posthog-js 1.444.4 → 1.445.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/integrity.json +52 -0
- package/dist/lazy-recorder.js +1 -1
- package/dist/loader-bootstrap.js +1 -1
- package/dist/loader-bootstrap.js.map +1 -1
- package/dist/loader.js +1 -1
- package/dist/loader.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/module.full.cjs +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.no-external.cjs +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.no-external.cjs +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/src/utils/loader-script.d.ts +1 -0
- package/dist/surveys-preview.js +1 -1
- package/dist/surveys.js +1 -1
- package/lib/package.json +2 -2
- package/lib/src/entrypoints/loader-bootstrap.js +9 -0
- package/lib/src/entrypoints/loader-bootstrap.js.map +1 -1
- package/lib/src/entrypoints/loader.js +8 -0
- package/lib/src/entrypoints/loader.js.map +1 -1
- package/lib/src/utils/loader-script.d.ts +1 -0
- package/lib/src/utils/loader-script.js +10 -0
- package/lib/src/utils/loader-script.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(){const e="u">typeof window?window:void 0,t="u">typeof globalThis?globalThis:e,i=null==t?void 0:t.navigator,n=null==t?void 0:t.document,s=null==t?void 0:t.location,r=null==t?void 0:t.fetch,o=(null==t?void 0:t.XMLHttpRequest)&&"withCredentials"in new t.XMLHttpRequest?t.XMLHttpRequest:void 0,a=null==t?void 0:t.AbortController,l=null==t?void 0:t.CompressionStream,c=null==i?void 0:i.userAgent,u="undefined"!=typeof globalThis?globalThis:e;u&&"undefined"==typeof self&&(u.self=u),u&&"undefined"==typeof File&&(u.File=function(){});const d=null!=e?e:{},h="$early_access_features",p="$active_feature_flags",g="$feature_flag_details",_="$feature_flag_errors",f="$feature_flag_evaluated_at",v="$feature_flag_request_id",m="$minimal_flag_called_events",y="$enabled_feature_flags",b="$stored_group_properties",S="$stored_person_properties",w="$flag_call_reported",k="$flag_call_reported_session_id",C="$feature_flag_payloads",x="$override_feature_flags",E="$override_feature_flag_payloads",I="visibilitychange",T="$autocapture_disabled_server_side",M="$surveys",P="$surveys_loaded_at",R="PostHog loadExternalDependency extension not found.",F="$surveys_activated",A="$surveys_activated_session",L="$surveys_activated_timestamps",O="$people_distinct_id",D="distinct_id",N="$device_id",B="$device_model",q="__alias",H="__cmpns",z="$fbc",U="$fbc_persistence",W="$fbp",j="$fbp_persistence",V="__timers",G="$heatmaps_enabled_server_side",Q="$exception_capture_enabled_server_side",K="$error_tracking_suppression_rules",J="$error_tracking_capture_extension_exceptions",Z="$web_vitals_enabled_server_side",Y="$dead_clicks_enabled_server_side",X="$product_tours_enabled_server_side",ee="$logs_capture_enabled_server_side",te="$web_vitals_allowed_metrics",ie="$session_recording_remote_config",ne="$session_recording_enabled_server_side",se="$replay_sample_rate",re="$replay_override_sampling",oe="$replay_override_linked_flag",ae="$replay_override_url_trigger",le="$replay_override_event_trigger",ce="$sesid",ue="$session_is_sampled",de="$session_past_minimum_duration",he="$session_recording_url_trigger_activated_session",pe="$session_recording_event_trigger_activated_session",ge="$posthog_sr_group_event_trigger_",_e="$posthog_sr_group_url_trigger_",fe="$posthog_sr_group_sampling_",ve="$debug_first_full_snapshot_timestamp",me="$sess_rec_flush_size",ye="$groups",be="ph_product_tours",Se="$product_tours_activated",we="$product_tours_activated_session",ke="$conversations_widget_session_id",Ce="$conversations_ticket_id",xe="$conversations_widget_state",Ee="$conversations_user_traits",Ie="$user_state",Te="$client_session_props",Me="$capture_rate_limit",Pe="$initial_campaign_params",Re="$initial_referrer_info",Fe="$initial_person_info",Ae="$epp",Le="$posthog_cookieless",Oe="$cookieless_mode",De="$sdk_debug_extensions_init_method",$e="$sdk_debug_extensions_init_time_ms",Ne="$sdk_debug_recording_script_not_loaded",Be="$sdk_debug_replay_stale_config",qe="$sdk_debug_replay_event_trigger_status",He="$sdk_debug_replay_linked_flag_trigger_status",ze="$sdk_debug_replay_matched_recording_trigger_groups",Ue="$sdk_debug_replay_pending_trigger_conditions",We="$sdk_debug_replay_remote_trigger_matching_config",je="$sdk_debug_replay_trigger_groups_count",Ve="$sdk_debug_replay_url_trigger_status",Ge="$sdk_debug_rrweb_attached",Qe="$sdk_debug_rrweb_start_attempted",Ke="$session_recording_start_reason",Je="anonymous",Ze="identified",Ye="identified_only",Xe="beforeunload",et="$pageview",tt="$pageleave",it="$identify",nt="$groupidentify";function st(e,t,i,n,s,r,o){try{var a=e[r](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(n,s)}function rt(e){return function(){var t=this,i=arguments;return new Promise(function(n,s){var r=e.apply(t,i);function o(e){st(r,n,s,o,a,"next",e)}function a(e){st(r,n,s,o,a,"throw",e)}o(void 0)})}}function ot(e){return ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ot(e)}function at(e,t,i){return(t=function(e){var t=function(e){if("object"!=ot(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=ot(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ot(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function lt(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function ct(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?lt(Object(i),!0).forEach(function(t){at(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):lt(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}var ut=function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysInProgress="surveys_in_progress",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e}({}),dt=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({});const ht="min_length",pt="max_length",gt=["$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"],_t=["token"];function ft(e,t){return-1!==e.indexOf(t)}const vt=function(e){return e.trim()},mt=function(e){return e.replace(/^\$/,"")};function yt(e){var t;const i=[];return null!==(t=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(t))return"[Circular]";i.push(t)}return t}}))&&void 0!==t?t:"null"}const bt=Object.prototype,St=bt.hasOwnProperty,wt=bt.toString,kt=Array.isArray||function(e){return"[object Array]"===wt.call(e)},Ct=e=>"function"==typeof e,xt=e=>e===Object(e)&&!kt(e),Et=e=>{if(xt(e)){for(const t in e)if(St.call(e,t))return!1;return!0}return!1},It=e=>void 0===e,Tt=e=>"[object String]"==wt.call(e),Mt=e=>Tt(e)&&0===e.trim().length,Pt=e=>null===e,Rt=e=>It(e)||Pt(e),Ft=e=>"[object Number]"==wt.call(e)&&e==e,At=e=>Ft(e)&&e>0,Lt=e=>"[object Boolean]"===wt.call(e),Ot=e=>e instanceof FormData,Dt=e=>ft(gt,e),$t=e=>ft(_t,e);function Nt(e){return null===e||"object"!=typeof e}function Bt(e,t){return{}.toString.call(e)===`[object ${t}]`}function qt(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return zt(e,Error)}}function Ht(e){return"u">typeof Event&&zt(e,Event)}function zt(e,t){try{return e instanceof t}catch(e){return!1}}const Ut=[!0,"true",1,"1","yes"],Wt=e=>ft(Ut,e),jt=[!1,"false",0,"0","no"],Vt=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","lightpanda","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Gt=new Map,Qt=function(e,t=[]){if(!e)return!1;const i=function(e,t){let i="";for(let e=0;t.length>e;e++){const n=t[e];i+=n.length+":"+n}return e.length+":"+e+"|"+t.length+":"+i}(e,t),n=Gt.get(i);if(void 0!==n)return n;const s=e.toLowerCase(),r=Vt.concat(t).some(e=>-1!==s.indexOf(e.toLowerCase()));return 256>Gt.size||Gt.clear(),Gt.set(i,r),r};function Kt(e,t,i,n,s){return t>i&&(n.warn("min cannot be greater than max."),t=i),Ft(e)?e>i?(n.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(n.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(n.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Kt(null!=s?s:i,t,i,n))}var Jt=class{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=Kt(e.bucketSize,0,100,e._logger),this._refillRate=Kt(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=Kt(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){const i=Math.floor((t-e.lastAccess)/this._refillInterval);i>0&&(e.tokens=Math.min(e.tokens+i*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+i*this._refillInterval)}consumeRateLimit(e){var t;const i=Date.now(),n=String(e);let s=this._buckets[n];return s?this._applyRefill(s,i):(s={tokens:this._bucketSize,lastAccess:i},this._buckets[n]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null===(t=this._onBucketRateLimited)||void 0===t||t.call(this,e)),0===s.tokens)}stop(){this._buckets={}}};const Zt="Mobile",Yt="Android",Xt="Tablet",ei="Android Tablet",ti="iPad",ii="Apple Watch",ni="Safari",si="BlackBerry",ri="Samsung Internet",oi="Chrome",ai="Chrome iOS",li="Internet Explorer",ci="Internet Explorer Mobile",ui="Opera",di="Microsoft Edge",hi="Firefox",pi="Firefox iOS",gi="Nintendo",_i="PlayStation",fi="Xbox",vi="Android Mobile",mi="Mobile Safari",yi="Windows",bi="Windows Phone",Si="Nokia",wi="Ouya",ki="Generic "+Zt.toLowerCase(),Ci="Generic "+Xt.toLowerCase(),xi="Konqueror",Ei="Oculus Browser",Ii="Vivaldi",Ti="Yandex",Mi="Whale",Pi="DuckDuckGo",Ri="Pale Moon",Fi="Waterfox",Ai="Brave",Li="Claude",Oi="Codex",Di="ChatGPT",$i="Google Search App",Ni=new RegExp("Version/(\\d+(\\.\\d+)?)"),Bi=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),qi=new RegExp(fi,"i"),Hi=new RegExp("PlayStation \\w+","i"),zi=new RegExp("Nintendo \\w+","i"),Ui=new RegExp("BlackBerry|PlayBook|BB10","i"),Wi={"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"},ji=function(e,t,i,n){t=t||"";const s=function(e){return(null==e?void 0:e.brave)?Ai:null}(i);return s||((null==n?void 0:n.detectGoogleSearchApp)&&ft(e,"GSA/")?$i:ft(e," OPR/")&&ft(e,"Mini")?"Opera Mini":ft(e," OPR/")?ui:Ui.test(e)?si:ft(e,"IEMobile")||ft(e,"WPDesktop")?ci:ft(e,"OculusBrowser")?Ei:ft(e,"SamsungBrowser")?ri:ft(e,"Edge")||ft(e,"Edg/")?di:ft(e,"Vivaldi/")?Ii:ft(e,"YaBrowser/")?Ti:ft(e,"Whale/")?Mi:ft(e,"DuckDuckGo/")||ft(e,"Ddg/")?Pi:ft(e,"Claude/")?Li:ft(e,"Codex/")?Oi:ft(e,"ChatGPT/")?Di:ft(e,"FBIOS")?"Facebook Mobile":ft(e,"UCWEB")||ft(e,"UCBrowser")?"UC Browser":ft(e,"CriOS")?ai:ft(e,"CrMo")||ft(e,oi)?oi:ft(e,Yt)&&ft(e,ni)?vi:ft(e,"FxiOS")?pi:ft(e.toLowerCase(),xi.toLowerCase())?xi:ft(e,"Brave/")?Ai:((e,t)=>t&&ft(t,"Apple")||function(e){return ft(e,ni)&&!ft(e,oi)&&!ft(e,Yt)}(e))(e,t)?ft(e,Zt)?mi:ni:ft(e,"PaleMoon/")?Ri:ft(e,"Waterfox/")?Fi:ft(e,hi)?hi:ft(e,"MSIE")||ft(e,"Trident/")?li:ft(e,"Gecko")?hi:"")},Vi={[ci]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[di]:[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],[mi]:[Ni],[ui]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[hi]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[pi]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[xi]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[si]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Ni],[vi]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ri]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Ei]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ti]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Mi]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ai]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Li]:[Bi],[Oi]:[Bi],[Di]:[Bi],[Pi]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ri]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Fi]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[$i]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[li]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Gi=function(e,t,i,n){const s=ji(e,t,i,n),r=Vi[s];if(It(r))return null;for(let t=0;r.length>t;t++){const i=e.match(r[t]);if(i)return parseFloat(i[i.length-2])}return null},Qi=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[fi,e&&e[1]||""]],[new RegExp(gi,"i"),[gi,""]],[new RegExp(_i,"i"),[_i,""]],[Ui,[si,""]],[new RegExp(yi,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[bi,""];if(new RegExp(Zt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let e=Wi[i[1]]||"";return/arm/i.test(t)&&(e="RT"),[yi,e]}return[yi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=It(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Yt,[e[2],e[3],e[4]||"0"].join(".")]:[Yt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Ki=function(e){for(let t=0;Qi.length>t;t++){const[i,n]=Qi[t],s=i.exec(e),r=s&&(Ct(n)?n(s,e):n);if(r)return r}return["",""]},Ji=function(e){return zi.test(e)?gi:Hi.test(e)?_i:qi.test(e)?fi:new RegExp(wi,"i").test(e)?wi:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?bi:/iPad/.test(e)?ti:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ii:Ui.test(e)?si:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Si,"i").test(e)?Si:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Zt).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Yt:ei:new RegExp("(pda|Mobile)","i").test(e)?ki:new RegExp(Xt,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?Ci:""},Zi=function(e,t){var i;const n=Ji(e);return n===ti||n===ei||"Kobo"===n||"Kindle Fire"===n||n===Ci?Xt:n===gi||n===fi||n===_i||n===wi?"Console":n===ii?"Wearable":n?Zt:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!==(i=null==t?void 0:t.maxTouchPoints)&&void 0!==i?i:0)>0?600>Math.min(null!==(s=null==t?void 0:t.screenWidth)&&void 0!==s?s:0,null!==(r=null==t?void 0:t.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==t?void 0:t.devicePixelRatio)&&void 0!==o?o:1)?Zt:Xt:"Desktop";var 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"]],en="[Truncated]",tn="[Unserializable]";function nn(e){let t="";for(let i=0;e.length>i;i++){const n=e.charCodeAt(i);if(55296>n||n>56319)t+=56320>n||n>57343?e[i]:"�";else{const n=e.charCodeAt(i+1);56320>n||n>57343?t+="�":(t+=e[i]+e[i+1],i++)}}return t}function sn(e,t){if(!t)return e;let i=[];try{i=Object.keys(t)}catch(e){i=[]}for(const n of i){let i;try{i=t[n]}catch(e){i=tn}Object.defineProperty(e,n,{value:i,enumerable:!0,writable:!0,configurable:!0})}return e}Date,Date;const rn=3e5;var on=class{record(e){if("too-large"===e.kind)return;if("retry-later"!==e.kind)return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),i=Date.now(),n=Math.min(e.retryAfterMs,rn);if(!t)return this._installedAt=i,void(this._until=i+n);this._until=Math.max(this._until,Math.min(i+n,this._installedAt+rn))}remainingMs(){const e=Date.now();if(this._installedAt-5e3>e)return this.reset(),0;const t=Math.min(rn,Math.max(0,this._until-e));return 0===t&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this._until=0,this._installedAt=0}constructor(){this._until=0,this._installedAt=0}};const an=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ln(e,t){return"string"==typeof(i=e)&&an.test(i)?e:t();var i}function cn(e,t){const i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return i}function un(e){return e?e.split("#")[0]:e}function dn(e){try{return e()}catch(e){return}}function hn(e,t){const i=setTimeout(e,t);return null!=i&&i.unref&&(null==i||i.unref()),i}function pn(e,t,i){return gn.apply(this,arguments)}function gn(){return(gn=rt(function*(e,t,i){let n;try{return yield Promise.race([e,new Promise((e,s)=>{n=hn(()=>{try{null==i||i(),e()}catch(e){s(e)}},t)})])}finally{clearTimeout(n)}})).apply(this,arguments)}let _n,fn,vn,mn;function yn(e){var t;const i=globalThis._posthogChunkIds,n=globalThis._debugIds;if(!i&&!n)return;const s=i?Object.keys(i):[],r=n?Object.keys(n):[];if(mn&&bn(i,s,fn)&&bn(n,r,vn))return mn;fn=i?ct({},i):void 0,vn=n?ct({},n):void 0,mn={},null!==(t=_n)&&void 0!==t||(_n={});const o=(t,i)=>{for(const s of t){const t=i[s];if(!t)continue;const r=null==_n?void 0:_n[s];if(r){mn[r]=t;continue}const o=e(s);for(let e=o.length-1;e>=0;e--){var n;const i=null===(n=o[e])||void 0===n?void 0:n.filename;if(i){mn[i]=t,_n[s]=i;break}}}};return n&&o(r,n),i&&o(s,i),mn}function bn(e,t,i){return e&&i?t.length===Object.keys(i).length&&t.every(t=>e[t]===i[t]):e===i}var Sn=class{constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t={}){const i=t&&t.mechanism||{handled:!0,type:"generic"},n=this.buildCoercingContext(i,t,0).apply(e),s=this.buildParsingContext(t),r=this.parseStacktrace(n,s);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(e){var t=this;return rt(function*(){for(const i of e)i.stacktrace&&i.stacktrace.frames&&kt(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null===(t=e.syntheticException)||void 0===t?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i;let n,s;if(null!=e.cause&&(n=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack)try{s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch(e){}return ct(ct({},e),{},{cause:n,stack:s,errors:null===(i=e.errors)||void 0===i?void 0:i.map(e=>this.parseStacktrace(e,t))})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(const i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return rt(function*(){let i=e;for(const e of t.modifiers)i=yield e(i);return i})()}convertToExceptionList(e,t){const i=[],n=(e,s,r)=>{var o;const a=i.length,l=void 0===s?ct(ct({type:"string"==typeof t.type&&t.type.length>0?t.type:"generic"},"boolean"==typeof t.handled?{handled:t.handled}:void 0===t.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof t.synthetic?t.synthetic:e.synthetic,exception_id:a}):{type:"chained",source:r,synthetic:e.synthetic,exception_id:a,parent_id:s},c={type:e.type,value:e.value,mechanism:l};e.stack&&(c.stacktrace={type:"raw",frames:e.stack}),i.push(c),e.cause&&n(e.cause,a,"cause");for(const t of null!==(o=e.errors)&&void 0!==o?o:[])n(t,a,"member")};return n(e),i}buildParsingContext(e){var t;return{chunkIdMap:yn(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}getAggregateErrors(e){try{if(qt(e)){let i=Object.getPrototypeOf(e);for(let n=0;i&&100>n;n++){var t;const n=null===(t=Object.getOwnPropertyDescriptor(i,"constructor"))||void 0===t?void 0:t.value;if("function"==typeof n&&"AggregateError"===n.name){const t=e.errors;return kt(t)?t:void 0}i=Object.getPrototypeOf(i)}}}catch(e){}}buildCoercingContext(e,t,i=0){let n=0,s=0,r=!1;const o=new Set,a=[],l={},c=(e,t,i=0)=>{const c=u(t,i),d=c.apply;if(c.apply=t=>{a.push(e);try{return d(t)}finally{a.pop()}},i>4||i>0&&-1!==a.indexOf(e))return this.coerceFallback(c);const h="object"==typeof e&&null!==e||"function"==typeof e;if(0===i&&n>=50||h&&o.has(e))return;h&&o.add(e),0===i&&n++;const p=this.getAggregateErrors(e);let g,_;r||(r=!!p);try{if(g=this.applyCoercers(e,c),!g)throw l}catch(e){if(e===l)return void(0===i&&n--);if(!r)throw e;g=this.coerceFallback(c)}if(!p||n>=50)return g;try{_=p.length}catch(e){return g}if(!Number.isInteger(_)||0>_||_>4294967295)return g;const f=[];for(let e=0;50>n&&1e3>s&&_>e;e++){let i;s++;try{i=c.next(p[e])}catch(e){n++,i=this.coerceFallback(u(t+1))}i&&f.push(i)}return ct(ct({},g),{},{errors:f})},u=(i,n=0)=>ct(ct({},t),{},{syntheticException:0==i?t.syntheticException:void 0,mechanism:0==i?e:{},apply(e){const t=c(e,i,n+1);if(!t)throw l;return t},next:e=>c(e,i+1)}),d=u(i);return ct(ct({},d),{},{apply:e=>{var t;return null!==(t=c(e,i))&&void 0!==t?t:this.coerceFallback(d)}})}};const wn=/^([a-z][a-z0-9.+-]+):/i,kn=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function Cn(e){if(!e||"<anonymous>"===e)return!1;const t=wn.exec(e);return!t||kn.includes(t[1].toLowerCase())}function xn(e,t,i,n,s){const r={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:Cn(t)};return It(n)||(r.lineno=n),It(s)||(r.colno=s),r}const En=(e,t)=>{const i=-1!==e.indexOf("safari-extension"),n=-1!==e.indexOf("safari-web-extension");return i||n?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},In=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Tn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Mn=/\((\S*)(?::(\d+))(?::(\d+))\)/,Pn=(e,t)=>{const i=In.exec(e);if(i){const[,e,n,s]=i;return xn(t,e,"?",+n,+s)}const n=Tn.exec(e);if(n){if(n[2]&&0===n[2].indexOf("eval")){const e=Mn.exec(n[2]);e&&(n[2]=e[1],n[3]=e[2],n[4]=e[3])}const[e,i]=En(n[1]||"?",n[2]);return xn(t,i,e,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,Fn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,An=(e,t)=>{const i=Rn.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const e=Fn.exec(i[3]);e&&(i[1]=i[1]||"eval",i[3]=e[1],i[4]=e[2],i[5]="")}let e=i[3],n=i[1]||"?";return[n,e]=En(n,e),xn(t,e,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Ln=/\(error: (.*)\)/;function On(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function Dn(e){for(let t=1;10>=t;t++){const i=e.length-2*t;if(0>i)break;let n=!0;for(let s=0;t>s;s++)if(!On(e[i+s],e[i+t+s])){n=!1;break}if(n){for(let n=0;t>n;n++)e[i+n]=e[i+t+n];return e.length=i+t,{start:i,length:t}}}}function $n(e,t){const i=t.start+t.length,n=Bn(e,t);n&&e.splice(i+n===e.length?i:t.start,n)}function Nn(e,t){let i=t.start;for(;i>0&&On(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function Bn(e,t){const i=t.start+t.length;let n=i;for(;e.length>n&&On(e[n],e[n-t.length]);)n++;return n-i}function qn(e,t){const i=t[0];let n=e.length-(i?Nn(e,i):0);for(const i of t)n-=Bn(e,i);return n}function Hn(e,t,i){for(let n=0;e.length>n;n++){const s=e[(t+n)%e.length],r=e[(i+n)%e.length];if(s!==r)return r>s}return!1}var zn=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const i=Tt(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Bt(e,"DOMException")}isDOMError(e){return Bt(e,"DOMError")}},Un=class{match(e){return qt(e)}coerce(e,t){var i;const n=this.getStack(e),s=void 0===n?null===(i=t.syntheticException)||void 0===i?void 0:i.stack:void 0,r=!!s;return{type:this.getType(e),value:this.getMessage(e,t),stack:null!=n?n:s,cause:e.cause?t.next(e.cause):void 0,synthetic:r}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){try{const t=e.stacktrace;if("string"==typeof t&&t.length>0)return t;const i=e.stack;return"string"==typeof i&&i.length>0?i:void 0}catch(e){return}}},Wn=class{match(e){return!!Bt(e,"ErrorEvent")&&(null!=e.error||this._hasUsableMessage(e))}coerce(e,t){var i;if(null!=e.error)return t.apply(e.error);const n=t.apply(e.message);return ct(ct({},n),{},{stack:null!==(i=this._buildLocationStack(e))&&void 0!==i?i:n.stack,synthetic:!0})}_hasUsableMessage(e){return Tt(e.message)&&e.message.length>0}_buildLocationStack(e){var t,i;const n=e,s=null!==(t=n.lineno)&&void 0!==t?t:0,r=null!==(i=n.colno)&&void 0!==i?i:0;if(Tt(n.filename)&&0!==n.filename.length&&0!==s)return`Error\n at ${n.filename}:${s}:${r}`}};const jn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Vn=class{match(e){return"string"==typeof e}coerce(e,t){var i;const[n,s]=this.getInfos(e);return{type:null!=n?n:"Error",value:null!=s?s:e,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e;const n=e.match(jn);return n&&(t=n[1],i=n[2]),[t,i]}};const Gn=["fatal","error","warning","log","info","debug"];function Qn(e,t=40){const i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(let e=i.length;e>0;e--){const n=i.slice(0,e).join(", ");if(t>=n.length)return e===i.length?n:n.length>t?`${n.slice(0,t)}...`:n}return""}var Kn=class{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,n;const s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:null!==(i=this.getStack(e))&&void 0!==i?i:null===(n=t.syntheticException)||void 0===n?void 0:n.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Ht(e))return e.constructor.name;const t="name"in e?e.name:void 0;return Tt(t)&&!Mt(t)?t:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){let t=`'${e.name}' captured as exception`;return"message"in e&&"string"==typeof e.message&&(t+=` with message: '${e.message}'`),t}if("message"in e&&"string"==typeof e.message)return e.message;const t=this.getObjectClassName(e);return`${t&&"Object"!==t?`'${t}'`:"Object"} captured as exception with keys: ${Qn(e)}`}isSeverityLevel(e){return Tt(e)&&!Mt(e)&&Gn.indexOf(e)>=0}getStack(e){try{return Tt(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:Tt(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const i=e[t];if(qt(i))return i}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}},Jn=class{match(e){return Ht(e)}coerce(e,t){var i;const n=e.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${Qn(e)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Zn=class{match(e){return Nt(e)}coerce(e,t){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Yn=class{match(e){return Bt(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Ht(e))return!1;try{const t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i;const n=this.getUnhandledRejectionReason(e);return Nt(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}:t.apply(n)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}};const Xn="$message",es="$timestamp",ts=new Set([Xn,es]),is={enabled:!0,max_bytes:32768};function ns(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:is.enabled,max_bytes:rs(e.max_bytes,is.max_bytes)}:ct({},is)}var ss=class{constructor(e){this._entries=[],this._totalBytes=0,this._config=ns(e)}setConfig(e){this._config=ns(e),this._trimToMaxBytes()}add(e){const t=function(e){let t;try{t=yt(e)}catch(e){return}try{const e=JSON.parse(t);if(!xt(e))return;const i=e,n=i[Xn],s=i[es];if(!Tt(n)||0===n.trim().length)return;if(!Tt(s)&&!Ft(s))return;return{step:i,json:t}}catch(e){return}}(e);if(!t)return;const i=function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;const t=encodeURIComponent(e);let i=0;for(let e=0;t.length>e;e++)"%"===t[e]?(i+=1,e+=2):i+=1;return i}(t.json);i>this._config.max_bytes||(this._entries.push({step:t.step,bytes:i}),this._totalBytes+=i,this._trimToMaxBytes())}getAttachable(){return this._entries.map(e=>e.step)}clear(){this._entries=[],this._totalBytes=0}size(){return this._entries.length}_trimToMaxBytes(){for(;this._totalBytes>this._config.max_bytes&&this._entries.length>0;){const e=this._entries.shift();e&&(this._totalBytes-=e.bytes)}}};function rs(e,t){if(!Ft(e)||1/0===e||-1/0===e)return t;const i=Math.floor(e);return 0>i?t:i}const os=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function as(e){return"string"==typeof e||e}function ls(e){return"string"==typeof e?e:void 0}const cs=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],us="NativeGzipValidationError",ds=e=>e.length>=2&&31===e[0]&&139===e[1],hs=(e,t)=>e===dt.GZipJS||t===dt.GZipJS||"gzip"===t,ps=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),gs=e=>{if(!e||"object"!=typeof e)return!1;const t="name"in e?String(e.name):"";return ps(e)||t===us};let _s;const fs=e=>{throw cn(us,`Native gzip produced invalid output: ${e}`)},vs=function(){var e=rt(function*(e,t){18>e.size&&fs("too-short");const i=new Uint8Array(yield e.slice(0,10).arrayBuffer());ds(i)&&8===i[2]||fs("invalid-header");const n=new DataView(yield e.slice(e.size-8).arrayBuffer());n.getUint32(0,!0)!==(e=>{const t=(()=>{if(_s)return _s;_s=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)t=1&t?3988292384^t>>>1:t>>>1;_s[e]=t>>>0}return _s})();let i=4294967295;for(let n=0;e.length>n;n++)i=t[255&(i^e[n])]^i>>>8;return(4294967295^i)>>>0})(t)&&fs("invalid-crc");const s=t.length>>>0;n.getUint32(4,!0)!==s&&fs("invalid-size")});return function(t,i){return e.apply(this,arguments)}}();function ms(e){return ys.apply(this,arguments)}function ys(){return ys=rt(function*(e,t=!0,i){try{const t=(new TextEncoder).encode(e),i=new globalThis.CompressionStream("gzip"),s=i.writable.getWriter(),r=s.write(t).then(()=>s.close()).catch((n=rt(function*(e){try{yield s.abort(e)}catch(e){}throw e}),function(e){return n.apply(this,arguments)})),o=new Response(i.readable).blob(),[a]=yield Promise.all([o,r]);return yield vs(a,t),a}catch(e){if(null==i?void 0:i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}var n}),ys.apply(this,arguments)}function bs(e,t){if(null==e)return{};var i,n,s=function(e,t){if(null==e)return{};var i={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;i[n]=e[n]}return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;r.length>n;n++)t.includes(i=r[n])||{}.propertyIsEnumerable.call(e,i)&&(s[i]=e[i])}return s}const Ss="[redacted]",ws=/^[A-Za-z0-9+/\n\r]+=*$/,ks=/^[A-Za-z0-9_-]+={0,2}$/,Cs=/[-_]/,xs=/^data:[^,\s]*;base64,/i,Es=/^[A-Za-z0-9+/_-]+={0,2}$/,Is=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,Ts=/^(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,Ps=/[\s<>"]/,Rs=new RegExp(Ms.source,"i"),Fs=/[a-z][a-z0-9+.-]{0,63}:\/\//i,As=new RegExp(`^${Fs.source}`,"i"),Ls=new RegExp(Fs.source,"gi"),Os=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,Ds=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,$s=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,Ns=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,Bs=/\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,qs=/(^|[^\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,Hs=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,zs=/\b\d(?:[ ./-]?\d){12,}\b/g,Us=/\d+/g,Ws=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,js=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function Vs(e){return function(e){return Ts.test(e)}(e)||Os.test(e)||Ds.test(e)}function Gs(e){return e.split("&",129).length>128}function Qs(e,t,i){return Vs(e)||t.includes(";")&&function(e){return e.split(";").some(e=>Vs(e.split("=",1)[0]))}(t)?Ss:Rs.test(t)?i?er(t,{allowNestedUrls:!1,stripPunctuation:!0}):Ss:t}function Ks(e,t){const i=new URLSearchParams;let n=!1,s=!1;for(const[r,o]of new URLSearchParams(e)){const e=tr(r),a=tr(o);n||(n=e!==r||a!==o);const l=Qs(e,a,t);n||(n=l!==a),s=Vs(e)||l!==a,i.append(e,l)}return{changed:n,lastFieldSensitive:s,serialized:i.toString()}}function Js(e,t){if(!e.includes("="))return{value:Zs(e,t),lastFieldSensitive:!1};const i=Ks(e,t);return{value:i.changed?i.serialized:e,lastFieldSensitive:i.lastFieldSensitive}}function Zs(e,t){return t?er(e,{allowNestedUrls:!1,stripPunctuation:!0}):Rs.test(e)?Ss:e}function Ys(e,t,i){return"#"===e?!t.fragment&&(t.fragment=!0):"?"===e&&(t.fragment?"="!==i&&!t.fragmentQuery&&(t.fragmentQuery=!0):!t.query&&(t.query=!0))}function Xs(e,t){var i;if(e.length>8192&&As.test(e))return Ss;const{address:n,suffix:s}=t.stripPunctuation?function(e){let t=e.length;for(;t>0&&".,;:!?)]}'".includes(e[t-1]);)t--;return{address:e.slice(0,t),suffix:e.slice(t)}}(e):{address:e,suffix:""};let r;try{r=new URL(n)}catch(e){return Ss+s}const o=r.search.slice(1),a=""!==r.hash,l=function(e){const t=e.slice(1),i=t.indexOf("?");return 0>i?{head:t,tail:null}:{head:t.slice(0,i),tail:t.slice(i+1)}}(r.hash);if(Gs(o)||Gs(l.head)||Gs(null!==(i=l.tail)&&void 0!==i?i:""))return Ss+s;let c=!1;(r.username||r.password)&&(r.username=Ss,r.password="",c=!0);const u=Ks(o,t.allowNestedUrls);u.changed&&(r.search=u.serialized,c=!0);const d=Js(l.head,t.allowNestedUrls),h=null===l.tail?null:(p=l.tail,d.lastFieldSensitive?{value:""===p?"":Ss,lastFieldSensitive:!0}:Js(p,t.allowNestedUrls));var p;const g=null===h?d.value:`${d.value}?${h.value}`;g!==r.hash.slice(1)&&(r.hash=g,c=!0);const _=a?null!=h?h:d:u;return(c?tr(r.toString()):n)+(_.lastFieldSensitive?"":s)}function er(e,t){return e.replace(Ms,i=>function(e,t){const i=function(e){if(!e.includes("://"))return[];const t=[...e.matchAll(Ls)].map(e=>e.index),i=[],n={query:!1,fragment:!1,fragmentQuery:!1};let s=0,r=!1,o="";for(let a=0;e.length>a&&t.length>s;a++){t[s]===a&&(a>0&&"="!==o&&i.push(a),s++);const l=e[a];Ys(l,n,o)?(o=l,r=!0):r&&"=&".includes(l)&&(o=l)}return i}(e);if(0===i.length)return Xs(e,t);let n="",s=0;for(const r of i)n+=Xs(e.slice(s,r),ct(ct({},t),{},{stripPunctuation:!1})),s=r;return n+Xs(e.slice(s),t)}(i,ct(ct({},t),{},{stripPunctuation:t.stripPunctuation&&i.length!==e.length})))}function tr(e){return e.replace(Is,Ss)}function ir(e,t){return function(e){return e.length>=10240&&(ws.test(e)||function(e){const t=xs.exec(e);if(!t)return!1;let i;try{i=decodeURIComponent(e.slice(t[0].length))}catch(e){return!1}return Es.test(i.replace(/[\r\n]/g,""))}(e)||Cs.test(e)&&ks.test(e))}(e)?"[binary data redacted - not supported by PostHog MCP analytics]":function(e,t,i){const n=4*i.maxStringLength;if(e.length>n){const s=t(e.slice(0,function(e,t){let i=t;for(;i>0&&!Ps.test(e[i-1]);)i--;return i}(e,n)));if(s.length>=2*i.maxStringLength)return s+i.truncationSuffix}return t(e)}(e,e=>function(e){return er(e,{allowNestedUrls:!0,stripPunctuation:!0})}(function(e){let t=e.replace($s," ");return t=t.replace(Ns,Ss),t=t.replace(Bs,Ss),t=t.replace(qs,`$1${Ss}`),t=t.replace(zs,sr),t=t.replace(Hs,Ss),t=t.replace(Ws,`$1${Ss}`),t=t.replace(js,`$1${Ss}`),t}(tr(e))),t)}function nr(e){let t=0,i=!1;for(let n=e.length-1;n>=0;n--){let s=e.charCodeAt(n)-48;if(0>s||s>9)return!1;i&&(s*=2,s>9&&(s-=9)),t+=s,i=!i}return t%10==0}function sr(e){const t=[];for(let i=Us.exec(e);null!==i;i=Us.exec(e))t.push({digits:i[0],start:i.index,end:i.index+i[0].length});let i="",n=0,s=0;for(;t.length>s;){let r="",o=-1;for(let e=s;t.length>e&&(r+=t[e].digits,19>=r.length);e++)r.length>=13&&nr(r)&&(o=e);0>o?s++:(i+=e.slice(n,t[s].start)+Ss,n=t[o].end,s=o+1)}return i+e.slice(n)}const rr={}.propertyIsEnumerable;function or(e,t){try{return cr(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(e){return[]}}function ar(e,t,i,n){if(0>=i.remainingNodes)return{stringValue:en};if(i.remainingNodes--,Lt(e))return{boolValue:e};if("bigint"==typeof e)return function(e,t){const i=e.toString(),n=BigInt("9223372036854775808");return e>=n||-n>e?(null==t||t.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}(e,t);if("number"==typeof e){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};const i=BigInt(e).toString();return e>=0x8000000000000000||-0x8000000000000000>e?(null==t||t.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:e}}if("string"==typeof e)return{stringValue:nn(e)};if("function"==typeof e)return{stringValue:"[Function]"};if("symbol"==typeof e)return{stringValue:String(e)};if("object"==typeof e&&null!==e){if(i.ancestors.has(e))return{stringValue:"[Circular]"};if(n>=20)return{stringValue:en};if(e instanceof Date){const t=e.getTime(),i=Number.isFinite(t)?e.toISOString():String(e);return{stringValue:"string"==typeof i?nn(i):String(i)}}i.ancestors.add(e);try{try{const s=e.toJSON;if("function"==typeof s)return ar(s.call(e),t,i,n+1)}catch(e){}return kt(e)?{arrayValue:{values:lr(e,t,i,n+1)}}:{kvlistValue:{values:cr(e,t,i,n+1)}}}finally{i.ancestors.delete(e)}}return{stringValue:nn(String(e))}}function lr(e,t,i,n){const s=[],r=Math.min(e.length,1e3);let o=0;for(;r>o&&i.remainingNodes>0;o++)try{const r=o in e?e[o]:void 0;if(Rt(r))continue;s.push(ar(r,t,i,n))}catch(e){s.push({stringValue:tn})}return e.length>o&&s.push({stringValue:en}),s}function cr(e,t,i,n){const s=[];for(const r in e)if(rr.call(e,r)){if(!r){null==t||t.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=i.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=e[r];if(Pt(o)||It(o))continue;s.push({key:nn(r),value:ar(o,t,i,n)})}catch(e){s.push({key:nn(r),value:{stringValue:tn}})}}return s}function ur(e,t,i){return ct(ct(ct(ct({},sn({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}const dr=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function hr(e,t){const i=sn({},e),n={};for(const e of dr)({}).hasOwnProperty.call(i,e)&&(n[e]=i[e],delete i[e]);return[...or(i,t),...or(n,t)]}const pr={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 gr={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}},_r=gr.info;function fr(e){try{return nn(String(e))}catch(e){return tn}}function vr(e,t,i,n){const s=e.level||"info",{text:r,number:o}=gr[s]||_r,a=function(e=Date.now()){return String(e)+"000000"}(Ft(n)?n:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),Rt(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),Rt(t.lastActivityTimestamp)||(l.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(l["url.full"]=t.currentUrl),t.screenName&&(l["screen.name"]=t.screenName),t.appState&&(l["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(l.feature_flags=t.activeFeatureFlags);const c=ct({},l),u=e.attributes;if(u){let e=[];try{e=Object.keys(u)}catch(t){e=[]}for(const t of e){let e;try{e=u[t]}catch(t){e=tn}Object.defineProperty(c,t,{value:e,enumerable:!0,writable:!0,configurable:!0})}}const d={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:r,body:{stringValue:fr(e.body)},attributes:or(c,i)};return e.trace_id&&(d.traceId=e.trace_id),e.span_id&&(d.spanId=e.span_id),It(e.trace_flags)||(d.flags=e.trace_flags),d}function mr(e,t,i){return ur(e,t,i)}function yr(e,t,i,n){return{resourceLogs:[{resource:{attributes:hr(t)},scopeLogs:[{scope:{name:i,version:n},logRecords:e}]}]}}var br=class{constructor(e){this._onFire=e,this._firesAt=0}get pending(){return!!this._timer}arm(e){this.clear(),this._firesAt=Date.now()+e,this._timer=hn(()=>{this._timer=void 0,this._onFire()},e)}armNoEarlierThan(e){this._timer&&Date.now()+e<=this._firesAt||this.arm(e)}clear(){this._timer&&(clearTimeout(this._timer),this._timer=void 0)}};function Sr(){return.75+.5*Math.random()}function wr(e,t,i,n){const s=Math.min(Math.max(0,t-1),6),r=e*Math.pow(2,s);return Math.round((void 0===n?r:Math.min(r,Math.max(n,e)))*i)}var kr=class{constructor(e,t,i,n,s,r=()=>Promise.resolve(),o){var a;this._instance=e,this._config=t,this._logger=i,this._getContext=n,this._onReady=s,this._waitForStoragePersist=r,this._scopeName=o,this._flushTimer=new br(()=>this._flushInBackground()),this._flushPromise=null,this._evictedSinceAdvance=0,this._queueGeneration=0,this._retryAfter=new on,this._consecutiveFlushFailures=0,this._flushJitter=1,this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._maxBufferSize=t.maxBufferSize,this._maxQueueSize=Math.max(null!==(a=t.maxQueueSize)&&void 0!==a?a:t.maxBufferSize,t.maxBufferSize),this._flushIntervalMs=t.flushIntervalMs,this._maxBatchRecordsPerPost=t.maxBatchRecordsPerPost,this._rateCapWindowMs=t.rateCapWindowMs,this._maxLogsPerInterval=t.maxLogsPerInterval}clearQueue(){this._queueGeneration++,this._instance.setPersistedProperty(ut.LogsQueue,[])}reset(){this._flushTimer.clear(),this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._consecutiveFlushFailures=0,this._flushJitter=1,this._retryAfter.reset(),this._maxBatchRecordsPerPost=this._config.maxBatchRecordsPerPost}onReconnect(){this._consecutiveFlushFailures=0,this._flushJitter=1,this._retryAfter.isOpen()?this._hasQueuedRecords()&&this._armFlushTimer():this._flushInBackground()}captureLog(e,t){var i;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==e?void 0:e.body))return;const n=this._runBeforeSend(e);if(null===n)return;if(!n.body)return void this._logger.info("Log was rejected in beforeSend function");if(!this._checkRateLimit())return;const s={record:vr(n,null!==(i=null==t?void 0:t.context)&&void 0!==i?i:this._getContext(),this._logger,null==t?void 0:t.occurredAtMs)};this._onReady(()=>this._enqueue(s))}_runBeforeSend(e){const t=this._config.beforeSend;if(!t)return e;const i=kt(t)?t:[t];let n=e;for(const e of i)try{const t=e(n);if(!t)return this._logger.info("Log was rejected in beforeSend function"),null;n=t}catch(e){return this._logger.error("Error in beforeSend function for log:",e),null}return n}_checkRateLimit(){if(void 0===this._maxLogsPerInterval)return!0;const e=Date.now(),t=e-this._intervalWindowStart;return this._rateCapWindowMs>t&&t>=0||(this._intervalWindowStart=e,this._intervalLogCount=0,this._droppedWarned=!1),this._maxLogsPerInterval>this._intervalLogCount?(this._intervalLogCount++,!0):(this._droppedWarned||(this._logger.warn(`captureLog dropping logs: exceeded ${this._maxLogsPerInterval} logs per ${this._rateCapWindowMs}ms`),this._droppedWarned=!0),!1)}flush(){var e=this;return rt(function*(){if(!e._instance.isDisabled)return e._flushPromise||(e._flushPromise=e._flushInner().finally(()=>{e._flushPromise=null})),e._flushPromise})()}_flushInner(){var e=this;return rt(function*(){var t;e._flushTimer.clear();let i=null!==(t=e._instance.getPersistedProperty(ut.LogsQueue))&&void 0!==t?t:[];if(0===i.length)return;const n=i.length;let s=0;for(;i.length>0&&n>s;){var r,o;const t=e._queueGeneration;e._evictedSinceAdvance=0;const n=Math.min(i.length,e._maxBatchRecordsPerPost),a=i.slice(0,n),l=yr(a.map(e=>e.record),e._buildResourceAttributes(),null!==(r=e._scopeName)&&void 0!==r?r:e._instance.getLibraryId(),e._instance.getLibraryVersion()),c=yield e._instance._sendLogsBatch(l);if(e._queueGeneration!==t)return;if("too-large"===c.kind&&a.length>1)e._maxBatchRecordsPerPost=Math.max(1,Math.floor(a.length/2)),e._logger.warn(`Logs batch of size ${a.length} was too large for the ingestion endpoint, reducing batch size to ${e._maxBatchRecordsPerPost}`);else{if(e._retryAfter.record(c),e._flushTimer.pending&&e._flushTimer.arm(Math.max(e._flushIntervalMs,e._retryAfter.remainingMs())),"retry-later"===c.kind)throw c.error;if("too-large"===c.kind?e._logger.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===c.kind&&e._config.maxBatchRecordsPerPost>e._maxBatchRecordsPerPost&&(e._maxBatchRecordsPerPost=Math.min(e._config.maxBatchRecordsPerPost,e._maxBatchRecordsPerPost+1)),yield e._persistQueueAdvance(a.length),i=null!==(o=e._instance.getPersistedProperty(ut.LogsQueue))&&void 0!==o?o:[],s+=a.length,"fatal"===c.kind)throw c.error}}})()}_persistQueueAdvance(e){var t=this;return rt(function*(){var i;const n=Math.max(0,e-t._evictedSinceAdvance),s=null!==(i=t._instance.getPersistedProperty(ut.LogsQueue))&&void 0!==i?i:[];t._instance.setPersistedProperty(ut.LogsQueue,s.slice(n)),yield t._waitForStoragePersist()})()}_buildResourceAttributes(){return mr(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion())}_enqueue(e){var t;if(this._instance.optedOut)return;const i=null!==(t=this._instance.getPersistedProperty(ut.LogsQueue))&&void 0!==t?t:[];this._maxQueueSize>i.length||(i.shift(),this._evictedSinceAdvance++,this._logger.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(ut.LogsQueue,i),this._maxBufferSize>i.length||this._retryAfter.isOpen()?this._armFlushTimer():this._flushInBackground()}_armFlushTimer(){this._flushTimer.pending||this._flushTimer.arm(Math.max(this._flushIntervalMs,this._retryAfter.remainingMs()))}_nextFlushDelay(){return Math.max(wr(this._flushIntervalMs,this._consecutiveFlushFailures,this._flushJitter,3e4),this._retryAfter.remainingMs())}_hasQueuedRecords(){const e=this._instance.getPersistedProperty(ut.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return rt(function*(){t._flushTimer.clear();const i=t.flush().catch(()=>{});void 0!==e?yield pn(i,e):yield i})()}flushWithTimeout(e){var t=this;return rt(function*(){const i=t.flush();yield pn(i,e,()=>{i.catch(()=>{})})})()}_flushInBackground(){this.flush().then(()=>{this._consecutiveFlushFailures=0,this._flushJitter=1},e=>{this._consecutiveFlushFailures++,this._flushJitter=Sr(),this._logger.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this._hasQueuedRecords()&&this._flushTimer.armNoEarlierThan(this._nextFlushDelay())})}};const Cr=/^[0-9a-f]+$/;function xr(e,t,i){return"string"==typeof e&&e.length===t&&e!==i&&Cr.test(e)}const Er=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;const Ir="00",Tr=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Mr(e){return String(e)+"000000"}function Pr(e,t,i,n){let s="";return n&&(s=Object.keys(n).sort().map(e=>`${JSON.stringify(e)}:${JSON.stringify(n[e])}`).join(",")),`${e}\0${t}\0${null!=i?i:""}\0${s}`}var Rr=class{constructor(e,t,i){this._instance=e,this._config=t,this._logger=i,this._series=new Map,this._flushTimer=new br(()=>this.flush().catch(e=>{this._logger.error("Metrics flush failed:",e)})),this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._retryAfter=new on,this._consecutiveFlushFailures=0,this._flushJitter=1,this._generation=0}count(e,t=1,i){this._capture({name:e,type:"count",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(e,t,i){this._capture({name:e,type:"gauge",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(e,t,i){this._capture({name:e,type:"histogram",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var e=this;const t=this._flushPromise,i=function(){var i=rt(function*(){t&&(yield t.catch(()=>{})),yield e._doFlush()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this._flushPromise===i&&(this._flushPromise=null)});return this._flushPromise=i,i}drainWindow(){if(0===this._series.size)return null;const e=this._series;return this._series=new Map,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._buildPayload(e)}reset(){this._generation++,this._retryAfter.reset(),this._consecutiveFlushFailures=0,this._flushJitter=1,this._flushTimer.clear(),this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set}_capture(e){if(this._instance.isDisabled||this._instance.optedOut)return;const t=this._runBeforeSend(e);if(null===t)return;if(!t.name||"string"!=typeof t.name)return void this._logger.warn("Dropping metric with empty name");if("number"!=typeof t.value||!Number.isFinite(t.value))return void this._logger.warn(`Dropping metric '${t.name}': value must be a finite number`);if("count"===t.type&&0>t.value)return void this._logger.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let i,n;try{i=t.attributes?ct({},t.attributes):void 0,n=Pr(t.type,t.name,t.unit,i)}catch(e){return void this._logger.warn(`Dropping metric '${t.name}': attributes could not be serialized`,e)}let s=this._series.get(n);if(!s){if(!this._admitNewSeries())return;s={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this._series.set(n,s)}const r=this._typeByName.get(t.name);void 0===r?this._typeByName.set(t.name,t.type):r===t.type||this._typeCollisionWarned.has(t.name)||(this._typeCollisionWarned.add(t.name),this._logger.warn(`Metric name '${t.name}' is already used as a ${r}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this._fold(s,t.value);const o=this._activeTraceContext();o&&(s.exemplar=ct(ct({},o),{},{value:t.value,timeMs:Date.now()})),this._armFlushTimer()}_activeTraceContext(){try{var e,t;const i=function(e){const t=function(e){if("string"!=typeof e)return;const t=Er.exec(e.trim());if(!t)return;const[,i,n,s,r,o]=t;return"ff"===i||"00"===i&&o||!function(e){return xr(e,32,"00000000000000000000000000000000")}(n)||!function(e){return xr(e,16,"0000000000000000")}(s)?void 0:{version:i,traceId:n,spanId:s,flags:r}}(e);return t&&{traceId:t.traceId,spanId:t.spanId,flags:(i=t.flags,1&parseInt(i,16)?"01":Ir)};var i}(null===(e=(t=this._instance).getActiveSpan)||void 0===e||null===(e=e.call(t))||void 0===e?void 0:e.traceparent());if(i&&"01"===i.flags)return{traceId:i.traceId,spanId:i.spanId}}catch(e){}}_admitNewSeries(){return this._config.maxSeriesPerFlush>this._series.size||(this._seriesCapWarned||(this._seriesCapWarned=!0,this._logger.warn(`Metric series cap reached (${this._config.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}_fold(e,t){switch(e.type){case"count":var i;e.total=(null!==(i=e.total)&&void 0!==i?i:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Tr.length+1).fill(0)});const i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[function(e,t){for(let i=0;t.length>i;i++)if(t[i]>=e)return i;return t.length}(t,Tr)]+=1;break}}}_runBeforeSend(e){const t=this._config.beforeSend;if(!t)return e;const i=kt(t)?t:[t];let n=e;for(const e of i)try{const t=e(n);if(!t)return this._logger.info("Metric was rejected in beforeSend function"),null;n=t}catch(e){return this._logger.error("Error in beforeSend function for metric:",e),null}return n}_armFlushTimer(){this._flushTimer.pending||this._flushTimer.arm(this._nextFlushDelay())}_nextFlushDelay(){return Math.max(wr(this._config.flushIntervalMs,this._consecutiveFlushFailures,this._flushJitter,3e4),this._retryAfter.remainingMs())}_doFlush(){var e=this;return rt(function*(){if(e._flushTimer.clear(),0===e._series.size)return;const t=e._series;e._series=new Map,e._seriesCapWarned=!1,e._typeByName=new Map,e._typeCollisionWarned=new Set;const i=e._generation,n=yield e._instance._sendMetricsBatch(e._buildPayload(t));if(i===e._generation)switch(e._retryAfter.record(n),"retry-later"===n.kind?(e._consecutiveFlushFailures++,e._flushJitter=Sr()):(e._consecutiveFlushFailures=0,e._flushJitter=1),e._flushTimer.pending&&e._flushTimer.arm(e._nextFlushDelay()),n.kind){case"ok":return;case"retry-later":return e._mergeWindowBack(t),void e._flushTimer.armNoEarlierThan(e._nextFlushDelay());case"too-large":return void e._logger.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e._logger.error("Failed to send metrics batch:",n.error)}})()}_buildPayload(e){return t=this._buildMetrics(e),i=function(e,t,i){return ur(e,t,i)}(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:hr(i)},scopeMetrics:[{scope:{name:n,version:s},metrics:t}]}]};var t,i,n,s}_buildMetrics(e){const t=Mr(Date.now()),i=new Map;for(const o of e.values()){var n;const e=Pr(o.type,o.name,o.unit,void 0);let a=i.get(e);a||(a=ct({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},i.set(e,a));const l=or(null!==(n=o.attributes)&&void 0!==n?n:{},this._logger),c=Mr(o.windowStartMs),u=Fr(o.exemplar);if("count"===o.type){var s;const e=ct({attributes:l,startTimeUnixNano:c,timeUnixNano:t,asDouble:null!==(s=o.total)&&void 0!==s?s:0},u);a.sum.dataPoints.push(e)}else if("gauge"===o.type){var r;const e=ct({attributes:l,timeUnixNano:t,asDouble:null!==(r=o.last)&&void 0!==r?r:0},u);a.gauge.dataPoints.push(e)}else if(o.hist){const e=ct({attributes:l,startTimeUnixNano:c,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Tr},u);a.histogram.dataPoints.push(e)}}return Array.from(i.values())}_mergeWindowBack(e){for(const[s,r]of e){var t;const e=this._series.get(s);if(e)switch(e.windowStartMs=Math.min(e.windowStartMs,r.windowStartMs),e.exemplar=null!==(t=e.exemplar)&&void 0!==t?t:r.exemplar,e.type){case"count":var i,n;e.total=(null!==(i=e.total)&&void 0!==i?i:0)+(null!==(n=r.total)&&void 0!==n?n:0);break;case"gauge":break;case"histogram":if(r.hist)if(e.hist){e.hist.count+=r.hist.count,e.hist.sum+=r.hist.sum,e.hist.min=Math.min(e.hist.min,r.hist.min),e.hist.max=Math.max(e.hist.max,r.hist.max);for(let t=0;e.hist.bucketCounts.length>t;t++)e.hist.bucketCounts[t]+=r.hist.bucketCounts[t]}else e.hist=r.hist}else this._admitNewSeries()&&this._series.set(s,r)}}};function Fr(e){return e?{exemplars:[{filteredAttributes:[],timeUnixNano:Mr(e.timeMs),asDouble:e.value,traceId:e.traceId,spanId:e.spanId}]}:{}}function Ar(e,t){if(!e)return;const i=e.find(e=>e.type===t);return null==i?void 0:i.value}const Lr="0.10.4",Or={DEBUG:!1,LIB_VERSION:Lr,LIB_NAME:"browser-common",JS_SDK_VERSION:Lr},Dr=(e,{debugEnabled:t}={})=>{const i={_log(i,...n){let s;try{s=typeof window>"u"?void 0:window}catch(e){return}s&&(Or.DEBUG||s.POSTHOG_DEBUG||t)&&!It(s.console)&&s.console&&("__rrweb_original__"in s.console[i]?s.console[i].__rrweb_original__:s.console[i])(e,...n)},debug(...e){i._log("debug",...e)},info(...e){i._log("log",...e)},warn(...e){i._log("warn",...e)},error(...e){i._log("error",...e)},critical(...t){console.error(e,...t)},uninitializedWarning(e){i.error(`You must initialize PostHog before calling ${e}`)},createLogger:(t,i)=>Dr(`${e} ${t}`,i)};return i},$r=Dr("[PostHog.js]"),Nr=$r.createLogger;function Br(e,t){kt(e)&&e.forEach(t)}function qr(e,t){if(!Rt(e))if(kt(e))e.forEach(t);else if(Ot(e))e.forEach((e,i)=>t(e,i));else for(const i in e)St.call(e,i)&&t(e[i],i)}const Hr=function(e,...t){for(const i of t)for(const t in i)void 0!==i[t]&&(e[t]=i[t]);return e};function zr(e){const t=Object.keys(e);let i=t.length;const n=new Array(i);for(;i--;)n[i]=[t[i],e[t[i]]];return n}const Ur=function(e){return function(...t){try{return e.apply(this,t)}catch(e){$r.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),$r.critical(e)}}},Wr=function(e){const t={};return qr(e,function(e,i){(Tt(e)&&e.length>0||Ft(e))&&(t[i]=e)}),t};function jr(e){const t=ct({},e);for(const i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch(e){}return t}const Vr=["herokuapp.com","vercel.app","netlify.app"];function Gr(e){const t=null==e?void 0:e.hostname;if(!Tt(t))return!1;const i=t.split(".").slice(-2).join(".");for(const e of Vr)if(i===e)return!1;return!0}function Qr(e,t,i,n){const{capture:s=!1,passive:r=!0}=null!=n?n:{};null==e||e.addEventListener(t,i,{capture:s,passive:r})}function Kr(e){return"ph_toolbar_internal"===e.name}const Jr=e=>{const t=typeof document>"u"?void 0:document,i=null==t?void 0:t.createElement("a");return It(i)?null:(i.href=e,i)},Zr=()=>{try{return"u">typeof window&&!1!==window.navigator.onLine}catch(e){return!1}},Yr=(e,t)=>e>=t&&Zr(),Xr=(e,t,i,n)=>{if(0===e){if(Zr()){const e=t+1;return e===i&&n(),e}return t}return 0},eo=["localhost","127.0.0.1"],to=(e,t)=>{try{let i;return JSON.stringify(e,(e,t)=>{var n;return qt(t)?(null!==(n=i)&&void 0!==n||(i=new WeakMap),i.has(t)||i.set(t,jr(t)),i.get(t)):"bigint"==typeof t?t.toString():t},t)}catch(t){return yt(e)}},io=function(e,t="&"){let i,n;const s=[];return qr(e,function(e,t){It(e)||It(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),n=encodeURIComponent(t),s[s.length]=n+"="+i)}),s.join(t)},no=function(e,t){const i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let n;for(let e=0;i.length>e;e++){const s=i[e].split(/=(.*)/);if(s[0]===t){n=s;break}}if(!kt(n)||2>n.length)return"";{let e=n[1].replace(/\+/g," ");try{e=decodeURIComponent(e)}catch(t){$r.error("Skipping decoding for malformed query param: "+e)}return e}},so=function(e,t,i){if(!e||!t||!t.length)return e;const n=e.split(/#(.*)/),s=n[1],r=(n[0]||"").split(/\?(.*)/),o=r[1],a=r[0],l=(o||"").split("&"),c=[];for(let e=0;l.length>e;e++){const n=l[e].split("?");let s=0;for(;n.length>s&&!t.includes(n[s].split("=")[0]);)s++;c.push(n.length>s?n.slice(0,s).concat(n[s].split("=")[0]+"="+i).join("?"):l[e])}let u=a;return null!=o&&(u+="?"+c.join("&")),null!=s&&(u+="#"+s),u},ro=function(e,t){const i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null};function oo(e,t){var i;const n=null==e||null===(i=e.config)||void 0===i?void 0:i.get_current_url;if(!Ct(n))return t;try{const e=n(t);return Tt(e)&&e?e:t}catch(e){return $r.error("Error in get_current_url, falling back to window.location.href",e),t}}function ao(e){var t;const i=typeof window>"u"?void 0:window,n=null==i||null===(t=i.location)||void 0===t?void 0:t.href;return It(n)?void 0:oo(e,n)}function lo(e){var t;return e instanceof Element&&("__POSTHOG_TOOLBAR__"===e.id||!!(null===(t=e.closest)||void 0===t?void 0:t.call(e,".toolbar-global-fade-container")))}function co(e){return!!e&&1===e.nodeType}function uo(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function ho(e){return!!e&&3===e.nodeType}function po(e){return!!e&&11===e.nodeType&&co(e.host)}function go(e){return e?vt(e).split(/\s+/):[]}function _o(e,t){const i=ao(t);return!!(i&&e&&e.some(e=>i.match(e)))}function fo(e){let t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return go(t)}function vo(e){return Rt(e)?null:vt(e).split(/(\s+)/).filter(e=>Ko(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function mo(e){let t="";return qo(e)&&!Ho(e)&&e.childNodes&&e.childNodes.length&&qr(e.childNodes,function(e){var i;ho(e)&&e.textContent&&(t+=null!==(i=vo(e.textContent))&&void 0!==i?i:"")}),vt(t)}function yo(e){var t;return It(e.target)?e.srcElement||null:(null===(t=e.target)||void 0===t?void 0:t.shadowRoot)?e.composedPath()[0]||null:e.target||null}const bo=["a","button","form","input","select","textarea","label"];function So(e,t){const i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch(e){return!1}}function wo(e,t){if(It(t))return!0;for(const i of e)if(t.some(e=>So(i,e)))return!0;return!1}function ko(e){const t=e.parentNode;return!(!t||!co(t))&&t}const Co=[".ph-no-autocapture","[data-ph-no-autocapture]"],xo=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],Eo=[...xo,"+","-","−","–"],Io=Eo.length+10,To=["button","a","input","select","textarea","label"],Mo=["button","link","tab","menuitem","option"],Po=(e,t)=>/[a-z0-9]/i.test(t)?ft(Eo,t)?new RegExp(`\\b${t}\\b`).test(e):e.includes(t):e===t,Ro=e=>ft(To,e.tagName.toLowerCase())||ft(Mo,(e.getAttribute("role")||"").toLowerCase());function Fo(e){let t="",i="";const n=e=>{co(e)&&qo(e)&&!Ho(e)&&(t+=` ${mo(e)}`,i=i||e.getAttribute("aria-label")||"",qr(e.childNodes,n))};n(e),t=vt(t.replace(/\s+/g," "));const s=(Ko(t)?t:"").toLowerCase(),r=e.getAttribute("aria-label")||(s?"":i);return{safeText:s,ariaLabel:vt(r).toLowerCase()}}const Ao=[".ph-no-deadclick",".ph-no-capture"],Lo=[".ph-no-rageclick",".ph-no-capture"],Oo=["","text","search","email","password","url","tel","number"];function Do(e){return!(!e||!co(e))&&(!!uo(e,"textarea")||(uo(e,"input")?ft(Oo,(e.getAttribute("type")||"").toLowerCase()):function(e){var t;if(e.isContentEditable)return!0;const i=null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return"true"===i||""===i}(e)))}function $o(e,t){if(!(typeof window>"u"?void 0:window)||No(e))return!1;let i,n,s;var r,o;if(Lt(t)?(i=!!t&&Lo,n=void 0,s=!1):(i=null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:Lo,n=null==t?void 0:t.content_ignorelist,s=null!==(o=null==t?void 0:t.ignore_text_selection)&&void 0!==o&&o),!1===i)return!1;if(s&&Do(e))return!1;const{targetElementList:a}=Bo(e,!1);return!(n&&function(e,{safeText:t,ariaLabel:i}){let n;if(!0===e)n=xo;else{if(!kt(e))return!1;if(e.length>Io)return $r.error(`[PostHog] content_ignorelist array cannot exceed ${Io} items. Use css_selector_ignorelist for more complex matching.`),!1;n=e.map(e=>e.toLowerCase())}return n.some(e=>Po(t,e)||Po(i,e))}(n,function(e,t){for(const e of t)if(Ro(e))return Fo(e);for(const e of t){try{var i;if("pointer"!==(null===(i=window)||void 0===i?void 0:i.getComputedStyle(e).getPropertyValue("cursor")))break}catch(e){break}const t=Fo(e);if(t.safeText||t.ariaLabel)return t}return Fo(e)}(e,a))||wo(a,i))}const No=e=>!e||uo(e,"html")||!co(e),Bo=(e,t)=>{const i=typeof window>"u"?void 0:window;if(!i||No(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const s=[e];let r=e;for(;r.parentNode&&!uo(r,"body");){if(po(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}const e=ko(r);if(!e)break;if(t||bo.indexOf(e.tagName.toLowerCase())>-1)n=!0;else try{const t=i.getComputedStyle(e);t&&"pointer"===t.getPropertyValue("cursor")&&(n=!0)}catch(e){}s.push(e),r=e}return{parentIsUsefulElement:n,targetElementList:s}};function qo(e){const t=new Set;let i=0;for(let n=e;n.parentNode&&!uo(n,"body");n=n.parentNode){if(i++>=1e3||t.has(n))return!1;t.add(n);const e=fo(n);if(ft(e,"ph-sensitive")||ft(e,"ph-no-capture"))return!1}if(ft(fo(e),"ph-include"))return!0;const n=e.type||"";if(Tt(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}const s=e.name||e.id||"";return!Tt(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 Ho(e){return!!(uo(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||uo(e,"select")||uo(e,"textarea")||"true"===e.getAttribute("contenteditable"))}const zo=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}))$"),Uo=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Wo=[16,15,14,13],jo=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Vo=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Go=/[0-9A-Za-z_]/;function Qo(e){let t=0,i=!1;for(let n=e.length-1;n>=0;n--){let s=e.charCodeAt(n)-48;i&&(s*=2,s>9&&(s-=9)),t+=s,i=!i}return t%10==0}function Ko(e,t=!0){if(Rt(e))return!1;if(Tt(e)){if(e=vt(e),t?zo.test((e||"").replace(/[- ]/g,"")):function(e){let t;for(Uo.lastIndex=0;t=Uo.exec(e);){const e=t[2];if(!e)continue;const i=e.replace(/[- ]/g,"");for(let e=0;i.length>e;e++)for(const t of Wo){const n=e+t;if(i.length>=n){const t=i.slice(e,n);if(zo.test(t)&&Qo(t))return!0}}}return!1}(e))return!1;if(t?jo.test(e):function(e){let t;for(Vo.lastIndex=0;t=Vo.exec(e);){const e=t[1],i=t[3];if(!(e&&i&&Go.test(e)&&Go.test(i)))return!0}return!1}(e))return!1}return!0}function Jo(e){let t=mo(e);return t=`${t} ${Zo(e)}`.trim(),Ko(t)?t:""}function Zo(e){let t="";return e&&e.childNodes&&e.childNodes.length&&qr(e.childNodes,function(e){var i;if(e&&"span"===(null===(i=e.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=mo(e);t=`${t} ${i}`.trim(),e.childNodes&&e.childNodes.length&&(t=`${t} ${Zo(e)}`.trim())}catch(e){$r.error("[AutoCapture]",e)}}),t}function Yo(e){return e.replace(/"|\\"/g,'\\"')}function Xo(e){const t=e.attr__class;if(t)return kt(t)?t:go(t)}const ea=1e6;function ta(e){var t;return Math.min(ea,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:ea)}const ia={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:ea,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},na=["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"],sa=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ra=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],oa=e=>{Rt(e)||qr(Object.keys(e),t=>{(e=>{const t=e.toLowerCase();return na.includes(t)||ra.some(e=>t.includes(e))})(t)&&(e[t]="redacted")})},aa=["/s/","/e/","/i/"];function la(e,t,i,n){if(Rt(e))return e;let s=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return Tt(s)&&(s=parseInt(s)),s>i?`[SessionRecording] ${n} body too large to record (${s} bytes)`:e}function ca(e,t){if(Rt(e))return e;let i=e;return Ko(i,!1)||(i="[SessionRecording] "+t+" body redacted"),qr(sa,e=>{(null==i?void 0:i.length)&&-1!==(null==i?void 0:i.indexOf(e))&&(i="[SessionRecording] "+t+" body redacted as might contain: "+e)}),i}const ua=new WeakSet,da="disabled",ha="sampled",pa="active",ga="buffering",_a="paused",fa="lazy_loading",va="rrweb_error",ma="trigger_activated",ya="trigger_pending",ba="trigger_disabled";function Sa(e,t,i,n,s,r){return 0===t?ba:(null==e?void 0:e.get_property(i?n+i:s))===r?ma:ya}function wa(e,t,i){return t.some(t=>{var n;return"regex"===t.matching&&(null!==(n=null==i?void 0:i.get(t.url))&&void 0!==n?n:new RegExp(t.url)).test(e)})}function ka(e){return e.includes("trigger_activated")?ma:e.includes("trigger_pending")?ya:ba}function Ca(e){const t=new Set(e);switch(t.delete(ba),t.size){case 0:return ba;case 1:return Array.from(t)[0];default:return ya}}var xa=class{constructor(e){this._matchers=e}triggerStatus(e){return ka(this._matchers.map(t=>t.triggerStatus(e)))}triggerStatusNoSideEffects(e){return ka(this._matchers.map(t=>t.triggerStatusNoSideEffects(e)))}stop(){this._matchers.forEach(e=>e.stop())}},Ea=class{constructor(e){this._matchers=e}triggerStatus(e){return Ca(this._matchers.map(t=>t.triggerStatus(e)))}triggerStatusNoSideEffects(e){return Ca(this._matchers.map(t=>t.triggerStatusNoSideEffects(e)))}stop(){this._matchers.forEach(e=>e.stop())}},Ia=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return ma}stop(){}};const Ta=e=>"sessionRecording"in e;var Ma=class{constructor(e,t){this._instance=e,this._urlTriggers=[],this._urlBlocklist=[],this._compiledTriggerRegexes=new Map,this._compiledBlocklistRegexes=new Map,this._lastCheckedUrl="",this.urlBlocked=!1,this._groupId=t}onConfig(e){var t,i;this._urlTriggers=(Ta(e)?xt(e.sessionRecording)?null===(t=e.sessionRecording)||void 0===t?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this._urlBlocklist=(Ta(e)?xt(e.sessionRecording)?null===(i=e.sessionRecording)||void 0===i?void 0:i.urlBlocklist:[]:null==e?void 0:e.urlBlocklist)||[],this._compileRegexCache()}_compileRegexCache(){this._compiledTriggerRegexes.clear(),this._compiledBlocklistRegexes.clear();for(const e of this._urlTriggers)if("regex"===e.matching&&!this._compiledTriggerRegexes.has(e.url))try{this._compiledTriggerRegexes.set(e.url,new RegExp(e.url))}catch(t){$r.error("Invalid URL trigger regex pattern:",e.url,t)}for(const e of this._urlBlocklist)if("regex"===e.matching&&!this._compiledBlocklistRegexes.has(e.url))try{this._compiledBlocklistRegexes.set(e.url,new RegExp(e.url))}catch(t){$r.error("Invalid URL blocklist regex pattern:",e.url,t)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return Sa(this._instance,this._urlTriggers.length,this._groupId,_e,he,e)}triggerStatus(e){const t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Ve]:t}),t}triggerStatusNoSideEffects(e){return this._urlTriggerStatus(e)}isCurrentUrlBlocked(){const e=ao(this._instance);if(!e)return!1;try{return wa(e,this._urlBlocklist,this._compiledBlocklistRegexes)}catch(e){return!0}}checkUrlBlocklist(e,t){const i=ao(this._instance);if(!i)return;if(i===this._lastCheckedUrl)return;this._lastCheckedUrl=i;const n=this.urlBlocked,s=wa(i,this._urlBlocklist,this._compiledBlocklistRegexes);n&&s||(s&&!n?e():!s&&n&&t())}checkUrlTriggerConditions(e,t,i,n){const s=ao(this._instance);if(!s)return;if(s===this._lastCheckedUrl)return;this._lastCheckedUrl=s;const r=this.urlBlocked,o=wa(s,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!r?e():!o&&r&&t();const a=this._urlTriggerStatus(n)===ma,l=wa(s,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&i("url",s)}stop(){this._lastCheckedUrl=""}},Pa=class{constructor(e){this._instance=e,this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{}}triggerStatus(){const e=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[He]:e}),e}triggerStatusNoSideEffects(){let e=ya;return Rt(this.linkedFlag)&&(e=ba),this.linkedFlagSeen&&(e=ma),e}onConfig(e,t){var i;if(this.linkedFlag=(Ta(e)?xt(e.sessionRecording)?null===(i=e.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==e?void 0:e.linkedFlag)||null,!Rt(this.linkedFlag)&&!this.linkedFlagSeen){const e=Tt(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=Tt(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags((n,s)=>{let r=!1;if(xt(s)&&e in s){const t=s[e];r=Lt(t)?!0===t:i?t===i:!!t}const o=r&&!this.linkedFlagSeen;this.linkedFlagSeen=r,o&&t(e,i)})}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}},Ra=class{constructor(e,t){this._instance=e,this._eventTriggers=[],this._groupId=t}onConfig(e){var t;this._eventTriggers=(Ta(e)?xt(e.sessionRecording)?null===(t=e.sessionRecording)||void 0===t?void 0:t.eventTriggers:[]:null==e?void 0:e.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}_eventTriggerStatus(e){return Sa(this._instance,this._eventTriggers.length,this._groupId,ge,pe,e)}triggerStatus(e){const t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[qe]:t}),t}triggerStatusNoSideEffects(e){return this._eventTriggerStatus(e)}checkEventTriggerConditions(e,t,i){if(0===this._eventTriggers.length)return;const n=this._eventTriggerStatus(i)===ma,s=this._eventTriggers.includes(e);!n&&s&&t("event",e)}stop(){}},Fa=class{constructor(e,t,i){if(this._instance=e,this.group=t,this._urlTriggerMatching=new Ma(e,t.id),this._eventTriggerMatching=new Ra(e,t.id),this._linkedFlagMatching=new Pa(e),t.conditions.events&&t.conditions.events.length>0||t.conditions.urls&&t.conditions.urls.length>0||t.conditions.flag){const e=(t.conditions.events||[]).map(e=>e.name),n={urlTriggers:t.conditions.urls||[],eventTriggers:e,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this._urlTriggerMatching.onConfig(n),this._eventTriggerMatching.onConfig(n),this._linkedFlagMatching.onConfig(n,i);const s=[this._eventTriggerMatching,this._urlTriggerMatching,this._linkedFlagMatching];this._combinedMatching="any"===t.conditions.matchType?new xa(s):new Ea(s)}else this._combinedMatching=new Ia}triggerStatus(e){return this._combinedMatching.triggerStatus(e)}triggerStatusNoSideEffects(e){return this._combinedMatching.triggerStatusNoSideEffects(e)}getPendingTriggerConditions(e){return"trigger_pending"!==this.triggerStatusNoSideEffects(e)?[]:[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter(({status:e})=>e===ya).map(({label:e})=>e)}checkEventTriggerConditions(e,t,i){this._eventTriggerMatching.checkEventTriggerConditions(e,t,i)}checkUrlTriggerConditions(e,t,i,n){this._urlTriggerMatching.checkUrlTriggerConditions(e,t,i,n)}activateTrigger(e,t){var i;const n="url"===e?_e+this.group.id:ge+this.group.id;null===(i=this._instance.persistence)||void 0===i||i.register({[n]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}};function Aa(e){if(e.rrwebError)return va;if(!e.receivedFlags)return ga;if(!e.isRecordingEnabled)return da;if(e.urlTriggerMatching.urlBlocked)return _a;const t=!0===e.isSampled,i=new xa([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?ha:"trigger_activated"===i?pa:"trigger_pending"===i?ga:!1===e.isSampled?da:pa}function La(e){if(e.rrwebError)return va;if(!e.receivedFlags)return ga;if(!e.isRecordingEnabled)return da;if(e.urlTriggerMatching.urlBlocked)return _a;const t=new Ea([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),i=t!==ba,n=Lt(e.isSampled);return i&&"trigger_pending"===t?ga:i&&"trigger_disabled"===t||n&&!e.isSampled?da:!0===e.isSampled?ha:pa}function Oa(){const e=[];return function(t,i){if(xt(i)||kt(i)){for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(i)?"[Circular]":(e.push(i),i)}return i}}function Da(e){try{const t=JSON.stringify(e,Oa());return t?new Blob([t]).size:0}catch(e){return-1}}function $a(e){if(Pt(e))return 4;if(It(e))return 0;switch(typeof e){case"string":return e.length+2;case"number":return String(e).length;case"boolean":return e?4:5;case"object":{if(kt(e)){let t=2;for(let i=0;e.length>i;i++){i>0&&(t+=1);const n=e[i];t+=It(n)||Pt(n)?4:$a(n)}return t}const t=e;let i=2,n=!0;for(const e in t){if(!{}.hasOwnProperty.call(t,e))continue;const s=t[e];It(s)||(n||(i+=1),n=!1,i+=e.length+3+$a(s))}return i}default:return 0}}function Na(e,t=6606028.8){if(e.size>=t&&e.data.length>1){const t=Math.floor(e.data.length/2),i=e.sizes.slice(0,t),n=e.sizes.slice(t);return[Na({size:i.reduce((e,t)=>e+t,0),data:e.data.slice(0,t),sizes:i,sessionId:e.sessionId,windowId:e.windowId}),Na({size:n.reduce((e,t)=>e+t,0),data:e.data.slice(t),sizes:n,sessionId:e.sessionId,windowId:e.windowId})].flatMap(e=>e)}return[e]}var Ba=Uint8Array,qa=Uint16Array,Ha=Uint32Array,za=new Ba([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]),Ua=new Ba([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]),Wa=new Ba([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ja=function(e,t){for(var i=new qa(31),n=0;31>n;++n)i[n]=t+=1<<e[n-1];var s=new Ha(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]},Va=ja(za,2),Ga=Va[1];Va[0][28]=258,Ga[258]=28;for(var Qa=ja(Ua,0)[1],Ka=new qa(32768),Ja=0;32768>Ja;++Ja){var Za=(43690&Ja)>>>1|(21845&Ja)<<1;Ka[Ja]=((65280&(Za=(61680&(Za=(52428&Za)>>>2|(13107&Za)<<2))>>>4|(3855&Za)<<4))>>>8|(255&Za)<<8)>>>1}var Ya=function(e,t,i){for(var n=e.length,s=0,r=new qa(t);n>s;++s)++r[e[s]-1];var o,a=new qa(t);for(s=0;t>s;++s)a[s]=a[s-1]+r[s-1]<<1;if(i){o=new qa(1<<t);var l=15-t;for(s=0;n>s;++s)if(e[s])for(var c=s<<4|e[s],u=t-e[s],d=a[e[s]-1]++<<u,h=d|(1<<u)-1;h>=d;++d)o[Ka[d]>>>l]=c}else for(o=new qa(n),s=0;n>s;++s)o[s]=Ka[a[e[s]-1]++]>>>15-e[s];return o},Xa=new Ba(288);for(Ja=0;144>Ja;++Ja)Xa[Ja]=8;for(Ja=144;256>Ja;++Ja)Xa[Ja]=9;for(Ja=256;280>Ja;++Ja)Xa[Ja]=7;for(Ja=280;288>Ja;++Ja)Xa[Ja]=8;var el=new Ba(32);for(Ja=0;32>Ja;++Ja)el[Ja]=5;var tl=Ya(Xa,9,0),il=Ya(el,5,0),nl=function(e){return(e/8|0)+(7&e&&1)},sl=function(e,t,i){(null==t||0>t)&&(t=0),(null==i||i>e.length)&&(i=e.length);var n=new(e instanceof qa?qa:e instanceof Ha?Ha:Ba)(i-t);return n.set(e.subarray(t,i)),n},rl=function(e,t,i){var n=t/8|0;e[n]|=i<<=7&t,e[n+1]|=i>>>8},ol=function(e,t,i){var n=t/8|0;e[n]|=i<<=7&t,e[n+1]|=i>>>8,e[n+2]|=i>>>16},al=function(e,t){for(var i=[],n=0;e.length>n;++n)e[n]&&i.push({s:n,f:e[n]});var s=i.length,r=i.slice();if(!s)return[new Ba(0),0];if(1==s){var o=new Ba(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],c=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=i[i[d].f>i[c].f?c++:d++],l=i[c!=u&&i[d].f>i[c].f?c++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=r[0].s;for(n=1;s>n;++n)r[n].s>h&&(h=r[n].s);var p=new qa(h+1),g=ll(i[u-1],p,0);if(g>t){n=0;var _=0,f=g-t,v=1<<f;for(r.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});s>n;++n){var m=r[n].s;if(t>=p[m])break;_+=v-(1<<g-p[m]),p[m]=t}for(_>>>=f;_>0;){var y=r[n].s;t>p[y]?_-=1<<t-p[y]++-1:++n}for(;n>=0&&_;--n){var b=r[n].s;p[b]==t&&(--p[b],++_)}g=t}return[new Ba(p),g]},ll=function(e,t,i){return-1==e.s?Math.max(ll(e.l,t,i+1),ll(e.r,t,i+1)):t[e.s]=i},cl=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new qa(++t),n=0,s=e[0],r=1,o=function(e){i[n++]=e},a=1;t>=a;++a)if(e[a]==s&&a!=t)++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=e[a]}return[i.subarray(0,n),t]},ul=function(e,t){for(var i=0,n=0;t.length>n;++n)i+=e[n]*t[n];return i},dl=function(e,t,i){var n=i.length,s=nl(t+2);e[s]=255&n,e[s+1]=n>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var r=0;n>r;++r)e[s+r+4]=i[r];return 8*(s+4+n)},hl=function(e,t,i,n,s,r,o,a,l,c,u){rl(t,u++,i),++s[256];for(var d=al(s,15),h=d[0],p=d[1],g=al(r,15),_=g[0],f=g[1],v=cl(h),m=v[0],y=v[1],b=cl(_),S=b[0],w=b[1],k=new qa(19),C=0;m.length>C;++C)k[31&m[C]]++;for(C=0;S.length>C;++C)k[31&S[C]]++;for(var x=al(k,7),E=x[0],I=x[1],T=19;T>4&&!E[Wa[T-1]];--T);var M,P,R,F,A=c+5<<3,L=ul(s,Xa)+ul(r,el)+o,O=ul(s,h)+ul(r,_)+o+14+3*T+ul(k,E)+(2*k[16]+3*k[17]+7*k[18]);if(L>=A&&O>=A)return dl(t,u,e.subarray(l,l+c));if(rl(t,u,1+(L>O)),u+=2,L>O){M=Ya(h,p,0),P=h,R=Ya(_,f,0),F=_;var D=Ya(E,I,0);for(rl(t,u,y-257),rl(t,u+5,w-1),rl(t,u+10,T-4),u+=14,C=0;T>C;++C)rl(t,u+3*C,E[Wa[C]]);u+=3*T;for(var N=[m,S],B=0;2>B;++B){var q=N[B];for(C=0;q.length>C;++C)rl(t,u,D[H=31&q[C]]),u+=E[H],H>15&&(rl(t,u,q[C]>>>5&127),u+=q[C]>>>12)}}else M=tl,P=Xa,R=il,F=el;for(C=0;a>C;++C)if(n[C]>255){var H;ol(t,u,M[257+(H=n[C]>>>18&31)]),u+=P[H+257],H>7&&(rl(t,u,n[C]>>>23&31),u+=za[H]);var z=31&n[C];ol(t,u,R[z]),u+=F[z],z>3&&(ol(t,u,n[C]>>>5&8191),u+=Ua[z])}else ol(t,u,M[n[C]]),u+=P[n[C]];return ol(t,u,M[256]),u+P[256]},pl=new Ha([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),gl=new Ba(0),_l=function(){for(var e=new Ha(256),t=0;256>t;++t){for(var i=t,n=9;--n;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),fl=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function vl(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,n=0;t.length>n;++n)i=_l[255&i^t[n]]^i>>>8;e=i},d(){return 4294967295^e}}}(),n=e.length;i.p(e);var s,r,o,a,l,c=(s=e,r=t,o=function(e){return 10+(e.filename&&e.filename.length+1||0)}(t),a=8,function(e,t,i,n,s,r){var o=e.length,a=new Ba(n+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(n,a.length-s),c=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?c=dl(l,c,e.subarray(u,d)):(l[u]=r,c=dl(l,c,e.subarray(u,o)))}else{for(var h=pl[t-1],p=h>>>13,g=8191&h,_=(1<<i)-1,f=new qa(32768),v=new qa(_+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&_},S=new Ha(25e3),w=new qa(288),k=new qa(32),C=0,x=0,E=(u=0,0),I=0,T=0;o>u;++u){var M=b(u),P=32767&u,R=v[M];if(f[P]=R,v[M]=P,u>=I){var F=o-u;if((C>7e3||E>24576)&&F>423){c=hl(e,l,0,S,w,k,x,E,T,u-T,c),E=C=x=0,T=u;for(var A=0;286>A;++A)w[A]=0;for(A=0;30>A;++A)k[A]=0}var L=2,O=0,D=g,N=P-R&32767;if(F>2&&M==b(u-N))for(var B=Math.min(p,F)-1,q=Math.min(32767,u),H=Math.min(258,F);q>=N&&--D&&P!=R;){if(e[u+L]==e[u+L-N]){for(var z=0;H>z&&e[u+z]==e[u+z-N];++z);if(z>L){if(L=z,O=N,z>B)break;var U=Math.min(N,z-2),W=0;for(A=0;U>A;++A){var j=u-N+A+32768&32767,V=j-f[j]+32768&32767;V>W&&(W=V,R=j)}}}N+=(P=R)-(R=f[P])+32768&32767}if(O){S[E++]=268435456|Ga[L]<<18|Qa[O];var G=31&Ga[L],Q=31&Qa[O];x+=za[G]+Ua[Q],++w[257+G],++k[Q],I=u+L,++C}else S[E++]=e[u],++w[e[u]]}}c=hl(e,l,r,S,w,k,x,E,T,u-T,c),r||(c=dl(l,c,gl))}return sl(a,0,n+nl(c)+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)),u=c.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&fl(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var n=0;i.length>=n;++n)e[n+10]=i.charCodeAt(n)}}(c,t),fl(c,u-8,i.d()),fl(c,u-4,n),c}function ml(e,t){var i=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var n=new Ba(e.length+(e.length>>>1)),s=0,r=function(e){n[s++]=e},o=0;i>o;++o){if(s+5>n.length){var a=new Ba(s+8+(i-o<<1));a.set(n),n=a}var l=e.charCodeAt(o);128>l||t?r(l):2048>l?(r(192|l>>>6),r(128|63&l)):l>55295&&57344>l?(r(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),r(128|l>>>12&63),r(128|l>>>6&63),r(128|63&l)):(r(224|l>>>12),r(128|l>>>6&63),r(128|63&l))}return sl(n,0,s)}function yl(e,t){var i="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var n=0;e.length>n;){var s=e[n++];128>s||t?i+=String.fromCharCode(s):224>s?i+=String.fromCharCode((31&s)<<6|63&e[n++]):240>s?i+=String.fromCharCode((15&s)<<12|(63&e[n++])<<6|63&e[n++]):(s=((15&s)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,i+=String.fromCharCode(55296|s>>10,56320|1023&s))}return i}var bl=class{constructor(e,t={}){var i,n,s,r;this._rrweb=e,this._options=t,this._loggedTracker={},this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0,this._refillByteBudget=()=>{const e=Date.now(),t=e-this._lastByteRefill;t>0?(this._byteTokens=Math.min(this._bytesBucketSize,this._byteTokens+t/1e3*this._bytesRefillRate),this._lastByteRefill=e):this._lastByteRefill=e},this._onNodeRateLimited=e=>{if(!this._loggedTracker[e]){var t,i;this._loggedTracker[e]=!0;const n=this._getNode(e);null===(t=(i=this._options).onBlockedNode)||void 0===t||t.call(i,e,n)}},this._getNodeOrRelevantParent=e=>{const t=this._getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){const e=t.closest("svg");if(e)return[this._rrweb.mirror.getId(e),e]}return[e,t]},this._getNode=e=>this._rrweb.mirror.getNode(e),this._numberOfChanges=e=>{var t,i,n,s,r,o,a,l;return(null!==(t=null===(i=e.removes)||void 0===i?void 0:i.length)&&void 0!==t?t:0)+(null!==(n=null===(s=e.attributes)||void 0===s?void 0:s.length)&&void 0!==n?n:0)+(null!==(r=null===(o=e.texts)||void 0===o?void 0:o.length)&&void 0!==r?r:0)+(null!==(a=null===(l=e.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;const t=e.data,i=this._numberOfChanges(t);if(t.attributes){const e=t.attributes.length;t.attributes=t.attributes.filter(e=>{const[t]=this._getNodeOrRelevantParent(e.id);return!this._rateLimiter.consumeRateLimit(t)&&e});const i=e-t.attributes.length;var n,s;i>0&&(null===(n=(s=this._options).onDroppedAttributeMutations)||void 0===n||n.call(s,i))}const r=this._numberOfChanges(t);if(0===r&&i!==r)return;if(this._byteBudgetDisabled)return e;this._refillByteBudget();const o=$a(e);var a,l;return o>this._byteTokens?(null===(a=(l=this._options).onDroppedOversizedMutation)||void 0===a||a.call(l,o),void this._scheduleResync()):(this._byteTokens-=o,e)},this._scheduleResync=()=>{if(this._resyncTimer)return;const e=Math.max(0,this._resyncIntervalMs-(Date.now()-this._lastResyncAt));this._resyncTimer=setTimeout(()=>{var e,t;this._resyncTimer=void 0,this._lastResyncAt=Date.now(),null===(e=(t=this._options).requestFullSnapshot)||void 0===e||e.call(t)},e)},this._rateLimiter=new Jt({bucketSize:null!==(i=this._options.bucketSize)&&void 0!==i?i:100,refillRate:null!==(n=this._options.refillRate)&&void 0!==n?n:10,refillInterval:1e3,_onBucketRateLimited:this._onNodeRateLimited,_logger:$r}),this._bytesBucketSize=null!==(s=this._options.bytesBucketSize)&&void 0!==s?s:0,this._bytesRefillRate=null!==(r=this._options.bytesRefillRate)&&void 0!==r?r:25600,this._byteBudgetDisabled=!Number.isFinite(this._bytesBucketSize)||0>=this._bytesBucketSize,this._byteTokens=this._bytesBucketSize;const o=this._options.resyncIntervalMs;this._resyncIntervalMs=Ft(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this._loggedTracker={},this._resyncTimer&&(clearTimeout(this._resyncTimer),this._resyncTimer=void 0),this._lastResyncAt=Date.now()}stop(){this._rateLimiter.stop(),this.reset(),this._byteTokens=this._bytesBucketSize,this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0}};const Sl=e=>{if(n){try{const t=e+"=",i=n.cookie.split(";").filter(e=>e.length);for(let e=0;i.length>e;e++){let n=i[e];for(;" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(t))return decodeURIComponent(n.substring(t.length,n.length))}}catch(e){}return null}};var wl=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,n,s){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(n)||!Number.isInteger(s)||0>t||0>i||0>n||0>s||t>0xffffffffffff||i>4095||n>1073741823||s>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=t/Math.pow(2,40),r[1]=t/Math.pow(2,32),r[2]=t/Math.pow(2,24),r[3]=t/Math.pow(2,16),r[4]=t/256,r[5]=t,r[6]=112|i>>>8,r[7]=i,r[8]=128|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 e(r)}toString(){let e="";for(let t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(let t=0;16>t;t++){const i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}},kl=class{generate(){const e=this.generateOrAbort();if(!It(e))return e;{this._timestamp=0;const e=this.generateOrAbort();if(It(e))throw new Error("Could not generate UUID after timestamp reset");return e}}generateOrAbort(){const e=(()=>{const e=Date.now();return Ft(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0})();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return wl.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}constructor(){this._timestamp=0,this._counter=0,this._random=new El}};const Cl=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};let xl;var El=class{nextUint32(){var e;return this._buffer.length>this._cursor||((null!==(e=xl)&&void 0!==e?e:xl="u">typeof window&&!It(window.crypto)&&crypto.getRandomValues?e=>{try{return crypto.getRandomValues(e)}catch(t){return Cl(e)}}:Cl)(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}};let Il;const Tl=()=>Ml().toString(),Ml=()=>(Il||(Il=new kl)).generate();let Pl="";const Rl=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Fl=null;const Al={_is_supported(){if(!Pt(Fl))return Fl;if(Fl=!1,n)try{const e=`__ph_cookie_support_${Tl()}`;Al._set(e,"xyz"),Fl='"xyz"'===Sl(e),Al._remove(e)}catch(e){Fl=!1}return Fl},_error(e){$r.error("cookieStore error: "+e)},_get:Sl,_parse(e){let t;try{t=JSON.parse(Al._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!n)return!1;try{let o="",a="";const l=function(e,t){if(t){let t=function(e,t=n){if(Pl)return Pl;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";const i=e.split(".");let s=Math.min(i.length,8);const r="dmn_chk_"+Tl();for(;!Pl&&s--;){const e=i.slice(s).join("."),n=r+"=1;domain=."+e+";path=/";t.cookie=n+";max-age=3",t.cookie.includes(r)&&(t.cookie=n+";max-age=0",Pl=e)}return Pl}(e);if(!t){const i=(e=>{const t=e.match(Rl);return t?t[0]:""})(e);i!==t&&$r.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}(n.location.hostname,s);if(i){const e=new Date;e.setTime(e.getTime()+864e5*i),o="; expires="+e.toUTCString()}r&&(a="; secure");const c=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&$r.warn("cookieStore warning: large cookie, len="+c.length),n.cookie=c,!0}catch(e){return!1}},_remove(e,t){if((null==n?void 0:n.cookie)&&(!t||!Pt(Sl(e))))try{Al._set(e,"",-1,t)}catch(e){return}}};let Ll=null;const Ol={_is_supported(){if(!Pt(Ll))return Ll;let t=!0;if(It(e))t=!1;else try{const e="__mplssupport__";Ol._set(e,"xyz"),'"xyz"'!==Ol._get(e)&&(t=!1),Ol._remove(e)}catch(e){t=!1}return t||$r.error("localStorage unsupported; falling back to cookie store"),Ll=t,t},_error(e){$r.error("localStorage error: "+e)},_get(t){try{return null==e?void 0:e.localStorage.getItem(t)}catch(e){Ol._error(e)}return null},_parse(e){try{return JSON.parse(Ol._get(e))||{}}catch(e){}return null},_set(t,i){try{return null==e||e.localStorage.setItem(t,JSON.stringify(i)),!0}catch(e){Ol._error(e)}return!1},_remove(t){try{null==e||e.localStorage.removeItem(t)}catch(e){Ol._error(e)}}},Dl=[S,p,y,g,C,v,f,_,w],$l=[N,D,ce,ue,Ae,Fe,U,Ie],Nl=e=>e+"_cpm",Bl=["__proto__","constructor","prototype"],ql=e=>{if(!xt(e))return{};const t={};return Object.keys(e).forEach(i=>{-1===Bl.indexOf(i)&&(t[i]=e[i])}),t},Hl=(e,t=[])=>{const i={};return[...$l,...t].forEach(t=>{const n=e[t];It(n)||Pt(n)||""===n||(i[t]=n)}),i},zl=e=>{let t=5381,i=2166136261;for(let n=0;e.length>n;n++){const s=e.charCodeAt(n);t=33*t^s,i=Math.imul(i^s,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},Ul=(e,t)=>({p:t,f:zl(JSON.stringify(e))}),Wl=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const i=Al._parse(Nl(e)),n=(null==i?void 0:i.f)===zl(t)&&kt(i.p);return{properties:n?i.p:[],isValid:n}}catch(e){return{properties:[],isValid:!1}}},jl=(e,t)=>t+"|"+(Al._get(Nl(e))||""),Vl={},Gl={_is_supported:()=>!0,_error(e){$r.error("memoryStorage error: "+e)},_get:e=>e in Vl?Vl[e]:null,_parse:e=>e in Vl?Vl[e]:null,_set:(e,t)=>(Vl[e]=t,!0),_remove(e){delete Vl[e]}};let Ql=null;const Kl={_is_supported(){if(!Pt(Ql))return Ql;if(Ql=!0,It(e))Ql=!1;else try{const e="__support__";Kl._set(e,"xyz"),'"xyz"'!==Kl._get(e)&&(Ql=!1),Kl._remove(e)}catch(e){Ql=!1}return Ql},_error(e){$r.error("sessionStorage error: ",e)},_get(t){try{return null==e?void 0:e.sessionStorage.getItem(t)}catch(e){Kl._error(e)}return null},_parse(e){try{return JSON.parse(Kl._get(e))||null}catch(e){}return null},_set(t,i){try{return null==e||e.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(e){Kl._error(e)}return!1},_remove(t){try{null==e||e.sessionStorage.removeItem(t)}catch(e){Kl._error(e)}}};Or.DEBUG=!1,Or.LIB_VERSION="1.444.4",Or.LIB_NAME="web";var Jl=Or,Zl=class{constructor(e){if(!e.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this._getProperty=e.get_property.bind(e),this._setProperty=e.persistence.set_property.bind(e.persistence)}trackSize(e,t){this._setProperty(me,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){const t=this._getProperty(me);return xt(i=t)&&Tt(i.sessionId)&&Ft(i.size)&&t.sessionId===e?t.size:0;var i}};function Yl(e,t){return function(e){let t=0;for(let i=0;e.length>i;i++)t=(t<<5)-t+e.charCodeAt(i),t|=0;return Math.abs(t)}(e)%100<Kt(100*t,0,100,$r)}function Xl(e){return`$survey_response_${e}`}function ec(e,t){if(!t)return null;const i=e[Xl(t)];return kt(i)?[...i]:i}function tc({event:e,survey:t,responses:i={},submissionId:n,completed:s,surveyLanguage:r,questionSnapshots:o}){return ct(ct(ct(ct({},!It(n)&&{$survey_submission_id:n}),"sent"===e?!It(s)&&{$survey_completed:s}:{$survey_partially_completed:ic(i)}),r&&{$survey_language:r}),function(e={},t,i){const n={};return t.questions.forEach(t=>{if(It(t.originalQuestionIndex))return;const i=0===(s=t.originalQuestionIndex)?"$survey_response":`$survey_response_${s}`;var s;const r=ec(e,t.id);It(r)||(n[i]=r)}),ct(ct({$survey_questions:t.questions.map(t=>{var n,s;return{id:t.id,question:null!==(n=null==i?void 0:i[null!==(s=t.id)&&void 0!==s?s:""])&&void 0!==n?n:t.question,response:ec(e,t.id)}})},e),n)}(i,t,o))}function ic(e={}){return Object.values(e).some(e=>!Rt(e))}function nc(e,t){let i=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(i=`$survey_${t}/${e.id}/${e.current_iteration}`),i}function sc(e){return"string"==typeof e&&e.trim()?e.trim():null}function rc(e){return e.toLowerCase()}function oc(e,t,i){if(!e||!t)return null;const n=rc(t),s=Object.keys(e).find(e=>rc(e)===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(e).find(e=>rc(e)===s);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${t})`),r}return null}const ac=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function lc(e,t,i){var n;const s=oc(e.translations,t,i),r=ct({},e);let o=!1;if(s){var a;const t=null===(a=e.translations)||void 0===a?void 0:a[s];if(t)if(null==i||i.info(`Applying survey-level translation for language: ${s}`),It(t.name)||(r.name=t.name,o=!0),r.appearance){const e=ct({},r.appearance);for(const i of ac){const n=t[i];It(n)||(e[i]=n,o=!0)}r.appearance=e}else(function(e){return ac.some(t=>!It(e[t]))})(t)&&(o=!0)}const l=e.questions.map(e=>function(e,t,i){var n;const s=oc(e.translations,t,i);if(!s)return{question:e,matchedKey:null,hasChanges:!1};const r=null===(n=e.translations)||void 0===n?void 0:n[s];if(!r)return{question:e,matchedKey:null,hasChanges:!1};const o=ct({},e);let a=!1;return It(r.question)||(o.question=r.question,a=!0),It(r.description)||(o.description=r.description,a=!0),It(r.buttonText)||(o.buttonText=r.buttonText,a=!0),"link"in o&&!It(r.link)&&(o.link=r.link,a=!0),"lowerBoundLabel"in o&&!It(r.lowerBoundLabel)&&(o.lowerBoundLabel=r.lowerBoundLabel,a=!0),"upperBoundLabel"in o&&!It(r.upperBoundLabel)&&(o.upperBoundLabel=r.upperBoundLabel,a=!0),"choices"in o&&function(e){return kt(e.choices)}(r)&&(o.choices=r.choices,a=!0),{question:a?o:e,matchedKey:a?s:null,hasChanges:a}}(e,t,i)),c=l.map(e=>e.question),u=l.some(e=>e.hasChanges);let d=null;return s||(d=(null===(n=l.find(e=>e.matchedKey))||void 0===n?void 0:n.matchedKey)||null),u&&(r.questions=c,o=!0,null==i||i.info(`Applied question-level translations for language: ${t}`)),{survey:r,matchedKey:o?s||d:null}}function cc(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}function uc(e){var t;return cc(e)&&!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t?void 0:t.repeatedActivation)||"always"===e.schedule}const dc=(e,t)=>{if(!(e=>{try{new RegExp(e)}catch(e){return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}},hc=e=>e.toLowerCase(),pc={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>dc(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!dc(t,e))),icontains:(e,t)=>t.map(hc).some(t=>e.map(hc).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(hc).every(t=>e.map(hc).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{const i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{const i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})};function gc(e,t){return!e||Object.entries(e).every(([e,i])=>{const n=null==t?void 0:t[e];if(null==n)return!1;const s=pc[i.operator];return!!s&&s(i.values.map(String),[String(n)])})}const _c=e=>{const t=[...e];for(let e=t.length-1;e>0;e--){const i=Math.floor(Math.random()*(e+1));[t[e],t[i]]=[t[i],t[e]]}return t};function fc(e,t,i){return to({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}const vc=new Set(["is_not","not_icontains","not_regex"]);function mc(e,t,i){return!e||0===e.length||e.every(e=>{const n="person"===e.type?i:t,s=null==n?void 0:n[e.key],r=e.operator||"exact";if(It(s)||Pt(s))return vc.has(r);const o=pc[r];return!!o&&!It(e.value)&&!Pt(e.value)&&o(kt(e.value)?e.value.map(String):[String(e.value)],kt(s)?s.map(String):[String(s)])})}const yc=Nr("[SessionRecording]");function bc(e,t){return t?e:"!"+e}function Sc(e,t){return e===t||e!=="!"+t&&null}var wc=class{constructor(e,t,i,n,s,r,o){this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=i,this._linkedFlagMatching=n,this._reportStarted=s,this._tryTakeFullSnapshot=r,this._onTriggerActivated=o,this._sampleRate=null,this._recordingStatusFunction=La}onRemoteConfig(e){this._sampleRate=Ft(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this._triggerStatusMatcher=new xa([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=Aa):(this._triggerStatusMatcher=new Ea([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=La),this._instance.register_for_session({[We]:e.triggerMatchType}),this._urlTriggerMatching.onConfig(e),this._eventTriggerMatching.onConfig(e),this._linkedFlagMatching.onConfig(e,(e,t)=>{this._reportStarted("linked_flag_matched",{flag:e,variant:t}),this._onTriggerActivated()})}getStatus(e){return this._recordingStatusFunction({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId})}getMinimumDuration(e){const t=this._instance.get_property("$session_recording_remote_config"),i=null==t?void 0:t.minimumDurationMilliseconds;return Ft(i)?i:null}checkUrlTriggers(e,t,i,n){this._urlTriggerMatching.checkUrlTriggerConditions(t,i,n,e)}setupEventTriggerListeners(e,t,i){if(0!==this._eventTriggerMatching._eventTriggers.length&&Rt(this._removeEventTriggerCaptureHook))return this._removeEventTriggerCaptureHook=e(e=>{try{this._eventTriggerMatching.checkEventTriggerConditions(e.event,i,t)}catch(e){yc.error("Could not activate event trigger",e)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t;const i=this._sampleRate;var n,s;if(!Ft(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(ue),o=this._instance.get_property(se),a=Sc(r,e),l=Ft(o)&&o!==i,c=It(o)&&r===e,u=l||c||!Lt(a),d=u?Yl(e,i):a;u&&(d?this._reportStarted("sampled"):yc.warn(`Sample rate (${i}) has determined that this sessionId (${e}) will not be sent to the server.`)),null===(t=this._instance.persistence)||void 0===t||t.register({$session_is_sampled:bc(e,d),$replay_sample_rate:Pt(o)&&r===e?null:i})}ensureSamplingDecision(e){if(!Ft(this._sampleRate))return;const t=this._instance.get_property(ue);Lt(Sc(t,e))||this.makeSamplingDecisions(e)}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,i,n,s;null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_recording_event_trigger_activated_session"),null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_recording_url_trigger_activated_session"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_is_sampled"),null===(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(e){}hasPendingTriggers(e){var t;return(null===(t=this._triggerStatusMatcher)||void 0===t?void 0:t.triggerStatus(e))===ya}getPendingTriggerConditions(e){return[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter(({status:e})=>e===ya).map(({label:e})=>e)}stop(){var e;null===(e=this._removeEventTriggerCaptureHook)||void 0===e||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._eventTriggerMatching.stop(),this._urlTriggerMatching.stop(),this._linkedFlagMatching.stop()}},kc=class{constructor(e,t,i,n,s){this._instance=e,this._urlTriggerMatching=t,this._reportStarted=i,this._tryAddCustomEvent=n,this._onTriggerActivated=s,this._triggerGroupMatchers=[],this._triggerGroupSamplingResults=new Map,this._hasCompletedInitialFlush=!1}onRemoteConfig(e){e.triggerGroups&&0!==e.triggerGroups.length?(this._setupTriggerGroups(e.triggerGroups),this._instance.register_for_session({[We]:"v2_trigger_groups",[je]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):yc.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return va;if(!e.receivedFlags)return ga;if(!e.isRecordingEnabled)return da;if(e.urlTriggerMatching.urlBlocked)return _a;const t=e.triggerGroupMatchers,i=e.triggerGroupSamplingResults;if(0===t.length)return da;let n=!1,s=!1;for(const r of t){const t=r.triggerStatus(e.sessionId);if("trigger_activated"===t){const e=r.group.id,t=i.get(e);It(t)?$r.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:e}):!0===t&&(s=!0)}else"trigger_pending"===t&&(n=!0)}return s?ha:n?ga:da}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId,triggerGroupMatchers:this._triggerGroupMatchers,triggerGroupSamplingResults:this._triggerGroupSamplingResults,minimumDuration:this.getMinimumDuration(e.sessionId)})}getMinimumDuration(e){let t=null;for(const i of this._triggerGroupMatchers)if("trigger_activated"===i.triggerStatus(e)){const e=i.group.minDurationMs;Ft(e)&&(Pt(t)||t>e)&&(t=e)}return t}checkUrlTriggers(e,t,i,n){this._urlTriggerMatching.checkUrlBlocklist(t,i);for(const n of this._triggerGroupMatchers)n.checkUrlTriggerConditions(t,i,t=>{this._checkGroupLevelProperties(n,void 0)&&(n.activateTrigger(t,e),this.updateActiveTriggers(e),this._onTriggerActivated(t))},e)}setupEventTriggerListeners(e,t,i){return this._removeEventTriggerCaptureHook=e(e=>{var i;if(this._hasCompletedInitialFlush)return yc.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(i=this._removeEventTriggerCaptureHook)||void 0===i||i.call(this),void(this._removeEventTriggerCaptureHook=void 0);try{for(const i of this._triggerGroupMatchers)i.checkEventTriggerConditions(e.event,n=>{if(!this._checkGroupLevelProperties(i,e.properties))return;const s=(i.group.conditions.events||[]).filter(t=>t.name===e.event),r=this._instance.get_property(S);s.some(t=>!t.properties||0===t.properties.length||mc(t.properties,e.properties,r))&&(i.activateTrigger(n,t),this.updateActiveTriggers(t),this._onTriggerActivated(n))},t)}catch(e){yc.error("Could not activate event trigger for trigger groups",e)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){for(const i of this._triggerGroupMatchers){var t;const n=i.group,s=n.id,r=n.sampleRate,o=fe+s,a=this._instance.get_property(o);let l=null,c=!1,u=!1,d=!1;if(xt(a)){const t=a.sessionId,i=a.sampleRate,n=a.sampled;c="string"==typeof t&&t!==e,u=Ft(i)&&i!==r,l=t===e&&Ft(i)&&i===r&&Lt(n)?n:null}else l=a===e||null,c="string"==typeof a&&a!==e,d=a===e;const h=c||u||d||!Lt(l),p=h?Yl(e+s,r):l;h&&this._tryAddCustomEvent("triggerGroupSamplingDecisionMade",{group_id:s,group_name:n.name,sampleRate:r,isSampled:p}),this._triggerGroupSamplingResults.set(s,p),null===(t=this._instance.persistence)||void 0===t||t.register({[o]:{sessionId:e,sampleRate:r,sampled:p}})}this.updateActiveTriggers(e)}ensureSamplingDecision(e){}onFlushComplete(){this._hasCompletedInitialFlush=!0}clearConditionalRecordingPersistence(){var e,t,i;null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_is_sampled"),null===(t=this._instance.persistence)||void 0===t||t.unregister("$replay_sample_rate"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_past_minimum_duration");for(const e of this._triggerGroupMatchers){var n,s,r;const t=e.group.id;null===(n=this._instance.persistence)||void 0===n||n.unregister("$posthog_sr_group_event_trigger_"+t),null===(s=this._instance.persistence)||void 0===s||s.unregister("$posthog_sr_group_url_trigger_"+t),null===(r=this._instance.persistence)||void 0===r||r.unregister("$posthog_sr_group_sampling_"+t)}}updateActiveTriggers(e){const t=[];for(const i of this._triggerGroupMatchers){const n=i.group,s=n.id,r="trigger_activated"===i.triggerStatus(e),o=!0===this._triggerGroupSamplingResults.get(s);r&&t.push({id:s,name:n.name,matched:!0,sampled:o})}this._instance.register_for_session({[ze]:t})}hasPendingTriggers(e){for(const t of this._triggerGroupMatchers)if("trigger_pending"===t.triggerStatus(e))return!0;return!1}getPendingTriggerConditions(e){return this._triggerGroupMatchers.flatMap(t=>"trigger_pending"!==t.triggerStatusNoSideEffects(e)?[]:t.getPendingTriggerConditions(e).map(e=>`trigger group "${t.group.name}": ${e}`))}stop(){var e;null===(e=this._removeEventTriggerCaptureHook)||void 0===e||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._triggerGroupMatchers.forEach(e=>e.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear(),this._urlTriggerMatching.stop()}_checkGroupLevelProperties(e,t){const i=e.group.conditions.properties;return!i||0===i.length||mc(i,t,this._instance.get_property(S))}_setupTriggerGroups(e){this._triggerGroupMatchers.forEach(e=>e.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();for(const t of e){const e=new Fa(this._instance,t,(e,i)=>{this._reportStarted("linked_flag_matched",{flag:e,variant:i,group_id:t.id,group_name:t.name}),this._onTriggerActivated()});this._triggerGroupMatchers.push(e)}}};function Cc(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}const xc=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],Ec=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...xc],Ic="<masked>",Tc=["li_fat_id"];function Mc(e,t,i){if(!n)return{};const s=t?[...xc,...i||[]]:[],r=Pc(so(n.URL,s,Ic),e),o=function(){const e={};return qr(Tc,function(t){const i=Sl(t);e[t]=i||null}),e}();return Hr(o,r)}function Pc(e,t){const i=Ec.concat(t||[]),n={};return qr(i,function(t){const i=no(e,t);n[t]=i||null}),n}function Rc(e){const t=function(e){return e?0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!Pt(t)){s.$search_engine=t;const e=n?no(n.referrer,i):"";e.length&&(s.ph_keyword=e)}return s}function Fc(){return navigator.language||navigator.userLanguage}function Ac(){const e=Fc();return"string"==typeof e?e.split("-")[0]:void 0}const Lc="$direct";function Oc(){return(null==n?void 0:n.referrer)||Lc}function Dc(e,t,i=!1){const n=e?[...xc,...t||[]]:[],r=i?un(null==s?void 0:s.href):null==s?void 0:s.href,o=null==r?void 0:r.substring(0,1e3);return{r:Oc().substring(0,1e3),u:o?so(o,n,Ic):void 0}}function $c(e,t=!1){var i;const{r:n,u:s}=e,r=t?un(s):s,o={$referrer:n,$referring_domain:null==n?void 0:n==Lc?Lc:null===(i=Jr(n))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const e=Jr(r);o.$host=null==e?void 0:e.host,o.$pathname=null==e?void 0:e.pathname;const t=Pc(r);Hr(o,t)}if(n){const e=Rc(n);Hr(o,e)}return o}function Nc(){try{return(new Date).getTimezoneOffset()}catch(e){return}}const Bc=1e5,qc=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Hc=[],zc=()=>!1,Uc="@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(" "),Wc="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),jc="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(" "),Vc="Accommodation AdministrativeArea Country Place State".split(" "),Gc={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:Wc,publisher:jc},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Hc},Offer:{seller:jc},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:jc,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:jc,areaServed:Vc,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Hc}},Qc=[["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(" "),Gc.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Gc.Event],[jc,Gc.Organization],[Vc,Gc.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Gc.Product]];function Kc(e,t){return St.call(e,t)?e[t]:void 0}function Jc(e){const t=typeof e;return Pt(e)||"string"===t||"number"===t||"boolean"===t}function Zc(e,t){return t&&function(e){return Tt(e)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(e.trim())}(e)?t(e.trim())||void 0:e}function Yc(e,t){return kt(e)&&e.every(Jc)?e.map(e=>Zc(e,t)).filter(e=>!It(e)):Jc(e)?Zc(e,t):void 0}function Xc(e,t){if("string"!=typeof e)return;const i=e.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 t(s)?s:void 0}catch(e){return}}function eu(e){if(St.call(Gc,e))return Gc[e];for(const[t,i]of Qc)if(t.includes(e))return i}function tu(e,t,i){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0})}function iu(e,t,i,n){if(kt(e)){const s=e.map(e=>iu(e,t,i,n)).filter(e=>!It(e));return s.length?s:void 0}return nu(e,t,i,n)||void 0}function nu(e,t,i,n){if(!xt(e)||!function(e){return e.remainingNodes?(e.remainingNodes--,!0):(e.exceeded=!0,!1)}(i))return null;const s=Kc(e,"@type"),r=function(e){const t=new Set,i="string"==typeof e?[e]:kt(e)?e:[],n=[];for(const e of i){if("string"!=typeof e)continue;const i=e.replace(/^https?:\/\/schema\.org\//,"");if(100>=i.length&&qc.test(i)&&!t.has(i)&&(t.add(i),n.push(i),20===n.length))break}return n}(s),o=r.filter(e=>!!eu(e)&&(!n||!n.length||n.includes(e))),a={};for(const n of Uc){const o="@type"===n?r.length?"string"==typeof s?r[0]:r:void 0:"@id"===n?Xc(Kc(e,n),t):Yc(Kc(e,n),i.maskUrl);It(o)||tu(a,n,o)}for(const n of o){const s=eu(n);for(const n of Object.keys(s)){const r=Kc(e,n),o=s[n];if(!0===o){const e=Yc(r,i.maskUrl);It(e)||tu(a,n,e)}else{const e=iu(r,t,i,o);It(e)||tu(a,n,e)}}}const l=iu(Kc(e,"@graph"),t,i);return It(l)||tu(a,"@graph",l),Object.keys(a).length?a:null}function su(e,t,i){if(!xt(e))return null;const n=Kc(e,"@context");if("string"!=typeof n||!/^https?:\/\/schema\.org\/?$/.test(n))return null;const s=nu(e,t,i);return s?ct({"@context":"https://schema.org"},s):null}function ru(e){var t;return"SCRIPT"===e.nodeName&&"application/ld+json"===(null===(t=e.getAttribute("type"))||void 0===t?void 0:t.trim().toLowerCase())}function ou(e,t,i){if("string"==typeof t?e.classList.contains(t):t&&Array.from(e.classList).some(e=>(t.lastIndex=0,t.test(e))))return!0;try{return!!i&&e.matches(i)}catch(e){return!1}}function au(e,t,i){for(let n=e;n;){if(ou(n,t,i))return!0;const e=n.parentNode;n=n.parentElement||(e&&e.nodeType===e.DOCUMENT_FRAGMENT_NODE?e.host:null)}return!1}function lu(e){return ru(e)?[e]:e.nodeType!==e.ELEMENT_NODE?[]:Array.from(e.querySelectorAll("script")).filter(ru)}function cu(e){return xt(e)?e.network_timing:e}const uu=Nr("[SessionRecording]"),du=[1,2,3,4,5,6,7,12],hu=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function pu(){var e;return null==d||null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.rrweb}function gu(){var e;return null===(e=pu())||void 0===e?void 0:e.record}function _u(e){try{return JSON.stringify(e)}catch(t){if(t instanceof RangeError)throw t;return JSON.stringify(e,Oa())}}function fu(e){return yl(vl(ml(_u(e))),!0)}function vu(e){return mu.apply(this,arguments)}function mu(){return(mu=rt(function*(e){const t=yield ms(_u(e),Jl.DEBUG,{rethrow:!0});return yl(new Uint8Array(yield t.arrayBuffer()),!0)})).apply(this,arguments)}let yu,bu;const Su="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let wu=!1;function ku(e){var t;return kt(e)&&0===e.length?(yu=null!==(t=yu)&&void 0!==t?t:fu([]),yu):fu(e)}function Cu(e){return xu.apply(this,arguments)}function xu(){return(xu=rt(function*(e){var t;return kt(e)&&0===e.length?yu||(bu=null!==(t=bu)&&void 0!==t?t:vu([]).then(e=>(yu=e,e)).catch(e=>{throw yu=void 0,bu=void 0,e}),bu):vu(e)})).apply(this,arguments)}function Eu(e){return Su&&!wu&&function(e){return 2===e.type||3===e.type&&(0===e.data.source||8===e.data.source)}(e)}function Iu(e){return{event:e,size:$a(e)}}function Tu(e,t){return ct(ct({},e),{},{data:t,cv:"2024-10"})}function Mu(e,t){return ct(ct({},e),{},{cv:"2024-10",data:ct(ct({},e.data),t)})}function Pu(e){try{if(2===e.type)return Iu(Tu(e,fu(e.data)));if(3===e.type&&0===e.data.source)return Iu(Mu(e,{texts:ku(e.data.texts),attributes:ku(e.data.attributes),removes:ku(e.data.removes),adds:ku(e.data.adds)}));if(3===e.type&&8===e.data.source)return Iu(Mu(e,{adds:e.data.adds?fu(e.data.adds):void 0,removes:e.data.removes?fu(e.data.removes):void 0}))}catch(e){uu.warn("could not compress event - will use uncompressed event",e)}return{event:e,size:Da(e)}}function Ru(){return Ru=rt(function*(e){try{if(2===e.type)return Iu(Tu(e,yield vu(e.data)));if(3===e.type&&0===e.data.source){const[t,i,n,s]=yield Promise.all([Cu(e.data.texts),Cu(e.data.attributes),Cu(e.data.removes),Cu(e.data.adds)]);return Iu(Mu(e,{texts:t,attributes:i,removes:n,adds:s}))}if(3===e.type&&8===e.data.source){const[t,i]=yield Promise.all([e.data.adds?vu(e.data.adds):void 0,e.data.removes?vu(e.data.removes):void 0]);return Iu(Mu(e,{adds:t,removes:i}))}}catch(t){return gs(t)&&(wu=!0),uu.warn("could not compress event asynchronously - trying synchronous compression",t),Pu(e)}return{event:e,size:Da(e)}}),Ru.apply(this,arguments)}function Fu(e,t){return 5===e.type&&e.data.tag===t}function Au(e){return Fu(e,"sessionIdle")}function Lu(e){return Fu(e,"$session_ending")}function Ou(e){return Fu(e,"$session_starting")}var Du=class{get sessionId(){return this._sessionId}get _sessionManager(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get _sessionIdleThresholdMilliseconds(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get _isSampled(){return Sc(this._instance.get_property(ue),this.sessionId)}get _sampleRate(){var e;const t=null===(e=this._remoteConfig)||void 0===e?void 0:e.sampleRate;return Ft(t)?t:null}get _minimumDuration(){var e,t;return null!==(e=null===(t=this._strategy)||void 0===t?void 0:t.getMinimumDuration(this.sessionId))&&void 0!==e?e:null}constructor(e,t){this._instance=e,this._endpoint="/s/",this._forceAllowLocalhostNetworkCapture=!1,this._stopRrweb=void 0,this._jsonLdCaptureReady=!1,this._lastActivityTimestamp=Date.now(),this._isActivatingTrigger=!1,this._queuedRRWebEvents=[],this._isIdle="unknown",this._eventsDroppedWhileIdle=0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,this._unstringifiableEventsDropped=0,this._holdFlushUntilInteraction=!1,this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed=!1,this._suppressNextFreshStartHold=!1,this._rrwebError=!1,this._rrwebStartAttempted=!1,this._snapshotCostErrorLogged=!1,this._hasWarnedClientMaskingOverride=!1,this._hasWarnedExclusiveAttributeMasking=!1,this._maskRegionsFnFailed=!1,this._hasLoggedRecorderCallbackError=!1,this._lastFullSnapshotSessionId=void 0,this._fullSnapshotHealAttemptedFor=void 0,this._pendingBufferRestored=!1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueueGeneration=0,this._isStoppingAfterCompression=!1,this._removePageViewCaptureHook=void 0,this._removeEventTriggerCaptureHook=void 0,this._onSessionIdListener=void 0,this._onSessionIdleResetForcedListener=void 0,this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback=(e,t,i)=>{var n,s,r,o;if(!i)return;if(e===this._sessionId&&t===this._windowId)return;const a=!i.noSessionId&&(i.activityTimeout||i.sessionPastMaximumLength),l=this._sessionId,c=this._windowId;var u;if(a&&this._tryAddCustomEvent("$session_ending",{currentSessionId:l,currentWindowId:c,nextSessionId:e,nextWindowId:t,changeReason:i,lastActivityTimestamp:this._lastActivityTimestamp,flushed_size:null===(u=this._flushedSizeTracker)||void 0===u?void 0:u.currentTrackedSize(l)}),null===(n=this._instance.persistence)||void 0===n||n.unregister("$debug_first_full_snapshot_timestamp"),null===(s=pu())||void 0===s||null===(r=s.resetMaxDepthState)||void 0===r||r.call(s),this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:i}),this._clearConditionalRecordingPersistence(),!(!1===this._isIdle&&this.isStarted||this._sessionId===e&&this._windowId===t)){const t=this._sessionId!==e&&!1!==this._isIdle;this._isIdle="unknown",this._restartForSessionIdChange(t)}a&&this._tryAddCustomEvent("$session_starting",{previousSessionId:l,previousWindowId:c,nextSessionId:e,nextWindowId:t,changeReason:i,lastActivityTimestamp:this._lastActivityTimestamp}),null===(o=this._strategy)||void 0===o||o.makeSamplingDecisions(e)},this._isRestartingForSessionIdChange=!1,this._hasPassedMinimumDuration=()=>{var e;return(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[de])===this._sessionId},this._getBufferDuration=()=>{var e,t;if(0===this._buffer.data.length)return null;const i=null===(e=this._buffer.data[0])||void 0===e?void 0:e.timestamp,n=null===(t=this._buffer.data[this._buffer.data.length-1])||void 0===t?void 0:t.timestamp;return Ft(i)&&Ft(n)?n-i:null},this._isBelowMinimumDuration=()=>{var e,t;const i=this._minimumDuration;if(!Ft(i))return!1;if(null===(e=null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.strictMinimumDuration)||void 0===e||!e){const e=this._sessionDuration;return Ft(e)&&e>=0&&i>e}if(this._hasPassedMinimumDuration())return!1;const n=this._getBufferDuration();return!!Pt(n)||i>n||(null===(s=this._instance.persistence)||void 0===s||s.register({$session_past_minimum_duration:this._sessionId}),!1);var s},this._onBeforeUnload=()=>{"buffering"!==this.status?(this._holdFlushUntilInteraction&&this._heldEpochShipsOnUnload&&this._documentWasEverVisible&&(this._setFlushHold(void 0),this._heldBufferOverflowed&&(this._heldBufferOverflowed=!1,this._tryTakeFullSnapshot())),this._drainCompressionQueueSync(),this._flushBuffer(!0)):this._clearBuffer()},this._onPageHide=()=>{this._onBeforeUnload()},this._onOffline=()=>{this._tryAddCustomEvent("browser offline",{})},this._onOnline=()=>{this._tryAddCustomEvent("browser online",{})},this._onVisibilityChange=()=>{(null==n?void 0:n.visibilityState)&&("visible"===n.visibilityState&&(this._documentWasEverVisible=!0),this._tryAddCustomEvent("window "+n.visibilityState,{}))},this._documentWasEverVisible=null==t||t;const{sessionId:i,windowId:s,sessionStartTimestamp:r}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=i,this._windowId=s,this._sessionStartTimestamp=r,this._linkedFlagMatching=new Pa(this._instance),this._urlTriggerMatching=new Ma(this._instance),this._eventTriggerMatching=new Ra(this._instance),this._buffer=this._clearBuffer(),this._pendingBufferStorageKey="ph_replay_pending_buffer_"+JSON.stringify([this._instance.config.persistence_name||this._instance.config.token,this._instance.config.token]),this._sessionManager.sessionTimeoutMs>this._sessionIdleThresholdMilliseconds||uu.warn(`session_idle_threshold_ms (${this._sessionIdleThresholdMilliseconds}) is greater than the session timeout (${this._sessionManager.sessionTimeoutMs}). Session will never be detected as idle`),this._flushedSizeTracker=new Zl(this._instance)}setDocumentWasEverVisible(e){e&&(this._documentWasEverVisible=!0)}get _masking(){var e,t,i,n,s,r,o,a,l;const c=null===(e=this._remoteConfig)||void 0===e?void 0:e.masking,u={maskAllInputs:null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.maskAllInputs,maskTextSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.maskTextSelector,blockSelector:null===(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},d=null!==(r=null==u?void 0:u.maskAllInputs)&&void 0!==r?r:null==c?void 0:c.maskAllInputs,h=null!==(o=null==u?void 0:u.maskTextSelector)&&void 0!==o?o:null==c?void 0:c.maskTextSelector,p=null!==(a=null==u?void 0:u.blockSelector)&&void 0!==a?a:null==c?void 0:c.blockSelector,g=null!==(l=null==u?void 0:u.maskAllElementAttributes)&&void 0!==l?l:null==c?void 0:c.maskAllElementAttributes;return It(d)&&It(h)&&It(p)&&It(g)?void 0:{maskAllInputs:null==d||d,maskTextSelector:h,blockSelector:p,maskAllElementAttributes:g}}_warnIfClientMaskingShadowsServer(){var e;if(this._hasWarnedClientMaskingOverride)return;const t=null===(e=this._remoteConfig)||void 0===e?void 0:e.masking;if(Rt(t))return;const i=this._instance.config.session_recording,n=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(e=>{const n=null==i?void 0:i[e],s=t[e];return!It(n)&&n!==s});0!==n.length&&(this._hasWarnedClientMaskingOverride=!0,uu.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:t}))}get _canvasResolutionScale(){var e;return Kt(null===(e=this._instance.config.session_recording.canvasCapture)||void 0===e?void 0:e.resolutionScale,.1,1,Nr("canvas recording resolution scale"),1)}get _canvasRecording(){var e,t,i,n,s,r,o;const a=this._instance.config.session_recording.captureCanvas,l=null===(e=this._remoteConfig)||void 0===e?void 0:e.canvasRecording,c=null!==(t=null!==(i=null==a?void 0:a.recordCanvas)&&void 0!==i?i:null==l?void 0:l.enabled)&&void 0!==t&&t,u=null!==(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 d=null!==(r=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==r?r:.4;if("string"==typeof d){const e=parseFloat(d);d=isNaN(e)?.4:e}return{enabled:c,fps:Kt(u,0,12,Nr("canvas recording fps"),4),quality:Kt(d,0,1,Nr("canvas recording quality"),.4)}}get _isConsoleLogCaptureEnabled(){var e;const t=!!(null===(e=this._remoteConfig)||void 0===e?void 0:e.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return null!=i?i:t}get _networkPayloadCapture(){var e,t,i;const n=null===(e=this._remoteConfig)||void 0===e?void 0:e.networkPayloadCapture,s={recordHeaders:null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.recordHeaders,recordBody:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.recordBody},r=!1!==s.recordHeaders&&(s.recordHeaders||(null==n?void 0:n.recordHeaders)),o=!1!==s.recordBody&&(s.recordBody||(null==n?void 0:n.recordBody)),a=cu(this._instance.config.capture_performance),l=cu(null==n?void 0:n.capturePerformance),c=!!(Lt(a)?a:l);return r||o||c?{recordHeaders:r,recordBody:o,recordPerformance:c}:void 0}_gatherRRWebPlugins(){var e,t;const i=[],n=null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordConsolePlugin;n&&this._isConsoleLogCaptureEnabled&&i.push(n());const r=null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordNetworkPlugin;if(this._networkPayloadCapture&&Ct(r))if(!eo.includes(s.hostname)||this._forceAllowLocalhostNetworkCapture){const e=Ct(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(r(ct(ct({},((e,t,i)=>{const n={payloadSizeLimitBytes:ia.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...ia.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...ia.payloadHostDenyList]},s=!1!==e.session_recording.recordHeaders&&t.recordHeaders,r=!1!==e.session_recording.recordBody&&t.recordBody,o=!1!==e.capture_performance&&t.recordPerformance,a=(e=>{const t=ta(e);return e=>((null==e?void 0:e.requestBody)&&(e.requestBody=la(e.requestBody,e.requestHeaders,t,"Request")),(null==e?void 0:e.responseBody)&&(e.responseBody=la(e.responseBody,e.responseHeaders,t,"Response")),e)})(n),l=t=>{return a(((e,t,i)=>{var n;if(null==i?void 0:i(e.name))return;const s=Jr(e.name);let r=0===t.indexOf("http")?null===(n=Jr(t))||void 0===n?void 0:n.pathname:t;"/"===r&&(r="");const o=null==s?void 0:s.pathname.replace(r||"","");return s&&o&&aa.some(e=>0===o.indexOf(e))?void 0:e})((oa((n=t).requestHeaders),oa(n.responseHeaders),n),e.api_host,i));var n},c=Ct(e.session_recording.maskNetworkRequestFn);return c&&Ct(e.session_recording.maskCapturedNetworkRequestFn)?$r.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."):c&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{const i=e.session_recording.maskNetworkRequestFn({url:t.name});if(i||!t.isInitial)return ct(ct({},t),{},{name:null==i?void 0:i.url})}),n.maskRequestFn=Ct(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var i,n;const s=l(t);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=e.session_recording).maskCapturedNetworkRequestFn)||void 0===i?void 0:i.call(n,s);return Rt(o)&&r?(ua.add(r),r):null!=o?o:void 0}:e=>function(e){if(!It(e))return e.requestBody=ca(e.requestBody,"Request"),e.responseBody=ca(e.responseBody,"Response"),e}(l(e)),ct(ct(ct({},ia),n),{},{recordHeaders:s,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===e.session_recording.streamNetworkBody})})(this._instance.config,this._networkPayloadCapture,e)),{},{captureFetchSynchronously:!0===this._instance.config.__preview_replay_sync_fetch})))}else uu.info("NetworkCapture not started because we are on localhost.");return i}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?un(e):e}_maskReplayUrl(e,t=!1){const i=t?un(e):this._stripUrlHash(e),n=this._instance.config.mask_personal_data_properties?[...xc,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(so(i,n,Ic))}_maskUrl(e){const t=this._instance.config.session_recording;if(t.maskCapturedNetworkRequestFn){var i;const n=t.maskCapturedNetworkRequestFn({name:e});return null!==(i=null==n?void 0:n.name)&&void 0!==i?i:null==n?void 0:n.url}if(t.maskNetworkRequestFn){const i=t.maskNetworkRequestFn({url:e});return null==i?void 0:i.url}return e}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return 10>this._queuedRRWebEvents.length?this._queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt+1,rrwebMethod:e.rrwebMethod}):uu.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(hu(()=>gu().addCustomEvent(e,t)))}_canCaptureJsonLd(){var e;return this._jsonLdCaptureReady&&!0===(null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.captureJsonLd)&&!this._urlTriggerMatching.urlBlocked&&!0!==this._isIdle}_tryAddJsonLdEvent(e){if(!this._canCaptureJsonLd())return!1;try{const t=gu();return!!t&&(t.addCustomEvent("$json_ld",e),this._canCaptureJsonLd())}catch(e){return!1}}_scheduleJsonLdScan(e=!1){Promise.resolve().then(()=>{var t;return null===(t=this._jsonLdCapture)||void 0===t?void 0:t.scan(e)})}_pageViewFallBack(){try{if(this._instance.config.capture_pageview||!e)return;const t=new URL(e.location.href),i=this._maskReplayUrl(t.origin+t.pathname+t.search);this._lastHref!==i&&(this._lastHref=i,this._tryAddCustomEvent("$url_changed",{href:i}))}catch(e){}}_processQueuedEvents(){if(this._queuedRRWebEvents.length){const e=[...this._queuedRRWebEvents];this._queuedRRWebEvents=[],e.forEach(e=>{Date.now()-e.enqueuedAt>2e3||this._tryRRWebMethod(e)})}}_tryTakeFullSnapshot(){return this._tryRRWebMethod(hu(()=>gu().takeFullSnapshot()))}get _fullSnapshotIntervalMillis(){var e,t,i;if((null===(e=this._strategy)||void 0===e?void 0:e.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var n;const e=null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.trigger_pending_buffer_interval_millis;return Ft(e)&&Number.isFinite(e)&&e>=1e3&&36e5>=e?e:6e4}return null!==(t=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.full_snapshot_interval_millis)&&void 0!==t?t:3e5}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!0===this._isIdle)return;const e=this._fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},e))}_onTriggerActivated(e){"event"===e&&this._releaseHoldAndFlush(),!this._urlTriggerMatching.urlBlocked&&["sampled","active"].includes(this.status)&&this._scheduleFullSnapshot()}_pauseRecording(){var e;this._urlTriggerMatching.urlBlocked||(this._urlTriggerMatching.urlBlocked=!0,null===(e=this._jsonLdCapture)||void 0===e||e.scan(),clearInterval(this._fullSnapshotTimer),uu.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e;this._urlTriggerMatching.urlBlocked&&(null===(e=this._jsonLdCapture)||void 0===e||e.scan(),this._urlTriggerMatching.urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),uu.info("recording resumed"))}_activateTrigger(e,t){var i;if("event"===e&&this._releaseHoldAndFlush(),!this._isActivatingTrigger&&(null===(i=this._strategy)||void 0===i?void 0:i.hasPendingTriggers(this.sessionId))){this._isActivatingTrigger=!0;try{var n,s;const i="url"===e?he:pe;null===(n=this._instance.persistence)||void 0===n||n.register({[i]:this.sessionId}),null===(s=this._strategy)||void 0===s||s.updateActiveTriggers(this.sessionId),this._onTriggerActivated(),this._flushBuffer(),this._reportStarted(e+"_trigger_matched",{["url"===e?"matchedUrl":"matchedEvent"]:t})}finally{this._isActivatingTrigger=!1}}}get isStarted(){return!!this._stopRrweb}get _remoteConfig(){const e=this._instance.get_property(ie);if(!e)return;let t;try{t=xt(e)?e:JSON.parse(e)}catch(e){return void uu.warn("persisted remote config for session recording is invalid and will be ignored",e)}if(!this.isStarted&&!this._isRestartingForSessionIdChange){var i;const n=null!==(i=t.cache_timestamp)&&void 0!==i?i:Date.now();if(Date.now()-n>36e5)return void uu.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:e})}return t}_checkOverride(e,t,i){this._instance.get_property(e)&&(t(),i())}start(t){var i,s;const r=this._remoteConfig;if(!r)return void uu.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const e=!1!==this._isIdle&&!this._suppressNextFreshStartHold;this._setFlushHold(e?"no_interaction_since_recording_started":void 0),this._suppressNextFreshStartHold=!1,this._heldEpochShipsOnUnload=e,this._heldBufferOverflowed=!1}this._isStoppingAfterCompression&&(this._invalidateCompressionQueue(),this._clearBuffer());const{sessionId:o,windowId:a,sessionStartTimestamp:l}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=o,this._windowId=a,this._sessionStartTimestamp=l,this._restorePendingBuffer(),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),(null==r?void 0:r.endpoint)&&(this._endpoint=null==r?void 0:r.endpoint),this._strategy=2===(null==r?void 0:r.version)&&(null==r?void 0:r.triggerGroups)&&r.triggerGroups.length>0?new kc(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this),this._onTriggerActivated.bind(this)):new wc(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.bind(this),this._onTriggerActivated.bind(this)),this._strategy.onRemoteConfig(r),null===(s=this._removeEventTriggerCaptureHook)||void 0===s||s.call(this),this._removeEventTriggerCaptureHook=this._strategy.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(e,t)=>this._activateTrigger(e,t)),this._checkOverride(re,()=>{this.overrideSampling()},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(re)}),this._checkOverride(oe,()=>{this.overrideLinkedFlag()},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(oe)}),this._checkOverride(le,()=>{this.overrideTrigger("event")},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(le)}),this._checkOverride(ae,()=>{this.overrideTrigger("url")},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(ae)}),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(Qr(e,"beforeunload",this._onBeforeUnload),Qr(e,"pagehide",this._onPageHide),Qr(e,"offline",this._onOffline),Qr(e,"online",this._onOnline),Qr(n,"visibilitychange",this._onVisibilityChange),!this._onSessionIdListener&&Ct(this._sessionManager.onSessionId)&&(this._onSessionIdListener=this._sessionManager.onSessionId(this._onSessionIdCallback)),!this._onSessionIdleResetForcedListener&&Ct(this._sessionManager.on)?this._onSessionIdleResetForcedListener=this._sessionManager.on("forcedIdleReset",()=>{this._clearConditionalRecordingPersistence(),this._isIdle="unknown",this.stop(),this._forceIdleSessionIdListener=this._sessionManager.onSessionId((e,t,i)=>{var n;null===(n=this._forceIdleSessionIdListener)||void 0===n||n.call(this),this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback(e,t,i)})}):Ct(this._sessionManager.on)||uu.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Rt(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this._instance.on("eventCaptured",e=>{try{if("$pageview"===e.event){const t=(null==e?void 0:e.properties.$current_url)?this._maskReplayUrl(e.properties.$current_url):"";if(!t)return;this._tryAddCustomEvent("$pageview",{href:t})}}catch(e){uu.error("Could not add $pageview to rrweb session",e)}})),"active"===this.status&&this._reportStarted(t||"recording_initialized"))}_teardown(){var t,i,s,r,o,a;null==e||e.removeEventListener("beforeunload",this._onBeforeUnload),null==e||e.removeEventListener("pagehide",this._onPageHide),null==e||e.removeEventListener("offline",this._onOffline),null==e||e.removeEventListener("online",this._onOnline),null==n||n.removeEventListener("visibilitychange",this._onVisibilityChange),clearInterval(this._fullSnapshotTimer),this._clearFlushBufferTimer(),null===(t=this._removePageViewCaptureHook)||void 0===t||t.call(this),this._removePageViewCaptureHook=void 0,null===(i=this._removeEventTriggerCaptureHook)||void 0===i||i.call(this),this._removeEventTriggerCaptureHook=void 0,null===(s=this._onSessionIdListener)||void 0===s||s.call(this),this._onSessionIdListener=void 0,null===(r=this._onSessionIdleResetForcedListener)||void 0===r||r.call(this),this._onSessionIdleResetForcedListener=void 0,null===(o=this._forceIdleSessionIdListener)||void 0===o||o.call(this),this._forceIdleSessionIdListener=void 0,null===(a=this._strategy)||void 0===a||a.stop(),this._stopRecordingProducers(),this._invalidateCompressionQueue()}_invalidateCompressionQueue(){this._compressionQueueGeneration+=1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueue=void 0,this._isStoppingAfterCompression=!1}_stopRecordingProducers(){var e,t;null===(e=this._mutationThrottler)||void 0===e||e.stop(),this._queuedRRWebEvents=[],null===(t=this._jsonLdCapture)||void 0===t||t.stop(),this._jsonLdCapture=void 0,this._jsonLdCaptureReady=!1;try{var i;null===(i=this._stopRrweb)||void 0===i||i.call(this)}catch(e){uu.warn("could not stop rrweb",e)}this._stopRrweb=void 0}_stopAfterCompressionQueueDrains(){if(!this._compressionQueue||0===this._queuedCompressionEvents)return!1;if(this._isStoppingAfterCompression)return!0;this._isStoppingAfterCompression=!0,this._flushHoldReason=void 0;const e=this._compressionQueueGeneration;return this._clearFlushBufferTimer(),this._stopRecordingProducers(),this._compressionQueue.catch(()=>{}).then(()=>{e===this._compressionQueueGeneration&&(this._isStoppingAfterCompression=!1,this._flushBuffer(),this._clearBuffer(),this._releaseHoldAfterStop(),this._teardown(),uu.info("stopped"))}).catch(()=>{this._isStoppingAfterCompression=!1,this._releaseHoldAfterStop(),this._teardown(),uu.info("stopped")}),!0}stop(){if(this._stopRecordingProducers(),this._isRestartingForSessionIdChange)this._drainCompressionQueueSync();else if(this._stopAfterCompressionQueueDrains())return;this._flushBuffer(),this._clearBuffer(),this._releaseHoldAfterStop(),this._teardown(),uu.info("stopped")}_releaseHoldAfterStop(){this._setFlushHold(void 0,{preserveLogDedup:this._isRestartingForSessionIdChange}),this._heldEpochShipsOnUnload=!1}flushBeforeIdentityReset(){(this.isStarted||this._isStoppingAfterCompression)&&(this._drainCompressionQueueSync(),this._flushBuffer())}_restartForSessionIdChange(e){this._isRestartingForSessionIdChange=!0,this._lastActivityTimestamp=Date.now();try{var t,i;this.stop(),this._lastSeenSnapshotCost=void 0,this._unstringifiableEventsDropped=0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,null===(t=pu())||void 0===t||null===(i=t.resetSnapshotCostState)||void 0===i||i.call(t),this.start("session_id_changed")}finally{this._isRestartingForSessionIdChange=!1}this._setFlushHold(e?"no_interaction_since_session_rotated":void 0),this._heldEpochShipsOnUnload=!1}_setFlushHold(e,{preserveLogDedup:t=!1}={}){if(this._holdFlushUntilInteraction=!It(e),this._flushHoldReason=e,It(e))return void(t||(this._lastLoggedFlushHold=void 0));if(this._isRestartingForSessionIdChange)return;const i=`${this.sessionId}:${e}`;i!==this._lastLoggedFlushHold&&(this._lastLoggedFlushHold=i,uu.info(`holding buffer: ${e}. nothing is uploaded until the user interacts with the page`))}_releaseHoldAndFlush(){this.isStarted||(this._suppressNextFreshStartHold=!0),this._holdFlushUntilInteraction&&(this._setFlushHold(void 0),this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed&&(this._heldBufferOverflowed=!1,this._tryTakeFullSnapshot()),this._scheduleFlushBuffer())}discard({discardProducerEvents:e=!1}={}){this._holdFlushUntilInteraction=!0,e&&(this._clearBuffer(),this._stopRecordingProducers()),this._clearBuffer(),this._teardown(),this._clearBuffer(),this._releaseHoldAfterStop(),uu.info("discarded")}_captureProcessedEvent(e,t,i,n,s){if(-1===i)return this._unstringifiableEventsDropped+=1,void uu.warn("could not stringify event - dropping it to keep the rest of the recording");const r={$snapshot_bytes:i,$snapshot_data:t,$session_id:n,$window_id:s};"disabled"!==this.status?(this._ensureFullSnapshotForSession(e,n),this._captureSnapshotBuffered(r)):this._clearBuffer()}_safeTrackFullSnapshotCost(){try{this._trackFullSnapshotCost()}catch(e){this._snapshotCostErrorLogged||(this._snapshotCostErrorLogged=!0,uu.error("could not track full snapshot cost",e))}}_trackFullSnapshotCost(){var e,t;const i=null===(e=pu())||void 0===e||null===(t=e.getLastSnapshotCost)||void 0===t?void 0:t.call(e);i&&i!==this._lastSeenSnapshotCost&&(this._lastSeenSnapshotCost=i,500>i.durationMs||uu.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(i.durationMs),stylesheetMs:Math.round(i.stylesheetMs),nodeCount:i.nodeCount,cssRuleCount:i.cssRuleCount,nonDeferrableCssRuleCount:i.nonDeferrableCssRuleCount,deferredStylesheetCount:i.deferredStylesheetCount}))}_ensureFullSnapshotForSession(e,t){2!==e.type?3===e.type&&(It(this._lastFullSnapshotSessionId)||this._lastFullSnapshotSessionId===t||this._fullSnapshotHealAttemptedFor===t||(this._fullSnapshotHealAttemptedFor=t,uu.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:t}),this._tryTakeFullSnapshot())):this._lastFullSnapshotSessionId=t}_finishQueuedCompressionEvent(e){e.counted&&e.generation===this._compressionQueueGeneration&&(this._queuedCompressionEvents=Math.max(0,this._queuedCompressionEvents-1)),e.counted=!1,this._pendingCompressionEvents=this._pendingCompressionEvents.filter(t=>t!==e)}_captureQueuedCompressionEvent(e,t,i){e.processed||e.generation!==this._compressionQueueGeneration||(e.processed=!0,this._captureProcessedEvent(e.event,t,i,e.targetSessionId,e.targetWindowId))}_processQueuedCompressionEventSync(e){try{let t,i=e.event;if(e.compressionEnabled)try{({event:i,size:t}=Pu(e.event))}catch(e){uu.warn("could not process queued compression event - will use uncompressed event",e)}It(t)&&(t=Da(e.event));try{this._captureQueuedCompressionEvent(e,i,t)}catch(e){uu.warn("could not capture queued compression event",e)}}finally{this._finishQueuedCompressionEvent(e)}}_drainCompressionQueueSync(){[...this._pendingCompressionEvents].forEach(e=>{try{this._processQueuedCompressionEventSync(e)}catch(e){uu.warn("could not drain queued compression event",e)}})}_enqueueCompression(e,t,i,n){var s=this;const r={event:e,compressionEnabled:t,targetSessionId:i,targetWindowId:n,generation:this._compressionQueueGeneration,processed:!1,counted:!0};this._pendingCompressionEvents.push(r),this._queuedCompressionEvents+=1;const o=(a=rt(function*(){try{if(r.processed)return;let i,n;try{const s=t?Eu(e)?yield function(e){return Ru.apply(this,arguments)}(e):Pu(e):{event:e,size:Da(e)};i=s.event,n=s.size}catch(t){uu.warn("could not process queued compression event - will use uncompressed event",t),i=e,n=Da(e)}s._captureQueuedCompressionEvent(r,i,n)}finally{s._finishQueuedCompressionEvent(r)}}),function(){return a.apply(this,arguments)});var a;this._compressionQueue=this._compressionQueue?this._compressionQueue.catch(()=>{}).then(o):o()}onRRwebEmit(t){var i,n,s,r,o,a,l,c,u,d,h;if(!this._instance.sessionManager)return;if(this._processQueuedEvents(),!t||!xt(t))return;if(4===t.type){const e=this._maskReplayUrl(t.data.href);if(this._lastHref=e,!e)return;t.data.href=e}else this._pageViewFallBack();if(null===(i=this._strategy)||void 0===i||i.checkUrlTriggers(this.sessionId,()=>this._pauseRecording(),()=>this._resumeRecording(),(e,t)=>this._activateTrigger(e,t)),this._urlTriggerMatching.urlBlocked&&!function(e){return 5===e.type&&"recording paused"===e.data.tag}(t))return;2===t.type&&(this._safeTrackFullSnapshotCost(),Promise.resolve().then(()=>this._safeTrackFullSnapshotCost()),this._scheduleFullSnapshot(),null===(d=this._mutationThrottler)||void 0===d||d.reset(),null===(h=this._instance.persistence)||void 0===h||h.register_once({$debug_first_full_snapshot_timestamp:t.timestamp},void 0));const p=2===t.type&&(null===(n=this._strategy)||void 0===n?void 0:n.hasPendingTriggers(this.sessionId));p&&this._clearBufferBeforeMostRecentMeta();const g=this._mutationThrottler?this._mutationThrottler.throttleMutations(t):t;if(!g)return void(!0===this._isIdle&&this._eventsDroppedWhileIdle++);const _=function(e){const t=e;if(t&&xt(t)&&6===t.type&&xt(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));const i=[];for(let e=0;t.data.payload.payload.length>e;e++)i.push(t.data.payload.payload[e]&&t.data.payload.payload[e].length>2e3?t.data.payload.payload[e].slice(0,2e3)+"...[truncated]":t.data.payload.payload[e]);return t.data.payload.payload=i,e}return e}(g),f=function(e){return Lu(e)?e.data.payload:null}(_),v=function(e){return Ou(e)?e.data.payload:null}(_),m=function(e){return Au(e)?e.data.payload:null}(_);f||v?(null==f?void 0:f.lastActivityTimestamp)&&(_.timestamp=f.lastActivityTimestamp):(null==m?void 0:m.sessionId)||this._updateWindowAndSessionIds(_);const y=null!==(s=null!==(r=null!==(o=null==f?void 0:f.currentSessionId)&&void 0!==o?o:null==v?void 0:v.nextSessionId)&&void 0!==r?r:null==m?void 0:m.sessionId)&&void 0!==s?s:this._sessionId,b=null!==(a=null!==(l=null!==(c=null==f?void 0:f.currentWindowId)&&void 0!==c?c:null==v?void 0:v.nextWindowId)&&void 0!==l?l:null==m?void 0:m.windowId)&&void 0!==a?a:this._windowId;if(!0===this._isIdle&&!function(e){return Au(e)||Lu(e)||Ou(e)}(_))return void(function(e){return 2===e.type||4===e.type||3===e.type&&9!==e.data.source}(_)&&this._eventsDroppedWhileIdle++);2===_.type&&(this._eventsDroppedWhileIdle=0),m&&(_.timestamp=m.lastActivityTimestamp+m.threshold);const S=this._jsonLdCaptureReady;this._jsonLdCaptureReady=!0,p?this._scheduleJsonLdScan(!0):S||this._scheduleJsonLdScan();const w=null===(u=this._instance.config.session_recording.compress_events)||void 0===u||u;if(5===_.type&&"$json_ld"===_.data.tag){let t;try{t=e?this._maskReplayUrl(e.location.href):void 0}catch(e){}_.data.href=t}if(this._queuedCompressionEvents>0||w&&Eu(_))return void this._enqueueCompression(_,w,y,b);const{event:k,size:C}=w?Pu(_):{event:_,size:Da(_)};this._captureProcessedEvent(_,k,C,y,b)}get status(){return this._strategy?this._strategy.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this._isSampled,rrwebError:this._rrwebError,urlTriggerMatching:this._urlTriggerMatching,eventTriggerMatching:this._eventTriggerMatching,linkedFlagMatching:this._linkedFlagMatching,remoteConfig:this._remoteConfig}):da}log(e,t="log"){var i;null===(i=this._instance.sessionRecording)||void 0===i||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}overrideLinkedFlag(){this._linkedFlagMatching.linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null===(e=this._instance.persistence)||void 0===e||e.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e),this._releaseHoldAndFlush()}_currentMaskedHostname(){try{var t;const i=null==e||null===(t=e.location)||void 0===t?void 0:t.href;if(!i)return;const n=this._maskReplayUrl(i);if(!n)return;return new URL(n).hostname||void 0}catch(e){return}}_clearFlushBufferTimer(){this._flushBufferTimer&&(clearTimeout(this._flushBufferTimer),this._flushBufferTimer=void 0)}_scheduleFlushBuffer(){this._flushBufferTimer||(this._flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_wouldOpenRecordingWithMarkersOnly(){return this._lastFullSnapshotSessionId!==this._buffer.sessionId&&0!==this._buffer.data.length&&this._buffer.data.every(e=>5===(null==e?void 0:e.type)&&!Lu(e)&&!Ou(e))}_describePendingTriggerConditions(){var e,t;return null!==(e=null===(t=this._strategy)||void 0===t?void 0:t.getPendingTriggerConditions(this.sessionId))&&void 0!==e?e:[]}_maybeLogBufferingReason(e){if("buffering"!==e)return It(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Ue]:[]}),void(this._lastLoggedBufferingReason=void 0);const t=this._describePendingTriggerConditions();if(0===t.length)return It(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Ue]:[]}),void(this._lastLoggedBufferingReason=void 0);const i=t.join(", "),n=`${this.sessionId}:${i}`;n!==this._lastLoggedBufferingReason&&(this._lastLoggedBufferingReason=n,this._instance.register_for_session({[Ue]:t}),uu.info(`buffering: ${i}`))}_canParkPendingBuffer(){var e;return"memory"!==this._instance.config.persistence&&!0!==(null===(e=this._instance.persistence)||void 0===e?void 0:e._disabled)&&Kl._is_supported()}_parkBufferForNextPage(){0!==this._buffer.data.length&&this._buffer.size!==this._lastParkedBufferSize&&943718.4>=this._buffer.size&&this._canParkPendingBuffer()&&(this._lastParkedBufferSize=this._buffer.size,Kl._set(this._pendingBufferStorageKey,this._buffer))}_restorePendingBuffer(){if(this._pendingBufferRestored||!this._canParkPendingBuffer())return;this._pendingBufferRestored=!0;const e=Kl._parse(this._pendingBufferStorageKey);Kl._remove(this._pendingBufferStorageKey),xt(e)&&kt(e.data)&&0!==e.data.length&&kt(e.sizes)&&e.sizes.length===e.data.length&&Ft(e.size)&&e.sessionId===this._sessionId&&e.windowId===this._windowId&&(this._buffer.data.length>0||(this._buffer=e))}_flushBuffer(e=!1){var t;if(this._clearFlushBufferTimer(),this._holdFlushUntilInteraction)return this._buffer;if(this._wouldOpenRecordingWithMarkersOnly())return this._buffer.size>943718.4?this._clearBuffer():(e&&this._parkBufferForNextPage(),this._buffer);const i=this._buffer;null===(t=this._strategy)||void 0===t||t.ensureSamplingDecision(this.sessionId);const n=this._isBelowMinimumDuration(),s=this.status;if(this._maybeLogBufferingReason(s),"buffering"===s||"paused"===s||"disabled"===s||n)return!e||"active"!==s&&"sampled"!==s||this._parkBufferForNextPage(),this._scheduleFlushBuffer(),this._buffer;if(this._buffer!==i)return this._buffer;if(i.data.length>0){var r;const e=this._currentMaskedHostname();Na(i).forEach(t=>{try{var i;null===(i=this._flushedSizeTracker)||void 0===i||i.trackSize(t.sessionId,t.size),this._captureSnapshot(ct(ct(ct(ct({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:Jl.LIB_NAME,$lib_version:Jl.LIB_VERSION,$snapshot_host:e},this._throttledMutationsDropped>0?{$sdk_debug_replay_throttled_mutations_dropped:this._throttledMutationsDropped}:{}),this._oversizedMutationsDropped>0?{$sdk_debug_replay_oversized_mutations_dropped:this._oversizedMutationsDropped}:{}),this._oversizedMutationBytesDropped>0?{$sdk_debug_replay_oversized_mutation_bytes_dropped:this._oversizedMutationBytesDropped}:{}),this._unstringifiableEventsDropped>0?{$sdk_debug_replay_unstringifiable_events_dropped:this._unstringifiableEventsDropped}:{}))}catch(e){uu.warn("could not capture snapshot chunk - skipping it",e)}}),It(this._lastParkedBufferSize)||(Kl._remove(this._pendingBufferStorageKey),this._lastParkedBufferSize=void 0),null===(r=this._strategy)||void 0===r||r.onFlushComplete()}return this._clearBuffer()}_captureSnapshotBuffered(e){var t;const i=2+((null===(t=this._buffer)||void 0===t?void 0:t.data.length)||0),n=e.$session_id,s=this._buffer.sessionId!==n;if(s||!0!==this._isIdle&&!this._holdFlushUntilInteraction&&this._buffer.size+e.$snapshot_bytes+i>943718.4){const t=this._sessionId;if(this._buffer=this._flushBuffer(),this._sessionId!==t)return;s&&this._buffer.data.length>0&&(this._buffer=this._clearBuffer()),this._buffer.sessionId=n,this._buffer.windowId=e.$window_id}this._holdFlushUntilInteraction&&(this._heldBufferOverflowed||this._buffer.size+e.$snapshot_bytes+i>943718.4)?this._heldBufferOverflowed=!0:(this._buffer.size+=e.$snapshot_bytes,this._buffer.data.push(e.$snapshot_data),this._buffer.sizes.push(e.$snapshot_bytes),!0===this._isIdle||this._holdFlushUntilInteraction||this._scheduleFlushBuffer())}_captureSnapshot(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get _sessionDuration(){var e,t;const i=null===(e=this._buffer)||void 0===e?void 0:e.data[(null===(t=this._buffer)||void 0===t?void 0:t.data.length)-1];return i?i.timestamp-this._sessionStartTimestamp:null}_clearBufferBeforeMostRecentMeta(){if(!this._buffer||0===this._buffer.data.length)return this._clearBuffer();let e=-1;for(let t=this._buffer.data.length-1;t>=0;t--)if(4===this._buffer.data[t].type){e=t;break}return 0>e?this._clearBuffer():(this._buffer.data=this._buffer.data.slice(e),this._buffer.sizes=this._buffer.sizes.slice(e),this._buffer.size=this._buffer.sizes.reduce((e,t)=>e+t,0),this._buffer)}_clearBuffer(){return this._buffer={size:0,data:[],sizes:[],sessionId:this._sessionId,windowId:this._windowId},this._buffer}_reportStarted(e,t){this._instance.register_for_session({[Ke]:e}),uu.info(e.replace("_"," "),t),"session_id_changed"!==e&&this._tryAddCustomEvent("$recording_started",ct({reason:e},t))}_isInteractiveEvent(e){var t;return 3===e.type&&-1!==du.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}_updateWindowAndSessionIds(e){const t=this._isInteractiveEvent(e);t||!0===this._isIdle||e.timestamp-this._lastActivityTimestamp>this._sessionIdleThresholdMilliseconds&&(this._isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this._sessionIdleThresholdMilliseconds,bufferLength:this._buffer.data.length,bufferSize:this._buffer.size,sessionId:this._sessionId,windowId:this._windowId}),this._flushBuffer());const{windowId:i,sessionId:n}=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp);let s=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this._isIdle)){const t="unknown"===this._isIdle;this._isIdle=!1,t||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),s=!0)}const r=this._sessionId!==n,o=this._windowId!==i;if(this._windowId=i,this._sessionId=n,r||o){const e=r&&!1!==this._isIdle;e&&(this._isIdle="unknown"),this._restartForSessionIdChange(e)}else if(t&&this._releaseHoldAndFlush(),s){var a;const e=["sampled","active"].includes(this.status)||(null===(a=this._strategy)||void 0===a?void 0:a.hasPendingTriggers(this.sessionId));this._eventsDroppedWhileIdle>0&&e&&this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot()}}_clearConditionalRecordingPersistence(){var e;null===(e=this._strategy)||void 0===e||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e;return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this._flushHoldReason,$sdk_debug_replay_internal_buffer_length:this._buffer.data.length,$sdk_debug_replay_internal_buffer_size:this._buffer.size,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(e=this._flushedSizeTracker)||void 0===e?void 0:e.currentTrackedSize(this.sessionId),$sdk_debug_replay_rrweb_error:this._rrwebError,[Ge]:this._rrwebAttached,[Qe]:this._rrwebStartAttempted}}get _rrwebAttached(){var e,t,i;return!!this._stopRrweb&&(null===(e=null===(t=gu())||void 0===t||null===(i=t.isRecording)||void 0===i?void 0:i.call(t))||void 0===e||e)}_startRecorder(){var t;if(this._stopRrweb)return;this._rrwebStartAttempted=!0;const i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},s=this._instance.config.session_recording;for(const[e,t]of Object.entries(s||{}))if(e in i)if("maskInputOptions"===e)i.maskInputOptions=ct({password:!0},t);else if("sampling"===e){const e=null!=t?t:{},n={};It(e.mousemove)||(n.mousemove=e.mousemove),It(e.mouseInteraction)||(n.mouseInteraction=e.mouseInteraction),i.sampling=n}else i[e]=t;var r,o,a,l;!0===(null==s?void 0:s.captureJsonLd)&&!0!==i.slimDOMOptions&&"all"!==i.slimDOMOptions&&(i.slimDOMOptions=ct(ct({},i.slimDOMOptions),{},{script:!0})),this._canvasRecording&&this._canvasRecording.enabled&&(i.recordCanvas=!0,i.sampling=ct(ct({},i.sampling),{},{canvas:this._canvasRecording.fps}),i.dataURLOptions={type:"image/webp",quality:this._canvasRecording.quality},i.canvasResolutionScale=this._canvasResolutionScale,i.canvasMasking={configured:()=>{var e;return Ct(null===(e=this._instance.config.session_recording)||void 0===e||null===(e=e.canvasCapture)||void 0===e?void 0:e.maskRegionsFn)},regionsFn:e=>{var t;const i=null===(t=this._instance.config.session_recording)||void 0===t||null===(t=t.canvasCapture)||void 0===t?void 0:t.maskRegionsFn;if(Ct(i))try{var n;return null!==(n=i(e))&&void 0!==n?n:null}catch(e){return this._maskRegionsFnFailed||(this._maskRegionsFnFailed=!0,uu.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",e)),null}}}),this._masking&&(i.maskAllInputs=null===(r=this._masking.maskAllInputs)||void 0===r||r,i.maskTextSelector=null!==(o=this._masking.maskTextSelector)&&void 0!==o?o:void 0,i.blockSelector=null!==(a=this._masking.blockSelector)&&void 0!==a?a:void 0,i.maskAllElementAttributes=null!==(l=this._masking.maskAllElementAttributes)&&void 0!==l&&l),i.maskAllElementAttributes&&i.maskAttributeFn&&(i.maskAttributeFn=void 0,this._hasWarnedExclusiveAttributeMasking||(this._hasWarnedExclusiveAttributeMasking=!0,uu.warn('`maskAllElementAttributes` and `maskAttributeFn` are mutually exclusive, and `maskAttributeFn` is being ignored. Remove one of the two. Note that `maskAllElementAttributes` can also come from your project\'s "Privacy and masking" settings. See https://posthog.com/docs/session-replay/privacy'))),this._warnIfClientMaskingShadowsServer();const c=gu();if(!c)return void uu.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this._mutationThrottler=null!==(t=this._mutationThrottler)&&void 0!==t?t:new bl(c,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(e,t)=>{const i=`Too many mutations on node '${e}'. Rate limiting. This could be due to SVG animations or something similar`;uu.info(i,{node:t}),this.log("[SessionRecording] "+i,"warn")},onDroppedAttributeMutations:e=>this._throttledMutationsDropped+=e,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this._fullSnapshotIntervalMillis,onDroppedOversizedMutation:e=>{0===this._oversizedMutationsDropped&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this._oversizedMutationsDropped+=1,this._oversizedMutationBytesDropped+=e},requestFullSnapshot:()=>this._tryTakeFullSnapshot()});const u=this._gatherRRWebPlugins();if(this._stopRrweb=c(ct(ct({emit:e=>{this.onRRwebEmit(e)},plugins:u,errorHandler:(e,t)=>"rrweb"===t&&(this._hasLoggedRecorderCallbackError||(this._hasLoggedRecorderCallbackError=!0,uu.error("rrweb internal error - recording will continue but may be incomplete",e)),!0)},i),{},{recordAfter:"DOMContentLoaded"})),!this._stopRrweb)return this._rrwebError=!0,void uu.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this._rrwebError=!1,!0===(null==s?void 0:s.captureJsonLd)&&n&&(null==e?void 0:e.MutationObserver)&&!this._jsonLdCapture&&(this._jsonLdCapture=function(e,t,i){const n=new WeakMap,s=i.getCaptureState||(()=>!0);let r=Bc;const o=function(e,t){const i=t.attributeFilter;return t.maskAllElementAttributes||t.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?zc:i=>{const n=e.getElementById(i);return!!n&&"SCRIPT"!==n.nodeName&&(!t.isRecordedElement||t.isRecordedElement(n))&&!au(n,t.blockClass,t.blockSelector)}}(e,i),a=t=>{try{const a=s();if(!r||!1===a||!t.isConnected||t.ownerDocument!==e||function(e,t){return au(e,t.blockClass,t.blockSelector)||au(e,t.maskTextClass,t.maskTextSelector)}(t,i))return;const l=function(e,t=zc,i){if(!e||e.length>Bc)return null;try{const n=JSON.parse(e),s={maskUrl:i,remainingNodes:2048,exceeded:!1},r=kt(n)?n.map(e=>su(e,t,s)):su(n,t,s);if(s.exceeded||Pt(r)||kt(r)&&(!r.length||r.some(Pt)))return null;const o=JSON.stringify(r);return o.length>2e4?null:[r,o]}catch(e){return null}}(t.text,o,i.maskUrl);if(!l)return void n.delete(t);const[c,u]=l;if(Pt(a))return void n.set(t,u);if(n.get(t)!==u){if(u.length>r)return void(r=0);i.emit(c)&&(n.set(t,u),r-=u.length)}}catch(e){return}};try{const i=new t(e=>{try{if(!r||!1===s())return;const t=e=>{for(const t of lu(e))a(t)};for(const i of e)if("childList"===i.type)ru(i.target)&&a(i.target),i.addedNodes.forEach(t);else if("characterData"===i.type){const e=i.target.parentNode;e&&ru(e)&&a(e)}else"attributes"===i.type&&ru(i.target)&&a(i.target)}catch(e){return}});return i.observe(e,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(t=!1){r&&!1!==s()&&lu(e.documentElement).forEach(e=>{t&&n.delete(e),a(e)})},stop(){return i.disconnect()}}}catch(e){return{scan(){},stop(){}}}}(n,e.MutationObserver,{maskUrl:e=>this._maskReplayUrl(e),attributeFilter:i.attributeFilter,blockClass:i.blockClass,blockSelector:i.blockSelector,isRecordedElement:e=>c.mirror.getId(e)>0,maskAllElementAttributes:i.maskAllElementAttributes,maskAttributeFn:i.maskAttributeFn,maskTextClass:i.maskTextClass,maskTextSelector:i.maskTextSelector,getCaptureState:()=>{var e;return!0!==(null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.captureJsonLd)||this._urlTriggerMatching.urlBlocked||this._urlTriggerMatching.isCurrentUrlBlocked()?null:this._canCaptureJsonLd()},emit:e=>this._tryAddJsonLdEvent(e)}),this._urlTriggerMatching.isCurrentUrlBlocked()&&this._jsonLdCapture.scan()),this._lastActivityTimestamp=Date.now(),this._isIdle=Lt(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:i,activePlugins:u.map(e=>null==e?void 0:e.name)}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}};const $u=["type"];var Nu=function(e){return e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e}({}),Bu=function(e){return e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e}({}),qu=function(e){return e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e}({}),Hu=function(e){return e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e}({}),zu=function(e){return e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e}({}),Uu=function(e){return e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e}({}),Wu=function(e){return e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e}({});function ju(e,t){return-1!==e.indexOf(t)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,new RegExp(/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi.source,"i");var Vu=/[a-z][a-z0-9+.-]{0,63}:\/\//i;new RegExp(`^${Vu.source}`,"i"),new RegExp(Vu.source,"gi");var Gu={Node:["childNodes","parentNode","parentElement","textContent","previousSibling","nextSibling","lastChild"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Qu={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Ku={};function Ju(e){if(Ku[e])return Ku[e];const t=function(e){var t,i;const n=null===(t=globalThis)||void 0===t||null===(t=t.Zone)||void 0===t||null===(i=t.__symbol__)||void 0===i?void 0:i.call(t,e);return n&&globalThis[n]?globalThis[n]:void 0}(e)||globalThis[e],i=t.prototype,n=e in Gu?Gu[e]:void 0,s=Boolean(n&&n.every(e=>{var t;return Boolean(null===(t=Object.getOwnPropertyDescriptor(i,e))||void 0===t||null===(t=t.get)||void 0===t?void 0:t.toString().includes("[native code]"))})),r=e in Qu?Qu[e]:void 0,o=Boolean(r&&r.every(e=>{var t;return"function"==typeof i[e]&&(null===(t=i[e])||void 0===t?void 0:t.toString().includes("[native code]"))}));if(s&&o)return Ku[e]=t.prototype,t.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 t.prototype;const s=n[e].prototype;return s?(function(e){return ju(e,"AppleWebKit")&&!ju(e,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",e),l=!0),Ku[e]=s):i}catch(e){return i}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var Zu=Object.create(null);function Yu(e,t,i){var n;const s=Zu[e],r=s[i];if(r)return r.call(t);const o=Ju(e),a=null===(n=Object.getOwnPropertyDescriptor(o,i))||void 0===n?void 0:n.get;return a?(s[i]=a,a.call(t)):t[i]}Zu.Node=Object.create(null),Zu.ShadowRoot=Object.create(null),Zu.MutationObserver=Object.create(null),Zu.Element=Object.create(null);var Xu,ed={};function td(e,t,i){const n=`${e}.${String(i)}`;if(ed[n])return ed[n].bind(t);const s=Ju(e)[i];return"function"!=typeof s?t[i]:(ed[n]=s,s.bind(t))}function id(){return Ju("MutationObserver").constructor}function nd(e,t,i){try{if(!(t in e))return()=>{};const n=e[t],s={next:n},r=i(function(...e){return s.next.apply(this,e)});return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:n},__rrweb_layer__:{enumerable:!1,value:s}})),e[t]=r,()=>{if(e[t]===r)return void(e[t]=s.next);const i=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0};let n=e[t],o=i(n);for(;o;){if(o.next===r)return void(o.next=s.next);n=o.next,o=i(n)}}}catch(e){return()=>{}}}var sd={childNodes:e=>Yu("Node",e,"childNodes"),parentNode:e=>Yu("Node",e,"parentNode"),parentElement:e=>Yu("Node",e,"parentElement"),textContent:e=>Yu("Node",e,"textContent"),previousSibling:e=>Yu("Node",e,"previousSibling"),nextSibling:e=>Yu("Node",e,"nextSibling"),lastChild:e=>Yu("Node",e,"lastChild"),isConnected(e){if(void 0===Xu){var t;const e=null===(t=Object.getOwnPropertyDescriptor(Ju("Node"),"isConnected"))||void 0===t?void 0:t.get;Xu=(null==e?void 0:e.toString().includes("[native code]"))?e:null}return null==Xu?void 0:Xu.call(e)},contains:(e,t)=>td("Node",e,"contains")(t),getRootNode:e=>td("Node",e,"getRootNode")(),host:e=>e&&"host"in e?Yu("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?Yu("Element",e,"shadowRoot"):null,querySelector:(e,t)=>td("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>td("Element",e,"querySelectorAll")(t),mutationObserver:id,patch:nd};function rd(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(e){}return Date.now()}var od=0;function ad(){od+=1}function ld(){return od}function cd(e,t){return(t!==od||e>6e4)&&!0}var ud=0,dd=0,hd=0,pd={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},gd=null,_d=null,fd=[],vd=0,md=0,yd={slowestBatchMs:0},bd={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function Sd(e){(ud+=1)>1||(pd={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},fd=[],vd=0,_d=(e=>e&&e>0?e:null)(e),dd=rd(),hd=od)}function wd(){return 0===ud?gd||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(ud-=1)>0?pd:(pd.durationMs=rd()-dd,pd.deferredStylesheetCount=vd,bd.deferredCount+=vd,_d=null,cd(pd.durationMs,hd)?pd:gd=pd)}function kd(e,t,i){let n=e.length;if(i>=32)return n;for(let s=0;e.length>s;s++){const r=e[s];try{const e=r.cssRules;if(e&&e.length)n+=kd(e,t,i+1);else if(t&&r.styleSheet){const e=r.styleSheet;if(!t.has(e)){t.add(e);const s=e.rules||e.cssRules;s&&(n+=kd(s,t,i+1))}}}catch(e){}}return n}function Cd(e){if(0===ud)return;const t=kd(e,null,0);pd.cssRuleCount+=t,md>0&&(pd.nonDeferrableCssRuleCount+=t)}function xd(e){md+=1;try{return e()}finally{md-=1}}function Ed(e){ud>0&&(pd.stylesheetMs+=e)}function Id(e){if(0===ud||null===_d)return!1;const t=pd.cssRuleCount-pd.nonDeferrableCssRuleCount;return t>=_d||t+function(e){try{const t=e&&(e.rules||e.cssRules);if(!t)return 0;const i=new WeakSet;return i.add(e),kd(t,i,0)}catch(e){return 0}}(e)>_d}function Td(){const e=fd;return fd=[],e}function Md(){bd.failedCount+=1}function Pd(e){e>0&&(bd.abandonedCount+=e)}function Rd(e){return Rd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rd(e)}function Fd(e,t,i){return(t=function(e){var t=function(e){if("object"!=Rd(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=Rd(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Rd(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ad(e){return e.nodeType===e.ELEMENT_NODE}function Ld(e){const t=e&&"host"in e&&"mode"in e&&sd.host(e)||null;return Boolean(t&&"shadowRoot"in t&&sd.shadowRoot(t)===e)}function Od(e){return"[object ShadowRoot]"==={}.toString.call(e)}function Dd(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function $d(e){const{cssText:t}=e;if(3>t.split('"').length)return t;const i=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?i.push("layer"):e.layerName&&i.push(`layer(${e.layerName})`),e.supportsText&&i.push(`supports(${e.supportsText})`),e.media.length&&i.push(e.media.mediaText),i.join(" ")+";"}var Nd=0;function Bd(e){const t=0===Nd,i=t?rd():0;Nd+=1;try{const t=e.rules||e.cssRules;if(!t)return null;Cd(t);let i=e.href;return!i&&e.ownerNode&&(i=e.ownerNode.baseURI),Dd(Array.from(t,e=>qd(e,i)).join(""))}catch(e){return null}finally{Nd-=1,t&&Ed(rd()-i)}}function qd(e,t){if(zd(e)){let t;try{t=Bd(e.styleSheet)||$d(e)}catch(i){t=e.cssText}try{var i;if(t&&(null===(i=e.styleSheet)||void 0===i?void 0:i.href))return sh(t,e.styleSheet.href)}catch(e){}return t}{let i=e.cssText;return Ud(e)&&e.selectorText.includes(":")&&(i=Hd(i)),t?sh(i,t):i}}function Hd(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function zd(e){return"styleSheet"in e}function Ud(e){return"selectorText"in e}var Wd=/^-?[A-Za-z_][\w-]*$/,jd=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Vd(e){const t=[];let i=!1,n=null;const s=new Map;function r(e){const s=t.pop();if("group"===s.kind){if(null===e){for(;t.length>0&&"group"===t[t.length-1].kind;)t.pop();return void r(null)}const i=t[t.length-1];return i.parts.push(e),void(i.index+=1)}if(!s.importRule)return i=!0,void(n=e);o(t[t.length-1],s.importRule,e)}function o(e,t,i){try{let s;try{s=i||$d(t)}catch(e){s=t.cssText}try{var n;s&&(null===(n=t.styleSheet)||void 0===n?void 0:n.href)&&(s=sh(s,t.styleSheet.href))}catch(e){}s&&e.parts.push(s),e.index+=1}catch(e){r(null)}}function a(e){const i=e.rules[e.index];if("sheet"===e.kind&&zd(i)){const n=s.get(i);return null===n?(e.parts.push(i.cssText),void(e.index+=1)):n?void t.push({kind:"sheet",sheet:n.sheet,rules:n.rules,sheetHref:n.sheetHref,index:0,parts:[],importRule:i}):void o(e,i,null)}if(function(e,i){try{const n=function(e){const t=e;if(!t.cssRules||0===t.cssRules.length)return null;if(t.media&&"string"==typeof t.media.mediaText)return`@media ${t.media.mediaText} {`;if(Ud(e)){if("number"==typeof t.type&&1!==t.type)return null;const i=t.style?t.style.cssText:"";return`${e.selectorText} {${i?" "+i:""}`}if("containerName"in t)return"string"!=typeof t.containerQuery||t.containerName&&!Wd.test(t.containerName)?null:`@container ${t.containerName?`${t.containerName} `:""}${t.containerQuery} {`;if("string"==typeof t.conditionText){let n="";try{var i;n=(null===(i=e.constructor)||void 0===i?void 0:i.name)||""}catch(e){return null}return""===n||"Object"===n||"CSSSupportsRule"===n?`@supports ${t.conditionText} {`:null}return"string"==typeof t.name?"keyText"in t.cssRules[0]?Wd.test(t.name)?`@keyframes ${t.name} {`:null:""===t.name?"@layer {":jd.test(t.name)?`@layer ${t.name} {`:null:null}(e);if(null===n)return!1;const s=i.sheetHref;return t.push({kind:"group",rules:Array.from(e.cssRules),sheetHref:s,index:0,parts:[],prelude:s?sh(n,s):n,fixColons:"sheet"===i.kind&&Ud(e)&&e.selectorText.includes(":")}),!0}catch(e){return!1}}(i,e))return;let n=i.cssText;"sheet"===e.kind&&Ud(i)&&i.selectorText.includes(":")&&(n=Hd(n)),e.parts.push(e.sheetHref?sh(n,e.sheetHref):n),e.index+=1}return function(e){try{const i=e.rules||e.cssRules;if(!i)return!1;Cd(i);let n=e.href;!n&&e.ownerNode&&(n=e.ownerNode.baseURI);const r=Array.from(i);return t.push({kind:"sheet",sheet:e,rules:r,sheetHref:n,index:0,parts:[],importRule:null}),function(e,t){const i=[{sheet:t,rules:e,index:0}];for(;i.length>0;){const e=i[i.length-1];if(e.index>=e.rules.length){i.pop();continue}const t=e.rules[e.index];if(e.index+=1,!zd(t)||s.has(t))continue;let n=null;try{n=t.styleSheet}catch(e){s.set(t,null);continue}if(n&&!i.some(e=>e.sheet===n))try{const e=n.rules||n.cssRules;if(!e)continue;Cd(e);let r=n.href;!r&&n.ownerNode&&(r=n.ownerNode.baseURI);const o=Array.from(e);s.set(t,{sheet:n,rules:o,sheetHref:r}),i.push({sheet:n,rules:o,index:0})}catch(e){}}}(r,e),!0}catch(e){return!1}}(e)||(i=!0),{advance(e){if(i)return!0;const s=rd();let o=e>0?e:1;try{for(;!i&&o>0;){const e=t[t.length-1];if(e.index>=e.rules.length){let t=null;try{if("group"===e.kind){const i=e.prelude+e.parts.join("")+"}";t=e.fixColons?Hd(i):i}else t=Dd(e.parts.join(""))}catch(e){}r(t);continue}o-=1;try{a(e)}catch(e){r(null)}}}catch(e){i=!0,n=null}finally{Ed(rd()-s)}return i},text:()=>i?n:null,remainingRules(){if(i)return 0;let e=0;for(const i of t)e+=i.rules.length-i.index;return e}}}var Gd=class{constructor(){Fd(this,"idNodeMap",new Map),Fd(this,"nodeMetaMap",new WeakMap)}getId(e){var t,i;return e&&null!==(t=null===(i=this.getMeta(e))||void 0===i?void 0:i.id)&&void 0!==t?t:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);if(this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e)),Ad(e)){const t=sd.shadowRoot(e);t&&this.removeNodeFromMap(t),"IFRAME"===e.nodeName&&e.contentDocument&&this.removeNodeFromMap(e.contentDocument)}}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){this.idNodeMap.set(t.id,e),this.nodeMetaMap.set(e,t)}replace(e,t){const i=this.getNode(e);if(i){const e=this.nodeMetaMap.get(i);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Qd({element:e,maskInputOptions:t,tagName:i,type:n,value:s,maskInputFn:r}){let o=s||"";const a=n&&Kd(n);return(t[i.toLowerCase()]||a&&t[a])&&(o=r?r(o,e):"*".repeat(o.length)),o}function Kd(e){return e.toLowerCase()}var Jd=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 Zd({element:e,name:t,value:i,maskAllElementAttributes:n,maskAttributeFn:s,isGenerated:r=!1}){return i?n?r&&Jd.has(Kd(t))?i:"*".repeat(i.length):s?s(t,i,e):i:i}var Yd="__rrweb_original__";function Xd(e){try{const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Kd(t):null}catch(e){return null}}var eh=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,th=/^(?:[a-z+]+:)?\/\//i,ih=/^www\..*/i,nh=/^(data:)([^,]*),(.*)/i;function sh(e,t){return(e||"").replace(eh,(e,i,n,s,r,o)=>{const a=n||r||o,l=i||s||"";if(!a)return e;if(th.test(a)||ih.test(a))return`url(${l}${a}${l})`;if(nh.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${l})`;const c=t.split("/"),u=a.split("/");c.pop();for(const e of u)"."!==e&&(".."===e?c.pop():c.push(e));return`url(${l}${c.join("/")}${l})`})}var rh,oh,ah=new Map,lh=1,ch=new RegExp("[^a-z0-9-_:]");function uh(){return lh++}var dh=!1,hh=/^[^ \t\n\r\u000c]+/,ph=/^[, \t\n\r\u000c]+/,gh=new WeakMap;function _h(e,t){return t&&""!==t.trim()?fh(e,t):t}function fh(e,t){let i=gh.get(e);if(i||(i=e.createElement("a"),gh.set(e,i)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return i.setAttribute("href",t),i.href}function vh(e,t){return(null==t?void 0:t.maxBase64ImageLength)?function(e,t){return t&&e.length>t?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":e}(e,t.maxBase64ImageLength):e}function mh(e,t,i,n,s,r){if(!n)return n;if("src"===i||"href"===i&&("use"!==t||"#"!==n[0])){const i=_h(e,n);if(i.startsWith("data:")){if("img"===t&&s){let e=i;return((null==r?void 0:r.type)||void 0!==(null==r?void 0:r.quality))&&(e=function(e,t,i,n){if(1e5>t.length)return t;if(!e.complete||0===e.naturalWidth)return t;if(e.naturalWidth>4096||e.naturalHeight>4096)return t;const s=ah.get(t);if(s&&s.type===i&&s.quality===n)return s.result;try{const s=document.createElement("canvas");s.width=e.naturalWidth,s.height=e.naturalHeight;const r=s.getContext("2d");if(!r)return t;r.drawImage(e,0,0);const o=s.toDataURL(i||"image/webp",null!=n?n:.4),a=t.length>o.length?o:t;if(ah.size>=10){const e=ah.keys().next().value;void 0!==e&&ah.delete(e)}return ah.set(t,{type:i,quality:n,result:a}),a}catch(e){return t}}(s,i,r.type,r.quality)),vh(e,r)}if("image"===t)return vh(i,r)}return i}if("xlink:href"===i&&"#"!==n[0]){const i=_h(e,n);return"image"===t&&i.startsWith("data:")?vh(i,r):i}return"background"!==i||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===i?function(e,t){if(""===t.trim())return t;let i=0;function n(e){let n;const s=e.exec(t.substring(i));return s?(n=s[0],i+=n.length,n):""}const s=[];for(;n(ph),t.length>i;){let r=n(hh);if(","===r.slice(-1))r=_h(e,r.substring(0,r.length-1)),s.push(r);else{let n="";r=_h(e,r);let o=!1;for(;;){const e=t.charAt(i);if(""===e){s.push((r+n).trim());break}if(o)")"===e&&(o=!1);else{if(","===e){i+=1,s.push((r+n).trim());break}"("===e&&(o=!0)}n+=e,i+=1}}}return s.join(", ")}(e,n):"style"===i?sh(n,fh(e)):"object"===t&&"data"===i?_h(e,n):n:_h(e,n)}function yh(e,t,i){return("video"===e||"audio"===e)&&"autoplay"===Kd(t)}function bh(e){return"string"==typeof e&&Kd(e).split(/\s+/).includes("stylesheet")}function Sh(e,t,i){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!i&&Sh(sd.parentNode(e),t,i);for(let i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;return!!i&&Sh(sd.parentNode(e),t,i)}function wh(e,t,i,n){let s;if(Ad(e)){if(s=e,!sd.childNodes(s).length)return!1}else{if(null===sd.parentElement(e))return!1;s=sd.parentElement(e)}try{if("string"==typeof t){if(n){if(s.closest(`.${t}`))return!0}else if(s.classList.contains(t))return!0}else if(Sh(s,t,n))return!0;if(i)if(n){if(s.closest(i))return!0}else if(s.matches(i))return!0}catch(e){}return!1}function kh(e,t,i){const n=e.removeEventListener;"function"==typeof n&&n.call(e,t,i)}var Ch=new Map;function xh(e={}){Ch.forEach((t,i)=>{e.keepChangedLinks&&t.changedLinkBaseline||(t.controller.abort(),Ch.delete(i))})}function Eh(e){try{return e.sheet}catch(e){return null}}function Ih(e,t,i,n,s){const r=new AbortController,o=()=>{var t;(null===(t=Ch.get(e))||void 0===t?void 0:t.controller)===r&&Ch.delete(e),r.abort()};let a=!1;const l=()=>{if(!a){a=!0;try{t()}finally{o()}}};e.addEventListener("load",l,{signal:r.signal,once:!0}),e.addEventListener("error",o,{signal:r.signal,once:!0});const c=Date.now()+6e4;let u;const d=t=>{const s=n.length>t?n[t]:Math.max(n[n.length-1],1e3);u=setTimeout(()=>{e.isConnected?i()?l():Date.now()<c?d(t+1):o():o()},s)};r.signal.addEventListener("abort",()=>clearTimeout(u),{once:!0}),d(0),Ch.set(e,{controller:r,changedLinkBaseline:s})}var Th=[100,200,400,800,1600,3200,6400,12800,25600];function Mh(e,t){return Array.from(e.styleSheets).find(e=>e.href===t)}function Ph(e){return null==e?"":e.toLowerCase()}var Rh=!1,Fh=!1;function Ah(e,t){const{doc:i,mirror:n,blockClass:s,blockSelector:r,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p=!1,maskAttributeFn:g,slimDOMOptions:_,dataURLOptions:f={},inlineImages:v=!1,recordCanvas:m=!1,canvasMaskingConfigured:y,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w=5e3,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:x=5e3,keepIframeSrcFn:E=()=>!1,newlyAddedElement:I=!1,depth:T=0,maxDepth:M=50}=t;let{needsMask:P}=t,{preserveWhiteSpace:R=!0}=t;if(T>=M)return Fh=!0,Rh||(Rh=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${M}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;P||(P=wh(e,o,a,void 0===P)),ud>0&&(pd.nodeCount+=1);const F=function(e,t){const{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:u,maskAllElementAttributes:d=!1,maskAttributeFn:h,dataURLOptions:p={},inlineImages:g,recordCanvas:_,canvasMaskingConfigured:f,keepIframeSrcFn:v,newlyAddedElement:m=!1}=t,y=function(e,t){if(!t.hasNode(e))return;const i=t.getId(e);return 1===i?void 0:i}(i,n);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Wu.Document,childNodes:[],compatMode:e.compatMode}:{type:Wu.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Wu.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function(e,t){const{doc:i,blockClass:n,blockSelector:s,inlineStylesheet:r,maskInputOptions:o={},maskInputFn:a,maskAllElementAttributes:l=!1,maskAttributeFn:c,dataURLOptions:u={},inlineImages:d,recordCanvas:h,canvasMaskingConfigured:p,keepIframeSrcFn:g,newlyAddedElement:_=!1,rootId:f}=t,v=function(e,t,i){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;if(i)return e.matches(i)}catch(e){}return!1}(e,n,s),m=function(e){if(e instanceof HTMLFormElement)return"form";const t=Kd(e.tagName);return ch.test(t)?"div":t}(e),y=new Set;let b={};const S=e.attributes.length;for(let t=0;S>t;t++){const n=e.attributes[t];yh(m,n.name)||(b[n.name]=mh(i,m,Kd(n.name),n.value,e,u))}if("link"===m&&"string"==typeof b.href){var w;const t=null===(w=Eh(e))||void 0===w?void 0:w.href;t&&(b.href=t)}if("link"===m&&r&&!v&&bh(b.rel)){let t=e.sheet;if(!t){const n=function(e){return e.href}(e);n&&(t=Mh(i,n),!t&&n.includes(".css"))&&(t=Mh(i,window.location.origin+"/"+n.replace(window.location.href,"")))}let n=null;t&&(Id(t)?ud>0&&(fd.push(e),vd+=1):n=Bd(t)),n&&(delete b.rel,delete b.href,b._cssText=n)}var k;if("style"===m&&e.sheet&&!(e.innerText||sd.textContent(e)||"").trim().length){const t=xd(()=>Bd(e.sheet));t&&(b._cssText=t)}if("input"===m||"textarea"===m||"select"===m){const t=e.value,i=e.checked;"radio"!==b.type&&"checkbox"!==b.type&&"submit"!==b.type&&"button"!==b.type&&t?b.value=Qd({element:e,type:Xd(e),tagName:m,value:t,maskInputOptions:o,maskInputFn:a}):i&&(b.checked=i)}if("option"===m&&(e.selected&&!o.select?b.selected=!0:delete b.selected),"dialog"===m&&e.open){try{b.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(e){b.rr_open_mode="modal",b.ph_rr_could_not_detect_modal=!0}y.add("rr_open_mode")}if("canvas"===m&&h&&!(null==p?void 0:p()))try{if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let i=0;e.width>i;i+=50)for(let n=0;e.height>n;n+=50){const s=t.getImageData,r=Yd in s?s[Yd]:s;let o;try{o=r.call(t,i,n,Math.min(50,e.width-i),Math.min(50,e.height-n))}catch(e){return!1}if(new Uint32Array(o.data.buffer).some(e=>0!==e))return!1}return!0})(e)||(b.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){const t=e.toDataURL(u.type,u.quality),n=i.createElement("canvas");n.width=e.width,n.height=e.height,t!==n.toDataURL(u.type,u.quality)&&(b.rr_dataURL=t)}}catch(e){"SecurityError"===(null==(k=e)?void 0:k.name)?dh||(dh=!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 C,x=!1;if("img"===m&&d){rh||(rh=i.createElement("canvas"),oh=rh.getContext("2d"));const t=e,n=t.currentSrc||t.getAttribute("src")||"<unknown-src>",s=t.crossOrigin,r=(t,i)=>x?Zd({element:e,name:t,value:i,maskAllElementAttributes:l,maskAttributeFn:c}):i,o=()=>{kh(t,"load",o);try{rh.width=t.naturalWidth,rh.height=t.naturalHeight,oh.drawImage(t,0,0);const e=rh.toDataURL(u.type,u.quality);b.rr_dataURL=r("rr_dataURL",e)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o));console.warn(`Cannot inline img src=${n}! Error: ${e}`)}"anonymous"===t.crossOrigin&&(s?b.crossOrigin=r("crossOrigin",s):t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o)}if("audio"===m||"video"===m){const t=b;t.rr_mediaState=e.paused?"paused":"played",y.add("rr_mediaState"),t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}if(_||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop)),v){var E,I,T;const{width:t,height:n,left:s,top:r}=e.getBoundingClientRect(),o=null===(E=i.defaultView)||void 0===E?void 0:E.getComputedStyle(e);b={class:b.class,rr_width:`${t}px`,rr_height:`${n}px`,rr_left:`${Math.floor(s+((null===(I=i.defaultView)||void 0===I?void 0:I.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(T=i.defaultView)||void 0===T?void 0:T.scrollY)||0))}px`},y.add("rr_width"),y.add("rr_height"),y.add("rr_left"),y.add("rr_top"),o&&(b.rr_position=o.position||"static",y.add("rr_position"),o.transform&&"none"!==o.transform&&(b.rr_transform=o.transform,y.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(b.rr_display=o.display,y.add("rr_display")))}if("iframe"!==m||g(b.src)||(e.contentDocument||(b.rr_src=b.src),delete b.src),l||c)for(const[t,i]of Object.entries(b))"string"!=typeof i&&null!==i||(b[t]=Zd({element:e,name:t,value:i,maskAllElementAttributes:l,maskAttributeFn:c,isGenerated:y.has(t)}));x=!0;try{customElements.get(m)&&(C=!0)}catch(e){}return{type:Wu.Element,tagName:m,attributes:b,childNodes:[],isSVG:(M=e,Boolean("svg"===M.tagName||M.ownerSVGElement)||void 0),needBlock:v,rootId:f,isCustom:C};var M}(e,{doc:i,blockClass:s,blockSelector:r,inlineStylesheet:a,maskInputOptions:l,maskInputFn:u,maskAllElementAttributes:d,maskAttributeFn:h,dataURLOptions:p,inlineImages:g,recordCanvas:_,canvasMaskingConfigured:f,keepIframeSrcFn:v,newlyAddedElement:m,rootId:y});case e.TEXT_NODE:return function(e,t){const{needsMask:i,maskTextFn:n,rootId:s}=t,r=sd.parentNode(e),o=r&&r.tagName;let a=sd.textContent(e);const l="STYLE"===o||void 0,c="SCRIPT"===o||void 0;if(l&&a){try{var u;if(e.nextSibling||e.previousSibling);else if(Id(r.sheet));else if(null===(u=r.sheet)||void 0===u?void 0:u.cssRules){const e=Bd(r.sheet);e&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(e)&&(a=e)}}catch(t){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${t}`,e)}a=sh(a,fh(t.doc))}return c&&(a="SCRIPT_PLACEHOLDER"),!l&&!c&&a&&i&&(a=n?n(a,sd.parentElement(e)):a.replace(/[\S]/g,"*")),{type:Wu.Text,textContent:a||"",isStyle:l,rootId:s}}(e,{doc:i,needsMask:o,maskTextFn:c,rootId:y});case e.CDATA_SECTION_NODE:return{type:Wu.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:Wu.Comment,textContent:sd.textContent(e)||"",rootId:y};default:return!1}}(e,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:g,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,keepIframeSrcFn:E,newlyAddedElement:I});if(!F)return console.warn(e,"not serialized"),null;let A;A=n.hasNode(e)?n.getId(e):function(e,t){if(t.comment&&e.type===Wu.Comment)return!0;if(e.type===Wu.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===function(e){var t;let i;try{i=new URL(e,window.location.href)}catch(e){return null}const n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(t=null==n?void 0:n[1])&&void 0!==t?t:null}(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(Ph(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Ph(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Ph(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&Ph(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Ph(e.attributes.property).match(/^(og|twitter|fb):/)||Ph(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===Ph(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(Ph(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(Ph(e.attributes.name))||Ph(e.attributes.property).match(/^article:/)||Ph(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(Ph(e.attributes.name)))return!0}}return!1}(F,_)||!R&&F.type===Wu.Text&&!F.isStyle&&!F.textContent.replace(/^\s+|\s+$/gm,"").length?-2:uh();const L=Object.assign(F,{id:A});if(n.add(e,L),-2===A)return null;b&&b(e);let O=!l;if(L.type===Wu.Element){O=O&&!L.needBlock,delete L.needBlock;const t=sd.shadowRoot(e);t&&Od(t)&&(L.isShadowHost=!0)}if((L.type===Wu.Document||L.type===Wu.Element)&&O){_.headWhitespace&&L.type===Wu.Element&&"head"===L.tagName&&(R=!1);const t={doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:g,slimDOMOptions:_,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:R,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:x,keepIframeSrcFn:E,depth:T+1,maxDepth:M};if(L.type===Wu.Element&&"textarea"===L.tagName&&void 0!==L.attributes.value);else for(const i of Array.from(sd.childNodes(e))){const e=Ah(i,t);e&&L.childNodes.push(e)}let I=null;if(Ad(e)&&(I=sd.shadowRoot(e)))for(const e of Array.from(sd.childNodes(I))){const i=Ah(e,t);i&&(Od(I)&&(i.isShadow=!0),L.childNodes.push(i))}}const D=sd.parentNode(e);if(D&&Ld(D)&&Od(D)&&(L.isShadow=!0),L.type===Wu.Element&&"iframe"===L.tagName){const t=function(e,t,i){const n=()=>{},s=e.contentWindow;if(!s)return n;let r;try{r=s.document.readyState}catch(e){return n}const o=()=>t();if("complete"!==r){let n=!1,s=null;const r=()=>{n||(n=!0,null!==s&&(clearTimeout(s),s=null),kh(e,"load",a),e.addEventListener("load",o),t())},a=()=>r();return s=setTimeout(r,i),e.addEventListener("load",a),()=>{null!==s&&(clearTimeout(s),s=null),n?kh(e,"load",o):(n=!0,kh(e,"load",a))}}const a="about:blank";let l;try{l=s.location.href}catch(e){return n}if(l!==a||e.src===a||""===e.src){const i=setTimeout(t,0);return e.addEventListener("load",o),()=>{clearTimeout(i),kh(e,"load",o)}}return e.addEventListener("load",o),()=>{kh(e,"load",o)}}(e,()=>{const t=e.contentDocument;if(t&&S){const i=Ah(t,{doc:t,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:g,slimDOMOptions:_,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:R,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:x,keepIframeSrcFn:E,depth:T+1,maxDepth:M});i&&S(e,i)}},w);null==k||k(e,t)}var N,B,q;return L.type===Wu.Element&&"link"===L.tagName&&bh(L.attributes.rel)&&(B=()=>{if(C){const t=n.getMeta(e),l=Ah(e,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:g,slimDOMOptions:_,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:R,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onStylesheetLoad:C,stylesheetLoadTimeout:x,keepIframeSrcFn:E,depth:T,maxDepth:M});l&&C(e,l,t)}},q=x,Ch.has(N=e)||Eh(N)||Ih(N,B,()=>Boolean(Eh(N)),[q])),L}function Lh(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:!1===e?{}:e}var Oh=class e{constructor(...e){Fd(this,"parentElement",null),Fd(this,"parentNode",null),Fd(this,"ownerDocument",void 0),Fd(this,"firstChild",null),Fd(this,"lastChild",null),Fd(this,"previousSibling",null),Fd(this,"nextSibling",null),Fd(this,"ELEMENT_NODE",1),Fd(this,"TEXT_NODE",3),Fd(this,"nodeType",void 0),Fd(this,"nodeName",void 0),Fd(this,"RRNodeType",void 0)}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(t){if(!(t instanceof e))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function Dh(e,t,i=document){const n={capture:!0,passive:!0};return i.addEventListener(e,t,n),()=>$h(i,e,t,n)}function $h(e,t,i,n){Nh(()=>{const s=e.removeEventListener;"function"==typeof s&&(void 0!==n?s.call(e,t,i,n):s.call(e,t,i))})}function Nh(e){try{e()}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}function Bh(e){e.forEach(e=>{if("function"==typeof e)try{e()}catch(e){}})}var qh="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.",Hh={map:{},getId(){return console.warn(qh),-1},getNode(){return console.warn(qh),null},removeNodeFromMap(){console.warn(qh)},has(){return console.warn(qh),!1},reset(){console.warn(qh)}};function zh(e,t,i={}){let n=null,s=0;return function(...r){const o=Date.now();s||!1!==i.leading||(s=o);const a=t-(o-s),l=this;0>=a||a>t?(n&&(clearTimeout(n),n=null),s=o,e.apply(l,r)):n||!1===i.trailing||(n=setTimeout(()=>{s=!1===i.leading?0:Date.now(),n=null,e.apply(l,r)},a))}}function Uh(e,t,i,n,s=window){const r=s.Object.getOwnPropertyDescriptor(e,t),o=()=>Uh(e,t,r||{},!0);if(n)return s.Object.defineProperty(e,t,i),o;const a=function(e){let t="function"==typeof e.setTimeout?e.setTimeout:void 0;try{var i,n;const s=null===(i=e.Zone)||void 0===i||null===(n=i.__symbol__)||void 0===n?void 0:n.call(i,"setTimeout"),r=s?e[s]:void 0;"function"==typeof r&&(t=r)}catch(e){}if(!t)return()=>{};const s=t;return t=>{try{s.call(e,t,0)}catch(e){}}}(s);return s.Object.defineProperty(e,t,{set(e){if(a(()=>{try{i.set.call(this,e)}catch(e){}}),r&&r.set){if(r.get)try{r.get.call(this)}catch(e){return}r.set.call(this,e)}}}),o}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Hh=new Proxy(Hh,{get(e,t,i){return"map"===t&&console.warn(qh),Reflect.get(e,t,i)}}));var Wh=Date.now;function jh(e){var t,i,n,s;const r=e.document;return{left:r.scrollingElement?r.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:r.documentElement.scrollLeft||(null==r?void 0:r.body)&&(null===(t=sd.parentElement(r.body))||void 0===t?void 0:t.scrollLeft)||(null==r||null===(i=r.body)||void 0===i?void 0:i.scrollLeft)||0,top:r.scrollingElement?r.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==r?void 0:r.documentElement.scrollTop)||(null==r?void 0:r.body)&&(null===(n=sd.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 Vh(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Gh(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Qh(e){return e?e.nodeType===e.ELEMENT_NODE?e:sd.parentElement(e):null}function Kh(e,t,i,n){if(!e)return!1;const s=Qh(e);if(!s)return!1;try{if("string"==typeof t){if(s.classList.contains(t))return!0;if(n&&null!==s.closest("."+t))return!0}else if(Sh(s,t,n))return!0}catch(e){}if(i){if(s.matches(i))return!0;if(n&&null!==s.closest(i))return!0}return!1}function Jh(e,t,i){const n=t&&"string"!=typeof t&&(t.global||t.sticky)?new RegExp(t):null;for(;e;){if(n&&(n.lastIndex=0),Kh(e,n||t,i,!0))return!0;const s="getRootNode"in e?sd.getRootNode(e):null;e=(null==s?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?sd.host(s):null}return!1}function Zh(e,t,i){return!("TITLE"!==e.tagName||!i.headTitleMutations)||-2===t.getId(e)}function Yh(e,t){if(Ld(e))return!1;const i=t.getId(e);if(!t.has(i))return!0;const n=sd.parentNode(e);return(!n||n.nodeType!==e.DOCUMENT_NODE)&&(!n||Yh(n,t))}function Xh(e){return Boolean(e.changedTouches)}function ep(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function tp(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function ip(e){return!!e&&(e instanceof Oh&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(sd.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Wh=()=>(new Date).getTime());var np=class{constructor(){Fd(this,"id",1),Fd(this,"styleIDMap",new WeakMap),Fd(this,"idStyleMap",new Map)}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let i;return i=void 0===t?this.id++:t,this.styleIDMap.set(e,i),this.idStyleMap.set(i,e),i}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function sp(e){var t;let i=null;return"getRootNode"in e&&(null===(t=sd.getRootNode(e))||void 0===t?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&sd.host(sd.getRootNode(e))&&(i=sd.host(sd.getRootNode(e))),i}function rp(e){const t=e.ownerDocument;if(!t)return!1;if(sd.contains(t,e))return!0;const i=sd.isConnected(e);return"boolean"==typeof i?i:function(e){const t=e.ownerDocument;if(!t)return!1;const i=function(e){let t,i=e;for(;t=sp(i);)i=t;return i}(e);return sd.contains(t,i)}(e)}var op,ap=(e,t)=>`${e}@${t}`,lp=class{constructor(){Fd(this,"frozen",!1),Fd(this,"locked",!1),Fd(this,"takePendingRecords",void 0),Fd(this,"texts",[]),Fd(this,"attributes",[]),Fd(this,"attributeMap",new WeakMap),Fd(this,"generatedAttributes",new WeakMap),Fd(this,"removes",[]),Fd(this,"mapRemoves",new Set),Fd(this,"movedMap",{}),Fd(this,"addedSet",new Set),Fd(this,"movedSet",new Set),Fd(this,"droppedSet",new Set),Fd(this,"removesSubTreeCache",new Set),Fd(this,"mutationCb",void 0),Fd(this,"blockClass",void 0),Fd(this,"blockSelector",void 0),Fd(this,"maskTextClass",void 0),Fd(this,"maskTextSelector",void 0),Fd(this,"inlineStylesheet",void 0),Fd(this,"maskInputOptions",void 0),Fd(this,"maskTextFn",void 0),Fd(this,"maskInputFn",void 0),Fd(this,"maskAllElementAttributes",void 0),Fd(this,"maskAttributeFn",void 0),Fd(this,"keepIframeSrcFn",void 0),Fd(this,"recordCanvas",void 0),Fd(this,"canvasMaskingConfigured",void 0),Fd(this,"inlineImages",void 0),Fd(this,"slimDOMOptions",void 0),Fd(this,"dataURLOptions",void 0),Fd(this,"doc",void 0),Fd(this,"mirror",void 0),Fd(this,"iframeManager",void 0),Fd(this,"stylesheetManager",void 0),Fd(this,"shadowDomManager",void 0),Fd(this,"canvasManager",void 0),Fd(this,"processedNodeManager",void 0),Fd(this,"unattachedDoc",void 0),Fd(this,"canvasManagerReleased",!1),Fd(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),Fd(this,"emit",()=>{if(this.frozen||this.locked)return;const e=rd(),t=ld();try{this.processBufferedMutations()}finally{i=rd()-e,n=t,ud>0||cd(i,null!=n?n:od)||i>yd.slowestBatchMs&&(yd.slowestBatchMs=i)}var i,n}),Fd(this,"processBufferedMutations",()=>{const e=[],t=new Set,i=e=>{let t=e,i=-2;for(;-2===i;)t=t&&t.nextSibling,i=t&&this.mirror.getId(t);return i};let n;const s=s=>{var r;const o=sd.parentNode(s);if(!o||!rp(s)||"TEXTAREA"===o.tagName)return!0;if(this.isBlockedAtEmission(o))return!0;const a=Ld(o)?this.mirror.getId(sp(s)):this.mirror.getId(o),l=i(s);if(-1===a||-1===l)return!1;null!==(r=n)&&void 0!==r||(n=this.buildSerializationOptions());const c=Ah(s,n);return c&&(e.push({parentId:a,nextId:l,node:c}),t.add(c.id)),!0};for(const e of this.mapRemoves)this.mapRemoves.delete(e),this.mirror.removeNodeFromMap(e);for(const e of this.movedSet)up(this.removesSubTreeCache,e)&&!this.movedSet.has(sd.parentNode(e))||this.addedSet.add(e);for(const e of Array.from(this.addedSet)){const t=dp(this.droppedSet,e),i=up(this.removesSubTreeCache,e),n=this.movedSet.has(e)||dp(this.movedSet,e);!t&&!i||n||(this.droppedSet.add(e),this.addedSet.delete(e))}const r=new Set;let o=null;const a=this.addedSet.values();let l=a.next();for(;this.addedSet.size;){let e=null;if(null!==o)for(e=sd.previousSibling(o);e&&-2===this.mirror.getId(e);)e=sd.previousSibling(e);if(e&&this.addedSet.has(e))o=e;else{for(this.addedSet.has(l.value)||(l=a.next()),o=l.value;;){const e=sd.parentNode(o),t=e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE?sd.host(e):e;if(!t||!this.addedSet.has(t))break;o=t}const e=sd.parentNode(o);if(e&&this.addedSet.has(sd.lastChild(e)))o=sd.lastChild(e);else if(e)for(;;){let e=sd.nextSibling(o);for(;e&&-2===this.mirror.getId(e);)e=sd.nextSibling(e);if(!e||!this.addedSet.has(e))break;o=e}}this.addedSet.delete(o);const t=sd.parentNode(o),i=t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?sd.host(t):t;i&&r.has(i)?r.add(o):s(o)||r.add(o)}r.size>0&&console.warn(`[rrweb] dropped ${r.size} node(s) with unresolved parent at emit`);const c={texts:this.texts.filter(e=>!this.isBlockedAtEmission(e.node)).map(e=>{const t=e.node,i=sd.parentNode(t);return i&&"TEXTAREA"===i.tagName&&this.genTextAreaValueMutation(i),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.filter(e=>!this.isBlockedAtEmission(e.node)).map(e=>{const{attributes:t}=e;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof t.style){const i=JSON.stringify(e.styleDiff),n=JSON.stringify(e._unchangedStyles);t.style.length>i.length&&(i+n).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(const[n,s]of Object.entries(t))if("string"==typeof s||null===s){var i;t[n]=Zd({element:e.node,name:n,value:s,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(i=this.generatedAttributes.get(e.node))||void 0===i?void 0:i.has(n)})}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e},u=[];if(this.inlineStylesheet)for(const{id:e,attributes:t}of c.attributes){if(!("rel"in t)&&!("href"in t))continue;const i=this.mirror.getNode(e);i&&"link"===Kd(i.nodeName)&&bh(i.getAttribute("rel"))&&i.getAttribute("href")&&!i.disabled&&u.push(i)}if(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={},c.texts.length||c.attributes.length||c.removes.length||c.adds.length){this.mutationCb(c);for(const e of u)this.stylesheetManager.inlineLinkStylesheetAfterChange(e,{currentId:()=>this.mirror.getId(e),reserializeWithoutCss:()=>({previous:this.mirror.getMeta(e),current:Ah(e,ct(ct({},this.buildSerializationOptions()),{},{inlineStylesheet:!1}))}),lastSerialization:()=>this.mirror.getMeta(e),readdAsMove:()=>this.recordReinsertion(e)})}}),Fd(this,"bufferBelongsToIframe",e=>this.doc===e.contentDocument),Fd(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));const i=Array.from(sd.childNodes(e),e=>sd.textContent(e)||"").join("");t.attributes.value=Qd({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Xd(e),value:i,maskInputFn:this.maskInputFn})}),Fd(this,"processMutation",e=>{if(!Zh(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=sd.textContent(e.target);Kh(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:wh(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Qh(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{var t;const n=e.target,s=Kd(n.tagName),r=e.attributeName,o=null!==(t=e.attributeNamespace)&&void 0!==t?t:null;let a=function(e,t,i){if(!i)return t;const n=e.getAttributeNodeNS(i,t);if(n)return n.name;if("http://www.w3.org/1999/xlink"===i)return`xlink:${t}`;if("http://www.w3.org/XML/1998/namespace"===i)return`xml:${t}`;if("http://www.w3.org/2000/xmlns/"===i)return"xmlns"===t?t:`xmlns:${t}`;const s=e.lookupPrefix(i);return s?`${s}:${t}`:t}(n,r,o),l=o?n.getAttributeNS(o,r):e.target.getAttribute(r);if("value"===a){const e=n,t=Xd(e);l=Qd({element:e,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:t,value:l,maskInputFn:this.maskInputFn})}if(Kh(e.target,this.blockClass,this.blockSelector,!1)||l===e.oldValue)return;let c=this.attributeMap.get(e.target);const u="iframe"===s&&"src"===a;if(u&&!this.keepIframeSrcFn(l)&&n.contentDocument)return;if("type"===a&&"input"===s&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!yh(s,a)){var i;c||(c={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(c),this.attributeMap.set(e.target,c));const t=mh(this.doc,s,Kd(a),l,n,this.dataURLOptions);if(u&&!this.keepIframeSrcFn(l)&&(a="rr_src"),c.attributes[a]=t,null===(i=this.generatedAttributes.get(e.target))||void 0===i||i.delete(a),"style"===a){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const t=this.unattachedDoc.createElement("span"),i=n.style;e.oldValue&&(t.style.cssText=e.oldValue);for(const e of Array.from(i)){const n=i.getPropertyValue(e),s=i.getPropertyPriority(e);n!==t.style.getPropertyValue(e)||s!==t.style.getPropertyPriority(e)?c.styleDiff[e]=""===s?n:[n,s]:c._unchangedStyles[e]=[n,s]}for(const e of Array.from(t.style))""===i.getPropertyValue(e)&&(c.styleDiff[e]=!1)}else if("open"===a&&"dialog"===s){c.attributes.rr_open_mode=n.matches("dialog:modal")?"modal":"non-modal";let t=this.generatedAttributes.get(e.target);t||(t=new Set,this.generatedAttributes.set(e.target,t)),t.add("rr_open_mode")}}break}case"childList":if(e.removedNodes.forEach(e=>{rp(e)||this.shadowDomManager.removeShadowRootsIn(e)}),Kh(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const i=this.mirror.getId(t),n=Ld(e.target)?this.mirror.getId(sd.host(e.target)):this.mirror.getId(e.target);Kh(e.target,this.blockClass,this.blockSelector,!1)||Zh(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(cp(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===i||Yh(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[ap(i,n)]?cp(this.movedSet,t):(this.removes.push({parentId:n,id:i,isShadow:!(!Ld(e.target)||!Od(e.target))||void 0}),function(e,t){const i=[e];for(;i.length;){const e=i.pop();t.has(e)||(t.add(e),sd.childNodes(e).forEach(e=>i.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.add(t))})}}),Fd(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)){if(this.addedSet.has(e))return this.addedSet.delete(e),void this.addedSet.add(e);if(!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Zh(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let i=null;t&&this.mirror.hasNode(t)&&(i=this.mirror.getId(t)),i&&-1!==i&&(this.movedMap[ap(this.mirror.getId(e),i)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);if(!Kh(e,this.blockClass,this.blockSelector,!1)){if(e.nodeType===e.TEXT_NODE)return;const t=sd.childNodes(e);for(let e=0,i=t.length;i>e;e++){const i=t[e];i&&this.genAdds(i)}if(ip(e)){const t=sd.childNodes(sd.shadowRoot(e));for(let i=0,n=t.length;n>i;i++){const n=t[i];n&&(this.processedNodeManager.add(n,this),this.genAdds(n,e))}}}}}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAllElementAttributes","maskAttributeFn","keepIframeSrcFn","recordCanvas","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]}),this.canvasManager.acquire()}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}readPendingRecordsFrom(e){this.takePendingRecords=()=>e.takeRecords()}reset(){this.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(const e of this.mapRemoves)this.mapRemoves.delete(e),this.mirror.removeNodeFromMap(e)}isBlockedAtEmission(e){return Jh(e,this.blockClass,this.blockSelector)}recordReinsertion(e){var t;const i=sd.parentNode(e);if(!i)return;null===(t=this.takePendingRecords)||void 0===t||t.call(this).forEach(this.processMutation);const n=(e,t)=>({type:"childList",target:i,removedNodes:e,addedNodes:t,oldValue:null,attributeName:null});this.processMutation(n([e],[])),this.processMutation(n([],[e])),this.emit()}buildSerializationOptions(){return{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:e=>{ep(e,this.mirror)&&this.iframeManager.addIframe(e),tp(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),ip(e)&&!Kh(e,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(sd.shadowRoot(e),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onIframeListenerRegistered:(e,t)=>{this.iframeManager.registerLoadListenerDisposer(e,t)},onStylesheetLoad:(e,t,i)=>{this.stylesheetManager.attachLinkElement(e,t,i)}}}};function cp(e,t){const i=[t];for(;i.length;){const t=i.pop();if(e.delete(t),t.nodeType===t.TEXT_NODE)continue;const n=sd.childNodes(t);for(let e=0,t=n.length;t>e;e++){const t=n[e];t&&i.push(t)}}}function up(e,t,i){return 0!==e.size&&function(e,t){const i=sd.parentNode(t);return!!i&&e.has(i)}(e,t)}function dp(e,t){if(0===e.size)return!1;let i=sd.parentNode(t);for(;i;){if(e.has(i))return!0;i=sd.parentNode(i)}return!1}function hp(e){op=e}function pp(){op=void 0}var gp=(e,t="rrweb")=>op?(...i)=>{try{return e(...i)}catch(e){if(op&&!0===op(e,t))return;throw e}}:e,_p=[];function fp(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function vp(e,t){const i=new lp;let n;i.init(e);try{n=new(id())(gp(i.processMutations.bind(i)));const s={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return e.attributeFilter&&e.attributeFilter.length>0&&(s.attributeFilter=e.attributeFilter),n.observe(t,s),i.readPendingRecordsFrom(n),_p.push(i),{observer:n,buffer:i}}catch(e){try{null==n||n.disconnect(),i.destroy(),i.reset()}catch(e){}throw e}}function mp({scrollCb:e,doc:t,mirror:i,blockClass:n,blockSelector:s,sampling:r}){const o=new Map,a=r=>{const a=fp(r);if(!a||Kh(a,n,s,!0))return;const l=i.getId(a);let c,u;if(a===t&&t.defaultView){const e=jh(t.defaultView);c=e.left,u=e.top}else c=a.scrollLeft,u=a.scrollTop;const d=`${c},${u}`;o.get(l)!==d&&(o.set(l,d),e({id:l,x:c,y:u}))},l=[Dh("scroll",gp(zh(gp(e=>a(e)),r.scroll||100)),t)];return"onscrollend"in t&&l.push(Dh("scrollend",gp(a),t)),()=>l.forEach(e=>e())}function yp(e,t){for(let i=_p.length-1;i>=0;i--){const n=_p[i];if(!n)continue;let s=n.bufferBelongsToIframe(e);!s&&t&&t.has(n.bufferDoc())&&(s=!0),s&&(n.reset(),_p.splice(i,1))}}var bp=["INPUT","TEXTAREA","SELECT"],Sp=new WeakMap;function wp(e){return function e(t,i){if(Ip("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||Ip("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||Ip("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||Ip("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const n=Array.from(t.parentRule.cssRules).indexOf(t);return i.unshift(n),e(t.parentRule,i)}if(t.parentStyleSheet){const e=Array.from(t.parentStyleSheet.cssRules).indexOf(t);i.unshift(e)}return i}(e,[])}function kp(e,t,i){let n,s;return e?(e.ownerNode?n=t.getId(e.ownerNode):s=i.getId(e),{styleId:s,id:n}):{}}function Cp({mirror:e,stylesheetManager:t},i){var n,s;let r=null;r=e.getId("#document"===i.nodeName?i:sd.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 e;return null===(e=a.get)||void 0===e?void 0:e.call(this)},set(e){let i;try{var n;i=null===(n=a.set)||void 0===n?void 0:n.call(this,e)}catch(e){if(e&&"object"==typeof e&&"NotAllowedError"===e.name)return;throw e}if(null!==r&&-1!==r)try{t.adoptStyleSheets(e,r)}catch(e){}return i}}),gp(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}var xp=new Set;function Ep(e,t={}){const i=e.doc.defaultView;if(!i)return()=>{};let n,s;!function(e,t){const{mutationCb:i,mousemoveCb:n,mouseInteractionCb:s,scrollCb:r,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p,customElementCb:g}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),i(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),n(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),s(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),r(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),o(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),l(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),c(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),g(...e)}}(e,t);const r=[],o=gp(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const e=_p.indexOf(s);-1!==e&&_p.splice(e,1)}e.shadowDomManager.resetForDoc(e.doc),null==n||n.disconnect()}finally{Bh(r)}}),a=(e,t)=>{const i=gp(()=>{try{return t()}catch(t){throw xp.add(e),t}})();"function"==typeof i&&r.push(i)};try{if(e.recordDOM&&a("mutation",()=>{const t=vp(e,e.doc);n=t.observer,s=t.buffer}),a("move",()=>function({mousemoveCb:e,sampling:t,doc:i,mirror:n}){if(!1===t.mousemove)return()=>{};const s="number"==typeof t.mousemove?t.mousemove:50,r="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let o,a=[];const l=zh(gp(t=>{const i=Date.now()-o;e(a.map(e=>(e.timeOffset-=i,e)),t),a=[],o=null}),r),c=gp(zh(gp(e=>{const t=fp(e),{clientX:i,clientY:s}=Xh(e)?e.changedTouches[0]:e;o||(o=Wh()),a.push({x:i,y:s,id:n.getId(t),timeOffset:Wh()-o}),l("drag"===e.type?Bu.Drag:"touchmove"===e.type?Bu.TouchMove:Bu.MouseMove)}),s,{trailing:!1})),u=[Dh("mousemove",c,i),Dh("touchmove",c,i),Dh("drag",c,i)];return gp(()=>{u.forEach(e=>e())})}(e)),a("mouseInteraction",()=>function({mouseInteractionCb:e,doc:t,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(qu).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]).forEach(r=>{let o=Kd(r);const c=(t=>r=>{const o=fp(r);if(Kh(o,n,s,!0))return;let a=null,c=t;if("pointerType"in r){switch(r.pointerType){case"mouse":a=Hu.Mouse;break;case"touch":a=Hu.Touch;break;case"pen":a=Hu.Pen}a===Hu.Touch&&(qu[t]===qu.MouseDown?c="TouchStart":qu[t]===qu.MouseUp&&(c="TouchEnd"))}else Xh(r)&&(a=Hu.Touch);null!==a?(l=a,(c.startsWith("Touch")&&a===Hu.Touch||c.startsWith("Mouse")&&a===Hu.Mouse)&&(a=null)):qu[t]===qu.Click&&(a=l,l=null);const u=Xh(r)?r.changedTouches[0]:r;if(!u)return;const d=i.getId(o),{clientX:h,clientY:p}=u;gp(e)(ct({type:qu[c],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(r);if(window.PointerEvent)switch(qu[r]){case qu.MouseDown:case qu.MouseUp:o=o.replace("mouse","pointer");break;case qu.TouchStart:case qu.TouchEnd:return}a.push(Dh(o,c,t))}),gp(()=>{a.forEach(e=>e())})}(e)),a("scroll",()=>mp(e)),a("viewportResize",()=>function({viewportResizeCb:e},{win:t}){let i=-1,n=-1;return Dh("resize",gp(zh(gp(()=>{const t=Vh(),s=Gh();i===t&&n===s||(e({width:Number(s),height:Number(t)}),i=t,n=s)}),200)),t)}(e,{win:i})),a("input",()=>function({inputCb:e,doc:t,mirror:i,blockClass:n,blockSelector:s,ignoreClass:r,ignoreSelector:o,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:u}){function d(e){let i=fp(e);const c=e.isTrusted,d=t.defaultView;if(i&&d&&!(i instanceof d.HTMLElement))return;const p=i&&i.tagName;if(i&&"OPTION"===p&&(i=sd.parentElement(i)),!i||!p||0>bp.indexOf(p)||Kh(i,n,s,!0))return;if(i.classList.contains(r)||o&&i.matches(o))return;let g=i.value,_=!1;const f=Xd(i)||"";"radio"===f||"checkbox"===f?_=i.checked:(a[p.toLowerCase()]||a[f])&&(g=Qd({element:i,maskInputOptions:a,tagName:p,type:f,value:g,maskInputFn:l})),h(i,u?{text:g,isChecked:_,userTriggered:c}:{text:g,isChecked:_});const v=i.name;"radio"===f&&v&&_&&t.querySelectorAll(`input[type="radio"][name="${v}"]`).forEach(e=>{if(e!==i){const t=e.value;h(e,u?{text:t,isChecked:!_,userTriggered:!1}:{text:t,isChecked:!_})}})}function h(t,n){const s=Sp.get(t);if(!s||s.text!==n.text||s.isChecked!==n.isChecked){Sp.set(t,n);const s=i.getId(t);gp(e)(ct(ct({},n),{},{id:s}))}}const p=("last"===c.input?["change"]:["input","change"]).map(e=>Dh(e,gp(d),t)),g=t.defaultView;if(!g)return()=>{p.forEach(e=>e())};const _=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value");return _&&_.set&&p.push(...[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]].map(e=>Uh(e[0],e[1],{set(){gp(d)({target:this,isTrusted:!1})}},!1,g))),gp(()=>{Bh(p)})}(e)),a("mediaInteraction",()=>function({mediaInteractionCb:e,blockClass:t,blockSelector:i,mirror:n,sampling:s,doc:r}){const o=gp(r=>zh(gp(s=>{const o=fp(s);if(!o||Kh(o,t,i,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:u,loop:d}=o;e({type:r,id:n.getId(o),currentTime:a,volume:l,muted:c,playbackRate:u,loop:d})}),s.media||500)),a=[Dh("play",o(Uu.Play),r),Dh("pause",o(Uu.Pause),r),Dh("seeked",o(Uu.Seeked),r),Dh("volumechange",o(Uu.VolumeChange),r),Dh("ratechange",o(Uu.RateChange),r)];return gp(()=>{a.forEach(e=>e())})}(e)),e.recordDOM){const t=function(e){const t=new Map,i=new Set;let n=!0;const s=e=>{if(n)try{e()}catch(e){}},r=e=>{var i;const n=t.get(e);if(n){for(;null===(i=n[0])||void 0===i?void 0:i.ready;){const e=n.shift();(null==e?void 0:e.emit)&&s(e.emit)}0===n.length&&t.delete(e)}};return{queueMutation(e,i){if(!e)return void s(i);const n=t.get(e);n?(n.push({emit:i,ready:!0}),r(e)):s(i)},queuePendingMutation(o,a,l){if(!n)return()=>{};let c=t.get(o);c||(c=[],t.set(o,c));const u={emit:a,ready:!1};c.push(u);let d,h=!1,p=!1;const g=()=>{h||p||(h=!0,void 0!==d&&i.delete(d),u.ready=!0,u.emit=void 0,r(o))};try{d=e.setTimeout(g,5e3),h||p?e.clearTimeout(d):i.add(d)}catch(e){g()}return t=>{!p&&n&&(p=!0,void 0!==d&&(e.clearTimeout(d),i.delete(d)),h?t&&s(l):(u.ready=!0,t||(u.emit=void 0),r(o)))}},reset(){n=!1,i.forEach(t=>e.clearTimeout(t)),i.clear(),t.clear()}}}(i);r.push(t.reset),a("styleSheet",()=>function({styleSheetRuleCb:e,mirror:t,stylesheetManager:i},{win:n,mutationQueue:s}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const r=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:gp((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=kp(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&s.queueMutation(r,()=>e({id:c,styleId:u,adds:[{rule:a,index:l}]})),l},"host")}),n.CSSStyleSheet.prototype.addRule=function(e,t,i=this.cssRules.length){return n.CSSStyleSheet.prototype.insertRule.apply(this,[`${e} { ${t} }`,i])};const o=n.CSSStyleSheet.prototype.deleteRule;let a,l;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:gp((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=kp(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&s.queueMutation(r,()=>e({id:c,styleId:u,removes:[{index:a}]})),l},"host")}),n.CSSStyleSheet.prototype.removeRule=function(e){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:gp((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:c}=kp(r,t,i.styleMirror);if(!(o&&-1!==o||c&&-1!==c))return l;const u=s.queuePendingMutation(r,()=>e({id:o,styleId:c,replace:a}),()=>{const t=Bd(r);null!==t&&e({id:o,styleId:c,replace:t})});try{n.call(l,()=>u(!0),()=>u(!1))}catch(e){u(!1)}}catch(e){}return l},"host")})),n.CSSStyleSheet.prototype.replaceSync&&(l=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:gp((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=kp(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&s.queueMutation(r,()=>e({id:c,styleId:u,replaceSync:a})),l},"host")}));const c={};Tp("CSSGroupingRule")?c.CSSGroupingRule=n.CSSGroupingRule:(Tp("CSSMediaRule")&&(c.CSSMediaRule=n.CSSMediaRule),Tp("CSSConditionRule")&&(c.CSSConditionRule=n.CSSConditionRule),Tp("CSSSupportsRule")&&(c.CSSSupportsRule=n.CSSSupportsRule));const u={};return Object.entries(c).forEach(([n,r])=>{u[n]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(u[n].insertRule,{apply:gp((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:c,styleId:u}=kp(r.parentStyleSheet,t,i.styleMirror);if(r.parentStyleSheet&&(c&&-1!==c||u&&-1!==u)){const t=[...wp(r),l];s.queueMutation(r.parentStyleSheet,()=>e({id:c,styleId:u,adds:[{rule:a,index:t}]}))}return l},"host")}),r.prototype.deleteRule=new Proxy(u[n].deleteRule,{apply:gp((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:c,styleId:u}=kp(r.parentStyleSheet,t,i.styleMirror);if(r.parentStyleSheet&&(c&&-1!==c||u&&-1!==u)){const t=[...wp(r),a];s.queueMutation(r.parentStyleSheet,()=>e({id:c,styleId:u,removes:[{index:t}]}))}return l},"host")})}),gp(()=>{n.CSSStyleSheet.prototype.insertRule=r,n.CSSStyleSheet.prototype.deleteRule=o,a&&(n.CSSStyleSheet.prototype.replace=a),l&&(n.CSSStyleSheet.prototype.replaceSync=l),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=u[e].insertRule,t.prototype.deleteRule=u[e].deleteRule})})}(e,{win:i,mutationQueue:t})),a("adoptedStyleSheet",()=>Cp(e,e.doc)),a("styleDeclaration",()=>function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:i,stylesheetManager:n},{win:s,mutationQueue:r}){const o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:gp((s,o,a)=>{var l;const[c,u,d]=a,h=s.apply(o,a);if(i.has(c))return h;const p=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;n.onCssomSheetMutation(p);const{id:g,styleId:_}=kp(p,t,n.styleMirror);if(g&&-1!==g||_&&-1!==_){const t=wp(o.parentRule);r.queueMutation(p,()=>e({id:g,styleId:_,set:{property:c,value:u,priority:d},index:t}))}return h},"host")});const a=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:gp((s,o,a)=>{var l;const[c]=a,u=s.apply(o,a);if(i.has(c))return u;const d=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;n.onCssomSheetMutation(d);const{id:h,styleId:p}=kp(d,t,n.styleMirror);if(h&&-1!==h||p&&-1!==p){const t=wp(o.parentRule);r.queueMutation(d,()=>e({id:h,styleId:p,remove:{property:c},index:t}))}return u},"host")}),gp(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=a})}(e,{win:i,mutationQueue:t})),e.collectFonts&&a("font",()=>function({fontCb:e,doc:t}){const i=t.defaultView;if(!i)return()=>{};const n=[],s=new WeakMap,r=i.FontFace;i.FontFace=function(e,t,i){const n=new r(e,t,i);return s.set(n,{family:e,buffer:"string"!=typeof t,descriptors:i,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),n};const o=nd(t.fonts,"add",function(t){return function(i){return setTimeout(gp(()=>{const t=s.get(i);t&&(e(t),s.delete(i))}),0),t.apply(this,[i])}});return n.push(()=>{i.FontFace=r}),n.push(o),gp(()=>{n.forEach(e=>e())})}(e))}a("selection",()=>function(e){const{doc:t,mirror:i,blockClass:n,blockSelector:s,selectionCb:r}=e;let o=!0;const a=gp(()=>{const e=t.getSelection();if(!e||o&&(null==e?void 0:e.isCollapsed))return;o=e.isCollapsed||!1;const a=[],l=e.rangeCount||0;for(let t=0;l>t;t++){const{startContainer:r,startOffset:o,endContainer:l,endOffset:c}=e.getRangeAt(t);Kh(r,n,s,!0)||Kh(l,n,s,!0)||a.push({start:i.getId(r),startOffset:o,end:i.getId(l),endOffset:c})}r({ranges:a})});return a(),Dh("selectionchange",a)}(e)),a("customElement",()=>function({doc:e,customElementCb:t}){const i=e.defaultView;return i&&i.customElements?nd(i.customElements,"define",function(e){return function(i,n,s){try{t({define:{name:i}})}catch(e){console.warn(`Custom element callback failed for ${i}`)}return e.apply(this,[i,n,s])}}):()=>{}}(e));for(const t of e.plugins)a(`plugin:${t.name}`,()=>t.observer(t.callback,i,t.options))}catch(e){try{o()}catch(e){}throw e}return o}function Ip(e){return void 0!==window[e]}function Tp(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}function Mp(e){const t=window;if("function"==typeof t.requestIdleCallback){const i=t.requestIdleCallback(e,{timeout:2e3});return{cancel(){var e;return null===(e=t.cancelIdleCallback)||void 0===e?void 0:e.call(t,i)}}}const i=setTimeout(e,250);return{cancel:()=>clearTimeout(i)}}var Pp=class{constructor(e){Fd(this,"generateIdFn",void 0),Fd(this,"iframeRemoteIdToLocalIdMap",new WeakMap),Fd(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,i,n){if(0>t)return t;const s=i||this.getRemoteIdToLocalIdMap(e),r=n||this.getLocalIdToRemoteIdMap(e);let o=s.get(t);return void 0===o&&(o=this.generateIdFn(),s.set(t,o),r.set(o,t)),o}getIds(e,t){const i=this.getRemoteIdToLocalIdMap(e),n=this.getLocalIdToRemoteIdMap(e);return t.map(t=>this.getId(e,t,i,n))}getRemoteId(e,t,i){var n;return"number"!=typeof t||0>t?t:null!==(n=(i||this.getLocalIdToRemoteIdMap(e)).get(t))&&void 0!==n?n:-1}getRemoteIds(e,t){const i=this.getLocalIdToRemoteIdMap(e);return t.map(t=>this.getRemoteId(e,t,i))}reset(e){if(!e)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(e),this.iframeLocalIdToRemoteIdMap.delete(e)}getRemoteIdToLocalIdMap(e){let t=this.iframeRemoteIdToLocalIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToLocalIdMap.set(e,t)),t}getLocalIdToRemoteIdMap(e){let t=this.iframeLocalIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeLocalIdToRemoteIdMap.set(e,t)),t}},Rp=class{constructor(e){Fd(this,"iframes",new WeakMap),Fd(this,"crossOriginIframeMap",new WeakMap),Fd(this,"crossOriginIframeMirror",new Pp(uh)),Fd(this,"crossOriginIframeStyleMirror",void 0),Fd(this,"crossOriginIframeRootIdMap",new WeakMap),Fd(this,"mirror",void 0),Fd(this,"mutationCb",void 0),Fd(this,"wrappedEmit",void 0),Fd(this,"loadListener",void 0),Fd(this,"pageHideListener",void 0),Fd(this,"stylesheetManager",void 0),Fd(this,"recordCrossOriginIframes",void 0),Fd(this,"messageHandler",void 0),Fd(this,"nestedIframeListeners",new Map),Fd(this,"attachedWindows",new WeakMap),Fd(this,"attachedDocuments",new WeakMap),Fd(this,"attachedIframes",new Map),Fd(this,"loadListenerDisposers",new WeakMap),Fd(this,"iframeElementsById",new Map),Fd(this,"pageHideHandlers",new WeakMap),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Pp(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}registerLoadListenerDisposer(e,t){let i=this.loadListenerDisposers.get(e);i||(i=new Set,this.loadListenerDisposers.set(e,i)),i.add(t);const n=this.mirror.getId(e);-1!==n&&this.iframeElementsById.set(n,e)}getIframeElementById(e){var t,i,n;return null!==(t=null!==(i=null===(n=this.attachedIframes.get(e))||void 0===n?void 0:n.element)&&void 0!==i?i:this.iframeElementsById.get(e))&&void 0!==t?t:null}forgetIframeId(e){this.attachedIframes.delete(e),this.iframeElementsById.delete(e)}disposeLoadListeners(e){const t=this.loadListenerDisposers.get(e);t&&(t.forEach(e=>Nh(e)),this.loadListenerDisposers.delete(e))}removePageHideListener(e){const t=this.pageHideHandlers.get(e);t&&(t.forEach(({win:e,handler:t})=>{$h(e,"pagehide",t)}),this.pageHideHandlers.delete(e))}addLoadListener(e){this.loadListener=e}addPageHideListener(e){this.pageHideListener=e}removeLoadListener(){this.loadListener=void 0}trackIframeContent(e,t){const i=this.mirror.getId(e);return this.attachedIframes.set(i,{element:e,content:t}),i}attachIframe(e,t){var i;const n=this.trackIframeContent(e,t);if(e.contentDocument){let t=this.attachedDocuments.get(e);t||(t=new Set,this.attachedDocuments.set(e,t)),t.add(e.contentDocument)}this.mutationCb({adds:[{parentId:n,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const s=e.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){const t=this.handleMessage.bind(this);Nh(()=>{s.addEventListener("message",t),this.nestedIframeListeners.set(s,t);let i=this.attachedWindows.get(e);i||(i=new Set,this.attachedWindows.set(e,i)),i.add(s)})}Nh(()=>{const t=e.contentWindow;if(!t)return;let i=this.pageHideHandlers.get(e);if(i)for(const e of i)if(e.win===t)return;const n=()=>{var t;null===(t=this.pageHideListener)||void 0===t||t.call(this,e),e.contentDocument&&this.mirror.removeNodeFromMap(e.contentDocument)};t.addEventListener("pagehide",n),i||(i=new Set,this.pageHideHandlers.set(e,i)),i.add({win:t,handler:n})}),null===(i=this.loadListener)||void 0===i||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const i=this.crossOriginIframeMap.get(e.source);if(!i)return;const n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){switch(t.type){case Nu.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),this.trackIframeContent(e,t.data.node),{timestamp:t.timestamp,type:Nu.IncrementalSnapshot,data:{source:Bu.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Nu.Meta:case Nu.Load:case Nu.DomContentLoaded:return!1;case Nu.Plugin:return t;case Nu.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Nu.IncrementalSnapshot:switch(t.data.source){case Bu.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const i=this.crossOriginIframeRootIdMap.get(e);i&&this.patchRootIdOnNode(t.node,i)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case Bu.Drag:case Bu.TouchMove:case Bu.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case Bu.ViewportResize:return!1;case Bu.MediaInteraction:case Bu.MouseInteraction:case Bu.Scroll:case Bu.CanvasMutation:case Bu.Input:return this.replaceIds(t.data,e,["id"]),t;case Bu.StyleSheetRule:case Bu.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Bu.Font:return t;case Bu.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case Bu.AdoptedStyleSheet:var i;return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(i=t.data.styles)||void 0===i||i.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,i,n){for(const s of n)(Array.isArray(t[s])||"number"==typeof t[s])&&(t[s]=Array.isArray(t[s])?e.getIds(i,t[s]):e.getId(i,t[s]));return t}replaceIds(e,t,i){return this.replace(this.crossOriginIframeMirror,e,t,i)}replaceStyleIds(e,t,i){return this.replace(this.crossOriginIframeStyleMirror,e,t,i)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type===Wu.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}removeIframeById(e){const t=this.attachedIframes.get(e),i=(null==t?void 0:t.element)||this.iframeElementsById.get(e)||this.mirror.getNode(e);if(this.iframeElementsById.delete(e),i){const e=i.contentWindow,t=this.attachedWindows.get(i);t&&(t.forEach(e=>{const t=this.nestedIframeListeners.get(e);t&&($h(e,"message",t),this.nestedIframeListeners.delete(e)),this.crossOriginIframeMap.delete(e)}),this.attachedWindows.delete(i)),e&&this.nestedIframeListeners.has(e)&&($h(e,"message",this.nestedIframeListeners.get(e)),this.nestedIframeListeners.delete(e)),e&&this.crossOriginIframeMap.delete(e),this.iframes.delete(i),this.disposeLoadListeners(i),this.removePageHideListener(i);const n=this.attachedDocuments.get(i);n&&(n.forEach(e=>{Nh(()=>this.mirror.removeNodeFromMap(e))}),Nh(()=>yp(i,n)),this.attachedDocuments.delete(i))}t&&this.attachedIframes.delete(e)}cleanupDetachedIframes(){if(0===this.attachedIframes.size)return;const e=[];this.attachedIframes.forEach((t,i)=>{this.mirror.has(i)||e.push(i)}),e.forEach(e=>this.removeIframeById(e))}reattachIframes(){this.attachedIframes.forEach(({content:e},t)=>{this.mirror.has(t)?this.mutationCb({adds:[{parentId:t,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(t)})}destroy(){this.recordCrossOriginIframes&&$h(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((e,t)=>{$h(t,"message",e)}),this.nestedIframeListeners.clear();const e=new Set;this.iframeElementsById.forEach(t=>e.add(t)),this.attachedIframes.forEach(({element:t})=>e.add(t)),e.forEach(e=>{this.disposeLoadListeners(e),this.removePageHideListener(e)}),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}},Fp=class{constructor(e){Fd(this,"shadowDoms",new Map),Fd(this,"mutationCb",void 0),Fd(this,"scrollCb",void 0),Fd(this,"bypassOptions",void 0),Fd(this,"mirror",void 0),Fd(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){var i,n;if(!Od(e))return;if(this.shadowDoms.has(e))return;const s=null!==(i=null===(n=sd.host(e))||void 0===n?void 0:n.ownerDocument)&&void 0!==i?i:t,r={doc:s,handlers:[]};this.shadowDoms.set(e,r);const{observer:o,buffer:a}=vp(ct(ct({},this.bypassOptions),{},{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);r.handlers.push(()=>{o.disconnect(),a.destroy(),a.releaseCanvasManager();const e=_p.indexOf(a);-1!==e&&_p.splice(e,1)}),r.handlers.push(mp(ct(ct({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(()=>{this.shadowDoms.get(e)===r&&(e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(sd.host(e))),r.handlers.push(Cp({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)))},0)}removeShadowRootsIn(e){if(0===this.shadowDoms.size)return;const t=sd.shadowRoot(e);t&&(this.shadowDoms.has(t)&&this.removeShadowRoot(t),this.removeShadowRootsIn(t)),sd.childNodes(e).forEach(e=>this.removeShadowRootsIn(e))}removeShadowRoot(e){const t=this.shadowDoms.get(e);this.shadowDoms.delete(e),null==t||t.handlers.forEach(Ap)}observeAttachShadow(e){Nh(()=>{const t=e.contentWindow,i=e.contentDocument;t&&i&&this.patchAttachShadow(t.Element,i)})}patchAttachShadow(e,t){const i=this;this.restoreHandlers.push({doc:t,handler:nd(e.prototype,"attachShadow",function(e){return function(n){const s=e.call(this,n),r=sd.shadowRoot(this);return r&&rp(this)&&i.addShadowRoot(r,t),s}})})}reset(){this.restoreHandlers.forEach(({handler:e})=>Ap(e)),this.restoreHandlers=[];const e=this.shadowDoms;this.shadowDoms=new Map,e.forEach(({handlers:e})=>e.forEach(Ap))}resetForDoc(e){const t=[];for(const i of this.restoreHandlers)i.doc===e?Ap(i.handler):t.push(i);this.restoreHandlers=t,this.shadowDoms.forEach((t,i)=>{t.doc===e&&this.removeShadowRoot(i)})}};function Ap(e){try{e()}catch(e){}}var Lp="skip-frame";function Op(e){if("object"!=typeof e||null===e)return!1;const{x:t,y:i,width:n,height:s}=e;return Number.isFinite(t)&&Number.isFinite(i)&&Number.isFinite(n)&&Number.isFinite(s)&&n>=0&&s>=0}for(var Dp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$p="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Np=0;64>Np;Np++)$p[Dp.charCodeAt(Np)]=Np;var Bp=function(e){var t,i=new Uint8Array(e),n=i.length,s="";for(t=0;n>t;t+=3)s+=Dp[i[t]>>2],s+=Dp[(3&i[t])<<4|i[t+1]>>4],s+=Dp[(15&i[t+1])<<2|i[t+2]>>6],s+=Dp[63&i[t+2]];return n%3==2?s=s.substring(0,s.length-1)+"=":n%3==1&&(s=s.substring(0,s.length-2)+"=="),s},qp=!1,Hp=new Map,zp=(e,t,i)=>{if(!e||!jp(e,t)&&"object"!=typeof e)return;const n=function(e,t){let i=Hp.get(e);return i||(i=new Map,Hp.set(e,i)),i.has(t)||i.set(t,[]),i.get(t)}(i,e.constructor.name);let s=n.indexOf(e);return-1===s&&(s=n.length,n.push(e)),s};function Up(e,t,i,n){if(e instanceof Array)return e.map(e=>Up(e,t,i,n));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer)return{rr_type:e.constructor.name,base64:Bp(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Up(e.buffer,t,i,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:i}=e;return{rr_type:t,src:i}}if(e instanceof HTMLCanvasElement){const t="HTMLImageElement";let i;try{i=e.toDataURL(n.type,n.quality)}catch(e){throw function(e){"SecurityError"===(null==e?void 0:e.name)?qp||(qp=!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.",e)):console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read.",e)}(e),e}return{rr_type:t,src:i}}return e instanceof ImageData?{rr_type:e.constructor.name,args:[Up(e.data,t,i,n),e.width,e.height]}:jp(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:zp(e,t,i)}:e}var Wp=(e,t,i,n)=>e.map(e=>Up(e,t,i,n)),jp=(e,t)=>{const i=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(i.find(i=>e instanceof t[i]))},Vp=["webgl","webgl2"];function Gp(e){return"nodeType"in e}function Qp(e,t,i,n){const s=[];try{if(n){const n=function(e,t,i){const n=e.GPUCanvasContext;if((null==n?void 0:n.prototype)&&"function"==typeof n.prototype.configure)return nd(n.prototype,"configure",function(n){return function(s){const r=function(e){const{canvas:t}=e;return t&&"object"==typeof t?t:null}(this);if(!r||Gp(r)&&Kh(r,t,i,!0))return n.call(this,s);Gp(r)&&!("__context"in r)&&(r.__context="webgpu");const o=function(e){const t=e.GPUTextureUsage;return t?t.COPY_SRC|t.RENDER_ATTACHMENT:null}(e);return n.call(this,null!==o&&s?ct(ct({},s),{},{usage:"number"==typeof s.usage?s.usage|o:o}):s)}})}(e,t,i);n&&s.push(n)}const r=nd(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(s,...r){const o=function(e){return"experimental-webgl"===e?"webgl":e}(s);if(!Kh(this,t,i,!0)&&("__context"in this||(this.__context=o),n&&Vp.includes(o)))if(r[0]&&"object"==typeof r[0]){const e=r[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else r.splice(0,1,{preserveDrawingBuffer:!0});return e.apply(this,[s,...r])}});s.push(r)}catch(e){console.warn("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(e=>e())}}function Kp(e,t,i,n,s,r,o){const a=[],l=Object.getOwnPropertyNames(e);for(const c of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if("function"!=typeof e[c])continue;const l=nd(e,c,function(e){return function(...a){const l=e.apply(this,a);if(zp(l,r,this),this.canvas&&"tagName"in this.canvas&&!Kh(this.canvas,n,s,!0)){let e;try{e=Wp(a,r,this,o)}catch(e){}e&&i(this.canvas,{type:t,property:c,args:e})}return l}});a.push(l)}catch(r){const o=Uh(e,c,{set(e){this.canvas&&"tagName"in this.canvas&&!Kh(this.canvas,n,s,!0)&&i(this.canvas,{type:t,property:c,args:[e],setter:!0})}});a.push(o)}return a}var Jp='(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',Zp="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Jp],{type:"text/javascript;charset=utf-8"});function Yp(e){let t;try{if(t=Zp&&(self.URL||self.webkitURL).createObjectURL(Zp),!t)throw"";const i=new Worker(t,{name:null==e?void 0:e.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),i}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Jp),{name:null==e?void 0:e.name})}}var Xp="A page CSP that omits blob: from worker-src or script-src blocks it";function eg(e,...t){console.warn(`[replay] canvas capture: ${e}`,...t)}var tg=class{onFullSnapshot(){var e;null===(e=this.resetFrameDedup)||void 0===e||e.call(this)}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){Fd(this,"pendingCanvasMutations",new Map),Fd(this,"rafStamps",{latestId:0,invokeId:null}),Fd(this,"mirror",void 0),Fd(this,"mutationCb",void 0),Fd(this,"resetObservers",void 0),Fd(this,"frozen",!1),Fd(this,"locked",!1),Fd(this,"rafIdTimestamp",null),Fd(this,"rafIdFlush",null),Fd(this,"refCount",0),Fd(this,"torndown",!1),Fd(this,"resetFrameDedup",null),Fd(this,"processMutation",(e,t)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)});const{sampling:t="all",win:i,blockClass:n,blockSelector:s,recordCanvas:r,dataURLOptions:o,resolutionScale:a,canvasMasking:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,r&&"all"===t&&this.initCanvasMutationObserver(i,n,s,o),r&&"number"==typeof t&&this.initCanvasFPSObserver(t,i,n,s,{dataURLOptions:o,resolutionScale:a,canvasMasking:l})}initCanvasFPSObserver(e,t,i,n,s){var r=this;if(!("OffscreenCanvas"in t))return void eg("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=Qp(t,i,n,!0),l=new Map;let c;try{c=new Yp}catch(e){return eg(`disabled because the encode worker did not start. ${Xp}`,e),void a()}let u=!1;c.onerror=e=>{var t;u=!0,eg(`stopped because the encode worker failed. ${Xp}`,e),cancelAnimationFrame(g),null===(t=c.terminate)||void 0===t||t.call(c),this.resetFrameDedup=null},this.resetFrameDedup=()=>{c.postMessage({resetFrameDedup:!0})},c.onmessage=e=>{const{id:t}=e.data;if(l.set(t,!1),!("base64"in e.data))return;const{base64:i,type:n,displayWidth:s,displayHeight:r}=e.data;this.mutationCb({id:t,type:zu["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 d=!1,h=!1;const p=1e3/e;let g,_=0;const f=e=>{var a;u||(_&&p>e-_||(_=e,(()=>{const e=[],s=t=>{try{t.querySelectorAll("canvas").forEach(t=>{Kh(t,i,n,!0)||e.push(t)}),t.querySelectorAll("*").forEach(e=>{e.shadowRoot&&s(e.shadowRoot)})}catch(e){}};return s(t.document),e})().forEach((a=rt(function*(e){const t=r.mirror.getId(e);if(-1!==t&&!l.get(t)&&0!==e.width&&0!==e.height){l.set(t,!0);try{if(["webgl","webgl2"].includes(e.__context)){var i,n;const s=e.getContext(e.__context);if(null==s||null===(i=s.isContextLost)||void 0===i?void 0:i.call(s))return void l.set(t,!1);!1===(null==s||null===(n=s.getContextAttributes())||void 0===n?void 0:n.preserveDrawingBuffer)&&s.clear(s.COLOR_BUFFER_BIT)}const r=e.clientWidth||e.width,a=e.clientHeight||e.height,u=Math.max(1,Math.round(r*o)),h=Math.max(1,Math.round(a*o)),p=function(e,t,i,n,s,r){if(!e||"function"!=typeof e.regionsFn)return;let o;try{o=e.regionsFn(t)}catch(e){return Lp}if(void 0===o)return;if(!Array.isArray(o)||!o.every(Op))return Lp;const a=i/s,l=n/r;return o.filter(e=>e.width>0&&e.height>0).map(e=>{const t=Math.floor(e.x*a),i=Math.floor(e.y*l);return{x:t,y:i,width:Math.ceil((e.x+e.width)*a)-t,height:Math.ceil((e.y+e.height)*l)-i}})}(s.canvasMasking,e,u,h,r,a);if("skip-frame"===p)return d||(d=!0,eg("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(t,!1);const g=yield createImageBitmap(e,1>o?{resizeWidth:u,resizeHeight:h,resizeQuality:"medium"}:{resizeWidth:u,resizeHeight:h});c.postMessage({id:t,bitmap:g,width:u,height:h,displayWidth:r,displayHeight:a,dataURLOptions:s.dataURLOptions,maskRegions:p},[g])}catch(e){h||(h=!0,eg("dropped a frame because the snapshot failed. A canvas that fails every frame records no canvas frames at all",e)),l.set(t,!1)}}}),function(e){return a.apply(this,arguments)}))),g=requestAnimationFrame(f))};g=requestAnimationFrame(f),this.resetObservers=()=>{var e;a(),cancelAnimationFrame(g),null===(e=c.terminate)||void 0===e||e.call(c),this.resetFrameDedup=null}}initCanvasMutationObserver(e,t,i,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=Qp(e,t,i,!1),r=function(e,t,i,n,s){const r=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[a])continue;const o=nd(t.CanvasRenderingContext2D.prototype,a,function(r){return function(...o){return Kh(this.canvas,i,n,!0)||setTimeout(()=>{let i;try{i=Wp(o,t,this,s)}catch(e){return}e(this.canvas,{type:zu["2D"],property:a,args:i})},0),r.apply(this,o)}});r.push(o)}catch(s){const o=Uh(t.CanvasRenderingContext2D.prototype,a,{set(t){Kh(this.canvas,i,n,!0)||e(this.canvas,{type:zu["2D"],property:a,args:[t],setter:!0})}});r.push(o)}return()=>{r.forEach(e=>e())}}(this.processMutation.bind(this),e,t,i,n),o=function(e,t,i,n,s){const r=[];return void 0!==t.WebGLRenderingContext&&r.push(...Kp(t.WebGLRenderingContext.prototype,zu.WebGL,e,i,n,t,s)),void 0!==t.WebGL2RenderingContext&&r.push(...Kp(t.WebGL2RenderingContext.prototype,zu.WebGL2,e,i,n,t,s)),()=>{r.forEach(e=>e())}}(this.processMutation.bind(this),e,t,i,n);this.resetObservers=()=>{s(),r(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,this.rafIdTimestamp=requestAnimationFrame(e)};this.rafIdTimestamp=requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const i=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,i)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(e);if(!i||-1===t)return;const n=i.map(e=>bs(e,$u)),{type:s}=i[0];this.mutationCb({id:t,type:s,commands:n}),this.pendingCanvasMutations.delete(e)}};function ig(e){var t,i,n;const s={};for(const n of Object.keys(null!==(t=null===(i=e.previous)||void 0===i?void 0:i.attributes)&&void 0!==t?t:{}))s[n]=null;return Object.assign(s,null===(n=e.current)||void 0===n?void 0:n.attributes),delete s.rel,delete s.href,s}var ng,sg,rg,og=class{constructor(e){var t,i,n;Fd(this,"trackedLinkElements",new WeakSet),Fd(this,"pendingDeferredSheets",new Set),Fd(this,"stopped",!1),Fd(this,"changedLinkJobs",new Map),Fd(this,"linksInlinedSinceSnapshot",new WeakSet),Fd(this,"mutationCb",void 0),Fd(this,"adoptedStyleSheetCb",void 0),Fd(this,"maskAllElementAttributes",void 0),Fd(this,"maskAttributeFn",void 0),Fd(this,"blockClass",void 0),Fd(this,"blockSelector",void 0),Fd(this,"styleMirror",new np),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(t=e.maskAllElementAttributes)&&void 0!==t&&t,this.maskAttributeFn=e.maskAttributeFn,this.blockClass=null!==(i=e.blockClass)&&void 0!==i?i:"rr-block",this.blockSelector=null!==(n=e.blockSelector)&&void 0!==n?n:null}isLinkBlocked(e){return Jh(e,this.blockClass,this.blockSelector)}attachLinkElement(e,t,i=null){this.stopped||!("_cssText"in t.attributes)||this.isLinkBlocked(e)||(this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:ig({previous:i,current:t})}]}),this.linksInlinedSinceSnapshot.add(e)),this.trackLinkElement(e)}beginDeferredLinkInlining(e,t,i={}){var n;const s=null!==(n=i.emitCssText)&&void 0!==n?n:i=>this.emitCssTextMutation(e,t,i);if(-1===t||!e.isConnected)return null;let r=null,o=null;try{o=e.sheet,o&&(r=Vd(o))}catch(e){}var a;if(!r||!o)return Md(),null===(a=i.onUninlinable)||void 0===a||a.call(i),null;const l=r;let c=!1;const u={sheet:o,invalidate(){c=!0}};this.pendingDeferredSheets.add(u);let d=!1;return{advance:t=>{if(d)return!0;const n=rd(),r=ld();let a=!0;try{if(c)return d=!0,i.onInvalidatedBySheetMutation?i.onInvalidatedBySheetMutation():Md(),!0;if(!l.advance(t))return a=!1,!1;d=!0;const n=l.text();if(!e.isConnected)return!0;let r=null;try{r=e.sheet}catch(e){}return r!==o?(Md(),!0):n?(this.isLinkBlocked(e)||s(n),!0):(Md(),null===(h=i.onUninlinable)||void 0===h||h.call(i),!0);var h}finally{a&&this.pendingDeferredSheets.delete(u),cd(p=rd()-n,null!=(g=r)?g:od)||(bd.totalMs+=p,p>bd.slowestSliceMs&&(bd.slowestSliceMs=p))}var p,g},remainingRules:()=>l.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(u)}}}onCssomSheetMutation(e){if(e&&0!==this.pendingDeferredSheets.size)for(const t of this.pendingDeferredSheets)t.sheet===e&&(this.pendingDeferredSheets.delete(t),t.invalidate())}inlineLinkStylesheetAfterChange(e,t){this.stopped||-1===t.currentId()||function(e,t){const i=Eh(e),n=Ch.get(e);if(n)return void(n.changedLinkBaseline&&(n.changedLinkBaseline.sheetAtLatestChange=i));const s={sheetAtLatestChange:i},r=()=>{const t=Eh(e);return Boolean(t&&(t!==s.sheetAtLatestChange||t.href===e.href))};r()?t():Ih(e,t,r,Th,s)}(e,()=>this.inlineChangedLinkStylesheet(e,t,3))}inlineChangedLinkStylesheet(e,t,i){var n;const s=t.currentId();if(this.stopped||!e.isConnected||-1===s||this.isLinkBlocked(e))return;null===(n=this.changedLinkJobs.get(e))||void 0===n||n.drop();let r=!1;const o=this.beginDeferredLinkInlining(e,s,{emitCssText:i=>this.emitCssTextMutation(e,s,i,ig(t.reserializeWithoutCss())),onInvalidatedBySheetMutation(){r=!0},onUninlinable:()=>this.readdAsPlainLink(e,t)});if(!o)return;let a=null;const l=()=>{o.discard(),null==a||a.cancel(),a=null,this.changedLinkJobs.get(e)===c&&this.changedLinkJobs.delete(e)},c={remainingRules:()=>o.remainingRules(),runSlice:()=>{try{return this.stopped||this.changedLinkJobs.get(e)!==c||-1===t.currentId()||this.isLinkBlocked(e)?(l(),!0):!!o.advance(200)&&(l(),!r||(i>0?this.inlineChangedLinkStylesheet(e,t,i-1):Md(),!0))}catch(e){return l(),!0}},drop:l};this.changedLinkJobs.set(e,c);const u=e=>{a=null;let t,i=0;do{t=c.runSlice(),i+=1}while(!t&&(e?!e.didTimeout&&e.timeRemaining()>5:10>i));t||(a=Mp(u))};a=Mp(u)}flushChangedLinkInlining(e){let t=0;for(const i of this.changedLinkJobs.values()){let n=!1;for(;!n;){if(Math.floor(i.remainingRules()/200)+1>e-t){i.drop(),Pd(1);break}n=i.runSlice(),t+=1}}return t}inlineDeferredLinkElement(e,t){var i;null===(i=this.beginDeferredLinkInlining(e,t))||void 0===i||i.advance(1/0)}emitCssTextMutation(e,t,i,n={}){this.stopped||(this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t,attributes:ct(ct({},n),{},{_cssText:Zd({element:e,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})})}]}),this.linksInlinedSinceSnapshot.add(e))}readdAsPlainLink(e,t){try{var i,n;if(this.stopped||!e.isConnected||this.isLinkBlocked(e))return;if(!this.linksInlinedSinceSnapshot.has(e)&&!("_cssText"in(null!==(i=null===(n=t.lastSerialization())||void 0===n?void 0:n.attributes)&&void 0!==i?i:{})))return;this.linksInlinedSinceSnapshot.delete(e),t.readdAsMove()}catch(e){}}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const i={id:t,styleIds:[]},n=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{const i=this.styleMirror.add(t);e=i;const s=rd();try{xd(()=>{try{const e=t.rules||t.cssRules;e&&Cd(e)}catch(e){}n.push({styleId:i,rules:Array.from(t.rules||CSSRule,(e,i)=>({rule:qd(e,t.href),index:i}))})})}finally{Ed(rd()-s)}}i.styleIds.push(e)}n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}stop(){this.stopped=!0,this.dropChangedLinkJobs(),xh()}dropChangedLinkJobs(){Array.from(this.changedLinkJobs.values()).forEach(e=>e.drop())}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),this.dropChangedLinkJobs(),this.linksInlinedSinceSnapshot=new WeakSet,xh({keepChangedLinks:!0})}trackStylesheetInLinkElement(e){}},ag=class{constructor(){Fd(this,"nodeMap",new WeakMap),Fd(this,"active",!1)}inOtherBuffer(e,t){const i=this.nodeMap.get(e);return i&&Array.from(i).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},lg=!1;try{if(2!==Array.from([1],e=>2*e)[0]){var cg;const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null===(cg=e.contentWindow)||void 0===cg?void 0:cg.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var ug=new Gd,dg=new Set([Bu.Mutation,Bu.MediaInteraction,Bu.StyleSheetRule,Bu.CanvasMutation,Bu.Font,Bu.Log,Bu.StyleDeclaration,Bu.AdoptedStyleSheet]);function hg(e={}){let t,i=!1,n=!1;const{emit:s,checkoutEveryNms:r,checkoutEveryNth:o,blockClass:a="rr-block",blockSelector:l=null,ignoreClass:c="rr-ignore",ignoreSelector:u=null,maskTextClass:d="rr-mask",maskTextSelector:h=null,inlineStylesheet:p=!0,inlineStylesheetBudgetRules:g,maskAllInputs:_,maskInputOptions:f,slimDOMOptions:v,maskInputFn:m,maskTextFn:y,maskAllElementAttributes:b=!1,maskAttributeFn:S,hooks:w,packFn:k,sampling:C={},dataURLOptions:x={},canvasResolutionScale:E,canvasMasking:I,mousemoveWait:T,recordDOM:M=!0,recordCanvas:P=!1,recordCrossOriginIframes:R=!1,recordAfter:F=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:A=!1,collectFonts:L=!1,inlineImages:O=!1,plugins:D,keepIframeSrcFn:N=()=>!1,ignoreCSSAttributes:B=new Set([]),attributeFilter:q,errorHandler:H}=e;hp(H);const z=ct({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},x),U=!R||window.parent===window;let W=!1;if(!U)try{window.parent.document&&(W=!1)}catch(e){W=!0}if(U&&!s)throw new Error("emit function is required");if(!U&&!W)return()=>{};void 0!==T&&void 0===C.mousemove&&(C.mousemove=T),ug.reset(),xh();const j=!0===_?{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!==f?f:{password:!0},V=Lh(void 0!==v&&v);let G;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=[].forEach)}();let Q=0;const K=new Map;let J,Z;const Y=e=>{for(const t of D||[])t.eventProcessor&&(e=t.eventProcessor(e));return k&&!W&&(e=k(e)),e};ng=(e,t)=>{var i;const n=e;if(n.timestamp=Wh(),!(null===(i=_p[0])||void 0===i?void 0:i.isFrozen())||n.type===Nu.FullSnapshot||n.type===Nu.IncrementalSnapshot&&dg.has(n.data.source)||_p.forEach(e=>e.unfreeze()),U)null==s||s(Y(n),t);else if(W){const e={type:"rrweb",event:Y(n),origin:window.location.origin,isCheckout:t};window.parent.postMessage(e,"*")}if(n.type===Nu.FullSnapshot)G=n,Q=0;else if(n.type===Nu.IncrementalSnapshot){if(n.data.source===Bu.Mutation&&n.data.isAttachIframe)return;Q++,(o&&Q>=o||r&&n.timestamp-G.timestamp>r)&&sg(!0)}};const X=e=>{if(e.removes&&e.removes.length>0){const t=e.adds.length>0?new Set(e.adds.map(e=>e.node.id)):null,i=new Set;if(e.adds.length>0)for(const t of e.adds){const e=ug.getNode(t.node.id);e&&"IFRAME"===e.nodeName&&i.add(e)}e.removes.forEach(({id:e})=>{if(t&&t.has(e))return;const n=re.getIframeElementById(e);n&&i.has(n)?re.forgetIframeId(e):(null==J||J(e),re.removeIframeById(e))}),null==Z||Z(),re.cleanupDetachedIframes()}ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.Mutation},e)})},ee=e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.Scroll},e)}),te=e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.CanvasMutation},e)}),ie=new og({mutationCb:X,adoptedStyleSheetCb:e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.AdoptedStyleSheet},e)}),maskAllElementAttributes:b,maskAttributeFn:S,blockClass:a,blockSelector:l});let ne=!1;const se=()=>{if(!ne){ne=!0;try{var e;const i=null!==(e=null==t?void 0:t.flush())&&void 0!==e?e:0;ie.flushChangedLinkInlining(50-i)}finally{ne=!1}}},re=new Rp({mirror:ug,mutationCb:X,stylesheetManager:ie,recordCrossOriginIframes:R,wrappedEmit:ng});for(const e of D||[])e.getMirror&&e.getMirror({nodeMirror:ug,crossOriginIframeMirror:re.crossOriginIframeMirror,crossOriginIframeStyleMirror:re.crossOriginIframeStyleMirror});const oe=new ag,ae=null==I?void 0:I.configured;rg=new tg({recordCanvas:P,mutationCb:te,win:window,blockClass:a,blockSelector:l,mirror:ug,sampling:C.canvas,dataURLOptions:z,resolutionScale:E,canvasMasking:I});const le=new Fp({mutationCb:X,scrollCb:ee,bypassOptions:{blockClass:a,blockSelector:l,maskTextClass:d,maskTextSelector:h,inlineStylesheet:p,maskInputOptions:j,dataURLOptions:z,maskTextFn:y,maskInputFn:m,maskAllElementAttributes:b,maskAttributeFn:S,recordCanvas:P,canvasMaskingConfigured:ae,inlineImages:O,sampling:C,slimDOMOptions:V,iframeManager:re,stylesheetManager:ie,canvasManager:rg,keepIframeSrcFn:N,processedNodeManager:oe,attributeFilter:q},mirror:ug});sg=(e=!1)=>{if(M){Sd(g);try{if(ng({type:Nu.Meta,data:{href:window.location.href,width:Gh(),height:Vh()}},e),i)return;null==t||t.cancel(),t=void 0,ie.reset(),le.init(),_p.forEach(e=>e.lock());let n=null,s=[];try{n=function(e,t){const{mirror:i=new Gd,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,canvasMaskingConfigured:u,maskAllInputs:d=!1,maskTextFn:h,maskInputFn:p,maskAllElementAttributes:g=!1,maskAttributeFn:_,slimDOM:f=!1,dataURLOptions:v,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onIframeListenerRegistered:w,onStylesheetLoad:k,stylesheetLoadTimeout:C,keepIframeSrcFn:x=()=>!1,maxDepth:E,inlineStylesheetBudgetRules:I}=t||{},T=!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===d?{password:!0}:d,M=Lh(f);Sd(I);try{return Ah(e,{doc:e,mirror:i,blockClass:n,blockSelector:s,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:T,maskTextFn:h,maskInputFn:p,maskAllElementAttributes:g,maskAttributeFn:_,slimDOMOptions:M,dataURLOptions:v,inlineImages:l,recordCanvas:c,canvasMaskingConfigured:u,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onIframeListenerRegistered:w,onStylesheetLoad:k,stylesheetLoadTimeout:C,keepIframeSrcFn:x,newlyAddedElement:!1,maxDepth:E})}finally{wd()}}(document,{mirror:ug,blockClass:a,blockSelector:l,maskTextClass:d,maskTextSelector:h,inlineStylesheet:p,maskAllInputs:j,inlineStylesheetBudgetRules:g,maskTextFn:y,maskInputFn:m,maskAllElementAttributes:b,maskAttributeFn:S,slimDOM:V,dataURLOptions:z,recordCanvas:P,canvasMaskingConfigured:ae,inlineImages:O,onSerialize(e){ep(e,ug)&&re.addIframe(e),tp(e,ug)&&ie.trackLinkElement(e),ip(e)&&le.addShadowRoot(sd.shadowRoot(e),document)},onIframeLoad(e,t){re.attachIframe(e,t),le.observeAttachShadow(e)},onIframeListenerRegistered(e,t){re.registerLoadListenerDisposer(e,t)},onStylesheetLoad(e,t,i){ie.attachLinkElement(e,t,i)},keepIframeSrcFn:N})}finally{s=Td()}if(i)return;if(!n)return console.warn("Failed to snapshot the document");if(ng({type:Nu.FullSnapshot,data:{node:n,initialOffset:jh(window)}},e),i)return;if(_p.forEach(e=>e.unlock()),rg.onFullSnapshot(),s.length){const e=function(e,t,i){let n=!1,s=null,r=0,o=null;const a=()=>null!==o||e.length>r,l=()=>{const i=e[r];e[r]=null,r+=1,i&&Nh(()=>{o=t.beginDeferredLinkInlining(i,ug.getId(i))})},c=()=>{if(!o)return;const e=o;let t=!0;Nh(()=>{t=e.advance(200)}),t&&(o=null)},u=()=>{o||l(),c()},d=e=>{if(s=null,n)return;let t=0;do{try{u()}catch(e){null==o||o.discard(),o=null,Pd(1)}t+=1}while(!n&&a()&&(e?!e.didTimeout&&e.timeRemaining()>5:10>t));n||(a()?s=Mp(d):i())};return s=Mp(d),{cancel(){n=!0,null==o||o.discard(),o=null,null==s||s.cancel(),s=null},flush(){if(n)return 0;n=!0,null==s||s.cancel(),s=null;let t=0,u=0;for(;a()&&50>t;){o||l();const e=o;if(e)if(Math.floor(e.remainingRules()/200)+1>50-t)e.discard(),o=null,u+=1;else{try{c()}catch(e){null==o||o.discard(),o=null,u+=1}t+=1}}if(a()||u>0){let t=u+(null!==o?1:0);for(let i=r;e.length>i;i++)null!==e[i]&&(t+=1);Pd(t),null==o||o.discard(),o=null}return i(),t}}}(s,ie,()=>{t===e&&(t=void 0)});t=e}R&&re.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ie.adoptStyleSheets(document.adoptedStyleSheets,ug.getId(document))}finally{wd()}}};try{const e=[];e.push(Dh("pagehide",()=>{try{se()}catch(e){}t=void 0},window));for(const t of["visibilitychange","freeze","resume"])e.push(Dh(t,ad,document));J=t=>{const i=K.get(t);i&&(i.forEach(t=>{Nh(t);const i=e.indexOf(t);-1!==i&&e.splice(i,1)}),K.delete(t))},Z=()=>{for(const[e]of K){const t=ug.getNode(e);if(t)try{t.contentDocument&&t.contentDocument.defaultView||null==J||J(e)}catch(t){null==J||J(e)}else null==J||J(e)}};const s=e=>{var t;return gp(Ep)({mutationCb:X,mousemoveCb:(e,t)=>ng({type:Nu.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.MouseInteraction},e)}),scrollCb:ee,viewportResizeCb:e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.ViewportResize},e)}),inputCb:e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.Input},e)}),mediaInteractionCb:e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.MediaInteraction},e)}),styleSheetRuleCb:e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.StyleSheetRule},e)}),styleDeclarationCb:e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.StyleDeclaration},e)}),canvasMutationCb:te,fontCb:e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.Font},e)}),selectionCb(e){ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.Selection},e)})},customElementCb(e){ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.CustomElement},e)})},blockClass:a,ignoreClass:c,ignoreSelector:u,maskTextClass:d,maskTextSelector:h,maskInputOptions:j,inlineStylesheet:p,sampling:C,recordDOM:M,recordCanvas:P,canvasMaskingConfigured:ae,inlineImages:O,userTriggeredOnInput:A,collectFonts:L,doc:e,maskInputFn:m,maskTextFn:y,maskAllElementAttributes:b,maskAttributeFn:S,keepIframeSrcFn:N,blockSelector:l,slimDOMOptions:V,dataURLOptions:z,mirror:ug,iframeManager:re,stylesheetManager:ie,shadowDomManager:le,processedNodeManager:oe,canvasManager:rg,ignoreCSSAttributes:B,attributeFilter:q,plugins:(null==D||null===(t=D.filter(e=>e.observer))||void 0===t?void 0:t.map(e=>({name:e.name,observer:e.observer,options:e.options,callback:t=>ng({type:Nu.Plugin,data:{plugin:e.name,payload:t}})})))||[]},w)};re.addLoadListener(t=>{try{const i=ug.getId(t),n=s(t.contentDocument);if("function"==typeof n&&(e.push(n),-1!==i)){let e=K.get(i);e||(e=new Set,K.set(i,e)),e.add(n)}}catch(e){console.warn(e)}}),re.addPageHideListener(e=>{const t=ug.getId(e);null==J||J(t),yp(e)});let r=-1;const o=e=>ng({type:Nu.Custom,data:{tag:"rrweb/fullscreen",payload:e}}),g=()=>{var e,t,i,n;const s=document,a=null!==(e=null!==(t=null!==(i=null!==(n=s.fullscreenElement)&&void 0!==n?n:s.webkitFullscreenElement)&&void 0!==i?i:s.mozFullScreenElement)&&void 0!==t?t:s.msFullscreenElement)&&void 0!==e?e:null,l=a?ug.getId(a):-1;l!==r&&(-1!==r&&o({id:r,enter:!1}),r=l,-1!==l&&o({id:l,enter:!0}))},_=()=>{if(i||n)return;if(n=!0,sg(),i)return;const t=s(document);i?"function"==typeof t&&Bh([t]):("function"==typeof t&&e.push(t),e.push(Dh("fullscreenchange",g)),e.push(Dh("webkitfullscreenchange",g)),e.push(Dh("mozfullscreenchange",g)),e.push(Dh("MSFullscreenChange",g)),lg=!0)};return["interactive","complete"].includes(document.readyState)?_():(e.push(Dh("DOMContentLoaded",()=>{ng({type:Nu.DomContentLoaded,data:{}}),"DOMContentLoaded"===F&&setTimeout(_,0)})),e.push(Dh("load",()=>{ng({type:Nu.Load,data:{}}),"load"===F&&_()},window))),()=>{i=!0;try{se()}catch(e){}t=void 0,ie.stop(),Bh(e),oe.destroy(),re.removeLoadListener(),re.destroy(),K.clear(),le.reset(),ug.reset(),lg=!1,pp()}}catch(e){console.warn(e)}}hg.addCustomEvent=(e,t)=>{if(!lg)throw new Error("please add custom event after start recording");ng({type:Nu.Custom,data:{tag:e,payload:t}})},hg.freezePage=()=>{_p.forEach(e=>e.freeze())},hg.takeFullSnapshot=e=>{if(!lg)throw new Error("please take full snapshot after start recording");sg(e)},hg.isRecording=()=>lg,hg.mirror=ug,"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 pg=/[a-z][a-z0-9+.-]{0,63}:\/\//i;new RegExp(`^${pg.source}`,"i"),new RegExp(pg.source,"gi");var gg=Object.create(null);function _g(e){return _g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_g(e)}function fg(e,t,i){return(t=function(e){var t=function(e){if("object"!=_g(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=_g(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_g(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}gg.Node=Object.create(null),gg.ShadowRoot=Object.create(null),gg.MutationObserver=Object.create(null),gg.Element=Object.create(null);var vg=class{constructor(e){fg(this,"fileName",void 0),fg(this,"functionName",void 0),fg(this,"lineNumber",void 0),fg(this,"columnNumber",void 0),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${t})`:`${this.fileName}:${e}:${t}`}},mg=/(^|@)\S+:\d+/,yg=/^\s*at .*(\S+:\d+|\(native\))/m,bg=/^(eval@)?(\[native code])?$/,Sg={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(yg)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):[]:[]},extractLocation(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error(`Cannot parse given url: ${e}`);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE(e){return e.stack.split("\n").filter(function(e){return!!e.match(yg)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const i=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=i?t.replace(i[0],""):t;const n=t.split(/\s+/).slice(1),s=this.extractLocation(i?i[1]:n.pop());return new vg({functionName:n.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(s[0])>-1?void 0:s[0],lineNumber:s[1],columnNumber:s[2]})},this)},parseFFOrSafari(e){return e.stack.split("\n").filter(function(e){return!e.match(bg)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new vg({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=e.match(t),n=i&&i[1]?i[1]:void 0,s=this.extractLocation(e.replace(t,""));return new vg({functionName:n,fileName:s[0],lineNumber:s[1],columnNumber:s[2]})}},this)},parseOpera(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9(e){const t=/Line (\d+).*script (?:in )?(\S+)/i,i=e.message.split("\n"),n=[];for(let e=2,s=i.length;s>e;e+=2){const s=t.exec(i[e]);s&&n.push(new vg({fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera10(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=e.stacktrace.split("\n"),n=[];for(let e=0,s=i.length;s>e;e+=2){const s=t.exec(i[e]);s&&n.push(new vg({functionName:s[3]||void 0,fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera11(e){return e.stack.split("\n").filter(function(e){return!!e.match(mg)&&!e.match(/^Error created at/)},this).map(function(e){const t=e.split("@"),i=this.extractLocation(t.pop());return new vg({functionName:(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function wg(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let i=e.localName;if(!i)break;i=i.toLowerCase();const n=e.parentElement,s=[];if(n.children&&n.children.length>0)for(let e=0;n.children.length>e;e++){const t=n.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===i&&s.push(t)}s.length>1&&(i+=`:eq(${s.indexOf(e)})`),t=i+(t?">"+t:""),e=n}return t}function kg(e){return Array.isArray(e)}function Cg(e){return"object"==typeof e&&null!==e&&!kg(e)}function xg(e,t){if(0===t)return!0;const i=Object.keys(e);for(const n of i)if(Cg(e[n])&&xg(e[n],t-1))return!0;return!1}function Eg(e,t){const i={numOfKeysLimit:50,depthOfLimit:4};Object.assign(i,t);const n=[],s=[];return JSON.stringify(e,function(e,t){if(n.length>0){const i=n.indexOf(this);~i?n.splice(i+1):n.push(this),~i?s.splice(i,1/0,e):s.push(e),~n.indexOf(t)&&(t=n[0]===t?"[Circular ~]":"[Circular ~."+s.slice(0,n.indexOf(t)).join(".")+"]")}else n.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(Cg(r=t)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||Cg(r)&&xg(r,i.depthOfLimit))return function(e){let t=e.toString();return i.stringLengthLimit&&t.length>i.stringLengthLimit&&(t=`${t.slice(0,i.stringLengthLimit)}...`),t}(t);var r;if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){const e={};for(const i in t){const n=t[i];e[i]=kg(n)?wg(n.length?n[0]:null):n}return e}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t})}var Ig={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 Tg(e,t,i){const n=i?Object.assign({},Ig,i):Ig,s=n.logger;if(!s)return()=>{};let r;r="string"==typeof s?t[s]:s;let o=0,a=!1,l=!0;const c=[];if(n.level.includes("error")){const i=t=>{const i=t.message;e({level:"error",trace:Sg.parse(t.error).map(e=>e.toString()),payload:[Eg(i,n.stringifyOptions)]})};t.addEventListener("error",i),c.push(()=>{t.removeEventListener("error",i)});const s=t=>{let i,s;t.reason instanceof Error?(i=t.reason,s=[Eg(`Uncaught (in promise) ${i.name}: ${i.message}`,n.stringifyOptions)]):(i=new Error,s=[Eg("Uncaught (in promise)",n.stringifyOptions),Eg(t.reason,n.stringifyOptions)]),e({level:"error",trace:Sg.parse(i).map(e=>e.toString()),payload:s})};t.addEventListener("unhandledrejection",s),c.push(()=>{t.removeEventListener("unhandledrejection",s)})}for(const e of n.level)c.push(u(r,e));return()=>{l=!1,c.forEach(e=>e())};function u(t,i){return t[i]?function(s,r){try{if(!(r in s))return()=>{};const c=s[r],u={next:c},d=(s=>(...r)=>{if(s.apply(t,r),l&&!("assert"===i&&r[0]||a)){a=!0;try{const t=Sg.parse(new Error).map(e=>e.toString()).splice(1),s=("assert"===i?r.slice(1):r).map(e=>Eg(e,n.stringifyOptions));o++,n.lengthThreshold>o?e({level:i,trace:t,payload:s}):o===n.lengthThreshold&&e({level:"warn",trace:[],payload:[Eg("The number of log records reached the threshold.")]})}catch(e){s.apply(t,["rrweb logger error:",e,...r])}finally{a=!1}}})(function(...e){return u.next.apply(this,e)});return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:c},__rrweb_layer__:{enumerable:!1,value:u}})),s[r]=d,()=>{if(s[r]===d)return void(s[r]=u.next);const e=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0};let t=s[r],i=e(t);for(;i;){if(i.next===d)return void(i.next=u.next);t=i.next,i=e(t)}}}catch(e){return()=>{}}}(t,i):()=>{}}}var Mg=e=>({name:"rrweb/console@1",observer:Tg,options:e});const Pg=()=>{},Rg=e=>{var t;if(Ct(e))return null!==(t=e.__posthog_layer__)&&void 0!==t?t:e.__rrweb_layer__};function Fg(e,t,i){try{if(!(t in e))return Pg;const n={next:e[t]},s=i(function(...e){return n.next.apply(this,e)});return Ct(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:n}})),e[t]=s,()=>{if(e[t]===s)return void(e[t]=n.next);let i=e[t],r=Rg(i);for(;r;){if(r.next===s)return void(r.next=n.next);i=r.next,r=Rg(i)}}}catch(e){return Pg}}function Ag(e,t){var i;const n=function(e){try{return"string"==typeof e?new URL(e).hostname:"url"in e?new URL(e.url).hostname:e.hostname}catch(e){return null}}(e),s={hostname:n,isHostDenied:!1};if(!(null===(i=t.payloadHostDenyList)||void 0===i?void 0:i.length)||!(null==n?void 0:n.trim().length))return s;for(const e of t.payloadHostDenyList)if(n.endsWith(e))return{hostname:n,isHostDenied:!0};return s}const Lg=Nr("[Recorder]"),Og=e=>"navigation"===e.entryType,Dg=e=>"resource"===e.entryType,$g=()=>{};function Ng(e,t){var i;return Og(t)&&"complete"===(null===(i=e.document)||void 0===i?void 0:i.readyState)&&t.loadEventEnd>0}function Bg(e,t){return t.recordInitialRequests?e.performance.getEntries().filter(i=>Ng(e,i)||Dg(i)&&t.initiatorTypes.includes(i.initiatorType)):t.performanceEntryTypeToObserve.includes("navigation")?function(e){var t;return"complete"!==(null===(t=e.document)||void 0===t?void 0:t.readyState)?[]:e.performance.getEntriesByType("navigation").filter(t=>Ng(e,t))}(e):[]}function qg(e,t){return!!t&&(Lt(t)||t[e])}function Hg(e){if("undefined"==typeof Request)return!1;if(e instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(e)}catch(e){return!1}}const zg=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function Ug({type:e,recordBody:t,headers:i,url:n}){function s(e){const t=Object.keys(i).find(e=>"content-type"===e.toLowerCase()),n=t&&i[t];return e.some(e=>null==n?void 0:n.toLowerCase().includes(e))}if(!t)return!1;if(function e(t){try{return"string"==typeof t?t.startsWith("blob:"):t instanceof URL?"blob:"===t.protocol:!!Hg(t)&&e(t.url)}catch(e){return!1}}(n))return!1;if(s(zg))return!1;if(Lt(t))return!0;if(kt(t))return s(t);const r=t[e];return Lt(r)?r:s(r)}function Wg(e,t,i,n,s){return jg.apply(this,arguments)}function jg(){return jg=rt(function*(e,t,i,n,s,r=0){if(r>10)return Lg.warn("Failed to get performance entry for request",{url:i,initiatorType:t}),null;const o=function(e,t){for(let i=e.length-1;i>=0;i-=1)if(t(e[i]))return e[i]}(e.performance.getEntriesByName(i),e=>Dg(e)&&e.initiatorType===t&&(It(n)||e.startTime>=n)&&(It(s)||s>=e.startTime));return o||(yield new Promise(e=>setTimeout(e,50*r)),Wg(e,t,i,n,s,r+1))}),jg.apply(this,arguments)}function Vg({body:e,options:t,url:i}){if(Rt(e))return null;const{hostname:n,isHostDenied:s}=Ag(i,t);if(s)return n+" is in deny list";if(Tt(e))return e;if((e=>"u">typeof Document&&e instanceof Document)(e))return e.textContent;if(Ot(e))return io(e);if(xt(e))try{return JSON.stringify(e)}catch(e){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(e)}const Gg=e=>!Pt(e)&&("navigation"===e.entryType||"resource"===e.entryType);function Qg(e,{entry:t,method:i,status:n,networkRequest:s,isInitial:r,start:o,end:a,url:l,initiatorType:c}){o=t?t.startTime:o,a=t?t.responseEnd:a;const u=Math.floor(Date.now()-e.performance.now()),d=Math.floor(u+(o||0)),h=[ct(ct({},t?JSON.parse(JSON.stringify(t.toJSON())):{name:l}),{},{startTime:It(o)?void 0:Math.round(o),endTime:It(a)?void 0:Math.round(a),timeOrigin:u,timestamp:d,method:i,initiatorType:c||(t?t.initiatorType:void 0),status:n,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:r})];if(Gg(t))for(const e of t.serverTiming||[])h.push({timeOrigin:u,timestamp:d,startTime:Math.round(t.startTime),name:e.name,duration:e.duration,entryType:"serverTiming"});return h}const Kg=["video/","audio/"];function Jg(e){return xt(e)&&Ct(e.getReader)&&Ct(e.tee)}const Zg="[SessionReplay] Timeout while trying to read body",Yg="[SessionReplay] Failed to read body";function Xg(e){return`${Yg}: ${e}`}function e_(e){return`[SessionReplay] Body too large to record (> ${e} bytes)`}function t_(e,t){if(!t.streamNetworkBody)return function(e){return new Promise(t=>{const i=setTimeout(()=>t(Zg),500);try{e.clone().text().then(e=>t(e),e=>t(Xg(e))).finally(()=>clearTimeout(i))}catch(e){clearTimeout(i),t(Yg)}})}(e);const i=ta(t);return function(e,t){try{var i,n;const s=null===(i=e.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>t}catch(e){return!1}}(e,i)?Promise.resolve(e_(i)):function(e,t){return new Promise(i=>{let n,s=!1;function r(){try{null==n||n.cancel().catch(()=>{})}catch(e){}}function o(e){s||(s=!0,clearTimeout(a),r(),i(e))}const a=setTimeout(()=>o(Zg),500);let l;try{l=e.clone()}catch(e){return void o(Yg)}const c=l.body;if(!Jg(c)||"undefined"==typeof TextDecoder){try{l.text().then(e=>o(e),e=>o(Xg(e)))}catch(e){o(Yg)}return}try{n=c.getReader()}catch(e){return void o(Yg)}const u=[];let d=0;!function e(){n.read().then(({done:i,value:n})=>{if(s)r();else if(i)o((new TextDecoder).decode(function(e,t){const i=new Uint8Array(t);let n=0;for(const t of e)i.set(t,n),n+=t.byteLength;return i}(u,d)));else{if(n){if(d+n.byteLength>t)return void o(e_(t));d+=n.byteLength,u.push(n)}e()}},e=>o(Xg(e)))}()})}(e,i)}function i_(e){return n_.apply(this,arguments)}function n_(){return n_=rt(function*({r:e,options:t,url:i}){const{hostname:n,isHostDenied:s}=Ag(i,t);return s?Promise.resolve(n+" is in deny list"):t_(e,t)}),n_.apply(this,arguments)}function s_(e){return r_.apply(this,arguments)}function r_(){return r_=rt(function*({r:e,options:t,url:i}){const n=function({r:e,options:t,url:i}){var n;if("chunked"===e.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";const s=null===(n=e.headers.get("Content-Type"))||void 0===n?void 0:n.toLowerCase(),r=Kg.some(e=>null==s?void 0:s.startsWith(e));if(s&&r)return`Content-Type ${s} is not supported`;const{hostname:o,isHostDenied:a}=Ag(i,t);return a?o+" is in deny list":null}({r:e,options:t,url:i});return Pt(n)?t_(e,t):Promise.resolve(n)}),r_.apply(this,arguments)}let o_=null;function a_(e,t,i){if(!("performance"in t))return()=>{};if(o_)return Lg.warn("Network observer already initialised, doing nothing"),()=>{};const n=i?Object.assign({},ia,i):ia;let s=!0,r=!1;const o=t=>{if(!s)return;const i=[];let o=!1;t.requests.forEach(e=>{const t="serverTiming"===e.entryType;if(t&&o)return;let s;try{s=n.maskRequestFn(e)}catch(e){return r||(r=!0,Lg.warn("Network capture masking callback failed; dropping the record. Further masking failures will not be logged for this observer.")),void(t||(o=!0))}t||(o=!s||(e=>!!e&&ua.has(e))(s)),s&&i.push(s)}),i.length>0&&e(ct(ct({},t),{},{requests:i}))},a=function(e,t,i){try{e({requests:Bg(t,i).flatMap(e=>Qg(t,{entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}catch(e){Lg.error("Failed to capture initial performance entries for network capture",e)}const n=t.PerformanceObserver,s=null==n?void 0:n.supportedEntryTypes;if(!n||!kt(s))return;const r=s.filter(e=>i.performanceEntryTypeToObserve.includes(e));if(!r.length)return;const o=new n(n=>{e({requests:n.getEntries().filter(e=>Og(e)||Dg(e)&&i.initiatorTypes.includes(e.initiatorType)&&(e=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)).flatMap(e=>Qg(t,{entry:e,method:void 0,status:void 0,networkRequest:{}}))})});return o.observe({entryTypes:r}),()=>{o.disconnect()}}(o,t,n),l=n.recordHeaders||n.recordBody;if(!a&&!l)return s=!1,$g;let c=()=>{},u=()=>{};return l&&(c=function(e,t,i){if(!i.initiatorTypes.includes("xmlhttprequest"))return()=>{};const n=qg("request",i.recordHeaders),s=qg("response",i.recordHeaders),r=Fg(t.XMLHttpRequest.prototype,"open",r=>function(o,a,l=!0,c,u){const d=this;try{const r=new Request(a),l={};let c,u;const h={},p=d.setRequestHeader.bind(d);d.setRequestHeader=(e,t)=>(h[e]=t,p(e,t)),n&&(l.requestHeaders=h);const g=d.send.bind(d);d.send=e=>(Ug({type:"request",headers:h,url:a,recordBody:i.recordBody})&&(l.requestBody=Vg({body:e,options:i,url:a})),c=t.performance.now(),g(e));const _=()=>{d.removeEventListener("readystatechange",f),d.removeEventListener("error",_),d.removeEventListener("abort",_),d.removeEventListener("timeout",_)},f=()=>{if(d.readyState!==d.DONE)return;_(),u=t.performance.now();const n={};d.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(e=>{const t=e.split(": "),i=t.shift(),s=t.join(": ");i&&(n[i]=s)}),s&&(l.responseHeaders=n),Ug({type:"response",headers:n,url:a,recordBody:i.recordBody})&&(l.responseBody=Vg({body:d.response,options:i,url:a})),Wg(t,"xmlhttprequest",r.url,c,u).then(i=>{e({requests:Qg(t,{entry:i,method:o,status:null==d?void 0:d.status,networkRequest:l,start:c,end:u,url:a.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};d.addEventListener("readystatechange",f),d.addEventListener("error",_),d.addEventListener("abort",_),d.addEventListener("timeout",_)}catch(e){Lg.error("Failed to instrument XHR for network capture",e)}r.call(d,o,a.toString(),l,c,u)});return()=>{r()}}(o,t,n),u=!0===n.captureFetchSynchronously?function(e,t,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=qg("request",i.recordHeaders),s=qg("response",i.recordHeaders),r=Fg(t,"fetch",r=>function(o,a){let l;try{l=new Request(o,a)}catch(e){Lg.error("Failed to instrument fetch for network capture",e);try{return Promise.resolve(r(o,a))}catch(e){return new Promise((t,i)=>i(e))}}const c={};let u,d;const h=rt(function*(){try{const e={};l.headers.forEach((t,i)=>{e[i]=t}),n&&(c.requestHeaders=e),!Jg(null==a?void 0:a.body)&&Ug({type:"request",headers:e,url:o,recordBody:i.recordBody})&&(c.requestBody=yield i_({r:l,options:i,url:o}))}catch(e){Lg.error("Failed to record fetch request for network capture",e)}})(),p=(g=rt(function*(e){try{const t={};e.headers.forEach((e,i)=>{t[i]=e}),s&&(c.responseHeaders=t),Ug({type:"response",headers:t,url:o,recordBody:i.recordBody})&&(c.responseBody=yield s_({r:e,options:i,url:o}))}catch(e){Lg.error("Failed to record fetch response for network capture",e)}}),function(e){return g.apply(this,arguments)});var g;try{u=t.performance.now()}catch(e){}let _;try{_=Hg(o)?r(l):r(o,a)}catch(e){_=new Promise((t,i)=>i(e))}const f=Promise.resolve(_).then(e=>{try{d=t.performance.now()}catch(e){}return{status:"fulfilled",response:e}},e=>({status:"rejected",error:e}));return rt(function*(){let i;try{yield h;const e=yield f;if("rejected"===e.status)throw e.error;return i=e.response,yield p(i),i}finally{(n=i,Wg(t,"fetch",l.url,u,d).then(i=>{e({requests:Qg(t,{entry:i,method:l.method,status:null==n?void 0:n.status,networkRequest:c,start:u,end:d,url:l.url,initiatorType:"fetch"})})})).catch(()=>{})}var n})()});return()=>{r()}}(o,t,n):function(e,t,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=qg("request",i.recordHeaders),s=qg("response",i.recordHeaders),r=Fg(t,"fetch",r=>function(){var o=rt(function*(o,a){let l,c;try{l=new Request(o,a)}catch(e){return Lg.error("Failed to instrument fetch for network capture",e),r(o,a)}const u={};let d,h;try{try{const e={};l.headers.forEach((t,i)=>{e[i]=t}),n&&(u.requestHeaders=e),!Jg(null==a?void 0:a.body)&&Ug({type:"request",headers:e,url:o,recordBody:i.recordBody})&&(u.requestBody=yield i_({r:l,options:i,url:o}))}catch(e){Lg.error("Failed to record fetch request for network capture",e)}d=t.performance.now(),c=Hg(o)?yield r(l):yield r(o,a),h=t.performance.now();try{const e={};c.headers.forEach((t,i)=>{e[i]=t}),s&&(u.responseHeaders=e),Ug({type:"response",headers:e,url:o,recordBody:i.recordBody})&&(u.responseBody=yield s_({r:c,options:i,url:o}))}catch(e){Lg.error("Failed to record fetch response for network capture",e)}return c}finally{Wg(t,"fetch",l.url,d,h).then(i=>{e({requests:Qg(t,{entry:i,method:l.method,status:null==c?void 0:c.status,networkRequest:u,start:d,end:h,url:l.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(e,t){return o.apply(this,arguments)}}());return()=>{r()}}(o,t,n)),o_=()=>{s=!1,null==a||a(),c(),u(),o_=null},o_}const l_=e=>({name:"rrweb/network@1",observer:a_,options:e});var c_,u_,d_,h_,p_,g_,__,f_,v_,m_,y_,b_,S_,w_,k_;d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Mg,getRecordNetworkPlugin:l_},d.__PosthogExtensions__.rrweb={record:hg,version:"v2",wasMaxDepthReached:()=>Fh,resetMaxDepthState(){Fh=!1,Rh=!1},getLastSnapshotCost:()=>gd,getMutationCost:()=>ct({},yd),getObserverInitFailures:()=>xp.size?Array.from(xp):void 0,resetSnapshotCostState(){ud=0,dd=0,hd=0,od=0,pd={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},gd=null,_d=null,fd=[],vd=0,md=0,yd={slowestBatchMs:0},bd={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},d.rrweb={record:hg,version:"v2"},d.rrwebConsoleRecord={getRecordConsolePlugin:Mg},d.getRecordNetworkPlugin=l_,d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initSessionRecording=(e,t)=>new Du(e,t);var C_={},x_=[],E_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,I_=Array.isArray;function T_(e,t){for(var i in t)e[i]=t[i];return e}function M_(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function P_(e,t,i){var n,s,r,o={};for(r in t)"key"==r?n=t[r]:"ref"==r?s=t[r]:o[r]=t[r];if(arguments.length>2&&(o.children=arguments.length>3?c_.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(r in e.defaultProps)void 0===o[r]&&(o[r]=e.defaultProps[r]);return R_(e,o,n,s,null)}function R_(e,t,i,n,s){var r={type:e,props:t,key:i,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==s?++d_:s,__i:-1,__u:0};return null==s&&null!=u_.vnode&&u_.vnode(r),r}function F_(e){return e.children}function A_(e,t){this.props=e,this.context=t}function L_(e,t){if(null==t)return e.__?L_(e.__,e.__i+1):null;for(var i;e.__k.length>t;t++)if(null!=(i=e.__k[t])&&null!=i.__e)return i.__e;return"function"==typeof e.type?L_(e):null}function O_(e){if(e.__P&&e.__d){var t=e.__v,i=t.__e,n=[],s=[],r=T_({},t);r.__v=t.__v+1,u_.vnode&&u_.vnode(r),j_(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[i]:null,n,null==i?L_(t):i,!!(32&t.__u),s),r.__v=t.__v,r.__.__k[r.__i]=r,G_(n,r,s),t.__e=t.__=null,r.__e!=i&&D_(r)}}function D_(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),D_(e)}function $_(e){(!e.__d&&(e.__d=!0)&&h_.push(e)&&!N_.__r++||p_!=u_.debounceRendering)&&((p_=u_.debounceRendering)||g_)(N_)}function N_(){try{for(var e,t=1;h_.length;)h_.length>t&&h_.sort(__),e=h_.shift(),t=h_.length,O_(e)}finally{h_.length=N_.__r=0}}function B_(e,t,i,n,s,r,o,a,l,c,u){var d,h,p,g,_,f,v,m=n&&n.__k||x_,y=t.length;for(l=function(e,t,i,n,s){var r,o,a,l,c,u=i.length,d=u,h=0;for(e.__k=new Array(s),r=0;s>r;r++)null!=(o=t[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=e.__k[r]=R_(null,o,null,null,null):I_(o)?o=e.__k[r]=R_(F_,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=e.__k[r]=R_(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[r]=o,l=r+h,o.__=e,o.__b=e.__b+1,a=null,-1!=(c=o.__i=H_(o,i,l,d))&&(d--,(a=i[c])&&(a.__u|=2)),null==a||null==a.__v?(-1==c&&(s>u?h--:u>s&&h++),"function"!=typeof o.type&&(o.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,o.__u|=4))):e.__k[r]=null;if(d)for(r=0;u>r;r++)null!=(a=i[r])&&!(2&a.__u)&&(a.__e==n&&(n=L_(a)),J_(a,a));return n}(i,t,m,l,y),d=0;y>d;d++)null!=(p=i.__k[d])&&(h=-1!=p.__i&&m[p.__i]||C_,p.__i=d,f=j_(e,p,h,s,r,o,a,l,c,u),g=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&K_(h.ref,null,p),u.push(p.ref,p.__c||g,p)),null==_&&null!=g&&(_=g),(v=!!(4&p.__u))||h.__k===p.__k?(l=q_(p,l,e,v),v&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==f?l=f:g&&(l=g.nextSibling),p.__u&=-7);return i.__e=_,l}function q_(e,t,i,n){var s,r;if("function"==typeof e.type){for(s=e.__k,r=0;s&&s.length>r;r++)s[r]&&(s[r].__=e,t=q_(s[r],t,i,n));return t}e.__e!=t&&(n&&(t&&e.type&&!t.parentNode&&(t=L_(e)),i.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function H_(e,t,i,n){var s,r,o,a=e.key,l=e.type,c=t[i],u=null!=c&&!(2&c.__u);if(null===c&&null==a||u&&a==c.key&&l==c.type)return i;if(n>(u?1:0))for(s=i-1,r=i+1;s>=0||t.length>r;)if(null!=(c=t[o=0>s?r++:s--])&&!(2&c.__u)&&a==c.key&&l==c.type)return o;return-1}function z_(e,t,i){"-"==t[0]?e.setProperty(t,null==i?"":i):e[t]=null==i?"":"number"!=typeof i||E_.test(t)?i:i+"px"}function U_(e,t,i,n,s){var r,o;e:if("style"==t)if("string"==typeof i)e.style.cssText=i;else{if("string"==typeof n&&(e.style.cssText=n=""),n)for(t in n)i&&t in i||z_(e.style,t,"");if(i)for(t in i)n&&i[t]==n[t]||z_(e.style,t,i[t])}else if("o"==t[0]&&"n"==t[1])r=t!=(t=t.replace(y_,"$1")),o=t.toLowerCase(),t=o in e||"onFocusOut"==t||"onFocusIn"==t?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=i,i?n?i[m_]=n[m_]:(i[m_]=b_,e.addEventListener(t,r?w_:S_,r)):e.removeEventListener(t,r?w_:S_,r);else{if("http://www.w3.org/2000/svg"==s)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==i?"":i;break e}catch(e){}"function"==typeof i||(null==i||!1===i&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==i?"":i))}}function W_(e){return function(t){if(this.l){var i=this.l[t.type+e];if(null==t[v_])t[v_]=b_++;else if(i[m_]>t[v_])return;return i(u_.event?u_.event(t):t)}}}function j_(e,t,i,n,s,r,o,a,l,c){var u,d,h,p,g,_,f,v,m,y,$,b,S,w,k,C,x=t.type;if(void 0!==t.constructor)return null;128&i.__u&&(l=!!(32&i.__u),r=[a=t.__e=i.__e]),(u=u_.__b)&&u(t);e:if("function"==typeof x){d=o.length;try{if(m=t.props,y=x.prototype&&x.prototype.render,$=(u=x.contextType)&&n[u.__c],b=u?$?$.props.value:u.__:n,i.__c?v=(h=t.__c=i.__c).__=h.__E:(y?t.__c=h=new x(m,b):(t.__c=h=new A_(m,b),h.constructor=x,h.render=Z_),$&&$.sub(h),h.state||(h.state={}),h.__n=n,p=h.__d=!0,h.__h=[],h._sb=[]),y&&null==h.__s&&(h.__s=h.state),y&&null!=x.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=T_({},h.__s)),T_(h.__s,x.getDerivedStateFromProps(m,h.__s))),g=h.props,_=h.state,h.__v=t,p)y&&null==x.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),y&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(y&&null==x.getDerivedStateFromProps&&m!==g&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,b),t.__v==i.__v||!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,b)){t.__v!=i.__v&&(h.props=m,h.state=h.__s,h.__d=!1),t.__e=i.__e,t.__k=i.__k,t.__k.some(function(e){e&&(e.__=t)}),x_.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&o.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,b),y&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(g,_,f)})}if(h.context=b,h.props=m,h.__P=e,h.__e=!1,S=u_.__r,w=0,y)h.state=h.__s,h.__d=!1,S&&S(t),u=h.render(h.props,h.state,h.context),x_.push.apply(h.__h,h._sb),h._sb=[];else do{h.__d=!1,S&&S(t),u=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&25>++w);h.state=h.__s,null!=h.getChildContext&&(n=T_(T_({},n),h.getChildContext())),y&&!p&&null!=h.getSnapshotBeforeUpdate&&(f=h.getSnapshotBeforeUpdate(g,_)),k=null!=u&&u.type===F_&&null==u.key?Q_(u.props.children):u,a=B_(e,I_(k)?k:[k],t,i,n,s,r,o,a,l,c),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),v&&(h.__E=h.__=null)}catch(e){if(o.length=d,t.__v=null,l||null!=r)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=r&&(r[r.indexOf(a)]=null),t.__e=a}else{if(null!=r)for(C=r.length;C--;)M_(r[C]);V_(t)}else t.__e=i.__e,!t.__k&&i.__k&&(t.__k=i.__k),e.then||V_(t);u_.__e(e,t,i)}}else null==r&&t.__v==i.__v?(t.__k=i.__k,t.__e=i.__e):a=t.__e=function(e,t,i,n,s,r,o,a,l){var c,u,d,h,p,g,_,f=i.props||C_,v=t.props,m=t.type;if("svg"==m?s="http://www.w3.org/2000/svg":"math"==m?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=r)for(c=0;r.length>c;c++)if((p=r[c])&&"setAttribute"in p==!!m&&(m?p.localName==m:3==p.nodeType)){e=p,r[c]=null;break}if(null==e){if(null==m)return document.createTextNode(v);e=document.createElementNS(s,m,v.is&&v),a&&(u_.__m&&u_.__m(t,r),a=!1),r=null}if(null==m)f===v||a&&e.data==v||(e.data=v);else{if(r="textarea"==m&&null!=v.defaultValue?null:r&&c_.call(e.childNodes),!a&&null!=r)for(f={},c=0;e.attributes.length>c;c++)f[(p=e.attributes[c]).name]=p.value;for(c in f)p=f[c],"dangerouslySetInnerHTML"==c?d=p:"children"==c||c in v||"value"==c&&"defaultValue"in v||"checked"==c&&"defaultChecked"in v||U_(e,c,null,p,s);for(c in v)p=v[c],"children"==c?h=p:"dangerouslySetInnerHTML"==c?u=p:"value"==c?g=p:"checked"==c?_=p:a&&"function"!=typeof p||f[c]===p||U_(e,c,p,f[c],s);if(u)a||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),B_("template"==t.type?e.content:e,I_(h)?h:[h],t,i,n,"foreignObject"==m?"http://www.w3.org/1999/xhtml":s,r,o,r?r[0]:i.__k&&L_(i,0),a,l),null!=r)for(c=r.length;c--;)M_(r[c]);a&&"textarea"!=m||(c="value","progress"==m&&null==g?e.removeAttribute("value"):null!=g&&(g!==e[c]||"progress"==m&&!g||"option"==m&&g!=f[c])&&U_(e,c,g,f[c],s),c="checked",null!=_&&_!=e[c]&&U_(e,c,_,f[c],s))}return e}(i.__e,t,i,n,s,r,o,l,c);return(u=u_.diffed)&&u(t),128&t.__u?void 0:a}function V_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(V_))}function G_(e,t,i){for(var n=0;i.length>n;n++)K_(i[n],i[++n],i[++n]);u_.__c&&u_.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){u_.__e(e,t.__v)}})}function Q_(e){return"object"!=typeof e||null==e||e.__b>0?e:I_(e)?e.map(Q_):void 0!==e.constructor?null:T_({},e)}function K_(e,t,i){try{if("function"==typeof e){var n="function"==typeof e.__u;n&&e.__u(),n&&null==t||(e.__u=e(t))}else e.current=t}catch(e){u_.__e(e,i)}}function J_(e,t,i){var n,s;if(u_.unmount&&u_.unmount(e),(n=e.ref)&&(n.current&&n.current!=e.__e||K_(n,null,t)),null!=(n=e.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(e){u_.__e(e,t)}n.base=n.__P=n.__n=null}if(n=e.__k)for(s=0;n.length>s;s++)n[s]&&J_(n[s],t,i||"function"!=typeof e.type);i||M_(e.__e),e.__c=e.__=e.__e=void 0}function Z_(e,t,i){return this.constructor(e,i)}function Y_(e,t,i){var n,s,r,o;t==document&&(t=document.documentElement),u_.__&&u_.__(e,t),s=(n="function"==typeof i)?null:i&&i.__k||t.__k,r=[],o=[],j_(t,e=(!n&&i||t).__k=P_(F_,null,[e]),s||C_,C_,t.namespaceURI,!n&&i?[i]:s?null:t.firstChild?c_.call(t.childNodes):null,r,!n&&i?i:s?s.__e:t.firstChild,n,o),G_(r,e,o),e.props.children=null}c_=x_.slice,u_={__e(e,t,i,n){for(var s,r,o;t=t.__;)if((s=t.__c)&&!s.__)try{if((r=s.constructor)&&null!=r.getDerivedStateFromError&&(s.setState(r.getDerivedStateFromError(e)),o=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(e,n||{}),o=s.__d),o)return s.__E=s}catch(t){e=t}throw e}},d_=0,A_.prototype.setState=function(e,t){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=T_({},this.state);"function"==typeof e&&(e=e(T_({},i),this.props)),e&&T_(i,e),null!=e&&this.__v&&(t&&this._sb.push(t),$_(this))},A_.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),$_(this))},A_.prototype.render=F_,h_=[],g_="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,__=function(e,t){return e.__v.__b-t.__v.__b},N_.__r=0,f_=Math.random().toString(8),v_="__d"+f_,m_="__a"+f_,y_=/(PointerCapture)$|Capture$/i,b_=0,S_=W_(!1),w_=W_(!0),k_=0;var X_=0;function ef(e,t,i,n,s,r){t||(t={});var o,a,l=t;if("ref"in l)for(a in l={},t)"ref"==a?o=t[a]:l[a]=t[a];var c={type:e,props:l,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--X_,__i:-1,__u:0,__source:s,__self:r};if("function"==typeof e&&(o=e.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return u_.vnode&&u_.vnode(c),c}const tf="featureFlagsCommon";function nf({client:e,config:t}){var i;if(!e||!t.uiHost)return;const n=null===(i=e.session)||void 0===i?void 0:i.sessionId;return n?`${t.uiHost}/project/${e.projectToken}/replay/${n}`:void 0}var sf,rf,of,af,lf=0,cf=[],uf=u_,df=uf.__b,hf=uf.__r,pf=uf.diffed,gf=uf.__c,_f=uf.unmount,ff=uf.__;function vf(e,t){uf.__h&&uf.__h(rf,e,lf||t),lf=0;var i=rf.__H||(rf.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function mf(e){return lf=1,function(e,t){var i=vf(sf++,2);if(i.t=e,!i.__c&&(i.__=[Mf(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=rf,!rf.__f)){var n=function(e,t,n){if(!i.__c.__H)return!0;var r=!1,o=i.__c.props!==e;if(i.__c.__H.__.some(function(e){if(e.__N){r=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),s){var a=s.call(this,e,t,n);return r?a||o:a}return!r||o};rf.__f=!0;var s=rf.shouldComponentUpdate,r=rf.componentWillUpdate;rf.componentWillUpdate=function(e,t,i){if(this.__e){var o=s;s=void 0,n(e,t,i),s=o}r&&r.call(this,e,t,i)},rf.shouldComponentUpdate=n}return i.__N||i.__}(Mf,e)}function yf(e,t){var i=vf(sf++,3);!uf.__s&&Tf(i.__H,t)&&(i.__=e,i.u=t,rf.__H.__h.push(i))}function bf(e){return lf=5,Sf(function(){return{current:e}},[])}function Sf(e,t){var i=vf(sf++,7);return Tf(i.__H,t)&&(i.__=e(),i.__H=t,i.__h=e),i.__}function wf(e){var t=rf.context[e.__c],i=vf(sf++,9);return i.c=e,t?(null==i.__&&(i.__=!0,t.sub(rf)),t.props.value):e.__}function kf(){for(var e;e=cf.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ef),t.__h.some(If),t.__h=[]}catch(i){t.__h=[],uf.__e(i,e.__v)}}}uf.__b=function(e){rf=null,df&&df(e)},uf.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ff&&ff(e,t)},uf.__r=function(e){hf&&hf(e),sf=0;var t=(rf=e.__c).__H;t&&(of===rf?(t.__h=[],rf.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.length&&kf(),sf=0)),of=rf},uf.diffed=function(e){pf&&pf(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==cf.push(t)&&af===uf.requestAnimationFrame||((af=uf.requestAnimationFrame)||xf)(kf)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),of=rf=null},uf.__c=function(e,t){t.some(function(e){try{e.__h.some(Ef),e.__h=e.__h.filter(function(e){return!e.__||If(e)})}catch(i){t.some(function(e){e.__h&&(e.__h=[])}),t=[],uf.__e(i,e.__v)}}),gf&&gf(e,t)},uf.unmount=function(e){_f&&_f(e);var t,i=e.__c;i&&i.__H&&(i.__H.__.some(function(e){try{Ef(e)}catch(e){t=e}}),i.__H=void 0,t&&uf.__e(t,i.__v))};var Cf="function"==typeof requestAnimationFrame;function xf(e){var t,i=function(){clearTimeout(n),Cf&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(i,35);Cf&&(t=requestAnimationFrame(i))}function Ef(e){var t=rf,i=e.__c;"function"==typeof i&&(e.__c=void 0,i()),rf=t}function If(e){var t=rf;e.__c=e.__(),rf=t}function Tf(e,t){return!e||e.length!==t.length||t.some(function(t,i){return t!==e[i]})}function Mf(e,t){return"function"==typeof t?t(e):t}const Pf="events",Rf="cancelEvents",Ff="tab",Af="left",Lf="center",Of="right",Df="next_to_trigger",$f="popover",Nf="widget",Bf="external_survey",qf="open",Hf="multiple_choice",zf="single_choice",Uf="rating",Wf="end",jf="always",Vf="survey shown",Gf="survey dismissed",Qf="survey sent",Kf="$survey_id",Jf="$survey_name",Zf="$survey_iteration",Yf="$survey_iteration_start_date",Xf="$survey_last_seen_date",ev="$survey_language",tv="popover",iv=Nr("[Surveys]"),nv="PostHog is not capturing, so a survey response cannot be recorded";function sv(e){return!(!e.start_date||e.end_date)}function rv(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}const ov=(e,t)=>`${e}${function(e){return e.current_iteration&&e.current_iteration>0?`${e.id}_${e.current_iteration}`:e.id}(t)}`,av=e=>ov("seenSurvey_",e),lv=e=>{try{const t=av(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){iv.error("Failed to persist survey seen state",e)}},cv=[$f,Nf,"api"],uv={ignoreConditions:!1,ignoreDelay:!1,displayType:tv};function dv(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function hv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,s,r,o,a=[],l=!0,c=!1;try{if(r=(i=i.call(e)).next,0===t);else for(;!(l=(n=r.call(i)).done)&&(a.push(n.value),a.length!==t);l=!0);}catch(e){c=!0,s=e}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(c)throw s}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return dv(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?dv(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const pv=Object.entries,gv=Object.setPrototypeOf,_v=Object.isFrozen,fv=Object.getPrototypeOf,vv=Object.getOwnPropertyDescriptor;let mv=Object.freeze,yv=Object.seal,bv=Object.create,Sv="undefined"!=typeof Reflect&&Reflect,wv=Sv.apply,kv=Sv.construct;mv||(mv=function(e){return e}),yv||(yv=function(e){return e}),wv||(wv=function(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),s=2;i>s;s++)n[s-2]=arguments[s];return e.apply(t,n)}),kv||(kv=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;t>n;n++)i[n-1]=arguments[n];return new e(...i)});const Cv=jv([].forEach),xv=jv([].lastIndexOf),Ev=jv([].pop),Iv=jv([].push),Tv=jv([].splice),Mv=Array.isArray,Pv=jv("".toLowerCase),Rv=jv("".toString),Fv=jv("".match),Av=jv("".replace),Lv=jv("".indexOf),Ov=jv("".trim),Dv=jv((0).toString),$v=jv(Boolean.prototype.toString),Nv="undefined"==typeof BigInt?null:jv(BigInt.prototype.toString),Bv="undefined"==typeof Symbol?null:jv(Symbol.prototype.toString),qv=jv({}.hasOwnProperty),Hv=jv({}.toString),zv=jv(/t/.test),Uv=(Wv=TypeError,function(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];return kv(Wv,t)});var Wv;function jv(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var i=arguments.length,n=new Array(i>1?i-1:0),s=1;i>s;s++)n[s-1]=arguments[s];return wv(e,t,n)}}function Vv(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Pv;if(gv&&gv(e,null),!Mv(t))return e;let n=t.length;for(;n--;){let s=t[n];if("string"==typeof s){const e=i(s);e!==s&&(_v(t)||(t[n]=e),s=e)}e[s]=!0}return e}function Gv(e){for(let t=0;e.length>t;t++)qv(e,t)||(e[t]=null);return e}function Qv(e){const t=bv(null);for(const n of pv(e)){var i=hv(n,2);const s=i[0],r=i[1];qv(e,s)&&(t[s]=Mv(r)?Gv(r):r&&"object"==typeof r&&r.constructor===Object?Qv(r):r)}return t}function Kv(e,t){for(;null!==e;){const i=vv(e,t);if(i){if(i.get)return jv(i.get);if("function"==typeof i.value)return jv(i.value)}e=fv(e)}return function(){return null}}const Jv=mv(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Zv=mv(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Yv=mv(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Xv=mv(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),em=mv(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),tm=mv(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),im=mv(["#text"]),nm=mv(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),sm=mv(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),rm=mv(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),om=mv(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),am=yv(/{{[\w\W]*|^[\w\W]*}}/g),lm=yv(/<%[\w\W]*|^[\w\W]*%>/g),cm=yv(/\${[\w\W]*/g),um=yv(/^data-[\-\w.\u00B7-\uFFFF]+$/),dm=yv(/^aria-[\-\w]+$/),hm=yv(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),pm=yv(/^(?:\w+script|data):/i),gm=yv(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),_m=yv(/^html$/i),fm=yv(/^[a-z][.\w]*(-[.\w]+)+$/i),vm=yv(/<[/\w!]/g),mm=yv(/<[/\w]/g),ym=yv(/<\/no(script|embed|frames)/i),bm=yv(/\/>/i),Sm=function(){return"undefined"==typeof window?null:window},wm=function(e,t,i,n){return qv(e,t)&&Mv(e[t])?Vv(n.base?Qv(n.base):{},e[t],n.transform):i};var km=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Sm();const i=t=>e(t);if(i.version="3.4.13",i.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return i.isSupported=!1,i;let n=t.document;const s=n,r=s.currentScript,o=t.HTMLTemplateElement,a=t.Node,l=t.NodeFilter,c=t.DOMParser,u=t.trustedTypes,d=t.Element.prototype,h=Kv(d,"cloneNode"),p=Kv(d,"remove"),g=Kv(d,"nextSibling"),_=Kv(d,"childNodes"),f=Kv(d,"parentNode"),v=Kv(d,"shadowRoot"),m=Kv(d,"attributes"),y=a&&a.prototype?Kv(a.prototype,"nodeType"):null,b=a&&a.prototype?Kv(a.prototype,"nodeName"):null,S=a&&a.prototype?Kv(a.prototype,"ownerDocument"):null;if("function"==typeof o){const e=n.createElement("template");e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let w,k,C="",x=!1,E=0;const I=function(){if(E>0)throw Uv('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},T=function(e){I(),E++;try{return w.createHTML(e)}finally{E--}},M=n.implementation,P=n.createNodeIterator,R=n.createDocumentFragment,F=n.getElementsByTagName,A=s.importNode;let L={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};i.isSupported="function"==typeof pv&&"function"==typeof f&&M&&void 0!==M.createHTMLDocument;const O=am,D=lm,N=cm,B=um,q=dm,H=pm,z=gm,U=fm;let W=hm,j=null;const V=Vv({},[...Jv,...Zv,...Yv,...em,...im]);let G=null;const Q=Vv({},[...nm,...sm,...rm,...om]);let K=Object.seal(bv(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),J=null,Z=null;const Y=Object.seal(bv(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let X=!0,ee=!0,te=!1,ie=!0,ne=!1,se=!0,re=!1,oe=!1,ae=null,le=null,ce=!1,ue=!1,de=!1,he=!1,pe=!0,ge=!1;const _e="user-content-";let fe=!0,ve=!1,me={},ye=null;const be=Vv({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Se=null;const we=Vv({},["audio","video","img","source","image","track"]);let ke=null;const Ce=Vv({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),xe="http://www.w3.org/1998/Math/MathML",Ee="http://www.w3.org/2000/svg",Ie="http://www.w3.org/1999/xhtml";let Te=Ie,Me=!1,Pe=null;const Re=Vv({},[xe,Ee,Ie],Rv),Fe=mv(["mi","mo","mn","ms","mtext"]);let Ae=Vv({},Fe);const Le=mv(["annotation-xml"]);let Oe=Vv({},Le);const De=Vv({},["title","style","font","a","script"]);let $e=null;const Ne=["application/xhtml+xml","text/html"];let Be=null,qe=null;const He=n.createElement("form"),ze=function(e){return e instanceof RegExp||e instanceof Function},Ue=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(qe&&qe===e)return;e&&"object"==typeof e||(e={}),e=Qv(e),$e=-1===Ne.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Be="application/xhtml+xml"===$e?Rv:Pv,j=wm(e,"ALLOWED_TAGS",V,{transform:Be}),G=wm(e,"ALLOWED_ATTR",Q,{transform:Be}),Pe=wm(e,"ALLOWED_NAMESPACES",Re,{transform:Rv}),ke=wm(e,"ADD_URI_SAFE_ATTR",Ce,{transform:Be,base:Ce}),Se=wm(e,"ADD_DATA_URI_TAGS",we,{transform:Be,base:we}),ye=wm(e,"FORBID_CONTENTS",be,{transform:Be}),J=wm(e,"FORBID_TAGS",Qv({}),{transform:Be}),Z=wm(e,"FORBID_ATTR",Qv({}),{transform:Be}),me=!!qv(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?Qv(e.USE_PROFILES):e.USE_PROFILES),X=!1!==e.ALLOW_ARIA_ATTR,ee=!1!==e.ALLOW_DATA_ATTR,te=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ie=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,ne=e.SAFE_FOR_TEMPLATES||!1,se=!1!==e.SAFE_FOR_XML,re=e.WHOLE_DOCUMENT||!1,ue=e.RETURN_DOM||!1,de=e.RETURN_DOM_FRAGMENT||!1,he=e.RETURN_TRUSTED_TYPE||!1,ce=e.FORCE_BODY||!1,pe=!1!==e.SANITIZE_DOM,ge=e.SANITIZE_NAMED_PROPS||!1,fe=!1!==e.KEEP_CONTENT,ve=e.IN_PLACE||!1,W=function(e){try{return zv(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:hm,Te="string"==typeof e.NAMESPACE?e.NAMESPACE:Ie,Ae=qv(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?Qv(e.MATHML_TEXT_INTEGRATION_POINTS):Vv({},Fe),Oe=qv(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?Qv(e.HTML_INTEGRATION_POINTS):Vv({},Le);const t=qv(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?Qv(e.CUSTOM_ELEMENT_HANDLING):bv(null);if(K=bv(null),qv(t,"tagNameCheck")&&ze(t.tagNameCheck)&&(K.tagNameCheck=t.tagNameCheck),qv(t,"attributeNameCheck")&&ze(t.attributeNameCheck)&&(K.attributeNameCheck=t.attributeNameCheck),qv(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(K.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),yv(K),ne&&(ee=!1),de&&(ue=!0),me&&(j=Vv({},im),G=bv(null),!0===me.html&&(Vv(j,Jv),Vv(G,nm)),!0===me.svg&&(Vv(j,Zv),Vv(G,sm),Vv(G,om)),!0===me.svgFilters&&(Vv(j,Yv),Vv(G,sm),Vv(G,om)),!0===me.mathMl&&(Vv(j,em),Vv(G,rm),Vv(G,om))),Y.tagCheck=null,Y.attributeCheck=null,qv(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?Y.tagCheck=e.ADD_TAGS:Mv(e.ADD_TAGS)&&(j===V&&(j=Qv(j)),Vv(j,e.ADD_TAGS,Be))),qv(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?Y.attributeCheck=e.ADD_ATTR:Mv(e.ADD_ATTR)&&(G===Q&&(G=Qv(G)),Vv(G,e.ADD_ATTR,Be))),qv(e,"ADD_URI_SAFE_ATTR")&&Mv(e.ADD_URI_SAFE_ATTR)&&Vv(ke,e.ADD_URI_SAFE_ATTR,Be),qv(e,"FORBID_CONTENTS")&&Mv(e.FORBID_CONTENTS)&&(ye===be&&(ye=Qv(ye)),Vv(ye,e.FORBID_CONTENTS,Be)),qv(e,"ADD_FORBID_CONTENTS")&&Mv(e.ADD_FORBID_CONTENTS)&&(ye===be&&(ye=Qv(ye)),Vv(ye,e.ADD_FORBID_CONTENTS,Be)),fe&&(j["#text"]=!0),re&&Vv(j,["html","head","body"]),j.table&&(Vv(j,["tbody"]),delete J.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Uv('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Uv('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=w;w=e.TRUSTED_TYPES_POLICY;try{C=T("")}catch(e){throw w=t,e}}else null===e.TRUSTED_TYPES_POLICY?(w=void 0,C=""):(void 0===w&&(x||(k=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let i=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(i=t.getAttribute(n));const s="dompurify"+(i?"#"+i:"");try{return e.createPolicy(s,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+s+" could not be created."),null}}(u,r),x=!0),w=k),w&&"string"==typeof C&&(C=T("")));mv&&mv(e),qe=e},We=Vv({},[...Zv,...Yv,...Xv]),je=Vv({},[...em,...tm]),Ve=function(e){Iv(i.removed,{element:e});try{f(e).removeChild(e)}catch(t){if(p(e),!f(e))throw Uv("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Ge=function(e){Je(e);const t=_(e);if(t){const e=[];Cv(t,t=>{Iv(e,t)}),Cv(e,e=>{try{p(e)}catch(e){}})}const i=m(e);if(i)for(let t=i.length-1;t>=0;--t){const n=i[t],s=n&&n.name;if("string"==typeof s)try{e.removeAttribute(s)}catch(e){}}},Qe=function(e,t){try{Iv(i.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Iv(i.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ue||de)try{Ve(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Ke=function(e){const t=m(e);if(t)for(let i=t.length-1;i>=0;--i){const n=t[i],s=n&&n.name;if("string"==typeof s&&!G[Be(s)])try{e.removeAttribute(s)}catch(e){}}},Je=function(e){const t=[e];for(;t.length>0;){const e=t.pop();1===(y?y(e):e.nodeType)&&Ke(e);const i=_(e);if(i)for(let e=i.length-1;e>=0;--e)t.push(i[e])}},Ze=function(e){let t=null,i=null;if(ce)e="<remove></remove>"+e;else{const t=Fv(e,/^[\r\n\t ]+/);i=t&&t[0]}"application/xhtml+xml"===$e&&Te===Ie&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const s=w?T(e):e;if(Te===Ie)try{t=(new c).parseFromString(s,$e)}catch(e){}if(!t||!t.documentElement){t=M.createDocument(Te,"template",null);try{t.documentElement.innerHTML=Me?C:s}catch(e){}}const r=t.body||t.documentElement;return e&&i&&r.insertBefore(n.createTextNode(i),r.childNodes[0]||null),Te===Ie?F.call(t,re?"html":"body")[0]:re?t.documentElement:r},Ye=function(e){const t=S?S(e):e.ownerDocument;return P.call(t||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Xe=function(e){return e=Av(e,O," "),e=Av(e,D," "),Av(e,N," ")},et=function(e){var t;e.normalize();const i=S?S(e):e.ownerDocument,n=P.call(i||e,e,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let s=n.nextNode();for(;s;)s.data=Xe(s.data),s=n.nextNode();const r=null===(t=e.querySelectorAll)||void 0===t?void 0:t.call(e,"template");r&&Cv(r,e=>{it(e.content)&&et(e.content)})},tt=function(e){const t=b?b(e):null;return"string"==typeof t&&"form"===Be(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==m(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==y(e)||e.childNodes!==_(e))},it=function(e){if(!y||"object"!=typeof e||null===e)return!1;try{return 11===y(e)}catch(e){return!1}},nt=function(e){if(!y||"object"!=typeof e||null===e)return!1;try{return"number"==typeof y(e)}catch(e){return!1}};function st(e,t,n){0!==e.length&&Cv(e,e=>{e.call(i,t,n,qe)})}const rt=function(e,t,i,n){return 0===e.length?t:t===i||t===n?Qv(t):t},ot=function(e,t){if(st(L.beforeSanitizeElements,e,null),e!==t&&null===f(e))return ve&&Je(e),!0;if(tt(e))return Ve(e),!0;const n=Be(b?b(e):e.nodeName);if(j=rt(L.uponSanitizeElement,j,V,ae),st(L.uponSanitizeElement,e,{tagName:n,allowedTags:j}),e!==t&&null===f(e))return ve&&Je(e),!0;if(function(e,t){return!!(se&&e.hasChildNodes()&&!nt(e.firstElementChild)&&zv(vm,e.textContent)&&zv(vm,e.innerHTML))||!(!se||e.namespaceURI!==Ie||"style"!==t||!nt(e.firstElementChild))||7===e.nodeType||!(!se||8!==e.nodeType||!zv(mm,e.data))}(e,n))return Ve(e),!0;if(J[n]||!(Y.tagCheck instanceof Function&&Y.tagCheck(n))&&!j[n]){const i=function(e,t,i){if(!J[t]&&ct(t)){if(K.tagNameCheck instanceof RegExp&&zv(K.tagNameCheck,t))return!1;if(K.tagNameCheck instanceof Function&&K.tagNameCheck(t))return!1}if(fe&&!ye[t]){const t=f(e),n=_(e);if(n&&t)for(let s=n.length-1;s>=0;--s){const r=e===i?h(n[s],!0):n[s];t.insertBefore(r,g(e))}}return Ve(e),!0}(e,n,t);return!1===i&&st(L.afterSanitizeElements,e,null),i}if(1===(y?y(e):e.nodeType)&&!function(e){let t=f(e);t&&t.tagName||(t={namespaceURI:Te,tagName:"template"});const i=Pv(e.tagName),n=Pv(t.tagName);return!!Pe[e.namespaceURI]&&(e.namespaceURI===Ee?function(e,t,i){return t.namespaceURI===Ie?"svg"===e:t.namespaceURI===xe?"svg"===e&&("annotation-xml"===i||Ae[i]):Boolean(We[e])}(i,t,n):e.namespaceURI===xe?function(e,t,i){return t.namespaceURI===Ie?"math"===e:t.namespaceURI===Ee?"math"===e&&Oe[i]:Boolean(je[e])}(i,t,n):e.namespaceURI===Ie?function(e,t,i){return!(t.namespaceURI===Ee&&!Oe[i])&&!(t.namespaceURI===xe&&!Ae[i])&&!je[e]&&(De[e]||!We[e])}(i,t,n):!("application/xhtml+xml"!==$e||!Pe[e.namespaceURI]))}(e))return Ve(e),!0;if(("noscript"===n||"noembed"===n||"noframes"===n)&&zv(ym,e.innerHTML))return Ve(e),!0;if(ne&&3===e.nodeType){const t=Xe(e.textContent);e.textContent!==t&&(Iv(i.removed,{element:e.cloneNode()}),e.textContent=t)}return st(L.afterSanitizeElements,e,null),!1},at=function(e,t,i){if(Z[t])return!1;if(se&&"patchsrc"===t)return!1;if(se&&"for"===t&&"label"!==e&&"output"!==e)return!1;if(pe&&("id"===t||"name"===t)&&(i in n||i in He))return!1;const s=G[t]||Y.attributeCheck instanceof Function&&Y.attributeCheck(t,e);if(ee&&zv(B,t));else if(X&&zv(q,t));else if(s){if(ke[t]);else if(zv(W,Av(i,z,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Lv(i,"data:")||!Se[e])if(te&&!zv(H,Av(i,z,"")));else if(i)return!1}else if(!(ct(e)&&(K.tagNameCheck instanceof RegExp&&zv(K.tagNameCheck,e)||K.tagNameCheck instanceof Function&&K.tagNameCheck(e))&&(K.attributeNameCheck instanceof RegExp&&zv(K.attributeNameCheck,t)||K.attributeNameCheck instanceof Function&&K.attributeNameCheck(t,e))||"is"===t&&K.allowCustomizedBuiltInElements&&(K.tagNameCheck instanceof RegExp&&zv(K.tagNameCheck,i)||K.tagNameCheck instanceof Function&&K.tagNameCheck(i))))return!1;return!0},lt=Vv({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ct=function(e){return!lt[Pv(e)]&&zv(U,e)},ut=function(e,t,i,n){if(w&&"object"==typeof u&&"function"==typeof u.getAttributeType&&!i)switch(u.getAttributeType(e,t)){case"TrustedHTML":return T(n);case"TrustedScriptURL":return function(e){I(),E++;try{return w.createScriptURL(e)}finally{E--}}(n)}return n},dt=function(e,t,n,s){try{n?e.setAttributeNS(n,t,s):e.setAttribute(t,s),tt(e)?Ve(e):Ev(i.removed)}catch(i){Qe(t,e)}},ht=function(e){st(L.beforeSanitizeAttributes,e,null);const t=e.attributes;if(!t||tt(e))return;G=rt(L.uponSanitizeAttribute,G,Q,le);const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:G,forceKeepAttr:void 0};let n=t.length;const s=Be(e.nodeName);for(;n--;){const r=t[n],o=r.name,a=r.namespaceURI,l=r.value,c=Be(o),u=l;let d="value"===o?u:Ov(u);i.attrName=c,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,st(L.uponSanitizeAttribute,e,i),d=i.attrValue,!ge||"id"!==c&&"name"!==c||0===Lv(d,_e)||(Qe(o,e),d=_e+d),se&&zv(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)||"attributename"===c&&Fv(d,"href")?Qe(o,e):i.forceKeepAttr||(!i.keepAttr||!ie&&zv(bm,d)?Qe(o,e):(ne&&(d=Xe(d)),at(s,c,d)?(d=ut(s,c,a,d),d!==u&&dt(e,o,a,d)):Qe(o,e)))}st(L.afterSanitizeAttributes,e,null)},pt=function(e){let t=null;const i=Ye(e);for(st(L.beforeSanitizeShadowDOM,e,null);t=i.nextNode();)if(st(L.uponSanitizeShadowNode,t,null),ot(t,e),ht(t),it(t.content)&&pt(t.content),1===(y?y(t):t.nodeType)){const e=v(t);it(e)&&(gt(e),pt(e))}st(L.afterSanitizeShadowDOM,e,null)},gt=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){pt(e.shadow);continue}const i=e.node,n=1===(y?y(i):i.nodeType),s=_(i);if(s)for(let e=s.length-1;e>=0;--e)t.push({node:s[e],shadow:null});if(n){const e=b?b(i):null;if("string"==typeof e&&"template"===Be(e)){const e=i.content;it(e)&&t.push({node:e,shadow:null})}}if(n){const e=v(i);it(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return i.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=null,o=null,a=null;if(Me=!e,Me&&(e="\x3c!--\x3e"),"string"!=typeof e&&!nt(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return Dv(e);case"boolean":return $v(e);case"bigint":return Nv?Nv(e):"0";case"symbol":return Bv?Bv(e):"Symbol()";case"undefined":default:return Hv(e);case"function":case"object":{if(null===e)return Hv(e);const t=e,i=Kv(t,"toString");if("function"==typeof i){const e=i(t);return"string"==typeof e?e:Hv(e)}return Hv(e)}}}(e)))throw Uv("dirty is not a string, aborting");if(!i.isSupported)return e;oe?(j=ae,G=le):Ue(t),(L.uponSanitizeElement.length>0||L.uponSanitizeAttribute.length>0)&&(j=Qv(j)),L.uponSanitizeAttribute.length>0&&(G=Qv(G)),i.removed=[];const l=ve&&"string"!=typeof e&&nt(e);if(l){!function(e){if(!se)return;const t=[e];for(;t.length>0;){const e=t.pop(),i=y?y(e):e.nodeType;if(7===i||8===i&&zv(mm,e.data)){try{p(e)}catch(e){}continue}if(1===i){const t=e,i=Be(b?b(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute("patchsrc")&&t.removeAttribute("patchsrc"),t.hasAttribute&&t.hasAttribute("for")&&"label"!==i&&"output"!==i&&t.removeAttribute("for")}catch(e){}}const n=_(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}}(e);const t=b?b(e):e.nodeName;if("string"==typeof t){const i=Be(t);if(!j[i]||J[i])throw Ge(e),Uv("root node is forbidden and cannot be sanitized in-place")}if(tt(e))throw Ge(e),Uv("root node is clobbered and cannot be sanitized in-place");try{gt(e)}catch(t){throw Ge(e),t}}else if(nt(e))n=Ze("\x3c!----\x3e"),r=n.ownerDocument.importNode(e,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?n=r:n.appendChild(r),gt(r);else{if(!ue&&!ne&&!re&&-1===e.indexOf("<"))return w&&he?T(e):e;if(n=Ze(e),!n)return ue?null:he?C:""}n&&ce&&Ve(n.firstChild);const c=l?e:n;try{const e=Ye(c);for(;o=e.nextNode();)ot(o,c),ht(o),it(o.content)&&pt(o.content)}catch(t){throw l&&(Ge(e),Cv(i.removed,e=>{e.element&&Je(e.element)})),t}if(l)return Cv(i.removed,e=>{e.element&&Je(e.element)}),ne&&et(e),e;if(ue){if(ne&&et(n),de)for(a=R.call(n.ownerDocument);n.firstChild;)a.appendChild(n.firstChild);else a=n;return(G.shadowroot||G.shadowrootmode)&&(a=A.call(s,a,!0)),a}let u=re?n.outerHTML:n.innerHTML;return re&&j["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&zv(_m,n.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+u),ne&&(u=Xe(u)),w&&he?T(u):u},i.setConfig=function(){Ue(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),oe=!0,ae=j,le=G},i.clearConfig=function(){qe=null,oe=!1,ae=null,le=null,w=k,C=""},i.isValidAttribute=function(e,t,i){qe||Ue({});const n=Be(e),s=Be(t);return at(n,s,i)},i.addHook=function(e,t){"function"==typeof t&&qv(L,e)&&Iv(L[e],t)},i.removeHook=function(e,t){if(qv(L,e)){if(void 0!==t){const i=xv(L[e],t);return-1===i?void 0:Tv(L[e],i,1)[0]}return Ev(L[e])}},i.removeHooks=function(e){qv(L,e)&&(L[e]=[])},i.removeAllHooks=function(){L={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},i}();const Cm=["a","abbr","acronym","area","article","aside","b","bdi","bdo","blockquote","br","caption","center","cite","code","col","colgroup","data","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","footer","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","img","ins","kbd","li","map","mark","nav","ol","p","pre","q","rp","rt","rtc","ruby","s","samp","small","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","time","tr","tt","u","ul","var","wbr"],xm=["style","lang","title","width","height"],Em=["abbr","align","axis","bgcolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"],Im={a:["href","hreflang","target","rel"],bdo:["dir"],blockquote:["cite"],col:["align","char","charoff","span"],colgroup:["align","char","charoff","span"],del:["cite","datetime"],hr:["align","size","width"],img:["align","alt","height","src","width"],ins:["cite","datetime"],ol:["start","type"],q:["cite"],table:["align","bgcolor","border","cellpadding","cellspacing","frame","rules","summary","width"],tbody:["align","char","charoff","valign"],td:Em,tfoot:["align","char","charoff","valign"],th:Em,thead:["align","char","charoff","valign"],tr:["align","bgcolor","char","charoff","valign"]};let Tm;function Mm(e){var t;const i=(null!==(t=Tm)&&void 0!==t?t:Tm=km()).sanitize(e,{ALLOWED_TAGS:Cm,ALLOWED_ATTR:[],ALLOW_ARIA_ATTR:!1,ALLOW_DATA_ATTR:!1,ALLOWED_NAMESPACES:["http://www.w3.org/1999/xhtml"],ADD_ATTR:(e,t)=>-1!==xm.indexOf(e)||{}.hasOwnProperty.call(Im,t)&&-1!==(Im[t]||[]).indexOf(e),RETURN_DOM_FRAGMENT:!0}),n=i.querySelectorAll("a");for(let e=0;n.length>e;e++)n.item(e).relList.add("noopener");const s=document.createElement("div");return s.appendChild(i),s.innerHTML}const Pm=Nr("[Stylesheet Loader]"),Rm="#020617",Fm={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:Of,widgetType:Ff,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,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:Rm,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},Am=[Lf,Af,Of];function Lm(e){if(e.startsWith("#")){let t=e.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(t)&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),/^[0-9A-Fa-f]{6}$/.test(t)?`rgb(${parseInt(t.slice(0,2),16)},${parseInt(t.slice(2,4),16)},${parseInt(t.slice(4,6),16)})`:"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function Om(e=Fm.backgroundColor){let t;"#"===e[0]&&(t=Lm(e)),e.startsWith("rgb")&&(t=e);const i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[e.toLowerCase()];if(i&&(t=Lm(i)),!t)return Rm;const n=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(n){const e=parseInt(n[1]),t=parseInt(n[2]),i=parseInt(n[3]);return Math.sqrt(e*e*.299+t*t*.587+i*i*.114)>127.5?Rm:"white"}return Rm}const Dm=(e,t,i)=>{const n=ty(e),s=document.querySelector(`.${n}`);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};const r=document.createElement("div");((e,t,i)=>{const n=ct(ct({},Fm),i),s=e.style,r=!Am.includes(n.position)||t===Nf&&(null==i?void 0:i.widgetType)===Ff;s.setProperty("--ph-survey-font-family",function(e){if("inherit"===e)return"inherit";const t='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return e?`${e}, ${t}`:`-apple-system, ${t}`}(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)||Om(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",Om(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||Om(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",Om(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)||Om(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,e.type,e.appearance),r.className=n;const o=r.attachShadow({mode:"open"}),a=function(e){const t=((e,t,i)=>{let n=e.createElement("style");n.innerText=t;const s=(e=>{var t;return Ct(e)?e:null==e||null===(t=e.config)||void 0===t?void 0:t.prepare_external_dependency_stylesheet})(i);return s&&(n=s(n)),n||(Pm.error("prepare_external_dependency_stylesheet returned null"),null)})(document,':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)}}',null==e?void 0:e.config.prepareStylesheet);return null==t||t.setAttribute("data-ph-survey-style","true"),t}(t);if(a){const e=o.querySelector("style");e&&o.removeChild(e),o.appendChild(a)}return(i||document.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},$m=e=>{try{const t=av(e);localStorage.getItem(t)||localStorage.setItem(t,"true")}catch(e){iv.error("Failed to persist survey seen state",e)}},Nm=({responses:e,survey:t,surveySubmissionId:i,posthog:n,isSurveyCompleted:s,properties:r,surveyLanguage:o,questionSnapshots:a})=>{var l,c,u;n?(null===(l=n.client)||void 0===l?void 0:l.canCapture)&&($m(t),s&&ey(t),null===(c=n.client)||void 0===c||c.capture(Qf,ct(ct(ct({[Jf]:t.name,[Kf]:t.id,[Zf]:t.current_iteration,[Yf]:t.current_iteration_start_date,sessionRecordingUrl:nf(n)},tc(ct(ct({event:"sent",survey:t,responses:e,submissionId:i,completed:s},!It(o)&&{surveyLanguage:o}),!It(a)&&{questionSnapshots:a}))),r),{},{$set:{[nc(t,"responded")]:!0}})),s&&(window.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:t.id}})),null===(u=n.client)||void 0===u||null===(u=u.getExtension("featureFlagsCommon"))||void 0===u||u.reloadFeatureFlags())):iv.error("[survey sent] event not captured, PostHog instance not found.")},Bm=(e,t,i,n)=>ct({[Jf]:t.name,[Kf]:t.id,[Zf]:t.current_iteration,[Yf]:t.current_iteration_start_date,sessionRecordingUrl:nf(n)},tc(ct(ct(ct(ct({event:e,survey:t},!It(null==i?void 0:i.responses)&&{responses:i.responses}),!It(null==i?void 0:i.surveySubmissionId)&&{submissionId:i.surveySubmissionId}),!It(null==i?void 0:i.surveyLanguage)&&{surveyLanguage:i.surveyLanguage}),!It(null==i?void 0:i.questionSnapshots)&&{questionSnapshots:i.questionSnapshots}))),qm=(e,t,i,n)=>{var s;if(!t)return void iv.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const r=Ym(e),o=r?r.surveyLanguage:n,a=ct(ct(ct({},Bm("dismissed",e,r,t)),o&&{[ev]:o}),{},{$set:{[nc(e,"dismissed")]:!0}});ey(e),$m(e),null===(s=t.client)||void 0===s||s.capture(Gf,a),window.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))},Hm=(e,t)=>{var i,n;if(!t)return void iv.error("[survey abandoned] event not captured, PostHog instance not found.");if(!(null===(i=t.client)||void 0===i?void 0:i.canCapture))return;const s=(e=>ov("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(s))return}catch(e){return}const r=Ym(e);if(r){try{localStorage.setItem(s,"true")}catch(e){}null===(n=t.client)||void 0===n||n.capture("survey abandoned",Bm("abandoned",e,r,t),{delivery:"unload"})}},zm=e=>{const t=e.map(e=>e.id);return t.every(e=>!!e)?t:void 0},Um=(e,t)=>{var i,n,s;return(e=>e.questions.some(e=>{var t;return!!(null===(t=e.branching)||void 0===t?void 0:t.type)}))(e)?e.questions:t?null!==(i=((e,t)=>{if(!t||t.length!==e.questions.length)return null;const i=new Map(e.questions.map(e=>[e.id,e])),n=[];for(const e of t){const t=i.get(e);if(!t)return null;n.push(t)}return n})(e,t.questionOrder))&&void 0!==i?i:e.questions:e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?(n=e.questions,s=_c(e.questions),n.length===s.length&&n.every((e,t)=>e===s[t])?s.reverse():s):e.questions},Wm=e=>uc(e)||Xm(e),jm=function(e){function t(e){var i,n;return this.getChildContext||(i=new Set,(n={})[t.__c]=this,this.getChildContext=function(){return n},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&i.forEach(function(e){e.__e=!0,$_(e)})},this.sub=function(e){i.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){i&&i.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+k_++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),Vm=()=>wf(jm),Gm=({component:e,children:t,renderAsHtml:i,style:n})=>function(e,t,i){var n,s,r,o,a=T_({},e.props);for(r in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)"key"==r?n=t[r]:"ref"==r?s=t[r]:a[r]=void 0===t[r]&&null!=o?o[r]:t[r];return arguments.length>2&&(a.children=arguments.length>3?c_.call(arguments,2):i),R_(e.type,a,n||e.key,s||e.ref,null)}(e,i?{dangerouslySetInnerHTML:{__html:Mm(t)},style:n}:{children:t,style:n});function Qm(e,t){var i,n,s;if(!(null===(i=e.conditions)||void 0===i?void 0:i.url))return!0;const r=null!==(n=ao(t))&&void 0!==n?n:"u">typeof window?window.location.href:void 0;if(!r)return!1;const o=[e.conditions.url],a=function(e){return null!=e?e:"icontains"}(null===(s=e.conditions)||void 0===s?void 0:s.urlMatchType);return pc[a](o,[r])}const Km=e=>ov("inProgressSurvey_",e),Jm={},Zm=(e,t)=>{const i=Km(e);try{localStorage.setItem(i,JSON.stringify(t)),delete Jm[i]}catch(e){iv.error("Error setting in-progress survey state in localStorage",e),Jm[i]=t}},Ym=e=>{const t=Km(e),i=Jm[t];if(i)return i;try{const e=localStorage.getItem(t);if(e)return JSON.parse(e)}catch(e){iv.error("Error getting in-progress survey state from localStorage",e)}return null},Xm=e=>{const t=Ym(e);return!Rt(null==t?void 0:t.surveySubmissionId)},ey=e=>{const t=Km(e);delete Jm[t];try{localStorage.removeItem(t)}catch(e){iv.error("Error clearing in-progress survey state from localStorage",e)}};function ty(e,t=!1){const i=`PostHogSurvey-${e.id}`;return t?`.${i}`:i}function iy(e,t=Of,i){if(e===Bf)return{};switch(t){case"top_left":return{top:"0",left:"0",transform:"translate(30px, 30px)"};case"top_right":return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case"top_center":return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case"middle_left":return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case"middle_right":return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case"middle_center":return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case Af:return{left:"30px"};case Lf:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===Nf&&i===Ff?"60px":"30px"}}}const ny=ef("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ef("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"})}),sy=ef("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ef("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"})}),ry=ef("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ef("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"})}),oy=ef("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ef("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"})}),ay=ef("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ef("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"})}),ly=ef("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:ef("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"})}),cy=ef("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:ef("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"})}),uy=({fill:e="currentColor"}={})=>ef("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:e,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[ef("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),ef("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:e})]}),dy=ef("svg",{width:"80",height:"14",viewBox:"0 0 160 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ef("g",{"clip-path":"url(#ph-survey-logo-clip)",children:[ef("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"}),ef("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"}),ef("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"}),ef("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"})]}),ef("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"}),ef("defs",{children:ef("clipPath",{id:"ph-survey-logo-clip",children:ef("path",{fill:"#fff",d:"M0 0h51.67v28H0z"})})})]});function hy({urlParams:e}){const t=e?Object.entries(e).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&"):"";return ef("a",{href:"https://posthog.com/surveys"+(t?`?${t}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",dy]})}function py({text:e,submitDisabled:t,appearance:i,onSubmit:n,link:s,onPreviewSubmit:r,skipSubmitButton:o,canGoBack:a,onBack:l}){const{isPreviewMode:c}=wf(jm),u=!!a&&!!l,d=!o&&ef("button",{className:"form-submit",disabled:t,"aria-label":"Submit survey",type:"button",onClick(){var e;s&&(null===(e=window)||void 0===e||e.open(s)),c?null==r||r():n()},children:e});return ef("div",{className:"bottom-section",children:[u?ef("div",{className:"form-buttons form-buttons-with-back",children:[ef("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:l,children:i.backButtonText||"Back"}),d]}):d,!i.whiteLabel&&ef(hy,{urlParams:{utm_source:"survey-footer"}})]})}function gy({question:e,forceDisableHtml:t,htmlFor:i}){return ef("div",{class:e.question||e.description?"question-header":"question-header question-header--empty",children:[ef(e.type===qf?"label":"h3",{className:"survey-question",htmlFor:i,children:e.question}),e.description&&Gm({component:P_("p",{className:"survey-question-description"}),children:e.description,renderAsHtml:!t&&"text"!==e.descriptionContentType})]})}function _y({onClick:e}){const{isPreviewMode:t}=wf(jm);return ef("button",{className:"form-cancel",onClick:e,disabled:t,"aria-label":"Close survey",type:"button",children:uy({fill:"black"})})}function fy({header:e,description:t,contentType:i,forceDisableHtml:n,appearance:s,onClose:r}){const{isPopup:o}=wf(jm);return yf(()=>{const e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),r())};return Qr(window,"keydown",e),()=>{window.removeEventListener("keydown",e)}},[r]),ef("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&ef(_y,{onClick:()=>r()}),ef("h3",{className:"thank-you-message-header",children:e}),t&&Gm({component:P_("p",{className:"thank-you-message-body"}),children:t,renderAsHtml:!n&&"text"!==i}),o&&ef(py,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>r()})]})}function vy({header:e,description:t,contentType:i,forceDisableHtml:n,appearance:s,onStart:r}){const{isPopup:o,onPreviewSubmit:a,onPopupSurveyDismissed:l}=wf(jm);return ef("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&ef(_y,{onClick:()=>l()}),e&&ef("h3",{className:"intro-screen-header",children:e}),t&&Gm({component:P_("p",{className:"intro-screen-body"}),children:t,renderAsHtml:!n&&"text"!==i}),ef(py,{text:s.introScreenButtonText||"Get started",submitDisabled:!1,appearance:s,onSubmit:r,onPreviewSubmit:()=>a(null)})]})}const my=e=>kt(e)&&e.every(e=>Tt(e));function yy({question:e,forceDisableHtml:t,appearance:i,onSubmit:n,onPreviewSubmit:s,displayQuestionIndex:r,initialValue:o,canGoBack:a,onBack:l}){const{isPreviewMode:c}=Vm(),u=bf(null),[d,h]=mf(()=>Tt(o)?o:""),p=null==i?void 0:i.disableAutofocus;yf(()=>{p||setTimeout(()=>{var e;c||null===(e=u.current)||void 0===e||e.focus()},100)},[c,p]);const g=`surveyQuestion${r}`,_=Sf(()=>function(e,t,i){const n=e.trim();if(!i&&""===n)return"This field is required";if(""===n)return!1;if(t&&t.length>0)for(const e of t)switch(e.type){case ht:var s;if(void 0!==e.value&&e.value>n.length)return null!==(s=e.errorMessage)&&void 0!==s?s:`Please enter at least ${e.value} characters`;break;case pt:var r;if(void 0!==e.value&&n.length>e.value)return null!==(r=e.errorMessage)&&void 0!==r?r:`Please enter no more than ${e.value} characters`}return!1}(d,e.validation,e.optional),[d,e.validation,e.optional]),f=Ar(e.validation,ht),v=Ar(e.validation,pt),m=Sf(()=>function(e,t){const i=1===e?void 0:e;return i&&t?`Enter ${i}-${t} characters`:i?`Enter at least ${i} ${1===i?"character":"characters"}`:t?`Maximum ${t} ${1===t?"character":"characters"}`:void 0}(f,v),[f,v]),y=()=>{_||n(d.trim())},b=()=>{_||s(d.trim())};return ef(F_,{children:[ef("div",{className:"question-container",children:[ef(gy,{question:e,forceDisableHtml:t,htmlFor:g}),ef("textarea",{ref:u,id:g,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:f,maxLength:v,onInput(e){h(e.currentTarget.value),e.stopPropagation()},onKeyDown(e){e.stopPropagation(),"Enter"!==e.key||!e.metaKey&&!e.ctrlKey||_||(e.preventDefault(),c?b():y())},value:d}),m&&ef("div",{className:"validation-hint",children:m})]}),ef(py,{text:e.buttonText||"Submit",submitDisabled:!!_,appearance:i,onSubmit:y,onPreviewSubmit:b,canGoBack:a,onBack:l})]})}function by({question:e,forceDisableHtml:t,appearance:i,onSubmit:n,onPreviewSubmit:s,canGoBack:r,onBack:o}){return ef(F_,{children:[ef("div",{className:"question-container",children:ef(gy,{question:e,forceDisableHtml:t})}),ef(py,{text:e.buttonText||"Submit",submitDisabled:!1,link:e.link,appearance:i,onSubmit:()=>n("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:r,onBack:o})]})}function Sy({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){var c;const u=e.scale,d=10===e.scale?0:1,[h,p]=mf(()=>Ft(o)?o:kt(o)&&o.length>0&&Ft(parseInt(o[0]))?parseInt(o[0]):Tt(o)&&Ft(parseInt(o))?parseInt(o):null),g="emoji"===e.display&&2===e.scale,{isPreviewMode:_}=Vm(),f=e=>_?r(e):s(e);return ef(F_,{children:[ef("div",{className:"question-container",children:[ef(gy,{question:e,forceDisableHtml:t}),ef("div",{className:"rating-section",children:[ef("div",{className:"rating-options",children:["emoji"===e.display&&ef("div",{className:"rating-options-emoji"+(g?" rating-options-emoji-2":""),children:null===(c=Iy[e.scale])||void 0===c?void 0:c.map((t,n)=>ef("button",{"aria-label":`Rate ${n+1}`,className:`ratings-emoji question-${i}-rating-${n} ${n+1===h?"rating-active":""}`,value:n+1,type:"button",onClick(){const t=n+1;p(t),e.skipSubmitButton&&f(t)},children:t},n))}),"number"===e.display&&ef("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${u-d+1}, minmax(0, 1fr))`},children:Ty(e.scale).map((t,s)=>ef(wy,{displayQuestionIndex:i,active:h===t,appearance:n,num:t,setActiveNumber(t){p(t),e.skipSubmitButton&&f(t)}},s))})]}),!g&&ef("div",{className:"rating-text",children:[ef("div",{children:e.lowerBoundLabel}),ef("div",{children:e.upperBoundLabel})]})]})]}),ef(py,{text:e.buttonText||(null==n?void 0:n.submitButtonText)||"Submit",submitDisabled:Pt(h)&&!e.optional,appearance:n,onSubmit:()=>s(h),onPreviewSubmit:()=>r(h),skipSubmitButton:e.skipSubmitButton,canGoBack:a,onBack:l})]})}function wy({num:e,active:t,displayQuestionIndex:i,setActiveNumber:n}){return ef("button",{"aria-label":`Rate ${e}`,className:`ratings-number question-${i}-rating-${e} ${t?"rating-active":""}`,type:"button",onClick(){n(e)},children:e})}function ky({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){const c=bf(null),u=Sf(()=>(e=>{var t;if(!e.shuffleOptions)return e.choices;const i=[...e.choices],n=e.hasOpenChoice&&null!==(t=i.pop())&&void 0!==t?t:null,s=(r=i,(o=_c(i)).length>1&&r.every((e,t)=>e===o[t])?o.reverse():o);var r,o;return Pt(n)||s.push(n),s})(e),[e]),[d,h]=mf(()=>((e,t)=>Tt(e)||my(e)?e:t===zf?null:[])(o,e.type)),[p,g]=mf(()=>((e,t)=>{if(Tt(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(my(e)){const i=e.find(e=>!t.includes(e));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,u)),{isPreviewMode:_}=Vm(),f=e.type===zf,v=e.type===Hf,m=e.skipSubmitButton&&f&&!e.hasOpenChoice,y=(e,t)=>{if(t){const e=!p.isSelected;return g(t=>ct(ct({},t),{},{isSelected:e,inputValue:e?t.inputValue:""})),f&&h(""),void(e&&setTimeout(()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.focus()},75))}if(f)return h(e),g(e=>ct(ct({},e),{},{isSelected:!1,inputValue:""})),void(m&&(s(e),_&&r(e)));v&&kt(d)&&(d.includes(e)?h(d.filter(t=>t!==e)):h([...d,e]))},b=e=>{e.stopPropagation();const t=e.currentTarget.value;g(e=>ct(ct({},e),{},{inputValue:t})),f&&h(t)},S=e=>{e.stopPropagation(),"Enter"!==e.key||w()||(e.preventDefault(),k()),"Escape"===e.key&&(e.preventDefault(),g(e=>ct(ct({},e),{},{isSelected:!1,inputValue:""})),f&&h(null))},w=()=>!(e.optional||!Pt(d)&&(!kt(d)||p.isSelected||0!==d.length)&&(!p.isSelected||""!==p.inputValue.trim())),k=()=>{p.isSelected&&v?kt(d)&&(_?r([...d,p.inputValue]):s([...d,p.inputValue])):_?r(d):s(d)};return ef(F_,{children:[ef("div",{className:"question-container",children:[ef(gy,{question:e,forceDisableHtml:t}),ef("fieldset",{className:"multiple-choice-options limit-height",children:[ef("legend",{className:"sr-only",children:v?" Select all that apply":" Select one"}),u.map((t,n)=>{const s=!!e.hasOpenChoice&&n===e.choices.length-1,r=`surveyQuestion${i}Choice${n}`,o=`${r}Open`,a=s?p.isSelected:f?d===t:kt(d)&&d.includes(t);return ef("label",{className:s?"choice-option-open":"",children:[ef("div",{className:"response-choice",children:[ef("input",{type:f?"radio":"checkbox",name:r,checked:a,onChange:()=>y(t,s),id:r,"aria-controls":o}),ef("span",{children:s?`${t}:`:t})]}),s&&ef("input",{type:"text",ref:c,id:o,name:`question${i}Open`,value:p.inputValue,onKeyDown:S,onInput:b,onClick(e){p.isSelected||y(t,!0),e.stopPropagation()},"aria-label":`${t} - please specify`})]},n)})]})]}),ef(py,{text:e.buttonText||"Submit",submitDisabled:w(),appearance:n,onSubmit:k,onPreviewSubmit:k,skipSubmitButton:m,canGoBack:a,onBack:l})]})}const Cy=[1,2,3,4,5],xy=[1,2,3,4,5,6,7],Ey=[0,1,2,3,4,5,6,7,8,9,10],Iy={2:[ly,cy],3:[ry,sy,ny],5:[oy,ry,sy,ny,ay]};function Ty(e){switch(e){case 5:default:return Cy;case 7:return xy;case 10:return Ey}}const My=Nr("[Surveys]");function Py(e,t,i){var n;const s=e.questions[t],r=t+1;if(!(null===(n=s.branching)||void 0===n?void 0:n.type))return t===e.questions.length-1?Wf:r;if(s.branching.type===Wf)return Wf;if("specific_question"===s.branching.type){if(Number.isInteger(s.branching.index))return s.branching.index}else if("response_based"===s.branching.type){if(s.type===zf){var o;let e=s.choices.indexOf(`${i}`);if(-1===e&&s.hasOpenChoice&&(e=s.choices.length-1),null===(o=s.branching)||void 0===o||null===(o=o.responseValues)||void 0===o?void 0:o.hasOwnProperty(e)){const t=s.branching.responseValues[e];if(Number.isInteger(t))return t;if(t===Wf)return Wf}}else if(s.type===Uf){var a;if(s.optional&&Rt(i))return r===e.questions.length?Wf:r;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const t=function(e,t){if(2===t){if(1>e||e>2)throw new Error("The response must be in range 1-2");return 1===e?"positive":"negative"}if(3===t){if(1>e||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(1>e||e>5)throw new Error("The response must be in range 1-5");return e>2?3===e?"neutral":"positive":"negative"}if(7===t){if(1>e||e>7)throw new Error("The response must be in range 1-7");return e>3?4===e?"neutral":"positive":"negative"}if(10===t){if(0>e||e>10)throw new Error("The response must be in range 0-10");return e>6?e>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(i,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];if(Number.isInteger(e))return e;if(e===Wf)return Wf}}return r}return My.warn("Falling back to next question index due to unexpected branching type"),r}const Ry=Nr("[SurveyTranslations]");function Fy(e,t){const i=function(e){var t;return function({overrideLanguage:e,storedPersonProperties:t,locale:i},n){const s=sc(e);if(s)return null==n||n.info(`Using override display language: ${s}`),s;const r=function(e){return e&&"object"==typeof e&&"language"in e?sc(e.language):null}(t);if(r)return null==n||n.info(`Using person property language: ${r}`),r;const o=sc(i);return o?(null==n||n.info(`Using detected locale: ${o}`),o):(null==n||n.info("No user language detected"),null)}({overrideLanguage:e.config.overrideLanguage,storedPersonProperties:null===(t=e.client)||void 0===t?void 0:t.kv.get(S),locale:"u">typeof navigator?navigator.language||navigator.userLanguage:void 0},Ry)}(t);if(!i)return Ry.info("No user language detected"),{survey:e,language:null};const n=lc(e,i,Ry);return{survey:n.survey,language:n.matchedKey}}const Ay="ph:show_survey_widget",Ly="PHWidgetSurveyClickListener";function Oy(e,t){try{const i=e.getBoundingClientRect(),n=window.innerHeight,s=window.innerWidth;let r=i.left+i.width/2-t/2;r+t>s-20&&(r=s-t-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:Fm.zIndex}}catch(e){return iv.warn("Failed to calculate trigger position:",e),null}}var Dy=class{constructor(e){var t,i;this._surveyTimeouts=new Map,this._widgetSelectorListeners=new Map,this._renderedTabWidgets=new Map,this._renderedTargets=new Map,this._prefillHandledSurveys=new Set,this._disposed=!1,this._currentLanguage=null,this._surveyIsRendered=!1,this._languageChangeListener=null,this._unsubscribeFeatureFlags=null,this._surveyPopupProps=null,this._loggedFeatureFlagsDisabledWarning=!1,this.handlePageUnload=()=>{var e;const t=null===(e=this._host.client)||void 0===e?void 0:e.kv.get(M);if(t)for(const e of t)Xm(e)&&Hm(e,this._host)},this.handlePopoverSurvey=(e,t,{resumeDelayFromActivation:i=!1}={})=>{var n,s,r,o,a,l,c;if(!(null===(n=this._host.client)||void 0===n?void 0:n.canCapture))return;const{survey:u,language:d}=this._translateSurveyForRendering(e);this._currentLanguage=d,this._surveyPopupProps=null,this._displayOptions=t;const h=this._applyDisplayOverrides(u,t);this._clearSurveyTimeout(h.id);const{properties:p,initialResponses:g}=null!=t?t:{},_=!(!g||0>=Object.keys(g).length)&&this._handleInitialResponses(h,g,p,d);if(_&&!(null===(s=h.appearance)||void 0===s?void 0:s.displayThankYouMessage))return;this._addSurveyToFocus(h);let f={};if((null===(r=h.appearance)||void 0===r?void 0:r.position)===Df&&(null===(o=h.appearance)||void 0===o?void 0:o.widgetSelector)){var v;const e=document.querySelector(h.appearance.widgetSelector);e&&(f=Oy(e,parseInt((null===(v=h.appearance)||void 0===v?void 0:v.maxWidth)||Fm.maxWidth))||{})}const m=(null===(a=h.appearance)||void 0===a?void 0:a.surveyPopupDelaySeconds)||0,{shadow:y}=Dm(h,this._host);this._renderedTargets.set(y,y.host);const b={posthog:this._host,survey:h,removeSurveyFromFocus:this._removeSurveyFromFocus,properties:p,style:f,isSurveyCompleted:_,skipShownEvent:null==t?void 0:t.skipShownEvent,surveyLanguage:d};if(this._surveyPopupProps=b,0>=m)return this._surveyIsRendered=!0,Y_(ef(qy,ct({},b)),y);const S=()=>{this._surveyIsRendered=!0;const{survey:i,language:n}=this._translateSurveyForRendering(e);this._currentLanguage=n;const s=this._applyDisplayOverrides(i,t),r=ct(ct({},b),{},{survey:s,surveyLanguage:n});this._surveyPopupProps=r,Y_(ef(qy,ct(ct({},r),{},{survey:ct(ct({},s),{},{appearance:ct(ct({},s.appearance),{},{surveyPopupDelaySeconds:0})})})),y)},w=()=>{var e;if(!(null===(e=this._host.client)||void 0===e?void 0:e.canCapture)||!this._shouldDisplaySurvey(h))return iv.info(`Survey ${h.id} no longer eligible when its display delay elapsed; not displaying`),this._removeSurveyFromFocus(h);S()},k=i?null===(l=this._host.surveys)||void 0===l||null===(l=l._surveyEventReceiver)||void 0===l||null===(c=l.getActivationTimestamp)||void 0===c?void 0:c.call(l,h.id):void 0,C=Ft(k)?Math.max(0,Date.now()-k):0,x=Math.max(0,1e3*m-C);if(0>=x)return w();const E=window.setTimeout(()=>{this._surveyTimeouts.delete(h.id),w()},x);this._surveyTimeouts.set(h.id,E)},this._handleWidget=e=>{var t;const{survey:i,language:n}=this._translateSurveyForRendering(e),{shadow:s,isNewlyCreated:r}=Dm(i,this._host);this._renderedTargets.set(s,s.host),(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)===Ff&&this._renderedTabWidgets.set(e.id,e),r&&Y_(ef(zy,{posthog:this._host,survey:i,surveyLanguage:n},e.id),s)},this._detachWidgetSelectorListener=e=>{const t=this._widgetSelectorListeners.get(e);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(Ly),this._widgetSelectorListeners.delete(e),iv.info(`Removed click listener for survey ${e}`))},this._removeWidgetSelectorListener=e=>{this._isWidgetSurveyOpen(e)||(this._removeSurveyFromDom(e),this._detachWidgetSelectorListener(e.id))},this._removeTabWidget=e=>{this._isWidgetSurveyOpen(e)||(this._removeSurveyFromDom(e),this._renderedTabWidgets.delete(e.id))},this._isWidgetSurveyOpen=e=>{try{var t;const i=document.querySelector(ty(e,!0));return!!(null==i||null===(t=i.shadowRoot)||void 0===t?void 0:t.querySelector(".ph-survey"))}catch(e){return!1}},this._manageWidgetSelectorListener=(e,t)=>{const i=document.querySelector(t),n=this._widgetSelectorListeners.get(e.id);if(i){if(this._handleWidget(e),n){if(i===n.element)return;iv.info(`Selector element changed for survey ${e.id}. Re-attaching listener.`),this._detachWidgetSelectorListener(e.id)}if(!i.hasAttribute(Ly)){const t=t=>{var i,n;t.stopPropagation();const s=(null===(i=e.appearance)||void 0===i?void 0:i.position)===Df?Oy(t.currentTarget,parseInt((null===(n=e.appearance)||void 0===n?void 0:n.maxWidth)||Fm.maxWidth)):{};window.dispatchEvent(new CustomEvent(Ay,{detail:{surveyId:e.id,position:s}}))};Qr(i,"click",t),i.setAttribute(Ly,"true"),this._widgetSelectorListeners.set(e.id,{element:i,listener:t,survey:e}),iv.info(`Attached click listener for feedback button survey ${e.id}`)}}else n&&this._removeWidgetSelectorListener(e)},this.renderPopover=e=>{var t;if(!(null===(t=this._host.client)||void 0===t?void 0:t.canCapture))return;const{survey:i,language:n}=this._translateSurveyForRendering(e),{shadow:s}=Dm(i,this._host);this._renderedTargets.set(s,s.host),Y_(ef(qy,{posthog:this._host,survey:i,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:n}),s)},this.renderSurvey=(e,t,i)=>{var n;if(!(null===(n=this._host.client)||void 0===n?void 0:n.canCapture))return;const{survey:s,language:r}=this._translateSurveyForRendering(e);let o=!1;this._host.config.prefillFromUrl&&(o=this._handleUrlPrefill(s,r,i)),Y_(ef(qy,{posthog:this._host,survey:s,removeSurveyFromFocus:this._removeSurveyFromFocus,isPopup:!1,properties:i,isSurveyCompleted:o,surveyLanguage:r}),t)},this.getActiveMatchingSurveys=(e,t=!1)=>{var i;null===(i=this._host.surveys)||void 0===i||i.getSurveys(t=>{e(t.filter(e=>this._shouldDisplaySurvey(e)))},t)},this.callSurveysAndEvaluateDisplayLogic=(e=!1)=>{this.getActiveMatchingSurveys(e=>{var t;const i=null===(t=this._host.client)||void 0===t?void 0:t.canCapture,n=e.filter(e=>i&&(e.type===$f||e.type===Nf)),s=new Set(n.map(e=>e.id));for(const e of Array.from(this._surveyTimeouts.keys()))s.has(e)||this.cancelSurvey(e);const r=this._sortSurveysByAppearanceDelay(n),o=new Set,a=new Set;r.forEach(e=>{if(e.type===Nf){var t,i,n,s;if((null===(t=e.appearance)||void 0===t?void 0:t.widgetType)===Ff)return a.add(e.id),void this._handleWidget(e);"selector"===(null===(i=e.appearance)||void 0===i?void 0:i.widgetType)&&(null===(n=e.appearance)||void 0===n?void 0:n.widgetSelector)&&(o.add(e.id),this._manageWidgetSelectorListener(e,null===(s=e.appearance)||void 0===s?void 0:s.widgetSelector))}Pt(this._surveyInFocus)&&e.type===$f&&this.handlePopoverSurvey(e,void 0,{resumeDelayFromActivation:!0})}),this._widgetSelectorListeners.forEach(({survey:e})=>{o.has(e.id)||this._removeWidgetSelectorListener(e)}),this._renderedTabWidgets.forEach((e,t)=>{a.has(t)||this._removeTabWidget(e)})},e)},this._addSurveyToFocus=e=>{Pt(this._surveyInFocus)||iv.error(`Survey ${this._surveyInFocus} already in focus. Cannot add survey ${e.id}.`),this._surveyInFocus=e.id},this._removeSurveyFromFocus=e=>{this._surveyInFocus!==e.id&&iv.error(`Survey ${e.id} is not in focus. Cannot remove survey ${e.id}.`),this._clearSurveyTimeout(e.id),this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0,this._removeSurveyFromDom(e)},this._host=e,this._surveyInFocus=null,this._languageChangeListener=()=>this._onLanguageChange(),Qr(window,"languagechange",this._languageChangeListener),this._unsubscribeFeatureFlags=null!==(t=null===(i=e.client)||void 0===i||null===(i=i.getExtension("featureFlagsCommon"))||void 0===i?void 0:i.onFeatureFlags(()=>this._onLanguageChange()))&&void 0!==t?t:null}_onLanguageChange(){var e;if(Pt(this._surveyInFocus))return;const t=null===(e=this._host.client)||void 0===e?void 0:e.kv.get(M),i=null==t?void 0:t.find(e=>e.id===this._surveyInFocus);if(!i)return;const{survey:n,language:s}=this._translateSurveyForRendering(i);if(s===this._currentLanguage)return;if(this._currentLanguage=s,!this._surveyIsRendered)return;const r=this._applyDisplayOverrides(n,this._displayOptions),{shadow:o}=Dm(r,this._host);Y_(ef(qy,ct(ct({},this._surveyPopupProps),{},{posthog:this._host,survey:r,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:s})),o)}_applyDisplayOverrides(e,t){return(null==t?void 0:t.position)||(null==t?void 0:t.selector)?ct(ct({},e),{},{appearance:ct(ct(ct({},e.appearance),t.position&&{position:t.position}),t.selector&&{widgetSelector:t.selector})}):e}_clearSurveyTimeout(e){const t=this._surveyTimeouts.get(e);t&&(clearTimeout(t),this._surveyTimeouts.delete(e))}cancelSurvey(e){this._surveyTimeouts.has(e)&&(iv.info(`Cancelled pending survey ${e}`),this._clearSurveyTimeout(e),this._surveyInFocus===e&&(this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0))}startAutomaticDisplay(){if(this._disposed||this._automaticDisplayDispose||!1===this._host.config.automaticDisplay)return;this._automaticDisplayDispose=()=>{};const e=function(e){let t;e.callSurveysAndEvaluateDisplayLogic(!0);const i=()=>{It(t)&&(t=setInterval(()=>{e.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},n=()=>{It(t)||(clearInterval(t),t=void 0)};i();const s=()=>{document.hidden?n():(e.callSurveysAndEvaluateDisplayLogic(!1),i())};return Qr(document,"visibilitychange",s),()=>{n(),document.removeEventListener("visibilitychange",s)}}(this);this._disposed?e():this._automaticDisplayDispose=e}clearInMemoryInProgressSurveyState(){(()=>{for(const e of Object.keys(Jm))delete Jm[e]})()}dispose(){var e;this._disposed=!0,null===(e=this._automaticDisplayDispose)||void 0===e||e.call(this),this._automaticDisplayDispose=void 0,this._languageChangeListener&&(window.removeEventListener("languagechange",this._languageChangeListener),this._languageChangeListener=null),this._unsubscribeFeatureFlags&&(this._unsubscribeFeatureFlags(),this._unsubscribeFeatureFlags=null),this._surveyTimeouts.forEach((e,t)=>this._clearSurveyTimeout(t)),this._widgetSelectorListeners.forEach((e,t)=>this._detachWidgetSelectorListener(t)),this._renderedTargets.forEach((e,t)=>{Y_(null,t),null==e||e.remove()}),this._renderedTargets.clear(),this._renderedTabWidgets.clear(),this._surveyInFocus=null}_sortSurveysByAppearanceDelay(e){return e.sort((e,t)=>{var i,n;const s=Xm(e),r=Xm(t);if(s&&!r)return-1;if(!s&&r)return 1;const o=e.schedule===jf,a=t.schedule===jf;return o&&!a?1:!o&&a?-1:((null===(i=e.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)-((null===(n=t.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)})}_translateSurveyForRendering(e){return Fy(e,this._host)}_handleUrlPrefill(e,t,i){if(this._prefillHandledSurveys.has(e.id))return!1;const{params:n}=function(){const e={};let t=!1;const i=window.location.search.replace(/^\?/,"");if(!i)return{params:e,autoSubmit:t};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(e){continue}if("auto_submit"===s&&"true"===r){t=!0;continue}const o=s.match(/^q(\d+)$/);if(o){const t=parseInt(o[1],10);e[t]||(e[t]=[]),e[t].push(r)}}return{params:e,autoSubmit:t}}();if(0===Object.keys(n).length)return!1;iv.info("[Survey Prefill] Detected URL prefill parameters");const s=this._processPrefillData(e,n,t);return!!s&&(this._autoSubmitPrefilledResponses(e,s,i,t),this._prefillHandledSurveys.add(e.id),s.isSurveyCompleted)}_autoSubmitPrefilledResponses(e,t,i,n){const{responses:s,submissionId:r,isSurveyCompleted:o,skippedResponses:a}=t;(Object.keys(a).length>0&&e.enable_partial_responses||o)&&Nm({responses:o?s:a,survey:e,surveySubmissionId:r,posthog:this._host,isSurveyCompleted:o,properties:i,surveyLanguage:n})}_handleInitialResponses(e,t,i,n){const s={};for(const[e,i]of Object.entries(t))s[parseInt(e)]=kt(i)?i.map(String):[String(i)];iv.info("[Survey] Processing initial responses");const r=this._processPrefillData(e,s,n);return!!r&&(this._autoSubmitPrefilledResponses(e,r,i,n),r.isSurveyCompleted)}_processPrefillData(e,t,i){try{const n=function(e,t){const i={};return e.questions.forEach((e,n)=>{if(!t[n]||!e.id)return;const s=t[n],r=Xl(e.id);try{switch(e.type){case zf:{if(!e.choices||0===e.choices.length)return void $r.warn(`[Survey Prefill] Question ${n} has no choices`);const t=parseInt(s[0],10);if(isNaN(t)||0>t||t>=e.choices.length)return void $r.warn(`[Survey Prefill] Invalid choice index for q${n}: ${s[0]}`);i[r]=e.choices[t];break}case Hf:{if(!e.choices||0===e.choices.length)return void $r.warn(`[Survey Prefill] Question ${n} has no choices`);const t=s.map(e=>parseInt(e,10)).filter(t=>!isNaN(t)&&t>=0&&e.choices.length>t);if(0===t.length)return void $r.warn(`[Survey Prefill] No valid choices for q${n}`);const o=[...new Set(t.map(t=>e.choices[t]))];t.length>o.length&&$r.warn(`[Survey Prefill] Removed duplicate choices for q${n}`),i[r]=o;break}case Uf:{const t=parseInt(s[0],10),o=e.scale||10,a=10===o?0:1;if(isNaN(t)||a>t||t>o)return void $r.warn(`[Survey Prefill] Invalid rating for q${n}: ${s[0]} (scale: ${a}-${o})`);i[r]=t;break}default:$r.info(`[Survey Prefill] Question type ${e.type} does not support prefill`)}}catch(e){$r.error(`[Survey Prefill] Error converting q${n}:`,e)}}),i}(e,t);if(0===Object.keys(n).length)return iv.warn("[Survey Prefill] No valid responses after conversion"),null;const s=Tl(),{startQuestionIndex:r,skippedResponses:o,skippedIndices:a}=function(e,t,i){let n=0;const s={},r=[],o=e.questions.length+1;let a=0;for(;e.questions.length>n&&o>a&&(a++,t.includes(n));){const t=e.questions[n];if(!t||!("skipSubmitButton"in t)||!t.skipSubmitButton)break;if(t.id){const e=Xl(t.id);It(i[e])||(s[e]=i[e])}r.push(n);const o=Py(e,n,t.id?i[Xl(t.id)]:null);if(o===Wf)return{startQuestionIndex:e.questions.length,skippedResponses:s,skippedIndices:r};n=o}return{startQuestionIndex:n,skippedResponses:s,skippedIndices:r}}(e,Object.keys(t).map(e=>parseInt(e,10)).filter(t=>{const i=e.questions[t];return(null==i?void 0:i.id)&&!It(n[Xl(i.id)])}),n),l=r>=e.questions.length;return Zm(e,{surveySubmissionId:s,responses:n,lastQuestionIndex:r,questionOrder:zm(e.questions),visitedIndices:a,surveyLanguage:i}),iv.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:n,submissionId:s,startQuestionIndex:r,isSurveyCompleted:l,skippedResponses:o}}catch(e){return iv.error("[Survey Prefill] Error handling prefill:",e),null}}_isSurveyFeatureFlagEnabled(e,t){var i;if(!e)return!0;const n=null===(i=this._host.client)||void 0===i?void 0:i.getExtension(tf),s=!!(null==n?void 0:n.isFeatureEnabled(e,{send_event:!e.startsWith("survey-targeting-")}));let r=!0;t&&(r=(null==n?void 0:n.getFeatureFlag(e,{send_event:!1}))===t||"any"===t);const o=s&&r;return o||this._warnIfFeatureFlagsDisabled(e),o}_warnIfFeatureFlagsDisabled(e){this._loggedFeatureFlagsDisabledWarning||!1!==this._host.config.featureFlagEvaluation||(this._loggedFeatureFlagsDisabledWarning=!0,iv.warn(`Survey feature flag "${e}" evaluated to false because advanced_disable_feature_flags is set. PostHog creates an internal targeting flag for almost every survey, so no survey can display while flags are disabled. To keep surveys working, replace advanced_disable_feature_flags with advanced_only_evaluate_survey_feature_flags, which evaluates survey flags only.`))}_isSurveyConditionMatched(e){return!e.conditions||Qm(e,this._host)&&function(e){var t,i;return function(e,t){var i,n,s;if(!e||0===e.length)return!0;const r="u">typeof window?window:void 0,o="u">typeof globalThis?globalThis:r,a=null==o?void 0:o.navigator,l=null==a?void 0:a.userAgent;if(!l)return!1;const c=Zi(l,{userAgentDataPlatform:null==a||null===(i=a.userAgentData)||void 0===i?void 0:i.platform,maxTouchPoints:null==a?void 0:a.maxTouchPoints,screenWidth:null==r||null===(n=r.screen)||void 0===n?void 0:n.width,screenHeight:null==r||null===(s=r.screen)||void 0===s?void 0:s.height,devicePixelRatio:null==r?void 0:r.devicePixelRatio});return pc[null!=t?t:"icontains"](e,[c])}(null===(t=e.conditions)||void 0===t?void 0:t.deviceTypes,null===(i=e.conditions)||void 0===i?void 0:i.deviceTypesMatchType)}(e)&&function(e){var t,i;return!(null===(t=e.conditions)||void 0===t?void 0:t.selector)||!!(null===(i=document)||void 0===i?void 0:i.querySelector(e.conditions.selector))}(e)}_internalFlagCheckSatisfied(e){var t;return Wm(e)?{satisfied:!0}:e.internal_targeting_flag_key&&function(e){var t;return"recurring"===e.schedule||(null!==(t=e.current_iteration)&&void 0!==t?t:0)>0}(e)&&!(null===(t=this._host.client)||void 0===t||null===(t=t.getExtension("featureFlagsCommon"))||void 0===t?void 0:t.hasLoadedFlags)?(this._warnIfFeatureFlagsDisabled(e.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this._isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key)}}checkSurveyEligibility(e){var t,i;const n={eligible:!0,reason:void 0};if(!sv(e))return n.eligible=!1,n.reason=`Survey is not running. It was completed on ${e.end_date}`,n;if(!cv.includes(e.type))return n.eligible=!1,n.reason=`Surveys of type ${e.type} are never eligible to be shown in the app`,n;const s=null===(t=e.conditions)||void 0===t?void 0:t.linkedFlagVariant;if(!this._isSurveyFeatureFlagEnabled(e.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._isSurveyFeatureFlagEnabled(e.targeting_flag_key))return n.eligible=!1,n.reason="Survey targeting feature flag is not enabled",n;const r=this._internalFlagCheckSatisfied(e);var o;return r.satisfied?(e=>{let t=null;try{t=localStorage.getItem("lastSeenSurveyDate")}catch(e){iv.error("localStorage error: "+e)}return function(e,t){if(!e||!t)return!0;const i="string"==typeof t?new Date(t):t,n=Math.abs((new Date).getTime()-i.getTime());return Math.ceil(n/864e5)>e}(e,t)})(null===(i=e.conditions)||void 0===i?void 0:i.seenSurveyWaitPeriodInDays)?((e=>{let t=null;try{t=localStorage.getItem(av(e))}catch(e){iv.error("localStorage error: "+e)}return!!t&&!Wm(e)})(e)&&(n.eligible=!1,n.reason="Survey has already been seen and it can't be activated again"),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(){var e;return(null===(e=this._host.client)||void 0===e?void 0:e.canCapture)?{eligible:!0}:{eligible:!1,reason:nv}}checkSurveyDisplayEligibility(e){const t=this.checkSurveyCaptureEligibility();return t.eligible?this.checkSurveyEligibility(e):t}checkSurveyRenderability(e){const t=this.checkSurveyDisplayEligibility(e);return t.eligible&&!this._hasActionOrEventTriggeredSurvey(e)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:t}_hasActionOrEventTriggeredSurvey(e){var t;if(!cc(e)&&!rv(e))return!0;const i=null===(t=this._host.surveys)||void 0===t||null===(t=t._surveyEventReceiver)||void 0===t?void 0:t.getSurveys();return!!(null==i?void 0:i.includes(e.id))}_checkFlags(e){var t;return!(null===(t=e.feature_flag_keys)||void 0===t?void 0:t.length)||e.feature_flag_keys.every(({key:e,value:t})=>!e||!t||this._isSurveyFeatureFlagEnabled(t))}_shouldDisplaySurvey(e){return this.checkSurveyEligibility(e).eligible&&this._isSurveyConditionMatched(e)&&this._hasActionOrEventTriggeredSurvey(e)&&this._checkFlags(e)}_removeSurveyFromDom(e){try{const t=document.querySelector(ty(e,!0));(null==t?void 0:t.shadowRoot)&&(Y_(null,t.shadowRoot),this._renderedTargets.delete(t.shadowRoot)),null==t||t.remove()}catch(t){iv.warn(`Failed to remove survey ${e.id} from DOM:`,t)}}getTestAPI(){return{addSurveyToFocus:this._addSurveyToFocus,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyInFocus:this._surveyInFocus,surveyTimeouts:this._surveyTimeouts,handleWidget:this._handleWidget,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this._manageWidgetSelectorListener,sortSurveysByAppearanceDelay:this._sortSurveysByAppearanceDelay.bind(this),checkFlags:this._checkFlags.bind(this),isSurveyFeatureFlagEnabled:this._isSurveyFeatureFlagEnabled.bind(this),onLanguageChange:this._onLanguageChange.bind(this),currentLanguage:this._currentLanguage,surveyIsRendered:this._surveyIsRendered}}};function $y({survey:e,removeSurveyFromFocus:t=()=>{},setSurveyVisible:i,isPreviewMode:n=!1,posthog:s}){yf(()=>{var r;if(n||!(null===(r=e.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var n;const r=e.type===Nf,o=Qm(e,s),a=(null===(n=e.appearance)||void 0===n?void 0:n.widgetType)===Ff&&r;if(!o)return iv.info(`Hiding survey ${e.id} because URL does not match`),i(!1),t(e);a&&(iv.info(`Showing survey ${e.id} because it is a feedback button tab and URL matches`),i(!0))};Qr(window,"popstate",o),Qr(window,"hashchange",o);const a=window.history.pushState,l=window.history.replaceState;return window.history.pushState=function(...e){a.apply(this,e),o()},window.history.replaceState=function(...e){l.apply(this,e),o()},()=>{window.removeEventListener("popstate",o),window.removeEventListener("hashchange",o),window.history.pushState=a,window.history.replaceState=l}},[n,e,t,i,s])}const Ny=200;function By(e="right"){switch(e){case"top":return{top:"0",left:"50%",transform:"translateX(-50%)"};case"left":return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case"bottom":return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function qy({survey:e,forceDisableHtml:t,posthog:i,style:n={},previewPageIndex:s,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:a=()=>{},onPreviewBack:l=()=>{},onPopupSurveyDismissed:c=()=>{},onCloseConfirmationMessage:u=()=>{},properties:d,isSurveyCompleted:h,skipShownEvent:p,surveyLanguage:g}){var _,f,v,m,y,b,S,w,k,C,x,E;const I=bf(null),T=Number.isInteger(s),{isPopupVisible:M,isSurveySent:P,hidePopupWithAnimation:R}=function(e,t,i,n,s,r,o,a,l){const[c,u]=mf(n||0===i||e.type===Bf),[d,h]=mf(!1),p=bf(!1),g=()=>{const t=()=>{r&&s(e),u(!1)};if(p.current)return;const i=null==o?void 0:o.current;i?(p.current=!0,i.style.transition=`opacity ${Ny}ms ease-out`,i.style.opacity="0",setTimeout(()=>{p.current=!1,t()},250)):t()},_=t=>{t.detail.surveyId===e.id&&g()};return yf(()=>{if(!t)return void iv.error("usePopupVisibility hook called without a PostHog instance.");if(n)return;let s;const r=t=>{var i,n;if(t.detail.surveyId===e.id){if(!(null===(i=e.appearance)||void 0===i?void 0:i.displayThankYouMessage))return g();h(!0),(null===(n=e.appearance)||void 0===n?void 0:n.autoDisappear)&&(s&&clearTimeout(s),s=setTimeout(g,5e3))}},o=()=>{var i;if(Qm(e,t)){u(!0);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}window.dispatchEvent(new Event("PHSurveyShown")),a||null===(i=t.client)||void 0===i||i.capture(Vf,ct(ct({[Jf]:e.name,[Kf]:e.id,[Zf]:e.current_iteration,[Yf]:e.current_iteration_start_date},l&&{[ev]:l}),{},{sessionRecordingUrl:nf(t)}))}};Qr(window,"PHSurveyClosed",_),Qr(window,"PHSurveySent",r);const c=i>0?setTimeout(o,i):void 0;return It(c)&&o(),()=>{It(c)||clearTimeout(c),It(s)||clearTimeout(s),window.removeEventListener("PHSurveyClosed",_),window.removeEventListener("PHSurveySent",r)}},[]),$y({survey:e,removeSurveyFromFocus:s,setSurveyVisible:u,isPreviewMode:n,posthog:t}),{isPopupVisible:c,isSurveySent:d,setIsPopupVisible:u,hidePopupWithAnimation:g}}(e,i,(null===(_=e.appearance)||void 0===_?void 0:_.surveyPopupDelaySeconds)?1e3*e.appearance.surveyPopupDelaySeconds:0,T,r,o,I,p,g),F=P||s===e.questions.length||!0===h,[A,L]=mf(!1),O=Sf(()=>!!Ym(e),[e]),D=!(!(null===(f=e.appearance)||void 0===f?void 0:f.introScreenHeader)&&!(null===(v=e.appearance)||void 0===v?void 0:v.introScreenDescription)),N=T?-1===s:!!(null===(m=e.appearance)||void 0===m?void 0:m.displayIntroScreen)&&D&&!A&&!O,B=Sf(()=>{const t=Ym(e),n=(null==t?void 0:t.surveySubmissionId)||Tl()||"";return{isPreviewMode:T,previewPageIndex:s,onPopupSurveyDismissed(){g?qm(e,i,T,g):qm(e,i,T),c()},isPopup:o||!1,surveySubmissionId:n,onPreviewSubmit:a,onPreviewBack:l,posthog:i,properties:d,surveyLanguage:g}},[T,s,o,i,e,c,a,l,d,g]);return M?ef(jm.Provider,{value:B,children:ef("div",{className:"ph-survey",style:ct(ct({},iy(e.type,null===(y=e.appearance)||void 0===y?void 0:y.position,null===(b=e.appearance)||void 0===b?void 0:b.widgetType)),n),ref:I,children:F?ef(fy,{header:(null===(S=e.appearance)||void 0===S?void 0:S.thankYouMessageHeader)||"Thank you!",description:(null===(w=e.appearance)||void 0===w?void 0:w.thankYouMessageDescription)||"",forceDisableHtml:!!t,contentType:null===(k=e.appearance)||void 0===k?void 0:k.thankYouMessageDescriptionContentType,appearance:e.appearance||Fm,onClose(){R(),u()}}):N?ef(vy,{header:(null===(C=e.appearance)||void 0===C?void 0:C.introScreenHeader)||"",description:(null===(x=e.appearance)||void 0===x?void 0:x.introScreenDescription)||"",forceDisableHtml:!!t,contentType:null===(E=e.appearance)||void 0===E?void 0:E.introScreenDescriptionContentType,appearance:e.appearance||Fm,onStart:()=>L(!0)}):ef(Hy,{survey:e,forceDisableHtml:!!t,posthog:i})})}):null}function Hy({survey:e,forceDisableHtml:t,posthog:i}){var n,s;const r=Sf(()=>{const t=Ym(e);if(!t)return null;const i=Ft(t.lastQuestionIndex);return!i||i&&t.lastQuestionIndex>=0&&e.questions.length>t.lastQuestionIndex?t:(ey(e),null)},[e]),[o,a]=mf(()=>((null==r?void 0:r.responses)&&iv.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[l,c]=mf(!1),{previewPageIndex:u,onPopupSurveyDismissed:d,isPopup:h,onPreviewSubmit:p,onPreviewBack:g,surveySubmissionId:_,isPreviewMode:f,properties:v,surveyLanguage:m}=wf(jm),[y,b]=mf(()=>{const t=null==r?void 0:r.lastQuestionIndex,i=Ft(t)&&t>=0&&e.questions.length>t?t:0;return Ft(u)&&u>=0?u:i}),[S,w]=mf(()=>{var t;return(null!==(t=null==r?void 0:r.visitedIndices)&&void 0!==t?t:[]).filter(t=>t>=0&&e.questions.length>t)}),[k,C]=mf(()=>{var t;const i=Ym(e);return null!==(t=null==i?void 0:i.questionSnapshots)&&void 0!==t?t:{}}),x=Sf(()=>zm(Um(e,r)),[e.id,r]),E=Sf(()=>{if(!x||new Set(x).size!==x.length)return Um(e,r);const t=new Map(e.questions.map(e=>[e.id,e])),i=x.map(e=>t.get(e)).filter(e=>!!e);return i.length===x.length?i:e.questions},[x,e.questions,e,r]);yf(()=>{!f||It(u)||0>u||b(u)},[u,f]);const I=!!(null===(n=e.appearance)||void 0===n?void 0:n.allowGoBack)&&(f?(null!=u?u:0)>0:S.length>0),T=E.at(y);return T?ef("form",{className:"survey-form",name:"surveyForm",children:[h&&!0!==(null===(s=e.appearance)||void 0===s?void 0:s.hideCancelButton)&&ef(_y,{onClick(){d()}}),ef("div",{className:"survey-box","data-question-index":y,children:[l&&ef("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),Uy({question:T,forceDisableHtml:t,displayQuestionIndex:y,appearance:e.appearance||Fm,onSubmit:t=>(({res:t,displayQuestionIndex:n,questionId:s})=>{var r;if(!i)return void iv.error("onNextButtonClick called without a PostHog instance.");if(!(null===(r=i.client)||void 0===r?void 0:r.canCapture))return void c(!0);if(c(!1),!s)return void iv.error("onNextButtonClick called without a questionId.");const{responses:l,questionSnapshots:u}=function({responses:e,questionSnapshots:t={}},i,n,s){return{responses:ct(ct({},e),{},{[Xl(i)]:n}),questionSnapshots:(null==s?void 0:s.id)?ct(ct({},t),{},{[s.id]:s.question}):t}}({responses:o,questionSnapshots:k},s,t,E[n]);a(l),C(u);const d=Py(e,n,t),h=d===Wf,p=[...S,n];if(h||(w(p),b(d),Zm(e,{surveySubmissionId:_,responses:l,lastQuestionIndex:d,questionOrder:zm(E),visitedIndices:p,surveyLanguage:m,questionSnapshots:u})),e.enable_partial_responses||h){const t=new Set(p.map(e=>{var t;return null===(t=E[e])||void 0===t?void 0:t.id}).filter(e=>!!e).map(e=>Xl(e))),n=Object.fromEntries(Object.entries(l).filter(([e])=>t.has(e)));Nm({responses:n,survey:e,surveySubmissionId:_,isSurveyCompleted:h,posthog:i,properties:v,surveyLanguage:m,questionSnapshots:u})}})({res:t,displayQuestionIndex:y,questionId:T.id}),onPreviewSubmit:p,initialValue:T.id?o[Xl(T.id)]:void 0,canGoBack:I,onBack(){if(f)return void g();if(0===S.length)return;const t=S[S.length-1],i=S.slice(0,-1);w(i),b(t),Zm(e,{surveySubmissionId:_,responses:o,lastQuestionIndex:t,questionOrder:zm(E),visitedIndices:i,surveyLanguage:m,questionSnapshots:k})}})]})]}):null}function zy({survey:e,forceDisableHtml:t,posthog:i,readOnly:n,surveyLanguage:s}){var r,o,a,l,c,u,d,h;const[p,g]=mf(!0),[_,f]=mf(!1),[v,m]=mf({}),y=bf(void 0),b=()=>{var e;(_||!i||n||(null===(e=i.client)||void 0===e?void 0:e.canCapture))&&f(!_)};if(yf(()=>{var t,s,r;if(!i)return void iv.error("FeedbackWidget called without a PostHog instance.");if(n)return;"tab"===(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)&&m((r=null===(s=e.appearance)||void 0===s?void 0:s.position)&&r!==Of&&r!==Df?{}:{top:"50%",bottom:"auto"});const o=t=>{var i;const n=t;(null===(i=n.detail)||void 0===i?void 0:i.surveyId)===e.id&&(iv.info(`Received show event for feedback button survey ${e.id}`),m(n.detail.position||{}),b())};return Qr(window,Ay,o),()=>{It(y.current)||(clearTimeout(y.current),y.current=void 0),window.removeEventListener(Ay,o)}},[i,n,e.id,null===(r=e.appearance)||void 0===r?void 0:r.widgetType,null===(o=e.appearance)||void 0===o?void 0:o.position,null===(a=e.appearance)||void 0===a?void 0:a.widgetSelector,null===(l=e.appearance)||void 0===l?void 0:l.borderColor]),$y({survey:e,setSurveyVisible:g,posthog:i}),!p)return null;const S=()=>{e.schedule!==jf&&g(!1),It(y.current)||clearTimeout(y.current),y.current=setTimeout(()=>{y.current=void 0,f(!1)},200)};return ef(F_,{children:["tab"===(null===(c=e.appearance)||void 0===c?void 0:c.widgetType)&&ef("button",{className:"ph-survey-widget-tab "+("top"===(null===(u=e.appearance)||void 0===u?void 0:u.tabPosition)?"widget-tab-top":""),onClick:b,disabled:n,style:By(null===(d=e.appearance)||void 0===d?void 0:d.tabPosition),children:(null===(h=e.appearance)||void 0===h?void 0:h.widgetLabel)||""}),_&&ef(qy,{posthog:i,survey:e,forceDisableHtml:t,style:v,onPopupSurveyDismissed:S,onCloseConfirmationMessage:S,surveyLanguage:s})]})}const Uy=({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l})=>{const c={forceDisableHtml:t,appearance:n,onPreviewSubmit(e){r(e)},onSubmit(e){s(e)},initialValue:o,displayQuestionIndex:i,canGoBack:a,onBack:l};switch(e.type){case qf:return P_(yy,ct(ct({},c),{},{question:e,key:e.id}));case"link":return P_(by,ct(ct({},c),{},{question:e,key:e.id}));case Uf:return P_(Sy,ct(ct({},c),{},{question:e,key:e.id}));case zf:case Hf:return P_(ky,ct(ct({},c),{},{question:e,key:e.id}));default:return iv.error(`Unsupported question type: ${e.type}`),null}},Wy="gzip-js",jy="base64";function Vy(e){let t=!0;return{dispose(){if(t){t=!1;const i=e();i&&Ct(i.then)&&i.then(void 0,()=>{})}}}}var Gy=class{on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter(e=>e!==t)}}emit(e,t){for(const i of this._events[e]||[])i(t);for(const i of this._events["*"]||[])i(e,t)}constructor(){this._events={}}};function Qy(e,t,i){if(Rt(e))return!1;switch(i){case"exact":return e===t;case"contains":{const i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}var Ky=class{constructor(e){this._host=e,this._actionRegistry=new Set,this._actionEvents=new Set,this._debugEventEmitter=new Gy,this._checkStep=(e,t)=>this._checkStepEvent(e,t)&&this._checkStepUrl(e,t)&&this._checkStepElement(e,t)&&this._checkStepProperties(e,t),this._checkStepEvent=(e,t)=>!(null==t?void 0:t.event)||(null==e?void 0:e.event)===(null==t?void 0:t.event)}init(){var e,t;It(null===(e=this._host)||void 0===e?void 0:e.subscribeCapture)||(this._captureHookUnsubscribe=null===(t=this._host)||void 0===t?void 0:t.subscribeCapture((e,t)=>{this.on(e,t)}))}dispose(){var e,t,i;null===(e=this._captureHookUnsubscribe)||void 0===e||e.call(this),this._captureHookUnsubscribe=void 0,null===(t=this._host)||void 0===t||null===(i=t.setElementSelectors)||void 0===i||i.call(t,new Set,this),this._debugEventEmitter=new Gy}register(e){var t,i;if(!It(null===(t=this._host)||void 0===t?void 0:t.subscribeCapture)&&(e.forEach(e=>{var t;this._actionRegistry.add(e),null===(t=e.steps)||void 0===t||t.forEach(e=>{this._actionEvents.add((null==e?void 0:e.event)||"")})}),null===(i=this._host)||void 0===i?void 0:i.setElementSelectors)){const e=new Set;this._actionRegistry.forEach(t=>{var i;null===(i=t.steps)||void 0===i||i.forEach(t=>{(null==t?void 0:t.selector)&&e.add(t.selector)})}),this._host.setElementSelectors(e,this)}}replace(e){this._actionRegistry.clear(),this._actionEvents.clear(),this.register(e)}on(e,t){null!=t&&0!=e.length&&(this._actionEvents.has(e)||this._actionEvents.has(t.event))&&this._actionRegistry.forEach(e=>{this._checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)})}_addActionHook(e){this.onAction("actionCaptured",t=>e(t))}_checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(const i of t.steps)if(this._checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(e,t){if(null==t?void 0:t.url){var i;let r=null==e||null===(i=e.properties)||void 0===i?void 0:i.$current_url;if(!(null==e?void 0:e.properties)||!("$current_url"in e.properties))try{var n,s;r=null===(n=this._host)||void 0===n||null===(s=n.getActionUrl)||void 0===s?void 0:s.call(n)}catch(e){return!1}if(!r||"string"!=typeof r)return!1;if(!Qy(r,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t)}_checkStepHref(e,t){var i;if(!(null==t?void 0:t.href))return!0;const n=this._getElementsList(e);if(n.length>0)return n.some(e=>Qy(e.href,t.href,t.href_matching||"exact"));const s=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!s&&Qy(function(e){const t=e.match(/(?::|")href="(.*?)"/);return t?t[1]:""}(s),t.href,t.href_matching||"exact")}_checkStepText(e,t){var i;if(!(null==t?void 0:t.text))return!0;const n=this._getElementsList(e);if(n.length>0)return n.some(e=>Qy(e.text,t.text,t.text_matching||"exact")||Qy(e.$el_text,t.text,t.text_matching||"exact"));const s=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!s&&(r=function(e){const t=[],i=/(?::|")text="(.*?)"/g;let n;for(;!Rt(n=i.exec(e));)t.includes(n[1])||t.push(n[1]);return t}(s),o=t.text,a=t.text_matching||"exact",r.some(e=>Qy(e,o,a)));var r,o,a}_checkStepSelector(e,t){var i,n;if(!(null==t?void 0:t.selector))return!0;const s=null==e||null===(i=e.properties)||void 0===i?void 0:i.$element_selectors;if(null==s?void 0:s.includes(t.selector))return!0;const r=(null==e||null===(n=e.properties)||void 0===n?void 0:n.$elements_chain)||"";if(t.selector_regex&&r)try{return new RegExp(t.selector_regex).test(r)}catch(e){}return!1}_getElementsList(e){var t;return null==(null==e||null===(t=e.properties)||void 0===t?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return!(null==t?void 0:t.properties)||0===t.properties.length||gc(t.properties.reduce((e,t)=>{const i=kt(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}},Jy=class{constructor(e,t){this._onActivationChanged=t,this._pendingActivatedItems=[],this._host=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map}_subscribeSession(){var e,t;this._sessionIdUnsubscribe=null===(e=(t=this._host).subscribeSession)||void 0===e?void 0:e.call(t,e=>this._onSessionIdChanged(e))}_shouldPersistArmedActivation(e){return!1}_getActivationTimestampsKey(){return null}_writeActivationTimestamps(e){}_clearActivationTimestampsStore(){}_doesEventMatchFilter(e,t){return!!e&&gc(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(e,t){const i=new Map;return e.forEach(e=>{var n;null===(n=e.conditions)||void 0===n||null===(n=n[t])||void 0===n||null===(n=n.values)||void 0===n||n.forEach(t=>{if(null==t?void 0:t.name){const n=i.get(t.name)||[];n.push(e.id),i.set(t.name,n)}})}),i}_getMatchingItems(e,t,i){const n=(i===Pf?this._eventToItems:this._cancelEventToItems).get(e);let s=[];return this._getItems(e=>{s=e.filter(e=>null==n?void 0:n.includes(e.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(t=>t.name===e);return this._doesEventMatchFilter(r,t)})}register(e){this._register(e,!1)}replace(e){this._register(e,!0)}_register(e,t){It(this._host.subscribeCapture)||(this._setupEventBasedItems(e,t),this._setupActionBasedItems(e,t))}_setupActionBasedItems(e,t){const i=e.filter(e=>{var t;return null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length});var n;if(t&&this._actionToItems.clear(),0===i.length)return void(t&&(null===(n=this._actionMatcher)||void 0===n||n.replace([])));this._actionMatcher||(this._actionMatcher=new Ky(this._host),this._actionMatcher.init(),this._actionMatcher._addActionHook(e=>this.onAction(e)));const s=[];i.forEach(e=>{var t;null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||t.values.forEach(t=>{if(s.push(t),t.name){var i;const n=null!==(i=this._actionToItems.get(t.name))&&void 0!==i?i:[];n.includes(e.id)||n.push(e.id),this._actionToItems.set(t.name,n)}})}),t?this._actionMatcher.replace(s):this._actionMatcher.register(s)}_mergeItemMaps(e,t){t.forEach((t,i)=>{var n;const s=null!==(n=e.get(i))&&void 0!==n?n:[];t.forEach(e=>{s.includes(e)||s.push(e)}),e.set(i,s)})}_setupEventBasedItems(e,t){var i,n,s;const r=e.filter(e=>{var t,i;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),o=e.filter(e=>{var t,i;return(null===(t=e.conditions)||void 0===t?void 0:t.cancelEvents)&&(null===(i=e.conditions)||void 0===i||null===(i=i.cancelEvents)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),a=this._buildEventToItemMap(e,Pf),l=this._buildEventToItemMap(e,Rf);t?(this._eventToItems=a,this._cancelEventToItems=l):(this._mergeItemMaps(this._eventToItems,a),this._mergeItemMaps(this._cancelEventToItems,l)),(0!==r.length||0!==o.length||e.some(e=>{var t;return null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length}))&&(null!==(i=this._captureHookUnsubscribe)&&void 0!==i||(this._captureHookUnsubscribe=null===(n=(s=this._host).subscribeCapture)||void 0===n?void 0:n.call(s,(e,t)=>{this.onEvent(e,t)})))}onEvent(e,t){var i,n;const s=this._getLogger(),r=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$survey_id)||(null==t||null===(n=t.properties)||void 0===n?void 0:n.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const i=this._activationOutcome(e,r,t);if("consume"===i)return s.info("event consumed activated item, removing it",{event:e,itemId:r}),void this._deactivateItems([r]);if("persist"===i)return s.info("shown item promoted to persisted activation",{event:e,itemId:r}),this._persistActivation(r),void this._clearActivationTimestamps([r])}if(this._cancelEventToItems.has(e)){const i=this._getMatchingItems(e,t,Rf);i.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:i.map(e=>e.id)}),this._deactivateItems(i.map(e=>e.id)),i.forEach(e=>this._cancelPendingItem(e.id)))}if(!this._eventToItems.has(e))return;s.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});const o=this._getMatchingItems(e,t,Pf);this._activateItems(o.map(e=>e.id))}onAction(e){this._actionToItems.has(e)&&this._activateItems(this._actionToItems.get(e)||[])}_activateItems(e){if(0===e.length)return;const t=!!this._host.getSessionId(),i=[];for(const n of e)t&&this._shouldPersistArmedActivation(n)?this._persistActivation(n)&&this._recordActivationTimestamp(n):i.push(n);i.length>0&&(this._pendingActivatedItems=[...new Set([...this._pendingActivatedItems,...i])]),this._getLogger().info("updating activated items",{activatedItems:this.getActivatedIds()}),this._notifyActivationChanged()}_persistActivation(e){this._pendingActivatedItems=this._pendingActivatedItems.filter(t=>t!==e);const t=this._getPersistedActivatedIds();return!t.includes(e)&&(this._setActivatedItems([...t,e]),this._stampActivationSession(),!0)}_deactivateItems(e){const t=new Set(e);this._pendingActivatedItems=this._pendingActivatedItems.filter(e=>!t.has(e));const i=this._getRawPersistedActivatedIds(),n=i.filter(e=>!t.has(e));n.length!==i.length&&(this._setActivatedItems(n),0===n.length&&this._clearActivationSession()),this._clearActivationTimestamps(e),this._notifyActivationChanged()}_notifyActivationChanged(){try{var e;null===(e=this._onActivationChanged)||void 0===e||e.call(this)}catch(e){this._getLogger().error("Error while handling activated items change",e)}}_getRawActivationTimestamps(){const e=this._getActivationTimestampsKey();if(!e)return{};const t=this._host.getProperty(e);return t&&"object"==typeof t?t:{}}_recordActivationTimestamp(e){if(!this._getActivationTimestampsKey())return;const t=this._getRawActivationTimestamps();this._writeActivationTimestamps(ct(ct({},t),{},{[e]:Date.now()}))}_clearActivationTimestamps(e){if(!this._getActivationTimestampsKey())return;const t=this._getRawActivationTimestamps(),i={};let n=!1;for(const[s,r]of Object.entries(t))e.includes(s)?n=!0:i[s]=r;n&&(Et(i)?this._clearActivationTimestampsStore():this._writeActivationTimestamps(i))}_clearAllActivationTimestamps(){this._getActivationTimestampsKey()&&this._clearActivationTimestampsStore()}getActivationTimestamp(e){if(!this._getPersistedActivatedIds().includes(e))return;const t=this._getRawActivationTimestamps()[e];return Ft(t)?t:void 0}_getRawPersistedActivatedIds(){const e=this._getActivatedKey();return this._host.getProperty(e)||[]}_getPersistedActivatedIds(){const e=this._getRawPersistedActivatedIds();if(0===e.length)return[];const t=this._host.getProperty(this._getActivatedSessionKey()),i=this._host.getSessionId();return i&&t===i?e:[]}_stampActivationSession(){const e=this._host.getSessionId();e&&this._setActivatedSession(e)}_clearActivationSession(){this._clearActivatedSession()}_onSessionIdChanged(e){const t=this._host.getProperty(this._getActivatedSessionKey());if(t&&t!==e){const e=this._getRawPersistedActivatedIds(),t=this._getRawActivationTimestamps();e.length>0&&(this._setActivatedItems([]),e.filter(e=>Ft(t[e])).forEach(e=>this._cancelPendingItem(e))),this._clearActivationSession(),this._clearAllActivationTimestamps(),e.length>0&&this._notifyActivationChanged()}}getActivatedIds(){return[...new Set([...this._getPersistedActivatedIds(),...this._pendingActivatedItems])].filter(e=>!this._isItemPermanentlyIneligible(e))}dispose(){var e,t,i;null===(e=this._sessionIdUnsubscribe)||void 0===e||e.call(this),this._sessionIdUnsubscribe=void 0,null===(t=this._captureHookUnsubscribe)||void 0===t||t.call(this),this._captureHookUnsubscribe=void 0,null===(i=this._actionMatcher)||void 0===i||i.dispose(),this._actionMatcher=void 0}reset(){this._pendingActivatedItems=[],this._getRawPersistedActivatedIds().length>0&&this._setActivatedItems([]),this._clearActivationSession(),this._clearAllActivationTimestamps(),this._notifyActivationChanged()}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}},Zy=class extends Jy{constructor(e,t,i,n){var s;super({subscribeCapture(t){const i=e.onEvent(e=>t(e.event,e));return()=>i.dispose()},subscribeSession(t){const i=e.onSession(t);return()=>i.dispose()},getSessionId(){var t;return null===(t=e.session)||void 0===t?void 0:t.sessionId},getProperty:t=>e.kv.get(t),getActionUrl:null==i?void 0:i.getActionUrl,setElementSelectors:null!==(s=null==i?void 0:i.setElementSelectors)&&void 0!==s?s:(t,i)=>{var n;return null===(n=e.getExtension("autocapture"))||void 0===n?void 0:n.setElementSelectors(t,i)}},n),this._client=e,this._surveys=t,this._subscribeSession()}_getActivatedKey(){return F}_getActivatedSessionKey(){return A}_getActivationTimestampsKey(){return L}_writeActivationTimestamps(e){this._client.kv.set({[L]:e})}_clearActivationTimestampsStore(){this._client.kv.remove(L)}_shouldPersistArmedActivation(e){var t;let i;this._getItems(t=>{i=t.find(t=>t.id===e)});const n=null==i||null===(t=i.appearance)||void 0===t?void 0:t.surveyPopupDelaySeconds;return Ft(n)&&n>0}_getShownEventName(){return Vf}_getItems(e){this._surveys.getSurveys(e)}_cancelPendingItem(e){this._surveys.cancelPendingSurvey(e)}_getLogger(){return iv}_setActivatedItems(e){this._client.kv.set({[F]:e})}_setActivatedSession(e){this._client.kv.set({[A]:e})}_clearActivatedSession(){this._client.kv.remove(A)}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t,i){var n;if(e===Qf&&!1===(null==i||null===(n=i.properties)||void 0===n?void 0:n.$survey_completed))return"ignore";let s;return this._getItems(e=>{s=e.find(e=>e.id===t)}),!s||uc(s)?e===Vf?"consume":"ignore":e===Vf?"persist":e===Gf||e===Qf?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}};const Yy=(e,t)=>(null==e?void 0:e.then)?e.then(t):t(e),Xy="SDK is not enabled or survey functionality is not yet loaded",eb="Disabled. Not loading surveys.";var tb=class{constructor(e){this._configSource=e,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this._isInitializingSurveys=!1,this._surveyInitializationFailed=!1,this._surveyCallbacks=[],this._activeMatchingSurveyCallbacks=[],this._getSurveysInFlightPromise=null,this._lastSurveyRefreshFailedAt=null,this._disposed=!1,this._renderTimeouts=new Set,this.onRemoteConfig=e=>{if(this._disposed)return;if(this._config.disableSurveys)return;if(!e.ok)return this._surveyInitializationFailed=!0,this._notifyActiveMatchingSurveyCallbacks({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),iv.warn("Remote config unavailable. Not loading surveys.");const t=e.config.surveys;if(Rt(t))return iv.warn("Flags not loaded yet. Not loading surveys.");this._isSurveysEnabled=Lt(t)?t:t.length>0,iv.info(`flags response received, isSurveysEnabled: ${this._isSurveysEnabled}`),this.loadIfEnabled()},this._notifyActiveMatchingSurveyCallbacks=e=>{this._activeMatchingSurveyCallbacks.slice().forEach(t=>this._notifyActiveMatchingSurveyCallback(t,e))}}setup(e){if(!this._disposed)return this._initializingClient=e,Yy(e.kv.initialize(),()=>{if(this._initializingClient!==e||this._disposed)return;this._initializingClient=void 0,this._client=e;const t=e.onRemoteConfig(this.onRemoteConfig);this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.loadIfEnabled())})}dispose(){var e,t,i,n,s;this._disposed||(this._disposed=!0,this._initializingClient=void 0,this._client=void 0,null===(e=this._remoteConfigSubscription)||void 0===e||e.dispose(),this._remoteConfigSubscription=void 0,null===(t=this._surveyEventReceiver)||void 0===t||t.dispose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(n=i.dispose)||void 0===n||n.call(i),this._surveyManager=null,this._surveyCallbacks=[],this._activeMatchingSurveyCallbacks.forEach(e=>{e.active=!1}),this._activeMatchingSurveyCallbacks=[],null===(s=this._activeMatchingSurveyConditionsUnsubscribe)||void 0===s||s.call(this),this._activeMatchingSurveyConditionsUnsubscribe=void 0,this._getSurveysInFlightPromise=null,this._renderTimeouts.forEach(e=>clearTimeout(e)),this._renderTimeouts.clear())}get _config(){return this._configSource.get()}getRenderContext(){if(!this._client)return;const e=this;return{client:this._client,get config(){return e._config},surveys:e}}initialize(){this.loadIfEnabled()}reset(){var e,t;null===(e=this._surveyManager)||void 0===e||null===(t=e.clearInMemoryInProgressSurveyState)||void 0===t||t.call(e);try{var i;null===(i=this._surveyEventReceiver)||void 0===i||i.reset(),localStorage.removeItem("lastSeenSurveyDate");const e=[];for(let t=0;t<localStorage.length;t++){const i=localStorage.key(t);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}catch(e){}this._notifyActiveMatchingSurveyCallbacks()}loadIfEnabled(){if(this._disposed||!this._client)return;const e=this._config;if(this._surveyManager)return;if(this._isInitializingSurveys)return void iv.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void iv.info(eb);if(e.cookielessMode&&this._client.isOptedOut)return void iv.info("Not loading surveys in cookieless mode without consent.");const t=this._configSource.getExtensions();if(!t)return void this._handleSurveyLoadError("PostHog Extensions not found.");if(It(this._isSurveysEnabled)&&!e.advancedEnableSurveys)return;const i=this._isSurveysEnabled||e.advancedEnableSurveys;this._isInitializingSurveys=!0,this._surveyInitializationFailed=!1;try{const e=t.generateSurveys;if(e)return this._completeSurveyInitialization(e,i),void(this._isInitializingSurveys=!1);const n=t.loadExternalDependency;if(!n)return this._handleSurveyLoadError(R),void(this._isInitializingSurveys=!1);n(e=>{try{if(this._disposed)return;const t=this._configSource.getExtensions();e||!(null==t?void 0:t.generateSurveys)?this._handleSurveyLoadError("Could not load surveys script",e):this._completeSurveyInitialization(t.generateSurveys,i)}finally{this._isInitializingSurveys=!1}})}catch(e){throw this._isInitializingSurveys=!1,this._handleSurveyLoadError("Error initializing surveys",e),e}}_completeSurveyInitialization(e,t){var i;if(this._disposed)return;this._surveyManager=e(t),this._surveyEventReceiver=this._createEventReceiver(this._client,this._notifyActiveMatchingSurveyCallbacks);const n=null===(i=this._client)||void 0===i?void 0:i.kv.get(M);n&&this._registerEventOrActionBasedSurveys(n),iv.info("Surveys loaded successfully"),this._startActiveMatchingSurveyConditions(),this._notifyActiveMatchingSurveyCallbacks(),this._notifySurveyCallbacks({isLoaded:!0})}_createEventReceiver(e,t){return new Zy(e,this,void 0,t)}_handleSurveyLoadError(e,t){this._surveyInitializationFailed=!0,iv.error(e,t),this._notifyActiveMatchingSurveyCallbacks({isLoaded:!1,error:e}),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter(t=>t!==e)}}getSurveys(e,t=!1){if(this._disposed)return;const i=this._client;if(!i)return e([],{isLoaded:!1,error:Xy});if(this._config.disableSurveys)return iv.info(eb),e([]);const n=i.kv.get(M);if(n&&!t)return e(n,{isLoaded:!0}),void(this._shouldBackgroundRefreshSurveys()&&this.getSurveys(()=>{},!0));if(this._getSurveysInFlightPromise)return void this._getSurveysInFlightPromise.then(({surveys:t,context:i})=>{this._disposed||e(t,i)}).catch(e=>iv.error("Error in survey callback",e));const s=i.sendRequest("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this._config.requestTimeoutMs}).then(e=>{try{return this._handleSurveyResponse(i,e)}catch(e){return iv.error("Error processing surveys response",e),this._handleSurveyResponse(i,{statusCode:0,error:e})}},e=>this._handleSurveyResponse(i,{statusCode:0,error:e}));this._getSurveysInFlightPromise=s;const r=()=>{this._getSurveysInFlightPromise===s&&(this._getSurveysInFlightPromise=null)};s.then(t=>{r(),this._disposed||(this._notifyActiveMatchingSurveyCallbacks(t.context),e(t.surveys,t.context))},r).catch(e=>iv.error("Error in survey callback",e))}_handleSurveyResponse(e,t){if(this._disposed)return{surveys:[],context:{isLoaded:!1,error:Xy}};const i=t.statusCode;if(200!==i||!t.json){const e=`Surveys API could not be loaded, status: ${i}`;return 0!==i?iv.error(e):t.error||iv.warn(e),this._lastSurveyRefreshFailedAt=Date.now(),{surveys:[],context:{isLoaded:!1,error:e}}}this._lastSurveyRefreshFailedAt=null;const n=t.json.surveys||[];return e.kv.set({[M]:n,[P]:Date.now()}),this._registerEventOrActionBasedSurveys(n),{surveys:n,context:{isLoaded:!0}}}_registerEventOrActionBasedSurveys(e){const t=e.filter(e=>sv(e)&&(cc(e)||rv(e)));this._registerSurveyTriggers(t)}_registerSurveyTriggers(e){var t;null===(t=this._surveyEventReceiver)||void 0===t||t.replace(e)}_shouldBackgroundRefreshSurveys(){return this._isSurveyCacheStale()&&!this._getSurveysInFlightPromise&&!this._isSurveyRefreshBackingOff()}_isSurveyCacheStale(){var e;const t=null===(e=this._client)||void 0===e?void 0:e.kv.get(P);return Ft(t)&&Date.now()-t>3e5}_isSurveyRefreshBackingOff(){return Ft(this._lastSurveyRefreshFailedAt)&&3e5>Date.now()-this._lastSurveyRefreshFailedAt}markSurveyAsSeen(e,t){var i;const n={id:e,current_iteration:null!==(i=null==t?void 0:t.iteration)&&void 0!==i?i:null};lv(n);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}this._notifyActiveMatchingSurveyCallbacks()}_notifySurveyCallbacks(e){for(const t of this._surveyCallbacks){if(this._disposed)return;try{e.isLoaded?this.getSurveys(t):t([],e)}catch(e){iv.error("Error in survey callback",e)}}}getActiveMatchingSurveys(e,t=!1){if(!Rt(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);iv.warn("init was not called")}onActiveMatchingSurveysChanged(e){var t;if(this._disposed)return()=>{};const i={callback:e,active:!0,revision:0};this._activeMatchingSurveyCallbacks.push(i),this._startActiveMatchingSurveyConditions();const n=null===(t=this._client)||void 0===t?void 0:t.kv.get(M);return this._config.disableSurveys||!this._surveyManager&&this._surveyInitializationFailed&&!this._isInitializingSurveys||!n&&!Rt(this._lastSurveyRefreshFailedAt)&&!this._getSurveysInFlightPromise?this._notifyActiveMatchingSurveyCallback(i,{isLoaded:!1}):this._surveyManager&&this._notifyActiveMatchingSurveyCallback(i),()=>{var e;i.active=!1,this._activeMatchingSurveyCallbacks=this._activeMatchingSurveyCallbacks.filter(e=>e!==i),0===this._activeMatchingSurveyCallbacks.length&&(null===(e=this._activeMatchingSurveyConditionsUnsubscribe)||void 0===e||e.call(this),this._activeMatchingSurveyConditionsUnsubscribe=void 0)}}_startActiveMatchingSurveyConditions(){var e,t,i;this._surveyManager&&this._activeMatchingSurveyCallbacks.length>0&&(null!==(e=this._activeMatchingSurveyConditionsUnsubscribe)&&void 0!==e||(this._activeMatchingSurveyConditionsUnsubscribe=null===(t=(i=this._configSource).onMatchingConditionsChanged)||void 0===t?void 0:t.call(i,this._notifyActiveMatchingSurveyCallbacks)))}_notifyActiveMatchingSurveyCallback(e,t){if(this._disposed||!e.active)return;const i=++e.revision,n=n=>{if(!this._disposed&&e.active&&i===e.revision)try{const i=null!=t?t:{isLoaded:!0},s=JSON.stringify([n,i]);if(s===e.lastResult)return;e.lastResult=s,e.callback(n,i)}catch(e){iv.error("Error in active matching surveys callback",e)}};try{t&&!t.isLoaded?n([]):this.getActiveMatchingSurveys(n)}catch(e){iv.error("Error in active matching surveys callback",e)}}_getSurveyById(e){let t=null;return this.getSurveys(i=>{var n;t=null!==(n=i.find(t=>t.id===e))&&void 0!==n?n:null}),t}_checkSurveyEligibility(e){if(Rt(this._surveyManager))return{eligible:!1,reason:Xy};const t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}_checkSurveyRenderability(e){var t;if(!(null===(t=this._client)||void 0===t?void 0:t.canCapture))return{eligible:!1,reason:nv};if(Rt(this._surveyManager))return{eligible:!1,reason:Xy};const i="string"==typeof e?this._getSurveyById(e):e;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Rt(this._surveyManager))return iv.warn("init was not called"),{visible:!1,disabledReason:Xy};const t=this._checkSurveyRenderability(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Rt(this._surveyManager)?(iv.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Xy})):new Promise(i=>{this.getSurveys(t=>{var n;const s=null!==(n=t.find(t=>t.id===e))&&void 0!==n?n:null;if(s){const e=this._checkSurveyRenderability(s);i({visible:e.eligible,disabledReason:e.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var n,s,r;if(!(null===(n=this._client)||void 0===n?void 0:n.canCapture))return;if(Rt(this._surveyManager))return void iv.warn("init was not called");const o="string"==typeof e?this._getSurveyById(e):e;if(!(null==o?void 0:o.id))return void iv.warn("Survey not found");if(!cv.includes(o.type))return void iv.warn(`Surveys of type ${o.type} cannot be rendered in the app`);const a=null===(s=typeof document>"u"?void 0:document)||void 0===s?void 0:s.querySelector(t);if(a){if(null===(r=o.appearance)||void 0===r?void 0:r.surveyPopupDelaySeconds){iv.info(`Rendering survey ${o.id} with delay of ${o.appearance.surveyPopupDelaySeconds} seconds`);const e=setTimeout(()=>{var t,n,s;this._renderTimeouts.delete(e),!this._disposed&&(null===(t=this._client)||void 0===t?void 0:t.canCapture)&&(iv.info(`Rendering survey ${o.id} with delay of ${null===(n=o.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds} seconds`),null===(s=this._surveyManager)||void 0===s||s.renderSurvey(o,a,i),iv.info(`Survey ${o.id} rendered`))},1e3*o.appearance.surveyPopupDelaySeconds);return void this._renderTimeouts.add(e)}this._surveyManager.renderSurvey(o,a,i)}else iv.warn("Survey element not found")}displaySurvey(e,t){var i,n;if(!(null===(i=this._client)||void 0===i?void 0:i.canCapture))return;if(Rt(this._surveyManager))return void iv.warn("init was not called");const s=this._getSurveyById(e);if(!s)return void iv.warn("Survey not found");let r=s;if((null===(n=s.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)&&t.ignoreDelay&&(r=ct(ct({},s),{},{appearance:ct(ct({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==tv&&t.initialResponses&&iv.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){const e=this._checkSurveyEligibility(s);if(!e.eligible)return void iv.warn("Survey is not eligible to be displayed: ",e.reason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}cancelPendingSurvey(e){Rt(this._surveyManager)?iv.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;null===(e=this._surveyManager)||void 0===e||null===(t=e.handlePageUnload)||void 0===t||t.call(e)}},ib=class{constructor(e){this.disabled=!1===e;const t=xt(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;const n=this.clicks[this.clicks.length-1];if(n&&Math.abs(e-n.x)+Math.abs(t-n.y)<this.thresholdPx&&this.timeoutMs>i-n.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}};const nb=()=>typeof window>"u"?void 0:window,sb=()=>typeof document>"u"?void 0:document,rb="$copy_autocapture",ob=["password","hidden","file","checkbox","button","submit","reset","image"],ab=Nr("[AutoCapture]");function lb(e,t){return t.length>e?t.slice(0,e)+"...":t}function cb(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do{t=t.previousSibling}while(t&&!co(t));return t}function ub(e,{e:t,maskAllElementAttributes:i,maskAllText:n,elementAttributeIgnoreList:s,elementsChainAsString:r,disableCaptureUrlHashes:o}){var a,l;if(!co(e))return{props:{}};const c=[e],u=new Set([e]);let d=e;for(;d.parentNode&&!uo(d,"body")&&1e3>c.length;){if(po(d.parentNode)){const e=d.parentNode.host;if(u.has(e))break;u.add(e),c.push(e),d=e;continue}if(!co(d.parentNode))break;if(u.has(d.parentNode))break;u.add(d.parentNode),c.push(d.parentNode),d=d.parentNode}const h="click"===t.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?c.findIndex(e=>uo(e,"button")||uo(e,"a")):-1;h>0&&(n=n||c.slice(0,h+1).some(e=>!qo(e)||Ho(e)));const p=[],g={};let _,f=!1,v=!1;if(qr(c,e=>{const t=qo(e);if(uo(e,"a")&&!i&&!(null==s?void 0:s.includes("href"))){const i=e.getAttribute("href");f=!!(t&&i&&Ko(i))&&(o?un(i):i)}ft(fo(e),"ph-no-capture")&&(v=!0),p.push(function(e,t,i,n,s=!1){const r=e.tagName.toLowerCase(),o={tag_name:r};bo.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?lb(1024,Jo(e)):lb(1024,mo(e)));const a=fo(e);t||(null==n?void 0:n.includes("class"))||0>=a.length||(o.classes=a.filter(function(e){return""!==e})),qr(e.attributes,function(i){var r;if((!Ho(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==n?void 0:n.includes(i.name))&&!t&&Ko(i.value)&&(!Tt(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let e=i.value;"class"===i.name&&(e=go(e).join(" ")),o["attr__"+i.name]=lb(1024,"href"===i.name&&s?un(e):e)}});let l=1,c=1,u=e;for(;u=cb(u);)l++,u.tagName===e.tagName&&c++;return o.nth_child=l,o.nth_of_type=c,o}(e,i,n,s,o)),qr(function(e){if(!qo(e))return{};const t={};return qr(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){const i=e.name.replace("data-ph-capture-attribute-",""),n=e.value;i&&n&&Ko(n)&&(t[i]=n)}}),t}(e),(e,t)=>{({}).hasOwnProperty.call(g,t)||(g[t]=e)})}),v)return{props:{},explicitNoCapture:v};if(h>0&&(e=c[h],p.splice(0,h)),n||(p[0].$el_text=uo(e,"a")||uo(e,"button")?Jo(e):mo(e)),f){var m,y;p[0].attr__href=f;const e=null===(m=Jr(f))||void 0===m?void 0:m.host,t=null===(y=nb())||void 0===y||null===(y=y.location)||void 0===y?void 0:y.host;e&&t&&e!==t&&(_=f)}return{props:Hr((S=t.type,{$event_type:S,$ce_version:1}),r?{}:{$elements:p},{$elements_chain:(b=p,kt(b)?function(e){return e.map(e=>{var t,i;let n="";if(e.tag_name&&(n+=e.tag_name),e.attr_class){e.attr_class.sort();for(const t of e.attr_class)n+=`.${t.replace(/"/g,"")}`}const s=ct(ct(ct(ct({},e.text?{text:e.text}:{}),{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),r={};return zr(s).sort(([e],[t])=>function(e,t){return t>e?-1:e>t?1:0}(e,t)).forEach(([e,t])=>r[Yo(e.toString())]=Yo(t.toString())),n+=":",n+=zr(r).map(([e,t])=>`${e}="${t}"`).join(""),n}).join(";")}(function(e){return e.map(e=>{var t,i;const n={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(i=e.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:Xo(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return zr(e).filter(([e])=>0===e.indexOf("attr__")).forEach(([e,t])=>n.attributes[e]=t),n})}(b)):"")},(null===(a=p[0])||void 0===a?void 0:a.$el_text)?{$el_text:null===(l=p[0])||void 0===l?void 0:l.$el_text}:{},_&&"click"===t.type?{$external_click_url:_}:{},g),target:e};var b,S}const db="autocapture";var hb=class{_clearPointer(){this._pointerDown=void 0,clearTimeout(this._pointerExpiry),this._pointerExpiry=void 0}_isExcludedPointerTarget(e){var t;if(!qo(e))return!0;const i=null!==(t=this._refreshConfig().css_selector_ignorelist)&&void 0!==t?t:Co,n=new Set;let s=e;for(;s;){if(n.size>=1e3||n.has(s))return!0;n.add(s);const e=s,t=fo(e);if(ft(t,"ph-no-capture")||ft(t,"ph-sensitive")||Ho(e)||i.some(t=>So(e,t)))return!0;const r=s.parentNode;s=po(r)?r.host:r&&co(r)?r:null}return!1}_trackPointer(e){if(!this.isEnabled||"pointercancel"===e.type)return void this._clearPointer();if("pointerdown"===e.type){var t;this._clearPointer();const i=yo(e);return void(e.isPrimary&&0===e.button&&!e.ctrlKey&&i&&co(i)&&(this._pointerDown={target:i,excluded:this._isExcludedPointerTarget(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:null===(t=this._client)||void 0===t?void 0:t.distinctId}))}const i=this._pointerDown;i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this._clearPointer():"pointerup"===e.type&&(i.released=!0,this._pointerExpiry=setTimeout(()=>this._clearPointer(),0)))}_recoverClickTarget(e){var t;const i=this._pointerDown;this._clearPointer();const n=yo(e);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(t=this._client)||void 0===t?void 0:t.distinctId)&&e.pointerId===i.id&&(e.detail>0||"touch"===e.pointerType||"pen"===e.pointerType)&&0===e.button&&5>=Math.abs(e.clientX-i.x)&&5>=Math.abs(e.clientY-i.y)&&n&&(uo(n,"html")||uo(n,"body"))){var s,r,o;if(i.excluded)return null;const e=null!==(s=this._refreshConfig().css_selector_ignorelist)&&void 0!==s?s:Co;return[n,null===(r=sb())||void 0===r?void 0:r.documentElement,null===(o=sb())||void 0===o?void 0:o.body].some(t=>{if(!t)return!1;const i=fo(t);return ft(i,"ph-no-capture")||ft(i,"ph-sensitive")||!qo(t)||Ho(t)||e.some(e=>So(t,e))})?null:i.target}}constructor(e){this._configSource=e,this.name=db,this._initialized=!1,this._isDisabledServerSide=null,this._hasReceivedConfigResponse=!1,this._elementSelectorsByOwner=new Map,this._elementsChainAsString=!1,this._config={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this._disposed=!1,this._configSource.refresh(this._config),this.rageclicks=new ib(this._config.rageclick),this._elementSelectors=null}setup(e){this._compileUrlPatterns(),this._client=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.startIfEnabled())}dispose(){var e;this._disposed||(this._disposed=!0,this._client=void 0,null===(e=this._remoteConfigSubscription)||void 0===e||e.dispose(),this._remoteConfigSubscription=void 0,this._elementSelectorsByOwner.clear(),this._elementSelectors=null,this._removeDomEventHandlers())}_refreshConfig(){return this._configSource.refresh(this._config),this._config}_compileUrlPatterns(){var e,t;return this._refreshConfig(),this._config.url_allowlist=null===(e=this._config.url_allowlist)||void 0===e?void 0:e.map(e=>new RegExp(e)),this._config.url_ignorelist=null===(t=this._config.url_ignorelist)||void 0===t?void 0:t.map(e=>new RegExp(e)),this._config}_addDomEventHandlers(){const e=nb(),t=sb();if(!this.isBrowserSupported())return void ab.info("Disabling Automatic Event Collection because this browser is not supported");if(!e||!t)return;this._listenerWindow=e,this._listenerDocument=t;const i=this._domEventHandler=t=>{t=t||(null==e?void 0:e.event);try{if("blur"===t.type)return void this._clearPointer();if(0===t.type.indexOf("pointer"))return void this._trackPointer(t);const e="click"===t.type?this._recoverClickTarget(t):void 0;if(Pt(e))return;this._captureEvent(t,"$autocapture",e)}catch(e){ab.error("Failed to capture event",e)}};if(Qr(e,"blur",i),Qr(t,"submit",i,{capture:!0}),Qr(t,"change",i,{capture:!0}),Qr(t,"click",i,{capture:!0}),qr(["pointerdown","pointermove","pointerup","pointercancel"],e=>{Qr(t,e,i,{capture:!0})}),this._refreshConfig().capture_copied_text){const i=this._copiedTextHandler=t=>{t=t||(null==e?void 0:e.event);try{this._captureEvent(t,rb)}catch(e){ab.error("Failed to capture clipboard event",e)}};Qr(t,"copy",i,{capture:!0}),Qr(t,"cut",i,{capture:!0}),Qr(t,"paste",i,{capture:!0})}}_removeDomEventHandlers(){const e=this._listenerWindow,t=this._listenerDocument;this._clearPointer(),this._domEventHandler&&(null==e||e.removeEventListener("blur",this._domEventHandler),qr(["pointerdown","pointermove","pointerup","pointercancel"],e=>{null==t||t.removeEventListener(e,this._domEventHandler,!0)}),null==t||t.removeEventListener("submit",this._domEventHandler,!0),null==t||t.removeEventListener("change",this._domEventHandler,!0),null==t||t.removeEventListener("click",this._domEventHandler,!0),this._domEventHandler=void 0),this._copiedTextHandler&&(null==t||t.removeEventListener("copy",this._copiedTextHandler,!0),null==t||t.removeEventListener("cut",this._copiedTextHandler,!0),null==t||t.removeEventListener("paste",this._copiedTextHandler,!0),this._copiedTextHandler=void 0),this._listenerWindow=void 0,this._listenerDocument=void 0,this._initialized=!1}startIfEnabled(){this.isEnabled||this._clearPointer(),!this._disposed&&this._client&&this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){if(this._disposed)return;if(this._hasReceivedConfigResponse=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString);const i=t.autocapture_opt_out;var n;Lt(i)&&(null===(n=this._client)||void 0===n||n.kv.set("$autocapture_disabled_server_side",i),this._isDisabledServerSide=i),this.startIfEnabled()}setElementSelectors(e,t=this){if(this._disposed)return;e.size?this._elementSelectorsByOwner.set(t,new Set(e)):this._elementSelectorsByOwner.delete(t);const i=new Set;this._elementSelectorsByOwner.forEach(e=>{e.forEach(e=>i.add(e))}),this._elementSelectors=i}getElementSelectors(e,t){var i;const n=[];return null===(i=this._elementSelectors)||void 0===i||i.forEach(i=>{var s;const r=null===(s=sb())||void 0===s?void 0:s.querySelectorAll(i);null==r||r.forEach(s=>{e!==s&&t!==s||ft(n,i)||n.push(i)})}),n}get isEnabled(){var e,t;if(this._disposed)return!1;const i=null===(e=this._client)||void 0===e?void 0:e.kv.get(T),n=this._isDisabledServerSide,s=this._refreshConfig();if(!s.remoteRequestsDisabled&&!this._hasReceivedConfigResponse)return!1;const r=s.remoteRequestsDisabled&&!this._hasReceivedConfigResponse;if(Pt(n)&&!Lt(i)&&!r)return!1;const o=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!s.enabled&&!o}_captureEvent(e,t="$autocapture",i){if(!this.isEnabled)return void this._clearPointer();let n=i||yo(e);ho(n)&&(n=n.parentNode||null);const s=this._compileUrlPatterns();var r;"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&s.rageclick&&(null===(r=this.rageclicks)||void 0===r?void 0:r.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&$o(n,s.rageclick)&&this._captureEvent(e,"$rageclick",i);const o=t===rb,a=o?ct(ct({},s),{},{dom_event_allowlist:void 0}):s;if(n&&function(e,t,i,n,s,r){var o;const a=typeof window>"u"?void 0:window;if(!a||No(e))return!1;if((null==i?void 0:i.url_allowlist)&&!_o(i.url_allowlist,r))return!1;if((null==i?void 0:i.url_ignorelist)&&_o(i.url_ignorelist,r))return!1;if(null==i?void 0:i.dom_event_allowlist){const e=i.dom_event_allowlist;if(e&&!e.some(e=>t.type===e))return!1}const{parentIsUsefulElement:l,targetElementList:c}=Bo(e,n);if(!function(e,t){const i=null==t?void 0:t.element_allowlist;if(It(i))return!0;for(const t of e)if(i.some(e=>t.tagName.toLowerCase()===e))return!0;return!1}(c,i))return!1;if(!wo(c,null==i?void 0:i.css_selector_allowlist))return!1;if(wo(c,null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Co))return!1;try{const i=a.getComputedStyle(e);if(i&&"pointer"===i.getPropertyValue("cursor")&&"click"===t.type)return!0}catch(e){}const u=e.tagName.toLowerCase();switch(u){case"html":return!1;case"form":return(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return l?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(bo.indexOf(u)>-1||"true"===e.getAttribute("contenteditable"))}}(n,e,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:s.getCurrentUrl}})){var l;const{props:i,explicitNoCapture:r,target:o}=ub(n,{e:e,maskAllElementAttributes:s.maskAllElementAttributes,maskAllText:s.maskAllText,elementAttributeIgnoreList:s.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString,disableCaptureUrlHashes:s.disableCaptureUrlHashes});if(r)return!1;const a=this.getElementSelectors(n,o);if(a&&a.length>0&&(i.$element_selectors=a),t===rb){const t=e.type||"clipboard";if("paste"!==t){var c,u;const e=null===(c=nb())||void 0===c||null===(c=c.getSelection())||void 0===c?void 0:c.toString(),t=vo(e);if(!t)return!1;i.$selected_content=t,i.$clipboard_text_length=null!==(u=null==e?void 0:e.length)&&void 0!==u?u:0}i.$copy_type=t}if("$autocapture"===t&&"change"===e.type&&s.capture_value_css_selector_allowlist&&!s.maskAllText&&(uo(d=n,"input")?!ft(ob,d.type):uo(d,"textarea")||uo(d,"select")&&!d.multiple)&&function(e,t){var i;if(!qo(e))return!1;const n=null!==(i=t.css_selector_ignorelist)&&void 0!==i?i:Co,s=new Set;let r=e;for(uo(e,"select")&&(r=e.options[e.selectedIndex]||e);r;){const e=r,t=fo(e);if(s.size>=1e3||s.has(r)||ft(t,"ph-sensitive")||ft(t,"ph-no-capture")||n.some(t=>So(e,t)))return!1;s.add(r);const i=r.assignedSlot||r.parentNode;r=po(i)?i.host:i&&co(i)?i:null}return!0}(n,s)&&!n.querySelector(".ph-no-capture, .ph-sensitive")){const e=s.capture_value_css_selector_allowlist;let t=!1;try{t=Ct(e)?!!e(n):kt(e)&&e.some(e=>So(n,e))}catch(e){ab.error("capture_value_css_selector_allowlist threw",e)}t&&(i.$input_value=n.value)}return null===(l=this._client)||void 0===l||l.capture(t,i),!0}var d}isBrowserSupported(){var e;return Ct(null===(e=sb())||void 0===e?void 0:e.querySelectorAll)}};const pb="featureFlags",gb="logs",_b=!!o||!!r,fb=new WeakMap,vb="text/plain";let mb=0,yb=!1;const bb=(e,t)=>{const[i,n]=e.split("#"),[s,r]=i.split("?");if(!r)return e;const o=r.split("&").filter(e=>e.split("=")[0]!==t).join("&");return`${s}${o?`?${o}`:""}${n?`#${n}`:""}`},Sb=(e,t,i=!0)=>{var n;const[s,r]=e.split("?"),o=ct({},t),a=null!==(n=null==r?void 0:r.split("&").map(e=>{var t;const[n,s]=e.split("="),r=i&&null!==(t=o[n])&&void 0!==t?t:s;return delete o[n],`${n}=${r}`}))&&void 0!==n?n:[],l=io(o);return l&&a.push(l),a.length>0?`${s}?${a.join("&")}`:s},wb=e=>{if(e._encodedBody)return e._encodedBody;const{data:t,compression:i}=e;if(!t)return;if(i===Wy){const e=vl(ml(to(t)),{mtime:0});return{contentType:vb,body:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),estimatedSize:e.byteLength}}if(i===jy){const e=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):e}(to(t)),i=(e=>"data="+encodeURIComponent("string"==typeof e?e:to(e)))(e);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const n=to(t);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}},kb=e=>{const t=()=>"sendBeacon"===e.transport?{url:Sb(e.url,{compression:jy}),encodedBody:wb(ct(ct({},e),{},{compression:jy,_encodedBody:void 0}))}:{url:bb(e.url,"compression"),encodedBody:wb(ct(ct({},e),{},{compression:void 0,_encodedBody:void 0}))};let i;try{i=wb(e)}catch(i){if(hs(e.compression,no(e.url,"compression")))return $r.error("Failed to gzip request body, sending uncompressed payload",i),t();throw i}return i&&hs(e.compression,no(e.url,"compression"))&&!((n=i.body)instanceof ArrayBuffer?ds(new Uint8Array(n)):ArrayBuffer.isView(n)&&ds(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(yb=!0,t()):{url:e.url,encodedBody:i};var n},Cb=e=>{try{return kb(e)}catch(i){var t;return $r.error(i),void(null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0,error:i}))}},xb=function(){var e=rt(function*(e){const t=yield ms(to(e.data),Jl.DEBUG,{rethrow:!0});if(!t)return e;const i=yield t.arrayBuffer();return ct(ct({},e),{},{_encodedBody:{contentType:vb,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}}(),Eb=/Failed to fetch|NetworkError|Load failed/i,Ib=e=>"TypeError"===(null==e?void 0:e.name)&&Eb.test((null==e?void 0:e.message)||""),Tb=e=>{try{const t=function(e,t=Date.now(),i=3e5){if("string"!=typeof e||!e)return;const n=e.trim(),s=/^\d+\s*,/.test(n)?n.slice(0,n.indexOf(",")).trim():n;if(/^\d+$/.test(s)){const e=1e3*Math.min(Number(s),i/1e3);return e>0?e:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(s))return;const r=/^\w{3} \w{3} /.test(s)?s+" GMT":s,o=Date.parse(r)-t;return Number.isFinite(o)&&o>0?Math.min(o,i):void 0}(e());return It(t)?void 0:Math.min(t,3e4)}catch(e){return}},Mb=e=>{const t=Cb(e);if(!t)return;const i=new o;fb.set(i,!0);const{url:n,encodedBody:s}=t;i.open(e.method||"GET",n,!0);const{contentType:r,body:a}=null!=s?s:{};qr(e.headers,function(e,t){i.setRequestHeader(t,e)}),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t;const n={statusCode:i.status,text:i.responseText};if(200===i.status)try{n.json=JSON.parse(i.responseText)}catch(e){}null===(t=e.callback)||void 0===t||t.call(e,n,Tb(()=>i.getResponseHeader("Retry-After")))}},i.send(a)},Pb=e=>{const t=Cb(e);if(!t)return;const{url:i,encodedBody:n}=t,{contentType:s,body:o,estimatedSize:l}=null!=n?n:{},c=new Headers;qr(e.headers,function(e,t){c.append(t,e)}),s&&c.append("Content-Type",s);let u=null,d=!1;if(a){const t=new a;u={signal:t.signal,timeout:setTimeout(()=>{d=!0;try{t.abort(cn("AbortError","PostHog request timed out"+((i=e.timeout)?` after ${i}ms`:"")))}catch(e){p(e)}var i},e.timeout)}}let h=!1;const p=t=>{var i;h||(h=!0,d&&"AbortError"===(null==t?void 0:t.name)||Ib(t)?$r.warn(t):$r.error(t),null===(i=e.callback)||void 0===i||i.call(e,{statusCode:0,error:t}))};let g=0;const _=()=>{mb-=g,g=0,u&&clearTimeout(u.timeout)};try{const t=ct({method:(null==e?void 0:e.method)||"GET",headers:c,referrerPolicy:"strict-origin",body:o,signal:null==u?void 0:u.signal},e.fetchOptions),n=null!=l?l:It(o)?0:void 0;t.keepalive="POST"===t.method&&!e._keepaliveDisabled&&!1!==t.keepalive&&t.body===o&&!It(n)&&n>=0&&52428.8>mb+n,t.keepalive&&(g=n,mb+=g),r(i,t).then(t=>t.text().then(i=>{var n;if(h)return;const s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){$r.error(e)}h=!0,_(),null===(n=e.callback)||void 0===n||n.call(e,s,Tb(()=>t.headers.get("Retry-After")))})).catch(e=>{_(),p(e)}).finally(_)}catch(e){_(),p(e)}},Rb=e=>{try{var t;const{url:n,encodedBody:s}=kb(e),{contentType:o,body:a,estimatedSize:l}=null!=s?s:{};if(!a)return;const c=a instanceof Blob?a:new Blob([a],{type:o});if(i.sendBeacon(n,c))return;const u=kt(e.data)?e.data:null===(t=e.data)||void 0===t?void 0:t.batch;if(kt(u)&&u.length>1&&(null!=l?l:0)>16384){const t=Math.ceil(u.length/2),i=t=>kt(e.data)?t:ct(ct({},e.data),{},{batch:t});return Rb(ct(ct({},e),{},{data:i(u.slice(0,t))})),void Rb(ct(ct({},e),{},{data:i(u.slice(t))}))}$r.warn(`Beacon of ~${null!=l?l:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?Pb(ct(ct({},e),{},{_keepaliveDisabled:!0})):Mb(e)}catch(e){$r.warn("Beacon send failed",e)}},Fb=(e,t,i,n)=>{const s="query"===n?"POST"===t?"sent_at":"_":void 0;return Sb(i===Wy?bb(e,"compression"):e,ct(ct({},s?{[s]:Date.now().toString()}:{}),i===Wy?{}:{compression:i}))},Ab=(()=>{const e=[];return r&&e.push({transport:"fetch",method:Pb}),o&&e.push({transport:"XHR",method:Mb}),(null==i?void 0:i.sendBeacon)&&e.push({transport:"sendBeacon",method:Rb}),e})();var Lb=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);const i={};for(const n of e){const e=null==t?void 0:t.get_property(n);It(e)||(i[n]=e)}return i}set(e,t){var i;null===(i=this._instance.persistence)||void 0===i||i.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null===(t=this._instance.persistence)||void 0===t||t.unregister(e)}},Ob=class{constructor(e){this.instance=e,this._logger=$r,this.kv=new Lb(e),this.onSession=e=>Vy(this.instance.onSessionId(t=>{try{e(t)}catch(e){this._logger.error("Browser extension session listener failed",e)}})),this.onEvent=e=>Vy(this.instance._addCaptureHook((t,i)=>{if(i)try{e({event:t,properties:i.properties})}catch(e){this._logger.error("Browser extension event listener failed",e)}})),this.onRemoteConfig=e=>{const t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},i=this.instance._internalEventEmitter.on("extensionsRemoteConfig",t);return this.instance._lastRemoteConfig&&t(this.instance._lastRemoteConfig),Vy(i)}}get logger(){return this._logger}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property("$device_id"))&&void 0!==e?e:this.distinctId}get deviceId(){const e=this.instance.get_property(N);return"string"==typeof e?e:void 0}get library(){return{name:Jl.LIB_NAME,version:Jl.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!==(e=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,n,s;const r=null===(e=this.instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==r?void 0:r.sessionId)&&void 0!==t?t:"",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(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return Ct(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get projectToken(){return this.instance.config.token}getExtension(e){let t;switch(e){case pb:case tf:t=this.instance.featureFlags;break;case gb:t=this.instance.logs;break;case"surveys":t=this.instance.surveys;break;case db:t=this.instance.autocapture}return t}capture(e,t,i){if(!i)return void this.instance.capture(e,t);const n=ct({timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce},"unload"===i.delivery?{transport:"sendBeacon",send_instantly:!0}:{});this.instance.capture(e,t,n)}registerDynamicEventProperties(e){return Vy(this.instance._registerExtensionEventProperties(e))}sendRequest(e){var t=this;return rt(function*(e,i={}){var n;const s=null!==(n=i.target)&&void 0!==n?n:"api",r=i.query?Sb(e,i.query):e,o=t.instance.requestRouter.endpointFor(s,r),a={method:i.method,url:o,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?dt.Base64:void 0,timestampMode:i.sentAt};return"api"===s&&"/i/v1/logs"===e&&(a.batchKey="logs"),"sendBeacon"===i.transport?(t.instance._send_request(a),{statusCode:202}):new Promise(e=>{a.callback=e,t.instance._send_request(a)})}).apply(this,arguments)}},Db=class{constructor(e){this._instance=e}get(){var e,t,i,n;const s=null===(e=this._instance)||void 0===e?void 0:e.config;return{disableSurveys:!!(null==s?void 0:s.disable_surveys),cookielessMode:!!(null==s?void 0:s.cookieless_mode),advancedEnableSurveys:!!(null==s?void 0:s.advanced_enable_surveys),requestTimeoutMs:null!==(t=null==s?void 0:s.surveys_request_timeout_ms)&&void 0!==t?t:1e4,prefillFromUrl:!!(null==s||null===(i=s.surveys)||void 0===i?void 0:i.prefillFromUrl),automaticDisplay:!(null==s?void 0:s.disable_surveys_automatic_display),featureFlagEvaluation:!(null==s?void 0:s.advanced_disable_feature_flags),overrideLanguage:null==s?void 0:s.override_display_language,prepareStylesheet:null==s?void 0:s.prepare_external_dependency_stylesheet,get_current_url:null==s?void 0:s.get_current_url,uiHost:null===(n=this._instance)||void 0===n||null===(n=n.requestRouter)||void 0===n?void 0:n.endpointFor("ui","")}}getExtensions(){const e=null==d?void 0:d.__PosthogExtensions__;if(!e||!this._instance)return;const t=this._instance,{generateSurveys:i,loadExternalDependency:n}=e;return{generateSurveys:i?e=>i(t,e):void 0,loadExternalDependency:n?e=>n(t,"surveys",e):void 0}}onMatchingConditionsChanged(t){var i,n;const s=null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook(e=>{"$pageview"!==e&&e!==Vf&&e!==Gf&&e!==Qf||t()}),r=()=>t();Qr(e,"PHSurveyShown",r);let o=!1;const a=null===(n=this._instance)||void 0===n?void 0:n.onFeatureFlags(()=>{o&&t()});return o=!0,()=>{o=!1,null==s||s(),null==a||a(),null==e||e.removeEventListener("PHSurveyShown",r)}}};const $b=new WeakMap,Nb=(e,t)=>{const i=function(e){var t;const i=new Db(e);if(!e)return{get config(){return i.get()}};if(null===(t=e.surveys)||void 0===t?void 0:t.getRenderContext)return e.surveys.getRenderContext();let n=$b.get(e);return n||(n={client:new Ob(e),get config(){return i.get()},surveys:e.surveys},$b.set(e,n)),n}(e);return i?function(e,t){if(typeof document>"u"||typeof window>"u")return;const i=new Dy(e);return!1===e.config.automaticDisplay?(iv.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i):!1===t?(iv.info("There are no surveys to load or Surveys is disabled in the project settings."),i):(i.startAutomaticDisplay(),i)}(i,t):void 0};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.generateSurveys=Nb,d.extendPostHogWithSurveys=Nb;const Bb=e=>{for(;null==e?void 0:e.__rrweb_original__;)e=e.__rrweb_original__;return e},qb=1e4,Hb=(e,t,i)=>i.remaining>0?t.length>i.remaining?(e.push(t.slice(0,i.remaining)),i.remaining=0,i.truncated=!0,!1):(e.push(t),i.remaining-=t.length,!0):(i.truncated=!0,!1),zb=(e,t,i)=>{const n=JSON.stringify(e);if(i.remaining>=n.length)return Hb(t,n,i);if(i.truncated=!0,2>i.remaining)return!1;let s=0,r=Math.min(e.length,i.remaining-2);for(;r>s;){const t=Math.ceil((s+r)/2);JSON.stringify(e.slice(0,t)).length>i.remaining?r=t-1:s=t}return Hb(t,JSON.stringify(e.slice(0,s)),i)},Ub=e=>void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e,Wb=(e,t,i)=>{if(!i.truncated){if(i.keysRemaining-=1,i.sizeRemaining-=String(t).length+e.length,0>=i.keysRemaining||0>=i.sizeRemaining)return i.truncated=!0,void(i.result.attributes_truncated=!0);i.result[e]=t}},jb=(e,t,i)=>{if(!i.truncated)if(xt(e)){if(i.seen.has(e))return void Wb(t||"circular","[Circular]",i);i.seen.add(e);try{for(const n in e)try{if(!{}.hasOwnProperty.call(e,n))continue;if(jb(e[n],t?`${t}.${n}`:n,i),i.truncated)break}catch(e){continue}}catch(e){}}else Wb(t,e,i)},Vb=(e,t,i,n,s=!1,r)=>{if(!Ub(e))return!s||Hb(t,"null",i);if(Pt(e)||(e=>{try{return Ft(e)||Lt(e)}catch(e){return!1}})(e))return Hb(t,JSON.stringify(e),i);if("string"==typeof e)return zb(e,t,i);if(!xt(e)&&!kt(e))return Hb(t,JSON.stringify(e),i);if(n.has(e))return zb("[Circular]",t,i);n.add(e);try{const r=e.toJSON;if(Ct(r))return Vb(r.call(e),t,i,n,s)}catch(e){}try{const n={}.toString.call(e);if("[object String]"===n)return zb(String(e.valueOf()),t,i);if("[object Number]"===n||"[object Boolean]"===n)return Hb(t,JSON.stringify(e.valueOf()),i)}catch(e){}if(e instanceof Error){const o={};try{for(const t in e)({}).hasOwnProperty.call(e,t)&&(o[t]=e[t])}catch(e){}try{o.name=e.name}catch(e){}try{o.message=e.message}catch(e){}try{o.stack=e.stack}catch(e){}return Vb(o,t,i,n,s,r)}if(kt(e)){if(!Hb(t,"[",i))return!1;for(let s=0;e.length>s;s++){if(s>0&&!Hb(t,",",i))return!1;let r;try{r=e[s]}catch(e){r=void 0}if(!Vb(r,t,i,n,!0))return!1}return Hb(t,"]",i)}if(!Hb(t,"{",i))return!1;let o=!0;try{for(const s in e){if(!{}.hasOwnProperty.call(e,s))continue;if(0>=i.remaining)return i.truncated=!0,!1;let a;try{a=e[s]}catch(e){continue}if(r)try{jb(a,s,r)}catch(e){}if(!Ub(a))continue;const l=`${o?"":","}${JSON.stringify(s)}:`;if(l.length>=i.remaining)return i.truncated=!0,!1;const c=t.length,u=i.remaining,d=i.truncated;if(!Hb(t,l,i))return!1;const h=t.length,p=Vb(a,t,i,n,!1),g=i.truncated;if(t.length!==h){if(o=!1,!p)return!1}else if(t.length=c,i.remaining=u,i.truncated=p?d:g,!p)return!1}}catch(e){}return Hb(t,"}",i)},Gb=(e,t)=>{const i=[],n={remaining:t,truncated:!1},s=xt(e[0])?{result:{},keysRemaining:50,sizeRemaining:qb,truncated:!1,seen:new WeakSet([e[0]])}:void 0;for(let t=0;e.length>t&&(0>=t||Hb(i," ",n))&&Vb(e[t],i,n,new WeakSet,!1,0===t?s:void 0);t++);return{body:i.join("")+(n.truncated?"...":""),truncated:n.truncated,attributes:(null==s?void 0:s.result)||{}}},Qb={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},Kb=e=>"canCapture"in e,Jb=e=>({console:d.console,hostname:d.location.host,getCapturingLogs(){let t;return t=Kb(e)?e.canCapture?e.getExtension(gb):void 0:(Ct(e.is_capturing)?e.is_capturing():!e.has_opted_out_capturing())?e.logs:void 0,t?{captureConsoleLog:i=>((e,t,i)=>{if(Kb(e))return void t.captureConsoleLog(i);const n=(e=>{const t=/^1\.(\d+)\.(\d+)$/.exec(e);if(!t)return;const i=Number(t[1]),n=Number(t[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"})(e.version),s=n?t[n]:void 0;n?Ct(s)&&s.call(t,i):Ct(t.captureConsoleLog)&&t.captureConsoleLog(i)})(e,t,i),captureBufferedConsoleLog(e,i,n){var s;return null===(s=t.captureBufferedConsoleLog)||void 0===s?void 0:s.call(t,e,i,n)}}:void 0}});d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.logs={initializeLogs:e=>(e=>{const t=e.console;let i=e;const n=[],s={host:e.hostname};let r=!1;const o=()=>{i=void 0;for(const e of n)try{e()}catch(e){}};try{for(const e of Object.keys(Qb)){const o=n=>(...o)=>{let a=!1;try{if(o.length>0&&!r&&i){const t=i.getCapturingLogs();if(t){r=!0,a=!0;const{body:i,truncated:n,attributes:l}=Gb(o,qb),c=ct(ct({},s),n?{body_truncated:"true"}:{}),u={level:Qb[e],body:i,attributes:ct(ct({"log.source":`console.${e}`},c),l)};t.captureConsoleLog(u)}}}catch(e){}finally{a&&(r=!1),n.apply(t,o)}},a=t[e];n.push(Fg(t,e,e=>{const t=o(e);return t.__rrweb_original__=Bb(a),t}))}}catch(e){throw o(),e}return o})(Jb(e)),replayConsoleBuffer:(e,t)=>((e,t)=>{const i=e.getCapturingLogs();if(i)for(const s of t)try{var n;const{body:t,truncated:r,attributes:o}=Gb(s.args,qb);null===(n=i.captureBufferedConsoleLog)||void 0===n||n.call(i,{level:Qb[s.level],body:t,attributes:ct(ct({"log.source":`console.${s.level}`,host:e.hostname},r?{body_truncated:"true"}:{}),o)},s.context,s.occurredAtMs)}catch(e){}})(Jb(e),t)};const Zb=e=>qt(e)&&("RangeError"===e.name&&0===e.message.indexOf("Maximum call stack size exceeded")||"InternalError"===e.name&&"too much recursion"===e.message),Yb=Nr("[Error tracking]"),Xb="webkit-masked-url:",eS=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],tS=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Xb],iS=["__firefox__","__gCrWeb"];function nS(){return new Sn([new zn,new Yn,new Wn,new Un,new Jn,new Kn,new Vn,new Zn],function(e,...t){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=Ln.test(n)?n.replace(Ln,"$1"):n;if(!o.match(/\S*Error: /)){for(const i of t){const t=i(o,e);if(t){s.push(t);const e=Dn(s);if(e){for(let t=a.length-1;t>=0;t--){const i=a[t];if(e.start>=i.start+i.length)break;a.pop()}a.push(e)}break}}if(qn(s,a)>=50)break}}const l=[...a].sort((e,t)=>t.start-e.start),c=l[l.length-1];if(c){const e=Nn(s,c);s.splice(c.start-e,e);for(const t of l)t.start-=e}for(const e of l)$n(s,e);return a.some(e=>0===e.start&&s.length===e.length)&&function(e){const t=e.map(e=>`${e.function}|${e.filename}|${e.lineno}|${e.colno}|${e.module}`);let i=0;for(let e=1;t.length>e;e++)Hn(t,e,i)&&(i=e);e.push(...e.splice(0,i))}(s),function(e){if(!e.length)return[];const t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return ct(ct({},e),{},{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||"?"});var i})}(s)}}("web:javascript",Pn,An))}const sS=Nr("[ExceptionAutocapture]"),rS=nS(),oS=(e,t)=>{try{return e()}catch(e){return t}},aS=(e,t)=>oS(()=>e(t()),void 0),lS=e=>oS(()=>Ct(e)&&Ct(e.call),!1),cS=(e,t)=>oS(()=>{e[t].__POSTHOG_INSTRUMENTED__=!0},void 0),uS=(e,t,i)=>{oS(()=>{var i;null===(i=e[t])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),oS(()=>{e[t]=i},void 0)},dS=t=>{const i=e;i||sS.info("window not available, cannot wrap onerror");const n=oS(()=>i.onerror,void 0);return i.onerror=function(...e){var i;return aS(t,()=>rS.buildFromUnknown((([e,t,i,n,s])=>{if(null!=s)return s;if(Tt(e)&&Tt(t)&&t.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:e,filename:t,lineno:i,colno:n})}catch(t){return e}return e})(e),{mechanism:{handled:!1}})),!!lS(n)&&null!==(i=n(...e))&&void 0!==i&&i},cS(i,"onerror"),()=>uS(i,"onerror",n)},hS=(t,i=!1)=>{const n=e;n||sS.info("window not available, cannot wrap onUnhandledRejection");const s=oS(()=>n.onunhandledrejection,void 0);return n.onunhandledrejection=function(e){var n;return aS(t,()=>rS.buildFromUnknown(e,{mechanism:{handled:!1}})),lS(s)?null!==(n=s(e))&&void 0!==n&&n:i},cS(n,"onunhandledrejection"),()=>uS(n,"onunhandledrejection",s)},pS={wrapOnError:dS,wrapUnhandledRejection:hS,wrapConsoleError(e){const t=console;t||sS.info("console not available, cannot wrap console.error");const i=oS(()=>t.error,void 0);return t.error=function(...t){oS(()=>t.length>1&&Tt(t[0])&&(/^\[PostHog\.js\](?: |$)/.test(t[0])||"rrweb logger error:"===t[0]),!1)||aS(e,()=>{let e;e=1==t.length?t[0]:t.join(" ");const i=t.find(e=>e instanceof Error);return rS.buildFromUnknown(i||e,{mechanism:{handled:!0,type:"onconsole"},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),lS(i)&&i(...t)},cS(t,"error"),()=>uS(t,"error",i)}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.errorWrappingFunctions=pS,d.posthogErrorWrappingFunctions=pS;const gS=(e,t)=>{if(!Ct(null==e?void 0:e.capture))return;const i=null==t?void 0:t.autocaptureExceptions,n=!Pt(i)&&"object"==typeof i&&kt(i.errors_to_ignore)?i.errors_to_ignore.reduce((e,t)=>{try{e.push(new RegExp(t))}catch(e){sS.error("Ignoring invalid legacy exception exclusion rule",t,e)}return e},[]):[],s=t=>{try{var i;null===(i=e.capture)||void 0===i||i.call(e,"$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(e){sS.error("Failed to capture exception for a legacy client",e)}};dS(e=>{n.some(t=>e.$exception_list.some(e=>t.test(e.value||"")))||s(e)}),hS(s,!0)};d.extendPostHogWithExceptionAutoCapture=gS,d.extendPostHogWithExceptionAutocapture=gS;const _S="X-POSTHOG-SESSION-ID",fS="X-POSTHOG-WINDOW-ID",vS="X-POSTHOG-DISTINCT-ID",mS=[_S,fS,vS],yS=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],bS=(e,t)=>({}.hasOwnProperty.call(e,t)),SS=e=>"object"==typeof e&&!Pt(e)||Ct(e),wS=e=>"undefined"!=typeof Request&&(e instanceof Request||"[object Request]"==={}.toString.call(e)),kS=t=>{try{var i;return wS(t)?t.url:new URL(t instanceof URL?t.toString():String(t),null==e||null===(i=e.location)||void 0===i?void 0:i.href).toString()}catch(e){return}},CS=(e,t,i,n,s)=>{let r;try{r=new URL(n).hostname}catch(e){return!1}if(!e)return!1;if(kt(e)&&!e.includes(r))return!1;let o=!1;if(i){const{sessionId:e,windowId:t}=i.checkAndGetSessionAndWindowId(!0);s.set(_S,e),s.set(fS,t),o=!0}const a=(e=>Ct(e)?e():e)(t);return a&&"$posthog_cookieless"!==a&&(s.set(vS,a),o=!0),o};d.__PosthogExtensions__=d.__PosthogExtensions__||{};const xS={_patchFetch:(t,i,n)=>Fg(e,"fetch",e=>function(s,r){const o=arguments.length>1?[s,r]:[s];let a=o;try{const e=kS(s);if(e)if(wS(s)){const e=new Request(s,r);CS(t,i,n,e.url,e.headers),a=[e]}else{const o=new Headers(SS(r)?r.headers:void 0);if(CS(t,i,n,e,o)){const e=((e,t)=>{if(It(e)||Pt(e))return{headers:t};if(!SS(e))return;const i=e;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){const e=Object.create(i);return Object.defineProperty(e,"headers",{configurable:!0,enumerable:!0,value:t,writable:!0}),e}return new Proxy({headers:t},{get:(e,t)=>bS(e,t)?Reflect.get(e,t):Reflect.get(i,t,i),has:(e,t)=>bS(e,t)||t in i,ownKeys(e){const t=new Set(Reflect.ownKeys(e));return Reflect.ownKeys(i).forEach(e=>t.add(e)),yS.forEach(e=>{e in i&&t.add(e)}),Array.from(t)},getOwnPropertyDescriptor(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);if(n)return n;if("string"==typeof t&&yS.includes(t)&&t in i)return{configurable:!0,enumerable:!0,get(){return Reflect.get(i,t,i)}};const s=Reflect.getOwnPropertyDescriptor(i,t);return s?ct(ct({},s),{},{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(i)})})(r,o);e&&(a=[s,e])}}}catch(e){a=o}return e.apply(this,a)}),_patchXHR:(t,i,n)=>Fg(e.XMLHttpRequest.prototype,"open",e=>function(s,r,o=!0,a,l){const c=this,u=new Headers,d=kS(r);d&&CS(t,i,n,d,u);const h=e.call(c,s,r,o,a,l);return mS.forEach(e=>{const t=u.get(e);if(t)try{c.setRequestHeader(e,t)}catch(e){}}),h})};d.__PosthogExtensions__.tracingHeadersPatchFns=xS,d.postHogTracingHeadersPatchFns=xS,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(e){const t=this.length;let i=Math.trunc(e)||0;return 0>i&&(i+=t),0>i||i>=t?void 0:this[i]},writable:!0,enumerable:!1,configurable:!0}),"function"!=typeof[].findLast&&Object.defineProperty(Array.prototype,"findLast",{value(e,t){for(let i=this.length-1;i>=0;i--){const n=this[i];if(e.call(t,n,i,this))return n}},writable:!0,enumerable:!1,configurable:!0});var ES=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(e){var t;if(e.hadRecentInput)return;const i=this.i[0],n=this.i.at(-1);this.o&&i&&n&&1e3>e.startTime-n.startTime&&5e3>e.startTime-i.startTime?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),null===(t=this.t)||void 0===t||t.call(this,e)}};const IS=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},TS=e=>{if("loading"===document.readyState)return"loading";const t=IS();if(t){if(t.domInteractive>e)return"loading";if(0===t.domContentLoadedEventStart||t.domContentLoadedEventStart>e)return"dom-interactive";if(0===t.domComplete||t.domComplete>e)return"dom-content-loaded"}return"complete"},MS=e=>{const t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},PS=e=>{let t="";try{for(;9!==(null==e?void 0:e.nodeType);){var i;const n=e,s=n.id?"#"+n.id:[MS(n),...Array.from(null!==(i=n.classList)&&void 0!==i?i:[]).sort()].join(".");if(t.length+s.length>99)return t||s;if(t=t?s+">"+t:s,n.id)break;e=n.parentNode}}catch(e){}return t},RS=new WeakMap;function FS(e,t){let i=RS.get(t);return i||(i=new WeakMap,RS.set(t,i)),i.get(e)||i.set(e,new t),i.get(e)}let AS=-1;const LS=()=>AS,OS=e=>{addEventListener("pageshow",t=>{t.persisted&&(AS=t.timeStamp,e(t))},!0)},DS=(e,t,i,n)=>{let s,r;return o=>{var a;t.value>=0&&(o||n)&&(r=t.value-(null!==(a=s)&&void 0!==a?a:0),(r||void 0===s)&&(s=t.value,t.delta=r,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,i),e(t)))}},$S=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},NS=()=>{var e,t;return null!==(e=null===(t=IS())||void 0===t?void 0:t.activationStart)&&void 0!==e?e:0};let BS=-1;const qS=new Set,HS=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,zS=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of qS)e();isFinite(BS)||(BS="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",zS,!0))}},US=(e=!1)=>{if(e&&(BS=1/0),0>BS){var t;const e=NS(),i=document.prerendering||null===(t=globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e))||void 0===t?void 0:t.startTime;BS=null!=i?i:HS(),addEventListener("visibilitychange",zS,!0),addEventListener("prerenderingchange",zS,!0),OS(()=>{setTimeout(()=>{BS=HS()})})}return{get firstHiddenTime(){return BS},onHidden(e){qS.add(e)}}},WS=(e,t=-1,i,n=0,s,r,o)=>{const a=IS(),l=(null==a?void 0:a.navigationId)||0;let c="navigate";return i?c=i:0>LS()?a&&(document.prerendering||NS()>0?c="prerender":document.wasDiscarded?c="restore":a.type&&(c=a.type.replace(/_/g,"-"))):c="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:n||l,navigationInteractionId:s,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},jS=(e,t,i={})=>{try{const n=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(n.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const i=e.getEntries();n.length>1&&i.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(i)})});for(const t of n)e.observe(ct({type:t,buffered:!0},i));return e}}catch(e){}},VS=e=>{var t,i;return(null===(t=globalThis.PerformanceObserver)||void 0===t||null===(t=t.supportedEntryTypes)||void 0===t?void 0:t.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},GS=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},QS=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var KS=class{constructor(){this.u=void 0}};const JS=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},ZS=[1800,3e3],YS=(e,t={})=>{const i=VS(t);JS(()=>{const n=FS(t,KS),s=US();let r,o=WS("FCP");const a=jS(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(a.disconnect(),s.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-NS(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,r(!0)))});a&&(r=DS(e,o,ZS,t.reportAllChanges),OS(i=>{o=WS("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,LS()),r=DS(e,o,ZS,t.reportAllChanges),$S(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&jS(["soft-navigation"],i=>{i.forEach(i=>{n.u&&i.navigationId&&GS(n.u,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=WS("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=DS(e,o,ZS,t.reportAllChanges),r(!0)})},t)})},XS=[.1,.25],ew=e=>e.find(e=>{var t;return 1===(null===(t=e.node)||void 0===t?void 0:t.nodeType)})||e[0],tw=(e,t={})=>{const i=FS(t=Object.assign({},t),ES),n=new WeakMap;i.t=e=>{var i;if(null==e||null===(i=e.sources)||void 0===i?void 0:i.length){const i=ew(e.sources),o=null==i?void 0:i.node;if(o){var s,r;const e=null!==(s=null===(r=t.generateTarget)||void 0===r?void 0:r.call(t,o))&&void 0!==s?s:PS(o);n.set(i,e)}}},((e,t={})=>{const i=US();YS(QS(()=>{let n,s=WS("CLS",0);const r=FS(t,ES),o=(i,o,a,l,c)=>{s=WS("CLS",0,i,o,a,l,c),r.o=0,n=DS(e,s,XS,t.reportAllChanges)},a=(e=!1)=>{r.o>s.value&&(s.value=r.o,s.entries=r.i),n(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=e=>{for(const t of e)"soft-navigation"!==t.entryType?r.l(t):l(t);a()},u=["layout-shift"];VS(t)&&u.push("soft-navigation");const d=jS(u,c);d&&(n=DS(e,s,XS,t.reportAllChanges),i.onHidden(()=>{c(d.takeRecords()),n(!0)}),OS(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,LS()),$S(n)}),setTimeout(n))}))})(t=>{e((e=>{let t={};if(e.entries.length){var i;const s=e.entries.reduce((e,t)=>e.value>t.value?e:t);if(null==s||null===(i=s.sources)||void 0===i?void 0:i.length){const e=ew(s.sources);e&&(t={largestShiftTarget:n.get(e),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:e,largestShiftEntry:s,loadState:TS(s.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},iw=(e,t={})=>{const i=FS(t=Object.assign({},t),KS);VS(t)&&(i.u=new Map),YS(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:TS(LS())};if("soft-navigation"!==e.navigationType){if(e.entries.length){const i=IS(),n=e.entries.at(-1);if(i){const s=Math.max(0,i.responseStart-(i.activationStart||0));t={timeToFirstByte:s,firstByteToFCP:e.value-s,loadState:TS(e.entries[0].startTime),navigationEntry:i,fcpEntry:n}}}}else{var n;const s=null===(n=i.u)||void 0===n?void 0:n.get(e.navigationId);s&&(t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:"complete",navigationEntry:s})}return Object.assign(e,{attribution:t})})(t))},t)};let nw=0,sw=1/0,rw=0;const ow=e=>{for(const t of e)t.interactionId&&(sw=Math.min(sw,t.interactionId),rw=Math.max(rw,t.interactionId),nw=rw?(rw-sw)/7+1:0)};let aw;const lw=()=>{var e;return aw?nw:null!==(e=performance.interactionCount)&&void 0!==e?e:0};var cw=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return lw()-this.h}D(){this.h=lw(),this.v.length=0,this.p.clear()}S(e){const t=this.T(),i=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==i||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[i]:{k:8,id:-1,entries:[]}}l(e){var t;if(null===(t=this.m)||void 0===t||t.call(this,e),!e.interactionId)return;const i=this.v.at(-1);let n=this.p.get(e.interactionId);if(n||10>this.v.length||e.duration>i.k){var s;if(n?e.duration>n.k?(n.entries=[e],n.k=e.duration):e.duration===n.k&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],k:e.duration},this.p.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.k-e.k),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.p.delete(t.id)}null===(s=this.M)||void 0===s||s.call(this,n)}}};const uw=e=>{const t="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const s=QS(e);let r=-1;const o=()=>{n(r),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:t})}},dw=[200,500],hw=(e,t={})=>{const i=FS(t=Object.assign({},t),cw);let n=[],s=[],r=0;const o=new WeakMap,a=new WeakMap;let l=!1;const c=()=>{l||(uw(u),l=!0)},u=()=>{const e=new Set(i.v.map(e=>o.get(e.entries[0]))),t=s.length-10;s=s.filter((i,n)=>n>=t||e.has(i));const a=new Set;for(const e of s){const t=d(e.startTime,e.processingEnd);for(const e of t)a.add(e)}n=n.filter(e=>e.startTime>r||a.has(e)),l=!1};i.m=e=>{const i=e.startTime+e.duration;let n;r=Math.max(r,e.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(e.startTime,n.startTime),n.processingStart=Math.min(e.processingStart,n.processingStart),n.processingEnd=Math.max(e.processingEnd,n.processingEnd),t.includeProcessedEventEntries&&n.entries.push(e);break}}n||(n={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:i,entries:t.includeProcessedEventEntries?[e]:[]},s.push(n)),e.interactionId&&o.set(e,n),c()},i.M=e=>{if(!a.get(e)){var i;const o=null===(i=e.entries.find(e=>e.target))||void 0===i?void 0:i.target;if(o){var n,s;const i=null!==(n=null===(s=t.generateTarget)||void 0===s?void 0:s.call(t,o))&&void 0!==n?n:PS(o);a.set(e,i)}else{var r;const t=null===(r=e.entries.find(e=>e.targetSelector))||void 0===r?void 0:r.targetSelector;t&&a.set(e,t)}}};const d=(e,t)=>{const i=[];for(const s of n)if(s.startTime+s.duration>=e){if(s.startTime>t)break;i.push(s)}return i};jS(["long-animation-frame"],e=>{n=n.concat(e),c()},t),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=US();JS(()=>{var n;"interactionCount"in performance||aw||(aw=jS(["event"],ow,{durationThreshold:0}));let s,r=WS("INP");const o=FS(t,cw),a=(i,n,a,l,c)=>{o.D(),r=WS("INP",-1,i,n,a,l,c),s=DS(e,r,dw,t.reportAllChanges)},l=()=>{const e=o.S(r.navigationType);e&&e.k!==r.value&&(r.value=e.k,r.entries=e.entries,s())},c=e=>{l(),s(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{uw(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.l(t):c(t);l(),t&&s(!0)})},d=["event","first-input"];VS(t)&&d.push("soft-navigation");const h=jS(d,u,ct(ct({},t),{},{durationThreshold:null!==(n=t.durationThreshold)&&void 0!==n?n:40}));s=DS(e,r,dw,t.reportAllChanges),h&&(i.onHidden(()=>{u(h.takeRecords(),!0)}),OS(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,LS())}))})})(t=>{e((e=>{if(0===e.entries.length){const t={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:e.value,loadState:TS(e.navigationStartTime||0)};return Object.assign(e,{attribution:t})}const t=e.entries[0],n=o.get(t),s=Math.max(n.processingStart,t.startTime),r=Math.max(t.startTime+t.duration,s),l=Math.min(n.processingEnd,r),c=n.entries.sort((e,t)=>e.processingStart-t.processingStart),u=d(t.startTime,l),h=i.p.get(t.interactionId),p={interactionTarget:a.get(h),interactionType:t.name.startsWith("key")?"keyboard":"pointer",interactionTime:t.startTime,nextPaintTime:r,processedEventEntries:c,longAnimationFrameEntries:u,inputDelay:s-t.startTime,processingDuration:l-s,presentationDelay:r-l,loadState:TS(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(e=>{var t;const i=e.interactionTime,n=e.nextPaintTime;if(!(null===(t=e.longAnimationFrameEntries)||void 0===t?void 0:t.length)||!i||!n)return;const s=e.inputDelay,r=e.processingDuration;let o,a,l=0,c=0,u=0,d=0;for(const t of e.longAnimationFrameEntries){c=c+t.startTime+t.duration-t.styleAndLayoutStart;for(const e of t.scripts){const t=e.startTime+e.duration;if(i>t)continue;const n=t-Math.max(i,e.startTime),u=e.duration?n/e.duration*e.forcedStyleAndLayoutDuration:0;l+=n-u,c+=u,n>d&&(a=i+s>e.startTime?"input-delay":i+s+r>e.startTime?"processing-duration":"presentation-delay",o=e,d=n)}}const h=e.longAnimationFrameEntries.at(-1),p=h?h.startTime+h.duration:0;p>=i+s+r&&(u=n-p),o&&a&&(e.longestScript={entry:o,subpart:a,intersectingDuration:d}),e.totalScriptDuration=l,e.totalStyleAndLayoutDuration=c,e.totalPaintDuration=u,e.totalUnattributedDuration=n-i-l-c-u})(p),Object.assign(e,{attribution:p})})(t))},t)};var pw=class{constructor(){this.m=void 0,this.u=void 0}l(e){var t;null===(t=this.m)||void 0===t||t.call(this,e)}};const $=[2500,4e3];let gw=50;const _w=[];jS(["resource"],e=>{for(const t of e)_w.push(t),_w.length>gw&&_w.shift()});const fw=(e,t={})=>{null!=(t=Object.assign({},t)).resourceBufferSize&&(gw=t.resourceBufferSize);const i=FS(t,pw),n=new WeakMap;VS(t)&&(i.u=new Map),i.m=e=>{const i=e.element;if(i){var s,r;const o=null!==(s=null===(r=t.generateTarget)||void 0===r?void 0:r.call(t,i))&&void 0!==s?s:PS(i);n.set(e,o)}else e.id&&n.set(e,`#${e.id}`)},((e,t={})=>{let i=!1;const n=VS(t);JS(()=>{let s,r=US(),o=WS("LCP");const a=FS(t,pw),l=(n,a,l,c,u)=>{o=WS("LCP",-1,n,a,l,c,u),s=DS(e,o,$,t.reportAllChanges),i=!1,"soft-navigation"===n&&(r=US(!0))},c=e=>{var t;a.u&&e.navigationId&&GS(a.u,e),i||s(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const n=null===(t=e.getLargestInteractionContentfulPaint)||void 0===t?void 0:t.call(e);n&&u([n])},u=e=>{t.reportAllChanges||n||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){c(t);continue}let e=0,n=[],l=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-NS(),0),a.l(t),n=[t];else if("interaction-contentful-paint"===t.entryType){var i;const s=t;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,e=Math.max(l-t.startTime,0),s.largestContentfulPaint&&(a.l(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=e,o.entries=n,s())}},d=["largest-contentful-paint"];n&&d.push("interaction-contentful-paint","soft-navigation");const h=jS(d,u);if(h){s=DS(e,o,$,t.reportAllChanges);const r=["keydown","click","visibilitychange"],a=e=>{if(e.isTrusted&&!i){const e=o.id;uw(()=>{if(!i){if(!n){h.disconnect();for(const e of r)removeEventListener(e,a,{capture:!0})}e===o.id&&(i=!0,s(!0))}})}};for(const e of r)addEventListener(e,a,{capture:!0});OS(n=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,LS()),s=DS(e,o,$,t.reportAllChanges),$S(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})})(t=>{e((e=>{let t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var s,r,o;const a=e.entries.at(-1),l=a.url&&(_w.findLast(e=>e.name===a.url)||performance.getEntriesByType("resource").findLast(e=>e.name===a.url));let c;t.target=n.get(a),t.lcpEntry=a,a.url&&(t.url=a.url),l&&(t.lcpResourceEntry=l);let u=0,d=0;if("soft-navigation"!==e.navigationType?(c=IS(),u=null!==(s=null==c?void 0:c.activationStart)&&void 0!==s?s:0,d=null!==(r=null==c?void 0:c.responseStart)&&void 0!==r?r:0):(u=e.navigationStartTime||0,c=null===(o=i.u)||void 0===o?void 0:o.get(e.navigationId)),c){const i=Math.max(0,d-u),n=Math.max(i,l?(l.requestStart||l.startTime)-u:0),s=Math.min(e.value,Math.max(n,l?l.responseEnd-u:0));t=ct(ct({},t),{},{timeToFirstByte:i,resourceLoadDelay:n-i,resourceLoadDuration:s-n,elementRenderDelay:e.value-s,navigationEntry:c})}}return Object.assign(e,{attribution:t})})(t))},t)};let vw=-1;const mw=()=>vw,yw=e=>{addEventListener("pageshow",t=>{t.persisted&&(vw=t.timeStamp,e(t))},!0)},bw=(e,t,i,n)=>{let s,r;return o=>{var a;t.value>=0&&(o||n)&&(r=t.value-(null!==(a=s)&&void 0!==a?a:0),(r||void 0===s)&&(s=t.value,t.delta=r,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,i),e(t)))}},Sw=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},ww=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},kw=()=>{var e,t;return null!==(e=null===(t=ww())||void 0===t?void 0:t.activationStart)&&void 0!==e?e:0};let Cw=-1;const xw=new Set,Ew=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Iw=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of xw)e();isFinite(Cw)||(Cw="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Iw,!0))}},Tw=(e=!1)=>{if(e&&(Cw=1/0),0>Cw){var t;const e=kw(),i=document.prerendering||null===(t=globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e))||void 0===t?void 0:t.startTime;Cw=null!=i?i:Ew(),addEventListener("visibilitychange",Iw,!0),addEventListener("prerenderingchange",Iw,!0),yw(()=>{setTimeout(()=>{Cw=Ew()})})}return{get firstHiddenTime(){return Cw},onHidden(e){xw.add(e)}}},Mw=(e,t=-1,i,n=0,s,r,o)=>{const a=ww(),l=(null==a?void 0:a.navigationId)||0;let c="navigate";return i?c=i:0>mw()?a&&(document.prerendering||kw()>0?c="prerender":document.wasDiscarded?c="restore":a.type&&(c=a.type.replace(/_/g,"-"))):c="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:n||l,navigationInteractionId:s,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},Pw=new WeakMap;function Rw(e,t){let i=Pw.get(t);return i||(i=new WeakMap,Pw.set(t,i)),i.get(e)||i.set(e,new t),i.get(e)}var Fw=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(e){var t;if(e.hadRecentInput)return;const i=this.o[0],n=this.o.at(-1);this.i&&i&&n&&1e3>e.startTime-n.startTime&&5e3>e.startTime-i.startTime?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),null===(t=this.t)||void 0===t||t.call(this,e)}};const Aw=(e,t,i={})=>{try{const n=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(n.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const i=e.getEntries();n.length>1&&i.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(i)})});for(const t of n)e.observe(ct({type:t,buffered:!0},i));return e}}catch(e){}},Lw=e=>{var t,i;return(null===(t=globalThis.PerformanceObserver)||void 0===t||null===(t=t.supportedEntryTypes)||void 0===t?void 0:t.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},Ow=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},Dw=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var $w=class{constructor(){this.l=void 0}};const Nw=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Bw=[1800,3e3],qw=(e,t={})=>{const i=Lw(t);Nw(()=>{const n=Rw(t,$w),s=Tw();let r,o=Mw("FCP");const a=Aw(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(a.disconnect(),s.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-kw(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,r(!0)))});a&&(r=bw(e,o,Bw,t.reportAllChanges),yw(i=>{o=Mw("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,mw()),r=bw(e,o,Bw,t.reportAllChanges),Sw(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Aw(["soft-navigation"],i=>{i.forEach(i=>{n.l&&i.navigationId&&Ow(n.l,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Mw("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=bw(e,o,Bw,t.reportAllChanges),r(!0)})},t)})},Hw=[.1,.25],zw=(e,t={})=>{const i=Tw();qw(Dw(()=>{let n,s=Mw("CLS",0);const r=Rw(t,Fw),o=(i,o,a,l,c)=>{s=Mw("CLS",0,i,o,a,l,c),r.i=0,n=bw(e,s,Hw,t.reportAllChanges)},a=(e=!1)=>{r.i>s.value&&(s.value=r.i,s.entries=r.o),n(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=e=>{for(const t of e)"soft-navigation"!==t.entryType?r.h(t):l(t);a()},u=["layout-shift"];Lw(t)&&u.push("soft-navigation");const d=Aw(u,c);d&&(n=bw(e,s,Hw,t.reportAllChanges),i.onHidden(()=>{c(d.takeRecords()),n(!0)}),yw(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,mw()),Sw(n)}),setTimeout(n))}))};let Uw=0,Ww=1/0,jw=0;const Vw=e=>{for(const t of e)t.interactionId&&(Ww=Math.min(Ww,t.interactionId),jw=Math.max(jw,t.interactionId),Uw=jw?(jw-Ww)/7+1:0)};let Gw;const Qw=()=>{var e;return Gw?Uw:null!==(e=performance.interactionCount)&&void 0!==e?e:0};var Kw=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return Qw()-this.u}M(){this.u=Qw(),this.v.length=0,this.m.clear()}L(e){const t=this._(),i=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==i||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[i]:{P:8,id:-1,entries:[]}}h(e){var t;if(null===(t=this.p)||void 0===t||t.call(this,e),!e.interactionId)return;const i=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||10>this.v.length||e.duration>i.P){var s;if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}null===(s=this.T)||void 0===s||s.call(this,n)}}};const Jw=e=>{const t="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const s=Dw(e);let r=-1;const o=()=>{n(r),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:t})}},Zw=[200,500],Yw=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Tw();Nw(()=>{var n;"interactionCount"in performance||Gw||(Gw=Aw(["event"],Vw,{durationThreshold:0}));let s,r=Mw("INP");const o=Rw(t,Kw),a=(i,n,a,l,c)=>{o.M(),r=Mw("INP",-1,i,n,a,l,c),s=bw(e,r,Zw,t.reportAllChanges)},l=()=>{const e=o.L(r.navigationType);e&&e.P!==r.value&&(r.value=e.P,r.entries=e.entries,s())},c=e=>{l(),s(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{Jw(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):c(t);l(),t&&s(!0)})},d=["event","first-input"];Lw(t)&&d.push("soft-navigation");const h=Aw(d,u,ct(ct({},t),{},{durationThreshold:null!==(n=t.durationThreshold)&&void 0!==n?n:40}));s=bw(e,r,Zw,t.reportAllChanges),h&&(i.onHidden(()=>{u(h.takeRecords(),!0)}),yw(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,mw())}))})};var Xw=class{constructor(){this.p=void 0,this.l=void 0}h(e){var t;null===(t=this.p)||void 0===t||t.call(this,e)}};const ek=[2500,4e3],tk=(e,t={})=>{let i=!1;const n=Lw(t);Nw(()=>{let s,r=Tw(),o=Mw("LCP");const a=Rw(t,Xw),l=(n,a,l,c,u)=>{o=Mw("LCP",-1,n,a,l,c,u),s=bw(e,o,ek,t.reportAllChanges),i=!1,"soft-navigation"===n&&(r=Tw(!0))},c=e=>{var t;a.l&&e.navigationId&&Ow(a.l,e),i||s(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const n=null===(t=e.getLargestInteractionContentfulPaint)||void 0===t?void 0:t.call(e);n&&u([n])},u=e=>{t.reportAllChanges||n||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){c(t);continue}let e=0,n=[],l=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-kw(),0),a.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){var i;const s=t;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,e=Math.max(l-t.startTime,0),s.largestContentfulPaint&&(a.h(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=e,o.entries=n,s())}},d=["largest-contentful-paint"];n&&d.push("interaction-contentful-paint","soft-navigation");const h=Aw(d,u);if(h){s=bw(e,o,ek,t.reportAllChanges);const r=["keydown","click","visibilitychange"],a=e=>{if(e.isTrusted&&!i){const e=o.id;Jw(()=>{if(!i){if(!n){h.disconnect();for(const e of r)removeEventListener(e,a,{capture:!0})}e===o.id&&(i=!0,s(!0))}})}};for(const e of r)addEventListener(e,a,{capture:!0});yw(n=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,mw()),s=bw(e,o,ek,t.reportAllChanges),Sw(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})},ik={onLCP:fw,onCLS:tw,onFCP:iw,onINP:hw,withoutAttribution:{onLCP:tk,onCLS:zw,onFCP:qw,onINP:Yw}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=ik,d.__PosthogExtensions__.postHogWebVitalsCallbacks=ik,d.postHogWebVitalsCallbacks=ik;const nk={onLCP:tk,onCLS:zw,onFCP:qw,onINP:Yw};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=nk,d.__PosthogExtensions__.postHogWebVitalsCallbacks=nk,d.postHogWebVitalsCallbacks=nk,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>nk;const sk={onLCP:fw,onCLS:tw,onFCP:iw,onINP:hw,withoutAttribution:{onLCP:tk,onCLS:zw,onFCP:qw,onINP:Yw}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=sk,d.__PosthogExtensions__.postHogWebVitalsCallbacks=sk,d.postHogWebVitalsCallbacks=sk;const rk={onLCP:tk,onCLS:zw,onFCP:qw,onINP:Yw};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=rk,d.__PosthogExtensions__.postHogWebVitalsCallbacks=rk,d.postHogWebVitalsCallbacks=rk,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>rk;const ok={};function ak(e,t){const i=yo(e);return i?ct({node:i,originalEvent:e,timestamp:Date.now()},t):null}function lk(e){return!!dn(()=>co(e))}function ck(e,t){return Math.abs(e)<Math.abs(t)?0>t?"up":"down":0>e?"left":"right"}function uk(e){return"swipe"===e.type?"$dead_swipe":"$dead_click"}const dk="canvas,video,audio,embed,object";function hk(e,t){return Ft(e)&&e>=t}function pk(e,t=1e3){return e>=0&&t>e?e:void 0}function gk(e,t,i=1e3){return Ft(t)?pk(e-t,i):void 0}var _k=class{_asRequiredConfig(e){var t,i,n,s,r,o,a,l;const c=this._defaultConfig((null==e?void 0:e.__onCapture)||this._captureDeadClick.bind(this));return{element_attribute_ignorelist:null!==(t=null==e?void 0:e.element_attribute_ignorelist)&&void 0!==t?t:c.element_attribute_ignorelist,scroll_threshold_ms:null!==(i=null==e?void 0:e.scroll_threshold_ms)&&void 0!==i?i:c.scroll_threshold_ms,selection_change_threshold_ms:null!==(n=null==e?void 0:e.selection_change_threshold_ms)&&void 0!==n?n:c.selection_change_threshold_ms,mutation_threshold_ms:null!==(s=null==e?void 0:e.mutation_threshold_ms)&&void 0!==s?s:c.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(r=null==e?void 0:e.capture_clicks_with_modifier_keys)&&void 0!==r?r:c.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==e?void 0:e.capture_dead_swipes)&&void 0!==o?o:c.capture_dead_swipes,swipe_threshold_px:null!==(a=null==e?void 0:e.swipe_threshold_px)&&void 0!==a?a:c.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(l=null==e?void 0:e.max_dead_swipes_per_page_load)&&void 0!==l?l:c.max_dead_swipes_per_page_load,css_selector_ignorelist:null==e?void 0:e.css_selector_ignorelist,__onCapture:c.__onCapture}}constructor(e,t){this.instance=e,this._observedRoots=new WeakSet,this._hadSelection=!1,this._clicks=[],this._deadSwipesCaptured=0,this._defaultConfig=e=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,capture_clicks_with_modifier_keys:!1,capture_dead_swipes:!0,swipe_threshold_px:30,max_dead_swipes_per_page_load:10,__onCapture:e}),this._clearMouseSelection=()=>{clearTimeout(this._mouseSelectionTimer),this._mouseSelectionTimer=void 0,this._mouseSelection=void 0},this._onMouseDown=e=>{if(this._observeGesturePath(e),this._clearMouseSelection(),0===e.button){const t={path:e.composedPath(),trusted:e.isTrusted,selectionChanged:!1,selectionInitiallyRelated:!1},i=null==n?void 0:n.getSelection();t.selectionInitiallyRelated="Range"===(null==i?void 0:i.type)&&this._selectionTouchesGesture(i,t),this._mouseSelection=t}},this._onMouseOut=e=>{Pt(e.relatedTarget)&&this._clearMouseSelection()},this._onMouseUp=e=>{const t=this._mouseSelection,i=e;if(!t||0!==i.button||e.isTrusted!==t.trusted)return;const n=e.composedPath();for(const e of t.path)if(lk(e)&&-1!==n.indexOf(e)){t.clickTarget=e;break}t.clickDetail=i.detail,this._mouseSelectionTimer=d.setTimeout(this._clearMouseSelection,0)},this._onClick=e=>{this._observeGesturePath(e);const t=e,i=ak(t,{type:"click"}),n=this._mouseSelection;i&&n&&0===t.button&&t.detail>0&&t.detail===n.clickDetail&&e.isTrusted===n.trusted&&i.node===n.clickTarget&&(i.selectionChangedDuringGesture=n.selectionChanged&&this._config.selection_change_threshold_ms>0,this._clearMouseSelection()),Pt(i)||this._ignore(i)||this._queueCandidate(i),this._scheduleCheck()},this._onScroll=()=>{const e=Date.now();this._lastScroll=e,e%50==0&&this._clicks.forEach(t=>{It(t.scrollDelayMs)&&(t.scrollDelayMs=e-t.timestamp)})},this._onSelectionChange=e=>{var t,i;const s=null==n?void 0:n.getSelection(),r=this._hadSelection;this._hadSelection="Range"===(null==s?void 0:s.type);const o=null==s?void 0:s.focusNode,a=o&&(co(o)?o:o.parentElement),l=null==n?void 0:n.activeElement;let c=l;for(;null==c||null===(t=c.shadowRoot)||void 0===t?void 0:t.activeElement;)c=c.shadowRoot.activeElement;const u=Do(yo(e))||Do(null!=a?a:null)||Do(null!==(i=c)&&void 0!==i?i:null),d="Caret"===(null==s?void 0:s.type)&&c&&!c.shadowRoot&&o&&o!==l&&o.contains(null!=l?l:null);if(!(r||this._hadSelection||u||d))return;const h=Date.now();this._lastSelectionChanged=h;const p=this._mouseSelection;if(p&&(r||this._hadSelection||u)){const t=yo(e);let i;if(Do(t))i=t;else if("Caret"===(null==s?void 0:s.type)){var g;Do(null!==(g=c)&&void 0!==g?g:null)||d?i=c:u&&(i=a)}const n=i?this._selectionIsInGesture(i,p):s&&(o||s.anchorNode)?this._selectionTouchesGesture(s,p):r&&!this._hadSelection&&p.selectionInitiallyRelated;p.selectionChanged=p.selectionChanged||n}this._clicks.forEach(e=>{const t=h-e.timestamp;0>t||!It(e.selectionChangedDelayMs)&&t>=e.selectionChangedDelayMs||(e.selectionChangedDelayMs=t)})},this._onVisibilityChange=()=>{"hidden"===(null==n?void 0:n.visibilityState)&&this._clearMouseSelection();const e=Date.now();this._lastVisibilityChange=e,this._recordLivenessSignal("visibilityChangedDelayMs",e)},this._onFocusChange=()=>{const e=Date.now();this._lastFocusChange=e,this._recordLivenessSignal("focusChangedDelayMs",e)},this._onTouchStart=e=>{this._observeGesturePath(e);const t=e.touches,i=1===(null==t?void 0:t.length)?t[0]:void 0;this._touchStart=i?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this._onTouchCancel=()=>{this._touchStart=void 0},this._onTouchEnd=e=>{var t;const i=this._touchStart;if(this._touchStart=void 0,It(i)||this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)return;const s=e,r=null===(t=s.changedTouches)||void 0===t?void 0:t[0];if(!r)return;const o=r.clientX-i.x,a=r.clientY-i.y,l=o*o+a*a,c=this._config.swipe_threshold_px;if(c*c>l)return;if([this._lastScroll,this._lastMutation,this._lastSelectionChanged].some(e=>Ft(e)&&e>=i.timestamp))return;var u,d;if(this._pageHasUnobservableSurfaces()&&(null!==(u=null==n||null===(d=n.elementsFromPoint)||void 0===d?void 0:d.call(n,i.x,i.y))&&void 0!==u?u:[]).some(e=>{var t;return null===(t=e.matches)||void 0===t?void 0:t.call(e,dk)}))return;const h=ak(s,{type:"swipe",swipeDirection:ck(o,a),swipeDistancePx:Math.round(Math.sqrt(l))});Pt(h)||this._ignore(h)||this._queueCandidate(h),this._scheduleCheck()},this._config=this._asRequiredConfig(t),this._onCapture=this._config.__onCapture}start(e){this._startClickObserver(),this._startScrollObserver(),this._startSelectionChangedObserver(),this._startVisibilityChangeObserver(),this._startFocusChangeObserver(),this._startMutationObserver(e),this._config.capture_dead_swipes&&this._startSwipeObserver()}_startMutationObserver(t){if(!this._mutationObserver){const i=function(t){return function(t,i){const n=ok[t];if(n)return n;let s=i[t];if((e=>Ct(e)&&-1!==e.toString().indexOf("[native code]"))(s)&&!(null==e?void 0:e.Zone))return ok[t]=s.bind(i);const r=i.document;if(r&&Ct(r.createElement)){let e,n=!1;try{e=r.createElement("iframe"),e.hidden=!0,r.head.appendChild(e);const l=e.contentWindow;var o,a;l&&l[t]&&(s=l[t],"MutationObserver"===t&&function(e){return ft(e,"AppleWebKit")&&!ft(e,"Chrome")}(null!==(o=null===(a=i.navigator)||void 0===a?void 0:a.userAgent)&&void 0!==o?o:"")&&(e.classList.add("rr-block","ph-no-capture"),n=!0))}catch(e){$r.warn(`Could not create sandbox iframe for ${t} check, bailing to assignableWindow.${t}: `,e)}finally{!n&&(null==e?void 0:e.parentNode)&&e.parentNode.removeChild(e)}}return s&&Ct(s)?ok[t]=s.bind(i):s}("MutationObserver",t)}(d);this._mutationObserver=new i(e=>{this._onMutation(e)}),this._observeRoot(t)}}_observeRoot(e){e&&this._mutationObserver&&(this._observedRoots.has(e)||(this._mutationObserver.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),this._observedRoots.add(e),this._observeShadowRoots(e)))}_observeShadowRoots(e,t){var i,n;co(e)&&e.shadowRoot&&this._observeRoot(e.shadowRoot);const s=null!==(i=null===(n=e.querySelectorAll)||void 0===n?void 0:n.call(e,"*"))&&void 0!==i?i:[];for(let e=0;s.length>e;e++)null==t||t.add(s[e]),this._observeRoot(s[e].shadowRoot)}_observeGesturePath(e){var t,i;const n=null!==(t=null===(i=e.composedPath)||void 0===i?void 0:i.call(e))&&void 0!==t?t:[];for(let e=0;n.length>e;e++){const t=n[e];lk(t)&&this._observeRoot(t.shadowRoot)}}stop(){var e;null===(e=this._mutationObserver)||void 0===e||e.disconnect(),this._mutationObserver=void 0,this._observedRoots=new WeakSet,d.removeEventListener("click",this._onClick,{capture:!0}),d.removeEventListener("mousedown",this._onMouseDown,{capture:!0}),d.removeEventListener("mouseup",this._onMouseUp,{capture:!0}),d.removeEventListener("mouseout",this._onMouseOut,{capture:!0}),d.removeEventListener("dragstart",this._clearMouseSelection,{capture:!0}),d.removeEventListener("pointercancel",this._clearMouseSelection,{capture:!0}),d.removeEventListener("blur",this._clearMouseSelection),this._clearMouseSelection(),d.removeEventListener("scroll",this._onScroll,{capture:!0}),null==n||n.removeEventListener("selectionchange",this._onSelectionChange),d.removeEventListener("touchstart",this._onTouchStart,{capture:!0}),d.removeEventListener("touchend",this._onTouchEnd,{capture:!0}),d.removeEventListener("touchcancel",this._onTouchCancel,{capture:!0}),null==n||n.removeEventListener("visibilitychange",this._onVisibilityChange),d.removeEventListener("blur",this._onFocusChange),d.removeEventListener("focus",this._onFocusChange),this._touchStart=void 0}_onMutation(e){const t=new Set;for(const n of e)try{var i;if(!1===(null===(i=n.target)||void 0===i?void 0:i.isConnected))continue;this._lastMutation=Date.now();const e=n.addedNodes;for(let i=0;e.length>i;i++){const n=e[i];lk(n)&&!t.has(n)&&this._observeShadowRoots(n,t)}}catch(e){}}_startClickObserver(){Qr(d,"click",this._onClick,{capture:!0}),Qr(d,"mousedown",this._onMouseDown,{capture:!0}),Qr(d,"mouseup",this._onMouseUp,{capture:!0}),Qr(d,"mouseout",this._onMouseOut,{capture:!0}),Qr(d,"dragstart",this._clearMouseSelection,{capture:!0}),Qr(d,"pointercancel",this._clearMouseSelection,{capture:!0}),Qr(d,"blur",this._clearMouseSelection)}_queueCandidate(e){e.selectionChangedDelayMs=gk(e.timestamp,this._lastSelectionChanged,this._config.selection_change_threshold_ms),e.visibilityChangedDelayMs=gk(e.timestamp,this._lastVisibilityChange),e.focusChangedDelayMs=gk(e.timestamp,this._lastFocusChange),this._clicks.push(e)}_scheduleCheck(){this._clicks.length&&It(this._checkClickTimer)&&(this._checkClickTimer=d.setTimeout(()=>{this._checkClicks()},1e3))}_startScrollObserver(){Qr(d,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){var e;this._hadSelection="Range"===(null==n||null===(e=n.getSelection())||void 0===e?void 0:e.type),Qr(n,"selectionchange",this._onSelectionChange)}_selectionIsInGesture(e,t){const i=t.path[0];try{for(;e;){if(-1!==t.path.indexOf(e)||co(i)&&i.contains(e))return!0;e=e.getRootNode().host}}catch(e){}return!1}_selectionTouchesGesture(e,t){const i=t.path[0],n=e.rangeCount>0?e.getRangeAt(0):void 0,s=!!n&&dn(()=>n.startContainer.getRootNode()===i.getRootNode());if(n&&s&&co(i)){var r;if(!n.collapsed)return n.intersectsNode(i);const e=co(n.startContainer)&&null!==(r=n.startContainer.childNodes[n.startOffset])&&void 0!==r?r:n.startContainer;return this._selectionIsInGesture(e,t)}return this._selectionIsInGesture(e.focusNode,t)||this._selectionIsInGesture(e.anchorNode,t)}_startVisibilityChangeObserver(){Qr(n,"visibilitychange",this._onVisibilityChange)}_startFocusChangeObserver(){Qr(d,"blur",this._onFocusChange),Qr(d,"focus",this._onFocusChange)}_recordLivenessSignal(e,t){this._clicks.forEach(i=>{const n=pk(t-i.timestamp);Ft(n)&&(It(i[e])||i[e]>n)&&(i[e]=n)})}_startSwipeObserver(){Qr(d,"touchstart",this._onTouchStart,{capture:!0,passive:!0}),Qr(d,"touchend",this._onTouchEnd,{capture:!0,passive:!0}),Qr(d,"touchcancel",this._onTouchCancel,{capture:!0,passive:!0})}_pageHasUnobservableSurfaces(){const e=It(this._surfacesCheckedAt)||Ft(this._lastMutation)&&this._lastMutation>this._surfacesCheckedAt;return(It(this._hasUnobservableSurfaces)||e)&&(this._surfacesCheckedAt=Date.now(),this._hasUnobservableSurfaces=!!(null==n?void 0:n.querySelector(dk))),!!this._hasUnobservableSurfaces}_ignore(e){return!e||("swipe"===e.type?this._ignoreCommon(e):this._ignoreClick(e))}_ignoreCommon(e){return!(!lo(e.node)&&!this._clicks.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!uo(e.node,"html")&&co(e.node)&&function(e,t){var i;if(!(typeof window>"u"?void 0:window)||No(e))return!1;const n=Lt(t)?Ao:null!==(i=null==t?void 0:t.css_selector_ignorelist)&&void 0!==i?i:Ao,{targetElementList:s}=Bo(e,!1);return!wo(s,n)}(e.node,{css_selector_ignorelist:this._config.css_selector_ignorelist}))}_ignoreClick(e){return!(this._config.capture_clicks_with_modifier_keys||(t=e.originalEvent,!(t.ctrlKey||t.metaKey||t.altKey||t.shiftKey)))||!!this._ignoreCommon(e)||function(e){if(!(typeof window>"u"?void 0:window)||No(e))return!1;const{targetElementList:t}=Bo(e,!1);return t.some(e=>uo(e,"a"))}(e.node);var t}_checkClicks(){if(!this._clicks.length)return;clearTimeout(this._checkClickTimer),this._checkClickTimer=void 0;const e=this._clicks;this._clicks=[];for(const i of e){var t;i.mutationDelayMs=null!==(t=i.mutationDelayMs)&&void 0!==t?t:this._lastMutation&&this._lastMutation>=i.timestamp?this._lastMutation-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const e=hk(i.scrollDelayMs,this._config.scroll_threshold_ms),n=hk(i.selectionChangedDelayMs,this._config.selection_change_threshold_ms),s=hk(i.mutationDelayMs,this._config.mutation_threshold_ms),r=hk(i.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),o=Ft(i.scrollDelayMs)&&this._config.scroll_threshold_ms>i.scrollDelayMs,a=Ft(i.mutationDelayMs)&&this._config.mutation_threshold_ms>i.mutationDelayMs,l=i.selectionChangedDuringGesture||Ft(i.selectionChangedDelayMs)&&this._config.selection_change_threshold_ms>i.selectionChangedDelayMs,c=Ft(i.visibilityChangedDelayMs),u=Ft(i.focusChangedDelayMs);if(!(o||a||l||c||u))if(e||s||r||n){const t=uk(i);if("$dead_swipe"===t){if(this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)continue;this._deadSwipesCaptured++}this._onCapture(i,{[`${t}_last_mutation_timestamp`]:this._lastMutation,[`${t}_event_timestamp`]:i.timestamp,[`${t}_scroll_timeout`]:e,[`${t}_mutation_timeout`]:s,[`${t}_absolute_timeout`]:r,[`${t}_selection_changed_timeout`]:n,[`${t}_visibility_changed_timeout`]:!1})}else this._config.mutation_threshold_ms>i.absoluteDelayMs&&this._clicks.push(i)}this._scheduleCheck()}_captureDeadClick(e,t){const i=uk(e);this.instance.capture(i,ct(ct(ct({},t),ub(e.node,{e:e.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:e.scrollDelayMs,[`${i}_mutation_delay_ms`]:e.mutationDelayMs,[`${i}_absolute_delay_ms`]:e.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:e.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:e.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:e.focusChangedDelayMs,$dead_swipe_direction:e.swipeDirection,$dead_swipe_distance_px:e.swipeDistancePx}),{timestamp:new Date(e.timestamp)})}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new _k(e,t);var fk=class{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return"always"===this._config.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this._config.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){const e=this._storage._get(this._storageKey);return Wt(e)?1:ft(jt,e)?0:-1}get _storage(){const e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?Ol:Al,i=t._is_supported()?t:Gl;if(!this._persistentStore||this._persistentStore!==i){this._persistentStore=i;const t="localStorage"===e?Al:Ol;t._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Wt(t._get(this._storageKey))),t._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(e=>Wt(e))}};const vk=Nr("[Dead Clicks]"),mk=()=>!0,yk=e=>{var t;const i=!!(null===(t=e.instance.persistence)||void 0===t?void 0:t.get_property(Y)),n=e.instance.config.capture_dead_clicks;return Lt(n)?n:!!xt(n)||i};var bk=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Y]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript(()=>{this._start()}):this.stop()}_loadScript(e){var t,i,n;(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)?e():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this.instance,"dead-clicks-autocapture",t=>{t?vk.error("failed to load script",t):e()})}_start(){var e;if(n){if(!this._lazyLoadedDeadClicksAutocapture&&(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)){const e=xt(this.instance.config.capture_dead_clicks)?ct({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this._lazyLoadedDeadClicksAutocapture=d.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this._lazyLoadedDeadClicksAutocapture.start(n),vk.info("starting...")}}else vk.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,vk.info("stopping..."))}};const Sk=Nr("[SegmentIntegration]");function wk(e,t,i=!0){const n=e.config.segment;if(!n)return t();const{analytics:s,filterProperties:r}=(e=>Ct(e.register))(o=n)?{analytics:o}:o;var o;!function(e,t,i,n){const s=t=>{const s=()=>t.anonymousId()||Tl();e.config.get_device_id=s,n&&t.id()&&(e.register({distinct_id:t.id(),$device_id:s()}),e.persistence.set_property(Ie,Ze)),i(n?void 0:t.anonymousId()||void 0)},r=t.user();"then"in r&&Ct(r.then)?r.then(s):s(r)}(e,s,i=>{s.register(((e,t,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||Sk.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=!!t&&n.event.anonymousId===t&&!n.event.userId;r||n.event.userId||n.event.anonymousId===e.get_distinct_id()||(Sk.info("No userId set, resetting PostHog"),e.reset()),r||(t=void 0),n.event.userId&&n.event.userId!==e.get_distinct_id()&&(Sk.info("UserId set, identifying with PostHog"),e.identify(n.event.userId));let o=e.calculateEventProperties(s,n.event.properties);if(!Rt(i)){const e=n.event.properties||{},t={};for(const i of Object.keys(o))St.call(e,i)||(t[i]=o[i]);const s=((e,t)=>{const i=kt(e)?e:[e];let n=ct({},t);for(const e of i)try{if(n=e(n),Rt(n))return null}catch(e){return Sk.error("Error in Segment filterProperties:",e),null}return n})(i,t);if(Rt(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(e){return n(e,e.event.event)},page(e){return n(e,et)},identify(e){return n(e,it)},screen(e){return n(e,"$screen")}}})(e,i,{filterProperties:r})).then(()=>{t()},e=>{Sk.error("Failed to register the Segment integration",e),t()})},i)}const kk="posthog-js";function Ck(e,{organization:t,projectId:i,prefix:n,severityAllowList:s=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var a,l,c,u,d;if("*"!==s&&!s.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});const h=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const p=(null===(a=o.exception)||void 0===a?void 0:a.values)||[],g=p.map(e=>ct(ct({},e),{},{stacktrace:e.stacktrace?ct(ct({},e.stacktrace),{},{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>ct(ct({},e),{},{platform:"web:javascript"}))}):void 0})),_={$exception_message:(null===(l=p[0])||void 0===l?void 0:l.value)||o.message,$exception_type:null===(c=p[0])||void 0===c?void 0:c.type,$exception_level:o.level,$exception_list:g,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(u=p[0])||void 0===u?void 0:u.value)||o.message,$sentry_exception_type:null===(d=p[0])||void 0===d?void 0:d.type,$sentry_tags:o.tags};var f;return t&&i&&(_.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(f=e.exceptions)||void 0===f||f.sendExceptionEvent(_)),o}}var xk=class{constructor(e,t,i,n,s,r){this.name=kk,this.setupOnce=function(o){o(Ck(e,{organization:t,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:null==r||r}))}}},Ek=class{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&($r.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null===(e=this._unsubscribeSessionId)||void 0===e||e.call(this),this._unsubscribeSessionId=void 0}doPageView(t,i){var n;const s=this._previousPageViewProperties(t,i);return this._currentPageview={pathname:null!==(n=null==e?void 0:e.location.pathname)&&void 0!==n?n:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,null===(t=this._currentPageview)||void 0===t?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null===(e=this._currentPageview)||void 0===e?void 0:e.pageViewId}}_previousPageViewProperties(e,t){const i=this._currentPageview;if(!i)return{$pageview_id:t};let n={$pageview_id:t,$prev_pageview_id:i.pageViewId};const s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:e,lastScrollY:t,maxScrollY:i,maxContentHeight:r,lastContentY:o,maxContentY:a}=s;if(!(It(e)||It(t)||It(i)||It(r)||It(o)||It(a))){e=Math.ceil(e),t=Math.ceil(t),i=Math.ceil(i),r=Math.ceil(r),o=Math.ceil(o),a=Math.ceil(a);const s=e>1?Kt(t/e,0,1,$r):1,l=e>1?Kt(i/e,0,1,$r):1,c=r>1?Kt(o/r,0,1,$r):1,u=r>1?Kt(a/r,0,1,$r):1;n=Hr(n,{$prev_pageview_last_scroll:t,$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:c,$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:u})}}return i.pathname&&(n.$prev_pageview_pathname=i.pathname),i.timestamp&&(n.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),n}};const Ik=["flags","surveys"],Tk={[O]:{exposure:"hidden"},[q]:{exposure:"hidden"},[H]:{exposure:"hidden"},[V]:{exposure:"hidden"},[U]:{exposure:"hidden"},[j]:{exposure:"hidden"},[T]:{exposure:"event"},[G]:{exposure:"hidden"},[ee]:{exposure:"hidden"},[Q]:{exposure:"event"},[K]:{exposure:"hidden"},[J]:{exposure:"event"},[Z]:{exposure:"event"},[Y]:{exposure:"event"},[X]:{exposure:"hidden"},[te]:{exposure:"event"},[ie]:{exposure:"hidden"},[ne]:{exposure:"hidden"},[ce]:{exposure:"hidden"},[ue]:{exposure:"event"},[se]:{exposure:"event",shouldSkipFromEventProperties:e=>Pt(e)},[de]:{exposure:"event"},[he]:{exposure:"event"},[pe]:{exposure:"event"},[ve]:{exposure:"event"},[me]:{exposure:"hidden"},[y]:{exposure:"hidden",storageGroup:"flags"},[p]:{exposure:"hidden",storageGroup:"flags"},[h]:{exposure:"hidden"},[g]:{exposure:"hidden",storageGroup:"flags"},[C]:{exposure:"hidden",storageGroup:"flags"},[v]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[m]:{exposure:"hidden",storageGroup:"flags"},[x]:{exposure:"hidden"},[E]:{exposure:"hidden"},[S]:{exposure:"hidden"},[b]:{exposure:"hidden"},[M]:{exposure:"hidden",storageGroup:"surveys"},[P]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[F]:{exposure:"event"},[A]:{exposure:"hidden"},[L]:{exposure:"hidden"},[be]:{exposure:"hidden"},[Se]:{exposure:"hidden"},[we]:{exposure:"hidden"},[ke]:{exposure:"event"},[Ce]:{exposure:"event"},[xe]:{exposure:"event"},[Ee]:{exposure:"event"},[w]:{exposure:"hidden"},[k]:{exposure:"hidden"},[ye]:{exposure:"event"},[_]:{exposure:"hidden"},[f]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ie]:{exposure:"hidden"},[Te]:{exposure:"hidden"},[Me]:{exposure:"hidden"},[Pe]:{exposure:"hidden"},[Re]:{exposure:"hidden"},[Fe]:{exposure:"hidden"},[Ae]:{exposure:"hidden"},[re]:{exposure:"event"},[oe]:{exposure:"event"},[ae]:{exposure:"event"},[le]:{exposure:"event"},[De]:{exposure:"event"},[$e]:{exposure:"event"},[Ne]:{exposure:"hidden"},[Be]:{exposure:"hidden"},[qe]:{exposure:"hidden"},[He]:{exposure:"hidden"},[ze]:{exposure:"hidden"},[Ue]:{exposure:"hidden"},[We]:{exposure:"hidden"},[je]:{exposure:"hidden"},[Ve]:{exposure:"hidden"},[Ke]:{exposure:"event"}},Mk=[[ge,{exposure:"hidden"}],[_e,{exposure:"hidden"}],[fe,{exposure:"hidden"}]],Pk=e=>{const t=Tk[e];if(t)return t;for(const[t,i]of Mk)if(0===e.indexOf(t))return i},Rk={flags:f,surveys:P},Fk=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ak=e=>`${e}_cookie_identity_change_pending`,Lk=e=>{let t="",i=0;for(const n of e){const e=encodeURIComponent(JSON.stringify(n).slice(1,-1)).length;if(i+e>1e3)break;t+=n,i+=e}return t},Ok="main",Dk=[y,p,g,C,v,f,m,S],$k=e=>-1!==Dk.indexOf(e),Nk=[U,j],Bk=e=>-1!==Nk.indexOf(e),qk=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(i){return e===t}},Hk=e=>{if(!e)return{};const t=JSON.parse(e);return xt(t)?t:{}},zk=(e,t)=>{qr(e,(i,n)=>{const s=Pk(n);s&&"event"!==s.exposure||{}.hasOwnProperty.call(t,n)||delete e[n]})};var Uk=class{constructor(t,i,n=!0,s=!t.cookieless_mode){if(this._slotState={},this._splitStorageEligible=!1,this._storesIdentityInCookie=!1,this._splitStorage=!1,this._cookieIdentityChangePending=!1,this._cookieSyncSuppressed=!1,this._pendingCrossTabFeatureFlagChanges=new Map,this._storageMigrationInProgress=!1,this._localIdentityChangePending=!1,this._crossTabFeatureFlagIdentityMismatch=!1,this._metaIdentifierChangePending=new Set,this._crossTabFeatureFlagHandlers=new Set,this._config=t,this._ownsSplitStorage=n,this.props={},this._campaign_params_url=void 0,this._name=(e=>{let t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(t),this._disabled=t.disable_persistence||!!i,this._storage=this._buildStorage(t),this._splitStorage=this._resolveSplitStorage(t),this.load(s),this._markLoadedCrossTabFeatureFlagChangesPending(),t.debug&&$r.info("Persistence loaded",t.persistence,ct({},this.props)),this.update_config(t,t,i),this.save(),e){const t=()=>this.flush();Qr(e,"beforeunload",t,{capture:!1}),Qr(e,"pagehide",t,{capture:!1}),this._onStorage=t=>{if(this._splitStorageEligible&&(!t.storageArea||t.storageArea===(null==e?void 0:e.localStorage))&&t.key)if(t.key!==this._name){if(this._splitStorage){const e=Ik.find(e=>t.key===this._groupEntryName(e));e&&this._syncCrossTabFeatureFlagProperties(t.key,e)}}else this._syncCrossTabFeatureFlagProperties(t.key,Ok)},Qr(e,"storage",this._onStorage)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([e,t])=>{const i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!$k(e)||!0===i)return;if(!0===t)return void this._setCrossTabFeatureFlagChangesPending(e,!0);const n=new Set(i||[]);t.forEach(e=>n.add(e)),n.size&&this._setCrossTabFeatureFlagChangesPending(e,n)})}onCrossTabFeatureFlagChange(e){return this._crossTabFeatureFlagHandlers.add(e),()=>this._crossTabFeatureFlagHandlers.delete(e)}destroy(){this._onStorage&&e&&(e.removeEventListener("storage",this._onStorage),this._onStorage=void 0),this._crossTabFeatureFlagHandlers.clear()}_syncCrossTabFeatureFlagProperties(e,t,i=!0){if(this._disabled)return!1;let n,s;try{if(s=Ol._get(e),Pt(s)){const e=this._slotWriteState(t);return e.storageValue=null,t!==Ok&&(e.persisted=!1),!1}n=Hk(s)}catch(e){return!1}const r=t===Ok?n:Ol._parse(this._name);if(r&&this._hasCrossTabFeatureFlagIdentityMismatch(r))return!1;const o=this._mergeCrossTabFeatureFlagProperties(n,t,i);return t===Ok&&this._splitStorage&&!qk(this._partitionProps().main,n)||this._rememberCrossTabStorageFingerprint(n,t,!0,s),o}_hasCrossTabFeatureFlagIdentityMismatch(e){const t=this.props[D],i=e[D];return!It(t)&&!It(i)&&t!==i}_rememberCrossTabStorageFingerprint(e,t,i,n){const s=this._slotWriteState(t);s.storageValue=n,t!==Ok&&(s.persisted=i);try{s.fingerprint=this._entryFingerprint(e,t)}catch(e){s.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,i){let n=!1;return Dk.forEach(i=>{var s;const r=null===(s=Pk(i))||void 0===s?void 0:s.storageGroup;if(t===Ok&&this._splitStorage&&r||t!==Ok&&r!==t)return;const o=i in e,a=this._mergePendingCrossTabFeatureFlagChanges(i,o?e[i]:void 0),l=this._pendingCrossTabFeatureFlagChanges.has(i)?i in this.props:o;l===i in this.props&&qk(a,this.props[i])||(l?this._setProp(i,a,!1):this._deleteProp(i,!1),n=!0)}),n&&i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()),n}_reconcileCrossTabFeatureFlagPropertiesBeforeWrite(){if(!this._splitStorageEligible)return!1;try{this._crossTabFeatureFlagIdentityMismatch=!1;const e=Ol._get(this._name),t=this._slotWriteState(Ok);let i,n=!1,s=!1;if(e!==t.storageValue)if(Pt(e))t.storageValue=null;else{if(i=Hk(e),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(i),this._crossTabFeatureFlagIdentityMismatch)return!1;s=this._mergeCrossTabFeatureFlagProperties(i,Ok,!1),!this._splitStorage||qk(this._partitionProps().main,i)?this._rememberCrossTabStorageFingerprint(i,Ok,!0,e):t.storageValue=e,n=!0}return this._splitStorage&&Ik.forEach(e=>{const t=Ol._get(this._groupEntryName(e)),r=this._slotWriteState(e),o=i||{},a=n&&Dk.some(t=>{var i;return(null===(i=Pk(t))||void 0===i?void 0:i.storageGroup)===e&&t in o});if(t===r.storageValue&&!a)return;if(Pt(t))return r.storageValue=null,r.persisted=!1,void(a&&(s=this._mergeCrossTabFeatureFlagProperties(o,e,!1)||s));const l=Hk(t);s=this._mergeCrossTabFeatureFlagProperties(l,e,!1)||s,this._rememberCrossTabStorageFingerprint(l,e,!0,t)}),s}catch(e){return!1}}_setCrossTabFeatureFlagChangesPending(e,t){this._pendingCrossTabFeatureFlagChanges.set(e,t);const i=Pk(e);(null==i?void 0:i.volatile)||(this._slotWriteState((this._splitStorage?null==i?void 0:i.storageGroup:void 0)||Ok).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){Dk.forEach(e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{const e=Ol._get(this._name),t=Hk(e);this._slotWriteState(Ok).storageValue=e,Dk.forEach(e=>{var i;const n=this._splitStorage?null===(i=Pk(e))||void 0===i?void 0:i.storageGroup:void 0,s=n?Ol._get(this._groupEntryName(n)):null;if(n){const e=this._slotWriteState(n);e.storageValue=s,e.persisted=!Pt(s)}const r=n&&!Pt(s)?Hk(s):t;e in this.props?this._markPendingCrossTabFeatureFlagChanges(e,r[e],this.props[e]):e in r&&this._setCrossTabFeatureFlagChangesPending(e,!0)})}catch(e){}}_mergePendingCrossTabFeatureFlagChanges(e,t){const i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!i)return t;if(!0===i)return this.props[e];if("$active_feature_flags"===e){const n=new Set(kt(t)?t:[]),s=new Set(kt(this.props[e])?this.props[e]:[]);return i.forEach(e=>s.has(e)?n.add(e):n.delete(e)),Array.from(n)}const n=xt(t)?ct({},t):{},s=xt(this.props[e])?this.props[e]:{};return i.forEach(e=>{e in s?n[e]=s[e]:delete n[e]}),n}_markPendingCrossTabFeatureFlagChanges(e,t,i){if(!$k(e))return;const n=this._pendingCrossTabFeatureFlagChanges.get(e);if(!0===n)return;let s=t;if(this._splitStorageEligible)try{var r;const t=this._splitStorage?null===(r=Pk(e))||void 0===r?void 0:r.storageGroup:void 0,i=t?this._groupEntryName(t):this._name;s=Hk(Ol._get(i))[e]}catch(e){}const o=new Set(n||[]);if("$active_feature_flags"===e){if(!It(t)&&!kt(t)||!It(s)&&!kt(s)||!kt(i))return void this._setCrossTabFeatureFlagChangesPending(e,!0);const n=new Set(t||[]),r=new Set(s||[]),a=new Set(i);new Set([...n,...a]).forEach(e=>{n.has(e)!==a.has(e)&&o.add(e)}),o.forEach(e=>{r.has(e)===a.has(e)&&o.delete(e)})}else{if(!xt(i))return void(qk(s,i)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));{if(!It(t)&&!xt(t)||It(t)&&Et(i)&&It(s))return void this._setCrossTabFeatureFlagChangesPending(e,!0);const n=xt(t)?t:{},r=xt(s)?s:{};new Set([...Object.keys(n),...Object.keys(i)]).forEach(e=>{e in n==e in i&&qk(n[e],i[e])||o.add(e)}),o.forEach(e=>{e in r==e in i&&qk(r[e],i[e])&&o.delete(e)})}}o.size?this._setCrossTabFeatureFlagChangesPending(e,o):this._pendingCrossTabFeatureFlagChanges.delete(e)}_saveDebounceMs(){var e;const t=null===(e=this._config)||void 0===e?void 0:e.persistence_save_debounce_ms;return Ft(t)&&t>0?t:0}_rememberCurrentCookieProperties(e){if(this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase())if(e)try{const t=Hl(e,this._config.cookie_persisted_properties||[]),i=Ul(t,this._config.cookie_persisted_properties||[]),n=JSON.stringify(t)+"|"+JSON.stringify(i),s=Al._get(this._name)||void 0;s&&jl(this._name,s)===n&&(this._lastSeenCookiePropertiesFingerprint=n,this._lastSeenMainCookieValue=s)}catch(e){}else try{const e=Al._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=e?jl(this._name,e):void 0,this._lastSeenMainCookieValue=e}catch(e){}}syncCookieProperties(){return this._syncCookieProperties(this._config)}_syncCookieProperties(e,t=!1){if(this._disabled&&!t||this._cookieSyncSuppressed||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;let i;try{i=Al._get(this._name)||void 0}catch(e){}if(!i||i===this._lastSeenMainCookieValue)return!1;const n=jl(this._name,i);let s;try{s=ql(JSON.parse(i))}catch(e){return!1}if((Al._get(this._name)||void 0)!==i)return!1;this._lastSeenCookiePropertiesFingerprint=n,this._lastSeenMainCookieValue=i;const r=Wl(this._name,i),o=[...$l,...r.properties],a={};if(Object.keys(s).forEach(e=>{const t=s[e];(It(t)||Pt(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(a[e]=!0,delete s[e])}),Et(s))return!1;const l="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,c=this.props,u=c[D],d=c[Ie],h=Hr({},c);[...$l,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==o.indexOf(e)&&!(e in s)&&!a[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){const t=h[e];(r.isValid||-1===$l.indexOf(e)||!1!==t&&0!==t)&&delete h[e]}}),this.props=Hr(h,s),Dk.forEach(e=>{const t=e in this.props;e in c===t&&qk(c[e],this.props[e])||(t?this._markPendingCrossTabFeatureFlagChanges(e,c[e],this.props[e]):this._setCrossTabFeatureFlagChangesPending(e,!0))}),!l||"$user_state"in s||"$user_state"in this.props||this._setProp(Ie,Je);const m=this.props[D],k=this.props[Ie];return!l||m===u&&k===d||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,Kl._set(Ak(this._name),!0),this._deleteProp(S),this._deleteProp(p),this._deleteProp(y),this._deleteProp(g),this._deleteProp(C),this._deleteProp(v),this._deleteProp(f),this._deleteProp(_),this._deleteProp(w),"anonymous"!==k||"identified"!==d&&"anonymous"!==s.$user_state&&(It(u)||m===u)||(zk(this.props,s),this._deleteProp(b)),"identified"===k?this.props.$user_id=m:delete this.props.$user_id,this._deleteProp(q)),!0}consumeCookieIdentityChange(){const e=Ak(this._name),t=this._cookieIdentityChangePending||!!Kl._get(e);return this._cookieIdentityChangePending=!1,t&&Kl._remove(e),t}_beginCookieSyncSuppression(e=!1){return!(this._cookieSyncSuppressed||this._disabled&&!e||!this._config.cookieWinsOnConflict||"localstorage+cookie"!==this._config.persistence.toLowerCase()||(this._cookieSyncSuppressed=!0,0))}_publishSuppressedCookieSnapshot(){this._cookieSyncSuppressed&&(It(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),delete this._slotState[Ok],this._writeNow(!0))}_endCookieSyncSuppression(e=!0){if(this._cookieSyncSuppressed)try{e?this._publishSuppressedCookieSnapshot():It(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0)}finally{this._cookieSyncSuppressed=!1}}isDisabled(){return!!this._disabled}_buildStorage(t){-1===Fk.indexOf(t.persistence.toLowerCase())&&($r.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");const i=((t=[],i=!1,n=()=>!1)=>{const s=[...$l,...t];return ct(ct({},Ol),{},{_rawText(e){return[Al._get(e),Al._get(Nl(e)),Ol._get(e)].join("\0")},_parse(e){try{let r,o={};try{r=Al._get(e)||void 0,o=r?ql(JSON.parse(r)):{}}catch(e){}const a=JSON.parse(Ol._get(e)||"{}");let l;if(i){const i=Wl(e,r),n=[...$l,...i.properties],c={};Object.keys(o).forEach(e=>{const t=o[e];Pt(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(c[e]=t)});const u="distinct_id"in c||"anonymous"===c.$user_state||"identified"===c.$user_state;if(Object.keys(c).length>0){var t;const e=a[D],r=null!==(t=a.$user_state)&&void 0!==t?t:Je;s.forEach(e=>{if(-1!==n.indexOf(e)&&!(e in o)&&(u||"distinct_id"!==e&&"$user_state"!==e)){const t=a[e];(i.isValid||-1===$l.indexOf(e)||!1!==t&&0!==t)&&delete a[e]}}),!u||"$user_state"in o||"$user_state"in a||(a[Ie]=Je),!u||("distinct_id"in c?c[D]:a[D])===e&&("$user_state"in c?c[Ie]:a[Ie])===r||(Dl.forEach(e=>delete a[e]),"identified"===c.$user_state&&"distinct_id"in c?a.$user_id=c[D]:delete a.$user_id,"identified"!==c.$user_state&&(delete a[ye],delete a[b]),delete a.__alias)}l=Hr(a,c)}else l=Hr(o,a);return n()||Ol._set(e,l),l}catch(e){}return null},_set(e,n,s,r,o,a){const l=Ol._set(e,n,void 0,void 0,a);try{const c=Hl(n,t);if(Object.keys(c).length){if(i){const i=Nl(e),u=Ul(c,t);if(Al._set(i,u,s,r,o,a),Al._get(i)!==JSON.stringify(u)){Al._remove(i,r);const t=Hl(n);return Al._set(e,t,s,r,o,a),l}}Al._set(e,c,s,r,o,a)}}catch(e){Ol._error(e)}return l},_remove(t,i){try{null==e||e.localStorage.removeItem(t),Al._remove(t,i),Al._remove(Nl(t),i)}catch(e){Ol._error(e)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict,()=>!!this._disabled);let n,s=!1,r=!1;const o=t.persistence.toLowerCase();return"localstorage"===o&&Ol._is_supported()?(n=Ol,r=!0):"localstorage+cookie"===o&&i._is_supported()?(n=i,r=!0,s=!0):"sessionstorage"===o&&Kl._is_supported()?n=Kl:"memory"===o?n=Gl:"cookie"===o&&Al._is_supported()?(n=Al,s=!0):i._is_supported()?(n=i,r=!0,s=!0):Al._is_supported()?(n=Al,s=!0):n=Gl,this._splitStorageEligible=r,this._storesIdentityInCookie=s,n}_groupEntryName(e){return`${this._name}__${e}`}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){const e={};return qr(this.props,(t,i)=>{const n=Pk(i);if(!n||"event"===n.exposure){var s;if(null==n||null===(s=n.shouldSkipFromEventProperties)||void 0===s?void 0:s.call(n,t))return;e[i]=t}}),e}load(e=!1){if(this._disabled&&!e)return;const t=this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase(),i=t?Ol._parse(this._name):null;let n={};if(t)try{n=ql(Al._parse(this._name)),qr(n,(e,t)=>{(It(e)||Pt(e)||""===e)&&delete n[t]})}catch(e){}const s=this._storage._parse(this._name);if(s&&(this.props=Hr({},s)),this._splitStorage&&this._loadGroupEntries(),t&&s){var r,o;const e=null==i?void 0:i[D],t=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Je,a=s[D],l=null!==(o=s.$user_state)&&void 0!==o?o:Je;if(a!==e||l!==t){this._cookieIdentityChangePending=!0,this._disabled||Kl._set(Ak(this._name),!0);const i=Hr({},this.props);Dl.forEach(e=>delete i[e]),"anonymous"!==l||"identified"!==t&&"anonymous"!==n.$user_state&&(It(e)||a===e)||(zk(i,n),delete i[b]),this.props=i;const s=new Set;Dl.forEach(e=>{var t;const i=null===(t=Pk(e))||void 0===t?void 0:t.storageGroup;i&&s.add(i)}),s.forEach(e=>{if(this._disabled)return;const t={};qr(this.props,(i,n)=>{var s;(null===(s=Pk(n))||void 0===s?void 0:s.storageGroup)===e&&(t[n]=i)}),Et(t)?(Ol._remove(this._groupEntryName(e)),this._slotState[e]={}):Ol._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})})}}Kl._get(Ak(this._name))&&(this._cookieIdentityChangePending=!0)}_loadGroupEntries(){for(const e of Ik){const t=Ol._parse(this._groupEntryName(e));if(t&&!Et(t)){const i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||Hr(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some(t=>{var i;return(null===(i=Pk(t))||void 0===i?void 0:i.storageGroup)===e})}_groupEntryIsStale(e,t){const i=Rk[e];if(!i)return!1;const n=t[i],s=this.props[i];return Ft(n)&&Ft(s)&&s>n}refreshKey(e){this._refreshKeys([e])}_refreshKeys(e){if(this._disabled)return;let t,i=!1;const n=()=>(i||(t=this._storage._parse(this._name),i=!0),t);e.forEach(e=>{var t;if(this._metaIdentifierChangePending.has(e))return;const i=this._splitStorage?null===(t=Pk(e))||void 0===t?void 0:t.storageGroup:void 0,s=i?Ol._parse(this._groupEntryName(i)):n();if(s&&e in s)this._setProp(e,s[e],!1);else{if(i){const t=n();if(t&&e in t)return void this._setProp(e,t[e],!1)}this._deleteProp(e,!1)}})}refreshMetaIdentifiers(){if(this._disabled)return;const e=this._storageSnapshot();(It(e)||e!==this._metaIdentifierStorageSnapshot)&&(this._refreshKeys(Nk),this._rememberMetaIdentifierStorageSnapshot(e))}_rememberMetaIdentifierStorageSnapshot(e=this._storageSnapshot()){this._metaIdentifierStorageSnapshot=0===this._metaIdentifierChangePending.size?e:void 0}_storageSnapshot(){const e=this._storage._rawText?this._storage._rawText(this._name):this._storage._get(this._name);return Tt(e)?e:void 0}save(){if(this._disabled)return;const e=this._saveDebounceMs();e>0?It(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout(()=>{this._pendingSaveTimer=void 0,this._writeNow()},e)):this._writeNow()}flush(){It(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(e=!1){if(this._disabled||this._cookieSyncSuppressed&&!e)return;e||(this.syncCookieProperties(),this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase()||this.refreshMetaIdentifiers());const t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);const i=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)return void(this._config.debug&&$r.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this._splitStorage)return this._writeNowSplit(),void(i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()));const n=this._writeEntry(this._storage,this._name,this.props,Ok);"written"===n&&this._rememberCurrentCookieProperties(this.props),"failed"!==n&&(this._pendingCrossTabFeatureFlagChanges.clear(),this._localIdentityChangePending=!1,this._metaIdentifierChangePending.clear()),"written"===n&&this._rememberMetaIdentifierStorageSnapshot(),i&&this._crossTabFeatureFlagHandlers.forEach(e=>e())}_writeNowSplit(){const{main:e,groups:t}=this._partitionProps(),i=this._writeEntry(this._storage,this._name,e,Ok);"written"===i&&this._rememberCurrentCookieProperties(e),"failed"!==i&&(this._localIdentityChangePending=!1,this._metaIdentifierChangePending.clear(),Dk.forEach(e=>{var t;(null===(t=Pk(e))||void 0===t?void 0:t.storageGroup)||this._pendingCrossTabFeatureFlagChanges.delete(e)})),"written"===i&&this._rememberMetaIdentifierStorageSnapshot();for(const e of Ik){var n;const i=t[e];if(Et(i)&&!(null===(n=this._slotState[e])||void 0===n?void 0:n.persisted)){Dk.forEach(t=>{var i;(null===(i=Pk(t))||void 0===i?void 0:i.storageGroup)===e&&this._pendingCrossTabFeatureFlagChanges.delete(t)});continue}const s=this._writeEntry(Ol,this._groupEntryName(e),i,e);"failed"!==s&&Dk.forEach(t=>{const i=Pk(t);(null==i?void 0:i.storageGroup)!==e||"written"!==s&&i.volatile||this._pendingCrossTabFeatureFlagChanges.delete(t)})}}_partitionProps(){const e={},t={flags:{},surveys:{}};return qr(this.props,(i,n)=>{var s;const r=null===(s=Pk(n))||void 0===s?void 0:s.storageGroup;r?t[r][n]=i:e[n]=i}),{main:e,groups:t}}_entryFingerprint(e,t){if(t===Ok)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;const i={};return qr(e,(e,t)=>{var n;i[t]=(null===(n=Pk(t))||void 0===n?void 0:n.volatile)?"__volatile__":e}),JSON.stringify(i)}_writeEntry(e,t,i,n){const s=this._slotWriteState(n);if(n!==Ok&&!s.dirty&&!It(s.fingerprint))return"skipped";let r;try{if(r=this._entryFingerprint(i,n),r===s.fingerprint)return s.dirty=!1,"skipped"}catch(e){r=void 0}return e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(s.dirty=!1,n!==Ok&&(s.persisted=!0),It(r)||(s.fingerprint=r),this._splitStorageEligible&&(s.storageValue=Ol._get(t)),"written"):(this._config.debug&&$r.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this._markAllCrossTabFeatureFlagChangesPending(),It(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!e&&this._ownsSplitStorage)for(const e of Ik)Ol._remove(this._groupEntryName(e));e?delete this._slotState[Ok]:this._slotState={},this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(xt(e)){this.syncCookieProperties(),It(t)&&(t="None"),this._expire_days=It(i)?this._default_expiry:i;let n=!1;if(qr(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),n=!0)}),n)return this.save(),!0}return!1}register(e,t){if(xt(e)){this.syncCookieProperties(),this._expire_days=It(t)?this._default_expiry:t;let i=!1;if(qr(e,(t,n)=>{e.hasOwnProperty(n)&&(this.props[n]!==t||xt(t)||kt(t))&&(this._setProp(n,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t="string"==typeof e?[e]:e;let i=!1;for(const e of t)e in this.props&&(this._deleteProp(e),i=!0);i&&this.save()}update_campaign_params(){const e=null==n?void 0:n.URL;if(e===this._campaign_params_url)return;const t=Mc(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties),i=!Et(Wr(t));return i&&this.register(t),this._campaign_params_url=e,i?t:void 0}update_search_keyword(){this.register(function(){const e=null==n?void 0:n.referrer;return e?Rc(e):{}}())}update_referrer_info(){var e;this.register_once({$referrer:Oc(),$referring_domain:(null==n?void 0:n.referrer)&&(null===(e=Jr(n.referrer))||void 0===e?void 0:e.host)||Lc},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=Dc(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes);this.register_once({[Fe]:this._storesIdentityInCookie?{r:Lk(e.r),u:e.u?Lk(e.u):void 0}:e},void 0)}get_initial_props(){const e={};qr([Re,Pe],t=>{const i=this.props[t];i&&qr(i,function(t,i){e["$initial_"+mt(i)]=t})});const t=this.props[Fe];if(t){const i=function(e,t=!1){const i=$c(e,t),n={};return qr(i,function(e,t){n[`$initial_${mt(t)}`]=e}),n}(t,this._config.disable_capture_url_hashes);Hr(e,i)}return e}safe_merge(e){return qr(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){const n=e.persistence!==t.persistence,s=!((e,t)=>{if(e.length!==t.length)return!1;const i=[...e].sort(),n=[...t].sort();return i.every((e,t)=>e===n[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=n||s,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!i,l=!!this._disabled&&!a;a||this._syncCookieProperties(t,l),this._config=e,!a&&(n||s||o)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._syncCookieProperties(ct(ct({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));const c=r||o?this._buildStorage(e):this._storage;this._truncateExistingPersonInfoForCookie();const u=this._resolveSplitStorage(e),d=r||u!==this._splitStorage,h=!a&&(d||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(l);this._storageMigrationInProgress=d;try{if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){const e=this.props;this.clear(),this._storage=c,this._splitStorage=u,this.props=e,this.save()}else o&&(this._storage=c,a||(delete this._slotState[Ok],this._writeNow()))}finally{this._storageMigrationInProgress=!1,h&&this._endCookieSyncSuppression()}}_truncateExistingPersonInfoForCookie(){const e=this.props[Fe];if(!this._storesIdentityInCookie||!xt(e)||"string"!=typeof e.r)return;const t=Lk(e.r),i="string"==typeof e.u?Lk(e.u):e.u;t===e.r&&i===e.u||this._setProp(Fe,ct(ct({},e),{},{r:t,u:i}))}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const i=this.props.__timers||{};i[e]=t,this._setProp(V,i),this.save()}remove_event_timer(e){const t=this.props.__timers||{},i=t[e];return It(i)||(delete t[e],this._setProp(V,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t,i=!0){var n;const s=this.props[e];this.props[e]=t,i&&("distinct_id"!==e&&"$user_state"!==e||s===t||(this._localIdentityChangePending=!0),Bk(e)&&!qk(s,t)&&this._metaIdentifierChangePending.add(e),this._markPendingCrossTabFeatureFlagChanges(e,s,t),(null===(n=Pk(e))||void 0===n?void 0:n.volatile)||this._markGroupDirty(e))}_deleteProp(e,t=!0){delete this.props[e],t&&($k(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),Bk(e)&&this._metaIdentifierChangePending.add(e),this._markGroupDirty(e))}_markGroupDirty(e){var t;const i=null===(t=Pk(e))||void 0===t?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}};const Wk=Nr("[RateLimiter]");var jk=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{const t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Wk.info(`${e||"events"} is quota limited.`),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Wk.warn(`could not rate limit - continuing. Error: "${null==e?void 0:e.message}"`,{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null===(e=this.instance.config.rate_limiting)||void 0===e?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null===(e=this.instance.config.rate_limiting)||void 0===e?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,i,n;const{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,o=(new Date).getTime(),a=null!==(t=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_property("$capture_rate_limit"))&&void 0!==t?t:{tokens:s,last:o};a.tokens+=Math.max(0,o-a.last)/1e3*r,a.last=Math.max(a.last,o),a.tokens>s&&(a.tokens=s);const l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){const e=(Ft(a.dropped)?a.dropped:0)+1;a.dropped=e,!this.lastEventRateLimited&&this._captureWarning(e)&&(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}}_isPropertyAllowed(e){const t=this.instance.config.property_denylist;return!kt(t)||!t.includes(e)}_triggeringPage(){var e;if(this._isPropertyAllowed("$current_url")&&this._isPropertyAllowed("$pathname")&&(null==s?void 0:s.pathname))return`${null!==(e=s.origin)&&void 0!==e?e:""}${s.pathname}`}_captureWarning(e){var t,i;const{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,r=this._triggeringPage(),o=this._isPropertyAllowed("$session_id")?null===(t=(i=this.instance).get_session_id)||void 0===t?void 0:t.call(i):void 0,a=[`${e} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${s} events per second and ${n} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}};const Vk=Nr("[RemoteConfig]");var Gk=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null===(e=d._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.config}_loadRemoteConfigJs(e){var t,i,n;(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.loadExternalDependency)?null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return Vk.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Vk.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(e=>{if(!e)return Vk.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(e=>{this._onRemoteConfig(e.json,e)});this._onRemoteConfig(e)})}catch(e){Vk.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||Vk.warn("Failed to fetch remote config from PostHog."):Vk.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){Vk.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null===(i=this._instance.featureFlags)||void 0===i||i.ensureFlagsLoaded()}catch(e){Vk.error("Error loading feature flags",e)}}};let Qk=!_b&&-1===(null==c?void 0:c.indexOf("MSIE"))&&-1===(null==c?void 0:c.indexOf("Mozilla"));function Kk(e,t,i){var n,s,r;i&&(t=ct(ct({},t),{},{callback:e=>i(e)})),e.__loaded?Qk?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null===(s=t.callback)||void 0===s||s.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=ct(ct({},e.config.request_headers),t.headers),t.compression="best-available"===t.compression?null!==(n=e.compression)&&void 0!==n?n:t.compressionFallback:t.compression,(It(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((e,t)=>{var i,n,s;const r=ct(ct({},e),{},{callback:null!=t?t:t=>{var i;return null===(i=e.callback)||void 0===i?void 0:i.call(e,t)}});r.timeout=r.timeout||6e4;const o=null!==(i=r.transport)&&void 0!==i?i:"fetch";"sendBeacon"===o&&It(r.compression)&&r.data&&(r.compression=jy),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(e=>{var t,i;const n=(kt(e)?e:[e]).map(e=>ct(ct({},e),e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})),s=n[0];return{api_key:null!==(t=null==s||null===(i=s.properties)||void 0===i?void 0:i.token)&&void 0!==t?t:null==s?void 0:s.token,batch:n,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((e,t=(new Date).toISOString())=>kt(e)?e.map(e=>ct(ct({},e),{},{sent_at:t})):ct(ct({},e),{},{sent_at:t}))(r.data))),r.url=Fb(r.url,r.method,r.compression,r.timestampMode);const a=Ab.filter(e=>!r.disableTransport||!e.transport||!r.disableTransport.includes(e.transport)),c=null!==(n=null===(s=function(e,t){for(let i=0;e.length>i;i++)if(t(e[i]))return e[i]}(a,e=>e.transport===o))||void 0===s?void 0:s.method)&&void 0!==n?n:a[0].method;if(!c)throw new Error("No available transport method");const u=e=>{try{c(e)}catch(e){var t;Ib(e)?$r.warn(e):$r.error(e),null===(t=r.callback)||void 0===t||t.call(r,{statusCode:0,error:e})}};"sendBeacon"!==o&&!r.preferSyncCompression&&r.data&&r.compression===Wy&&l&&"undefined"!=typeof Promise&&!yb?xb(r).then(e=>{u(e)}).catch(t=>{if(ps(t))return yb=!0,void u(ct(ct({},r),{},{compression:void 0,url:Fb(e.url,e.method,void 0,e.timestampMode)}));gs(t)&&(yb=!0),u(r)}):u(r)})(t,(n,s)=>{var r,o,a;e.rateLimiter.checkForLimiting(n),400>n.statusCode||null===(r=(o=e.config).on_request_error)||void 0===r||r.call(o,n),i?i(n,s):null===(a=t.callback)||void 0===a||a.call(t,n)})):t.fireCallbackOnDrop&&(null===(r=t.callback)||void 0===r||r.call(t,{statusCode:0}))}var Jk=class{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Kt((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,$r.createLogger("flush interval"),3e3),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();const e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this._sendRequestSafely(ct(ct({},e),{},{callback:void 0}),"sendBeacon")})}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){this._isPaused||(this._flushTimeout=setTimeout(()=>{this._clearFlushTimeout(),this._flush()},this._flushTimeoutMs))}_flush(){if(this._queue.length>0){const e=this._formatQueue();for(const t in e)this._sendRequestSafely(e[t])}}_sendRequestSafely(e,t){try{this._sendRequest(e,t)}catch(e){$r.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){const e={},t={};qr(this._queue,i=>{var n;const s=i,r=((s?s.batchKey:null)||s.url)+(s.batchGroup?`:${s.batchGroup}`:"");It(e[r])&&(e[r]=ct(ct({},s),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),t[r]=[]),null===(n=e[r].data)||void 0===n||n.push(s.data),s.callback&&t[r].push(s.callback)});for(const i in t){const n=t[i];n.length&&(e[i].callback=e=>{for(const t of n)t(e)})}return this._queue=[],e}};const Zk=["retriesPerformedSoFar"];var Yk=class{constructor(e){this._instance=e,this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._queue=[],this._areWeOnline=!0,this.resume()}resume(){if(!It(e)&&"onLine"in e.navigator){if(this._areWeOnline=e.navigator.onLine,this._onlineListener)return;this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},Qr(e,"online",this._onlineListener),Qr(e,"offline",this._offlineListener)}}get length(){return this._queue.length}retriableRequest(e,t){let{retriesPerformedSoFar:i}=e,n=bs(e,Zk);At(i)&&(n.url=Sb(n.url,{retry_count:i})),Kk(this._instance,t?ct(ct({},n),{},{transport:t}):n,(e,t)=>{var s;if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=i?i:0))return void this._enqueue(ct({retriesPerformedSoFar:i},n),t);0===e.statusCode&&$r.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,e)})}_enqueue(e,t){const i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;const n=Math.max(function(e){const t=3e3*Math.pow(2,e),i=t/2,n=Math.min(18e5,t),s=(Math.random()-.5)*(n-i);return Math.ceil(n+s)}(i),null!=t?t:0),s=Date.now()+n;this._queue.push({retryAt:s,requestOptions:e});let r=`Enqueued failed request for retry in ${n}`;navigator.onLine||(r+=" (Browser is offline)"),$r.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout(()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()},this._pollIntervalMs)}_flush(){const e=Date.now(),t=[],i=this._queue.filter(i=>e>i.retryAt||(t.push(i),!1));if(this._queue=t,i.length>0)for(const{requestOptions:e}of i)this.retriableRequest(e)}unload(){this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,It(e)||(this._onlineListener&&(e.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(e.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0));for(const{requestOptions:e}of this._queue)try{this._instance._send_request(ct(ct({},e),{},{callback:kt(e.data)?void 0:e.callback,transport:"sendBeacon"}))}catch(e){$r.error(e)}this._queue=[]}},Xk=class{constructor(e){this._instance=e,this._updateScrollData=()=>{var e,t,i,n;this._context||(this._context={});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._context.lastScrollY=Math.ceil(r),this._context.maxScrollY=Math.max(r,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(n=this._context.maxContentHeight)&&void 0!==n?n:0)}}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){const e=this._context;return this._context=void 0,setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){Qr(e,"scroll",this._updateScrollData,{capture:!0}),Qr(e,"scrollend",this._updateScrollData,{capture:!0}),Qr(e,"resize",this._updateScrollData)}scrollElement(){if(this._scrollRoot){const i=kt(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(const n of i){var t;const i=null==e||null===(t=e.document)||void 0===t?void 0:t.querySelector(n);if(i)return i}return}var i;return null==e||null===(i=e.document)||void 0===i?void 0:i.documentElement}_scrollPosition(t){var i,n;const s="y"===t?"scrollTop":"scrollLeft";if(this._scrollRoot){const e=this.scrollElement();return e&&e[s]||0}return e?"y"===t?e.scrollY||e.pageYOffset||(null===(i=e.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:e.scrollX||e.pageXOffset||(null===(n=e.document)||void 0===n||null===(n=n.documentElement)||void 0===n?void 0:n.scrollLeft)||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}};const eC=e=>Dc(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes);var tC=class{constructor(e,t,i,n){this._onSessionIdCallback=e=>{const t=this._getStored();if(t&&t.sessionId===e)return;const i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[Te]:i})},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=n||eC,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[Te]}getSetOnceProps(){var e;const t=null===(e=this._getStored())||void 0===e?void 0:e.props;return t?"r"in t?$c(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){const e={};return qr(Wr(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e[`$session_entry_${mt(i)}`]=t}),e}};const iC=Nr("[SessionId]"),nC=864e5;var sC=class{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var n;if(this._lastPersistedActivityTimestamp=null,this._lastCookieSyncTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new Gy,this._sessionHasBeenIdleTooLong=(e,t)=>!(!At(e)||!At(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._pendingBootstrapSession=void 0,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||Tl,this._windowIdGenerator=i||Tl;const s=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Kt(this._config.session_idle_timeout_seconds||1800,60,36e3,iC.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){const e=Kl._parse(this._window_id_storage_key),t=Kl._parse(this._primary_window_exists_storage_key);e&&!t?this._windowId=e:Kl._remove(this._window_id_storage_key),Kl._set(this._primary_window_exists_storage_key,!0)}(null===(n=this._config.bootstrap)||void 0===n?void 0:n.sessionID)&&this.setBootstrapSessionId(this._config.bootstrap.sessionID),this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return It(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(t=>t!==e)}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&Kl._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Kl._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Kl._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){const t=this._lastPersistedActivityTimestamp;return!Pt(t)&&!Pt(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){const n=t!==this._sessionActivityTimestamp,s=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,s&&!n||s&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[ce]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e;const t=null===(e=this._config)||void 0===e?void 0:e.persistence_save_debounce_ms;return At(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(ce):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(Pt(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this._lastPersistedActivityTimestamp)return;this._refreshSessionIdFromStorage();const[,t,i]=this._getSessionId();t===this._sessionId&&i===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[ce]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}_freshestActivityTimestamp(){const[e]=this._getSessionId(),t=At(e)?e:0,i=At(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){const e=this._persistence.props[ce];return kt(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,this._pendingBootstrapSession=void 0,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}setBootstrapSessionId(e,t=!1){const i=((e,t=(new Date).getTime())=>{try{const i=(e=>{const t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(e);return i>t+6e4?void iC.error("Bootstrap sessionID cannot be in the future"):i}catch(e){return void iC.error("Invalid sessionID in bootstrap",e)}})(e);return!It(i)&&(t?this._pendingBootstrapSession={sessionId:e,sessionStartTimestamp:i}:this._setSessionId(e,(new Date).getTime(),i),!0)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&e&&(e.removeEventListener(Xe,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Kl._remove(this._primary_window_exists_storage_key)},Qr(e,Xe,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,i=!1){if("always"===this._config.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const n=t||(new Date).getTime(),s=this._sessionId;if(i)this._lastCookieSyncTimestamp=n;else if(Pt(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>n||n-this._lastCookieSyncTimestamp>=1e3){var r,o;null===(r=(o=this._persistence).syncCookieProperties)||void 0===r||r.call(o),this._lastCookieSyncTimestamp=n}let[,a,l]=this._getSessionId();const c=!It(s)&&a!==s,u=this._freshestActivityTimestamp();let d=this._getWindowId();const h=this._pendingBootstrapSession,p=!!h&&(h.sessionStartTimestamp>n+6e4||n-h.sessionStartTimestamp>nC),g=h?p:At(l)&&Math.abs(n-l)>nC;let _=!1,f=c,v=!a||!!h;const m=a;let y=!v&&!e&&this._sessionHasBeenIdleTooLong(n,u);if(y&&(y=this._isSessionIdleAfterCrossTabRefresh(n),y||iC.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this._getSessionId(),y||(v=!a||!!h)),v||y||g){f=!1;const e=h&&!p;a=e?h.sessionId:this._sessionIdGenerator(),d=this._windowIdGenerator(),iC.info("new session ID assigned",{sessionId:a,windowId:d,bootstrapped:!!e,changeReason:{noSessionId:v,activityTimeout:y,sessionPastMaximumLength:g}}),l=e?h.sessionStartTimestamp:n,this._pendingBootstrapSession=void 0,_=!0}else d||(d=this._windowIdGenerator(),_=!0),f=f||a!==m,f&&(iC.info("adopted cross-tab session id",{sessionId:a,windowId:d}),_=!0);const b=At(u)&&e&&!g?u:n,S=At(l)?l:(new Date).getTime();this._setWindowId(d),this._setSessionId(a,b,S),e||this._resetIdleTimer();const w={noSessionId:v,activityTimeout:y,sessionPastMaximumLength:g,crossTabAdoption:f};return _&&this._sessionIdChangedHandlers.forEach(e=>e(a,d,w)),{sessionId:a,windowId:d,sessionStartTimestamp:S,changeReason:_?w:void 0,lastActivityTimestamp:u}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){const e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()},1.1*this.sessionTimeoutMs))}};const rC=Object.freeze(["2026-08-30","2026-08-29","2026-06-25","2026-05-30","2026-01-30","2025-11-30","2025-05-24"]),oC=function(e,t){if(!e)return!1;const i=e.userAgent;if(i&&Qt(i,t))return!0;try{const i=null==e?void 0:e.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(e=>Qt(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver};function aC(){return aC=rt(function*(){const e=null==i?void 0:i.userAgentData;if(null==e?void 0:e.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return Tt(i)&&i.length>0?i:void 0}catch(e){return void $r.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}}),aC.apply(this,arguments)}const lC="custom",cC="i.posthog.com",uC=/^\/static\//,dC=["/s/","/e/","/i/"];var hC=class{constructor(e){this._regionCache={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${cC}`,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":lC),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(!uC.test(e))return;const t=this.instance.config.asset_host;return"string"==typeof t&&t.trim().replace(/\/$/,"")||void 0}_urlKey(e){const t=Jr(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,i){if("ui"===e)return i;let n=i;const s=this.instance.config.rewriteRequestPath;if(s){var r;const e=(null===(r=Jr(i))||void 0===r?void 0:r.href)||i;n=s(new URL(e)).toString()}if(s&&"api"===e&&dC.some(e=>0===t.indexOf(e))){const e=this._urlKey(n);if(e){const t=this.apiHost;let i=this._ingestionEndpoints;(null==i?void 0:i.apiHost)===t&&i.rewriteRequestPath===s||(i={apiHost:t,rewriteRequestPath:s,urls:new Set},this._ingestionEndpoints=i),i.urls.add(e)}}return n}isIngestionEndpoint(e){const t=this._ingestionEndpoints,i=this._urlKey(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t=""){if(t&&(t="/"===t[0]?t:`/${t}`),"ui"===e)return this._prepareEndpoint(e,t,this.uiHost+t);if("flags"===e)return this._prepareEndpoint(e,t,this.flagsApiHost+t);if("assets"===e){const i=this._staticAssetHostOverride(t);if(i)return this._prepareEndpoint(e,t,`${i}${t}`)}if(this.region===lC)return this._prepareEndpoint(e,t,this.apiHost+t);const i=cC+t;switch(e){case"assets":return this._prepareEndpoint(e,t,`https://${this.region}-assets.${i}`);case"api":return this._prepareEndpoint(e,t,`https://${this.region}.${i}`)}}};const pC=Nr("[PostHog ExternalIntegrations]"),gC={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var _C=class{constructor(e){this._instance=e}_loadScript(e,t){var i,n;null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,e,e=>{if(e)return pC.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e;for(const[s,r]of Object.entries(null!==(e=this._instance.config.integrations)&&void 0!==e?e:{})){var t,i,n;r&&!(null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t?void 0:t[s])&&this._loadScript(gC[s],()=>{var e;null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e||null===(e=e[s])||void 0===e||e.start(this._instance)}),!r&&(null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[s])&&(null===(n=d.__PosthogExtensions__)||void 0===n||null===(n=n.integrations)||void 0===n||null===(n=n[s])||void 0===n||n.stop())}}};const fC={};let vC=0;const mC=()=>{},yC='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',bC="Surveys module not available",SC="sanitize_properties is deprecated. Use before_send instead",wC="Invalid value for property_denylist config: ",kC=["$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"],CC=["$feature_flag_called","$$heatmap","$snapshot"],xC=e=>"$"===e.charAt(0)&&!ft(CC,e),EC=/^[A-Za-z0-9_-]{1,400}$/,IC=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,TC=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,MC=["token","distinct_id",Oe],PC="posthog",RC=[...rC].sort()[rC.length-1],FC=e=>{const t={};return e&&"unset"!==e?("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0),t):t},AC=t=>{var i;return ct({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Gr(null==n?void 0:n.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:mC,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_replay_sync_fetch:!0,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&Tt(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==e||null===(i=e.location)||void 0===i?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(e){$r.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Ye,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:mC},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Eo,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:FC(e),external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e),cookieWinsOnConflict:!(!e||"unset"===e||"2026-08-29">e)}))(t))},LC=[["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"]],OC=e=>{const t={};for(const[i,n]of LC)It(e[i])||(t[n]=e[i]);const i=Hr({},t,e),n=e.__preview_external_dependency_versioned_paths;return It(n)||(It(e.strict_script_versioning)&&(i.strict_script_versioning=!!n),Tt(n)&&It(e.asset_host)&&(i.asset_host=n)),kt(e.property_blacklist)&&(It(e.property_denylist)?i.property_denylist=e.property_blacklist:kt(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:$r.error(wC+e.property_denylist)),i};var DC=class{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){$r.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},$C=class t{_removeExtension(e){if(!e)return;const t=this._extensions.indexOf(e);-1!==t&&this._extensions.splice(t,1)}_replaceExtension(e,t){var i;return this._removeExtension(e),this._extensions.push(t),null===(i=t.initialize)||void 0===i||i.call(t),t}_inCookielessMode(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}_warnIfVolatileIdentityWithoutStableId(){if(this._hasWarnedAboutVolatileIdentity)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this._inCookielessMode())return;const e="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!e&&!this.config.disable_persistence)return;if(this._hasStableInitialDistinctId)return;let t,i,n;e?(t=`persistence is set to '${this.config.persistence}'`,i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",n="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",i="on every page load",n="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._hasWarnedAboutVolatileIdentity=!0,console.warn("[PostHog.js]",`${t} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${n}`)}_syncCookielessIdentity(){const e=this.persistence;if(!e||this._isConsentTransition)return;if(this._inCookielessMode())return void("on_reject"===this.config.cookieless_mode&&"$posthog_cookieless"!==this.get_distinct_id()&&(this._sync_opt_out_with_persistence(),this._enterCookielessMode()));if("$posthog_cookieless"!==this.get_distinct_id())return;this._is_persistence_disabled()||e.load(!0);const t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){const t=this.config.get_device_id(Tl());this.register({distinct_id:t,$device_id:t}),e.set_property(Ie,Je)}this._sync_opt_out_with_persistence()}get decideEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this._isPageUnloading=!1,this._isShutdown=!1,this.webPerformance=new DC,this._personProcessingSetOncePropertiesSent=!1,this.version=Jl.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new Gy,this._extensions=[],this._extensionEventPropertyProducers=[],this._replayDebugPropertiesPaused=!1,this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._isConsentTransition=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=AC(),this.SentryIntegration=xk,this.sentryIntegration=e=>function(e,t){const i=Ck(e,t);return{name:kk,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new Xk(this),this.pageViewManager=new Ek(this),this.rateLimiter=new jk(this),this.requestRouter=new hC(this),this.consent=new fk(this),this.externalIntegrations=new _C(this);const i=null!==(e=t.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{const n=Tt(e)?{[e]:t}:e;this.setPersonProperties(n),null==i||i({})},set_once:(e,t,i)=>{const n=Tt(e)?{[e]:t}:e;this.setPersonProperties(void 0,n),null==i||i({})}},this.on("eventCaptured",e=>$r.info(`send "${null==e?void 0:e.event}"`,e))}init(e,i,n){if(n&&n!==PC){var s;const r=null!==(s=fC[n])&&void 0!==s?s:new t;return r._init(e,i,n),fC[n]=r,fC[PC][n]=r,r}return this._init(e,i,n)}_init(t,i={},n){var s,r,o;const a=Tt(t)?t.trim():"";if(!a)return $r.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=AC(i.defaults),i.debug=this._checkLocalStorageForDebug(i.debug),this._originalUserConfig=i,this._triggered_notifs=[],i.person_profiles?this._initialPersonProfilesConfig=i.person_profiles:i.process_person&&(this._initialPersonProfilesConfig=i.process_person);const c=AC(i.defaults),u=OC(i),d=Hr({},c,u,{name:n,token:a});xt(c.rageclick)&&xt(u.rageclick)&&(d.rageclick=Hr({},c.rageclick,u.rageclick)),xt(c.session_recording)&&xt(u.session_recording)&&(d.session_recording=Hr({},c.session_recording,u.session_recording)),this.set_config(d),this.config.on_xhr_error&&$r.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Wy;const h=this._is_persistence_disabled(),p=!this._inCookielessMode();if(this.persistence=new Uk(this.config,h,!0,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Uk(ct(ct({},this.config),{},{persistence:"sessionStorage"}),h,!1,p),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!h&&Kl._is_supported()){const e=Kl._parse(this._sessionRegisteredPropertiesStorageKey);kt(e)&&e.forEach(e=>{Tt(e)&&this._sessionRegisteredPropKeys.add(e)})}else Kl._remove(this._sessionRegisteredPropertiesStorageKey);const g=ct({},this.persistence.props),_=ct({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new Jk((e,t)=>this._send_retriable_request(e,t),this.config.request_queue_config),this._retryQueue=new Yk(this),this.__request_queue=[];const f=this._inCookielessMode();f||(this.sessionManager=new sC(this),this.sessionPropsManager=new tC(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this._clearSessionRegisteredProps()})),this._enrollFeatureFlags(),this.config.__preview_deferred_init_extensions?($r.info("Deferring extension initialization to improve startup performance"),this._extensionInitTimeout=setTimeout(()=>{this._extensionInitTimeout=void 0,this._initExtensions(f)},0)):($r.info("Initializing extensions synchronously"),this._initExtensions(f)),Jl.DEBUG=Jl.DEBUG||this.config.debug,Jl.DEBUG&&$r.info("Starting in debug mode",{this:this,config:i,thisC:ct({},this.config),p:g,s:_}),this.config.identity_distinct_id&&!(null===(s=i.bootstrap)||void 0===s?void 0:s.distinctID)&&(i.bootstrap=ct(ct({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const v=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this._hasStableInitialDistinctId=!!v&&!Mt(v),null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID){const e=i.bootstrap.distinctID,t=this.get_distinct_id(),n=this.persistence.get_property(Ie);if(i.bootstrap.isIdentifiedID&&null!=t&&t!==e&&"anonymous"===n)this.identify(e);else if(i.bootstrap.isIdentifiedID&&null!=t&&t!==e&&"identified"===n)$r.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const t=this.config.get_device_id(Tl()),n=i.bootstrap.isIdentifiedID?t:e;this.persistence.set_property(Ie,i.bootstrap.isIdentifiedID?Ze:Je),this.register({distinct_id:e,$device_id:n})}}if(f)this.register_once({distinct_id:Le,$device_id:null},"");else if(!this.get_distinct_id()){const e=this.config.get_device_id(Tl());this.register_once({distinct_id:e,$device_id:e},""),this.persistence.set_property(Ie,Je)}return Qr(e,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Qr(e,"pageshow",e=>{if(this._isPageUnloading=!1,!this._isShutdown){var t;if(e.persisted&&this.persistence){const e=this.persistence.get_property(D),t=this.persistence.get_property(Ie);this.persistence.load(),this._processCookieIdentityChange()||e===this.persistence.get_property("distinct_id")&&t===this.persistence.get_property("$user_state")||this._processIdentityChange()}null===(t=this._retryQueue)||void 0===t||t.resume()}}),i.segment?wk(this,()=>this._loaded()):this._loaded(),Ct(this.config._onCapture)&&this.config._onCapture!==mC&&($r.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&$r.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 aC.apply(this,arguments)}().then(e=>{e&&this.register({[B]:e})}).catch(mC),this}_isSharedExtension(e){const t=e;return Tt(t.name)&&Ct(t.setup)}_enrollExtension(e,t){var i=this;this._isSharedExtension(e)?t.push(rt(function*(){try{yield e.setup(i._getBrowserClientAdapter())}catch(i){$r.error(`Failed to set up extension "${e.name}"`,i);try{var t;yield null===(t=e.dispose)||void 0===t?void 0:t.call(e)}catch(t){$r.error(`Failed to dispose extension "${e.name}"`,t)}}})):this._extensions.push(e)}_enrollFeatureFlags(){var e,i,n,s=this;const r=null!==(e=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==e?e:null===(n=t.__defaultExtensionClasses)||void 0===n?void 0:n.featureFlags;var o,a,l;if(r)if(this.featureFlags&&this.featureFlags instanceof r||(null===(o=this._featureFlagsReloadingUnsubscribe)||void 0===o||o.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new r(this)),Ct(this.featureFlags.onReloading)&&Ct(this.featureFlags.setup)){if(!this._featureFlagsReloadingUnsubscribe){this._featureFlagsReloadingUnsubscribe=this.featureFlags.onReloading(()=>{this._internalEventEmitter.emit("featureFlagsReloading",!0)});const e=this.featureFlags;rt(function*(){try{yield e.setup(s._getBrowserClientAdapter())}catch(t){$r.error("Failed to set up feature flags",t);const i=s._featureFlagsReloadingUnsubscribe;s._featureFlagsReloadingUnsubscribe=void 0;try{null==i||i()}catch(e){$r.error("Failed to unsubscribe feature flag reloading",e)}try{yield e.dispose()}catch(e){$r.error("Failed to dispose feature flags",e)}}})()}}else null===(a=(l=this.featureFlags).initialize)||void 0===a||a.call(l)}_initExtensions(e){const i=performance.now(),n=ct(ct({},t.__defaultExtensionClasses),this.config.__extensionClasses),s=[];var r,o,a,l,c,u,d,h;n.exceptions&&this._extensions.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new n.exceptions(this)),n.historyAutocapture&&this._extensions.push(this.historyAutocapture=new n.historyAutocapture(this)),n.tracingHeaders&&this._extensions.push(this.tracingHeaders=new n.tracingHeaders(this)),n.siteApps&&this._extensions.push(this.siteApps=new n.siteApps(this)),n.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new n.sessionRecording(this)),this.config.disable_scroll_properties||s.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),n.autocapture&&this._enrollExtension(this.autocapture=new n.autocapture(this),s),n.surveys&&this._enrollExtension(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new n.surveys(this),s),n.logs&&this._enrollExtension(this.logs=null!==(a=this.logs)&&void 0!==a?a:new n.logs(this),s),n.metrics&&this._extensions.push(this.metrics=null!==(l=this.metrics)&&void 0!==l?l:new n.metrics(this)),n.conversations&&this._extensions.push(this.conversations=null!==(c=this.conversations)&&void 0!==c?c:new n.conversations(this)),n.productTours&&this._extensions.push(this.productTours=new n.productTours(this)),n.heatmaps&&this._extensions.push(this.heatmaps=new n.heatmaps(this)),n.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new n.webVitalsAutocapture(this)),n.exceptionObserver&&this._extensions.push(this.exceptionObserver=new n.exceptionObserver(this)),n.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new n.deadClicksAutocapture(this,yk)),n.toolbar&&this._extensions.push(this.toolbar=null!==(u=this.toolbar)&&void 0!==u?u:new n.toolbar(this)),n.experiments&&this._extensions.push(this.experiments=null!==(d=this.experiments)&&void 0!==d?d:new n.experiments(this)),n.webMCP&&this._extensions.push(this.webMCP=null!==(h=this.webMCP)&&void 0!==h?h:new n.webMCP(this)),this._extensions.forEach(e=>{e.initialize&&s.push(()=>{var t;null===(t=e.initialize)||void 0===t||t.call(e)})}),s.push(()=>{if(this._pendingRemoteConfig){const e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach(t=>{var i;return null===(i=t.onRemoteConfig)||void 0===i?void 0:i.call(t,e)})}}),this._processInitTaskQueue(s,i)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void(this._extensionInitTimeout=setTimeout(()=>{this._extensionInitTimeout=void 0,this._processInitTaskQueue(e,t)},0));const i=e.shift();if(i)try{i()}catch(e){$r.error("Error initializing extension:",e)}}const i=Math.round(performance.now()-t);this.register_for_session({[De]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[$e]:i}),this.config.__preview_deferred_init_extensions&&$r.info(`PostHog extensions initialized (${i}ms)`)}_onRemoteConfig(e){if(!n||!n.body)return $r.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(e)},500);if(this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.ok){var t;const i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=ft(i.supportedCompression,Wy)?Wy:ft(i.supportedCompression,jy)?jy:void 0),(null===(t=i.analytics)||void 0===t?void 0:t.endpoint)&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Ye}),this._internalEventEmitter.emit("extensionsRemoteConfig",e),this._extensions.forEach(t=>{var i;return null===(i=t.onRemoteConfig)||void 0===i?void 0:i.call(t,e)})}_loaded(){try{this.config.loaded(this)}catch(e){$r.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&(null==s?void 0:s.hostname)){const e=s.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()},1),this._remoteConfigLoader=new Gk(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null===(e=this._requestQueue)||void 0===e||e.enable())}_dom_loaded(){this.is_capturing()&&Br(this.__request_queue,e=>this._send_retriable_request(e)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,n,s,r;this._isPageUnloading=!0,null===(e=this.surveys)||void 0===e||null===(t=e.handlePageUnload)||void 0===t||t.call(e),null===(i=this.metrics)||void 0===i||i.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(tt),null===(n=this.logs)||void 0===n||n.flushLogs("sendBeacon"),null===(s=this._requestQueue)||void 0===s||s.unload(),null===(r=this._retryQueue)||void 0===r||r.unload()):this._shouldCapturePageleave()&&this.capture(tt,null,{transport:"sendBeacon"})}_send_request(e){Kk(this,e)}_send_retriable_request(e,t){this._retryQueue?this._retryQueue.retriableRequest(e,t):this._send_request(t?ct(ct({},e),{},{transport:t}):e)}_execute_array(e){vC++;try{let t;const i=[],n=[],s=[];Br(e,e=>{if(e)if(t=e[0],kt(t))s.push(e);else if(Ct(e))try{e.call(this)}catch(t){$r.error("Error executing queued PostHog call",e,t)}else kt(e)&&"alias"===t?i.push(e):kt(e)&&-1!==t.indexOf("capture")&&Ct(this[t])?s.push(e):n.push(e)});const r=function(e,t){Br(e,function(e){try{if(kt(e[0])){let i=t;qr(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){$r.error("Error executing queued PostHog call",e,t)}})};r(i,this),r(n,this),r(s,this)}finally{vC--}}push(e){if(vC>0&&kt(e)&&Tt(e[0])){const i=t.prototype[e[0]];return void(Ct(i)&&i.apply(this,e.slice(1)))}this._execute_array([e])}get _facebookClickIdChannel(){return{property:z,persistenceKey:U,cookieName:"_fbc",pattern:IC,register:(e,t)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[U]:{value:e,delivered:t}})},unregister:()=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.unregister(U)}}}get _facebookBrowserIdChannel(){return{property:W,persistenceKey:j,cookieName:"_fbp",pattern:TC,register:(e,t)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[j]:{value:e,delivered:t}})},unregister:()=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.unregister(j)}}}_getPersistedMetaIdentifier(e){var t;const i=null===(t=this.persistence)||void 0===t?void 0:t.get_property(e.persistenceKey);return Tt(i)&&e.pattern.test(i)?{value:i,delivered:!1}:xt(i)&&Tt(i.value)&&e.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}_storeMetaIdentifier(e,t,i){return t===(null==i?void 0:i.value)?{value:t,pending:!i.delivered}:(e.register(t,!1),{value:t,pending:!0})}_readMetaCookie(e){if(!this.config.save_campaign_params||this._inCookielessMode())return;const t=Sl(e.cookieName);return Tt(t)&&e.pattern.test(t)?t:void 0}_updateFacebookClickId(e,t,i,n){if(!this.persistence)return;const s=this._facebookClickIdChannel;this.persistence.refreshMetaIdentifiers();const r=this._getPersistedMetaIdentifier(s);if(n)return void s.unregister();if(i)return Tt(t)&&IC.test(t)?this._storeMetaIdentifier(s,t,r):void s.unregister();const o=Tt(e)&&EC.test(e)?e:void 0,a=this._readMetaCookie(s);return a&&((e,t,i)=>{const n=e.split(".");if(t)return n[3]===t;if(!i)return!0;const s=i.value.split(".");return n[3]===s[3]||Number(n[2])>Number(s[2])})(a,o,r)?this._storeMetaIdentifier(s,a,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this._storeMetaIdentifier(s,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}_updateFacebookBrowserId(e,t,i){if(!this.persistence)return;const n=this._facebookBrowserIdChannel;this.persistence.refreshMetaIdentifiers();const s=this._getPersistedMetaIdentifier(n);if(i)return void n.unregister();if(t)return Tt(e)&&TC.test(e)?this._storeMetaIdentifier(n,e,s):void n.unregister();const r=this._readMetaCookie(n);return r?this._storeMetaIdentifier(n,r,s):s?{value:s.value,pending:!s.delivered}:void 0}_markMetaIdentifierDelivered(e,t){if(!this.persistence)return;this.persistence.refreshMetaIdentifiers();const i=this._getPersistedMetaIdentifier(e);(null==i?void 0:i.value)!==t||i.delivered||e.register(t,!0)}capture(e,t,i){var n,s;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue))return void $r.uninitializedWarning("posthog.capture");if(!this.is_capturing())return void $r.info(`Event "${e}" was not captured because capturing is disabled (opted out or consent pending).`);if(It(e)||!Tt(e))return void $r.error("No event name provided to posthog.capture");if(this._syncCookielessIdentity(),"$snapshot"===e&&this._inCookielessMode())return;const r=!this.config.opt_out_useragent_filter&&this._is_bot();if(r&&!this.config.__preview_capture_bot_pageviews)return void $r.info(`Event "${e}" was not captured because the user agent looks like a bot. Set \`opt_out_useragent_filter: true\` to capture it.`);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 $r.critical("This capture call is ignored due to client rate limiting.");let a;(null==t?void 0:t.$current_url)&&!Tt(null==t?void 0:t.$current_url)&&($r.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||(null==i?void 0:i._originatedFromCaptureException)||$r.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(a=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const l=new Date,c=(null==i?void 0:i.timestamp)||l,u=ln(null==i?void 0:i.uuid,Tl);let d={uuid:u,event:e,properties:this.calculateEventProperties(e,t||{},c,u)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&r&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),o&&(d.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens);const h="$feature_flag_called"===e&&!1===d.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!h&&(d.$set=null==i?void 0:i.$set);const p=xt(null==t?void 0:t.$set)?t.$set:void 0,g=kt(null==t?void 0:t.$unset)?t.$unset:[],_=(null==i?void 0:i.$unset)||[],f=e=>{var t;const n=!!(null==i?void 0:i.$set)&&e in i.$set;return{hasProvided:n||!!p&&e in p,provided:n?null==i||null===(t=i.$set)||void 0===t?void 0:t[e]:null==p?void 0:p[e],unset:-1!==g.indexOf(e)||-1!==_.indexOf(e)}},v=f(z),m=f(W),y=[{channel:this._facebookClickIdChannel,hasProvided:v.hasProvided,update:this._updateFacebookClickId(null==a?void 0:a.fbclid,v.provided,v.hasProvided,v.unset)},{channel:this._facebookBrowserIdChannel,hasProvided:m.hasProvided,update:this._updateFacebookBrowserId(m.provided,m.hasProvided,m.unset)}];for(const{channel:e,hasProvided:t,update:i}of y)i&&!0===d.properties.$process_person_profile&&i.pending&&!t&&!h&&(d.$set=ct({[e.property]:i.value},d.$set));const b=null==i?void 0:i.$unset;b&&(d.$unset=b);const S=h?void 0:this._calculate_set_once_properties(null==i?void 0:i.$set_once,e!==nt,e===it);if(S&&(d.$set_once=S),(null==i?void 0:i._noTruncate)||(w=this.config.properties_string_max_length,d=function(e,t){const i=new Set;return function e(n,s){if(n!==Object(n))return t?t(n):n;if(i.has(n))return;let r;if(i.add(n),kt(n))r=[],Br(n,t=>{r.push(e(t))});else{const t={};qr(qt(n)?jr(n):n,(n,s)=>{i.has(n)||(t[s]=e(n,s))}),r=t}return r}(e)}(d,e=>Tt(e)?e.slice(0,w):e)),d.timestamp=c,It(null==i?void 0:i.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=l),h&&(d.properties=((e,t=[])=>{const i={},n=t=>{void 0!==e[t]&&(i[t]=e[t])};return cs.forEach(n),t.forEach(n),i})(d.properties,MC)),e===Gf||e===Qf){const i=null==t?void 0:t[Kf],n=null==t?void 0:t[Zf];lv({id:i,current_iteration:n}),d.$set=ct(ct({},d.$set),{},{[nc({id:i,current_iteration:n},e===Qf?"responded":"dismissed")]:!0})}else e===Vf&&(d.$set=ct(ct({},d.$set),{},{[Xf]:(new Date).toISOString()}));var w;if("product tour shown"===e){const e=null==t?void 0:t.$product_tour_type;e&&(d.$set=ct(ct({},d.$set),{},{[`$product_tour_last_seen_date/${e}`]:(new Date).toISOString()}))}const k=ct(ct({},d.properties.$set),d.$set);if(Et(k)||this.setPersonPropertiesForFlags(k),!Rt(this.config.before_send)){const e=this._runBeforeSend(d);if(!e)return;d=e,d.uuid=ln(d.uuid,Tl)}this.sessionRecording&&!this._replayDebugPropertiesPaused&&xC(e)&&(this._replayDebugPropertiesPaused=!0,setTimeout(()=>this._replayDebugPropertiesPaused=!1,3e4));const C=y.filter(({channel:e,update:t})=>{var i,n,s;const r=null!==(i=null===(n=d.$set)||void 0===n?void 0:n[e.property])&&void 0!==i?i:xt(null===(s=d.properties)||void 0===s?void 0:s.$set)?d.properties.$set[e.property]:void 0;return(null==t?void 0:t.pending)&&r===t.value});this._internalEventEmitter.emit("eventCaptured",d);const x=null!==(n=null==i?void 0:i._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),E="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(x),I=ct(ct(ct({method:"POST",url:x,data:d,compression:"best-available",preferSyncCompression:null==i?void 0:i.send_instantly,timestampMode:E?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},E&&(null===(s=d.properties)||void 0===s?void 0:s.$session_id)?{batchGroup:d.properties.$session_id+(d.properties.$window_id?`-${d.properties.$window_id}`:"")}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),C.length?{fireCallbackOnDrop:!0,callback:e=>{if(e.statusCode>=200&&300>e.statusCode)for(const{channel:e,update:t}of C)this._markMetaIdentifierDelivered(e,t.value)}}:{});if(!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)){var T;let e;!I.transport&&!I.callback&&Et(null!==(T=this.config.request_headers)&&void 0!==T?T:{})&&this._isPageUnloading&&(e="sendBeacon"),this._send_retriable_request(I,e)}else this._requestQueue.enqueue(I);return d}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return null===(t=this._browserClientAdapter)||void 0===t?void 0:t.getExtension(e)}_getBrowserClientAdapter(){var e;return null!==(e=this._browserClientAdapter)&&void 0!==e?e:this._browserClientAdapter=new Ob(this)}_registerExtensionEventProperties(e){this._extensionEventPropertyProducers.push(e);let t=!0;return()=>{if(!t)return;t=!1;const i=this._extensionEventPropertyProducers.indexOf(e);-1!==i&&this._extensionEventPropertyProducers.splice(i,1)}}_processCookieIdentityChange(e=!0){var t;return!!(null===(t=this.persistence)||void 0===t?void 0:t.consumeCookieIdentityChange())&&(this._processIdentityChange(e),!0)}_processIdentityChange(e=!0){var t,i,n;this._cachedPersonProperties=null,"anonymous"===(null===(t=this.persistence)||void 0===t?void 0:t.get_property("$user_state"))&&(null===(n=this.sessionPersistence)||void 0===n||n.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null===(i=this.featureFlags)||void 0===i||i.reset(),e&&this.reloadFeatureFlags()}calculateEventProperties(t,i,r,o,a){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this._syncCookielessIdentity(),this.persistence.syncCookieProperties(),this._processCookieIdentityChange();const l=a?void 0:this.persistence.remove_event_timer(t);let u=ct({},i);if(u.token=this.config.token,u.$config_defaults="latest"===this.config.defaults?RC:this.config.defaults,this._inCookielessMode()&&(u[Oe]=!0),"$snapshot"===t){const e=ct(ct({},this.persistence.properties()),this.sessionPersistence.properties());return u.distinct_id=e.distinct_id,(!Tt(u.distinct_id)&&!Ft(u.distinct_id)||Mt(u.distinct_id))&&$r.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}const d=function(t,i,n,r=!1){var o,a,l,u;if(!c)return{};const d=t?[...xc,...i||[]]:[],[h,p]=Ki(c),[g,_]=function(e){for(let t=0;Xi.length>t;t++){const[i,n,s]=Xi[t],r=e.match(i);if(r){const t=s&&e.match(s)||r;return[n,(null==t?void 0:t[1])||""]}}return["",""]}(c),f=function(){const e="u">typeof navigator?navigator:void 0;return(null==e?void 0:e.brave)?{brave:!0}:{}}(),v={};It(n)||(v.detectGoogleSearchApp=n);const m={},y=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,b=null===(a=navigator)||void 0===a?void 0:a.maxTouchPoints,S=null==e||null===(l=e.screen)||void 0===l?void 0:l.width,w=null==e||null===(u=e.screen)||void 0===u?void 0:u.height,k=null==e?void 0:e.devicePixelRatio;It(y)||(m.userAgentDataPlatform=y),It(b)||(m.maxTouchPoints=b),It(S)||(m.screenWidth=S),It(w)||(m.screenHeight=w),It(k)||(m.devicePixelRatio=k);const C=Hr(Wr({$os:h,$os_version:p,$browser:ji(c,navigator.vendor,f,v),$webview_app:g,$webview_app_version:_,$device:Ji(c),$device_type:Zi(c,m),$timezone:Cc(),$timezone_offset:Nc()}),{$current_url:so(r?un(null==s?void 0:s.href):null==s?void 0:s.href,d,Ic),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:c.length>1e3?c.substring(0,997)+"...":c,$browser_version:Gi(c,navigator.vendor,f,v),$browser_language:Fc(),$browser_language_prefix:Ac(),$screen_height:null==e?void 0:e.screen.height,$screen_width:null==e?void 0:e.screen.width,$viewport_height:null==e?void 0:e.innerHeight,$viewport_width:null==e?void 0:e.innerWidth,$lib:Or.LIB_NAME,$lib_version:Or.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Or.SDK_DIST_CHANNEL&&(C.$sdk_dist_channel=Or.SDK_DIST_CHANNEL),C}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:e,windowId:t}=this.sessionManager.checkAndGetSessionAndWindowId(a,r.getTime(),!0);u.$session_id=e,u.$window_id=t}this.sessionPropsManager&&Hr(u,this.sessionPropsManager.getSessionProps());try{var h;if(this.sessionRecording){const e=this.sessionRecording.sdkDebugProperties,i=!this._replayDebugPropertiesPaused&&xC(t);for(const t in e)(i||ft(kC,t))&&(u[t]=e[t])}u.$sdk_debug_retry_queue_size=null===(h=this._retryQueue)||void 0===h?void 0:h.length}catch(e){u.$sdk_debug_error_capturing_properties=String(e)}let p;if(this.requestRouter.region===lC&&(u.$lib_custom_api_host=this.config.api_host),p="$pageview"!==t||a?"$pageleave"!==t||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),u=Hr(u,p),"$pageview"===t&&n&&(u.title=n.title),!It(l)){const e=r.getTime()-l;u.$duration=parseFloat((e/1e3).toFixed(3))}c&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");const g=this.persistence.properties(),_=this.sessionPersistence.properties(),f=u.$groups,v=g.$groups;xt(f)&&!Et(f)&&(u.$groups=ct(ct({},xt(v)?v:{}),f)),qr(["$referrer","$referring_domain"],e=>{e in g&&delete _[e]});const m={};if(this._extensionEventPropertyProducers.length>0)for(const e of this._extensionEventPropertyProducers.slice())try{Hr(m,e())}catch(e){$r.error("Failed to produce browser extension event properties",e)}u=Hr({},d,g,_,ct(ct({},m),u)),u.$is_identified=this._isIdentified(),kt(this.config.property_denylist)?qr(this.config.property_denylist,function(e){delete u[e]}):$r.error(wC+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const y=this.config.sanitize_properties;y&&($r.error(SC),u=y(u,t));const b=this._hasPersonProcessing();return u.$process_person_profile=b,b&&!a&&this._requirePersonProcessing("_calculate_event_properties"),u}_calculate_set_once_properties(e,t=!0,i=!1){var n;if(!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;const s=this.persistence.get_initial_props(),r=null===(n=this.sessionPropsManager)||void 0===n?void 0:n.getSetOnceProps();let o=Hr({},s,r||{},e||{});const a=this.config.sanitize_properties;return a&&($r.error(SC),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),Et(o)?void 0:o}register(e,t){var i;null===(i=this.persistence)||void 0===i||i.register(e,t)}register_once(e,t,i){var n;null===(n=this.persistence)||void 0===n||n.register_once(e,t,i)}register_for_session(e){var t,i;null===(t=this.persistence)||void 0===t||t.syncCookieProperties(),this._processCookieIdentityChange(),null===(i=this.sessionPersistence)||void 0===i||i.register(e),Object.keys(e).forEach(e=>this._sessionRegisteredPropKeys.add(e)),this._persistSessionRegisteredPropKeys()}unregister(e){var t;null===(t=this.persistence)||void 0===t||t.unregister(e)}unregister_for_session(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e),this._sessionRegisteredPropKeys.delete(e),this._persistSessionRegisteredPropKeys()}_register_single(e,t){this.register({[e]:t})}_clearSessionRegisteredProps(){this._sessionRegisteredPropKeys.forEach(e=>{var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e)}),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()}_persistSessionRegisteredPropKeys(){var e;if(!this._sessionRegisteredPropertiesStorageKey)return;if("memory"===this.config.persistence||(null===(e=this.sessionPersistence)||void 0===e?void 0:e._disabled)||!Kl._is_supported())return void Kl._remove(this._sessionRegisteredPropertiesStorageKey);const t=[];this._sessionRegisteredPropKeys.forEach(e=>t.push(e)),t.length>0?Kl._set(this._sessionRegisteredPropertiesStorageKey,t):Kl._remove(this._sessionRegisteredPropertiesStorageKey)}getFeatureFlag(e,t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null===(t=this.featureFlags)||void 0===t?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i,n;return null!==(i=null===(n=this.featureFlags)||void 0===n?void 0:n.isFeatureEnabled(e,t))&&void 0!==i?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null===(e=this.featureFlags)||void 0===e||e.reloadFeatureFlags()}updateFlags(e,t,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t=!1,i){var n;return null===(n=this.featureFlags)||void 0===n?void 0:n.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:bC}),()=>{})}onSessionId(e){var t,i;return null!==(t=null===(i=this.sessionManager)||void 0===i?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t=!1){this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:bC})}getActiveMatchingSurveys(e,t=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:bC})}onActiveMatchingSurveysChanged(e){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(e):(e([],{isLoaded:!1,error:bC}),()=>{})}renderSurvey(e,t){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(e,t)}displaySurvey(e,t=uv){var i;null===(i=this.surveys)||void 0===i||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null===(t=this.surveys)||void 0===t||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null===(i=this.surveys)||void 0===i?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:bC}}canRenderSurveyAsync(e,t=!1){var i,n;return null!==(i=null===(n=this.surveys)||void 0===n?void 0:n.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:bC})}_validateIdentifyId(e){return!e||Mt(e)?($r.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?($r.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||($r.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return $r.uninitializedWarning("posthog.identify");if(Ft(e)&&(e=e.toString(),$r.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this._validateIdentifyId(e))return;if(!this._requirePersonProcessing("posthog.identify"))return;this._syncCookielessIdentity();const n=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,r=this._processCookieIdentityChange(!1),o=this.persistence._beginCookieSyncSuppression();let a=!1;try{const n=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:n},""),e!==n&&e!==this.get_property("__alias")&&(this.unregister(q),this.register({distinct_id:e}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Je,c=e!==n,u=!c&&o;if(c&&o){var l;const s=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:n};this.persistence.set_property(Ie,Ze),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$identify",s,{$set:t||{},$set_once:i||{}})&&(this._cachedPersonProperties=fc(e,t,i)),null===(l=this.featureFlags)||void 0===l||l.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:n)}else if(u){this.persistence.set_property(Ie,Ze);const n=t||{},s=i||{};this.setPersonPropertiesForFlags({$set:n,$set_once:s},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:n,$set_once:s})&&(this._cachedPersonProperties=fc(e,t,i))}else(t||i)&&this.setPersonProperties(t,i);c||s||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(w)):u&&(t||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence._endCookieSyncSuppression(a)}}setPersonProperties(e,t){if(!e&&!t)return;if(!this._requirePersonProcessing("posthog.setPersonProperties"))return;const i=fc(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}})&&(this._cachedPersonProperties=i)):$r.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var t;const i=(kt(e)?e:[e]).filter(e=>Tt(e)&&e.length>0);0!==i.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null===(t=this.featureFlags)||void 0===t||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this._cachedPersonProperties=null)}group(e,t,i){var n;if(!e||!t)return void $r.error("posthog.group requires a group type and group key");null===(n=this.persistence)||void 0===n||n.syncCookieProperties(),this._processCookieIdentityChange();const s=this.getGroups(),r=s[e]!==t;if(r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:ct(ct({},s),{},{[e]:t})}),(r||i)&&this._hasPersonProcessing()){const n={$group_type:e,$group_key:t};i&&(n.$group_set=i),this.capture(nt,n)}i&&this.setGroupPropertiesForFlags({[e]:i}),r&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t=!0){var i;null===(i=this.featureFlags)||void 0===i||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e=!0){var t;null===(t=this.featureFlags)||void 0===t||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t=!0){var i;this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null===(i=this.featureFlags)||void 0===i||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null===(t=this.featureFlags)||void 0===t||t.resetGroupPropertiesForFlags(e)}reset(e){const t=Lt(e)?e:null==e?void 0:e.resetDeviceID,i=Lt(e)||null==e?void 0:e.bootstrap;this._reset(t,!1,i)}_reset(e,t=!1,i){var n,s,r,o,a,l;if($r.info("reset"),!this.__loaded)return $r.uninitializedWarning("posthog.reset");const c=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(n=this._originalUserConfig)||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._shouldDisableFlags());const u=this.get_property(N),d=this.get_property(B),h=this.get_property(ie);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const p=this.is_capturing();t||this.consent.reset(),t||!p||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const g=null===(a=this.persistence)||void 0===a||null===(l=a._beginCookieSyncSuppression)||void 0===l?void 0:l.call(a),_=this._isConsentTransition;this._isConsentTransition=_||t;let f=!1;try{var v,m,y,b,S,w,k,C,x,E,I,T,M;if(null===(v=this.persistence)||void 0===v||v.clear(),null===(m=this.sessionPersistence)||void 0===m||m.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),It(h)||null===(E=this.persistence)||void 0===E||E.register({$session_recording_remote_config:h}),null===(y=this.surveys)||void 0===y||y.reset(),null===(b=this.featureFlags)||void 0===b||b.reset(),null===(S=this.conversations)||void 0===S||S.reset(),null===(w=this.logs)||void 0===w||w.reset(),null===(k=this.metrics)||void 0===k||k.reset(),null===(C=this.persistence)||void 0===C||C.set_property("$user_state","anonymous"),null===(x=this.sessionManager)||void 0===x||x.resetSessionId(),this._cachedPersonProperties=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Le,$device_id:null},"");else{const t=this.config.get_device_id(Tl());this.register_once({distinct_id:t,$device_id:e?t:u},""),e||It(d)||this.register({[B]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(i.distinctID&&!this._inCookielessMode()&&(null===(M=this.persistence)||void 0===M||M.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(I=this.featureFlags)||void 0===I||I.initialize(),!Rt(c)&&!(null===(T=this.sessionManager)||void 0===T?void 0:T.setBootstrapSessionId(c,!0))){const e=ct({},i);delete e.sessionID,this.config.bootstrap=e}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,f=!0}finally{var P,R;this._isConsentTransition=_,g&&(null===(P=this.persistence)||void 0===P||null===(R=P._endCookieSyncSuppression)||void 0===R||R.call(P,f))}var F;this._lastRemoteConfig&&(null===(F=this.conversations)||void 0===F||F.onRemoteConfig(this._lastRemoteConfig)),this.reloadFeatureFlags()}shutdown(e){var t=this;return rt(function*(){if(!t.__loaded)return void $r.uninitializedWarning("posthog.shutdown");t._isShutdown=!0,clearTimeout(t._extensionInitTimeout),t._extensionInitTimeout=void 0;const e=t._featureFlagsReloadingUnsubscribe;t._featureFlagsReloadingUnsubscribe=void 0;for(const i of[()=>{var e;return null===(e=t.sessionRecording)||void 0===e?void 0:e.dispose()},()=>{var e;return null===(e=t.logs)||void 0===e?void 0:e.flushLogs("sendBeacon")},()=>{var e;return null===(e=t.metrics)||void 0===e?void 0:e.flush("sendBeacon")},()=>{var e;return null===(e=t.metrics)||void 0===e?void 0:e.dispose()},()=>{var e;return null===(e=t.logs)||void 0===e?void 0:e.dispose()},()=>{var e;return null===(e=t.surveys)||void 0===e?void 0:e.dispose()},()=>{var e;return null===(e=t.autocapture)||void 0===e?void 0:e.dispose()},()=>null==e?void 0:e(),()=>{var e;return null===(e=t._requestQueue)||void 0===e?void 0:e.unload()},()=>{var e;return null===(e=t._retryQueue)||void 0===e?void 0:e.unload()},()=>{var e;return null===(e=t.featureFlags)||void 0===e?void 0:e.destroy()},()=>{var e;return null===(e=t.persistence)||void 0===e?void 0:e.destroy()},()=>{var e;return null===(e=t.sessionPersistence)||void 0===e?void 0:e.destroy()}])try{const e=i();e&&Ct(e.then)&&e.then(void 0,e=>{$r.error("Error during shutdown",e)})}catch(e){$r.error("Error during shutdown",e)}})()}setIdentity(e,t){var i;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null===(i=this.conversations)||void 0===i||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(e=this.conversations)||void 0===e||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null===(t=this.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";const{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let n=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${t}`);if((null==e?void 0:e.withTimestamp)&&i){var s;const t=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!i)return n;n+=`?t=${Math.max(Math.floor(((new Date).getTime()-i)/1e3)-t,0)}`}return n}alias(e,t){return e===this.get_property("$people_distinct_id")?($r.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(It(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(q,e),this.capture("$create_alias",{alias:e,distinct_id:t})):($r.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){const t=ct({},this.config);if(xt(e)){var i,n,s,r,o,a,l,c,u,d,h,p,g,_;Hr(this.config,OC(e));const b=this._is_persistence_disabled();if(this.persistence){const e="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;var f,v;if(e&&this.sessionPersistence!==this.persistence&&(null===(f=this.sessionPersistence)||void 0===f||f.remove(),null===(v=this.sessionPersistence)||void 0===v||v.destroy()),this.persistence.update_config(this.config,t,b),e)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new Uk(ct(ct({},this.config),{},{persistence:"sessionStorage"}),b,!1);else{var m;null===(m=this.sessionPersistence)||void 0===m||m.update_config(ct(ct({},this.config),{},{persistence:"sessionStorage"}),ct(ct({},t),{},{persistence:"sessionStorage"}),b)}}const S=this._checkLocalStorageForDebug(this.config.debug);var y;Lt(S)&&(this.config.debug=S),Lt(this.config.debug)&&(this.config.debug?(Jl.DEBUG=!0,Ol._is_supported()&&Ol._set("ph_debug",!0),$r.info("set_config",{config:e,oldConfig:t,newConfig:ct({},this.config)})):(Jl.DEBUG=!1,Ol._is_supported()&&Ol._remove("ph_debug"))),null===(i=this.featureFlags)||void 0===i||null===(n=i.updateConfig)||void 0===n||n.call(i,this.config,this._shouldDisableFlags()),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===(c=this.tracingHeaders)||void 0===c||c.startIfEnabledOrStop(),null===(u=this.autocapture)||void 0===u||u.startIfEnabled(),null===(d=this.heatmaps)||void 0===d||d.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null===(y=this.historyAutocapture)||void 0===y||y.startIfEnabledOrStop()),null===(h=this.exceptionObserver)||void 0===h||h.startIfEnabledOrStop(),null===(p=this.deadClicksAutocapture)||void 0===p||p.startIfEnabledOrStop(),null===(g=this.surveys)||void 0===g||g.loadIfEnabled(),this._sync_opt_out_with_persistence(),null===(_=this.externalIntegrations)||void 0===_||_.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&wk(this,mC,!1)}}_overrideSDKInfo(e,t){Jl.LIB_NAME=e,Jl.LIB_VERSION=t}startSessionRecording(e){const t=!0===e,i={sampling:t||!!(null==e?void 0:e.sampling),linked_flag:t||!!(null==e?void 0:e.linked_flag),url_trigger:t||!!(null==e?void 0:e.url_trigger),event_trigger:t||!!(null==e?void 0:e.event_trigger)};var 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 e;return!!(null===(e=this.sessionRecording)||void 0===e?void 0:e.started)}captureException(e,t){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(ct(ct({},i),t))}catch(e){return}}addExceptionStep(e,t){var i;null===(i=this.exceptions)||void 0===i||i.addExceptionStep(e,t)}captureLog(e){var t;null===(t=this.logs)||void 0===t||t.captureLog(e)}get logger(){var e,i;return null!==(e=null===(i=this.logs)||void 0===i?void 0:i.logger)&&void 0!==e?e:t._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null===(i=this.toolbar)||void 0===i?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null===(t=this.persistence)||void 0===t?void 0:t.props[e]}getSessionProperty(e){var t;return null===(t=this.sessionPersistence)||void 0===t?void 0:t.props[e]}toString(){var e;let t=null!==(e=this.config.name)&&void 0!==e?e:PC;return t!==PC&&(t="posthog."+t),t}_isIdentified(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property("$user_state"))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?void 0:t.get_property("$user_state"))}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&Et(this.getGroups())&&!(null===(e=this.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.__alias)&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.$epp))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?($r.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(Ae,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;const e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_sync_opt_out_with_persistence(){var e,t;const i=this._is_persistence_disabled();var n,s,r;return this.is_capturing()||null===(n=this.logs)||void 0===n||n._onOptOut(),(null===(e=this.persistence)||void 0===e?void 0:e._disabled)!==i&&(null===(s=this.persistence)||void 0===s||s.set_disabled(i)),(null===(t=this.sessionPersistence)||void 0===t?void 0:t._disabled)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),this._persistSessionRegisteredPropKeys(),i}opt_in_capturing(e){var i;if("always"!==this.config.cookieless_mode){if(this._inCookielessMode()){var n,s,r,o,a,l;null===(n=this.sessionRecording)||void 0===n||n.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),null===(s=this.sessionManager)||void 0===s||s.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new sC(this),this.pageViewManager=new Ek(this),this.persistence&&(this.sessionPropsManager=new tC(this,this.sessionManager,this.persistence));const e=null!==(o=null===(a=this.config.__extensionClasses)||void 0===a?void 0:a.sessionRecording)&&void 0!==o?o:null===(l=t.__defaultExtensionClasses)||void 0===l?void 0:l.sessionRecording;var c,u;e&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new e(this)),this._lastRemoteConfig&&(null===(c=this.sessionRecording)||void 0===c||null===(u=c.onRemoteConfig)||void 0===u||u.call(c,this._lastRemoteConfig)))}var d,h,p;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(d=this.surveys)||void 0===d||d.loadIfEnabled(),null===(h=this.conversations)||void 0===h||h.loadIfEnabled()),(It(null==e?void 0:e.captureEventName)||(null==e?void 0:e.captureEventName))&&this.capture(null!==(p=null==e?void 0:e.captureEventName)&&void 0!==p?p:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else $r.warn(yC)}opt_out_capturing(){"always"!==this.config.cookieless_mode?(this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),"on_reject"===this.config.cookieless_mode&&this._enterCookielessMode()):$r.warn(yC)}_enterCookielessMode(){var e,t;const i=this.sessionRecording;null==i||i.dispose({discardBufferedEvents:!0}),"$posthog_cookieless"!==this.get_distinct_id()&&this._reset(!0,!0),this.register({distinct_id:Le,$device_id:null}),this._removeExtension(i),this.sessionRecording=void 0,null===(e=this.sessionManager)||void 0===e||e.destroy(),null===(t=this.pageViewManager)||void 0===t||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return!this._isConsentTransition&&("always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing()))}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return i?oC(i,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){n&&("visible"===n.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(et,{title:n.title},{send_instantly:!0}),this._visibilityStateListener&&(n.removeEventListener(I,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),Qr(n,I,this._visibilityStateListener)))}debug(t){!1===t?(null==e||e.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==e||e.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}_shouldDisableFlags(){const e=this._originalUserConfig||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?($r.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(e,t,i,n,s){const r=t in e&&!Rt(e[t]),o=i in e&&!Rt(e[i]);return r?e[t]:!!o&&(s&&s.warn(`Config field '${i}' is deprecated. Please use '${t}' instead. The old field will be removed in a future major version.`),e[i])}(e,"advanced_disable_flags","advanced_disable_decide",0,$r)}_runBeforeSend(e){var t;if(Rt(this.config.before_send))return e;const i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter($t),n=kt(this.config.before_send)?this.config.before_send:[this.config.before_send];let s=e;for(const t of n)try{if(s=t(s),Rt(s)){const t=`Event '${e.event}' was rejected in beforeSend function`;return Dt(e.event)?$r.warn(`${t}. This can cause unexpected behavior.`):$r.info(t),null}s.properties&&!Et(s.properties)||$r.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(t){return $r.error(`Error in beforeSend function for event '${e.event}':`,t),null}for(const t of i)if(s.properties&&Rt(s.properties[t]))return $r.warn(`Event '${e.event}' had its '${t}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return s}getPageViewId(){var e;return null===(e=this.pageViewManager._currentPageview)||void 0===e?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){const t=Lt(e)&&!e,i=Ol._is_supported()&&"true"===Ol._get("ph_debug");return!t&&(!!i||e)}};$C.__defaultExtensionClasses={},$C._noopLogger=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(let i=0;t.length>i;i++)e.prototype[t[i]]=Ur(e.prototype[t[i]])}($C,["identify"]);const NC=["[data-ph-capture-value]"];var BC=class{constructor(e){this._instance=e}refresh(e){var t;const i=this._instance.config,n=xt(i.autocapture)?i.autocapture:void 0;e.enabled=!!i.autocapture,e.rageclick=i.rageclick,e.maskAllElementAttributes=i.mask_all_element_attributes,e.maskAllText=i.mask_all_text,e.disableCaptureUrlHashes=i.disable_capture_url_hashes,e.getCurrentUrl=i.get_current_url,e.remoteRequestsDisabled=this._instance._shouldDisableFlags(),e.url_allowlist=null==n?void 0:n.url_allowlist,e.url_ignorelist=null==n?void 0:n.url_ignorelist,e.dom_event_allowlist=null==n?void 0:n.dom_event_allowlist,e.element_allowlist=null==n?void 0:n.element_allowlist,e.css_selector_allowlist=null==n?void 0:n.css_selector_allowlist,e.css_selector_ignorelist=null==n?void 0:n.css_selector_ignorelist,e.element_attribute_ignorelist=null==n?void 0:n.element_attribute_ignorelist,e.capture_copied_text=null==n?void 0:n.capture_copied_text,e.capture_value_css_selector_allowlist=null!==(t=null==n?void 0:n.capture_value_css_selector_allowlist)&&void 0!==t?t:NC}};const qC=Nr("[ExceptionAutocapture]"),HC=Nr("[TracingHeaders]"),zC=Nr("[Web Vitals]"),UC=9e5,WC=["CLS","FCP","INP","LCP"],jC=["INP","LCP"],VC=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],GC=Nr("[SessionRecording]"),QC=[Ne,Be,qe,He,ze,Ue,We,je,Ve],KC=Nr("[Heatmaps]");function JC(e){return xt(e)&&"clientX"in e&&"clientY"in e&&Ft(e.clientX)&&Ft(e.clientY)}const ZC=Nr("[Product Tours]"),YC=e=>{var t;return!e.config.disable_product_tours&&!!(null===(t=e.persistence)||void 0===t?void 0:t.get_property(X))},XC=["$set_once","$set"],ex=Nr("[SiteApps]"),tx="Error while initializing PostHog app with config id ",ix=(null==e?void 0:e.location)?ro(e.location.hash,"__posthog")||ro(location.hash,"state"):null,nx="_postHogToolbarParams",sx=Nr("[Toolbar]"),rx=Nr("[FeatureFlags]"),ox=Nr("[FeatureFlags]",{debugEnabled:!0}),ax="\" failed. Feature flags didn't load in time.",lx=[502,504],cx=["click","keydown","wheel","touchstart","pointerdown"],ux="connection_error",dx=e=>{const t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},hx=e=>{const t={};for(const[i,n]of zr(e||{}))n&&(t[i]=n);return t};var px=class{constructor(e){this.name="featureFlags",this._override_warning=!1,this.featureFlagEventHandlers=[],this._logger=rx,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._reloadingHandlers=[],this._pendingReloads=new Set,this._activeReloads=new Set,this._hasLoadedFlags=!1,this._requestInFlight=!1,this._requestGeneration=0,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._firingFeatureFlagsCallbacks=!1,this._flagsLoadedFromRemote=!1,this._staleCacheRefreshTriggered=!1,this._consecutiveStatusZeroFailures=0,this._hadUserInteraction=!1,this._onOnline=()=>{const e=this._hasStatusZeroCircuitBreakerTripped();this._consecutiveStatusZeroFailures=0,e&&this.reloadFeatureFlags()},this._refreshIfDue=()=>{var e,t;const i=this._refreshIntervalMs,n=null!==(e=this._dueRefreshIntervalMs)&&void 0!==e?e:i;It(i)||It(n)||this._config.remoteRequestsDisabled||!this._document||"hidden"===this._document.visibilityState||Date.now()-(null!==(t=this._lastRefreshAt)&&void 0!==t?t:0)<n||(this._dueRefreshIntervalMs=this._hadUserInteraction||!this._config.idleRefreshBackoff?i:Math.min(2*n,36e5),this._hadUserInteraction=!1,this.reloadFeatureFlags(),this._scheduleNextRefresh())},this._onUserInteraction=()=>{this._hadUserInteraction&&this._dueRefreshIntervalMs===this._refreshIntervalMs||this._resumeConfiguredInterval()},this._onVisibilityChange=()=>{var e;"visible"===(null===(e=this._document)||void 0===e?void 0:e.visibilityState)&&this._resumeConfiguredInterval()},this._configSource=e}get _crossTabPersistence(){}_onConfigUpdated(){this._client&&this._syncAutomaticRefresh()}setup(e){try{this._window=typeof window>"u"?void 0:window,this._document=typeof document>"u"?void 0:document}catch(e){this._window=void 0,this._document=void 0}return this._initializingClient=e,this._logger=e.logger.createLogger("[FeatureFlags]"),Yy(e.kv.initialize(),()=>{this._initializingClient===e&&(this._initializingClient=void 0,this._client=e,this._finishSetup(e))})}_finishSetup(e){var t;if(this._client===e)return this._window&&Qr(this._window,"online",this._onOnline),this._syncAutomaticRefresh(),this._dynamicProperties=e.registerDynamicEventProperties(()=>this._isCacheStale()?this._baseEventProperties:this._eventPropertiesWithFlagValues),this._crossTabPersistenceUnsubscribe=null===(t=this._crossTabPersistence)||void 0===t?void 0:t.onCrossTabFeatureFlagChange(()=>{this._clearBootstrapState(),this._rebuildEventProperties(),this._fireFeatureFlagsCallbacks()}),this._rebuildEventProperties(),this.initialize()}_resumeConfiguredInterval(){this._hadUserInteraction=!0,this._dueRefreshIntervalMs=this._refreshIntervalMs,this._refreshIfDue()}_syncAutomaticRefresh(){var e;const t=this._config.refreshIntervalMs,i=!this._config.remoteRequestsDisabled&&this._document&&!It(t)&&t>0?t:void 0;this._config.idleRefreshBackoff||(this._dueRefreshIntervalMs=i),i!==this._refreshIntervalMs&&(this._stopAutomaticRefresh(),It(i)||(this._refreshIntervalMs=i,this._dueRefreshIntervalMs=i,this._scheduleNextRefresh(),(null===(e=this._document)||void 0===e?void 0:e.addEventListener)&&(Qr(this._document,I,this._onVisibilityChange),Br(cx,e=>{Qr(this._document,e,this._onUserInteraction,{capture:!0})}))))}_scheduleNextRefresh(){It(this._refreshIntervalMs)||(It(this._refreshInterval)||clearInterval(this._refreshInterval),this._lastRefreshAt=Date.now(),this._refreshInterval=setInterval(this._refreshIfDue,this._refreshIntervalMs))}_stopAutomaticRefresh(){var e,t;It(this._refreshInterval)||(clearInterval(this._refreshInterval),this._refreshInterval=void 0,null===(e=this._document)||void 0===e||null===(t=e.removeEventListener)||void 0===t||t.call(e,"visibilitychange",this._onVisibilityChange),Br(cx,e=>{var t,i;null===(t=this._document)||void 0===t||null===(i=t.removeEventListener)||void 0===i||i.call(t,e,this._onUserInteraction,{capture:!0})})),this._refreshIntervalMs=void 0,this._dueRefreshIntervalMs=void 0,this._hadUserInteraction=!1,this._lastRefreshAt=void 0}destroy(){this._dispose()}dispose(){this._dispose()}_dispose(){var e,t,i;this._stopAutomaticRefresh(),this._requestGeneration++,this._additionalReloadRequested=!1,this._initializingClient=void 0,this._settleReloads(this._pendingReloads,"cancelled"),this._settleReloads(this._activeReloads,"cancelled"),this._client&&(this._clearDebouncer(),null===(e=this._dynamicProperties)||void 0===e||e.dispose(),this._dynamicProperties=void 0,null===(t=this._crossTabPersistenceUnsubscribe)||void 0===t||t.call(this),this._crossTabPersistenceUnsubscribe=void 0,this._reloadingHandlers=[],null===(i=this._window)||void 0===i||i.removeEventListener("online",this._onOnline),this._client=void 0)}get _config(){return this._configSource.get()}_prop(e){var t;return this._bootstrapState&&e in this._bootstrapState?this._bootstrapState[e]:null===(t=this._client)||void 0===t?void 0:t.kv.get(e)}_clearBootstrapState(){return!!this._bootstrapState&&(this._bootstrapState=void 0,!0)}_fallBackToPersistedFlags(){var e;return!It(null===(e=this._client)||void 0===e?void 0:e.kv.get("$enabled_feature_flags"))&&this._clearBootstrapState()}_set(e){this._persist(()=>{var t;return null===(t=this._client)||void 0===t?void 0:t.kv.set(e)})}_markCrossTabFeatureFlagSnapshot(e,t,i){if(!this._crossTabPersistence||!e.$enabled_feature_flags)return;const n=this._prop("$enabled_feature_flags")||{},s=e.$enabled_feature_flags||{},r=t.flags||t.featureFlags,o=t.flags?Object.entries(t.flags).filter(([,e])=>!(null==e?void 0:e.failed)).map(([e])=>e):[],a=!!t.errorsWhileComputingFlags&&!!t.flags,l=a?o:i&&!kt(r)?Object.keys(r||{}):Array.from(new Set([...Object.keys(n),...Object.keys(s)])),c=this._prop("$feature_flag_payloads")||{},u=e.$feature_flag_payloads||{},d=a||i?l:Array.from(new Set([...Object.keys(c),...Object.keys(u)])),h=!a&&!i,_=!!h||l,b=!!h||d,S={[p]:_,[y]:_,[C]:b};e.$feature_flag_details&&(S[g]=_);for(const t of[v,f,m])It(e[t])||(S[t]=!0);this._crossTabPersistence.markCrossTabFeatureFlagChanges(S)}_remove(e){this._persist(()=>{var t;return null===(t=this._client)||void 0===t?void 0:t.kv.remove(e)})}_persist(e){try{e()}catch(e){this._logger.error("Failed to update feature flag persistence",e)}}_rebuildEventProperties(){const e={};for(const t of[p,C,v,x]){const i=this._prop(t);It(i)||(e[t]=i)}this._baseEventProperties=e;const t=ct({},e),i=this._prop(y);if(i)for(const[e,n]of Object.entries(i))t[`$feature/${e}`]=n;this._eventPropertiesWithFlagValues=t}_isCacheStale(){const e=this._config.cacheTtlMs;if(!e||0>=e)return!1;const t=this._prop(f);return"number"!=typeof t||Date.now()-t>e}_checkAndTriggerStaleRefresh(){return!!this._isCacheStale()&&(this._staleCacheRefreshTriggered||this._requestInFlight||(this._staleCacheRefreshTriggered=!0,this._logger.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_getValidEvaluationEnvironments(){const e=this._config.evaluationContexts;return(null==e?void 0:e.length)?e.filter(e=>{const t=e&&"string"==typeof e&&e.trim().length>0;return t||this._logger.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}_getValidFlagKeys(){const e=this._config.flagKeys;if(!It(e))return e.filter(e=>{const t=e&&"string"==typeof e&&e.trim().length>0;return t||this._logger.error("Invalid flag key found:",e,"Expected non-empty string"),t})}initialize(){var e,t;const i=this._config,n=null!==(e=null===(t=i.bootstrap)||void 0===t?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(n).length){var s,r;const e=null!==(s=null===(r=i.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:{},t=Object.keys(n).filter(e=>!It(n[e])).reduce((e,t)=>(e[t]=n[t],e),{}),o=Object.keys(e).filter(e=>t[e]).reduce((t,i)=>(t[i]=e[i],t),{});return this._receivedFeatureFlags({featureFlags:t,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(e,t,i){var n,s;const r=(null==i?void 0:i.merge)&&null!==(n=this._prop("$enabled_feature_flags"))&&void 0!==n?n:{},o=(null==i?void 0:i.merge)&&null!==(s=this._prop("$feature_flag_payloads"))&&void 0!==s?s:{},a=ct(ct({},r),e),l=ct(ct({},o),t),c={};for(const[e,t]of Object.entries(a))c[e]={key:e,enabled:as(t),variant:ls(t),reason:void 0,metadata:It(null==l?void 0:l[e])?void 0:{id:0,version:void 0,description:void 0,payload:l[e]}};this._receivedFeatureFlags({flags:c})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this._prop(g),t=this._prop(x),i=this._prop(E);if(!i&&!t)return e||{};const n=Hr({},e||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(const e of s){var r,o;const s=n[e],a=null==t?void 0:t[e],l=It(a)?null!==(r=null==s?void 0:s.enabled)&&void 0!==r&&r:!!a,c=It(a)?null==s?void 0:s.variant:"string"==typeof a?a:void 0,u=null==i?void 0:i[e],d=ct(ct({},s),{},{enabled:l,variant:l?null!=c?c:null==s?void 0:s.variant:void 0});l!==(null==s?void 0:s.enabled)&&(d.original_enabled=null==s?void 0:s.enabled),c!==(null==s?void 0:s.variant)&&(d.original_variant=null==s?void 0:s.variant),u&&(d.metadata=ct(ct({},null==s?void 0:s.metadata),{},{payload:u,original_payload:null==s||null===(o=s.metadata)||void 0===o?void 0:o.payload})),n[e]=d}return this._override_warning||(this._logger.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:n}),this._override_warning=!0),n}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{const n=e[i];return{key:i,enabled:as(n),variant:ls(n),payload:os(t[i])}})}getFlagVariants(){const e=this._prop(y),t=this._prop(x);if(!t)return e||{};const i=Hr({},e||{}),n=Object.keys(t);for(let e=0;n.length>e;e++)i[n[e]]=t[n[e]];return this._override_warning||(this._logger.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){const e=this._prop(C),t=this._prop(E);if(!t)return e||{};const i=Hr({},e||{}),n=Object.keys(t);for(let e=0;n.length>e;e++)i[n[e]]=t[n[e]];return this._override_warning||(this._logger.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this._override_warning=!0),i}reloadFeatureFlags(){this._reloadingDisabled||this._config.featureFlagsDisabled||this._hasStatusZeroCircuitBreakerTripped()||(this._firingFeatureFlagsCallbacks&&this._logger.warn("reloadFeatureFlags() was called inside an onFeatureFlags callback. This callback also runs when flags change in other tabs, so this can cause a request loop."),this._requestInFlight&&(this._additionalReloadRequested=!0),this._reloadDebouncer||(this._reloadingHandlers.slice().forEach(e=>{try{e()}catch(e){this._logger.error("Error while running feature flags reloading callback",e)}}),this._reloadDebouncer=setTimeout(()=>{this._callFlagsEndpoint()},5)))}reloadFeatureFlagsAsync(){return!this._client||this._reloadingDisabled||this._config.featureFlagsDisabled||this._config.remoteRequestsDisabled||this._hasStatusZeroCircuitBreakerTripped()?Promise.resolve({status:"skipped"}):new Promise(e=>{this._pendingReloads.add(e),this.reloadFeatureFlags()})}_settleReloads(e,t){e.forEach(e=>e({status:t})),e.clear()}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}onReloading(e){return this._reloadingHandlers.push(e),()=>{this._reloadingHandlers=this._reloadingHandlers.filter(t=>t!==e)}}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}resetFlagCallReported(){this._remove(w)}_callFlagsEndpoint(e){var t;this._clearDebouncer();const i=this._client;if(!i||this._config.remoteRequestsDisabled||this._hasStatusZeroCircuitBreakerTripped())return void this._settleReloads(this._pendingReloads,"skipped");if(this._requestInFlight)return void(this._additionalReloadRequested=!0);const n={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:ct(ct(ct({},i.initialPersonProperties),this._prop("$stored_person_properties")||{}),{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this._prop(b),timezone:Cc()};It(i.deviceId)||(n.$device_id=i.deviceId),((null==e?void 0:e.disableFlags)||this._config.featureFlagsDisabled)&&(n.disable_flags=!0);const s=this._getValidEvaluationEnvironments();s.length&&(n.evaluation_contexts=s);const r=this._getValidFlagKeys();It(r)||(n.flag_keys=r);const o=this._config.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this._requestGeneration,c=this._pendingReloads;this._pendingReloads=new Set,this._activeReloads=c,this._requestInFlight=!0;const u=()=>{this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())},d=e=>{var t,i;const s=null!==(t=e.json)&&void 0!==t?t:{},r=200!==e.statusCode;if(this._requestInFlight=!1,l!==this._requestGeneration)return void u();if(this._trackStatusZeroReachability(e.statusCode),r||this._additionalReloadRequested||(this.$anon_distinct_id=void 0),n.disable_flags&&!this._additionalReloadRequested)return void this._settleReloads(c,"skipped");this._flagsLoadedFromRemote=!r;const a=[];e.error?a.push(e.error instanceof Error&&"AbortError"===e.error.name?"timeout":e.error instanceof Error?ux:"unknown_error"):200!==e.statusCode&&a.push(`api_error_${e.statusCode}`),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");const d=!!(null===(i=s.quotaLimited)||void 0===i?void 0:i.includes("feature_flags"));d&&a.push("quota_limited"),this._set({[_]:a}),d?this._logger.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):n.disable_flags||this._receivedFeatureFlags(s,r,{partialResponse:o}),this._settleReloads(c,n.disable_flags?"skipped":a.length||!s.flags&&!s.featureFlags?"error":"loaded"),u()},h=e=>{this._requestInFlight=!1,l===this._requestGeneration?(this._set({[_]:[ux]}),this._logger.error("Feature flag request failed",e),this._fallBackToPersistedFlags()&&this._fireFeatureFlagsCallbacks(!0),this._settleReloads(c,"error"),u()):u()};let p=null!==(t=this._config.requestMaxRetries)&&void 0!==t?t:1;const g=()=>p>0&&l===this._requestGeneration,f=()=>{if(l!==this._requestGeneration||!this._client||this._config.remoteRequestsDisabled)return this._requestInFlight=!1,this._settleReloads(c,"skipped"),void u();try{i.sendRequest(a,{target:"flags",method:"POST",body:n,compression:this._config.compression,sentAt:"body",timeoutMs:this._config.requestTimeoutMs}).then(e=>{if((e=>lx.includes(e.statusCode)||(e=>0===e.statusCode&&e.error instanceof Error&&"AbortError"===e.error.name)(e))(e)&&g())return p--,void setTimeout(f,500);d(e)}).catch(h)}catch(e){h(e)}};f()}_hasStatusZeroCircuitBreakerTripped(){return Yr(this._consecutiveStatusZeroFailures,3)}_trackStatusZeroReachability(e){this._consecutiveStatusZeroFailures=Xr(e,this._consecutiveStatusZeroFailures,3,()=>this._logger.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t={}){var i;if(t.fresh&&!this._flagsLoadedFromRemote)return;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return void this._logger.warn('getFeatureFlag for key "'+e+ax);if(this._checkAndTriggerStaleRefresh())return;const n=this.getFeatureFlagResult(e,t);return null!==(i=null==n?void 0:n.variant)&&void 0!==i?i:null==n?void 0:n.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this._flagsLoadedFromRemote)return;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return void this._logger.warn('getFeatureFlagResult for key "'+e+ax);if(this._checkAndTriggerStaleRefresh())return;const i=this.getFlagVariants(),n=e in i,s=i[e],r=this.getFlagPayloads()[e],o=String(s),a=this._prop("$feature_flag_request_id")||void 0,l=this._prop("$feature_flag_evaluated_at")||void 0;let c,u=this._prop("$flag_call_reported")||{};if(this._config.deduplicateCallsPerSession){var d;const e=null===(d=this._client)||void 0===d||null===(d=d.session)||void 0===d?void 0:d.sessionId,t=this._prop(k);e&&e!==t&&(u={},c=e)}if(!t.send_event&&"send_event"in t)c&&this._set({[w]:u,[k]:c});else{var h,p;const t=null===(h=this._client)||void 0===h?void 0:h.canCapture;if(!t&&Object.keys(u).length>0&&(u={},this._set({[w]:u})),t&&!(null===(p=u[e])||void 0===p?void 0:p.includes(o))){var g,_,f,v,m,y,b,S,C,x,E,I,T;kt(u[e])?u[e].push(o):u[e]=[o],this._set(ct({[w]:u},c?{[k]:c}:{}));const t=this.getFeatureFlagDetails(e),i=[...null!==(g=this._prop("$feature_flag_errors"))&&void 0!==g?g:[]];It(s)&&i.push("flag_missing");const n={$feature_flag:e,$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!==(_=null===(f=this._config.bootstrap)||void 0===f||null===(f=f.featureFlags)||void 0===f?void 0:f[e])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(v=null===(m=this._config.bootstrap)||void 0===m||null===(m=m.featureFlagPayloads)||void 0===m?void 0:m[e])&&void 0!==v?v:null,$used_bootstrap_value:!this._flagsLoadedFromRemote};It(null==t||null===(y=t.metadata)||void 0===y?void 0:y.has_experiment)||(n.$feature_flag_has_experiment=t.metadata.has_experiment),It(null==t||null===(b=t.metadata)||void 0===b?void 0:b.version)||(n.$feature_flag_version=t.metadata.version);const d=null!==(S=null==t||null===(C=t.reason)||void 0===C?void 0:C.description)&&void 0!==S?S:null==t||null===(x=t.reason)||void 0===x?void 0:x.code;d&&(n.$feature_flag_reason=d),(null==t||null===(E=t.metadata)||void 0===E?void 0:E.id)&&(n.$feature_flag_id=t.metadata.id),It(null==t?void 0:t.original_variant)&&It(null==t?void 0:t.original_enabled)||(n.$feature_flag_original_response=It(t.original_variant)?t.original_enabled:t.original_variant),(null==t||null===(I=t.metadata)||void 0===I?void 0:I.original_payload)&&(n.$feature_flag_original_payload=null==t||null===(T=t.metadata)||void 0===T?void 0:T.original_payload),i.length&&(n.$feature_flag_error=i.join(",")),this._captureFeatureFlagCalled(n)}else c&&this._set({[w]:u,[k]:c})}return n?{key:e,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:os(r)}:void 0}_captureFeatureFlagCalled(e){try{var t;null===(t=this._client)||void 0===t||t.capture("$feature_flag_called",e)}catch(e){this._logger.error("Failed to capture feature flag call",e)}}getRemoteConfigPayload(e,t){this._getRemoteConfigPayload(e,t)}_getRemoteConfigPayload(e,t){var i=this;return rt(function*(){const n=i._client;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._getValidEvaluationEnvironments();r.length&&(s.evaluation_contexts=r);const o=i._getValidFlagKeys();let a;It(o)||(s.flag_keys=o);try{var l;const t=null===(l=(yield n.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:i._config.compression,sentAt:"body",timeoutMs:i._config.requestTimeoutMs})).json)||void 0===l?void 0:l.featureFlagPayloads;a=(null==t?void 0:t[e])||void 0}catch(e){return void i._logger.error("Remote config feature flag request failed",e)}try{t(a)}catch(e){i._logger.error("Remote config feature flag callback failed",e)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this._flagsLoadedFromRemote)return t.defaultValue;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return this._logger.warn('isFeatureEnabled for key "'+e+ax),t.defaultValue;const i=this.getFeatureFlag(e,t);return It(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){this._receivedFeatureFlags(e,t,i)}_receivedFeatureFlags(e,t,i){if(!this._client)return;this._hasLoadedFlags=!0;const n=((e,t={},i={},n={},s,r=rx)=>{const o=((e,t)=>{const i=e.flags;if(i){const t=Object.fromEntries(Object.keys(i).map(e=>{var t;return[e,null!==(t=i[e].variant)&&void 0!==t?t:i[e].enabled]})),n=Object.fromEntries(Object.keys(i).filter(e=>i[e].enabled).filter(e=>{var t;return!It(null===(t=i[e].metadata)||void 0===t?void 0:t.payload)}).map(e=>{var t;return[e,null===(t=i[e].metadata)||void 0===t?void 0:t.payload]}));return ct(ct({},e),{},{featureFlags:t,featureFlagPayloads:n})}return e.featureFlags&&t.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e,r),a=o.flags,l=o.featureFlags,c=o.featureFlagPayloads;if(!l)return;const u=e.requestId,d=e.evaluatedAt;if(kt(l)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const e={};if(l)for(let t=0;l.length>t;t++)e[l[t]]=!0;return{[p]:l,[y]:e,[m]:!1}}let h=l,_=c,b=a;if(null==s?void 0:s.partialResponse){const e=Object.keys(h),s=_||{};h=ct(ct({},t),h),_=ct(ct({},i),s),e.forEach(e=>{e in s||null==_||delete _[e]}),b=ct(ct({},n),b)}else if(e.errorsWhileComputingFlags)if(a){const e=new Set(Object.keys(a).filter(e=>{var t;return!(null===(t=a[e])||void 0===t?void 0:t.failed)}));h=ct(ct({},t),Object.fromEntries(Object.entries(h).filter(([t])=>e.has(t))));const s=Object.fromEntries(Object.entries(_||{}).filter(([t])=>e.has(t)));_=ct(ct({},i),s),e.forEach(e=>{e in s||null==_||delete _[e]}),b=ct(ct({},n),Object.fromEntries(Object.entries(b||{}).filter(([t])=>e.has(t))))}else h=ct(ct({},t),h),_=ct(ct({},i),_),b=ct(ct({},n),b);return ct(ct({[p]:Object.keys(hx(h)),[y]:h||{},[C]:_||{},[g]:b||{},[m]:!0===e.minimalFlagCalledEvents},u?{[v]:u}:{}),d?{[f]:d}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this._logger);if(n)if(!1===(null==i?void 0:i.persist)){const e=!It(this._client.kv.get(y));this._bootstrapState=n,e||this._set(n)}else this._clearBootstrapState(),this._markCrossTabFeatureFlagSnapshot(n,e,!!(null==i?void 0:i.partialResponse)),this._set(n);else t&&this._fallBackToPersistedFlags();t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}override(e,t=!1){this._logger.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this._overrideFeatureFlags(e)}_overrideFeatureFlags(e){if(this._client){if(!1===e)return this._remove([x,E]),this._fireFeatureFlagsCallbacks(),void ox.info("All overrides cleared");if(kt(e))return this._set({[x]:dx(e)}),this._fireFeatureFlagsCallbacks(),void ox.info("Flag overrides set",{flags:e});if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t;const i=e;this._override_warning=Boolean(null!==(t=i.suppressWarning)&&void 0!==t&&t);const n={},s=i.flags,r=i.payloads;return s&&(n[x]=kt(s)?dx(s):s),r&&(n[E]=r),Object.keys(n).length&&this._set(n),!1===s&&!1===r?this._remove([x,E]):!1===s?this._remove(x):!1===r&&this._remove(E),this._fireFeatureFlagsCallbacks(),!1===s?ox.info("Flag overrides cleared"):s&&ox.info("Flag overrides set",{flags:s}),void(!1===r?ox.info("Payload overrides cleared"):r&&ox.info("Payload overrides set",{payloads:r}))}if(e&&"object"==typeof e)return this._set({[x]:e}),this._fireFeatureFlagsCallbacks(),void ox.info("Flag overrides set",{flags:e});this._logger.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this._logger.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){const{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();try{e(t,i)}catch(e){this._logger.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var n;const s=(this._prop("$early_access_features")||[]).find(t=>t.flagKey===e),r={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:r};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i);const a=ct(ct({},this.getFlagVariants()),{},{[e]:t});null===(n=this._crossTabPersistence)||void 0===n||n.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(r)}),this._set({[p]:Object.keys(hx(a)),[y]:a,[S]:ct(ct({},this._prop("$stored_person_properties")||{}),r)}),this._fireFeatureFlagsCallbacks();try{var l;null===(l=this._client)||void 0===l||l.capture("$feature_enrollment_update",o)}catch(e){this._logger.error("Failed to capture early access feature enrollment",e)}}getEarlyAccessFeatures(e,t=!1,i){const n=this._prop(h);!n||t?this._getEarlyAccessFeatures(e,i):e(n)}_getEarlyAccessFeatures(e,t){var i=this;return rt(function*(){const n=i._client;if(!n)return;const s=t?`&${t.map(e=>`stage=${e}`).join("&")}`:"";let r;try{const e=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${s}`,{target:"api",method:"GET",sentAt:"query"});if(!e.json)return;r=e.json.earlyAccessFeatures,i._set({[h]:r})}catch(e){return void i._logger.error("Early access feature request failed",e)}try{e(r)}catch(e){i._logger.error("Early access feature callback failed",e)}})()}_prepareFeatureFlagsForCallbacks(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}_fireFeatureFlagsCallbacks(e){this._rebuildEventProperties();const{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks(),n=this._firingFeatureFlagsCallbacks;this._firingFeatureFlagsCallbacks=!0,this.featureFlagEventHandlers.forEach(n=>{try{n(t,i,{errorsLoading:e})}catch(e){this._logger.error("Error while running feature flags callback",e)}}),this._firingFeatureFlagsCallbacks=n}setPersonPropertiesForFlags(e,t=!0){this._setPersonPropertiesForFlags(e,t)}_setPersonPropertiesForFlags(e,t=!0){const i=this._prop("$stored_person_properties")||{},n=(null==e?void 0:e.$set)||((null==e?void 0:e.$set_once)?{}:e),s=null==e?void 0:e.$set_once,r={};if(s)for(const e in s)({}).hasOwnProperty.call(s,e)&&(e in i||(r[e]=s[e]));this._set({[S]:ct(ct(ct({},i),r),n)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const i=ct({},this._prop("$stored_person_properties")||{});e.forEach(e=>{delete i[e]}),this._set({[S]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this._remove(S),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const i=this._prop("$stored_group_properties")||{},n=ct({},i);for(const t of Object.keys(e))n[t]=ct(ct({},i[t]),e[t]);this._set({[b]:n}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this._prop("$stored_group_properties")||{};this._set({[b]:ct(ct({},t),{},{[e]:{}})})}else this._remove(b)}reset(){this._requestGeneration++,this._settleReloads(this._pendingReloads,"cancelled"),this._settleReloads(this._activeReloads,"cancelled"),this._additionalReloadRequested=!1,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._bootstrapState=void 0,this._hasLoadedFlags=!1,this._reloadingDisabled=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1,this._consecutiveStatusZeroFailures=0}};const gx=Nr("[FeatureFlags]");var _x=class{constructor(e,t=!1){this._loggedEvaluationEnvironmentsDeprecation=!1,this.update(e,t)}update(e,t){this._snapshot=((e,t)=>{var i,n,s,r,o,a,l,c;return{bootstrap:{featureFlags:null!==(i=null===(n=e.bootstrap)||void 0===n?void 0:n.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(s=null===(r=e.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:void 0},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=e.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:It(e.remote_config_refresh_interval_ms),requestTimeoutMs:e.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!==(a=e.feature_flag_request_max_retries)&&void 0!==a?a:1),compression:e.disable_compression?void 0:"best-available",evaluationContexts:null!==(l=null!==(c=e.evaluation_contexts)&&void 0!==c?c:e.evaluation_environments)&&void 0!==l?l:[],flagKeys:kt(e.flag_keys)?e.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this._loggedEvaluationEnvironmentsDeprecation||(gx.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._loggedEvaluationEnvironmentsDeprecation=!0),It(e.flag_keys)||kt(e.flag_keys)||gx.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this._snapshot}};const fx="Refusing to render web experiment since the viewer is a likely bot",vx={ADD_ATTR:(e,t)=>"target"===e&&"a"===t||"form"===e&&/^(button|fieldset|input|output|select|textarea)$/.test(t),ADD_URI_SAFE_ATTR:["form"]};let mx;const yx={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>dc(t,e),not_regex:(e,t)=>!dc(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},bx=Nr("[Conversations]"),Sx="Conversations not available yet.";function wx(e,t){var i,n,s,r,o,a,l;const c=null!==(i=null==e?void 0:e.flushIntervalMs)&&void 0!==i?i:3e3,u=null!==(n=null==e?void 0:e.maxBufferSize)&&void 0!==n?n:100,d=(null==t?void 0:t.consoleCapture)?void 0:null!==(s=null==e?void 0:e.maxLogsPerInterval)&&void 0!==s?s:1e3,h=It(d)?Math.max(u,2048):Math.max(u,d),p=ct(ct({},function(){let e="",t="";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&&([e,t]=Ki(s))}catch(e){}return function(e,t){const i=function(e){if(e)return{}.hasOwnProperty.call(pr,e)?pr[e]:e}(e);return ct(ct({},i?{"os.name":i}:{}),t?{"os.version":t}:{})}(e,t)}()),null==e?void 0:e.resourceAttributes);return{serviceName:null!==(r=null!==(o=null==p?void 0:p["service.name"])&&void 0!==o?o:null==e?void 0:e.serviceName)&&void 0!==r?r:null==t?void 0:t.serviceNameDefault,serviceVersion:null!==(a=null==p?void 0:p["service.version"])&&void 0!==a?a:null==e?void 0:e.serviceVersion,environment:null!==(l=null==p?void 0:p["deployment.environment"])&&void 0!==l?l:null==e?void 0:e.environment,resourceAttributes:p,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:c,maxBufferSize:u,maxQueueSize:h,maxBatchRecordsPerPost:100,rateCapWindowMs:c,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const kx=["debug","log","warn","error","info"],Cx="console",xx="__posthogHandledLogsRequestError",Ex=(e,t)=>{const i=e instanceof Error?e:new Error(t);return i[xx]=!0,i},Ix=e=>!!e&&"object"==typeof e&&!0===e[xx];var Tx=class{get _coreLogger(){return ct(ct({},this._logger),{},{error:(...e)=>{e.some(Ix)||this._logger.error(...e)}})}constructor(e,t){var i;this._configSource=e,this._getSdkContext=t,this.name="logs",this._isLogsEnabled=!1,this._isLoaded=!1,this._isLoading=!1,this._logger=Nr("[logs]"),this._queue=[],this._consoleQueue=[],this._consecutiveStatusZeroFailures=0,this._setupStarted=!1,this._disposed=!1,this._consoleBuffer=[],this._consoleRecorderUnpatchers=[],this._isRecordingConsole=!1,this._isRecordingConsoleEntry=!1,this._listeningForReconnect=!1,this._onReconnect=()=>{var e,t;this._disposed||(this._consecutiveStatusZeroFailures=0,null===(e=this._core)||void 0===e||e.onReconnect(),null===(t=this._consoleCore)||void 0===t||t.onReconnect())},this._isLogsEnabled=!!(null===(i=e.get())||void 0===i?void 0:i.captureConsoleLogs)}get _isRequestReady(){return!0}_getConsoleLoader(){}_listenForReconnect(){if(!this._listeningForReconnect){try{this._window=typeof window>"u"?void 0:window}catch(e){this._window=void 0}this._window&&(Qr(this._window,"online",this._onReconnect),this._listeningForReconnect=!0)}}_buildCore(e,t,i,n){this._listenForReconnect();const s=wx(this._configSource.get(),i);return[new kr(this._createHost(e,t),s,this._coreLogger,()=>this._getSdkContext(),e=>e(),void 0,n),s]}_getCore(){const e=this._configSource.get();var t;return this._core&&this._resolvedFrom===e||(null===(t=this._core)||void 0===t||t.reset(),this._resolvedFrom=e,[this._core,this._resolvedConfig]=this._buildCore(()=>this._queue,e=>{this._queue=e})),this._core}_getConsoleCore(){const e=this._configSource.get();var t;return this._consoleCore&&this._consoleResolvedFrom===e||(null===(t=this._consoleCore)||void 0===t||t.reset(),this._consoleResolvedFrom=e,[this._consoleCore,this._consoleResolvedConfig]=this._buildCore(()=>this._consoleQueue,e=>{this._consoleQueue=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Cx)),this._consoleCore}setup(e){if(!this._disposed&&!this._setupStarted)return this._setupStarted=!0,this._client=e,this._logger=e.logger.createLogger("[logs]"),Yy(e.kv.initialize(),()=>{this._disposed||this._finishSetup(e)})}_finishSetup(e){var t;this._listenForReconnect(),(null===(t=this._configSource.get())||void 0===t?void 0:t.captureConsoleLogs)&&(this._isLogsEnabled=!0),(this._isLogsEnabled||this._configSource.remoteConfigWillArrive&&e.kv.get(this._configSource.captureHintKey))&&this._startConsoleRecorder();let i=!1;const n=e.onRemoteConfig(e=>{var t;i=e.ok&&!0===(null===(t=e.config.logs)||void 0===t?void 0:t.captureConsoleLogs),this.onRemoteConfig(e)});this._disposed?n.dispose():(this._remoteConfigSubscription=n,i||this.loadIfEnabled())}dispose(){var e,t,i,n,s,r,o;this._disposed||(this._disposed=!0,this._stopConsoleRecorder(),null===(e=this._remoteConfigSubscription)||void 0===e||e.dispose(),this._remoteConfigSubscription=void 0,this._client=void 0,this._isLoading=!1,null===(t=this._window)||void 0===t||t.removeEventListener("online",this._onReconnect),null===(i=this._consoleLogsDispose)||void 0===i||i.call(this),this._consoleLogsDispose=void 0,null===(n=this._core)||void 0===n||n.clearQueue(),null===(s=this._consoleCore)||void 0===s||s.clearQueue(),null===(r=this._core)||void 0===r||r.reset(),null===(o=this._consoleCore)||void 0===o||o.reset())}onRemoteConfig(e){var t,i;if(this._disposed)return;const n=e.ok?null===(t=e.config.logs)||void 0===t?void 0:t.captureConsoleLogs:void 0;Rt(n)?this._stopRecorderStartedByPersistedHint():(null===(i=this._client)||void 0===i||i.kv.set(this._configSource.captureHintKey,!!n),n?(this._isLogsEnabled=!0,this._isLoaded||this._startConsoleRecorder(),this.loadIfEnabled()):this._stopRecorderStartedByPersistedHint())}reset(){var e,t,i,n;this._stopConsoleRecorder(),null===(e=this._core)||void 0===e||e.clearQueue(),this._queue=[],null===(t=this._core)||void 0===t||t.reset(),null===(i=this._consoleCore)||void 0===i||i.clearQueue(),this._consoleQueue=[],null===(n=this._consoleCore)||void 0===n||n.reset(),this._consecutiveStatusZeroFailures=0}captureLog(e){!this._disposed&&this._client&&this._getCore().captureLog(e)}captureConsoleLog(e){!this._disposed&&this._client&&this._getConsoleCore().captureLog(e)}captureBufferedConsoleLog(e,t,i){!this._disposed&&this._client&&this._getConsoleCore().captureLog(e,{context:t,occurredAtMs:i})}_onOptOut(){var e;this._stopConsoleRecorder(),null===(e=this._consoleCore)||void 0===e||e.clearQueue(),this._consoleQueue=[]}_stopRecorderStartedByPersistedHint(){this._isLogsEnabled||this._stopConsoleRecorder()}_startConsoleRecorder(){var e;if(this._isRecordingConsole||!(null===(e=this._window)||void 0===e?void 0:e.console))return;const t=wx(this._configSource.get()).maxBufferSize;let i=!0;this._consoleRecorderUnpatchers.push(()=>{i=!1});for(const e of kx){let n;try{n=Bb(this._window.console[e])}catch(e){continue}n&&this._consoleRecorderUnpatchers.push(Fg(this._window.console,e,s=>{const r=(...n)=>{try{i&&this._recordConsoleEntry(e,n,t)}catch(e){}return s.apply(this._window.console,n)};return r.__rrweb_original__=n,r}))}this._isRecordingConsole=!0,this._consoleRecorderTimeout=setTimeout(()=>{this._stopConsoleRecorder()},3e4)}_recordConsoleEntry(e,t,i){var n;if(this._isRecordingConsole&&!this._isRecordingConsoleEntry&&0!==t.length)if(null===(n=this._client)||void 0===n?void 0:n.canCapture){if(i>this._consoleBuffer.length){this._isRecordingConsoleEntry=!0;try{this._consoleBuffer.push({level:e,args:t,occurredAtMs:Date.now(),context:this._getSdkContext()})}finally{this._isRecordingConsoleEntry=!1}}}else this._stopConsoleRecorder()}_stopConsoleRecorder(){if(this._consoleBuffer=[],this._isRecordingConsole){this._isRecordingConsole=!1,this._consoleRecorderTimeout&&(clearTimeout(this._consoleRecorderTimeout),this._consoleRecorderTimeout=void 0);for(const e of this._consoleRecorderUnpatchers)e();this._consoleRecorderUnpatchers=[]}}_takeConsoleBuffer(){const e=this._consoleBuffer;return this._stopConsoleRecorder(),e}get logger(){return this._capture_logger||(this._capture_logger={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this._capture_logger}flushLogs(e){this._client&&(e?this._flushViaTransport(e):(this._core&&this._core.flush().catch(e=>this._logFlushError(e)),this._consoleCore&&this._consoleCore.flush().catch(e=>this._logFlushError(e))))}flush(){var e=this;return rt(function*(){var t,i;const n=null===(t=e._core)||void 0===t?void 0:t.flush().catch(t=>e._logFlushError(t)),s=null===(i=e._consoleCore)||void 0===i?void 0:i.flush().catch(t=>e._logFlushError(t));yield n,yield s})()}_logFlushError(e){Ix(e)||this._logger.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this._disposed||!this._isLogsEnabled||this._isLoaded||this._isLoading)return;const e=this._getConsoleLoader();if(e){this._isLoading=!0;try{e((e,t)=>{if(this._isLoading=!1,!this._disposed&&this._isLogsEnabled)if(e||!t)this._logger.error("Could not load logs script",e),this._stopConsoleRecorder();else{const e=this._takeConsoleBuffer();this._consoleLogsDispose=t.initialize(this._client),this._isLoaded=!0,e.length>0&&t.replay(this._client,e)}})}catch(e){throw this._isLoading=!1,e}}else this._stopConsoleRecorder()}_createHost(e,t){const i=this._client;return{get isDisabled(){return!1},get optedOut(){return!i.canCapture},getPersistedProperty:t=>t===ut.LogsQueue?e():void 0,setPersistedProperty(e,i){e===ut.LogsQueue&&t(null!=i?i:[])},_sendLogsBatch:e=>this._sendLogsBatch(e),getLibraryId:()=>i.library.name,getLibraryVersion:()=>i.library.version}}_sendLogsBatch(e){return new Promise(t=>{if(Yr(this._consecutiveStatusZeroFailures,3))return void t({kind:"fatal",error:Ex(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const n=e=>{i||(i=!0,clearTimeout(s),t(e))},s=setTimeout(()=>{this._logger.warn("Logs request timed out before receiving a response"),n({kind:"retry-later",error:Ex(void 0,"logs request timed out")})},9e4),r=this._isRequestReady;this._client.sendRequest("/i/v1/logs",{method:"POST",query:{token:this._client.projectToken},body:e,compression:"best-available",timeoutMs:6e4}).then(e=>{var t;const i=e.statusCode;this._trackEndpointReachability(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?(e.error||this._logger.warn("Logs request failed before receiving an HTTP response"),n({kind:"retry-later",error:Ex(e.error,"logs request failed before receiving an HTTP response")})):n({kind:"retry-later",error:null!==(t=e.error)&&void 0!==t?t:new Error(`logs request failed with status ${i}`)})},e=>{n({kind:"retry-later",error:e})})})}_trackEndpointReachability(e,t){(0!==e||t)&&(this._consecutiveStatusZeroFailures=Xr(e,this._consecutiveStatusZeroFailures,3,()=>this._logger.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}_flushViaTransport(e){this._queue.length>0&&this._drainQueueViaTransport(e,this._queue,this._resolvedConfig,this._client.library.name,e=>{this._queue=e}),this._consoleQueue.length>0&&this._drainQueueViaTransport(e,this._consoleQueue,this._consoleResolvedConfig,Cx,e=>{this._consoleQueue=e})}_drainQueueViaTransport(e,t,i,n,s){if(0===t.length)return;const r=t.map(e=>e.record);s([]);const o=yr(r,mr(i,this._client.library.name,this._client.library.version),n,this._client.library.version);this._client.sendRequest("/i/v1/logs",{method:"POST",query:{token:this._client.projectToken},body:o,compression:"best-available",transport:e,timeoutMs:6e4}).catch(e=>this._logFlushError(e))}};const Mx=Nr("[NetworkMetrics]"),Px=()=>{var t;return(null==e||null===(t=e.performance)||void 0===t?void 0:t.now)?e.performance.now():Date.now()},Rx={"http:":80,"https:":443},Fx=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),Ax=(e,t)=>{var i;const n=String(t);return{method:String(e).toUpperCase(),url:(null===(i=Jr(n))||void 0===i?void 0:i.href)||n}},Lx=(e,t,i,n,s,r,o=!1)=>{try{var a,l;const c=s();if(!c)return;const u=i||void 0,d=Px()-n,h=Jr(t.url);if(h&&"http:"!==h.protocol&&"https:"!==h.protocol)return;const p={url:(null==h?void 0:h.href)||t.url,method:t.method},g=Ct(c.name)?c.name(p):Tt(c.name)?c.name:"http.client.request.duration";if(!g)return;const _=o&&!u?void 0:((e,t)=>e?400>e?void 0:String(e):(null==t?void 0:t.name)||"_OTHER")(u,r),f=ct(ct(ct(ct(ct({},(e=>{const t=Fx.has(e)?e:"_OTHER";return ct({"http.request.method":t},"_OTHER"===t&&e!==t?{"http.request.method_original":e}:{})})(p.method)),h?(e=>{return{"server.address":e.hostname.startsWith("[")&&e.hostname.endsWith("]")?e.hostname.slice(1,-1):e.hostname,"server.port":Number(e.port)||Rx[e.protocol],"url.scheme":e.protocol.slice(0,-1),"url.template":(t=e.pathname,t.split("/").map(e=>(e=>/^\d+$/.test(e)||e.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(e))(e)?":id":e).join("/"))};var t})(h):{}),u?{"http.response.status_code":u}:{}),_?{"error.type":_}:{}),null===(a=c.attributes)||void 0===a?void 0:a.call(c,p,{status:u,durationMs:d}));null===(l=e.metrics)||void 0===l||l.histogram(g,d,{unit:"ms",attributes:f})}catch(e){Mx.error("Failed to record network metric",e)}},Ox=()=>{},Dx=(t,i)=>Ct(null==e?void 0:e.fetch)?Fg(e,"fetch",e=>function(...n){const s=Px(),r=e.apply(this,n);if(!i())return r;try{var o,a,l;const[e,c]=n,u=Ax(null!==(o=null!==(a=null==c?void 0:c.method)&&void 0!==a?a:null==e?void 0:e.method)&&void 0!==o?o:"GET",null!==(l=null==e?void 0:e.url)&&void 0!==l?l:e);return r.then(e=>(Lx(t,u,null==e?void 0:e.status,s,i,void 0,!0),e),e=>{throw Lx(t,u,void 0,s,i,e),e})}catch(e){return Mx.error("Failed to observe fetch",e),r}}):Ox,$x=(t,i)=>{var n;const s=null==e||null===(n=e.XMLHttpRequest)||void 0===n?void 0:n.prototype;if(!s)return Ox;const r=new WeakMap,o=Fg(s,"open",e=>function(...t){try{(()=>fb.has(this))()||r.set(this,Ax(t[0],t[1]))}catch(e){Mx.error("Failed to observe XHR open",e)}return e.apply(this,t)}),a=Fg(s,"send",e=>function(...n){let s;try{const e=r.get(this);if(e&&i()){const n=Px();s=()=>{this.removeEventListener("loadend",s),Lx(t,e,this.status,n,i)},Qr(this,"loadend",s)}}catch(e){Mx.error("Failed to observe XHR send",e)}try{return e.apply(this,n)}catch(e){throw s&&this.removeEventListener("loadend",s),e}});return()=>{o(),a()}},Nx=new WeakMap,Bx=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),qx={maxStringLength:2048,truncationSuffix:"..."},Hx={maxStringLength:2048,truncationSuffix:"..."};function zx(e){if(e)return!0===e?{intent:!0,model:!0}:{intent:!1!==e.intent,model:!1!==e.model}}function Ux(e,t){return{}.hasOwnProperty.call(e,t)}function Wx(e,t){const i=Object.create(e);return t&&Object.defineProperty(i,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:t}),i}function jx(e,t,i=!1){if(!Tt(e))return;const n=e.trim();return n?(i?ir(n,qx):n).slice(0,t):void 0}function Vx(e){try{return xt(e)&&!0===e.isError}catch(e){return!1}}function Gx(e){return ir(e||"Unknown error",Hx).slice(0,2048)}function Qx(e,t){try{return Gx(t?function(e){try{if(!xt(e)||!kt(e.content))return;return e.content.filter(e=>xt(e)&&"text"===e.type&&Tt(e.text)).map(e=>e.text).join(" ").trim()||void 0}catch(e){return}}(e):xt(e)&&Tt(e.message)?e.message:Tt(e)?e:String(e))}catch(e){return"Unknown error"}}function Kx(e,t,i){return t.errorResult?[{type:"Error",value:i,mechanism:{type:"generic",handled:!0,synthetic:!0,exception_id:0}}]:e.buildProperties(t.error,{handled:!0}).$exception_list.map(e=>ct(ct({},e),{},{value:Gx(e.value)}))}function Jx(e,t){if(t)return"Error";try{if(!xt(e))return"Error";let t=Tt(e.name)?e.name.trim():"";const i=e.constructor;return t&&"Error"!==t||!Ct(i)||"Error"===i.name||(t=i.name),(t||"Error").slice(0,256)}catch(e){return"Error"}}function Zx(e,t){return{message:Qx(e,t),type:Jx(e,t)}}const Yx={featureFlags:class extends px{constructor(e){const t=new _x(e.config,e._shouldDisableFlags());super(t),this.name=pb,this._instance=e,this._mutableConfigSource=t}get _crossTabPersistence(){return this._instance.persistence}updateConfig(e,t){this._mutableConfigSource.update(e,t),this._onConfigUpdated()}}},Xx={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!!(null===(e=this._lazyLoadedSessionRecording)||void 0===e?void 0:e.isStarted)}get status(){var e,t;return"awaiting_config"===this._recordingStatus||"missing_config"===this._recordingStatus?this._recordingStatus:null!==(e=null===(t=this._lazyLoadedSessionRecording)||void 0===t?void 0:t.status)&&void 0!==e?e:this._recordingStatus}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=da,this._persistFlagsOnSessionListener=void 0,this._sessionRecordingDisposed=!1,this._documentWasEverVisible=(()=>{var t,i;if(!(null==n?void 0:n.visibilityState)||"visible"===n.visibilityState)return!0;const s=null==e||null===(t=e.performance)||void 0===t||null===(i=t.getEntriesByType)||void 0===i?void 0:i.call(t,"visibility-state");return!(null==s?void 0:s.length)||s.some(e=>"visible"===e.name)})(),this._onVisibilityChange=()=>{var e,t;"visible"===(null==n?void 0:n.visibilityState)&&(this._documentWasEverVisible=!0,null===(e=this._lazyLoadedSessionRecording)||void 0===e||null===(t=e.setDocumentWasEverVisible)||void 0===t||t.call(e,!0))},!this._instance.sessionManager)throw GC.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this._config.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==n?void 0:n.addEventListener)&&Qr(n,"visibilitychange",this._onVisibilityChange)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this._sessionRecordingDisposed=!0,null==n||null===(t=n.removeEventListener)||void 0===t||t.call(n,"visibilitychange",this._onVisibilityChange),e?this._discardRecording(!0):this.stopRecording()}get _isRecordingEnabled(){var t;const i=!!(null===(t=this._instance.get_property("$session_recording_remote_config"))||void 0===t?void 0:t.enabled),n=!this._config.disable_session_recording,s=this._config.disable_session_recording||this._instance.consent.isOptedOut();return e&&i&&n&&!s}startIfEnabledOrStop(e){var t;if(this._sessionRecordingDisposed)return;if(this._isRecordingEnabled&&(null===(t=this._lazyLoadedSessionRecording)||void 0===t?void 0:t.isStarted))return;const i=!It(Object.assign)&&!It(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),GC.info("starting")):(this._recordingStatus=da,this.stopRecording())}_lazyLoadAndStart(e){var t,i;if(this._isRecordingEnabled)if("awaiting_config"!==this._recordingStatus&&"missing_config"!==this._recordingStatus&&(this._recordingStatus=fa),(null==d||null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.rrweb)||void 0===t?void 0:t.record)&&(null===(i=d.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this._onScriptLoaded(e);else{var n,s;const t=this._instance.sessionManager;null===(n=d.__PosthogExtensions__)||void 0===n||null===(s=n.loadExternalDependency)||void 0===s||s.call(n,this._instance,this._scriptName,i=>{if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager===t)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),GC.error("could not load recorder",i)):void this._onScriptLoaded(e);this._recordingStatus="disabled"})}}stopRecording(){var e,t;null===(e=this._persistFlagsOnSessionListener)||void 0===e||e.call(this),this._persistFlagsOnSessionListener=void 0,null===(t=this._lazyLoadedSessionRecording)||void 0===t||t.stop()}_discardRecording(e=!1){var t,i;null===(t=this._persistFlagsOnSessionListener)||void 0===t||t.call(this),this._persistFlagsOnSessionListener=void 0,null===(i=this._lazyLoadedSessionRecording)||void 0===i||i.discard({discardProducerEvents:e})}_resetSampling(){var e,t;null===(e=this._persistence)||void 0===e||e.unregister("$session_is_sampled"),null===(t=this._persistence)||void 0===t||t.unregister("$replay_sample_rate")}_validateSampleRate(e,t){if(Rt(e))return null;const i=Ft(e)?e:parseFloat(e);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(GC.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):i;var n}_persistRemoteConfig(e){if(this._persistence){var t,i;const n=this._persistence,s=()=>{var t;const i=!1===e.sessionRecording?void 0:e.sessionRecording,s=this._validateSampleRate(null===(t=this._config.session_recording)||void 0===t?void 0:t.sampleRate,"session_recording.sampleRate"),r=this._validateSampleRate(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:r;Rt(o)&&this._resetSampling();const a=null==i?void 0:i.minimumDurationMilliseconds;n.register({[ie]:ct(ct({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:ct({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:It(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===(t=this._persistFlagsOnSessionListener)||void 0===t||t.call(this),this._persistFlagsOnSessionListener=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.onSessionId(s)}}onRemoteConfig(e){const t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this._persistRemoteConfig(t),void this._discardRecording()):(this._persistRemoteConfig(t),void this.startIfEnabledOrStop()):("awaiting_config"===this._recordingStatus&&(this._recordingStatus="missing_config",this._instance.register_for_session({[Be]:!0}),GC.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var i;(null===(i=this._lazyLoadedSessionRecording)||void 0===i?void 0:i.log)?this._lazyLoadedSessionRecording.log(e,t):GC.warn("log called before recorder was ready")}get _scriptName(){var e,t;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.get_property(ie);return(null==i||null===(t=i.scriptConfig)||void 0===t?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){const e=this._instance.get_property(ie);if(!e)return!1;let t;try{t="object"==typeof e?e:JSON.parse(e)}catch(e){return GC.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}return!Rt(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}_onScriptLoaded(e){var t,i,n;if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager){if(!(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.initSessionRecording))return GC.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Ne]:!0});var s;if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null===(s=d.__PosthogExtensions__)||void 0===s?void 0:s.initSessionRecording(this._instance,this._documentWasEverVisible),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if("missing_config"===this._recordingStatus||"awaiting_config"===this._recordingStatus)return;return this._recordingStatus="awaiting_config",GC.info("persisted remote config is stale, requesting fresh config before starting"),void new Gk(this._instance).load()}this._recordingStatus=fa,null===(i=(n=this._lazyLoadedSessionRecording).setDocumentWasEverVisible)||void 0===i||i.call(n,this._documentWasEverVisible),this._lazyLoadedSessionRecording.start(e)}else this._recordingStatus=da}onRRwebEmit(e){var t,i;null===(t=this._lazyLoadedSessionRecording)||void 0===t||null===(i=t.onRRwebEmit)||void 0===i||i.call(t,e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||null===(t=this._persistence)||void 0===t||t.register({$replay_override_linked_flag:!0}),null===(e=this._lazyLoadedSessionRecording)||void 0===e||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null===(t=this._persistence)||void 0===t||t.register({$replay_override_sampling:!0}),null===(e=this._lazyLoadedSessionRecording)||void 0===e||e.overrideSampling()}overrideTrigger(e){var t,i;this._lazyLoadedSessionRecording||null===(i=this._persistence)||void 0===i||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(t=this._lazyLoadedSessionRecording)||void 0===t||t.overrideTrigger(e)}get sdkDebugProperties(){var e;const t={};for(const e of QC){var i;const n=null===(i=this._instance.sessionPersistence)||void 0===i?void 0:i.get_property(e);It(n)||(t[e]=n)}return ct(ct({},t),(null===(e=this._lazyLoadedSessionRecording)||void 0===e?void 0:e.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(e,t){var i;return!!(null===(i=this._lazyLoadedSessionRecording)||void 0===i?void 0:i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;null===(e=this._lazyLoadedSessionRecording)||void 0===e||null===(t=e.flushBeforeIdentityReset)||void 0===t||t.call(e)}}},eE={autocapture:class extends hb{constructor(e){super(new BC(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._isFlushingPageview=!1,this._instance=e,this._lastLocation=this._getCurrentLocation()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this._getCaptureOptions();return!!(e.path||e.search||this._shouldCaptureHashChanges(e))}startIfEnabled(){this.isEnabled&&($r.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this._lastLocation=this._getCurrentLocation(),this.startIfEnabled()}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,this._hashchangeListener&&this._hashchangeListener(),this._hashchangeListener=void 0,$r.info("History API monitoring stopped")}monitorHistoryChanges(){e&&e.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener(),this._shouldCaptureHashChanges()&&this._setupHashchangeListener())}_patchHistoryMethod(t){var i;if(!e||(null===(i=e.history[t])||void 0===i?void 0:i.__posthog_wrapped__))return;const n=this;Fg(e.history,t,i=>function(s,r,o){var a;n._isUrlChanging(o)&&n._flushPendingPageview(),i.call(this,s,r,o),n._capturePageview(t,!n._isFlushingPageview&&"popstate"!==(null==e||null===(a=e.event)||void 0===a?void 0:a.type))})}_getCurrentLocation(){const t=null==e?void 0:e.location;if(null==t?void 0:t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}_getCaptureOptions(){const e=this._instance.config.capture_pageview;return"history_change"===e?{path:!0}:xt(e)?e:{}}_shouldCaptureHashChanges(e=this._getCaptureOptions()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}_hasLocationChanged(e){const t=this._getCaptureOptions(),i=this._lastLocation;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this._shouldCaptureHashChanges(t)&&e.hash!==i.hash))}_capturePageview(e,t=!1){try{t||this._flushPendingPageview();const i=this._getCurrentLocation();if(!i)return;if(this._hasLocationChanged(i)){const i=()=>this._instance.capture(et,{navigation_type:e});t?(this._pendingPageview=i,Promise.resolve().then(()=>this._flushPendingPageview())):i()}this._lastLocation=i}catch(t){$r.error(`Error capturing ${e} pageview`,t)}}_isUrlChanging(t){var i,n;return!(Rt(t)||!e)&&(null===(i=Jr(String(t)))||void 0===i?void 0:i.href)!==(null===(n=e.location)||void 0===n?void 0:n.href)}_flushPendingPageview(){const e=this._pendingPageview;if(e){this._pendingPageview=void 0,this._isFlushingPageview=!0;try{e()}catch(e){$r.error("Error capturing deferred pageview",e)}finally{this._isFlushingPageview=!1}this._lastLocation=this._getCurrentLocation()}}_setupPopstateListener(){if(this._popstateListener)return;const t=()=>{this._capturePageview("popstate")};Qr(e,"popstate",t),this._popstateListener=()=>{e&&e.removeEventListener("popstate",t)}}_setupHashchangeListener(){if(this._hashchangeListener)return;const t=()=>{this._capturePageview("hashchange")};Qr(e,"hashchange",t),this._hashchangeListener=()=>{e&&e.removeEventListener("hashchange",t)}}},heatmaps:class{get _config(){return this.instance.config}constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!!(null===(t=this.instance.persistence)||void 0===t?void 0:t.props[G]),this.rageclicks=new ib(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return xt(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Rt(this._config.capture_heatmaps)?Rt(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;KC.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("heatmaps"in t))return;const i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[G]:i}),this._enabledServerSide=i,this.startIfEnabled()}getAndClearBuffer(){const e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){JC(e.originalEvent)&&this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval=function(e){return"visible"===(null==e?void 0:e.visibilityState)}(n)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){e&&n&&(this._flushHandler=this._flush.bind(this),Qr(e,Xe,this._flushHandler),this._onClickHandler=t=>this._onClick(t||(null==e?void 0:e.event)),Qr(n,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=t=>this._onMouseMove(t||(null==e?void 0:e.event)),Qr(n,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new bk(this.instance,mk,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),Qr(n,I,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var t;e&&n&&(this._flushHandler&&e.removeEventListener(Xe,this._flushHandler),this._onClickHandler&&n.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&n.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&n.removeEventListener(I,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null===(t=this._deadClicksCapture)||void 0===t||t.stop(),this._initialized=!1)}_getProperties(t,i){const n=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(t,i,n){let s=t;for(;s&&co(s)&&!uo(s,"body");){if(s===n)return!1;let t;try{var r,o,a;t=null===(r=null!==(o=null===(a=s.ownerDocument)||void 0===a?void 0:a.defaultView)&&void 0!==o?o:e)||void 0===r?void 0:r.getComputedStyle(s).position}catch(e){return!1}if(ft(i,t))return!0;s=ko(s)}return!1}(yo(t),["fixed","sticky"],r);return{x:t.clientX+(o?0:s),y:t.clientY+(o?0:n),target_fixed:o,type:i}}_onClick(e,t="click"){var i;if(lo(e.target)||!JC(e))return;const n=this._getProperties(e,t);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(e.clientX,e.clientY,(new Date).getTime()))&&$o(yo(e),this.instance.config.rageclick)&&this._capture(ct(ct({},n),{},{type:"rageclick"})),this._capture(n)}_onMouseMove(e){!lo(e.target)&&JC(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(e,"mousemove"))},500))}_capture(t){if(!e)return;const i=this._config.disable_capture_url_hashes?un(e.location.href):e.location.href,n=this._config.custom_personal_data_properties,s=this._config.mask_personal_data_properties?[...xc,...n||[]]:[],r=so(i,s,Ic);this._buffer=this._buffer||{},this._buffer[r]||(this._buffer[r]=[]),this._buffer[r].push(t)}_flush(){this._buffer&&!Et(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:bk,webVitalsAutocapture:class{constructor(t){var i;this._instance=t,this._enabledServerSide=!1,this._initialized=!1,this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=(e=!1)=>{clearTimeout(this._delayedFlushTimer),this._delayedFlushTimer=void 0,0!==this._buffer.metrics.length&&(this._instance.capture("$web_vitals",ct({$current_url:this._buffer.url},this._buffer.metrics.reduce((e,t)=>ct(ct({},e),{},{[`$web_vitals_${t.name}_event`]:ct({},t),[`$web_vitals_${t.name}_value`]:t.value}),{})),e?{transport:"sendBeacon",send_instantly:!0}:void 0),this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=e=>{var t;if(this._buffer=this._buffer||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Rt(null==e?void 0:e.name)||Rt(null==e?void 0:e.value))return void zC.error("Invalid metric received",e);const i="string"==typeof e.navigationURL?e.navigationURL:void 0,n=this._maskedURL(i);if(It(n))return;const s=Ft(e.navigationId)||"string"==typeof e.navigationId?`navigation:${e.navigationId}`:`url:${n}`;if(this._maxAllowedValue&&e.value>=this._maxAllowedValue)return void zC.error("Ignoring metric with value >= "+this._maxAllowedValue,e);this._buffer.navigationKey!==s&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),It(this._buffer.navigationKey)&&(this._buffer.navigationKey=s,this._buffer.url=n),this._buffer.firstMetricTimestamp=It(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp;const r=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0),o=ct(ct(ct({},e),i?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete o.entries,xt(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){const t={};for(const i of VC){const n="url"===i&&"string"==typeof e.attribution[i]?this._maskedURL(e.attribution[i]):e.attribution[i];It(n)||(t[i]=n)}o.attribution=t}else delete o.attribution;It(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this._buffer.metrics.push(o),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()},this._startCapturing=()=>{if(this._initialized)return;let t,i,n,s,r=!1;const o=d.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this._callbackFlavor])||("web-vitals"===this._callbackFlavor&&It(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!It(l)){const e=l.withoutAttribution,o=this.attributionMetrics;r=!It(e),t=o.indexOf("LCP")>-1?l.onLCP:(null==e?void 0:e.onLCP)||l.onLCP,i=o.indexOf("CLS")>-1?l.onCLS:(null==e?void 0:e.onCLS)||l.onCLS,n=o.indexOf("FCP")>-1?l.onFCP:(null==e?void 0:e.onFCP)||l.onFCP,s=o.indexOf("INP")>-1?l.onINP:(null==e?void 0:e.onINP)||l.onINP}if(!(t&&i&&n&&s))return void zC.error("web vitals callbacks not loaded - not starting");const c={reportSoftNavs:this.useSoftNavs},u=r&&this.attributionMetrics.indexOf("INP")>-1?ct(ct({},c),{},{includeProcessedEventEntries:!1}):c;this.allowedMetrics.indexOf("LCP")>-1&&t(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("CLS")>-1&&i(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("FCP")>-1&&n(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("INP")>-1&&s(this._addToBuffer.bind(this),u);const h=null==e?void 0:e.document;Qr(h,I,()=>{"hidden"===(null==h?void 0:h.visibilityState)&&this._flushToCapture(!0)}),Qr(e,"pagehide",()=>this._flushToCapture(!0)),this._initialized=!0},this._enabledServerSide=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[Z]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const i=xt(this._perfConfig)?null===(e=this._perfConfig)||void 0===e?void 0:e.web_vitals_allowed_metrics:void 0;return Rt(i)?(null===(t=this._instance.persistence)||void 0===t?void 0:t.props.$web_vitals_allowed_metrics)||WC:i}get flushToCaptureTimeoutMs(){return(xt(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=xt(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return Lt(e)?e?WC:[]:kt(e)?e:jC}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=xt(this._perfConfig)?this._perfConfig.__preview_web_vitals_soft_navs:void 0;return null!=e&&e}get _maxAllowedValue(){const e=xt(this._perfConfig)&&Ft(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:UC;return e>0&&6e4>=e?UC:e}get isEnabled(){const e=null==s?void 0:s.protocol;if("http:"!==e&&"https:"!==e)return zC.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=xt(this._perfConfig)?this._perfConfig.web_vitals:Lt(this._perfConfig)?this._perfConfig:void 0;return Lt(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(zC.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const i=xt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,n=xt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Z]:i}),this._instance.persistence.register({[te]:n})),this._enabledServerSide=i,this.startIfEnabled()}get _callbackFlavor(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}_loadScript(e){var t;const i=d.__PosthogExtensions__,n=this._callbackFlavor,s=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==s?void 0:s[n])||"web-vitals"===n&&It(s)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?e():null==i||null===(t=i.loadExternalDependency)||void 0===t||t.call(i,this._instance,n,t=>{t?zC.error("failed to load script",t):e()})}_maskedURL(t){const i=t||(null==e?void 0:e.location.href);if(!i)return void zC.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?un(i):i,s=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...xc,...s||[]]:[];return so(n,r,Ic)}}},tE={exceptionObserver:class{constructor(t){var i;this._startCapturing=()=>{var t;if(!e||!this.isEnabled||!(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions))return;const i=d.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=d.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=d.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=i(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=n(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=s(this.captureException.bind(this)))}catch(e){qC.error("failed to start",e),this._stopCapturing()}},this._instance=t,this._remoteEnabled=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[Q]),this._rateLimiter=new Jt(ct(ct({},function(e={}){var t,i,n,s;return{refillRate:null!==(t=null!==(i=e.exceptionRateLimiterRefillRate)&&void 0!==i?i:e.__exceptionRateLimiterRefillRate)&&void 0!==t?t:1,bucketSize:null!==(n=null!==(s=e.exceptionRateLimiterBucketSize)&&void 0!==s?s:e.__exceptionRateLimiterBucketSize)&&void 0!==n?n:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,_logger:qC})),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return xt(e)?t=ct(ct({},t),e):(It(e)?this._remoteEnabled:e)&&(t=ct(ct({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(qC.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,i,n;(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions)?e():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"exception-autocapture",t=>{if(t)return qC.error("failed to load script",t);e()})}_stopCapturing(){var e,t,i;null===(e=this._unwrapOnError)||void 0===e||e.call(this),this._unwrapOnError=void 0,null===(t=this._unwrapUnhandledRejection)||void 0===t||t.call(this),this._unwrapUnhandledRejection=void 0,null===(i=this._unwrapConsoleError)||void 0===i||i.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this._remoteEnabled=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Q]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}onConfigChange(){this._config=this._requiredConfig()}captureException(e){try{var t,i,n;const s=null!==(t=null==e||null===(i=e.$exception_list)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.type)&&void 0!==t?t:"Exception";if(this._rateLimiter.consumeRateLimit(s))return void qC.info("Skipping exception capture because of client rate limiting.",{exception:s});null===(n=this._instance.exceptions)||void 0===n||n.sendExceptionEvent(e)}catch(e){}}},exceptions:class{constructor(e){var t,i;this._suppressionRules=[],this._errorPropertiesBuilder=nS(),this._instance=e,this._suppressionRules=null!==(t=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==t?t:[],this._exceptionStepsConfig=ns(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new ss(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=ns(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,i,n;if(!e.ok)return;const s=e.config;if(!("errorTracking"in s))return;const r=null!==(t=null===(i=s.errorTracking)||void 0===i?void 0:i.suppressionRules)&&void 0!==t?t:[],o=null===(n=s.errorTracking)||void 0===n?void 0:n.captureExtensionExceptions;this._suppressionRules=r,this._instance.persistence&&this._instance.persistence.register({[K]:this._suppressionRules,[J]:o})}get _captureExtensionExceptions(){var e;const t=!!this._instance.get_property(J),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this._errorPropertiesBuilder.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this._exceptionStepsConfig.enabled)try{if(!Tt(e)||0===e.trim().length)return void Yb.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:i,droppedKeys:n}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};const t=[];return{sanitizedProperties:Object.keys(e).reduce((i,n)=>ts.has(n)?(t.push(n),i):(i[n]=e[n],i),{}),droppedKeys:t}}(this._coerceExceptionStepProperties(t));n.length>0&&Yb.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this._exceptionStepsBuffer.add(ct({[Xn]:e,[es]:(new Date).toISOString()},i))}catch(e){Yb.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return this._addDroppedExceptionStep("Exception dropped: matched a suppression rule"),void Yb.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by a browser extension"),void Yb.info("Skipping exception capture because it was thrown by an extension");if(!this._captureExtensionExceptions&&this._isInjectedBrowserScriptException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by an injected browser script"),void Yb.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by the PostHog SDK"),void Yb.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this._exceptionStepsConfig.enabled&&Rt(e.$exception_steps)?this._addBufferedExceptionSteps(e):e,n=function(){if("u">typeof process){var e;const t=null===(e=process.env.POSTHOG_RELEASE_ID)||void 0===e?void 0:e.trim();if(t)return t}const t=globalThis._posthogReleaseId;return"string"==typeof t&&t.length>0?t:void 0}();n&&(i.$release_id=n);try{const e=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return e&&this._exceptionStepsBuffer.clear(),e}catch(e){return Zb(e)||Yb.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void(Zb(e)||Yb.error("Failed to process exception event. Ignoring this exception.",e))}}_addBufferedExceptionSteps(e){try{const t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:ct(ct({},e),{},{$exception_steps:t})}catch(t){return Yb.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[Xn]:e,[es]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return xt(e)?ct({},e):{}}_getExceptionStepsConfig(){var e,t;return null!==(e=null===(t=this._instance.config.error_tracking)||void 0===t?void 0:t.exception_steps)&&void 0!==e?e:{}}_matchesSuppressionRule(e){if(0===e.length)return!1;try{const t=e.reduce((e,{type:t,value:i})=>(Tt(t)&&t.length>0&&e.$exception_types.push(t),Tt(i)&&i.length>0&&e.$exception_values.push(i),e),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some(e=>{const i=e.values.map(e=>{const i=pc[e.operator],n=t[e.key];if(!i||!n)return!1;const s=kt(e.value)?e.value:[e.value];return s.length>0&&i(s,n)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}catch(e){return Yb.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}_isExtensionException(e){const t=e.flatMap(e=>{var t,i;return null!==(t=null===(i=e.stacktrace)||void 0===i?void 0:i.frames)&&void 0!==t?t:[]}),i=t.filter(({filename:e})=>!!e&&tS.some(t=>e.startsWith(t)));return 0!==i.length&&(!i.every(({filename:e})=>!!e&&e.startsWith(Xb))||e.some(({type:e,value:t})=>"NoResponse"===e||Tt(t)&&eS.some(({value:e,exact:i})=>i?t===e:t.includes(e)))&&!t.some(({in_app:e,filename:t})=>e&&!(null==t?void 0:t.startsWith(Xb))))}_isInjectedBrowserScriptException(e){return e.some(({value:e})=>Tt(e)&&iS.some(t=>e.includes(t)))}_isPostHogException(e){if(e.length>0){var t,i,n,s;const r=null!==(t=null===(i=e[0].stacktrace)||void 0===i?void 0:i.frames)&&void 0!==t?t:[],o=r[r.length-1];return null!==(n=null==o||null===(s=o.filename)||void 0===s?void 0:s.includes("posthog.com/static"))&&void 0!==n&&n}return!1}_isExceptionList(e){return!Rt(e)&&kt(e)}}},iE=ct({productTours:class{get _persistence(){return this._instance.persistence}constructor(e){this._productTourManager=null,this._cachedTours=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var i,n;if(this._persistence&&this._persistence.register({[X]:!!t.productTours}),!YC(this._instance))return!this._productTourManager&&Rt(null===(i=this._persistence)||void 0===i?void 0:i.props.ph_product_tours)||ZC.info("product tours disabled; stopping and clearing cached tours"),null===(n=this._productTourManager)||void 0===n||n.stop(),this._productTourManager=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this._productTourManager&&YC(this._instance)&&this._loadScript(()=>this._startProductTours())}_loadScript(e){var t,i,n;(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)?e():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"product-tours",t=>{t?ZC.error("Could not load product tours script",t):e()})}_startProductTours(){var e;!this._productTourManager&&(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)&&(this._productTourManager=d.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(kt(this._cachedTours)&&!t)return void e(this._cachedTours,{isLoaded:!0});const i=this._persistence;if(i){const n=i.props[be];if(kt(n)&&!t)return this._cachedTours=n,void e(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:t=>{if(!YC(this._instance))return void e([],{isLoaded:!0});const n=t.statusCode;if(200!==n||!t.json){const i=`Product Tours API could not be loaded, status: ${n}`;return 0===n?t.error||ZC.warn(i):ZC.error(i),void e([],{isLoaded:!1,error:i})}const s=kt(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=s,i&&i.register({[be]:s}),e(s,{isLoaded:!0})}})}getActiveProductTours(e){Rt(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript(()=>{var t;this._startProductTours(),null===(t=this._productTourManager)||void 0===t||t.previewTour(e)})}dismissProductTour(){var e;null===(e=this._productTourManager)||void 0===e||e.dismissTour("user_clicked_skip")}nextStep(){var e;null===(e=this._productTourManager)||void 0===e||e.nextStep()}previousStep(){var e;null===(e=this._productTourManager)||void 0===e||e.previousStep()}clearCache(){var e;this._cachedTours=null,null===(e=this._persistence)||void 0===e||e.unregister("ph_product_tours")}resetTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.resetTour(e)}resetAllTours(){var e;null===(e=this._productTourManager)||void 0===e||e.resetAllTours()}cancelPendingTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.cancelPendingTour(e)}}},Yx),nE={siteApps:class{constructor(e){this._instance=e,this._siteAppElementPatchCount=0,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(!t)return;const i=this.globalsForEvent(t);this._bufferedInvocations.push(i),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}get siteAppLoaders(){var e;return null===(e=d._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,i,n,s,r,o,a;if(!e)throw new Error("Event payload is required");const l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(const[e,t]of Object.entries(u))l[e]={id:c[e],type:e,properties:t};const{$set_once:d,$set:h}=e;return{event:ct(ct({},bs(e,XC)),{},{properties:ct(ct(ct({},e.properties),h?{$set:ct(ct({},null!==(t=null===(i=e.properties)||void 0===i?void 0:i.$set)&&void 0!==t?t:{}),h)}:{}),d?{$set_once:ct(ct({},null!==(n=null===(s=e.properties)||void 0===s?void 0:s.$set_once)&&void 0!==n?n:{}),d)}:{}),elements_chain:null!==(r=null===(o=e.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(a=e.properties)||void 0===a?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}_prepareElementForSiteApp(e){var t;const i=null===(t=e.tagName)||void 0===t?void 0:t.toLowerCase();if("style"===i&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(e)||(ex.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===i&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(e)||(ex.error("prepare_external_dependency_script returned null"),null)}return e}_patchSiteAppElementInsertionMethods(){var e,t,i,s,r,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const c=null==n?void 0:n.defaultView,u=null==c||null===(e=c.Node)||void 0===e?void 0:e.prototype;if(!c||!u)return()=>{};if(this._siteAppElementPatchCount++,this._restoreSiteAppElementPatches)return this._releaseSiteAppElementPatches();const d=[],h=this,p=new WeakSet,g=(e,t,i)=>{if(!(null==e?void 0:e[t]))return;const n=e[t];e[t]=i(n),d.push(()=>{e[t]=n})},_=e=>{if(p.has(e))return e;const t=h._prepareElementForSiteApp(e);return t&&p.add(t),t},f=e=>e.map(e=>"string"==typeof e?e:_(e)).filter(e=>!Pt(e));return g(u,"appendChild",e=>function(t){const i=_(t);return i?e.call(this,i):t}),g(u,"insertBefore",e=>function(t,i){const n=_(t);return n?e.call(this,n,i):t}),g(u,"replaceChild",e=>function(t,i){const n=_(t);return n?e.call(this,n,i):i}),[null===(t=c.Element)||void 0===t?void 0:t.prototype,null===(i=c.Document)||void 0===i?void 0:i.prototype,null===(s=c.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(e=>{g(e,"append",e=>function(...t){return e.apply(this,f(t))}),g(e,"prepend",e=>function(...t){return e.apply(this,f(t))})}),[null===(r=c.Element)||void 0===r?void 0:r.prototype,null===(o=c.CharacterData)||void 0===o?void 0:o.prototype,null===(a=c.DocumentType)||void 0===a?void 0:a.prototype].forEach(e=>{g(e,"before",e=>function(...t){return e.apply(this,f(t))}),g(e,"after",e=>function(...t){return e.apply(this,f(t))}),g(e,"replaceWith",e=>function(...t){const i=f(t);return t.length&&!i.length?void 0:e.apply(this,i)})}),g(null===(l=c.Element)||void 0===l?void 0:l.prototype,"insertAdjacentElement",e=>function(t,i){const n=_(i);return n?e.call(this,t,n):null}),this._restoreSiteAppElementPatches=()=>{d.forEach(e=>e()),this._restoreSiteAppElementPatches=void 0},this._releaseSiteAppElementPatches()}_releaseSiteAppElementPatches(){let e=!1;return()=>{var t;e||(e=!0,this._siteAppElementPatchCount--,0===this._siteAppElementPatchCount&&(null===(t=this._restoreSiteAppElementPatches)||void 0===t||t.call(this)))}}_runWithPreparedSiteAppElements(e,t=!0){const i=this._patchSiteAppElementInsertionMethods();try{const n=e(i);return t&&i(),n}catch(e){throw i(),e}}setupSiteApp(e){const t=this.apps[e.id],i=()=>{var i;!t.errored&&this._bufferedInvocations.length&&(ex.info(`Processing ${this._bufferedInvocations.length} events for site app with id ${e.id}`),this._bufferedInvocations.forEach(e=>this._runWithPreparedSiteAppElements(()=>{var i;return null===(i=t.processEvent)||void 0===i?void 0:i.call(t,e)})),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null===(i=this._stopBuffering)||void 0===i||i.call(this))};let n=!1;const s=s=>{t.errored=!s,t.loaded=!0,ex.info(`Site app with id ${e.id} ${s?"loaded":"errored"}`),n&&i()};try{const{processEvent:i}=this._runWithPreparedSiteAppElements(t=>e.init({posthog:this._instance,callback(e){t(),s(e)}}),!1);i&&(t.processEvent=i),n=!0}catch(t){ex.error(tx+e.id,t),s(!1)}if(n&&t.loaded)try{i()}catch(i){ex.error(`Error while processing buffered events PostHog app with config id ${e.id}`,i),t.errored=!0}}_setupSiteApps(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}_onCapturedEvent(e){if(0===Object.keys(this.apps).length)return;const t=this.globalsForEvent(e);for(const i of Object.values(this.apps))try{this._runWithPreparedSiteAppElements(()=>{var e;return null===(e=i.processEvent)||void 0===e?void 0:e.call(i,t)})}catch(t){ex.error(`Error while processing event ${e.event} for site app ${i.id}`,t)}}onRemoteConfig(e){var t,i,n;if(null===(t=this.siteAppLoaders)||void 0===t?void 0:t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",e=>this._onCapturedEvent(e))):void ex.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this._stopBuffering)||void 0===i||i.call(this),!e.ok)return;const s=e.config;if(null===(n=s.siteApps)||void 0===n?void 0:n.length)if(this.isEnabled)for(const{id:e,url:t}of s.siteApps){var r,o;d[`__$$ph_site_app_${e}`]=this._instance,null===(r=d.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,t,t=>{if(t)return ex.error(tx+e,t)})}else ex.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},sE={tracingHeaders:class{constructor(e){this._instance=e,this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._hostnamesForPatch=void 0,this._startCapturing=()=>{const e=this._syncHostnamesForPatch();var t,i;e?(It(this._restoreXHRPatch)&&(this._restoreXHRPatch=null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.tracingHeadersPatchFns)||void 0===t?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),It(this._restoreFetchPatch)&&(this._restoreFetchPatch=null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this._stopCapturing()}}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,i,n;(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.tracingHeadersPatchFns)?e():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"tracing-headers",t=>{if(t)return HC.error("failed to load script",t);e()})}_getConfiguredHostnames(){var e,t;return null!==(e=null!==(t=this._instance.config.tracing_headers)&&void 0!==t?t:this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}_syncHostnamesForPatch(){const e=this._getConfiguredHostnames();return kt(e)?(kt(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(kt(this._hostnamesForPatch)&&this._hostnamesForPatch.splice(0),this._hostnamesForPatch=e||void 0,this._hostnamesForPatch)}_stopCapturing(){var e,t;null===(e=this._restoreXHRPatch)||void 0===e||e.call(this),null===(t=this._restoreFetchPatch)||void 0===t||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0}startIfEnabledOrStop(){this._syncHostnamesForPatch()?this._loadScript(this._startCapturing):this._stopCapturing()}}},rE=ct({surveys:class extends tb{constructor(e){super(new Db(e))}}},Yx),oE={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){d.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=d.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t=void 0,i=void 0,s=void 0){var r,o;if(Kr(this.instance.config))return!1;if(!e||!n)return!1;t=null!==(r=t)&&void 0!==r?r:e.location,s=null!==(o=s)&&void 0!==o?o:e.history;try{if(!i){try{e.localStorage.setItem("test","test"),e.localStorage.removeItem("test")}catch(e){return!1}i=null==e?void 0:e.localStorage}const n=ix||ro(t.hash,"__posthog")||ro(t.hash,"state");let r;const o=n?dn(()=>JSON.parse(atob(decodeURIComponent(n))))||dn(()=>JSON.parse(decodeURIComponent(n))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?t.hash=o.desiredHash:s?s.replaceState(s.state,"",t.pathname+t.search):t.hash="")):(r=JSON.parse(i.getItem(nx)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(e){return!1}}_callLoadToolbar(e){const t=d.ph_load_toolbar||d.ph_load_editor;!Rt(t)&&Ct(t)?t(e,this.instance):sx.warn("No toolbar load function found")}loadToolbar(t){const i=!!(null==n?void 0:n.getElementById("__POSTHOG_TOOLBAR__"));if(!e||i)return!1;const s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=ct(ct({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(e.localStorage.setItem(nx,JSON.stringify(ct(ct({},r),{},{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(r);else if(0===this._getToolbarState()){var o,a;this._setToolbarState(1),null===(o=d.__PosthogExtensions__)||void 0===o||null===(a=o.loadExternalDependency)||void 0===a||a.call(o,this.instance,"toolbar",e=>{if(e)return sx.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(r)}),Qr(e,"turbolinks:load",()=>{this._setToolbarState(0),this.loadToolbar(r)})}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,i=void 0){return this.maybeLoadToolbar(e,t,i)}}},aE=ct({experiments:class t{get _config(){return this._instance.config}constructor(e){this._instance=e,this.getWebExperimentsAndEvaluateDisplayLogic=(e=!1)=>{this.getWebExperiments(e=>{t._logInfo("retrieved web experiments from the server"),this._flagToExperiments=new Map,e.forEach(e=>{if(e.feature_flag_key){var i;this._flagToExperiments&&(t._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null===(i=this._flagToExperiments)||void 0===i||i.set(e.feature_flag_key,e));const n=this._instance.getFeatureFlag(e.feature_flag_key);Tt(n)&&e.variants[n]&&this._applyTransforms(e.name,n,e.variants[n].transforms)}else if(e.variants)for(const i in e.variants){const n=e.variants[i];t._matchesTestVariant(n,this._instance)&&this._applyTransforms(e.name,i,n.transforms)}})},e)},this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())t._logInfo(fx);else if(!this._config.disable_web_experiments){if(Rt(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t._logInfo("applying feature flags",e),e.forEach(e=>{var t;if(this._flagToExperiments&&(null===(t=this._flagToExperiments)||void 0===t?void 0:t.has(e))){var i;const t=this._instance.getFeatureFlag(e),n=null===(i=this._flagToExperiments)||void 0===i?void 0:i.get(e);t&&(null==n?void 0:n.variants[t])&&this._applyTransforms(n.name,t,n.variants[t].transforms)}})}}previewWebExperiment(){const e=t.getWindowLocation();if(null==e?void 0:e.search){const i=no(null==e?void 0:e.search,"__experiment_id"),n=no(null==e?void 0:e.search,"__experiment_variant");i&&n&&(t._logInfo(`previewing web experiments ${i} && ${n}`),this.getWebExperiments(e=>{this._showPreviewWebExperiment(parseInt(i),n,e)},!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._config.disable_web_experiments&&!i)return e([]);const n=this._instance.get_property("$web_experiments");if(n&&!t)return e(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this._config.token}`),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}_showPreviewWebExperiment(e,i,n){const s=n.filter(t=>t.id===e);s&&s.length>0&&(t._logInfo(`Previewing web experiment [${s[0].name}] with variant [${i}]`),this._applyTransforms(s[0].name,i,s[0].variants[i].transforms))}static _matchesTestVariant(e,i){return!Rt(e.conditions)&&t._matchUrlConditions(e,i)&&t._matchUTMConditions(e)}static _matchUrlConditions(e,i){var n;if(Rt(e.conditions)||Rt(null===(n=e.conditions)||void 0===n?void 0:n.url))return!0;const s=t.getWindowLocation();if(s){var r,o,a;const t=oo(i,s.href);return!(null===(r=e.conditions)||void 0===r?void 0:r.url)||yx[null!==(o=null===(a=e.conditions)||void 0===a?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](e.conditions.url,t)}return!1}static getWindowLocation(){return null==e?void 0:e.location}static _matchUTMConditions(e){var t;if(Rt(e.conditions)||Rt(null===(t=e.conditions)||void 0===t?void 0:t.utm))return!0;const i=Mc();if(i.utm_source){var n,s,r,o,a,l,c,u;const t=!(null===(n=e.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)||(null===(s=e.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)==i.utm_campaign,d=!(null===(r=e.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=e.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==i.utm_source,h=!(null===(a=e.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)||(null===(l=e.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)==i.utm_medium,p=!(null===(c=e.conditions)||void 0===c||null===(c=c.utm)||void 0===c?void 0:c.utm_term)||(null===(u=e.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)==i.utm_term;return t&&h&&p&&d}return!1}static _logInfo(e,...t){$r.info(`[WebExperiments] ${e}`,t)}static _sanitizeLinkTargets(e){("http://www.w3.org/1999/xhtml"===e.namespaceURI&&"template"===e.localName?e.content:e).querySelectorAll("a[target], template").forEach(e=>{var i;if("template"===e.localName)return void("http://www.w3.org/1999/xhtml"===e.namespaceURI&&t._sanitizeLinkTargets(e));if("http://www.w3.org/1999/xhtml"!==e.namespaceURI||"_blank"!==(null===(i=e.getAttribute("target"))||void 0===i?void 0:i.toLowerCase()))return void e.removeAttribute("target");const n=(e.getAttribute("rel")||"").split(/\s+/).filter(e=>e&&!/^(opener|noopener)$/i.test(e));n.push("noopener"),e.setAttribute("rel",n.join(" "))})}_applyTransforms(e,i,n){this._is_bot()?t._logInfo(fx):"control"!==i?n.forEach(n=>{if(n.selector){var s;t._logInfo(`applying transform of variant ${i} for experiment ${e} `,n);const r=null===(s=document)||void 0===s?void 0:s.querySelectorAll(n.selector),o=new Map;null==r||r.forEach(e=>{if("script"===e.localName.toLowerCase())return;const i=e;if(n.html){var s;const a="http://www.w3.org/1998/Math/MathML"===e.namespaceURI&&"annotation-xml"===e.localName&&(null===(s=e.getAttribute("encoding"))||void 0===s?void 0:s.toLowerCase())||"",l=JSON.stringify([e.namespaceURI,e.localName,a]);let c=o.get(l);if(Rt(c)){var r;const i=null!==(r=mx)&&void 0!==r?r:mx=km(),s=e.ownerDocument.implementation.createHTMLDocument(""),u=s.createElementNS(e.namespaceURI,e.localName);a&&u.setAttribute("encoding",a);const d=s.createRange();d.selectNodeContents(u);const h="http://www.w3.org/2000/svg"===e.namespaceURI&&/^(foreignObject|desc|title)$/.test(e.localName)||/^(text\/html|application\/xhtml\+xml)$/.test(a)?"http://www.w3.org/1999/xhtml":e.namespaceURI,p=d.createContextualFragment(n.html);"http://www.w3.org/1998/Math/MathML"===e.namespaceURI&&/^(mi|mo|mn|ms|mtext)$/.test(e.localName)?(u.appendChild(p),i.sanitize(u,ct(ct({},vx),{},{NAMESPACE:h||void 0,IN_PLACE:!0}))):("http://www.w3.org/1999/xhtml"===u.namespaceURI&&"template"===u.localName?u.content:u).appendChild(i.sanitize(p,ct(ct({},vx),{},{NAMESPACE:h||void 0,RETURN_DOM_FRAGMENT:!0}))),t._sanitizeLinkTargets(u),c=u.innerHTML,o.set(l,c)}i.innerHTML=c}n.css&&i.setAttribute("style",n.css)})}}):t._logInfo("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?oC(i,this._config.custom_blocked_useragents):void 0}}},Yx),lE={conversations:class{constructor(e){this._instance=e,this._isConversationsEnabled=void 0,this._conversationsManager=null,this._isInitializing=!1,this._remoteConfig=null,this._loadFailed=!1,this._resetGeneration=0,this._pendingPanelAction=null,this._theme=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations)return void(this._pendingPanelAction=null);if(this._remoteConfigSuccessful=e.ok,!e.ok)return;const t=e.config.conversations;Rt(t)?this._pendingPanelAction=null:(Lt(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this._isConversationsEnabled||(this._pendingPanelAction=null),this.loadIfEnabled())}reset(){var e;null===(e=this._conversationsManager)||void 0===e||e.reset(),this._conversationsManager=null,this._resetGeneration++,this._isConversationsEnabled=void 0,this._remoteConfig=null,this._remoteConfigSuccessful=void 0,this._loadFailed=!1,this._pendingPanelAction=null}loadIfEnabled(){if(this._conversationsManager)return;if(this._isInitializing)return;if(this._instance.config.disable_conversations)return;if(Kr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=null==d?void 0:d.__PosthogExtensions__;if(e&&!It(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{const t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);const i=e.loadExternalDependency;if(!i)return void this._handleLoadError(R);const n=this._resetGeneration;i(this._instance,"conversations",t=>{if(n!==this._resetGeneration)return this._isInitializing=!1,void this.loadIfEnabled();t||!e.initConversations?this._handleLoadError("Could not load conversations script",t):this._completeInitialization(e.initConversations),this._isInitializing=!1})}catch(e){this._handleLoadError("Error initializing conversations",e),this._isInitializing=!1}}else bx.error("Conversations enabled but missing token in remote config.")}_completeInitialization(e){if(this._remoteConfig){try{this._conversationsManager=e(this._remoteConfig,this._instance),this._loadFailed=!1,bx.info("Conversations loaded successfully")}catch(e){return void this._handleLoadError("Error completing conversations initialization",e)}this._theme&&this._conversationsManager.setTheme(this._theme),this._applyPendingPanelAction()}else bx.error("Cannot complete initialization: remote config is null")}_applyPendingPanelAction(){const e=this._pendingPanelAction;this._pendingPanelAction=null,this._conversationsManager&&e&&("open"===e?this._conversationsManager.open():this._conversationsManager.close())}_handleLoadError(e,t){bx.error(e,t),this._conversationsManager=null,this._isInitializing=!1,this._loadFailed=!0}show(){this._conversationsManager?this._conversationsManager.show():bx.warn("Conversations not loaded yet.")}hide(){"open"===this._pendingPanelAction&&(this._pendingPanelAction=null),this._conversationsManager&&this._conversationsManager.hide()}open(){this._conversationsManager?(this._pendingPanelAction=null,this._conversationsManager.open()):this._pendingPanelAction="open"}close(){this._conversationsManager?(this._pendingPanelAction=null,this._conversationsManager.close()):this._pendingPanelAction="close"}setTheme(e){var t,i;this._theme=ct(ct(ct({},this._theme),e),{},{dark:ct(ct({},null===(t=this._theme)||void 0===t?void 0:t.dark),null==e?void 0:e.dark)}),null===(i=this._conversationsManager)||void 0===i||i.setTheme(e)}isAvailable(){return!0===this._isConversationsEnabled&&!Pt(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Kr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this._remoteConfigSuccessful?"remote_config_failed":It(this._isConversationsEnabled)?this._remoteConfigSuccessful?"disabled_in_project":"remote_config_pending":this._isConversationsEnabled?Rt(this._remoteConfig)||!this._remoteConfig.token?"missing_token":(null==d?void 0:d.__PosthogExtensions__)?this._isInitializing?"initializing":this._loadFailed?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,i){var n=this;return rt(function*(){return n._conversationsManager?n._conversationsManager.sendMessage(e,t,i):(bx.warn(Sx),null)})()}getMessages(e,t){var i=this;return rt(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(bx.warn(Sx),null)})()}markAsRead(e){var t=this;return rt(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(bx.warn(Sx),null)})()}getTickets(e){var t=this;return rt(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(bx.warn(Sx),null)})()}requestRestoreLink(e){var t=this;return rt(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(bx.warn(Sx),null)})()}restoreFromToken(e){var t=this;return rt(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(bx.warn(Sx),null)})()}restoreFromUrlToken(){var e=this;return rt(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(bx.warn(Sx),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}_onIdentityChanged(){var e;null===(e=this._conversationsManager)||void 0===e||e.setIdentity()}_onIdentityCleared(){var e;null===(e=this._conversationsManager)||void 0===e||e.clearIdentity()}}},cE={logs:class extends Tx{constructor(e){super({get(){var t;return null==e||null===(t=e.config)||void 0===t?void 0:t.logs},captureHintKey:ee,get remoteConfigWillArrive(){var t,i;return!(null===(t=e._shouldDisableFlags)||void 0===t?void 0:t.call(e))||!!(null===(i=d._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[e.config.token])||void 0===i?void 0:i.config)}},()=>function(e){var t;const i={};if(i.distinctId=e.get_distinct_id(),e.sessionManager){const{sessionId:t,windowId:n,sessionStartTimestamp:s,lastActivityTimestamp:r}=e.sessionManager.checkAndGetSessionAndWindowId(!0);i.sessionId=t,i.windowId=n,Rt(s)||(i.sessionStartTimestamp=s),Rt(r)||(i.lastActivityTimestamp=r)}if((null==d||null===(t=d.location)||void 0===t?void 0:t.href)&&(i.currentUrl=e.config.disable_capture_url_hashes?un(d.location.href):d.location.href),e.featureFlags){const t=e.featureFlags.getFlags();t&&t.length>0&&(i.activeFeatureFlags=t)}return i}(e)),this._instance=e,this.name=gb,this._listenForReconnect()}get _isRequestReady(){return this._instance.__loaded}_getConsoleLoader(){const e=Nr("[logs]"),t=null==d?void 0:d.__PosthogExtensions__;if(!t)return void e.error("PostHog Extensions not found.");const i=t.loadExternalDependency;if(i)return e=>{i(this._instance,"logs",i=>{const n=t.logs;e(i,(null==n?void 0:n.initializeLogs)?{initialize:e=>n.initializeLogs(e),replay(e,t){var i;return null===(i=n.replayConsoleBuffer)||void 0===i?void 0:i.call(n,e,t)}}:void 0)})};e.error(R)}}},uE={metrics:class{constructor(e){this._instance=e,this._logger=Nr("[metrics]"),this._disposed=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this._disposed)return;const t=!!(null===(e=this._instance.config.metrics)||void 0===e?void 0:e.network);t&&!this._stopNetworkMetrics?this._stopNetworkMetrics=(e=>{let t=!0;const i=()=>t?(e=>{var t;const i=null===(t=e.config.metrics)||void 0===t?void 0:t.network;return!0===i?{}:i||void 0})(e):void 0,n=Dx(e,i),s=$x(e,i);return()=>{t=!1,n(),s()}})(this._instance):!t&&this._stopNetworkMetrics&&(this._stopNetworkMetrics(),this._stopNetworkMetrics=void 0)}_getCore(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.metrics;var i;return this._core&&this._resolvedFrom===t||(null===(i=this._core)||void 0===i||i.reset(),this._resolvedFrom=t,this._core=new Rr(this._createHost(),function(e){var t,i,n,s,r;const o=null==e?void 0:e.resourceAttributes;return{serviceName:null!==(t=null==o?void 0:o["service.name"])&&void 0!==t?t:null==e?void 0:e.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==e?void 0:e.serviceVersion,environment:null!==(n=null==o?void 0:o["deployment.environment"])&&void 0!==n?n:null==e?void 0:e.environment,resourceAttributes:o,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:null!==(s=null==e?void 0:e.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(r=null==e?void 0:e.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(t),this._logger)),this._core}count(e,t=1,i){this._getCore().count(e,t,i)}gauge(e,t,i){this._getCore().gauge(e,t,i)}histogram(e,t,i){this._getCore().histogram(e,t,i)}flush(e){if(!this._core)return Promise.resolve();if(e){const t=this._core.drainWindow();return t&&this._sendMetricsBatch(t,e),Promise.resolve()}return this._core.flush().catch(e=>this._logger.error("PostHog metrics flush failed:",e))}reset(){var e;null===(e=this._core)||void 0===e||e.reset()}dispose(){var e,t;this._disposed=!0,null===(e=this._stopNetworkMetrics)||void 0===e||e.call(this),this._stopNetworkMetrics=void 0,null===(t=this._core)||void 0===t||t.reset()}_createHost(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},_sendMetricsBatch:e=>t._sendMetricsBatch(e),getLibraryId:()=>Jl.LIB_NAME,getLibraryVersion:()=>Jl.LIB_VERSION}}_sendMetricsBatch(e,t){return new Promise(i=>{let n=!1;const s=e=>{n||(n=!0,clearTimeout(r),i(e))},r=setTimeout(()=>s({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(ct(ct({method:"POST",url:this._metricsUrl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(e){const t=e.statusCode;if(t>=200&&300>t)s({kind:"ok"});else if(413===t)s({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)s({kind:"fatal",error:new Error(`metrics request failed with status ${t}`)});else{var i;s({kind:"retry-later",error:null!==(i=e.error)&&void 0!==i?i:new Error(`metrics request failed with status ${t}`)})}}}))})}_metricsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},dE={webMCP:class{constructor(e){this._instance=e,this._isPatched=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this._isPatched)return;const e=null==n?void 0:n.modelContext;if(!e||!Ct(e.registerTool))return;const t=Nx.get(e);if(t)return t.instances.add(this._instance),void(this._isPatched=!0);const i={instances:new Set([this._instance])},s=e.registerTool,r=this;Fg(e,"registerTool",e=>{const t=e;return function(e,...n){let s=e;try{s=r._wrapTool(e,i)}catch(i){return t.call(this,e,...n)}return t.call(this,s,...n)}}),e.registerTool!==s&&(Nx.set(e,i),this._isPatched=!0)}_wrapTool(e,t){if(!e||!Ct(e.execute))return e;const i=e.execute,n=this,{tool:s,injected:r}=function(e,t){const i={intent:!1,model:!1},n=e.inputSchema;if(!function(e){return!!It(e)||xt(e)&&Object.keys(e).every(e=>Bx.has(e)||e.startsWith("x-"))&&!0!==e.additionalProperties&&!xt(e.additionalProperties)&&(!e.type||"object"===e.type)&&(!e.properties||xt(e.properties))&&(!e.required||kt(e.required))}(n))return{tool:Wx(e),injected:i};const s=(null==n?void 0:n.properties)||{},r=e=>Ux(s,e)||kt(null==n?void 0:n.required)&&n.required.includes(e);if(i.intent=t.intent&&!r("context"),i.model=t.model&&!r("llm_model"),!i.intent&&!i.model)return{tool:Wx(e),injected:i};const o=ct({},s),a=kt(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:Wx(e,ct(ct({},n),{},{type:(null==n?void 0:n.type)||"object",properties:o,required:a})),injected:i}}(e,function(e){const t={intent:!1,model:!1};for(const i of e.instances){const e=zx(i.config.capture_webmcp);t.intent||(t.intent=!0===(null==e?void 0:e.intent)),t.model||(t.model=!0===(null==e?void 0:e.model))}return t}(t));return Object.defineProperty(s,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...o){const a=new Date,l=function(e,t){if(!xt(e))return{};try{const i=t.intent?jx(e.context,2048,!0):void 0,n=t.model?jx(e.llm_model,256):void 0;return ct(ct({},i&&"{}"!==i?{intent:i}:{}),n&&"unknown"!==n.toLowerCase()?{model:n}:{})}catch(e){return{}}}(o[0],r),c=function(e,t){const i=e[0];if(!xt(i))return e;try{const n=t.intent&&Ux(i,"context"),s=t.model&&Ux(i,"llm_model");if(!n&&!s)return e;const r=ct({},i);return n&&delete r.context,s&&delete r.llm_model,[r,...e.slice(1)]}catch(t){return e}}(o,r);let u;try{u=i.apply(this===s?e:this,c)}catch(e){throw n._captureToolCall(t,s,a,{error:e,errorResult:!1},l),e}if((d=u)&&"function"==typeof d.then)return Promise.resolve(u).then(e=>{const i=Vx(e)?{error:e,errorResult:!0}:void 0;return n._captureToolCall(t,s,a,i,l),e},e=>{throw n._captureToolCall(t,s,a,{error:e,errorResult:!1},l),e});var d;const h=Vx(u)?{error:u,errorResult:!0}:void 0;return n._captureToolCall(t,s,a,h,l),u}}),s}_captureToolCall(e,t,i,n,r){const o=Date.now()-i.getTime();let a;for(const c of e.instances){var l;const e=zx(c.config.capture_webmcp);if(e){n&&!a&&(a=Zx(n.error,n.errorResult));try{c.capture("$mcp_tool_call",ct(ct(ct({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:t.name,$mcp_resource_name:t.name,$mcp_tool_description:t.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}:{}),e.intent&&r.intent?{$mcp_intent:r.intent,$mcp_intent_source:"context_parameter"}:{}),e.model&&r.model?{$mcp_llm_model:r.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:i})}catch(e){continue}if(n&&a&&c.exceptions&&(null===(l=c.exceptionObserver)||void 0===l?void 0:l.isEnabled))try{const e={$exception_list:Kx(c.exceptions,n,a.message),$exception_level:"error",$exception_source:"mcp.tool_call",$mcp_interface:"webmcp",$mcp_tool_name:t.name,$mcp_resource_name:t.name,$mcp_tool_description:t.description,$mcp_server_name:null==s?void 0:s.hostname};c.exceptionObserver.captureException(e)}catch(e){}}}}}};$C.__defaultExtensionClasses=ct({},ct(ct(ct(ct(ct(ct(ct(ct(ct(ct(ct(ct(ct(ct({},Yx),Xx),eE),tE),iE),nE),rE),sE),oE),aE),lE),cE),uE),dE)),function(){Jl.SDK_DIST_CHANNEL="cdn";const t=d.posthog;if(t&&!kt(t._i)&&Ct(t.init))return;const i=fC[PC]=new $C;if(t){const e=[];qr(t._i,function(n){if(n&&kt(n)){const s=i.init(n[0],n[1],n[2]),r=t[n[2]]||t;s.__loaded&&-1===e.indexOf(r)&&(e.push(r),s._execute_array.call(s.people,r.people),s._execute_array(r))}});const n=t.people;if(!i.__loaded&&kt(t)){const e=i.init;let s=!0;i.init=(r,o,a)=>{const l=e.call(i,r,o,a);return s&&l===i&&l.__loaded&&(s=!1,i.init=e,l._execute_array.call(l.people,n),l._execute_array(t)),l}}}i.__SV=1,d.posthog=i,function(){function t(){t.done||(t.done=!0,Qk=!1,qr(fC,function(e){e._dom_loaded()}))}(null==n?void 0:n.addEventListener)?"complete"===n.readyState?t():Qr(n,"DOMContentLoaded",t,{capture:!1}):e&&$r.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}()}();
|
|
1
|
+
!function(){const e="u">typeof window?window:void 0,t="u">typeof globalThis?globalThis:e,i=null==t?void 0:t.navigator,n=null==t?void 0:t.document,s=null==t?void 0:t.location,r=null==t?void 0:t.fetch,o=(null==t?void 0:t.XMLHttpRequest)&&"withCredentials"in new t.XMLHttpRequest?t.XMLHttpRequest:void 0,a=null==t?void 0:t.AbortController,l=null==t?void 0:t.CompressionStream,c=null==i?void 0:i.userAgent,u="undefined"!=typeof globalThis?globalThis:e;u&&"undefined"==typeof self&&(u.self=u),u&&"undefined"==typeof File&&(u.File=function(){});const d=null!=e?e:{},h="$early_access_features",p="$active_feature_flags",g="$feature_flag_details",_="$feature_flag_errors",f="$feature_flag_evaluated_at",v="$feature_flag_request_id",m="$minimal_flag_called_events",y="$enabled_feature_flags",b="$stored_group_properties",S="$stored_person_properties",w="$flag_call_reported",k="$flag_call_reported_session_id",C="$feature_flag_payloads",x="$override_feature_flags",E="$override_feature_flag_payloads",I="visibilitychange",T="$autocapture_disabled_server_side",M="$surveys",P="$surveys_loaded_at",R="PostHog loadExternalDependency extension not found.",F="$surveys_activated",A="$surveys_activated_session",L="$surveys_activated_timestamps",O="$people_distinct_id",D="distinct_id",N="$device_id",B="$device_model",q="__alias",H="__cmpns",z="$fbc",U="$fbc_persistence",W="$fbp",j="$fbp_persistence",V="__timers",G="$heatmaps_enabled_server_side",Q="$exception_capture_enabled_server_side",K="$error_tracking_suppression_rules",J="$error_tracking_capture_extension_exceptions",Z="$web_vitals_enabled_server_side",Y="$dead_clicks_enabled_server_side",X="$product_tours_enabled_server_side",ee="$logs_capture_enabled_server_side",te="$web_vitals_allowed_metrics",ie="$session_recording_remote_config",ne="$session_recording_enabled_server_side",se="$replay_sample_rate",re="$replay_override_sampling",oe="$replay_override_linked_flag",ae="$replay_override_url_trigger",le="$replay_override_event_trigger",ce="$sesid",ue="$session_is_sampled",de="$session_past_minimum_duration",he="$session_recording_url_trigger_activated_session",pe="$session_recording_event_trigger_activated_session",ge="$posthog_sr_group_event_trigger_",_e="$posthog_sr_group_url_trigger_",fe="$posthog_sr_group_sampling_",ve="$debug_first_full_snapshot_timestamp",me="$sess_rec_flush_size",ye="$groups",be="ph_product_tours",Se="$product_tours_activated",we="$product_tours_activated_session",ke="$conversations_widget_session_id",Ce="$conversations_ticket_id",xe="$conversations_widget_state",Ee="$conversations_user_traits",Ie="$user_state",Te="$client_session_props",Me="$capture_rate_limit",Pe="$initial_campaign_params",Re="$initial_referrer_info",Fe="$initial_person_info",Ae="$epp",Le="$posthog_cookieless",Oe="$cookieless_mode",De="$sdk_debug_extensions_init_method",$e="$sdk_debug_extensions_init_time_ms",Ne="$sdk_debug_recording_script_not_loaded",Be="$sdk_debug_replay_stale_config",qe="$sdk_debug_replay_event_trigger_status",He="$sdk_debug_replay_linked_flag_trigger_status",ze="$sdk_debug_replay_matched_recording_trigger_groups",Ue="$sdk_debug_replay_pending_trigger_conditions",We="$sdk_debug_replay_remote_trigger_matching_config",je="$sdk_debug_replay_trigger_groups_count",Ve="$sdk_debug_replay_url_trigger_status",Ge="$sdk_debug_rrweb_attached",Qe="$sdk_debug_rrweb_start_attempted",Ke="$session_recording_start_reason",Je="anonymous",Ze="identified",Ye="identified_only",Xe="beforeunload",et="$pageview",tt="$pageleave",it="$identify",nt="$groupidentify";function st(e,t,i,n,s,r,o){try{var a=e[r](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(n,s)}function rt(e){return function(){var t=this,i=arguments;return new Promise(function(n,s){var r=e.apply(t,i);function o(e){st(r,n,s,o,a,"next",e)}function a(e){st(r,n,s,o,a,"throw",e)}o(void 0)})}}function ot(e){return ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ot(e)}function at(e,t,i){return(t=function(e){var t=function(e){if("object"!=ot(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=ot(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ot(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function lt(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function ct(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?lt(Object(i),!0).forEach(function(t){at(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):lt(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}var ut=function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysInProgress="surveys_in_progress",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e}({}),dt=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({});const ht="min_length",pt="max_length",gt=["$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"],_t=["token"];function ft(e,t){return-1!==e.indexOf(t)}const vt=function(e){return e.trim()},mt=function(e){return e.replace(/^\$/,"")};function yt(e){var t;const i=[];return null!==(t=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(t))return"[Circular]";i.push(t)}return t}}))&&void 0!==t?t:"null"}const bt=Object.prototype,St=bt.hasOwnProperty,wt=bt.toString,kt=Array.isArray||function(e){return"[object Array]"===wt.call(e)},Ct=e=>"function"==typeof e,xt=e=>e===Object(e)&&!kt(e),Et=e=>{if(xt(e)){for(const t in e)if(St.call(e,t))return!1;return!0}return!1},It=e=>void 0===e,Tt=e=>"[object String]"==wt.call(e),Mt=e=>Tt(e)&&0===e.trim().length,Pt=e=>null===e,Rt=e=>It(e)||Pt(e),Ft=e=>"[object Number]"==wt.call(e)&&e==e,At=e=>Ft(e)&&e>0,Lt=e=>"[object Boolean]"===wt.call(e),Ot=e=>e instanceof FormData,Dt=e=>ft(gt,e),$t=e=>ft(_t,e);function Nt(e){return null===e||"object"!=typeof e}function Bt(e,t){return{}.toString.call(e)===`[object ${t}]`}function qt(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return zt(e,Error)}}function Ht(e){return"u">typeof Event&&zt(e,Event)}function zt(e,t){try{return e instanceof t}catch(e){return!1}}const Ut=[!0,"true",1,"1","yes"],Wt=e=>ft(Ut,e),jt=[!1,"false",0,"0","no"],Vt=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","lightpanda","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Gt=new Map,Qt=function(e,t=[]){if(!e)return!1;const i=function(e,t){let i="";for(let e=0;t.length>e;e++){const n=t[e];i+=n.length+":"+n}return e.length+":"+e+"|"+t.length+":"+i}(e,t),n=Gt.get(i);if(void 0!==n)return n;const s=e.toLowerCase(),r=Vt.concat(t).some(e=>-1!==s.indexOf(e.toLowerCase()));return 256>Gt.size||Gt.clear(),Gt.set(i,r),r};function Kt(e,t,i,n,s){return t>i&&(n.warn("min cannot be greater than max."),t=i),Ft(e)?e>i?(n.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(n.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(n.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Kt(null!=s?s:i,t,i,n))}var Jt=class{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=Kt(e.bucketSize,0,100,e._logger),this._refillRate=Kt(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=Kt(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){const i=Math.floor((t-e.lastAccess)/this._refillInterval);i>0&&(e.tokens=Math.min(e.tokens+i*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+i*this._refillInterval)}consumeRateLimit(e){var t;const i=Date.now(),n=String(e);let s=this._buckets[n];return s?this._applyRefill(s,i):(s={tokens:this._bucketSize,lastAccess:i},this._buckets[n]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null===(t=this._onBucketRateLimited)||void 0===t||t.call(this,e)),0===s.tokens)}stop(){this._buckets={}}};const Zt="Mobile",Yt="Android",Xt="Tablet",ei="Android Tablet",ti="iPad",ii="Apple Watch",ni="Safari",si="BlackBerry",ri="Samsung Internet",oi="Chrome",ai="Chrome iOS",li="Internet Explorer",ci="Internet Explorer Mobile",ui="Opera",di="Microsoft Edge",hi="Firefox",pi="Firefox iOS",gi="Nintendo",_i="PlayStation",fi="Xbox",vi="Android Mobile",mi="Mobile Safari",yi="Windows",bi="Windows Phone",Si="Nokia",wi="Ouya",ki="Generic "+Zt.toLowerCase(),Ci="Generic "+Xt.toLowerCase(),xi="Konqueror",Ei="Oculus Browser",Ii="Vivaldi",Ti="Yandex",Mi="Whale",Pi="DuckDuckGo",Ri="Pale Moon",Fi="Waterfox",Ai="Brave",Li="Claude",Oi="Codex",Di="ChatGPT",$i="Google Search App",Ni=new RegExp("Version/(\\d+(\\.\\d+)?)"),Bi=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),qi=new RegExp(fi,"i"),Hi=new RegExp("PlayStation \\w+","i"),zi=new RegExp("Nintendo \\w+","i"),Ui=new RegExp("BlackBerry|PlayBook|BB10","i"),Wi={"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"},ji=function(e,t,i,n){t=t||"";const s=function(e){return(null==e?void 0:e.brave)?Ai:null}(i);return s||((null==n?void 0:n.detectGoogleSearchApp)&&ft(e,"GSA/")?$i:ft(e," OPR/")&&ft(e,"Mini")?"Opera Mini":ft(e," OPR/")?ui:Ui.test(e)?si:ft(e,"IEMobile")||ft(e,"WPDesktop")?ci:ft(e,"OculusBrowser")?Ei:ft(e,"SamsungBrowser")?ri:ft(e,"Edge")||ft(e,"Edg/")?di:ft(e,"Vivaldi/")?Ii:ft(e,"YaBrowser/")?Ti:ft(e,"Whale/")?Mi:ft(e,"DuckDuckGo/")||ft(e,"Ddg/")?Pi:ft(e,"Claude/")?Li:ft(e,"Codex/")?Oi:ft(e,"ChatGPT/")?Di:ft(e,"FBIOS")?"Facebook Mobile":ft(e,"UCWEB")||ft(e,"UCBrowser")?"UC Browser":ft(e,"CriOS")?ai:ft(e,"CrMo")||ft(e,oi)?oi:ft(e,Yt)&&ft(e,ni)?vi:ft(e,"FxiOS")?pi:ft(e.toLowerCase(),xi.toLowerCase())?xi:ft(e,"Brave/")?Ai:((e,t)=>t&&ft(t,"Apple")||function(e){return ft(e,ni)&&!ft(e,oi)&&!ft(e,Yt)}(e))(e,t)?ft(e,Zt)?mi:ni:ft(e,"PaleMoon/")?Ri:ft(e,"Waterfox/")?Fi:ft(e,hi)?hi:ft(e,"MSIE")||ft(e,"Trident/")?li:ft(e,"Gecko")?hi:"")},Vi={[ci]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[di]:[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],[mi]:[Ni],[ui]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[hi]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[pi]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[xi]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[si]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Ni],[vi]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ri]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Ei]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ti]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Mi]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ai]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Li]:[Bi],[Oi]:[Bi],[Di]:[Bi],[Pi]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ri]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Fi]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[$i]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[li]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Gi=function(e,t,i,n){const s=ji(e,t,i,n),r=Vi[s];if(It(r))return null;for(let t=0;r.length>t;t++){const i=e.match(r[t]);if(i)return parseFloat(i[i.length-2])}return null},Qi=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[fi,e&&e[1]||""]],[new RegExp(gi,"i"),[gi,""]],[new RegExp(_i,"i"),[_i,""]],[Ui,[si,""]],[new RegExp(yi,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[bi,""];if(new RegExp(Zt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let e=Wi[i[1]]||"";return/arm/i.test(t)&&(e="RT"),[yi,e]}return[yi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=It(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Yt,[e[2],e[3],e[4]||"0"].join(".")]:[Yt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Ki=function(e){for(let t=0;Qi.length>t;t++){const[i,n]=Qi[t],s=i.exec(e),r=s&&(Ct(n)?n(s,e):n);if(r)return r}return["",""]},Ji=function(e){return zi.test(e)?gi:Hi.test(e)?_i:qi.test(e)?fi:new RegExp(wi,"i").test(e)?wi:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?bi:/iPad/.test(e)?ti:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ii:Ui.test(e)?si:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Si,"i").test(e)?Si:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Zt).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Yt:ei:new RegExp("(pda|Mobile)","i").test(e)?ki:new RegExp(Xt,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?Ci:""},Zi=function(e,t){var i;const n=Ji(e);return n===ti||n===ei||"Kobo"===n||"Kindle Fire"===n||n===Ci?Xt:n===gi||n===fi||n===_i||n===wi?"Console":n===ii?"Wearable":n?Zt:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!==(i=null==t?void 0:t.maxTouchPoints)&&void 0!==i?i:0)>0?600>Math.min(null!==(s=null==t?void 0:t.screenWidth)&&void 0!==s?s:0,null!==(r=null==t?void 0:t.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==t?void 0:t.devicePixelRatio)&&void 0!==o?o:1)?Zt:Xt:"Desktop";var 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"]],en="[Truncated]",tn="[Unserializable]";function nn(e){let t="";for(let i=0;e.length>i;i++){const n=e.charCodeAt(i);if(55296>n||n>56319)t+=56320>n||n>57343?e[i]:"�";else{const n=e.charCodeAt(i+1);56320>n||n>57343?t+="�":(t+=e[i]+e[i+1],i++)}}return t}function sn(e,t){if(!t)return e;let i=[];try{i=Object.keys(t)}catch(e){i=[]}for(const n of i){let i;try{i=t[n]}catch(e){i=tn}Object.defineProperty(e,n,{value:i,enumerable:!0,writable:!0,configurable:!0})}return e}Date,Date;const rn=3e5;var on=class{record(e){if("too-large"===e.kind)return;if("retry-later"!==e.kind)return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),i=Date.now(),n=Math.min(e.retryAfterMs,rn);if(!t)return this._installedAt=i,void(this._until=i+n);this._until=Math.max(this._until,Math.min(i+n,this._installedAt+rn))}remainingMs(){const e=Date.now();if(this._installedAt-5e3>e)return this.reset(),0;const t=Math.min(rn,Math.max(0,this._until-e));return 0===t&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this._until=0,this._installedAt=0}constructor(){this._until=0,this._installedAt=0}};const an=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ln(e,t){return"string"==typeof(i=e)&&an.test(i)?e:t();var i}function cn(e,t){const i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return i}function un(e){return e?e.split("#")[0]:e}function dn(e){try{return e()}catch(e){return}}function hn(e,t){const i=setTimeout(e,t);return null!=i&&i.unref&&(null==i||i.unref()),i}function pn(e,t,i){return gn.apply(this,arguments)}function gn(){return(gn=rt(function*(e,t,i){let n;try{return yield Promise.race([e,new Promise((e,s)=>{n=hn(()=>{try{null==i||i(),e()}catch(e){s(e)}},t)})])}finally{clearTimeout(n)}})).apply(this,arguments)}let _n,fn,vn,mn;function yn(e){var t;const i=globalThis._posthogChunkIds,n=globalThis._debugIds;if(!i&&!n)return;const s=i?Object.keys(i):[],r=n?Object.keys(n):[];if(mn&&bn(i,s,fn)&&bn(n,r,vn))return mn;fn=i?ct({},i):void 0,vn=n?ct({},n):void 0,mn={},null!==(t=_n)&&void 0!==t||(_n={});const o=(t,i)=>{for(const s of t){const t=i[s];if(!t)continue;const r=null==_n?void 0:_n[s];if(r){mn[r]=t;continue}const o=e(s);for(let e=o.length-1;e>=0;e--){var n;const i=null===(n=o[e])||void 0===n?void 0:n.filename;if(i){mn[i]=t,_n[s]=i;break}}}};return n&&o(r,n),i&&o(s,i),mn}function bn(e,t,i){return e&&i?t.length===Object.keys(i).length&&t.every(t=>e[t]===i[t]):e===i}var Sn=class{constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t={}){const i=t&&t.mechanism||{handled:!0,type:"generic"},n=this.buildCoercingContext(i,t,0).apply(e),s=this.buildParsingContext(t),r=this.parseStacktrace(n,s);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(e){var t=this;return rt(function*(){for(const i of e)i.stacktrace&&i.stacktrace.frames&&kt(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null===(t=e.syntheticException)||void 0===t?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i;let n,s;if(null!=e.cause&&(n=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack)try{s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch(e){}return ct(ct({},e),{},{cause:n,stack:s,errors:null===(i=e.errors)||void 0===i?void 0:i.map(e=>this.parseStacktrace(e,t))})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(const i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return rt(function*(){let i=e;for(const e of t.modifiers)i=yield e(i);return i})()}convertToExceptionList(e,t){const i=[],n=(e,s,r)=>{var o;const a=i.length,l=void 0===s?ct(ct({type:"string"==typeof t.type&&t.type.length>0?t.type:"generic"},"boolean"==typeof t.handled?{handled:t.handled}:void 0===t.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof t.synthetic?t.synthetic:e.synthetic,exception_id:a}):{type:"chained",source:r,synthetic:e.synthetic,exception_id:a,parent_id:s},c={type:e.type,value:e.value,mechanism:l};e.stack&&(c.stacktrace={type:"raw",frames:e.stack}),i.push(c),e.cause&&n(e.cause,a,"cause");for(const t of null!==(o=e.errors)&&void 0!==o?o:[])n(t,a,"member")};return n(e),i}buildParsingContext(e){var t;return{chunkIdMap:yn(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}getAggregateErrors(e){try{if(qt(e)){let i=Object.getPrototypeOf(e);for(let n=0;i&&100>n;n++){var t;const n=null===(t=Object.getOwnPropertyDescriptor(i,"constructor"))||void 0===t?void 0:t.value;if("function"==typeof n&&"AggregateError"===n.name){const t=e.errors;return kt(t)?t:void 0}i=Object.getPrototypeOf(i)}}}catch(e){}}buildCoercingContext(e,t,i=0){let n=0,s=0,r=!1;const o=new Set,a=[],l={},c=(e,t,i=0)=>{const c=u(t,i),d=c.apply;if(c.apply=t=>{a.push(e);try{return d(t)}finally{a.pop()}},i>4||i>0&&-1!==a.indexOf(e))return this.coerceFallback(c);const h="object"==typeof e&&null!==e||"function"==typeof e;if(0===i&&n>=50||h&&o.has(e))return;h&&o.add(e),0===i&&n++;const p=this.getAggregateErrors(e);let g,_;r||(r=!!p);try{if(g=this.applyCoercers(e,c),!g)throw l}catch(e){if(e===l)return void(0===i&&n--);if(!r)throw e;g=this.coerceFallback(c)}if(!p||n>=50)return g;try{_=p.length}catch(e){return g}if(!Number.isInteger(_)||0>_||_>4294967295)return g;const f=[];for(let e=0;50>n&&1e3>s&&_>e;e++){let i;s++;try{i=c.next(p[e])}catch(e){n++,i=this.coerceFallback(u(t+1))}i&&f.push(i)}return ct(ct({},g),{},{errors:f})},u=(i,n=0)=>ct(ct({},t),{},{syntheticException:0==i?t.syntheticException:void 0,mechanism:0==i?e:{},apply(e){const t=c(e,i,n+1);if(!t)throw l;return t},next:e=>c(e,i+1)}),d=u(i);return ct(ct({},d),{},{apply:e=>{var t;return null!==(t=c(e,i))&&void 0!==t?t:this.coerceFallback(d)}})}};const wn=/^([a-z][a-z0-9.+-]+):/i,kn=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function Cn(e){if(!e||"<anonymous>"===e)return!1;const t=wn.exec(e);return!t||kn.includes(t[1].toLowerCase())}function xn(e,t,i,n,s){const r={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:Cn(t)};return It(n)||(r.lineno=n),It(s)||(r.colno=s),r}const En=(e,t)=>{const i=-1!==e.indexOf("safari-extension"),n=-1!==e.indexOf("safari-web-extension");return i||n?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},In=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Tn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Mn=/\((\S*)(?::(\d+))(?::(\d+))\)/,Pn=(e,t)=>{const i=In.exec(e);if(i){const[,e,n,s]=i;return xn(t,e,"?",+n,+s)}const n=Tn.exec(e);if(n){if(n[2]&&0===n[2].indexOf("eval")){const e=Mn.exec(n[2]);e&&(n[2]=e[1],n[3]=e[2],n[4]=e[3])}const[e,i]=En(n[1]||"?",n[2]);return xn(t,i,e,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,Fn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,An=(e,t)=>{const i=Rn.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const e=Fn.exec(i[3]);e&&(i[1]=i[1]||"eval",i[3]=e[1],i[4]=e[2],i[5]="")}let e=i[3],n=i[1]||"?";return[n,e]=En(n,e),xn(t,e,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Ln=/\(error: (.*)\)/;function On(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function Dn(e){for(let t=1;10>=t;t++){const i=e.length-2*t;if(0>i)break;let n=!0;for(let s=0;t>s;s++)if(!On(e[i+s],e[i+t+s])){n=!1;break}if(n){for(let n=0;t>n;n++)e[i+n]=e[i+t+n];return e.length=i+t,{start:i,length:t}}}}function $n(e,t){const i=t.start+t.length,n=Bn(e,t);n&&e.splice(i+n===e.length?i:t.start,n)}function Nn(e,t){let i=t.start;for(;i>0&&On(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function Bn(e,t){const i=t.start+t.length;let n=i;for(;e.length>n&&On(e[n],e[n-t.length]);)n++;return n-i}function qn(e,t){const i=t[0];let n=e.length-(i?Nn(e,i):0);for(const i of t)n-=Bn(e,i);return n}function Hn(e,t,i){for(let n=0;e.length>n;n++){const s=e[(t+n)%e.length],r=e[(i+n)%e.length];if(s!==r)return r>s}return!1}var zn=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const i=Tt(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Bt(e,"DOMException")}isDOMError(e){return Bt(e,"DOMError")}},Un=class{match(e){return qt(e)}coerce(e,t){var i;const n=this.getStack(e),s=void 0===n?null===(i=t.syntheticException)||void 0===i?void 0:i.stack:void 0,r=!!s;return{type:this.getType(e),value:this.getMessage(e,t),stack:null!=n?n:s,cause:e.cause?t.next(e.cause):void 0,synthetic:r}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){try{const t=e.stacktrace;if("string"==typeof t&&t.length>0)return t;const i=e.stack;return"string"==typeof i&&i.length>0?i:void 0}catch(e){return}}},Wn=class{match(e){return!!Bt(e,"ErrorEvent")&&(null!=e.error||this._hasUsableMessage(e))}coerce(e,t){var i;if(null!=e.error)return t.apply(e.error);const n=t.apply(e.message);return ct(ct({},n),{},{stack:null!==(i=this._buildLocationStack(e))&&void 0!==i?i:n.stack,synthetic:!0})}_hasUsableMessage(e){return Tt(e.message)&&e.message.length>0}_buildLocationStack(e){var t,i;const n=e,s=null!==(t=n.lineno)&&void 0!==t?t:0,r=null!==(i=n.colno)&&void 0!==i?i:0;if(Tt(n.filename)&&0!==n.filename.length&&0!==s)return`Error\n at ${n.filename}:${s}:${r}`}};const jn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Vn=class{match(e){return"string"==typeof e}coerce(e,t){var i;const[n,s]=this.getInfos(e);return{type:null!=n?n:"Error",value:null!=s?s:e,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e;const n=e.match(jn);return n&&(t=n[1],i=n[2]),[t,i]}};const Gn=["fatal","error","warning","log","info","debug"];function Qn(e,t=40){const i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(let e=i.length;e>0;e--){const n=i.slice(0,e).join(", ");if(t>=n.length)return e===i.length?n:n.length>t?`${n.slice(0,t)}...`:n}return""}var Kn=class{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,n;const s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:null!==(i=this.getStack(e))&&void 0!==i?i:null===(n=t.syntheticException)||void 0===n?void 0:n.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Ht(e))return e.constructor.name;const t="name"in e?e.name:void 0;return Tt(t)&&!Mt(t)?t:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){let t=`'${e.name}' captured as exception`;return"message"in e&&"string"==typeof e.message&&(t+=` with message: '${e.message}'`),t}if("message"in e&&"string"==typeof e.message)return e.message;const t=this.getObjectClassName(e);return`${t&&"Object"!==t?`'${t}'`:"Object"} captured as exception with keys: ${Qn(e)}`}isSeverityLevel(e){return Tt(e)&&!Mt(e)&&Gn.indexOf(e)>=0}getStack(e){try{return Tt(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:Tt(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const i=e[t];if(qt(i))return i}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}},Jn=class{match(e){return Ht(e)}coerce(e,t){var i;const n=e.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${Qn(e)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Zn=class{match(e){return Nt(e)}coerce(e,t){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Yn=class{match(e){return Bt(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Ht(e))return!1;try{const t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i;const n=this.getUnhandledRejectionReason(e);return Nt(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}:t.apply(n)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}};const Xn="$message",es="$timestamp",ts=new Set([Xn,es]),is={enabled:!0,max_bytes:32768};function ns(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:is.enabled,max_bytes:rs(e.max_bytes,is.max_bytes)}:ct({},is)}var ss=class{constructor(e){this._entries=[],this._totalBytes=0,this._config=ns(e)}setConfig(e){this._config=ns(e),this._trimToMaxBytes()}add(e){const t=function(e){let t;try{t=yt(e)}catch(e){return}try{const e=JSON.parse(t);if(!xt(e))return;const i=e,n=i[Xn],s=i[es];if(!Tt(n)||0===n.trim().length)return;if(!Tt(s)&&!Ft(s))return;return{step:i,json:t}}catch(e){return}}(e);if(!t)return;const i=function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;const t=encodeURIComponent(e);let i=0;for(let e=0;t.length>e;e++)"%"===t[e]?(i+=1,e+=2):i+=1;return i}(t.json);i>this._config.max_bytes||(this._entries.push({step:t.step,bytes:i}),this._totalBytes+=i,this._trimToMaxBytes())}getAttachable(){return this._entries.map(e=>e.step)}clear(){this._entries=[],this._totalBytes=0}size(){return this._entries.length}_trimToMaxBytes(){for(;this._totalBytes>this._config.max_bytes&&this._entries.length>0;){const e=this._entries.shift();e&&(this._totalBytes-=e.bytes)}}};function rs(e,t){if(!Ft(e)||1/0===e||-1/0===e)return t;const i=Math.floor(e);return 0>i?t:i}const os=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function as(e){return"string"==typeof e||e}function ls(e){return"string"==typeof e?e:void 0}const cs=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],us="NativeGzipValidationError",ds=e=>e.length>=2&&31===e[0]&&139===e[1],hs=(e,t)=>e===dt.GZipJS||t===dt.GZipJS||"gzip"===t,ps=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),gs=e=>{if(!e||"object"!=typeof e)return!1;const t="name"in e?String(e.name):"";return ps(e)||t===us};let _s;const fs=e=>{throw cn(us,`Native gzip produced invalid output: ${e}`)},vs=function(){var e=rt(function*(e,t){18>e.size&&fs("too-short");const i=new Uint8Array(yield e.slice(0,10).arrayBuffer());ds(i)&&8===i[2]||fs("invalid-header");const n=new DataView(yield e.slice(e.size-8).arrayBuffer());n.getUint32(0,!0)!==(e=>{const t=(()=>{if(_s)return _s;_s=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)t=1&t?3988292384^t>>>1:t>>>1;_s[e]=t>>>0}return _s})();let i=4294967295;for(let n=0;e.length>n;n++)i=t[255&(i^e[n])]^i>>>8;return(4294967295^i)>>>0})(t)&&fs("invalid-crc");const s=t.length>>>0;n.getUint32(4,!0)!==s&&fs("invalid-size")});return function(t,i){return e.apply(this,arguments)}}();function ms(e){return ys.apply(this,arguments)}function ys(){return ys=rt(function*(e,t=!0,i){try{const t=(new TextEncoder).encode(e),i=new globalThis.CompressionStream("gzip"),s=i.writable.getWriter(),r=s.write(t).then(()=>s.close()).catch((n=rt(function*(e){try{yield s.abort(e)}catch(e){}throw e}),function(e){return n.apply(this,arguments)})),o=new Response(i.readable).blob(),[a]=yield Promise.all([o,r]);return yield vs(a,t),a}catch(e){if(null==i?void 0:i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}var n}),ys.apply(this,arguments)}function bs(e,t){if(null==e)return{};var i,n,s=function(e,t){if(null==e)return{};var i={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;i[n]=e[n]}return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;r.length>n;n++)t.includes(i=r[n])||{}.propertyIsEnumerable.call(e,i)&&(s[i]=e[i])}return s}const Ss="[redacted]",ws=/^[A-Za-z0-9+/\n\r]+=*$/,ks=/^[A-Za-z0-9_-]+={0,2}$/,Cs=/[-_]/,xs=/^data:[^,\s]*;base64,/i,Es=/^[A-Za-z0-9+/_-]+={0,2}$/,Is=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,Ts=/^(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,Ps=/[\s<>"]/,Rs=new RegExp(Ms.source,"i"),Fs=/[a-z][a-z0-9+.-]{0,63}:\/\//i,As=new RegExp(`^${Fs.source}`,"i"),Ls=new RegExp(Fs.source,"gi"),Os=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,Ds=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,$s=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,Ns=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,Bs=/\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,qs=/(^|[^\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,Hs=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,zs=/\b\d(?:[ ./-]?\d){12,}\b/g,Us=/\d+/g,Ws=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,js=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function Vs(e){return function(e){return Ts.test(e)}(e)||Os.test(e)||Ds.test(e)}function Gs(e){return e.split("&",129).length>128}function Qs(e,t,i){return Vs(e)||t.includes(";")&&function(e){return e.split(";").some(e=>Vs(e.split("=",1)[0]))}(t)?Ss:Rs.test(t)?i?er(t,{allowNestedUrls:!1,stripPunctuation:!0}):Ss:t}function Ks(e,t){const i=new URLSearchParams;let n=!1,s=!1;for(const[r,o]of new URLSearchParams(e)){const e=tr(r),a=tr(o);n||(n=e!==r||a!==o);const l=Qs(e,a,t);n||(n=l!==a),s=Vs(e)||l!==a,i.append(e,l)}return{changed:n,lastFieldSensitive:s,serialized:i.toString()}}function Js(e,t){if(!e.includes("="))return{value:Zs(e,t),lastFieldSensitive:!1};const i=Ks(e,t);return{value:i.changed?i.serialized:e,lastFieldSensitive:i.lastFieldSensitive}}function Zs(e,t){return t?er(e,{allowNestedUrls:!1,stripPunctuation:!0}):Rs.test(e)?Ss:e}function Ys(e,t,i){return"#"===e?!t.fragment&&(t.fragment=!0):"?"===e&&(t.fragment?"="!==i&&!t.fragmentQuery&&(t.fragmentQuery=!0):!t.query&&(t.query=!0))}function Xs(e,t){var i;if(e.length>8192&&As.test(e))return Ss;const{address:n,suffix:s}=t.stripPunctuation?function(e){let t=e.length;for(;t>0&&".,;:!?)]}'".includes(e[t-1]);)t--;return{address:e.slice(0,t),suffix:e.slice(t)}}(e):{address:e,suffix:""};let r;try{r=new URL(n)}catch(e){return Ss+s}const o=r.search.slice(1),a=""!==r.hash,l=function(e){const t=e.slice(1),i=t.indexOf("?");return 0>i?{head:t,tail:null}:{head:t.slice(0,i),tail:t.slice(i+1)}}(r.hash);if(Gs(o)||Gs(l.head)||Gs(null!==(i=l.tail)&&void 0!==i?i:""))return Ss+s;let c=!1;(r.username||r.password)&&(r.username=Ss,r.password="",c=!0);const u=Ks(o,t.allowNestedUrls);u.changed&&(r.search=u.serialized,c=!0);const d=Js(l.head,t.allowNestedUrls),h=null===l.tail?null:(p=l.tail,d.lastFieldSensitive?{value:""===p?"":Ss,lastFieldSensitive:!0}:Js(p,t.allowNestedUrls));var p;const g=null===h?d.value:`${d.value}?${h.value}`;g!==r.hash.slice(1)&&(r.hash=g,c=!0);const _=a?null!=h?h:d:u;return(c?tr(r.toString()):n)+(_.lastFieldSensitive?"":s)}function er(e,t){return e.replace(Ms,i=>function(e,t){const i=function(e){if(!e.includes("://"))return[];const t=[...e.matchAll(Ls)].map(e=>e.index),i=[],n={query:!1,fragment:!1,fragmentQuery:!1};let s=0,r=!1,o="";for(let a=0;e.length>a&&t.length>s;a++){t[s]===a&&(a>0&&"="!==o&&i.push(a),s++);const l=e[a];Ys(l,n,o)?(o=l,r=!0):r&&"=&".includes(l)&&(o=l)}return i}(e);if(0===i.length)return Xs(e,t);let n="",s=0;for(const r of i)n+=Xs(e.slice(s,r),ct(ct({},t),{},{stripPunctuation:!1})),s=r;return n+Xs(e.slice(s),t)}(i,ct(ct({},t),{},{stripPunctuation:t.stripPunctuation&&i.length!==e.length})))}function tr(e){return e.replace(Is,Ss)}function ir(e,t){return function(e){return e.length>=10240&&(ws.test(e)||function(e){const t=xs.exec(e);if(!t)return!1;let i;try{i=decodeURIComponent(e.slice(t[0].length))}catch(e){return!1}return Es.test(i.replace(/[\r\n]/g,""))}(e)||Cs.test(e)&&ks.test(e))}(e)?"[binary data redacted - not supported by PostHog MCP analytics]":function(e,t,i){const n=4*i.maxStringLength;if(e.length>n){const s=t(e.slice(0,function(e,t){let i=t;for(;i>0&&!Ps.test(e[i-1]);)i--;return i}(e,n)));if(s.length>=2*i.maxStringLength)return s+i.truncationSuffix}return t(e)}(e,e=>function(e){return er(e,{allowNestedUrls:!0,stripPunctuation:!0})}(function(e){let t=e.replace($s," ");return t=t.replace(Ns,Ss),t=t.replace(Bs,Ss),t=t.replace(qs,`$1${Ss}`),t=t.replace(zs,sr),t=t.replace(Hs,Ss),t=t.replace(Ws,`$1${Ss}`),t=t.replace(js,`$1${Ss}`),t}(tr(e))),t)}function nr(e){let t=0,i=!1;for(let n=e.length-1;n>=0;n--){let s=e.charCodeAt(n)-48;if(0>s||s>9)return!1;i&&(s*=2,s>9&&(s-=9)),t+=s,i=!i}return t%10==0}function sr(e){const t=[];for(let i=Us.exec(e);null!==i;i=Us.exec(e))t.push({digits:i[0],start:i.index,end:i.index+i[0].length});let i="",n=0,s=0;for(;t.length>s;){let r="",o=-1;for(let e=s;t.length>e&&(r+=t[e].digits,19>=r.length);e++)r.length>=13&&nr(r)&&(o=e);0>o?s++:(i+=e.slice(n,t[s].start)+Ss,n=t[o].end,s=o+1)}return i+e.slice(n)}const rr={}.propertyIsEnumerable;function or(e,t){try{return cr(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(e){return[]}}function ar(e,t,i,n){if(0>=i.remainingNodes)return{stringValue:en};if(i.remainingNodes--,Lt(e))return{boolValue:e};if("bigint"==typeof e)return function(e,t){const i=e.toString(),n=BigInt("9223372036854775808");return e>=n||-n>e?(null==t||t.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}(e,t);if("number"==typeof e){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};const i=BigInt(e).toString();return e>=0x8000000000000000||-0x8000000000000000>e?(null==t||t.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:e}}if("string"==typeof e)return{stringValue:nn(e)};if("function"==typeof e)return{stringValue:"[Function]"};if("symbol"==typeof e)return{stringValue:String(e)};if("object"==typeof e&&null!==e){if(i.ancestors.has(e))return{stringValue:"[Circular]"};if(n>=20)return{stringValue:en};if(e instanceof Date){const t=e.getTime(),i=Number.isFinite(t)?e.toISOString():String(e);return{stringValue:"string"==typeof i?nn(i):String(i)}}i.ancestors.add(e);try{try{const s=e.toJSON;if("function"==typeof s)return ar(s.call(e),t,i,n+1)}catch(e){}return kt(e)?{arrayValue:{values:lr(e,t,i,n+1)}}:{kvlistValue:{values:cr(e,t,i,n+1)}}}finally{i.ancestors.delete(e)}}return{stringValue:nn(String(e))}}function lr(e,t,i,n){const s=[],r=Math.min(e.length,1e3);let o=0;for(;r>o&&i.remainingNodes>0;o++)try{const r=o in e?e[o]:void 0;if(Rt(r))continue;s.push(ar(r,t,i,n))}catch(e){s.push({stringValue:tn})}return e.length>o&&s.push({stringValue:en}),s}function cr(e,t,i,n){const s=[];for(const r in e)if(rr.call(e,r)){if(!r){null==t||t.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=i.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=e[r];if(Pt(o)||It(o))continue;s.push({key:nn(r),value:ar(o,t,i,n)})}catch(e){s.push({key:nn(r),value:{stringValue:tn}})}}return s}function ur(e,t,i){return ct(ct(ct(ct({},sn({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}const dr=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function hr(e,t){const i=sn({},e),n={};for(const e of dr)({}).hasOwnProperty.call(i,e)&&(n[e]=i[e],delete i[e]);return[...or(i,t),...or(n,t)]}const pr={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 gr={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}},_r=gr.info;function fr(e){try{return nn(String(e))}catch(e){return tn}}function vr(e,t,i,n){const s=e.level||"info",{text:r,number:o}=gr[s]||_r,a=function(e=Date.now()){return String(e)+"000000"}(Ft(n)?n:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),Rt(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),Rt(t.lastActivityTimestamp)||(l.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(l["url.full"]=t.currentUrl),t.screenName&&(l["screen.name"]=t.screenName),t.appState&&(l["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(l.feature_flags=t.activeFeatureFlags);const c=ct({},l),u=e.attributes;if(u){let e=[];try{e=Object.keys(u)}catch(t){e=[]}for(const t of e){let e;try{e=u[t]}catch(t){e=tn}Object.defineProperty(c,t,{value:e,enumerable:!0,writable:!0,configurable:!0})}}const d={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:r,body:{stringValue:fr(e.body)},attributes:or(c,i)};return e.trace_id&&(d.traceId=e.trace_id),e.span_id&&(d.spanId=e.span_id),It(e.trace_flags)||(d.flags=e.trace_flags),d}function mr(e,t,i){return ur(e,t,i)}function yr(e,t,i,n){return{resourceLogs:[{resource:{attributes:hr(t)},scopeLogs:[{scope:{name:i,version:n},logRecords:e}]}]}}var br=class{constructor(e){this._onFire=e,this._firesAt=0}get pending(){return!!this._timer}arm(e){this.clear(),this._firesAt=Date.now()+e,this._timer=hn(()=>{this._timer=void 0,this._onFire()},e)}armNoEarlierThan(e){this._timer&&Date.now()+e<=this._firesAt||this.arm(e)}clear(){this._timer&&(clearTimeout(this._timer),this._timer=void 0)}};function Sr(){return.75+.5*Math.random()}function wr(e,t,i,n){const s=Math.min(Math.max(0,t-1),6),r=e*Math.pow(2,s);return Math.round((void 0===n?r:Math.min(r,Math.max(n,e)))*i)}var kr=class{constructor(e,t,i,n,s,r=()=>Promise.resolve(),o){var a;this._instance=e,this._config=t,this._logger=i,this._getContext=n,this._onReady=s,this._waitForStoragePersist=r,this._scopeName=o,this._flushTimer=new br(()=>this._flushInBackground()),this._flushPromise=null,this._evictedSinceAdvance=0,this._queueGeneration=0,this._retryAfter=new on,this._consecutiveFlushFailures=0,this._flushJitter=1,this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._maxBufferSize=t.maxBufferSize,this._maxQueueSize=Math.max(null!==(a=t.maxQueueSize)&&void 0!==a?a:t.maxBufferSize,t.maxBufferSize),this._flushIntervalMs=t.flushIntervalMs,this._maxBatchRecordsPerPost=t.maxBatchRecordsPerPost,this._rateCapWindowMs=t.rateCapWindowMs,this._maxLogsPerInterval=t.maxLogsPerInterval}clearQueue(){this._queueGeneration++,this._instance.setPersistedProperty(ut.LogsQueue,[])}reset(){this._flushTimer.clear(),this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._consecutiveFlushFailures=0,this._flushJitter=1,this._retryAfter.reset(),this._maxBatchRecordsPerPost=this._config.maxBatchRecordsPerPost}onReconnect(){this._consecutiveFlushFailures=0,this._flushJitter=1,this._retryAfter.isOpen()?this._hasQueuedRecords()&&this._armFlushTimer():this._flushInBackground()}captureLog(e,t){var i;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==e?void 0:e.body))return;const n=this._runBeforeSend(e);if(null===n)return;if(!n.body)return void this._logger.info("Log was rejected in beforeSend function");if(!this._checkRateLimit())return;const s={record:vr(n,null!==(i=null==t?void 0:t.context)&&void 0!==i?i:this._getContext(),this._logger,null==t?void 0:t.occurredAtMs)};this._onReady(()=>this._enqueue(s))}_runBeforeSend(e){const t=this._config.beforeSend;if(!t)return e;const i=kt(t)?t:[t];let n=e;for(const e of i)try{const t=e(n);if(!t)return this._logger.info("Log was rejected in beforeSend function"),null;n=t}catch(e){return this._logger.error("Error in beforeSend function for log:",e),null}return n}_checkRateLimit(){if(void 0===this._maxLogsPerInterval)return!0;const e=Date.now(),t=e-this._intervalWindowStart;return this._rateCapWindowMs>t&&t>=0||(this._intervalWindowStart=e,this._intervalLogCount=0,this._droppedWarned=!1),this._maxLogsPerInterval>this._intervalLogCount?(this._intervalLogCount++,!0):(this._droppedWarned||(this._logger.warn(`captureLog dropping logs: exceeded ${this._maxLogsPerInterval} logs per ${this._rateCapWindowMs}ms`),this._droppedWarned=!0),!1)}flush(){var e=this;return rt(function*(){if(!e._instance.isDisabled)return e._flushPromise||(e._flushPromise=e._flushInner().finally(()=>{e._flushPromise=null})),e._flushPromise})()}_flushInner(){var e=this;return rt(function*(){var t;e._flushTimer.clear();let i=null!==(t=e._instance.getPersistedProperty(ut.LogsQueue))&&void 0!==t?t:[];if(0===i.length)return;const n=i.length;let s=0;for(;i.length>0&&n>s;){var r,o;const t=e._queueGeneration;e._evictedSinceAdvance=0;const n=Math.min(i.length,e._maxBatchRecordsPerPost),a=i.slice(0,n),l=yr(a.map(e=>e.record),e._buildResourceAttributes(),null!==(r=e._scopeName)&&void 0!==r?r:e._instance.getLibraryId(),e._instance.getLibraryVersion()),c=yield e._instance._sendLogsBatch(l);if(e._queueGeneration!==t)return;if("too-large"===c.kind&&a.length>1)e._maxBatchRecordsPerPost=Math.max(1,Math.floor(a.length/2)),e._logger.warn(`Logs batch of size ${a.length} was too large for the ingestion endpoint, reducing batch size to ${e._maxBatchRecordsPerPost}`);else{if(e._retryAfter.record(c),e._flushTimer.pending&&e._flushTimer.arm(Math.max(e._flushIntervalMs,e._retryAfter.remainingMs())),"retry-later"===c.kind)throw c.error;if("too-large"===c.kind?e._logger.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===c.kind&&e._config.maxBatchRecordsPerPost>e._maxBatchRecordsPerPost&&(e._maxBatchRecordsPerPost=Math.min(e._config.maxBatchRecordsPerPost,e._maxBatchRecordsPerPost+1)),yield e._persistQueueAdvance(a.length),i=null!==(o=e._instance.getPersistedProperty(ut.LogsQueue))&&void 0!==o?o:[],s+=a.length,"fatal"===c.kind)throw c.error}}})()}_persistQueueAdvance(e){var t=this;return rt(function*(){var i;const n=Math.max(0,e-t._evictedSinceAdvance),s=null!==(i=t._instance.getPersistedProperty(ut.LogsQueue))&&void 0!==i?i:[];t._instance.setPersistedProperty(ut.LogsQueue,s.slice(n)),yield t._waitForStoragePersist()})()}_buildResourceAttributes(){return mr(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion())}_enqueue(e){var t;if(this._instance.optedOut)return;const i=null!==(t=this._instance.getPersistedProperty(ut.LogsQueue))&&void 0!==t?t:[];this._maxQueueSize>i.length||(i.shift(),this._evictedSinceAdvance++,this._logger.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(ut.LogsQueue,i),this._maxBufferSize>i.length||this._retryAfter.isOpen()?this._armFlushTimer():this._flushInBackground()}_armFlushTimer(){this._flushTimer.pending||this._flushTimer.arm(Math.max(this._flushIntervalMs,this._retryAfter.remainingMs()))}_nextFlushDelay(){return Math.max(wr(this._flushIntervalMs,this._consecutiveFlushFailures,this._flushJitter,3e4),this._retryAfter.remainingMs())}_hasQueuedRecords(){const e=this._instance.getPersistedProperty(ut.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return rt(function*(){t._flushTimer.clear();const i=t.flush().catch(()=>{});void 0!==e?yield pn(i,e):yield i})()}flushWithTimeout(e){var t=this;return rt(function*(){const i=t.flush();yield pn(i,e,()=>{i.catch(()=>{})})})()}_flushInBackground(){this.flush().then(()=>{this._consecutiveFlushFailures=0,this._flushJitter=1},e=>{this._consecutiveFlushFailures++,this._flushJitter=Sr(),this._logger.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this._hasQueuedRecords()&&this._flushTimer.armNoEarlierThan(this._nextFlushDelay())})}};const Cr=/^[0-9a-f]+$/;function xr(e,t,i){return"string"==typeof e&&e.length===t&&e!==i&&Cr.test(e)}const Er=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;const Ir="00",Tr=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Mr(e){return String(e)+"000000"}function Pr(e,t,i,n){let s="";return n&&(s=Object.keys(n).sort().map(e=>`${JSON.stringify(e)}:${JSON.stringify(n[e])}`).join(",")),`${e}\0${t}\0${null!=i?i:""}\0${s}`}var Rr=class{constructor(e,t,i){this._instance=e,this._config=t,this._logger=i,this._series=new Map,this._flushTimer=new br(()=>this.flush().catch(e=>{this._logger.error("Metrics flush failed:",e)})),this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._retryAfter=new on,this._consecutiveFlushFailures=0,this._flushJitter=1,this._generation=0}count(e,t=1,i){this._capture({name:e,type:"count",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(e,t,i){this._capture({name:e,type:"gauge",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(e,t,i){this._capture({name:e,type:"histogram",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var e=this;const t=this._flushPromise,i=function(){var i=rt(function*(){t&&(yield t.catch(()=>{})),yield e._doFlush()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this._flushPromise===i&&(this._flushPromise=null)});return this._flushPromise=i,i}drainWindow(){if(0===this._series.size)return null;const e=this._series;return this._series=new Map,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._buildPayload(e)}reset(){this._generation++,this._retryAfter.reset(),this._consecutiveFlushFailures=0,this._flushJitter=1,this._flushTimer.clear(),this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set}_capture(e){if(this._instance.isDisabled||this._instance.optedOut)return;const t=this._runBeforeSend(e);if(null===t)return;if(!t.name||"string"!=typeof t.name)return void this._logger.warn("Dropping metric with empty name");if("number"!=typeof t.value||!Number.isFinite(t.value))return void this._logger.warn(`Dropping metric '${t.name}': value must be a finite number`);if("count"===t.type&&0>t.value)return void this._logger.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let i,n;try{i=t.attributes?ct({},t.attributes):void 0,n=Pr(t.type,t.name,t.unit,i)}catch(e){return void this._logger.warn(`Dropping metric '${t.name}': attributes could not be serialized`,e)}let s=this._series.get(n);if(!s){if(!this._admitNewSeries())return;s={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this._series.set(n,s)}const r=this._typeByName.get(t.name);void 0===r?this._typeByName.set(t.name,t.type):r===t.type||this._typeCollisionWarned.has(t.name)||(this._typeCollisionWarned.add(t.name),this._logger.warn(`Metric name '${t.name}' is already used as a ${r}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this._fold(s,t.value);const o=this._activeTraceContext();o&&(s.exemplar=ct(ct({},o),{},{value:t.value,timeMs:Date.now()})),this._armFlushTimer()}_activeTraceContext(){try{var e,t;const i=function(e){const t=function(e){if("string"!=typeof e)return;const t=Er.exec(e.trim());if(!t)return;const[,i,n,s,r,o]=t;return"ff"===i||"00"===i&&o||!function(e){return xr(e,32,"00000000000000000000000000000000")}(n)||!function(e){return xr(e,16,"0000000000000000")}(s)?void 0:{version:i,traceId:n,spanId:s,flags:r}}(e);return t&&{traceId:t.traceId,spanId:t.spanId,flags:(i=t.flags,1&parseInt(i,16)?"01":Ir)};var i}(null===(e=(t=this._instance).getActiveSpan)||void 0===e||null===(e=e.call(t))||void 0===e?void 0:e.traceparent());if(i&&"01"===i.flags)return{traceId:i.traceId,spanId:i.spanId}}catch(e){}}_admitNewSeries(){return this._config.maxSeriesPerFlush>this._series.size||(this._seriesCapWarned||(this._seriesCapWarned=!0,this._logger.warn(`Metric series cap reached (${this._config.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}_fold(e,t){switch(e.type){case"count":var i;e.total=(null!==(i=e.total)&&void 0!==i?i:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Tr.length+1).fill(0)});const i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[function(e,t){for(let i=0;t.length>i;i++)if(t[i]>=e)return i;return t.length}(t,Tr)]+=1;break}}}_runBeforeSend(e){const t=this._config.beforeSend;if(!t)return e;const i=kt(t)?t:[t];let n=e;for(const e of i)try{const t=e(n);if(!t)return this._logger.info("Metric was rejected in beforeSend function"),null;n=t}catch(e){return this._logger.error("Error in beforeSend function for metric:",e),null}return n}_armFlushTimer(){this._flushTimer.pending||this._flushTimer.arm(this._nextFlushDelay())}_nextFlushDelay(){return Math.max(wr(this._config.flushIntervalMs,this._consecutiveFlushFailures,this._flushJitter,3e4),this._retryAfter.remainingMs())}_doFlush(){var e=this;return rt(function*(){if(e._flushTimer.clear(),0===e._series.size)return;const t=e._series;e._series=new Map,e._seriesCapWarned=!1,e._typeByName=new Map,e._typeCollisionWarned=new Set;const i=e._generation,n=yield e._instance._sendMetricsBatch(e._buildPayload(t));if(i===e._generation)switch(e._retryAfter.record(n),"retry-later"===n.kind?(e._consecutiveFlushFailures++,e._flushJitter=Sr()):(e._consecutiveFlushFailures=0,e._flushJitter=1),e._flushTimer.pending&&e._flushTimer.arm(e._nextFlushDelay()),n.kind){case"ok":return;case"retry-later":return e._mergeWindowBack(t),void e._flushTimer.armNoEarlierThan(e._nextFlushDelay());case"too-large":return void e._logger.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e._logger.error("Failed to send metrics batch:",n.error)}})()}_buildPayload(e){return t=this._buildMetrics(e),i=function(e,t,i){return ur(e,t,i)}(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:hr(i)},scopeMetrics:[{scope:{name:n,version:s},metrics:t}]}]};var t,i,n,s}_buildMetrics(e){const t=Mr(Date.now()),i=new Map;for(const o of e.values()){var n;const e=Pr(o.type,o.name,o.unit,void 0);let a=i.get(e);a||(a=ct({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},i.set(e,a));const l=or(null!==(n=o.attributes)&&void 0!==n?n:{},this._logger),c=Mr(o.windowStartMs),u=Fr(o.exemplar);if("count"===o.type){var s;const e=ct({attributes:l,startTimeUnixNano:c,timeUnixNano:t,asDouble:null!==(s=o.total)&&void 0!==s?s:0},u);a.sum.dataPoints.push(e)}else if("gauge"===o.type){var r;const e=ct({attributes:l,timeUnixNano:t,asDouble:null!==(r=o.last)&&void 0!==r?r:0},u);a.gauge.dataPoints.push(e)}else if(o.hist){const e=ct({attributes:l,startTimeUnixNano:c,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Tr},u);a.histogram.dataPoints.push(e)}}return Array.from(i.values())}_mergeWindowBack(e){for(const[s,r]of e){var t;const e=this._series.get(s);if(e)switch(e.windowStartMs=Math.min(e.windowStartMs,r.windowStartMs),e.exemplar=null!==(t=e.exemplar)&&void 0!==t?t:r.exemplar,e.type){case"count":var i,n;e.total=(null!==(i=e.total)&&void 0!==i?i:0)+(null!==(n=r.total)&&void 0!==n?n:0);break;case"gauge":break;case"histogram":if(r.hist)if(e.hist){e.hist.count+=r.hist.count,e.hist.sum+=r.hist.sum,e.hist.min=Math.min(e.hist.min,r.hist.min),e.hist.max=Math.max(e.hist.max,r.hist.max);for(let t=0;e.hist.bucketCounts.length>t;t++)e.hist.bucketCounts[t]+=r.hist.bucketCounts[t]}else e.hist=r.hist}else this._admitNewSeries()&&this._series.set(s,r)}}};function Fr(e){return e?{exemplars:[{filteredAttributes:[],timeUnixNano:Mr(e.timeMs),asDouble:e.value,traceId:e.traceId,spanId:e.spanId}]}:{}}function Ar(e,t){if(!e)return;const i=e.find(e=>e.type===t);return null==i?void 0:i.value}const Lr="0.10.4",Or={DEBUG:!1,LIB_VERSION:Lr,LIB_NAME:"browser-common",JS_SDK_VERSION:Lr},Dr=(e,{debugEnabled:t}={})=>{const i={_log(i,...n){let s;try{s=typeof window>"u"?void 0:window}catch(e){return}s&&(Or.DEBUG||s.POSTHOG_DEBUG||t)&&!It(s.console)&&s.console&&("__rrweb_original__"in s.console[i]?s.console[i].__rrweb_original__:s.console[i])(e,...n)},debug(...e){i._log("debug",...e)},info(...e){i._log("log",...e)},warn(...e){i._log("warn",...e)},error(...e){i._log("error",...e)},critical(...t){console.error(e,...t)},uninitializedWarning(e){i.error(`You must initialize PostHog before calling ${e}`)},createLogger:(t,i)=>Dr(`${e} ${t}`,i)};return i},$r=Dr("[PostHog.js]"),Nr=$r.createLogger;function Br(e,t){kt(e)&&e.forEach(t)}function qr(e,t){if(!Rt(e))if(kt(e))e.forEach(t);else if(Ot(e))e.forEach((e,i)=>t(e,i));else for(const i in e)St.call(e,i)&&t(e[i],i)}const Hr=function(e,...t){for(const i of t)for(const t in i)void 0!==i[t]&&(e[t]=i[t]);return e};function zr(e){const t=Object.keys(e);let i=t.length;const n=new Array(i);for(;i--;)n[i]=[t[i],e[t[i]]];return n}const Ur=function(e){return function(...t){try{return e.apply(this,t)}catch(e){$r.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),$r.critical(e)}}},Wr=function(e){const t={};return qr(e,function(e,i){(Tt(e)&&e.length>0||Ft(e))&&(t[i]=e)}),t};function jr(e){const t=ct({},e);for(const i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch(e){}return t}const Vr=["herokuapp.com","vercel.app","netlify.app"];function Gr(e){const t=null==e?void 0:e.hostname;if(!Tt(t))return!1;const i=t.split(".").slice(-2).join(".");for(const e of Vr)if(i===e)return!1;return!0}function Qr(e,t,i,n){const{capture:s=!1,passive:r=!0}=null!=n?n:{};null==e||e.addEventListener(t,i,{capture:s,passive:r})}function Kr(e){return"ph_toolbar_internal"===e.name}const Jr=e=>{const t=typeof document>"u"?void 0:document,i=null==t?void 0:t.createElement("a");return It(i)?null:(i.href=e,i)},Zr=()=>{try{return"u">typeof window&&!1!==window.navigator.onLine}catch(e){return!1}},Yr=(e,t)=>e>=t&&Zr(),Xr=(e,t,i,n)=>{if(0===e){if(Zr()){const e=t+1;return e===i&&n(),e}return t}return 0},eo=["localhost","127.0.0.1"],to=(e,t)=>{try{let i;return JSON.stringify(e,(e,t)=>{var n;return qt(t)?(null!==(n=i)&&void 0!==n||(i=new WeakMap),i.has(t)||i.set(t,jr(t)),i.get(t)):"bigint"==typeof t?t.toString():t},t)}catch(t){return yt(e)}},io=function(e,t="&"){let i,n;const s=[];return qr(e,function(e,t){It(e)||It(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),n=encodeURIComponent(t),s[s.length]=n+"="+i)}),s.join(t)},no=function(e,t){const i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let n;for(let e=0;i.length>e;e++){const s=i[e].split(/=(.*)/);if(s[0]===t){n=s;break}}if(!kt(n)||2>n.length)return"";{let e=n[1].replace(/\+/g," ");try{e=decodeURIComponent(e)}catch(t){$r.error("Skipping decoding for malformed query param: "+e)}return e}},so=function(e,t,i){if(!e||!t||!t.length)return e;const n=e.split(/#(.*)/),s=n[1],r=(n[0]||"").split(/\?(.*)/),o=r[1],a=r[0],l=(o||"").split("&"),c=[];for(let e=0;l.length>e;e++){const n=l[e].split("?");let s=0;for(;n.length>s&&!t.includes(n[s].split("=")[0]);)s++;c.push(n.length>s?n.slice(0,s).concat(n[s].split("=")[0]+"="+i).join("?"):l[e])}let u=a;return null!=o&&(u+="?"+c.join("&")),null!=s&&(u+="#"+s),u},ro=function(e,t){const i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null};function oo(e,t){var i;const n=null==e||null===(i=e.config)||void 0===i?void 0:i.get_current_url;if(!Ct(n))return t;try{const e=n(t);return Tt(e)&&e?e:t}catch(e){return $r.error("Error in get_current_url, falling back to window.location.href",e),t}}function ao(e){var t;const i=typeof window>"u"?void 0:window,n=null==i||null===(t=i.location)||void 0===t?void 0:t.href;return It(n)?void 0:oo(e,n)}function lo(e){var t;return e instanceof Element&&("__POSTHOG_TOOLBAR__"===e.id||!!(null===(t=e.closest)||void 0===t?void 0:t.call(e,".toolbar-global-fade-container")))}function co(e){return!!e&&1===e.nodeType}function uo(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function ho(e){return!!e&&3===e.nodeType}function po(e){return!!e&&11===e.nodeType&&co(e.host)}function go(e){return e?vt(e).split(/\s+/):[]}function _o(e,t){const i=ao(t);return!!(i&&e&&e.some(e=>i.match(e)))}function fo(e){let t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return go(t)}function vo(e){return Rt(e)?null:vt(e).split(/(\s+)/).filter(e=>Ko(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function mo(e){let t="";return qo(e)&&!Ho(e)&&e.childNodes&&e.childNodes.length&&qr(e.childNodes,function(e){var i;ho(e)&&e.textContent&&(t+=null!==(i=vo(e.textContent))&&void 0!==i?i:"")}),vt(t)}function yo(e){var t;return It(e.target)?e.srcElement||null:(null===(t=e.target)||void 0===t?void 0:t.shadowRoot)?e.composedPath()[0]||null:e.target||null}const bo=["a","button","form","input","select","textarea","label"];function So(e,t){const i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch(e){return!1}}function wo(e,t){if(It(t))return!0;for(const i of e)if(t.some(e=>So(i,e)))return!0;return!1}function ko(e){const t=e.parentNode;return!(!t||!co(t))&&t}const Co=[".ph-no-autocapture","[data-ph-no-autocapture]"],xo=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],Eo=[...xo,"+","-","−","–"],Io=Eo.length+10,To=["button","a","input","select","textarea","label"],Mo=["button","link","tab","menuitem","option"],Po=(e,t)=>/[a-z0-9]/i.test(t)?ft(Eo,t)?new RegExp(`\\b${t}\\b`).test(e):e.includes(t):e===t,Ro=e=>ft(To,e.tagName.toLowerCase())||ft(Mo,(e.getAttribute("role")||"").toLowerCase());function Fo(e){let t="",i="";const n=e=>{co(e)&&qo(e)&&!Ho(e)&&(t+=` ${mo(e)}`,i=i||e.getAttribute("aria-label")||"",qr(e.childNodes,n))};n(e),t=vt(t.replace(/\s+/g," "));const s=(Ko(t)?t:"").toLowerCase(),r=e.getAttribute("aria-label")||(s?"":i);return{safeText:s,ariaLabel:vt(r).toLowerCase()}}const Ao=[".ph-no-deadclick",".ph-no-capture"],Lo=[".ph-no-rageclick",".ph-no-capture"],Oo=["","text","search","email","password","url","tel","number"];function Do(e){return!(!e||!co(e))&&(!!uo(e,"textarea")||(uo(e,"input")?ft(Oo,(e.getAttribute("type")||"").toLowerCase()):function(e){var t;if(e.isContentEditable)return!0;const i=null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return"true"===i||""===i}(e)))}function $o(e,t){if(!(typeof window>"u"?void 0:window)||No(e))return!1;let i,n,s;var r,o;if(Lt(t)?(i=!!t&&Lo,n=void 0,s=!1):(i=null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:Lo,n=null==t?void 0:t.content_ignorelist,s=null!==(o=null==t?void 0:t.ignore_text_selection)&&void 0!==o&&o),!1===i)return!1;if(s&&Do(e))return!1;const{targetElementList:a}=Bo(e,!1);return!(n&&function(e,{safeText:t,ariaLabel:i}){let n;if(!0===e)n=xo;else{if(!kt(e))return!1;if(e.length>Io)return $r.error(`[PostHog] content_ignorelist array cannot exceed ${Io} items. Use css_selector_ignorelist for more complex matching.`),!1;n=e.map(e=>e.toLowerCase())}return n.some(e=>Po(t,e)||Po(i,e))}(n,function(e,t){for(const e of t)if(Ro(e))return Fo(e);for(const e of t){try{var i;if("pointer"!==(null===(i=window)||void 0===i?void 0:i.getComputedStyle(e).getPropertyValue("cursor")))break}catch(e){break}const t=Fo(e);if(t.safeText||t.ariaLabel)return t}return Fo(e)}(e,a))||wo(a,i))}const No=e=>!e||uo(e,"html")||!co(e),Bo=(e,t)=>{const i=typeof window>"u"?void 0:window;if(!i||No(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const s=[e];let r=e;for(;r.parentNode&&!uo(r,"body");){if(po(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}const e=ko(r);if(!e)break;if(t||bo.indexOf(e.tagName.toLowerCase())>-1)n=!0;else try{const t=i.getComputedStyle(e);t&&"pointer"===t.getPropertyValue("cursor")&&(n=!0)}catch(e){}s.push(e),r=e}return{parentIsUsefulElement:n,targetElementList:s}};function qo(e){const t=new Set;let i=0;for(let n=e;n.parentNode&&!uo(n,"body");n=n.parentNode){if(i++>=1e3||t.has(n))return!1;t.add(n);const e=fo(n);if(ft(e,"ph-sensitive")||ft(e,"ph-no-capture"))return!1}if(ft(fo(e),"ph-include"))return!0;const n=e.type||"";if(Tt(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}const s=e.name||e.id||"";return!Tt(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 Ho(e){return!!(uo(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||uo(e,"select")||uo(e,"textarea")||"true"===e.getAttribute("contenteditable"))}const zo=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}))$"),Uo=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Wo=[16,15,14,13],jo=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Vo=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Go=/[0-9A-Za-z_]/;function Qo(e){let t=0,i=!1;for(let n=e.length-1;n>=0;n--){let s=e.charCodeAt(n)-48;i&&(s*=2,s>9&&(s-=9)),t+=s,i=!i}return t%10==0}function Ko(e,t=!0){if(Rt(e))return!1;if(Tt(e)){if(e=vt(e),t?zo.test((e||"").replace(/[- ]/g,"")):function(e){let t;for(Uo.lastIndex=0;t=Uo.exec(e);){const e=t[2];if(!e)continue;const i=e.replace(/[- ]/g,"");for(let e=0;i.length>e;e++)for(const t of Wo){const n=e+t;if(i.length>=n){const t=i.slice(e,n);if(zo.test(t)&&Qo(t))return!0}}}return!1}(e))return!1;if(t?jo.test(e):function(e){let t;for(Vo.lastIndex=0;t=Vo.exec(e);){const e=t[1],i=t[3];if(!(e&&i&&Go.test(e)&&Go.test(i)))return!0}return!1}(e))return!1}return!0}function Jo(e){let t=mo(e);return t=`${t} ${Zo(e)}`.trim(),Ko(t)?t:""}function Zo(e){let t="";return e&&e.childNodes&&e.childNodes.length&&qr(e.childNodes,function(e){var i;if(e&&"span"===(null===(i=e.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=mo(e);t=`${t} ${i}`.trim(),e.childNodes&&e.childNodes.length&&(t=`${t} ${Zo(e)}`.trim())}catch(e){$r.error("[AutoCapture]",e)}}),t}function Yo(e){return e.replace(/"|\\"/g,'\\"')}function Xo(e){const t=e.attr__class;if(t)return kt(t)?t:go(t)}const ea=1e6;function ta(e){var t;return Math.min(ea,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:ea)}const ia={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:ea,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},na=["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"],sa=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ra=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],oa=e=>{Rt(e)||qr(Object.keys(e),t=>{(e=>{const t=e.toLowerCase();return na.includes(t)||ra.some(e=>t.includes(e))})(t)&&(e[t]="redacted")})},aa=["/s/","/e/","/i/"];function la(e,t,i,n){if(Rt(e))return e;let s=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return Tt(s)&&(s=parseInt(s)),s>i?`[SessionRecording] ${n} body too large to record (${s} bytes)`:e}function ca(e,t){if(Rt(e))return e;let i=e;return Ko(i,!1)||(i="[SessionRecording] "+t+" body redacted"),qr(sa,e=>{(null==i?void 0:i.length)&&-1!==(null==i?void 0:i.indexOf(e))&&(i="[SessionRecording] "+t+" body redacted as might contain: "+e)}),i}const ua=new WeakSet,da="disabled",ha="sampled",pa="active",ga="buffering",_a="paused",fa="lazy_loading",va="rrweb_error",ma="trigger_activated",ya="trigger_pending",ba="trigger_disabled";function Sa(e,t,i,n,s,r){return 0===t?ba:(null==e?void 0:e.get_property(i?n+i:s))===r?ma:ya}function wa(e,t,i){return t.some(t=>{var n;return"regex"===t.matching&&(null!==(n=null==i?void 0:i.get(t.url))&&void 0!==n?n:new RegExp(t.url)).test(e)})}function ka(e){return e.includes("trigger_activated")?ma:e.includes("trigger_pending")?ya:ba}function Ca(e){const t=new Set(e);switch(t.delete(ba),t.size){case 0:return ba;case 1:return Array.from(t)[0];default:return ya}}var xa=class{constructor(e){this._matchers=e}triggerStatus(e){return ka(this._matchers.map(t=>t.triggerStatus(e)))}triggerStatusNoSideEffects(e){return ka(this._matchers.map(t=>t.triggerStatusNoSideEffects(e)))}stop(){this._matchers.forEach(e=>e.stop())}},Ea=class{constructor(e){this._matchers=e}triggerStatus(e){return Ca(this._matchers.map(t=>t.triggerStatus(e)))}triggerStatusNoSideEffects(e){return Ca(this._matchers.map(t=>t.triggerStatusNoSideEffects(e)))}stop(){this._matchers.forEach(e=>e.stop())}},Ia=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return ma}stop(){}};const Ta=e=>"sessionRecording"in e;var Ma=class{constructor(e,t){this._instance=e,this._urlTriggers=[],this._urlBlocklist=[],this._compiledTriggerRegexes=new Map,this._compiledBlocklistRegexes=new Map,this._lastCheckedUrl="",this.urlBlocked=!1,this._groupId=t}onConfig(e){var t,i;this._urlTriggers=(Ta(e)?xt(e.sessionRecording)?null===(t=e.sessionRecording)||void 0===t?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this._urlBlocklist=(Ta(e)?xt(e.sessionRecording)?null===(i=e.sessionRecording)||void 0===i?void 0:i.urlBlocklist:[]:null==e?void 0:e.urlBlocklist)||[],this._compileRegexCache()}_compileRegexCache(){this._compiledTriggerRegexes.clear(),this._compiledBlocklistRegexes.clear();for(const e of this._urlTriggers)if("regex"===e.matching&&!this._compiledTriggerRegexes.has(e.url))try{this._compiledTriggerRegexes.set(e.url,new RegExp(e.url))}catch(t){$r.error("Invalid URL trigger regex pattern:",e.url,t)}for(const e of this._urlBlocklist)if("regex"===e.matching&&!this._compiledBlocklistRegexes.has(e.url))try{this._compiledBlocklistRegexes.set(e.url,new RegExp(e.url))}catch(t){$r.error("Invalid URL blocklist regex pattern:",e.url,t)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return Sa(this._instance,this._urlTriggers.length,this._groupId,_e,he,e)}triggerStatus(e){const t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Ve]:t}),t}triggerStatusNoSideEffects(e){return this._urlTriggerStatus(e)}isCurrentUrlBlocked(){const e=ao(this._instance);if(!e)return!1;try{return wa(e,this._urlBlocklist,this._compiledBlocklistRegexes)}catch(e){return!0}}checkUrlBlocklist(e,t){const i=ao(this._instance);if(!i)return;if(i===this._lastCheckedUrl)return;this._lastCheckedUrl=i;const n=this.urlBlocked,s=wa(i,this._urlBlocklist,this._compiledBlocklistRegexes);n&&s||(s&&!n?e():!s&&n&&t())}checkUrlTriggerConditions(e,t,i,n){const s=ao(this._instance);if(!s)return;if(s===this._lastCheckedUrl)return;this._lastCheckedUrl=s;const r=this.urlBlocked,o=wa(s,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!r?e():!o&&r&&t();const a=this._urlTriggerStatus(n)===ma,l=wa(s,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&i("url",s)}stop(){this._lastCheckedUrl=""}},Pa=class{constructor(e){this._instance=e,this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{}}triggerStatus(){const e=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[He]:e}),e}triggerStatusNoSideEffects(){let e=ya;return Rt(this.linkedFlag)&&(e=ba),this.linkedFlagSeen&&(e=ma),e}onConfig(e,t){var i;if(this.linkedFlag=(Ta(e)?xt(e.sessionRecording)?null===(i=e.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==e?void 0:e.linkedFlag)||null,!Rt(this.linkedFlag)&&!this.linkedFlagSeen){const e=Tt(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=Tt(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags((n,s)=>{let r=!1;if(xt(s)&&e in s){const t=s[e];r=Lt(t)?!0===t:i?t===i:!!t}const o=r&&!this.linkedFlagSeen;this.linkedFlagSeen=r,o&&t(e,i)})}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}},Ra=class{constructor(e,t){this._instance=e,this._eventTriggers=[],this._groupId=t}onConfig(e){var t;this._eventTriggers=(Ta(e)?xt(e.sessionRecording)?null===(t=e.sessionRecording)||void 0===t?void 0:t.eventTriggers:[]:null==e?void 0:e.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}_eventTriggerStatus(e){return Sa(this._instance,this._eventTriggers.length,this._groupId,ge,pe,e)}triggerStatus(e){const t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[qe]:t}),t}triggerStatusNoSideEffects(e){return this._eventTriggerStatus(e)}checkEventTriggerConditions(e,t,i){if(0===this._eventTriggers.length)return;const n=this._eventTriggerStatus(i)===ma,s=this._eventTriggers.includes(e);!n&&s&&t("event",e)}stop(){}},Fa=class{constructor(e,t,i){if(this._instance=e,this.group=t,this._urlTriggerMatching=new Ma(e,t.id),this._eventTriggerMatching=new Ra(e,t.id),this._linkedFlagMatching=new Pa(e),t.conditions.events&&t.conditions.events.length>0||t.conditions.urls&&t.conditions.urls.length>0||t.conditions.flag){const e=(t.conditions.events||[]).map(e=>e.name),n={urlTriggers:t.conditions.urls||[],eventTriggers:e,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this._urlTriggerMatching.onConfig(n),this._eventTriggerMatching.onConfig(n),this._linkedFlagMatching.onConfig(n,i);const s=[this._eventTriggerMatching,this._urlTriggerMatching,this._linkedFlagMatching];this._combinedMatching="any"===t.conditions.matchType?new xa(s):new Ea(s)}else this._combinedMatching=new Ia}triggerStatus(e){return this._combinedMatching.triggerStatus(e)}triggerStatusNoSideEffects(e){return this._combinedMatching.triggerStatusNoSideEffects(e)}getPendingTriggerConditions(e){return"trigger_pending"!==this.triggerStatusNoSideEffects(e)?[]:[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter(({status:e})=>e===ya).map(({label:e})=>e)}checkEventTriggerConditions(e,t,i){this._eventTriggerMatching.checkEventTriggerConditions(e,t,i)}checkUrlTriggerConditions(e,t,i,n){this._urlTriggerMatching.checkUrlTriggerConditions(e,t,i,n)}activateTrigger(e,t){var i;const n="url"===e?_e+this.group.id:ge+this.group.id;null===(i=this._instance.persistence)||void 0===i||i.register({[n]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}};function Aa(e){if(e.rrwebError)return va;if(!e.receivedFlags)return ga;if(!e.isRecordingEnabled)return da;if(e.urlTriggerMatching.urlBlocked)return _a;const t=!0===e.isSampled,i=new xa([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?ha:"trigger_activated"===i?pa:"trigger_pending"===i?ga:!1===e.isSampled?da:pa}function La(e){if(e.rrwebError)return va;if(!e.receivedFlags)return ga;if(!e.isRecordingEnabled)return da;if(e.urlTriggerMatching.urlBlocked)return _a;const t=new Ea([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),i=t!==ba,n=Lt(e.isSampled);return i&&"trigger_pending"===t?ga:i&&"trigger_disabled"===t||n&&!e.isSampled?da:!0===e.isSampled?ha:pa}function Oa(){const e=[];return function(t,i){if(xt(i)||kt(i)){for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(i)?"[Circular]":(e.push(i),i)}return i}}function Da(e){try{const t=JSON.stringify(e,Oa());return t?new Blob([t]).size:0}catch(e){return-1}}function $a(e){if(Pt(e))return 4;if(It(e))return 0;switch(typeof e){case"string":return e.length+2;case"number":return String(e).length;case"boolean":return e?4:5;case"object":{if(kt(e)){let t=2;for(let i=0;e.length>i;i++){i>0&&(t+=1);const n=e[i];t+=It(n)||Pt(n)?4:$a(n)}return t}const t=e;let i=2,n=!0;for(const e in t){if(!{}.hasOwnProperty.call(t,e))continue;const s=t[e];It(s)||(n||(i+=1),n=!1,i+=e.length+3+$a(s))}return i}default:return 0}}function Na(e,t=6606028.8){if(e.size>=t&&e.data.length>1){const t=Math.floor(e.data.length/2),i=e.sizes.slice(0,t),n=e.sizes.slice(t);return[Na({size:i.reduce((e,t)=>e+t,0),data:e.data.slice(0,t),sizes:i,sessionId:e.sessionId,windowId:e.windowId}),Na({size:n.reduce((e,t)=>e+t,0),data:e.data.slice(t),sizes:n,sessionId:e.sessionId,windowId:e.windowId})].flatMap(e=>e)}return[e]}var Ba=Uint8Array,qa=Uint16Array,Ha=Uint32Array,za=new Ba([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]),Ua=new Ba([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]),Wa=new Ba([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ja=function(e,t){for(var i=new qa(31),n=0;31>n;++n)i[n]=t+=1<<e[n-1];var s=new Ha(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]},Va=ja(za,2),Ga=Va[1];Va[0][28]=258,Ga[258]=28;for(var Qa=ja(Ua,0)[1],Ka=new qa(32768),Ja=0;32768>Ja;++Ja){var Za=(43690&Ja)>>>1|(21845&Ja)<<1;Ka[Ja]=((65280&(Za=(61680&(Za=(52428&Za)>>>2|(13107&Za)<<2))>>>4|(3855&Za)<<4))>>>8|(255&Za)<<8)>>>1}var Ya=function(e,t,i){for(var n=e.length,s=0,r=new qa(t);n>s;++s)++r[e[s]-1];var o,a=new qa(t);for(s=0;t>s;++s)a[s]=a[s-1]+r[s-1]<<1;if(i){o=new qa(1<<t);var l=15-t;for(s=0;n>s;++s)if(e[s])for(var c=s<<4|e[s],u=t-e[s],d=a[e[s]-1]++<<u,h=d|(1<<u)-1;h>=d;++d)o[Ka[d]>>>l]=c}else for(o=new qa(n),s=0;n>s;++s)o[s]=Ka[a[e[s]-1]++]>>>15-e[s];return o},Xa=new Ba(288);for(Ja=0;144>Ja;++Ja)Xa[Ja]=8;for(Ja=144;256>Ja;++Ja)Xa[Ja]=9;for(Ja=256;280>Ja;++Ja)Xa[Ja]=7;for(Ja=280;288>Ja;++Ja)Xa[Ja]=8;var el=new Ba(32);for(Ja=0;32>Ja;++Ja)el[Ja]=5;var tl=Ya(Xa,9,0),il=Ya(el,5,0),nl=function(e){return(e/8|0)+(7&e&&1)},sl=function(e,t,i){(null==t||0>t)&&(t=0),(null==i||i>e.length)&&(i=e.length);var n=new(e instanceof qa?qa:e instanceof Ha?Ha:Ba)(i-t);return n.set(e.subarray(t,i)),n},rl=function(e,t,i){var n=t/8|0;e[n]|=i<<=7&t,e[n+1]|=i>>>8},ol=function(e,t,i){var n=t/8|0;e[n]|=i<<=7&t,e[n+1]|=i>>>8,e[n+2]|=i>>>16},al=function(e,t){for(var i=[],n=0;e.length>n;++n)e[n]&&i.push({s:n,f:e[n]});var s=i.length,r=i.slice();if(!s)return[new Ba(0),0];if(1==s){var o=new Ba(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],c=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=i[i[d].f>i[c].f?c++:d++],l=i[c!=u&&i[d].f>i[c].f?c++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=r[0].s;for(n=1;s>n;++n)r[n].s>h&&(h=r[n].s);var p=new qa(h+1),g=ll(i[u-1],p,0);if(g>t){n=0;var _=0,f=g-t,v=1<<f;for(r.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});s>n;++n){var m=r[n].s;if(t>=p[m])break;_+=v-(1<<g-p[m]),p[m]=t}for(_>>>=f;_>0;){var y=r[n].s;t>p[y]?_-=1<<t-p[y]++-1:++n}for(;n>=0&&_;--n){var b=r[n].s;p[b]==t&&(--p[b],++_)}g=t}return[new Ba(p),g]},ll=function(e,t,i){return-1==e.s?Math.max(ll(e.l,t,i+1),ll(e.r,t,i+1)):t[e.s]=i},cl=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new qa(++t),n=0,s=e[0],r=1,o=function(e){i[n++]=e},a=1;t>=a;++a)if(e[a]==s&&a!=t)++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=e[a]}return[i.subarray(0,n),t]},ul=function(e,t){for(var i=0,n=0;t.length>n;++n)i+=e[n]*t[n];return i},dl=function(e,t,i){var n=i.length,s=nl(t+2);e[s]=255&n,e[s+1]=n>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var r=0;n>r;++r)e[s+r+4]=i[r];return 8*(s+4+n)},hl=function(e,t,i,n,s,r,o,a,l,c,u){rl(t,u++,i),++s[256];for(var d=al(s,15),h=d[0],p=d[1],g=al(r,15),_=g[0],f=g[1],v=cl(h),m=v[0],y=v[1],b=cl(_),S=b[0],w=b[1],k=new qa(19),C=0;m.length>C;++C)k[31&m[C]]++;for(C=0;S.length>C;++C)k[31&S[C]]++;for(var x=al(k,7),E=x[0],I=x[1],T=19;T>4&&!E[Wa[T-1]];--T);var M,P,R,F,A=c+5<<3,L=ul(s,Xa)+ul(r,el)+o,O=ul(s,h)+ul(r,_)+o+14+3*T+ul(k,E)+(2*k[16]+3*k[17]+7*k[18]);if(L>=A&&O>=A)return dl(t,u,e.subarray(l,l+c));if(rl(t,u,1+(L>O)),u+=2,L>O){M=Ya(h,p,0),P=h,R=Ya(_,f,0),F=_;var D=Ya(E,I,0);for(rl(t,u,y-257),rl(t,u+5,w-1),rl(t,u+10,T-4),u+=14,C=0;T>C;++C)rl(t,u+3*C,E[Wa[C]]);u+=3*T;for(var N=[m,S],B=0;2>B;++B){var q=N[B];for(C=0;q.length>C;++C)rl(t,u,D[H=31&q[C]]),u+=E[H],H>15&&(rl(t,u,q[C]>>>5&127),u+=q[C]>>>12)}}else M=tl,P=Xa,R=il,F=el;for(C=0;a>C;++C)if(n[C]>255){var H;ol(t,u,M[257+(H=n[C]>>>18&31)]),u+=P[H+257],H>7&&(rl(t,u,n[C]>>>23&31),u+=za[H]);var z=31&n[C];ol(t,u,R[z]),u+=F[z],z>3&&(ol(t,u,n[C]>>>5&8191),u+=Ua[z])}else ol(t,u,M[n[C]]),u+=P[n[C]];return ol(t,u,M[256]),u+P[256]},pl=new Ha([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),gl=new Ba(0),_l=function(){for(var e=new Ha(256),t=0;256>t;++t){for(var i=t,n=9;--n;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),fl=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function vl(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,n=0;t.length>n;++n)i=_l[255&i^t[n]]^i>>>8;e=i},d(){return 4294967295^e}}}(),n=e.length;i.p(e);var s,r,o,a,l,c=(s=e,r=t,o=function(e){return 10+(e.filename&&e.filename.length+1||0)}(t),a=8,function(e,t,i,n,s,r){var o=e.length,a=new Ba(n+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(n,a.length-s),c=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?c=dl(l,c,e.subarray(u,d)):(l[u]=r,c=dl(l,c,e.subarray(u,o)))}else{for(var h=pl[t-1],p=h>>>13,g=8191&h,_=(1<<i)-1,f=new qa(32768),v=new qa(_+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&_},S=new Ha(25e3),w=new qa(288),k=new qa(32),C=0,x=0,E=(u=0,0),I=0,T=0;o>u;++u){var M=b(u),P=32767&u,R=v[M];if(f[P]=R,v[M]=P,u>=I){var F=o-u;if((C>7e3||E>24576)&&F>423){c=hl(e,l,0,S,w,k,x,E,T,u-T,c),E=C=x=0,T=u;for(var A=0;286>A;++A)w[A]=0;for(A=0;30>A;++A)k[A]=0}var L=2,O=0,D=g,N=P-R&32767;if(F>2&&M==b(u-N))for(var B=Math.min(p,F)-1,q=Math.min(32767,u),H=Math.min(258,F);q>=N&&--D&&P!=R;){if(e[u+L]==e[u+L-N]){for(var z=0;H>z&&e[u+z]==e[u+z-N];++z);if(z>L){if(L=z,O=N,z>B)break;var U=Math.min(N,z-2),W=0;for(A=0;U>A;++A){var j=u-N+A+32768&32767,V=j-f[j]+32768&32767;V>W&&(W=V,R=j)}}}N+=(P=R)-(R=f[P])+32768&32767}if(O){S[E++]=268435456|Ga[L]<<18|Qa[O];var G=31&Ga[L],Q=31&Qa[O];x+=za[G]+Ua[Q],++w[257+G],++k[Q],I=u+L,++C}else S[E++]=e[u],++w[e[u]]}}c=hl(e,l,r,S,w,k,x,E,T,u-T,c),r||(c=dl(l,c,gl))}return sl(a,0,n+nl(c)+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)),u=c.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&fl(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var n=0;i.length>=n;++n)e[n+10]=i.charCodeAt(n)}}(c,t),fl(c,u-8,i.d()),fl(c,u-4,n),c}function ml(e,t){var i=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var n=new Ba(e.length+(e.length>>>1)),s=0,r=function(e){n[s++]=e},o=0;i>o;++o){if(s+5>n.length){var a=new Ba(s+8+(i-o<<1));a.set(n),n=a}var l=e.charCodeAt(o);128>l||t?r(l):2048>l?(r(192|l>>>6),r(128|63&l)):l>55295&&57344>l?(r(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),r(128|l>>>12&63),r(128|l>>>6&63),r(128|63&l)):(r(224|l>>>12),r(128|l>>>6&63),r(128|63&l))}return sl(n,0,s)}function yl(e,t){var i="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var n=0;e.length>n;){var s=e[n++];128>s||t?i+=String.fromCharCode(s):224>s?i+=String.fromCharCode((31&s)<<6|63&e[n++]):240>s?i+=String.fromCharCode((15&s)<<12|(63&e[n++])<<6|63&e[n++]):(s=((15&s)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,i+=String.fromCharCode(55296|s>>10,56320|1023&s))}return i}var bl=class{constructor(e,t={}){var i,n,s,r;this._rrweb=e,this._options=t,this._loggedTracker={},this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0,this._refillByteBudget=()=>{const e=Date.now(),t=e-this._lastByteRefill;t>0?(this._byteTokens=Math.min(this._bytesBucketSize,this._byteTokens+t/1e3*this._bytesRefillRate),this._lastByteRefill=e):this._lastByteRefill=e},this._onNodeRateLimited=e=>{if(!this._loggedTracker[e]){var t,i;this._loggedTracker[e]=!0;const n=this._getNode(e);null===(t=(i=this._options).onBlockedNode)||void 0===t||t.call(i,e,n)}},this._getNodeOrRelevantParent=e=>{const t=this._getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){const e=t.closest("svg");if(e)return[this._rrweb.mirror.getId(e),e]}return[e,t]},this._getNode=e=>this._rrweb.mirror.getNode(e),this._numberOfChanges=e=>{var t,i,n,s,r,o,a,l;return(null!==(t=null===(i=e.removes)||void 0===i?void 0:i.length)&&void 0!==t?t:0)+(null!==(n=null===(s=e.attributes)||void 0===s?void 0:s.length)&&void 0!==n?n:0)+(null!==(r=null===(o=e.texts)||void 0===o?void 0:o.length)&&void 0!==r?r:0)+(null!==(a=null===(l=e.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;const t=e.data,i=this._numberOfChanges(t);if(t.attributes){const e=t.attributes.length;t.attributes=t.attributes.filter(e=>{const[t]=this._getNodeOrRelevantParent(e.id);return!this._rateLimiter.consumeRateLimit(t)&&e});const i=e-t.attributes.length;var n,s;i>0&&(null===(n=(s=this._options).onDroppedAttributeMutations)||void 0===n||n.call(s,i))}const r=this._numberOfChanges(t);if(0===r&&i!==r)return;if(this._byteBudgetDisabled)return e;this._refillByteBudget();const o=$a(e);var a,l;return o>this._byteTokens?(null===(a=(l=this._options).onDroppedOversizedMutation)||void 0===a||a.call(l,o),void this._scheduleResync()):(this._byteTokens-=o,e)},this._scheduleResync=()=>{if(this._resyncTimer)return;const e=Math.max(0,this._resyncIntervalMs-(Date.now()-this._lastResyncAt));this._resyncTimer=setTimeout(()=>{var e,t;this._resyncTimer=void 0,this._lastResyncAt=Date.now(),null===(e=(t=this._options).requestFullSnapshot)||void 0===e||e.call(t)},e)},this._rateLimiter=new Jt({bucketSize:null!==(i=this._options.bucketSize)&&void 0!==i?i:100,refillRate:null!==(n=this._options.refillRate)&&void 0!==n?n:10,refillInterval:1e3,_onBucketRateLimited:this._onNodeRateLimited,_logger:$r}),this._bytesBucketSize=null!==(s=this._options.bytesBucketSize)&&void 0!==s?s:0,this._bytesRefillRate=null!==(r=this._options.bytesRefillRate)&&void 0!==r?r:25600,this._byteBudgetDisabled=!Number.isFinite(this._bytesBucketSize)||0>=this._bytesBucketSize,this._byteTokens=this._bytesBucketSize;const o=this._options.resyncIntervalMs;this._resyncIntervalMs=Ft(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this._loggedTracker={},this._resyncTimer&&(clearTimeout(this._resyncTimer),this._resyncTimer=void 0),this._lastResyncAt=Date.now()}stop(){this._rateLimiter.stop(),this.reset(),this._byteTokens=this._bytesBucketSize,this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0}};const Sl=e=>{if(n){try{const t=e+"=",i=n.cookie.split(";").filter(e=>e.length);for(let e=0;i.length>e;e++){let n=i[e];for(;" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(t))return decodeURIComponent(n.substring(t.length,n.length))}}catch(e){}return null}};var wl=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,n,s){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(n)||!Number.isInteger(s)||0>t||0>i||0>n||0>s||t>0xffffffffffff||i>4095||n>1073741823||s>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=t/Math.pow(2,40),r[1]=t/Math.pow(2,32),r[2]=t/Math.pow(2,24),r[3]=t/Math.pow(2,16),r[4]=t/256,r[5]=t,r[6]=112|i>>>8,r[7]=i,r[8]=128|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 e(r)}toString(){let e="";for(let t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(let t=0;16>t;t++){const i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}},kl=class{generate(){const e=this.generateOrAbort();if(!It(e))return e;{this._timestamp=0;const e=this.generateOrAbort();if(It(e))throw new Error("Could not generate UUID after timestamp reset");return e}}generateOrAbort(){const e=(()=>{const e=Date.now();return Ft(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0})();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return wl.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}constructor(){this._timestamp=0,this._counter=0,this._random=new El}};const Cl=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};let xl;var El=class{nextUint32(){var e;return this._buffer.length>this._cursor||((null!==(e=xl)&&void 0!==e?e:xl="u">typeof window&&!It(window.crypto)&&crypto.getRandomValues?e=>{try{return crypto.getRandomValues(e)}catch(t){return Cl(e)}}:Cl)(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}};let Il;const Tl=()=>Ml().toString(),Ml=()=>(Il||(Il=new kl)).generate();let Pl="";const Rl=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Fl=null;const Al={_is_supported(){if(!Pt(Fl))return Fl;if(Fl=!1,n)try{const e=`__ph_cookie_support_${Tl()}`;Al._set(e,"xyz"),Fl='"xyz"'===Sl(e),Al._remove(e)}catch(e){Fl=!1}return Fl},_error(e){$r.error("cookieStore error: "+e)},_get:Sl,_parse(e){let t;try{t=JSON.parse(Al._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!n)return!1;try{let o="",a="";const l=function(e,t){if(t){let t=function(e,t=n){if(Pl)return Pl;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";const i=e.split(".");let s=Math.min(i.length,8);const r="dmn_chk_"+Tl();for(;!Pl&&s--;){const e=i.slice(s).join("."),n=r+"=1;domain=."+e+";path=/";t.cookie=n+";max-age=3",t.cookie.includes(r)&&(t.cookie=n+";max-age=0",Pl=e)}return Pl}(e);if(!t){const i=(e=>{const t=e.match(Rl);return t?t[0]:""})(e);i!==t&&$r.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}(n.location.hostname,s);if(i){const e=new Date;e.setTime(e.getTime()+864e5*i),o="; expires="+e.toUTCString()}r&&(a="; secure");const c=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&$r.warn("cookieStore warning: large cookie, len="+c.length),n.cookie=c,!0}catch(e){return!1}},_remove(e,t){if((null==n?void 0:n.cookie)&&(!t||!Pt(Sl(e))))try{Al._set(e,"",-1,t)}catch(e){return}}};let Ll=null;const Ol={_is_supported(){if(!Pt(Ll))return Ll;let t=!0;if(It(e))t=!1;else try{const e="__mplssupport__";Ol._set(e,"xyz"),'"xyz"'!==Ol._get(e)&&(t=!1),Ol._remove(e)}catch(e){t=!1}return t||$r.error("localStorage unsupported; falling back to cookie store"),Ll=t,t},_error(e){$r.error("localStorage error: "+e)},_get(t){try{return null==e?void 0:e.localStorage.getItem(t)}catch(e){Ol._error(e)}return null},_parse(e){try{return JSON.parse(Ol._get(e))||{}}catch(e){}return null},_set(t,i){try{return null==e||e.localStorage.setItem(t,JSON.stringify(i)),!0}catch(e){Ol._error(e)}return!1},_remove(t){try{null==e||e.localStorage.removeItem(t)}catch(e){Ol._error(e)}}},Dl=[S,p,y,g,C,v,f,_,w],$l=[N,D,ce,ue,Ae,Fe,U,Ie],Nl=e=>e+"_cpm",Bl=["__proto__","constructor","prototype"],ql=e=>{if(!xt(e))return{};const t={};return Object.keys(e).forEach(i=>{-1===Bl.indexOf(i)&&(t[i]=e[i])}),t},Hl=(e,t=[])=>{const i={};return[...$l,...t].forEach(t=>{const n=e[t];It(n)||Pt(n)||""===n||(i[t]=n)}),i},zl=e=>{let t=5381,i=2166136261;for(let n=0;e.length>n;n++){const s=e.charCodeAt(n);t=33*t^s,i=Math.imul(i^s,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},Ul=(e,t)=>({p:t,f:zl(JSON.stringify(e))}),Wl=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const i=Al._parse(Nl(e)),n=(null==i?void 0:i.f)===zl(t)&&kt(i.p);return{properties:n?i.p:[],isValid:n}}catch(e){return{properties:[],isValid:!1}}},jl=(e,t)=>t+"|"+(Al._get(Nl(e))||""),Vl={},Gl={_is_supported:()=>!0,_error(e){$r.error("memoryStorage error: "+e)},_get:e=>e in Vl?Vl[e]:null,_parse:e=>e in Vl?Vl[e]:null,_set:(e,t)=>(Vl[e]=t,!0),_remove(e){delete Vl[e]}};let Ql=null;const Kl={_is_supported(){if(!Pt(Ql))return Ql;if(Ql=!0,It(e))Ql=!1;else try{const e="__support__";Kl._set(e,"xyz"),'"xyz"'!==Kl._get(e)&&(Ql=!1),Kl._remove(e)}catch(e){Ql=!1}return Ql},_error(e){$r.error("sessionStorage error: ",e)},_get(t){try{return null==e?void 0:e.sessionStorage.getItem(t)}catch(e){Kl._error(e)}return null},_parse(e){try{return JSON.parse(Kl._get(e))||null}catch(e){}return null},_set(t,i){try{return null==e||e.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(e){Kl._error(e)}return!1},_remove(t){try{null==e||e.sessionStorage.removeItem(t)}catch(e){Kl._error(e)}}};Or.DEBUG=!1,Or.LIB_VERSION="1.445.0",Or.LIB_NAME="web";var Jl=Or,Zl=class{constructor(e){if(!e.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this._getProperty=e.get_property.bind(e),this._setProperty=e.persistence.set_property.bind(e.persistence)}trackSize(e,t){this._setProperty(me,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){const t=this._getProperty(me);return xt(i=t)&&Tt(i.sessionId)&&Ft(i.size)&&t.sessionId===e?t.size:0;var i}};function Yl(e,t){return function(e){let t=0;for(let i=0;e.length>i;i++)t=(t<<5)-t+e.charCodeAt(i),t|=0;return Math.abs(t)}(e)%100<Kt(100*t,0,100,$r)}function Xl(e){return`$survey_response_${e}`}function ec(e,t){if(!t)return null;const i=e[Xl(t)];return kt(i)?[...i]:i}function tc({event:e,survey:t,responses:i={},submissionId:n,completed:s,surveyLanguage:r,questionSnapshots:o}){return ct(ct(ct(ct({},!It(n)&&{$survey_submission_id:n}),"sent"===e?!It(s)&&{$survey_completed:s}:{$survey_partially_completed:ic(i)}),r&&{$survey_language:r}),function(e={},t,i){const n={};return t.questions.forEach(t=>{if(It(t.originalQuestionIndex))return;const i=0===(s=t.originalQuestionIndex)?"$survey_response":`$survey_response_${s}`;var s;const r=ec(e,t.id);It(r)||(n[i]=r)}),ct(ct({$survey_questions:t.questions.map(t=>{var n,s;return{id:t.id,question:null!==(n=null==i?void 0:i[null!==(s=t.id)&&void 0!==s?s:""])&&void 0!==n?n:t.question,response:ec(e,t.id)}})},e),n)}(i,t,o))}function ic(e={}){return Object.values(e).some(e=>!Rt(e))}function nc(e,t){let i=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(i=`$survey_${t}/${e.id}/${e.current_iteration}`),i}function sc(e){return"string"==typeof e&&e.trim()?e.trim():null}function rc(e){return e.toLowerCase()}function oc(e,t,i){if(!e||!t)return null;const n=rc(t),s=Object.keys(e).find(e=>rc(e)===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(e).find(e=>rc(e)===s);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${t})`),r}return null}const ac=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function lc(e,t,i){var n;const s=oc(e.translations,t,i),r=ct({},e);let o=!1;if(s){var a;const t=null===(a=e.translations)||void 0===a?void 0:a[s];if(t)if(null==i||i.info(`Applying survey-level translation for language: ${s}`),It(t.name)||(r.name=t.name,o=!0),r.appearance){const e=ct({},r.appearance);for(const i of ac){const n=t[i];It(n)||(e[i]=n,o=!0)}r.appearance=e}else(function(e){return ac.some(t=>!It(e[t]))})(t)&&(o=!0)}const l=e.questions.map(e=>function(e,t,i){var n;const s=oc(e.translations,t,i);if(!s)return{question:e,matchedKey:null,hasChanges:!1};const r=null===(n=e.translations)||void 0===n?void 0:n[s];if(!r)return{question:e,matchedKey:null,hasChanges:!1};const o=ct({},e);let a=!1;return It(r.question)||(o.question=r.question,a=!0),It(r.description)||(o.description=r.description,a=!0),It(r.buttonText)||(o.buttonText=r.buttonText,a=!0),"link"in o&&!It(r.link)&&(o.link=r.link,a=!0),"lowerBoundLabel"in o&&!It(r.lowerBoundLabel)&&(o.lowerBoundLabel=r.lowerBoundLabel,a=!0),"upperBoundLabel"in o&&!It(r.upperBoundLabel)&&(o.upperBoundLabel=r.upperBoundLabel,a=!0),"choices"in o&&function(e){return kt(e.choices)}(r)&&(o.choices=r.choices,a=!0),{question:a?o:e,matchedKey:a?s:null,hasChanges:a}}(e,t,i)),c=l.map(e=>e.question),u=l.some(e=>e.hasChanges);let d=null;return s||(d=(null===(n=l.find(e=>e.matchedKey))||void 0===n?void 0:n.matchedKey)||null),u&&(r.questions=c,o=!0,null==i||i.info(`Applied question-level translations for language: ${t}`)),{survey:r,matchedKey:o?s||d:null}}function cc(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}function uc(e){var t;return cc(e)&&!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t?void 0:t.repeatedActivation)||"always"===e.schedule}const dc=(e,t)=>{if(!(e=>{try{new RegExp(e)}catch(e){return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}},hc=e=>e.toLowerCase(),pc={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>dc(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!dc(t,e))),icontains:(e,t)=>t.map(hc).some(t=>e.map(hc).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(hc).every(t=>e.map(hc).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{const i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{const i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})};function gc(e,t){return!e||Object.entries(e).every(([e,i])=>{const n=null==t?void 0:t[e];if(null==n)return!1;const s=pc[i.operator];return!!s&&s(i.values.map(String),[String(n)])})}const _c=e=>{const t=[...e];for(let e=t.length-1;e>0;e--){const i=Math.floor(Math.random()*(e+1));[t[e],t[i]]=[t[i],t[e]]}return t};function fc(e,t,i){return to({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}const vc=new Set(["is_not","not_icontains","not_regex"]);function mc(e,t,i){return!e||0===e.length||e.every(e=>{const n="person"===e.type?i:t,s=null==n?void 0:n[e.key],r=e.operator||"exact";if(It(s)||Pt(s))return vc.has(r);const o=pc[r];return!!o&&!It(e.value)&&!Pt(e.value)&&o(kt(e.value)?e.value.map(String):[String(e.value)],kt(s)?s.map(String):[String(s)])})}const yc=Nr("[SessionRecording]");function bc(e,t){return t?e:"!"+e}function Sc(e,t){return e===t||e!=="!"+t&&null}var wc=class{constructor(e,t,i,n,s,r,o){this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=i,this._linkedFlagMatching=n,this._reportStarted=s,this._tryTakeFullSnapshot=r,this._onTriggerActivated=o,this._sampleRate=null,this._recordingStatusFunction=La}onRemoteConfig(e){this._sampleRate=Ft(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this._triggerStatusMatcher=new xa([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=Aa):(this._triggerStatusMatcher=new Ea([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=La),this._instance.register_for_session({[We]:e.triggerMatchType}),this._urlTriggerMatching.onConfig(e),this._eventTriggerMatching.onConfig(e),this._linkedFlagMatching.onConfig(e,(e,t)=>{this._reportStarted("linked_flag_matched",{flag:e,variant:t}),this._onTriggerActivated()})}getStatus(e){return this._recordingStatusFunction({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId})}getMinimumDuration(e){const t=this._instance.get_property("$session_recording_remote_config"),i=null==t?void 0:t.minimumDurationMilliseconds;return Ft(i)?i:null}checkUrlTriggers(e,t,i,n){this._urlTriggerMatching.checkUrlTriggerConditions(t,i,n,e)}setupEventTriggerListeners(e,t,i){if(0!==this._eventTriggerMatching._eventTriggers.length&&Rt(this._removeEventTriggerCaptureHook))return this._removeEventTriggerCaptureHook=e(e=>{try{this._eventTriggerMatching.checkEventTriggerConditions(e.event,i,t)}catch(e){yc.error("Could not activate event trigger",e)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t;const i=this._sampleRate;var n,s;if(!Ft(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(ue),o=this._instance.get_property(se),a=Sc(r,e),l=Ft(o)&&o!==i,c=It(o)&&r===e,u=l||c||!Lt(a),d=u?Yl(e,i):a;u&&(d?this._reportStarted("sampled"):yc.warn(`Sample rate (${i}) has determined that this sessionId (${e}) will not be sent to the server.`)),null===(t=this._instance.persistence)||void 0===t||t.register({$session_is_sampled:bc(e,d),$replay_sample_rate:Pt(o)&&r===e?null:i})}ensureSamplingDecision(e){if(!Ft(this._sampleRate))return;const t=this._instance.get_property(ue);Lt(Sc(t,e))||this.makeSamplingDecisions(e)}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,i,n,s;null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_recording_event_trigger_activated_session"),null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_recording_url_trigger_activated_session"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_is_sampled"),null===(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(e){}hasPendingTriggers(e){var t;return(null===(t=this._triggerStatusMatcher)||void 0===t?void 0:t.triggerStatus(e))===ya}getPendingTriggerConditions(e){return[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter(({status:e})=>e===ya).map(({label:e})=>e)}stop(){var e;null===(e=this._removeEventTriggerCaptureHook)||void 0===e||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._eventTriggerMatching.stop(),this._urlTriggerMatching.stop(),this._linkedFlagMatching.stop()}},kc=class{constructor(e,t,i,n,s){this._instance=e,this._urlTriggerMatching=t,this._reportStarted=i,this._tryAddCustomEvent=n,this._onTriggerActivated=s,this._triggerGroupMatchers=[],this._triggerGroupSamplingResults=new Map,this._hasCompletedInitialFlush=!1}onRemoteConfig(e){e.triggerGroups&&0!==e.triggerGroups.length?(this._setupTriggerGroups(e.triggerGroups),this._instance.register_for_session({[We]:"v2_trigger_groups",[je]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):yc.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return va;if(!e.receivedFlags)return ga;if(!e.isRecordingEnabled)return da;if(e.urlTriggerMatching.urlBlocked)return _a;const t=e.triggerGroupMatchers,i=e.triggerGroupSamplingResults;if(0===t.length)return da;let n=!1,s=!1;for(const r of t){const t=r.triggerStatus(e.sessionId);if("trigger_activated"===t){const e=r.group.id,t=i.get(e);It(t)?$r.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:e}):!0===t&&(s=!0)}else"trigger_pending"===t&&(n=!0)}return s?ha:n?ga:da}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId,triggerGroupMatchers:this._triggerGroupMatchers,triggerGroupSamplingResults:this._triggerGroupSamplingResults,minimumDuration:this.getMinimumDuration(e.sessionId)})}getMinimumDuration(e){let t=null;for(const i of this._triggerGroupMatchers)if("trigger_activated"===i.triggerStatus(e)){const e=i.group.minDurationMs;Ft(e)&&(Pt(t)||t>e)&&(t=e)}return t}checkUrlTriggers(e,t,i,n){this._urlTriggerMatching.checkUrlBlocklist(t,i);for(const n of this._triggerGroupMatchers)n.checkUrlTriggerConditions(t,i,t=>{this._checkGroupLevelProperties(n,void 0)&&(n.activateTrigger(t,e),this.updateActiveTriggers(e),this._onTriggerActivated(t))},e)}setupEventTriggerListeners(e,t,i){return this._removeEventTriggerCaptureHook=e(e=>{var i;if(this._hasCompletedInitialFlush)return yc.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(i=this._removeEventTriggerCaptureHook)||void 0===i||i.call(this),void(this._removeEventTriggerCaptureHook=void 0);try{for(const i of this._triggerGroupMatchers)i.checkEventTriggerConditions(e.event,n=>{if(!this._checkGroupLevelProperties(i,e.properties))return;const s=(i.group.conditions.events||[]).filter(t=>t.name===e.event),r=this._instance.get_property(S);s.some(t=>!t.properties||0===t.properties.length||mc(t.properties,e.properties,r))&&(i.activateTrigger(n,t),this.updateActiveTriggers(t),this._onTriggerActivated(n))},t)}catch(e){yc.error("Could not activate event trigger for trigger groups",e)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){for(const i of this._triggerGroupMatchers){var t;const n=i.group,s=n.id,r=n.sampleRate,o=fe+s,a=this._instance.get_property(o);let l=null,c=!1,u=!1,d=!1;if(xt(a)){const t=a.sessionId,i=a.sampleRate,n=a.sampled;c="string"==typeof t&&t!==e,u=Ft(i)&&i!==r,l=t===e&&Ft(i)&&i===r&&Lt(n)?n:null}else l=a===e||null,c="string"==typeof a&&a!==e,d=a===e;const h=c||u||d||!Lt(l),p=h?Yl(e+s,r):l;h&&this._tryAddCustomEvent("triggerGroupSamplingDecisionMade",{group_id:s,group_name:n.name,sampleRate:r,isSampled:p}),this._triggerGroupSamplingResults.set(s,p),null===(t=this._instance.persistence)||void 0===t||t.register({[o]:{sessionId:e,sampleRate:r,sampled:p}})}this.updateActiveTriggers(e)}ensureSamplingDecision(e){}onFlushComplete(){this._hasCompletedInitialFlush=!0}clearConditionalRecordingPersistence(){var e,t,i;null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_is_sampled"),null===(t=this._instance.persistence)||void 0===t||t.unregister("$replay_sample_rate"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_past_minimum_duration");for(const e of this._triggerGroupMatchers){var n,s,r;const t=e.group.id;null===(n=this._instance.persistence)||void 0===n||n.unregister("$posthog_sr_group_event_trigger_"+t),null===(s=this._instance.persistence)||void 0===s||s.unregister("$posthog_sr_group_url_trigger_"+t),null===(r=this._instance.persistence)||void 0===r||r.unregister("$posthog_sr_group_sampling_"+t)}}updateActiveTriggers(e){const t=[];for(const i of this._triggerGroupMatchers){const n=i.group,s=n.id,r="trigger_activated"===i.triggerStatus(e),o=!0===this._triggerGroupSamplingResults.get(s);r&&t.push({id:s,name:n.name,matched:!0,sampled:o})}this._instance.register_for_session({[ze]:t})}hasPendingTriggers(e){for(const t of this._triggerGroupMatchers)if("trigger_pending"===t.triggerStatus(e))return!0;return!1}getPendingTriggerConditions(e){return this._triggerGroupMatchers.flatMap(t=>"trigger_pending"!==t.triggerStatusNoSideEffects(e)?[]:t.getPendingTriggerConditions(e).map(e=>`trigger group "${t.group.name}": ${e}`))}stop(){var e;null===(e=this._removeEventTriggerCaptureHook)||void 0===e||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._triggerGroupMatchers.forEach(e=>e.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear(),this._urlTriggerMatching.stop()}_checkGroupLevelProperties(e,t){const i=e.group.conditions.properties;return!i||0===i.length||mc(i,t,this._instance.get_property(S))}_setupTriggerGroups(e){this._triggerGroupMatchers.forEach(e=>e.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();for(const t of e){const e=new Fa(this._instance,t,(e,i)=>{this._reportStarted("linked_flag_matched",{flag:e,variant:i,group_id:t.id,group_name:t.name}),this._onTriggerActivated()});this._triggerGroupMatchers.push(e)}}};function Cc(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}const xc=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],Ec=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...xc],Ic="<masked>",Tc=["li_fat_id"];function Mc(e,t,i){if(!n)return{};const s=t?[...xc,...i||[]]:[],r=Pc(so(n.URL,s,Ic),e),o=function(){const e={};return qr(Tc,function(t){const i=Sl(t);e[t]=i||null}),e}();return Hr(o,r)}function Pc(e,t){const i=Ec.concat(t||[]),n={};return qr(i,function(t){const i=no(e,t);n[t]=i||null}),n}function Rc(e){const t=function(e){return e?0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!Pt(t)){s.$search_engine=t;const e=n?no(n.referrer,i):"";e.length&&(s.ph_keyword=e)}return s}function Fc(){return navigator.language||navigator.userLanguage}function Ac(){const e=Fc();return"string"==typeof e?e.split("-")[0]:void 0}const Lc="$direct";function Oc(){return(null==n?void 0:n.referrer)||Lc}function Dc(e,t,i=!1){const n=e?[...xc,...t||[]]:[],r=i?un(null==s?void 0:s.href):null==s?void 0:s.href,o=null==r?void 0:r.substring(0,1e3);return{r:Oc().substring(0,1e3),u:o?so(o,n,Ic):void 0}}function $c(e,t=!1){var i;const{r:n,u:s}=e,r=t?un(s):s,o={$referrer:n,$referring_domain:null==n?void 0:n==Lc?Lc:null===(i=Jr(n))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const e=Jr(r);o.$host=null==e?void 0:e.host,o.$pathname=null==e?void 0:e.pathname;const t=Pc(r);Hr(o,t)}if(n){const e=Rc(n);Hr(o,e)}return o}function Nc(){try{return(new Date).getTimezoneOffset()}catch(e){return}}const Bc=1e5,qc=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Hc=[],zc=()=>!1,Uc="@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(" "),Wc="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),jc="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(" "),Vc="Accommodation AdministrativeArea Country Place State".split(" "),Gc={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:Wc,publisher:jc},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Hc},Offer:{seller:jc},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:jc,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:jc,areaServed:Vc,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Hc}},Qc=[["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(" "),Gc.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Gc.Event],[jc,Gc.Organization],[Vc,Gc.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Gc.Product]];function Kc(e,t){return St.call(e,t)?e[t]:void 0}function Jc(e){const t=typeof e;return Pt(e)||"string"===t||"number"===t||"boolean"===t}function Zc(e,t){return t&&function(e){return Tt(e)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(e.trim())}(e)?t(e.trim())||void 0:e}function Yc(e,t){return kt(e)&&e.every(Jc)?e.map(e=>Zc(e,t)).filter(e=>!It(e)):Jc(e)?Zc(e,t):void 0}function Xc(e,t){if("string"!=typeof e)return;const i=e.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 t(s)?s:void 0}catch(e){return}}function eu(e){if(St.call(Gc,e))return Gc[e];for(const[t,i]of Qc)if(t.includes(e))return i}function tu(e,t,i){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0})}function iu(e,t,i,n){if(kt(e)){const s=e.map(e=>iu(e,t,i,n)).filter(e=>!It(e));return s.length?s:void 0}return nu(e,t,i,n)||void 0}function nu(e,t,i,n){if(!xt(e)||!function(e){return e.remainingNodes?(e.remainingNodes--,!0):(e.exceeded=!0,!1)}(i))return null;const s=Kc(e,"@type"),r=function(e){const t=new Set,i="string"==typeof e?[e]:kt(e)?e:[],n=[];for(const e of i){if("string"!=typeof e)continue;const i=e.replace(/^https?:\/\/schema\.org\//,"");if(100>=i.length&&qc.test(i)&&!t.has(i)&&(t.add(i),n.push(i),20===n.length))break}return n}(s),o=r.filter(e=>!!eu(e)&&(!n||!n.length||n.includes(e))),a={};for(const n of Uc){const o="@type"===n?r.length?"string"==typeof s?r[0]:r:void 0:"@id"===n?Xc(Kc(e,n),t):Yc(Kc(e,n),i.maskUrl);It(o)||tu(a,n,o)}for(const n of o){const s=eu(n);for(const n of Object.keys(s)){const r=Kc(e,n),o=s[n];if(!0===o){const e=Yc(r,i.maskUrl);It(e)||tu(a,n,e)}else{const e=iu(r,t,i,o);It(e)||tu(a,n,e)}}}const l=iu(Kc(e,"@graph"),t,i);return It(l)||tu(a,"@graph",l),Object.keys(a).length?a:null}function su(e,t,i){if(!xt(e))return null;const n=Kc(e,"@context");if("string"!=typeof n||!/^https?:\/\/schema\.org\/?$/.test(n))return null;const s=nu(e,t,i);return s?ct({"@context":"https://schema.org"},s):null}function ru(e){var t;return"SCRIPT"===e.nodeName&&"application/ld+json"===(null===(t=e.getAttribute("type"))||void 0===t?void 0:t.trim().toLowerCase())}function ou(e,t,i){if("string"==typeof t?e.classList.contains(t):t&&Array.from(e.classList).some(e=>(t.lastIndex=0,t.test(e))))return!0;try{return!!i&&e.matches(i)}catch(e){return!1}}function au(e,t,i){for(let n=e;n;){if(ou(n,t,i))return!0;const e=n.parentNode;n=n.parentElement||(e&&e.nodeType===e.DOCUMENT_FRAGMENT_NODE?e.host:null)}return!1}function lu(e){return ru(e)?[e]:e.nodeType!==e.ELEMENT_NODE?[]:Array.from(e.querySelectorAll("script")).filter(ru)}function cu(e){return xt(e)?e.network_timing:e}const uu=Nr("[SessionRecording]"),du=[1,2,3,4,5,6,7,12],hu=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function pu(){var e;return null==d||null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.rrweb}function gu(){var e;return null===(e=pu())||void 0===e?void 0:e.record}function _u(e){try{return JSON.stringify(e)}catch(t){if(t instanceof RangeError)throw t;return JSON.stringify(e,Oa())}}function fu(e){return yl(vl(ml(_u(e))),!0)}function vu(e){return mu.apply(this,arguments)}function mu(){return(mu=rt(function*(e){const t=yield ms(_u(e),Jl.DEBUG,{rethrow:!0});return yl(new Uint8Array(yield t.arrayBuffer()),!0)})).apply(this,arguments)}let yu,bu;const Su="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let wu=!1;function ku(e){var t;return kt(e)&&0===e.length?(yu=null!==(t=yu)&&void 0!==t?t:fu([]),yu):fu(e)}function Cu(e){return xu.apply(this,arguments)}function xu(){return(xu=rt(function*(e){var t;return kt(e)&&0===e.length?yu||(bu=null!==(t=bu)&&void 0!==t?t:vu([]).then(e=>(yu=e,e)).catch(e=>{throw yu=void 0,bu=void 0,e}),bu):vu(e)})).apply(this,arguments)}function Eu(e){return Su&&!wu&&function(e){return 2===e.type||3===e.type&&(0===e.data.source||8===e.data.source)}(e)}function Iu(e){return{event:e,size:$a(e)}}function Tu(e,t){return ct(ct({},e),{},{data:t,cv:"2024-10"})}function Mu(e,t){return ct(ct({},e),{},{cv:"2024-10",data:ct(ct({},e.data),t)})}function Pu(e){try{if(2===e.type)return Iu(Tu(e,fu(e.data)));if(3===e.type&&0===e.data.source)return Iu(Mu(e,{texts:ku(e.data.texts),attributes:ku(e.data.attributes),removes:ku(e.data.removes),adds:ku(e.data.adds)}));if(3===e.type&&8===e.data.source)return Iu(Mu(e,{adds:e.data.adds?fu(e.data.adds):void 0,removes:e.data.removes?fu(e.data.removes):void 0}))}catch(e){uu.warn("could not compress event - will use uncompressed event",e)}return{event:e,size:Da(e)}}function Ru(){return Ru=rt(function*(e){try{if(2===e.type)return Iu(Tu(e,yield vu(e.data)));if(3===e.type&&0===e.data.source){const[t,i,n,s]=yield Promise.all([Cu(e.data.texts),Cu(e.data.attributes),Cu(e.data.removes),Cu(e.data.adds)]);return Iu(Mu(e,{texts:t,attributes:i,removes:n,adds:s}))}if(3===e.type&&8===e.data.source){const[t,i]=yield Promise.all([e.data.adds?vu(e.data.adds):void 0,e.data.removes?vu(e.data.removes):void 0]);return Iu(Mu(e,{adds:t,removes:i}))}}catch(t){return gs(t)&&(wu=!0),uu.warn("could not compress event asynchronously - trying synchronous compression",t),Pu(e)}return{event:e,size:Da(e)}}),Ru.apply(this,arguments)}function Fu(e,t){return 5===e.type&&e.data.tag===t}function Au(e){return Fu(e,"sessionIdle")}function Lu(e){return Fu(e,"$session_ending")}function Ou(e){return Fu(e,"$session_starting")}var Du=class{get sessionId(){return this._sessionId}get _sessionManager(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get _sessionIdleThresholdMilliseconds(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get _isSampled(){return Sc(this._instance.get_property(ue),this.sessionId)}get _sampleRate(){var e;const t=null===(e=this._remoteConfig)||void 0===e?void 0:e.sampleRate;return Ft(t)?t:null}get _minimumDuration(){var e,t;return null!==(e=null===(t=this._strategy)||void 0===t?void 0:t.getMinimumDuration(this.sessionId))&&void 0!==e?e:null}constructor(e,t){this._instance=e,this._endpoint="/s/",this._forceAllowLocalhostNetworkCapture=!1,this._stopRrweb=void 0,this._jsonLdCaptureReady=!1,this._lastActivityTimestamp=Date.now(),this._isActivatingTrigger=!1,this._queuedRRWebEvents=[],this._isIdle="unknown",this._eventsDroppedWhileIdle=0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,this._unstringifiableEventsDropped=0,this._holdFlushUntilInteraction=!1,this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed=!1,this._suppressNextFreshStartHold=!1,this._rrwebError=!1,this._rrwebStartAttempted=!1,this._snapshotCostErrorLogged=!1,this._hasWarnedClientMaskingOverride=!1,this._hasWarnedExclusiveAttributeMasking=!1,this._maskRegionsFnFailed=!1,this._hasLoggedRecorderCallbackError=!1,this._lastFullSnapshotSessionId=void 0,this._fullSnapshotHealAttemptedFor=void 0,this._pendingBufferRestored=!1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueueGeneration=0,this._isStoppingAfterCompression=!1,this._removePageViewCaptureHook=void 0,this._removeEventTriggerCaptureHook=void 0,this._onSessionIdListener=void 0,this._onSessionIdleResetForcedListener=void 0,this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback=(e,t,i)=>{var n,s,r,o;if(!i)return;if(e===this._sessionId&&t===this._windowId)return;const a=!i.noSessionId&&(i.activityTimeout||i.sessionPastMaximumLength),l=this._sessionId,c=this._windowId;var u;if(a&&this._tryAddCustomEvent("$session_ending",{currentSessionId:l,currentWindowId:c,nextSessionId:e,nextWindowId:t,changeReason:i,lastActivityTimestamp:this._lastActivityTimestamp,flushed_size:null===(u=this._flushedSizeTracker)||void 0===u?void 0:u.currentTrackedSize(l)}),null===(n=this._instance.persistence)||void 0===n||n.unregister("$debug_first_full_snapshot_timestamp"),null===(s=pu())||void 0===s||null===(r=s.resetMaxDepthState)||void 0===r||r.call(s),this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:i}),this._clearConditionalRecordingPersistence(),!(!1===this._isIdle&&this.isStarted||this._sessionId===e&&this._windowId===t)){const t=this._sessionId!==e&&!1!==this._isIdle;this._isIdle="unknown",this._restartForSessionIdChange(t)}a&&this._tryAddCustomEvent("$session_starting",{previousSessionId:l,previousWindowId:c,nextSessionId:e,nextWindowId:t,changeReason:i,lastActivityTimestamp:this._lastActivityTimestamp}),null===(o=this._strategy)||void 0===o||o.makeSamplingDecisions(e)},this._isRestartingForSessionIdChange=!1,this._hasPassedMinimumDuration=()=>{var e;return(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[de])===this._sessionId},this._getBufferDuration=()=>{var e,t;if(0===this._buffer.data.length)return null;const i=null===(e=this._buffer.data[0])||void 0===e?void 0:e.timestamp,n=null===(t=this._buffer.data[this._buffer.data.length-1])||void 0===t?void 0:t.timestamp;return Ft(i)&&Ft(n)?n-i:null},this._isBelowMinimumDuration=()=>{var e,t;const i=this._minimumDuration;if(!Ft(i))return!1;if(null===(e=null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.strictMinimumDuration)||void 0===e||!e){const e=this._sessionDuration;return Ft(e)&&e>=0&&i>e}if(this._hasPassedMinimumDuration())return!1;const n=this._getBufferDuration();return!!Pt(n)||i>n||(null===(s=this._instance.persistence)||void 0===s||s.register({$session_past_minimum_duration:this._sessionId}),!1);var s},this._onBeforeUnload=()=>{"buffering"!==this.status?(this._holdFlushUntilInteraction&&this._heldEpochShipsOnUnload&&this._documentWasEverVisible&&(this._setFlushHold(void 0),this._heldBufferOverflowed&&(this._heldBufferOverflowed=!1,this._tryTakeFullSnapshot())),this._drainCompressionQueueSync(),this._flushBuffer(!0)):this._clearBuffer()},this._onPageHide=()=>{this._onBeforeUnload()},this._onOffline=()=>{this._tryAddCustomEvent("browser offline",{})},this._onOnline=()=>{this._tryAddCustomEvent("browser online",{})},this._onVisibilityChange=()=>{(null==n?void 0:n.visibilityState)&&("visible"===n.visibilityState&&(this._documentWasEverVisible=!0),this._tryAddCustomEvent("window "+n.visibilityState,{}))},this._documentWasEverVisible=null==t||t;const{sessionId:i,windowId:s,sessionStartTimestamp:r}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=i,this._windowId=s,this._sessionStartTimestamp=r,this._linkedFlagMatching=new Pa(this._instance),this._urlTriggerMatching=new Ma(this._instance),this._eventTriggerMatching=new Ra(this._instance),this._buffer=this._clearBuffer(),this._pendingBufferStorageKey="ph_replay_pending_buffer_"+JSON.stringify([this._instance.config.persistence_name||this._instance.config.token,this._instance.config.token]),this._sessionManager.sessionTimeoutMs>this._sessionIdleThresholdMilliseconds||uu.warn(`session_idle_threshold_ms (${this._sessionIdleThresholdMilliseconds}) is greater than the session timeout (${this._sessionManager.sessionTimeoutMs}). Session will never be detected as idle`),this._flushedSizeTracker=new Zl(this._instance)}setDocumentWasEverVisible(e){e&&(this._documentWasEverVisible=!0)}get _masking(){var e,t,i,n,s,r,o,a,l;const c=null===(e=this._remoteConfig)||void 0===e?void 0:e.masking,u={maskAllInputs:null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.maskAllInputs,maskTextSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.maskTextSelector,blockSelector:null===(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},d=null!==(r=null==u?void 0:u.maskAllInputs)&&void 0!==r?r:null==c?void 0:c.maskAllInputs,h=null!==(o=null==u?void 0:u.maskTextSelector)&&void 0!==o?o:null==c?void 0:c.maskTextSelector,p=null!==(a=null==u?void 0:u.blockSelector)&&void 0!==a?a:null==c?void 0:c.blockSelector,g=null!==(l=null==u?void 0:u.maskAllElementAttributes)&&void 0!==l?l:null==c?void 0:c.maskAllElementAttributes;return It(d)&&It(h)&&It(p)&&It(g)?void 0:{maskAllInputs:null==d||d,maskTextSelector:h,blockSelector:p,maskAllElementAttributes:g}}_warnIfClientMaskingShadowsServer(){var e;if(this._hasWarnedClientMaskingOverride)return;const t=null===(e=this._remoteConfig)||void 0===e?void 0:e.masking;if(Rt(t))return;const i=this._instance.config.session_recording,n=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(e=>{const n=null==i?void 0:i[e],s=t[e];return!It(n)&&n!==s});0!==n.length&&(this._hasWarnedClientMaskingOverride=!0,uu.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:t}))}get _canvasResolutionScale(){var e;return Kt(null===(e=this._instance.config.session_recording.canvasCapture)||void 0===e?void 0:e.resolutionScale,.1,1,Nr("canvas recording resolution scale"),1)}get _canvasRecording(){var e,t,i,n,s,r,o;const a=this._instance.config.session_recording.captureCanvas,l=null===(e=this._remoteConfig)||void 0===e?void 0:e.canvasRecording,c=null!==(t=null!==(i=null==a?void 0:a.recordCanvas)&&void 0!==i?i:null==l?void 0:l.enabled)&&void 0!==t&&t,u=null!==(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 d=null!==(r=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==r?r:.4;if("string"==typeof d){const e=parseFloat(d);d=isNaN(e)?.4:e}return{enabled:c,fps:Kt(u,0,12,Nr("canvas recording fps"),4),quality:Kt(d,0,1,Nr("canvas recording quality"),.4)}}get _isConsoleLogCaptureEnabled(){var e;const t=!!(null===(e=this._remoteConfig)||void 0===e?void 0:e.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return null!=i?i:t}get _networkPayloadCapture(){var e,t,i;const n=null===(e=this._remoteConfig)||void 0===e?void 0:e.networkPayloadCapture,s={recordHeaders:null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.recordHeaders,recordBody:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.recordBody},r=!1!==s.recordHeaders&&(s.recordHeaders||(null==n?void 0:n.recordHeaders)),o=!1!==s.recordBody&&(s.recordBody||(null==n?void 0:n.recordBody)),a=cu(this._instance.config.capture_performance),l=cu(null==n?void 0:n.capturePerformance),c=!!(Lt(a)?a:l);return r||o||c?{recordHeaders:r,recordBody:o,recordPerformance:c}:void 0}_gatherRRWebPlugins(){var e,t;const i=[],n=null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordConsolePlugin;n&&this._isConsoleLogCaptureEnabled&&i.push(n());const r=null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordNetworkPlugin;if(this._networkPayloadCapture&&Ct(r))if(!eo.includes(s.hostname)||this._forceAllowLocalhostNetworkCapture){const e=Ct(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(r(ct(ct({},((e,t,i)=>{const n={payloadSizeLimitBytes:ia.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...ia.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...ia.payloadHostDenyList]},s=!1!==e.session_recording.recordHeaders&&t.recordHeaders,r=!1!==e.session_recording.recordBody&&t.recordBody,o=!1!==e.capture_performance&&t.recordPerformance,a=(e=>{const t=ta(e);return e=>((null==e?void 0:e.requestBody)&&(e.requestBody=la(e.requestBody,e.requestHeaders,t,"Request")),(null==e?void 0:e.responseBody)&&(e.responseBody=la(e.responseBody,e.responseHeaders,t,"Response")),e)})(n),l=t=>{return a(((e,t,i)=>{var n;if(null==i?void 0:i(e.name))return;const s=Jr(e.name);let r=0===t.indexOf("http")?null===(n=Jr(t))||void 0===n?void 0:n.pathname:t;"/"===r&&(r="");const o=null==s?void 0:s.pathname.replace(r||"","");return s&&o&&aa.some(e=>0===o.indexOf(e))?void 0:e})((oa((n=t).requestHeaders),oa(n.responseHeaders),n),e.api_host,i));var n},c=Ct(e.session_recording.maskNetworkRequestFn);return c&&Ct(e.session_recording.maskCapturedNetworkRequestFn)?$r.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."):c&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{const i=e.session_recording.maskNetworkRequestFn({url:t.name});if(i||!t.isInitial)return ct(ct({},t),{},{name:null==i?void 0:i.url})}),n.maskRequestFn=Ct(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var i,n;const s=l(t);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=e.session_recording).maskCapturedNetworkRequestFn)||void 0===i?void 0:i.call(n,s);return Rt(o)&&r?(ua.add(r),r):null!=o?o:void 0}:e=>function(e){if(!It(e))return e.requestBody=ca(e.requestBody,"Request"),e.responseBody=ca(e.responseBody,"Response"),e}(l(e)),ct(ct(ct({},ia),n),{},{recordHeaders:s,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===e.session_recording.streamNetworkBody})})(this._instance.config,this._networkPayloadCapture,e)),{},{captureFetchSynchronously:!0===this._instance.config.__preview_replay_sync_fetch})))}else uu.info("NetworkCapture not started because we are on localhost.");return i}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?un(e):e}_maskReplayUrl(e,t=!1){const i=t?un(e):this._stripUrlHash(e),n=this._instance.config.mask_personal_data_properties?[...xc,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(so(i,n,Ic))}_maskUrl(e){const t=this._instance.config.session_recording;if(t.maskCapturedNetworkRequestFn){var i;const n=t.maskCapturedNetworkRequestFn({name:e});return null!==(i=null==n?void 0:n.name)&&void 0!==i?i:null==n?void 0:n.url}if(t.maskNetworkRequestFn){const i=t.maskNetworkRequestFn({url:e});return null==i?void 0:i.url}return e}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return 10>this._queuedRRWebEvents.length?this._queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt+1,rrwebMethod:e.rrwebMethod}):uu.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(hu(()=>gu().addCustomEvent(e,t)))}_canCaptureJsonLd(){var e;return this._jsonLdCaptureReady&&!0===(null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.captureJsonLd)&&!this._urlTriggerMatching.urlBlocked&&!0!==this._isIdle}_tryAddJsonLdEvent(e){if(!this._canCaptureJsonLd())return!1;try{const t=gu();return!!t&&(t.addCustomEvent("$json_ld",e),this._canCaptureJsonLd())}catch(e){return!1}}_scheduleJsonLdScan(e=!1){Promise.resolve().then(()=>{var t;return null===(t=this._jsonLdCapture)||void 0===t?void 0:t.scan(e)})}_pageViewFallBack(){try{if(this._instance.config.capture_pageview||!e)return;const t=new URL(e.location.href),i=this._maskReplayUrl(t.origin+t.pathname+t.search);this._lastHref!==i&&(this._lastHref=i,this._tryAddCustomEvent("$url_changed",{href:i}))}catch(e){}}_processQueuedEvents(){if(this._queuedRRWebEvents.length){const e=[...this._queuedRRWebEvents];this._queuedRRWebEvents=[],e.forEach(e=>{Date.now()-e.enqueuedAt>2e3||this._tryRRWebMethod(e)})}}_tryTakeFullSnapshot(){return this._tryRRWebMethod(hu(()=>gu().takeFullSnapshot()))}get _fullSnapshotIntervalMillis(){var e,t,i;if((null===(e=this._strategy)||void 0===e?void 0:e.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var n;const e=null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.trigger_pending_buffer_interval_millis;return Ft(e)&&Number.isFinite(e)&&e>=1e3&&36e5>=e?e:6e4}return null!==(t=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.full_snapshot_interval_millis)&&void 0!==t?t:3e5}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!0===this._isIdle)return;const e=this._fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},e))}_onTriggerActivated(e){"event"===e&&this._releaseHoldAndFlush(),!this._urlTriggerMatching.urlBlocked&&["sampled","active"].includes(this.status)&&this._scheduleFullSnapshot()}_pauseRecording(){var e;this._urlTriggerMatching.urlBlocked||(this._urlTriggerMatching.urlBlocked=!0,null===(e=this._jsonLdCapture)||void 0===e||e.scan(),clearInterval(this._fullSnapshotTimer),uu.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e;this._urlTriggerMatching.urlBlocked&&(null===(e=this._jsonLdCapture)||void 0===e||e.scan(),this._urlTriggerMatching.urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),uu.info("recording resumed"))}_activateTrigger(e,t){var i;if("event"===e&&this._releaseHoldAndFlush(),!this._isActivatingTrigger&&(null===(i=this._strategy)||void 0===i?void 0:i.hasPendingTriggers(this.sessionId))){this._isActivatingTrigger=!0;try{var n,s;const i="url"===e?he:pe;null===(n=this._instance.persistence)||void 0===n||n.register({[i]:this.sessionId}),null===(s=this._strategy)||void 0===s||s.updateActiveTriggers(this.sessionId),this._onTriggerActivated(),this._flushBuffer(),this._reportStarted(e+"_trigger_matched",{["url"===e?"matchedUrl":"matchedEvent"]:t})}finally{this._isActivatingTrigger=!1}}}get isStarted(){return!!this._stopRrweb}get _remoteConfig(){const e=this._instance.get_property(ie);if(!e)return;let t;try{t=xt(e)?e:JSON.parse(e)}catch(e){return void uu.warn("persisted remote config for session recording is invalid and will be ignored",e)}if(!this.isStarted&&!this._isRestartingForSessionIdChange){var i;const n=null!==(i=t.cache_timestamp)&&void 0!==i?i:Date.now();if(Date.now()-n>36e5)return void uu.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:e})}return t}_checkOverride(e,t,i){this._instance.get_property(e)&&(t(),i())}start(t){var i,s;const r=this._remoteConfig;if(!r)return void uu.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const e=!1!==this._isIdle&&!this._suppressNextFreshStartHold;this._setFlushHold(e?"no_interaction_since_recording_started":void 0),this._suppressNextFreshStartHold=!1,this._heldEpochShipsOnUnload=e,this._heldBufferOverflowed=!1}this._isStoppingAfterCompression&&(this._invalidateCompressionQueue(),this._clearBuffer());const{sessionId:o,windowId:a,sessionStartTimestamp:l}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=o,this._windowId=a,this._sessionStartTimestamp=l,this._restorePendingBuffer(),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),(null==r?void 0:r.endpoint)&&(this._endpoint=null==r?void 0:r.endpoint),this._strategy=2===(null==r?void 0:r.version)&&(null==r?void 0:r.triggerGroups)&&r.triggerGroups.length>0?new kc(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this),this._onTriggerActivated.bind(this)):new wc(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.bind(this),this._onTriggerActivated.bind(this)),this._strategy.onRemoteConfig(r),null===(s=this._removeEventTriggerCaptureHook)||void 0===s||s.call(this),this._removeEventTriggerCaptureHook=this._strategy.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(e,t)=>this._activateTrigger(e,t)),this._checkOverride(re,()=>{this.overrideSampling()},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(re)}),this._checkOverride(oe,()=>{this.overrideLinkedFlag()},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(oe)}),this._checkOverride(le,()=>{this.overrideTrigger("event")},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(le)}),this._checkOverride(ae,()=>{this.overrideTrigger("url")},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(ae)}),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(Qr(e,"beforeunload",this._onBeforeUnload),Qr(e,"pagehide",this._onPageHide),Qr(e,"offline",this._onOffline),Qr(e,"online",this._onOnline),Qr(n,"visibilitychange",this._onVisibilityChange),!this._onSessionIdListener&&Ct(this._sessionManager.onSessionId)&&(this._onSessionIdListener=this._sessionManager.onSessionId(this._onSessionIdCallback)),!this._onSessionIdleResetForcedListener&&Ct(this._sessionManager.on)?this._onSessionIdleResetForcedListener=this._sessionManager.on("forcedIdleReset",()=>{this._clearConditionalRecordingPersistence(),this._isIdle="unknown",this.stop(),this._forceIdleSessionIdListener=this._sessionManager.onSessionId((e,t,i)=>{var n;null===(n=this._forceIdleSessionIdListener)||void 0===n||n.call(this),this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback(e,t,i)})}):Ct(this._sessionManager.on)||uu.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Rt(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this._instance.on("eventCaptured",e=>{try{if("$pageview"===e.event){const t=(null==e?void 0:e.properties.$current_url)?this._maskReplayUrl(e.properties.$current_url):"";if(!t)return;this._tryAddCustomEvent("$pageview",{href:t})}}catch(e){uu.error("Could not add $pageview to rrweb session",e)}})),"active"===this.status&&this._reportStarted(t||"recording_initialized"))}_teardown(){var t,i,s,r,o,a;null==e||e.removeEventListener("beforeunload",this._onBeforeUnload),null==e||e.removeEventListener("pagehide",this._onPageHide),null==e||e.removeEventListener("offline",this._onOffline),null==e||e.removeEventListener("online",this._onOnline),null==n||n.removeEventListener("visibilitychange",this._onVisibilityChange),clearInterval(this._fullSnapshotTimer),this._clearFlushBufferTimer(),null===(t=this._removePageViewCaptureHook)||void 0===t||t.call(this),this._removePageViewCaptureHook=void 0,null===(i=this._removeEventTriggerCaptureHook)||void 0===i||i.call(this),this._removeEventTriggerCaptureHook=void 0,null===(s=this._onSessionIdListener)||void 0===s||s.call(this),this._onSessionIdListener=void 0,null===(r=this._onSessionIdleResetForcedListener)||void 0===r||r.call(this),this._onSessionIdleResetForcedListener=void 0,null===(o=this._forceIdleSessionIdListener)||void 0===o||o.call(this),this._forceIdleSessionIdListener=void 0,null===(a=this._strategy)||void 0===a||a.stop(),this._stopRecordingProducers(),this._invalidateCompressionQueue()}_invalidateCompressionQueue(){this._compressionQueueGeneration+=1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueue=void 0,this._isStoppingAfterCompression=!1}_stopRecordingProducers(){var e,t;null===(e=this._mutationThrottler)||void 0===e||e.stop(),this._queuedRRWebEvents=[],null===(t=this._jsonLdCapture)||void 0===t||t.stop(),this._jsonLdCapture=void 0,this._jsonLdCaptureReady=!1;try{var i;null===(i=this._stopRrweb)||void 0===i||i.call(this)}catch(e){uu.warn("could not stop rrweb",e)}this._stopRrweb=void 0}_stopAfterCompressionQueueDrains(){if(!this._compressionQueue||0===this._queuedCompressionEvents)return!1;if(this._isStoppingAfterCompression)return!0;this._isStoppingAfterCompression=!0,this._flushHoldReason=void 0;const e=this._compressionQueueGeneration;return this._clearFlushBufferTimer(),this._stopRecordingProducers(),this._compressionQueue.catch(()=>{}).then(()=>{e===this._compressionQueueGeneration&&(this._isStoppingAfterCompression=!1,this._flushBuffer(),this._clearBuffer(),this._releaseHoldAfterStop(),this._teardown(),uu.info("stopped"))}).catch(()=>{this._isStoppingAfterCompression=!1,this._releaseHoldAfterStop(),this._teardown(),uu.info("stopped")}),!0}stop(){if(this._stopRecordingProducers(),this._isRestartingForSessionIdChange)this._drainCompressionQueueSync();else if(this._stopAfterCompressionQueueDrains())return;this._flushBuffer(),this._clearBuffer(),this._releaseHoldAfterStop(),this._teardown(),uu.info("stopped")}_releaseHoldAfterStop(){this._setFlushHold(void 0,{preserveLogDedup:this._isRestartingForSessionIdChange}),this._heldEpochShipsOnUnload=!1}flushBeforeIdentityReset(){(this.isStarted||this._isStoppingAfterCompression)&&(this._drainCompressionQueueSync(),this._flushBuffer())}_restartForSessionIdChange(e){this._isRestartingForSessionIdChange=!0,this._lastActivityTimestamp=Date.now();try{var t,i;this.stop(),this._lastSeenSnapshotCost=void 0,this._unstringifiableEventsDropped=0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,null===(t=pu())||void 0===t||null===(i=t.resetSnapshotCostState)||void 0===i||i.call(t),this.start("session_id_changed")}finally{this._isRestartingForSessionIdChange=!1}this._setFlushHold(e?"no_interaction_since_session_rotated":void 0),this._heldEpochShipsOnUnload=!1}_setFlushHold(e,{preserveLogDedup:t=!1}={}){if(this._holdFlushUntilInteraction=!It(e),this._flushHoldReason=e,It(e))return void(t||(this._lastLoggedFlushHold=void 0));if(this._isRestartingForSessionIdChange)return;const i=`${this.sessionId}:${e}`;i!==this._lastLoggedFlushHold&&(this._lastLoggedFlushHold=i,uu.info(`holding buffer: ${e}. nothing is uploaded until the user interacts with the page`))}_releaseHoldAndFlush(){this.isStarted||(this._suppressNextFreshStartHold=!0),this._holdFlushUntilInteraction&&(this._setFlushHold(void 0),this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed&&(this._heldBufferOverflowed=!1,this._tryTakeFullSnapshot()),this._scheduleFlushBuffer())}discard({discardProducerEvents:e=!1}={}){this._holdFlushUntilInteraction=!0,e&&(this._clearBuffer(),this._stopRecordingProducers()),this._clearBuffer(),this._teardown(),this._clearBuffer(),this._releaseHoldAfterStop(),uu.info("discarded")}_captureProcessedEvent(e,t,i,n,s){if(-1===i)return this._unstringifiableEventsDropped+=1,void uu.warn("could not stringify event - dropping it to keep the rest of the recording");const r={$snapshot_bytes:i,$snapshot_data:t,$session_id:n,$window_id:s};"disabled"!==this.status?(this._ensureFullSnapshotForSession(e,n),this._captureSnapshotBuffered(r)):this._clearBuffer()}_safeTrackFullSnapshotCost(){try{this._trackFullSnapshotCost()}catch(e){this._snapshotCostErrorLogged||(this._snapshotCostErrorLogged=!0,uu.error("could not track full snapshot cost",e))}}_trackFullSnapshotCost(){var e,t;const i=null===(e=pu())||void 0===e||null===(t=e.getLastSnapshotCost)||void 0===t?void 0:t.call(e);i&&i!==this._lastSeenSnapshotCost&&(this._lastSeenSnapshotCost=i,500>i.durationMs||uu.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(i.durationMs),stylesheetMs:Math.round(i.stylesheetMs),nodeCount:i.nodeCount,cssRuleCount:i.cssRuleCount,nonDeferrableCssRuleCount:i.nonDeferrableCssRuleCount,deferredStylesheetCount:i.deferredStylesheetCount}))}_ensureFullSnapshotForSession(e,t){2!==e.type?3===e.type&&(It(this._lastFullSnapshotSessionId)||this._lastFullSnapshotSessionId===t||this._fullSnapshotHealAttemptedFor===t||(this._fullSnapshotHealAttemptedFor=t,uu.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:t}),this._tryTakeFullSnapshot())):this._lastFullSnapshotSessionId=t}_finishQueuedCompressionEvent(e){e.counted&&e.generation===this._compressionQueueGeneration&&(this._queuedCompressionEvents=Math.max(0,this._queuedCompressionEvents-1)),e.counted=!1,this._pendingCompressionEvents=this._pendingCompressionEvents.filter(t=>t!==e)}_captureQueuedCompressionEvent(e,t,i){e.processed||e.generation!==this._compressionQueueGeneration||(e.processed=!0,this._captureProcessedEvent(e.event,t,i,e.targetSessionId,e.targetWindowId))}_processQueuedCompressionEventSync(e){try{let t,i=e.event;if(e.compressionEnabled)try{({event:i,size:t}=Pu(e.event))}catch(e){uu.warn("could not process queued compression event - will use uncompressed event",e)}It(t)&&(t=Da(e.event));try{this._captureQueuedCompressionEvent(e,i,t)}catch(e){uu.warn("could not capture queued compression event",e)}}finally{this._finishQueuedCompressionEvent(e)}}_drainCompressionQueueSync(){[...this._pendingCompressionEvents].forEach(e=>{try{this._processQueuedCompressionEventSync(e)}catch(e){uu.warn("could not drain queued compression event",e)}})}_enqueueCompression(e,t,i,n){var s=this;const r={event:e,compressionEnabled:t,targetSessionId:i,targetWindowId:n,generation:this._compressionQueueGeneration,processed:!1,counted:!0};this._pendingCompressionEvents.push(r),this._queuedCompressionEvents+=1;const o=(a=rt(function*(){try{if(r.processed)return;let i,n;try{const s=t?Eu(e)?yield function(e){return Ru.apply(this,arguments)}(e):Pu(e):{event:e,size:Da(e)};i=s.event,n=s.size}catch(t){uu.warn("could not process queued compression event - will use uncompressed event",t),i=e,n=Da(e)}s._captureQueuedCompressionEvent(r,i,n)}finally{s._finishQueuedCompressionEvent(r)}}),function(){return a.apply(this,arguments)});var a;this._compressionQueue=this._compressionQueue?this._compressionQueue.catch(()=>{}).then(o):o()}onRRwebEmit(t){var i,n,s,r,o,a,l,c,u,d,h;if(!this._instance.sessionManager)return;if(this._processQueuedEvents(),!t||!xt(t))return;if(4===t.type){const e=this._maskReplayUrl(t.data.href);if(this._lastHref=e,!e)return;t.data.href=e}else this._pageViewFallBack();if(null===(i=this._strategy)||void 0===i||i.checkUrlTriggers(this.sessionId,()=>this._pauseRecording(),()=>this._resumeRecording(),(e,t)=>this._activateTrigger(e,t)),this._urlTriggerMatching.urlBlocked&&!function(e){return 5===e.type&&"recording paused"===e.data.tag}(t))return;2===t.type&&(this._safeTrackFullSnapshotCost(),Promise.resolve().then(()=>this._safeTrackFullSnapshotCost()),this._scheduleFullSnapshot(),null===(d=this._mutationThrottler)||void 0===d||d.reset(),null===(h=this._instance.persistence)||void 0===h||h.register_once({$debug_first_full_snapshot_timestamp:t.timestamp},void 0));const p=2===t.type&&(null===(n=this._strategy)||void 0===n?void 0:n.hasPendingTriggers(this.sessionId));p&&this._clearBufferBeforeMostRecentMeta();const g=this._mutationThrottler?this._mutationThrottler.throttleMutations(t):t;if(!g)return void(!0===this._isIdle&&this._eventsDroppedWhileIdle++);const _=function(e){const t=e;if(t&&xt(t)&&6===t.type&&xt(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));const i=[];for(let e=0;t.data.payload.payload.length>e;e++)i.push(t.data.payload.payload[e]&&t.data.payload.payload[e].length>2e3?t.data.payload.payload[e].slice(0,2e3)+"...[truncated]":t.data.payload.payload[e]);return t.data.payload.payload=i,e}return e}(g),f=function(e){return Lu(e)?e.data.payload:null}(_),v=function(e){return Ou(e)?e.data.payload:null}(_),m=function(e){return Au(e)?e.data.payload:null}(_);f||v?(null==f?void 0:f.lastActivityTimestamp)&&(_.timestamp=f.lastActivityTimestamp):(null==m?void 0:m.sessionId)||this._updateWindowAndSessionIds(_);const y=null!==(s=null!==(r=null!==(o=null==f?void 0:f.currentSessionId)&&void 0!==o?o:null==v?void 0:v.nextSessionId)&&void 0!==r?r:null==m?void 0:m.sessionId)&&void 0!==s?s:this._sessionId,b=null!==(a=null!==(l=null!==(c=null==f?void 0:f.currentWindowId)&&void 0!==c?c:null==v?void 0:v.nextWindowId)&&void 0!==l?l:null==m?void 0:m.windowId)&&void 0!==a?a:this._windowId;if(!0===this._isIdle&&!function(e){return Au(e)||Lu(e)||Ou(e)}(_))return void(function(e){return 2===e.type||4===e.type||3===e.type&&9!==e.data.source}(_)&&this._eventsDroppedWhileIdle++);2===_.type&&(this._eventsDroppedWhileIdle=0),m&&(_.timestamp=m.lastActivityTimestamp+m.threshold);const S=this._jsonLdCaptureReady;this._jsonLdCaptureReady=!0,p?this._scheduleJsonLdScan(!0):S||this._scheduleJsonLdScan();const w=null===(u=this._instance.config.session_recording.compress_events)||void 0===u||u;if(5===_.type&&"$json_ld"===_.data.tag){let t;try{t=e?this._maskReplayUrl(e.location.href):void 0}catch(e){}_.data.href=t}if(this._queuedCompressionEvents>0||w&&Eu(_))return void this._enqueueCompression(_,w,y,b);const{event:k,size:C}=w?Pu(_):{event:_,size:Da(_)};this._captureProcessedEvent(_,k,C,y,b)}get status(){return this._strategy?this._strategy.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this._isSampled,rrwebError:this._rrwebError,urlTriggerMatching:this._urlTriggerMatching,eventTriggerMatching:this._eventTriggerMatching,linkedFlagMatching:this._linkedFlagMatching,remoteConfig:this._remoteConfig}):da}log(e,t="log"){var i;null===(i=this._instance.sessionRecording)||void 0===i||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}overrideLinkedFlag(){this._linkedFlagMatching.linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null===(e=this._instance.persistence)||void 0===e||e.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e),this._releaseHoldAndFlush()}_currentMaskedHostname(){try{var t;const i=null==e||null===(t=e.location)||void 0===t?void 0:t.href;if(!i)return;const n=this._maskReplayUrl(i);if(!n)return;return new URL(n).hostname||void 0}catch(e){return}}_clearFlushBufferTimer(){this._flushBufferTimer&&(clearTimeout(this._flushBufferTimer),this._flushBufferTimer=void 0)}_scheduleFlushBuffer(){this._flushBufferTimer||(this._flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_wouldOpenRecordingWithMarkersOnly(){return this._lastFullSnapshotSessionId!==this._buffer.sessionId&&0!==this._buffer.data.length&&this._buffer.data.every(e=>5===(null==e?void 0:e.type)&&!Lu(e)&&!Ou(e))}_describePendingTriggerConditions(){var e,t;return null!==(e=null===(t=this._strategy)||void 0===t?void 0:t.getPendingTriggerConditions(this.sessionId))&&void 0!==e?e:[]}_maybeLogBufferingReason(e){if("buffering"!==e)return It(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Ue]:[]}),void(this._lastLoggedBufferingReason=void 0);const t=this._describePendingTriggerConditions();if(0===t.length)return It(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Ue]:[]}),void(this._lastLoggedBufferingReason=void 0);const i=t.join(", "),n=`${this.sessionId}:${i}`;n!==this._lastLoggedBufferingReason&&(this._lastLoggedBufferingReason=n,this._instance.register_for_session({[Ue]:t}),uu.info(`buffering: ${i}`))}_canParkPendingBuffer(){var e;return"memory"!==this._instance.config.persistence&&!0!==(null===(e=this._instance.persistence)||void 0===e?void 0:e._disabled)&&Kl._is_supported()}_parkBufferForNextPage(){0!==this._buffer.data.length&&this._buffer.size!==this._lastParkedBufferSize&&943718.4>=this._buffer.size&&this._canParkPendingBuffer()&&(this._lastParkedBufferSize=this._buffer.size,Kl._set(this._pendingBufferStorageKey,this._buffer))}_restorePendingBuffer(){if(this._pendingBufferRestored||!this._canParkPendingBuffer())return;this._pendingBufferRestored=!0;const e=Kl._parse(this._pendingBufferStorageKey);Kl._remove(this._pendingBufferStorageKey),xt(e)&&kt(e.data)&&0!==e.data.length&&kt(e.sizes)&&e.sizes.length===e.data.length&&Ft(e.size)&&e.sessionId===this._sessionId&&e.windowId===this._windowId&&(this._buffer.data.length>0||(this._buffer=e))}_flushBuffer(e=!1){var t;if(this._clearFlushBufferTimer(),this._holdFlushUntilInteraction)return this._buffer;if(this._wouldOpenRecordingWithMarkersOnly())return this._buffer.size>943718.4?this._clearBuffer():(e&&this._parkBufferForNextPage(),this._buffer);const i=this._buffer;null===(t=this._strategy)||void 0===t||t.ensureSamplingDecision(this.sessionId);const n=this._isBelowMinimumDuration(),s=this.status;if(this._maybeLogBufferingReason(s),"buffering"===s||"paused"===s||"disabled"===s||n)return!e||"active"!==s&&"sampled"!==s||this._parkBufferForNextPage(),this._scheduleFlushBuffer(),this._buffer;if(this._buffer!==i)return this._buffer;if(i.data.length>0){var r;const e=this._currentMaskedHostname();Na(i).forEach(t=>{try{var i;null===(i=this._flushedSizeTracker)||void 0===i||i.trackSize(t.sessionId,t.size),this._captureSnapshot(ct(ct(ct(ct({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:Jl.LIB_NAME,$lib_version:Jl.LIB_VERSION,$snapshot_host:e},this._throttledMutationsDropped>0?{$sdk_debug_replay_throttled_mutations_dropped:this._throttledMutationsDropped}:{}),this._oversizedMutationsDropped>0?{$sdk_debug_replay_oversized_mutations_dropped:this._oversizedMutationsDropped}:{}),this._oversizedMutationBytesDropped>0?{$sdk_debug_replay_oversized_mutation_bytes_dropped:this._oversizedMutationBytesDropped}:{}),this._unstringifiableEventsDropped>0?{$sdk_debug_replay_unstringifiable_events_dropped:this._unstringifiableEventsDropped}:{}))}catch(e){uu.warn("could not capture snapshot chunk - skipping it",e)}}),It(this._lastParkedBufferSize)||(Kl._remove(this._pendingBufferStorageKey),this._lastParkedBufferSize=void 0),null===(r=this._strategy)||void 0===r||r.onFlushComplete()}return this._clearBuffer()}_captureSnapshotBuffered(e){var t;const i=2+((null===(t=this._buffer)||void 0===t?void 0:t.data.length)||0),n=e.$session_id,s=this._buffer.sessionId!==n;if(s||!0!==this._isIdle&&!this._holdFlushUntilInteraction&&this._buffer.size+e.$snapshot_bytes+i>943718.4){const t=this._sessionId;if(this._buffer=this._flushBuffer(),this._sessionId!==t)return;s&&this._buffer.data.length>0&&(this._buffer=this._clearBuffer()),this._buffer.sessionId=n,this._buffer.windowId=e.$window_id}this._holdFlushUntilInteraction&&(this._heldBufferOverflowed||this._buffer.size+e.$snapshot_bytes+i>943718.4)?this._heldBufferOverflowed=!0:(this._buffer.size+=e.$snapshot_bytes,this._buffer.data.push(e.$snapshot_data),this._buffer.sizes.push(e.$snapshot_bytes),!0===this._isIdle||this._holdFlushUntilInteraction||this._scheduleFlushBuffer())}_captureSnapshot(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get _sessionDuration(){var e,t;const i=null===(e=this._buffer)||void 0===e?void 0:e.data[(null===(t=this._buffer)||void 0===t?void 0:t.data.length)-1];return i?i.timestamp-this._sessionStartTimestamp:null}_clearBufferBeforeMostRecentMeta(){if(!this._buffer||0===this._buffer.data.length)return this._clearBuffer();let e=-1;for(let t=this._buffer.data.length-1;t>=0;t--)if(4===this._buffer.data[t].type){e=t;break}return 0>e?this._clearBuffer():(this._buffer.data=this._buffer.data.slice(e),this._buffer.sizes=this._buffer.sizes.slice(e),this._buffer.size=this._buffer.sizes.reduce((e,t)=>e+t,0),this._buffer)}_clearBuffer(){return this._buffer={size:0,data:[],sizes:[],sessionId:this._sessionId,windowId:this._windowId},this._buffer}_reportStarted(e,t){this._instance.register_for_session({[Ke]:e}),uu.info(e.replace("_"," "),t),"session_id_changed"!==e&&this._tryAddCustomEvent("$recording_started",ct({reason:e},t))}_isInteractiveEvent(e){var t;return 3===e.type&&-1!==du.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}_updateWindowAndSessionIds(e){const t=this._isInteractiveEvent(e);t||!0===this._isIdle||e.timestamp-this._lastActivityTimestamp>this._sessionIdleThresholdMilliseconds&&(this._isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this._sessionIdleThresholdMilliseconds,bufferLength:this._buffer.data.length,bufferSize:this._buffer.size,sessionId:this._sessionId,windowId:this._windowId}),this._flushBuffer());const{windowId:i,sessionId:n}=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp);let s=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this._isIdle)){const t="unknown"===this._isIdle;this._isIdle=!1,t||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),s=!0)}const r=this._sessionId!==n,o=this._windowId!==i;if(this._windowId=i,this._sessionId=n,r||o){const e=r&&!1!==this._isIdle;e&&(this._isIdle="unknown"),this._restartForSessionIdChange(e)}else if(t&&this._releaseHoldAndFlush(),s){var a;const e=["sampled","active"].includes(this.status)||(null===(a=this._strategy)||void 0===a?void 0:a.hasPendingTriggers(this.sessionId));this._eventsDroppedWhileIdle>0&&e&&this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot()}}_clearConditionalRecordingPersistence(){var e;null===(e=this._strategy)||void 0===e||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e;return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this._flushHoldReason,$sdk_debug_replay_internal_buffer_length:this._buffer.data.length,$sdk_debug_replay_internal_buffer_size:this._buffer.size,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(e=this._flushedSizeTracker)||void 0===e?void 0:e.currentTrackedSize(this.sessionId),$sdk_debug_replay_rrweb_error:this._rrwebError,[Ge]:this._rrwebAttached,[Qe]:this._rrwebStartAttempted}}get _rrwebAttached(){var e,t,i;return!!this._stopRrweb&&(null===(e=null===(t=gu())||void 0===t||null===(i=t.isRecording)||void 0===i?void 0:i.call(t))||void 0===e||e)}_startRecorder(){var t;if(this._stopRrweb)return;this._rrwebStartAttempted=!0;const i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},s=this._instance.config.session_recording;for(const[e,t]of Object.entries(s||{}))if(e in i)if("maskInputOptions"===e)i.maskInputOptions=ct({password:!0},t);else if("sampling"===e){const e=null!=t?t:{},n={};It(e.mousemove)||(n.mousemove=e.mousemove),It(e.mouseInteraction)||(n.mouseInteraction=e.mouseInteraction),i.sampling=n}else i[e]=t;var r,o,a,l;!0===(null==s?void 0:s.captureJsonLd)&&!0!==i.slimDOMOptions&&"all"!==i.slimDOMOptions&&(i.slimDOMOptions=ct(ct({},i.slimDOMOptions),{},{script:!0})),this._canvasRecording&&this._canvasRecording.enabled&&(i.recordCanvas=!0,i.sampling=ct(ct({},i.sampling),{},{canvas:this._canvasRecording.fps}),i.dataURLOptions={type:"image/webp",quality:this._canvasRecording.quality},i.canvasResolutionScale=this._canvasResolutionScale,i.canvasMasking={configured:()=>{var e;return Ct(null===(e=this._instance.config.session_recording)||void 0===e||null===(e=e.canvasCapture)||void 0===e?void 0:e.maskRegionsFn)},regionsFn:e=>{var t;const i=null===(t=this._instance.config.session_recording)||void 0===t||null===(t=t.canvasCapture)||void 0===t?void 0:t.maskRegionsFn;if(Ct(i))try{var n;return null!==(n=i(e))&&void 0!==n?n:null}catch(e){return this._maskRegionsFnFailed||(this._maskRegionsFnFailed=!0,uu.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",e)),null}}}),this._masking&&(i.maskAllInputs=null===(r=this._masking.maskAllInputs)||void 0===r||r,i.maskTextSelector=null!==(o=this._masking.maskTextSelector)&&void 0!==o?o:void 0,i.blockSelector=null!==(a=this._masking.blockSelector)&&void 0!==a?a:void 0,i.maskAllElementAttributes=null!==(l=this._masking.maskAllElementAttributes)&&void 0!==l&&l),i.maskAllElementAttributes&&i.maskAttributeFn&&(i.maskAttributeFn=void 0,this._hasWarnedExclusiveAttributeMasking||(this._hasWarnedExclusiveAttributeMasking=!0,uu.warn('`maskAllElementAttributes` and `maskAttributeFn` are mutually exclusive, and `maskAttributeFn` is being ignored. Remove one of the two. Note that `maskAllElementAttributes` can also come from your project\'s "Privacy and masking" settings. See https://posthog.com/docs/session-replay/privacy'))),this._warnIfClientMaskingShadowsServer();const c=gu();if(!c)return void uu.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this._mutationThrottler=null!==(t=this._mutationThrottler)&&void 0!==t?t:new bl(c,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(e,t)=>{const i=`Too many mutations on node '${e}'. Rate limiting. This could be due to SVG animations or something similar`;uu.info(i,{node:t}),this.log("[SessionRecording] "+i,"warn")},onDroppedAttributeMutations:e=>this._throttledMutationsDropped+=e,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this._fullSnapshotIntervalMillis,onDroppedOversizedMutation:e=>{0===this._oversizedMutationsDropped&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this._oversizedMutationsDropped+=1,this._oversizedMutationBytesDropped+=e},requestFullSnapshot:()=>this._tryTakeFullSnapshot()});const u=this._gatherRRWebPlugins();if(this._stopRrweb=c(ct(ct({emit:e=>{this.onRRwebEmit(e)},plugins:u,errorHandler:(e,t)=>"rrweb"===t&&(this._hasLoggedRecorderCallbackError||(this._hasLoggedRecorderCallbackError=!0,uu.error("rrweb internal error - recording will continue but may be incomplete",e)),!0)},i),{},{recordAfter:"DOMContentLoaded"})),!this._stopRrweb)return this._rrwebError=!0,void uu.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this._rrwebError=!1,!0===(null==s?void 0:s.captureJsonLd)&&n&&(null==e?void 0:e.MutationObserver)&&!this._jsonLdCapture&&(this._jsonLdCapture=function(e,t,i){const n=new WeakMap,s=i.getCaptureState||(()=>!0);let r=Bc;const o=function(e,t){const i=t.attributeFilter;return t.maskAllElementAttributes||t.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?zc:i=>{const n=e.getElementById(i);return!!n&&"SCRIPT"!==n.nodeName&&(!t.isRecordedElement||t.isRecordedElement(n))&&!au(n,t.blockClass,t.blockSelector)}}(e,i),a=t=>{try{const a=s();if(!r||!1===a||!t.isConnected||t.ownerDocument!==e||function(e,t){return au(e,t.blockClass,t.blockSelector)||au(e,t.maskTextClass,t.maskTextSelector)}(t,i))return;const l=function(e,t=zc,i){if(!e||e.length>Bc)return null;try{const n=JSON.parse(e),s={maskUrl:i,remainingNodes:2048,exceeded:!1},r=kt(n)?n.map(e=>su(e,t,s)):su(n,t,s);if(s.exceeded||Pt(r)||kt(r)&&(!r.length||r.some(Pt)))return null;const o=JSON.stringify(r);return o.length>2e4?null:[r,o]}catch(e){return null}}(t.text,o,i.maskUrl);if(!l)return void n.delete(t);const[c,u]=l;if(Pt(a))return void n.set(t,u);if(n.get(t)!==u){if(u.length>r)return void(r=0);i.emit(c)&&(n.set(t,u),r-=u.length)}}catch(e){return}};try{const i=new t(e=>{try{if(!r||!1===s())return;const t=e=>{for(const t of lu(e))a(t)};for(const i of e)if("childList"===i.type)ru(i.target)&&a(i.target),i.addedNodes.forEach(t);else if("characterData"===i.type){const e=i.target.parentNode;e&&ru(e)&&a(e)}else"attributes"===i.type&&ru(i.target)&&a(i.target)}catch(e){return}});return i.observe(e,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(t=!1){r&&!1!==s()&&lu(e.documentElement).forEach(e=>{t&&n.delete(e),a(e)})},stop(){return i.disconnect()}}}catch(e){return{scan(){},stop(){}}}}(n,e.MutationObserver,{maskUrl:e=>this._maskReplayUrl(e),attributeFilter:i.attributeFilter,blockClass:i.blockClass,blockSelector:i.blockSelector,isRecordedElement:e=>c.mirror.getId(e)>0,maskAllElementAttributes:i.maskAllElementAttributes,maskAttributeFn:i.maskAttributeFn,maskTextClass:i.maskTextClass,maskTextSelector:i.maskTextSelector,getCaptureState:()=>{var e;return!0!==(null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.captureJsonLd)||this._urlTriggerMatching.urlBlocked||this._urlTriggerMatching.isCurrentUrlBlocked()?null:this._canCaptureJsonLd()},emit:e=>this._tryAddJsonLdEvent(e)}),this._urlTriggerMatching.isCurrentUrlBlocked()&&this._jsonLdCapture.scan()),this._lastActivityTimestamp=Date.now(),this._isIdle=Lt(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:i,activePlugins:u.map(e=>null==e?void 0:e.name)}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}};const $u=["type"];var Nu=function(e){return e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e}({}),Bu=function(e){return e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e}({}),qu=function(e){return e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e}({}),Hu=function(e){return e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e}({}),zu=function(e){return e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e}({}),Uu=function(e){return e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e}({}),Wu=function(e){return e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e}({});function ju(e,t){return-1!==e.indexOf(t)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,new RegExp(/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi.source,"i");var Vu=/[a-z][a-z0-9+.-]{0,63}:\/\//i;new RegExp(`^${Vu.source}`,"i"),new RegExp(Vu.source,"gi");var Gu={Node:["childNodes","parentNode","parentElement","textContent","previousSibling","nextSibling","lastChild"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Qu={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Ku={};function Ju(e){if(Ku[e])return Ku[e];const t=function(e){var t,i;const n=null===(t=globalThis)||void 0===t||null===(t=t.Zone)||void 0===t||null===(i=t.__symbol__)||void 0===i?void 0:i.call(t,e);return n&&globalThis[n]?globalThis[n]:void 0}(e)||globalThis[e],i=t.prototype,n=e in Gu?Gu[e]:void 0,s=Boolean(n&&n.every(e=>{var t;return Boolean(null===(t=Object.getOwnPropertyDescriptor(i,e))||void 0===t||null===(t=t.get)||void 0===t?void 0:t.toString().includes("[native code]"))})),r=e in Qu?Qu[e]:void 0,o=Boolean(r&&r.every(e=>{var t;return"function"==typeof i[e]&&(null===(t=i[e])||void 0===t?void 0:t.toString().includes("[native code]"))}));if(s&&o)return Ku[e]=t.prototype,t.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 t.prototype;const s=n[e].prototype;return s?(function(e){return ju(e,"AppleWebKit")&&!ju(e,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",e),l=!0),Ku[e]=s):i}catch(e){return i}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var Zu=Object.create(null);function Yu(e,t,i){var n;const s=Zu[e],r=s[i];if(r)return r.call(t);const o=Ju(e),a=null===(n=Object.getOwnPropertyDescriptor(o,i))||void 0===n?void 0:n.get;return a?(s[i]=a,a.call(t)):t[i]}Zu.Node=Object.create(null),Zu.ShadowRoot=Object.create(null),Zu.MutationObserver=Object.create(null),Zu.Element=Object.create(null);var Xu,ed={};function td(e,t,i){const n=`${e}.${String(i)}`;if(ed[n])return ed[n].bind(t);const s=Ju(e)[i];return"function"!=typeof s?t[i]:(ed[n]=s,s.bind(t))}function id(){return Ju("MutationObserver").constructor}function nd(e,t,i){try{if(!(t in e))return()=>{};const n=e[t],s={next:n},r=i(function(...e){return s.next.apply(this,e)});return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:n},__rrweb_layer__:{enumerable:!1,value:s}})),e[t]=r,()=>{if(e[t]===r)return void(e[t]=s.next);const i=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0};let n=e[t],o=i(n);for(;o;){if(o.next===r)return void(o.next=s.next);n=o.next,o=i(n)}}}catch(e){return()=>{}}}var sd={childNodes:e=>Yu("Node",e,"childNodes"),parentNode:e=>Yu("Node",e,"parentNode"),parentElement:e=>Yu("Node",e,"parentElement"),textContent:e=>Yu("Node",e,"textContent"),previousSibling:e=>Yu("Node",e,"previousSibling"),nextSibling:e=>Yu("Node",e,"nextSibling"),lastChild:e=>Yu("Node",e,"lastChild"),isConnected(e){if(void 0===Xu){var t;const e=null===(t=Object.getOwnPropertyDescriptor(Ju("Node"),"isConnected"))||void 0===t?void 0:t.get;Xu=(null==e?void 0:e.toString().includes("[native code]"))?e:null}return null==Xu?void 0:Xu.call(e)},contains:(e,t)=>td("Node",e,"contains")(t),getRootNode:e=>td("Node",e,"getRootNode")(),host:e=>e&&"host"in e?Yu("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?Yu("Element",e,"shadowRoot"):null,querySelector:(e,t)=>td("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>td("Element",e,"querySelectorAll")(t),mutationObserver:id,patch:nd};function rd(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(e){}return Date.now()}var od=0;function ad(){od+=1}function ld(){return od}function cd(e,t){return(t!==od||e>6e4)&&!0}var ud=0,dd=0,hd=0,pd={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},gd=null,_d=null,fd=[],vd=0,md=0,yd={slowestBatchMs:0},bd={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function Sd(e){(ud+=1)>1||(pd={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},fd=[],vd=0,_d=(e=>e&&e>0?e:null)(e),dd=rd(),hd=od)}function wd(){return 0===ud?gd||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(ud-=1)>0?pd:(pd.durationMs=rd()-dd,pd.deferredStylesheetCount=vd,bd.deferredCount+=vd,_d=null,cd(pd.durationMs,hd)?pd:gd=pd)}function kd(e,t,i){let n=e.length;if(i>=32)return n;for(let s=0;e.length>s;s++){const r=e[s];try{const e=r.cssRules;if(e&&e.length)n+=kd(e,t,i+1);else if(t&&r.styleSheet){const e=r.styleSheet;if(!t.has(e)){t.add(e);const s=e.rules||e.cssRules;s&&(n+=kd(s,t,i+1))}}}catch(e){}}return n}function Cd(e){if(0===ud)return;const t=kd(e,null,0);pd.cssRuleCount+=t,md>0&&(pd.nonDeferrableCssRuleCount+=t)}function xd(e){md+=1;try{return e()}finally{md-=1}}function Ed(e){ud>0&&(pd.stylesheetMs+=e)}function Id(e){if(0===ud||null===_d)return!1;const t=pd.cssRuleCount-pd.nonDeferrableCssRuleCount;return t>=_d||t+function(e){try{const t=e&&(e.rules||e.cssRules);if(!t)return 0;const i=new WeakSet;return i.add(e),kd(t,i,0)}catch(e){return 0}}(e)>_d}function Td(){const e=fd;return fd=[],e}function Md(){bd.failedCount+=1}function Pd(e){e>0&&(bd.abandonedCount+=e)}function Rd(e){return Rd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rd(e)}function Fd(e,t,i){return(t=function(e){var t=function(e){if("object"!=Rd(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=Rd(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Rd(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Ad(e){return e.nodeType===e.ELEMENT_NODE}function Ld(e){const t=e&&"host"in e&&"mode"in e&&sd.host(e)||null;return Boolean(t&&"shadowRoot"in t&&sd.shadowRoot(t)===e)}function Od(e){return"[object ShadowRoot]"==={}.toString.call(e)}function Dd(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function $d(e){const{cssText:t}=e;if(3>t.split('"').length)return t;const i=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?i.push("layer"):e.layerName&&i.push(`layer(${e.layerName})`),e.supportsText&&i.push(`supports(${e.supportsText})`),e.media.length&&i.push(e.media.mediaText),i.join(" ")+";"}var Nd=0;function Bd(e){const t=0===Nd,i=t?rd():0;Nd+=1;try{const t=e.rules||e.cssRules;if(!t)return null;Cd(t);let i=e.href;return!i&&e.ownerNode&&(i=e.ownerNode.baseURI),Dd(Array.from(t,e=>qd(e,i)).join(""))}catch(e){return null}finally{Nd-=1,t&&Ed(rd()-i)}}function qd(e,t){if(zd(e)){let t;try{t=Bd(e.styleSheet)||$d(e)}catch(i){t=e.cssText}try{var i;if(t&&(null===(i=e.styleSheet)||void 0===i?void 0:i.href))return sh(t,e.styleSheet.href)}catch(e){}return t}{let i=e.cssText;return Ud(e)&&e.selectorText.includes(":")&&(i=Hd(i)),t?sh(i,t):i}}function Hd(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function zd(e){return"styleSheet"in e}function Ud(e){return"selectorText"in e}var Wd=/^-?[A-Za-z_][\w-]*$/,jd=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Vd(e){const t=[];let i=!1,n=null;const s=new Map;function r(e){const s=t.pop();if("group"===s.kind){if(null===e){for(;t.length>0&&"group"===t[t.length-1].kind;)t.pop();return void r(null)}const i=t[t.length-1];return i.parts.push(e),void(i.index+=1)}if(!s.importRule)return i=!0,void(n=e);o(t[t.length-1],s.importRule,e)}function o(e,t,i){try{let s;try{s=i||$d(t)}catch(e){s=t.cssText}try{var n;s&&(null===(n=t.styleSheet)||void 0===n?void 0:n.href)&&(s=sh(s,t.styleSheet.href))}catch(e){}s&&e.parts.push(s),e.index+=1}catch(e){r(null)}}function a(e){const i=e.rules[e.index];if("sheet"===e.kind&&zd(i)){const n=s.get(i);return null===n?(e.parts.push(i.cssText),void(e.index+=1)):n?void t.push({kind:"sheet",sheet:n.sheet,rules:n.rules,sheetHref:n.sheetHref,index:0,parts:[],importRule:i}):void o(e,i,null)}if(function(e,i){try{const n=function(e){const t=e;if(!t.cssRules||0===t.cssRules.length)return null;if(t.media&&"string"==typeof t.media.mediaText)return`@media ${t.media.mediaText} {`;if(Ud(e)){if("number"==typeof t.type&&1!==t.type)return null;const i=t.style?t.style.cssText:"";return`${e.selectorText} {${i?" "+i:""}`}if("containerName"in t)return"string"!=typeof t.containerQuery||t.containerName&&!Wd.test(t.containerName)?null:`@container ${t.containerName?`${t.containerName} `:""}${t.containerQuery} {`;if("string"==typeof t.conditionText){let n="";try{var i;n=(null===(i=e.constructor)||void 0===i?void 0:i.name)||""}catch(e){return null}return""===n||"Object"===n||"CSSSupportsRule"===n?`@supports ${t.conditionText} {`:null}return"string"==typeof t.name?"keyText"in t.cssRules[0]?Wd.test(t.name)?`@keyframes ${t.name} {`:null:""===t.name?"@layer {":jd.test(t.name)?`@layer ${t.name} {`:null:null}(e);if(null===n)return!1;const s=i.sheetHref;return t.push({kind:"group",rules:Array.from(e.cssRules),sheetHref:s,index:0,parts:[],prelude:s?sh(n,s):n,fixColons:"sheet"===i.kind&&Ud(e)&&e.selectorText.includes(":")}),!0}catch(e){return!1}}(i,e))return;let n=i.cssText;"sheet"===e.kind&&Ud(i)&&i.selectorText.includes(":")&&(n=Hd(n)),e.parts.push(e.sheetHref?sh(n,e.sheetHref):n),e.index+=1}return function(e){try{const i=e.rules||e.cssRules;if(!i)return!1;Cd(i);let n=e.href;!n&&e.ownerNode&&(n=e.ownerNode.baseURI);const r=Array.from(i);return t.push({kind:"sheet",sheet:e,rules:r,sheetHref:n,index:0,parts:[],importRule:null}),function(e,t){const i=[{sheet:t,rules:e,index:0}];for(;i.length>0;){const e=i[i.length-1];if(e.index>=e.rules.length){i.pop();continue}const t=e.rules[e.index];if(e.index+=1,!zd(t)||s.has(t))continue;let n=null;try{n=t.styleSheet}catch(e){s.set(t,null);continue}if(n&&!i.some(e=>e.sheet===n))try{const e=n.rules||n.cssRules;if(!e)continue;Cd(e);let r=n.href;!r&&n.ownerNode&&(r=n.ownerNode.baseURI);const o=Array.from(e);s.set(t,{sheet:n,rules:o,sheetHref:r}),i.push({sheet:n,rules:o,index:0})}catch(e){}}}(r,e),!0}catch(e){return!1}}(e)||(i=!0),{advance(e){if(i)return!0;const s=rd();let o=e>0?e:1;try{for(;!i&&o>0;){const e=t[t.length-1];if(e.index>=e.rules.length){let t=null;try{if("group"===e.kind){const i=e.prelude+e.parts.join("")+"}";t=e.fixColons?Hd(i):i}else t=Dd(e.parts.join(""))}catch(e){}r(t);continue}o-=1;try{a(e)}catch(e){r(null)}}}catch(e){i=!0,n=null}finally{Ed(rd()-s)}return i},text:()=>i?n:null,remainingRules(){if(i)return 0;let e=0;for(const i of t)e+=i.rules.length-i.index;return e}}}var Gd=class{constructor(){Fd(this,"idNodeMap",new Map),Fd(this,"nodeMetaMap",new WeakMap)}getId(e){var t,i;return e&&null!==(t=null===(i=this.getMeta(e))||void 0===i?void 0:i.id)&&void 0!==t?t:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);if(this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e)),Ad(e)){const t=sd.shadowRoot(e);t&&this.removeNodeFromMap(t),"IFRAME"===e.nodeName&&e.contentDocument&&this.removeNodeFromMap(e.contentDocument)}}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){this.idNodeMap.set(t.id,e),this.nodeMetaMap.set(e,t)}replace(e,t){const i=this.getNode(e);if(i){const e=this.nodeMetaMap.get(i);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Qd({element:e,maskInputOptions:t,tagName:i,type:n,value:s,maskInputFn:r}){let o=s||"";const a=n&&Kd(n);return(t[i.toLowerCase()]||a&&t[a])&&(o=r?r(o,e):"*".repeat(o.length)),o}function Kd(e){return e.toLowerCase()}var Jd=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 Zd({element:e,name:t,value:i,maskAllElementAttributes:n,maskAttributeFn:s,isGenerated:r=!1}){return i?n?r&&Jd.has(Kd(t))?i:"*".repeat(i.length):s?s(t,i,e):i:i}var Yd="__rrweb_original__";function Xd(e){try{const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Kd(t):null}catch(e){return null}}var eh=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,th=/^(?:[a-z+]+:)?\/\//i,ih=/^www\..*/i,nh=/^(data:)([^,]*),(.*)/i;function sh(e,t){return(e||"").replace(eh,(e,i,n,s,r,o)=>{const a=n||r||o,l=i||s||"";if(!a)return e;if(th.test(a)||ih.test(a))return`url(${l}${a}${l})`;if(nh.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${l})`;const c=t.split("/"),u=a.split("/");c.pop();for(const e of u)"."!==e&&(".."===e?c.pop():c.push(e));return`url(${l}${c.join("/")}${l})`})}var rh,oh,ah=new Map,lh=1,ch=new RegExp("[^a-z0-9-_:]");function uh(){return lh++}var dh=!1,hh=/^[^ \t\n\r\u000c]+/,ph=/^[, \t\n\r\u000c]+/,gh=new WeakMap;function _h(e,t){return t&&""!==t.trim()?fh(e,t):t}function fh(e,t){let i=gh.get(e);if(i||(i=e.createElement("a"),gh.set(e,i)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return i.setAttribute("href",t),i.href}function vh(e,t){return(null==t?void 0:t.maxBase64ImageLength)?function(e,t){return t&&e.length>t?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":e}(e,t.maxBase64ImageLength):e}function mh(e,t,i,n,s,r){if(!n)return n;if("src"===i||"href"===i&&("use"!==t||"#"!==n[0])){const i=_h(e,n);if(i.startsWith("data:")){if("img"===t&&s){let e=i;return((null==r?void 0:r.type)||void 0!==(null==r?void 0:r.quality))&&(e=function(e,t,i,n){if(1e5>t.length)return t;if(!e.complete||0===e.naturalWidth)return t;if(e.naturalWidth>4096||e.naturalHeight>4096)return t;const s=ah.get(t);if(s&&s.type===i&&s.quality===n)return s.result;try{const s=document.createElement("canvas");s.width=e.naturalWidth,s.height=e.naturalHeight;const r=s.getContext("2d");if(!r)return t;r.drawImage(e,0,0);const o=s.toDataURL(i||"image/webp",null!=n?n:.4),a=t.length>o.length?o:t;if(ah.size>=10){const e=ah.keys().next().value;void 0!==e&&ah.delete(e)}return ah.set(t,{type:i,quality:n,result:a}),a}catch(e){return t}}(s,i,r.type,r.quality)),vh(e,r)}if("image"===t)return vh(i,r)}return i}if("xlink:href"===i&&"#"!==n[0]){const i=_h(e,n);return"image"===t&&i.startsWith("data:")?vh(i,r):i}return"background"!==i||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===i?function(e,t){if(""===t.trim())return t;let i=0;function n(e){let n;const s=e.exec(t.substring(i));return s?(n=s[0],i+=n.length,n):""}const s=[];for(;n(ph),t.length>i;){let r=n(hh);if(","===r.slice(-1))r=_h(e,r.substring(0,r.length-1)),s.push(r);else{let n="";r=_h(e,r);let o=!1;for(;;){const e=t.charAt(i);if(""===e){s.push((r+n).trim());break}if(o)")"===e&&(o=!1);else{if(","===e){i+=1,s.push((r+n).trim());break}"("===e&&(o=!0)}n+=e,i+=1}}}return s.join(", ")}(e,n):"style"===i?sh(n,fh(e)):"object"===t&&"data"===i?_h(e,n):n:_h(e,n)}function yh(e,t,i){return("video"===e||"audio"===e)&&"autoplay"===Kd(t)}function bh(e){return"string"==typeof e&&Kd(e).split(/\s+/).includes("stylesheet")}function Sh(e,t,i){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!i&&Sh(sd.parentNode(e),t,i);for(let i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;return!!i&&Sh(sd.parentNode(e),t,i)}function wh(e,t,i,n){let s;if(Ad(e)){if(s=e,!sd.childNodes(s).length)return!1}else{if(null===sd.parentElement(e))return!1;s=sd.parentElement(e)}try{if("string"==typeof t){if(n){if(s.closest(`.${t}`))return!0}else if(s.classList.contains(t))return!0}else if(Sh(s,t,n))return!0;if(i)if(n){if(s.closest(i))return!0}else if(s.matches(i))return!0}catch(e){}return!1}function kh(e,t,i){const n=e.removeEventListener;"function"==typeof n&&n.call(e,t,i)}var Ch=new Map;function xh(e={}){Ch.forEach((t,i)=>{e.keepChangedLinks&&t.changedLinkBaseline||(t.controller.abort(),Ch.delete(i))})}function Eh(e){try{return e.sheet}catch(e){return null}}function Ih(e,t,i,n,s){const r=new AbortController,o=()=>{var t;(null===(t=Ch.get(e))||void 0===t?void 0:t.controller)===r&&Ch.delete(e),r.abort()};let a=!1;const l=()=>{if(!a){a=!0;try{t()}finally{o()}}};e.addEventListener("load",l,{signal:r.signal,once:!0}),e.addEventListener("error",o,{signal:r.signal,once:!0});const c=Date.now()+6e4;let u;const d=t=>{const s=n.length>t?n[t]:Math.max(n[n.length-1],1e3);u=setTimeout(()=>{e.isConnected?i()?l():Date.now()<c?d(t+1):o():o()},s)};r.signal.addEventListener("abort",()=>clearTimeout(u),{once:!0}),d(0),Ch.set(e,{controller:r,changedLinkBaseline:s})}var Th=[100,200,400,800,1600,3200,6400,12800,25600];function Mh(e,t){return Array.from(e.styleSheets).find(e=>e.href===t)}function Ph(e){return null==e?"":e.toLowerCase()}var Rh=!1,Fh=!1;function Ah(e,t){const{doc:i,mirror:n,blockClass:s,blockSelector:r,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p=!1,maskAttributeFn:g,slimDOMOptions:_,dataURLOptions:f={},inlineImages:v=!1,recordCanvas:m=!1,canvasMaskingConfigured:y,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w=5e3,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:x=5e3,keepIframeSrcFn:E=()=>!1,newlyAddedElement:I=!1,depth:T=0,maxDepth:M=50}=t;let{needsMask:P}=t,{preserveWhiteSpace:R=!0}=t;if(T>=M)return Fh=!0,Rh||(Rh=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${M}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;P||(P=wh(e,o,a,void 0===P)),ud>0&&(pd.nodeCount+=1);const F=function(e,t){const{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:u,maskAllElementAttributes:d=!1,maskAttributeFn:h,dataURLOptions:p={},inlineImages:g,recordCanvas:_,canvasMaskingConfigured:f,keepIframeSrcFn:v,newlyAddedElement:m=!1}=t,y=function(e,t){if(!t.hasNode(e))return;const i=t.getId(e);return 1===i?void 0:i}(i,n);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Wu.Document,childNodes:[],compatMode:e.compatMode}:{type:Wu.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Wu.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function(e,t){const{doc:i,blockClass:n,blockSelector:s,inlineStylesheet:r,maskInputOptions:o={},maskInputFn:a,maskAllElementAttributes:l=!1,maskAttributeFn:c,dataURLOptions:u={},inlineImages:d,recordCanvas:h,canvasMaskingConfigured:p,keepIframeSrcFn:g,newlyAddedElement:_=!1,rootId:f}=t,v=function(e,t,i){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;if(i)return e.matches(i)}catch(e){}return!1}(e,n,s),m=function(e){if(e instanceof HTMLFormElement)return"form";const t=Kd(e.tagName);return ch.test(t)?"div":t}(e),y=new Set;let b={};const S=e.attributes.length;for(let t=0;S>t;t++){const n=e.attributes[t];yh(m,n.name)||(b[n.name]=mh(i,m,Kd(n.name),n.value,e,u))}if("link"===m&&"string"==typeof b.href){var w;const t=null===(w=Eh(e))||void 0===w?void 0:w.href;t&&(b.href=t)}if("link"===m&&r&&!v&&bh(b.rel)){let t=e.sheet;if(!t){const n=function(e){return e.href}(e);n&&(t=Mh(i,n),!t&&n.includes(".css"))&&(t=Mh(i,window.location.origin+"/"+n.replace(window.location.href,"")))}let n=null;t&&(Id(t)?ud>0&&(fd.push(e),vd+=1):n=Bd(t)),n&&(delete b.rel,delete b.href,b._cssText=n)}var k;if("style"===m&&e.sheet&&!(e.innerText||sd.textContent(e)||"").trim().length){const t=xd(()=>Bd(e.sheet));t&&(b._cssText=t)}if("input"===m||"textarea"===m||"select"===m){const t=e.value,i=e.checked;"radio"!==b.type&&"checkbox"!==b.type&&"submit"!==b.type&&"button"!==b.type&&t?b.value=Qd({element:e,type:Xd(e),tagName:m,value:t,maskInputOptions:o,maskInputFn:a}):i&&(b.checked=i)}if("option"===m&&(e.selected&&!o.select?b.selected=!0:delete b.selected),"dialog"===m&&e.open){try{b.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(e){b.rr_open_mode="modal",b.ph_rr_could_not_detect_modal=!0}y.add("rr_open_mode")}if("canvas"===m&&h&&!(null==p?void 0:p()))try{if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let i=0;e.width>i;i+=50)for(let n=0;e.height>n;n+=50){const s=t.getImageData,r=Yd in s?s[Yd]:s;let o;try{o=r.call(t,i,n,Math.min(50,e.width-i),Math.min(50,e.height-n))}catch(e){return!1}if(new Uint32Array(o.data.buffer).some(e=>0!==e))return!1}return!0})(e)||(b.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){const t=e.toDataURL(u.type,u.quality),n=i.createElement("canvas");n.width=e.width,n.height=e.height,t!==n.toDataURL(u.type,u.quality)&&(b.rr_dataURL=t)}}catch(e){"SecurityError"===(null==(k=e)?void 0:k.name)?dh||(dh=!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 C,x=!1;if("img"===m&&d){rh||(rh=i.createElement("canvas"),oh=rh.getContext("2d"));const t=e,n=t.currentSrc||t.getAttribute("src")||"<unknown-src>",s=t.crossOrigin,r=(t,i)=>x?Zd({element:e,name:t,value:i,maskAllElementAttributes:l,maskAttributeFn:c}):i,o=()=>{kh(t,"load",o);try{rh.width=t.naturalWidth,rh.height=t.naturalHeight,oh.drawImage(t,0,0);const e=rh.toDataURL(u.type,u.quality);b.rr_dataURL=r("rr_dataURL",e)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o));console.warn(`Cannot inline img src=${n}! Error: ${e}`)}"anonymous"===t.crossOrigin&&(s?b.crossOrigin=r("crossOrigin",s):t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o)}if("audio"===m||"video"===m){const t=b;t.rr_mediaState=e.paused?"paused":"played",y.add("rr_mediaState"),t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}if(_||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop)),v){var E,I,T;const{width:t,height:n,left:s,top:r}=e.getBoundingClientRect(),o=null===(E=i.defaultView)||void 0===E?void 0:E.getComputedStyle(e);b={class:b.class,rr_width:`${t}px`,rr_height:`${n}px`,rr_left:`${Math.floor(s+((null===(I=i.defaultView)||void 0===I?void 0:I.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(T=i.defaultView)||void 0===T?void 0:T.scrollY)||0))}px`},y.add("rr_width"),y.add("rr_height"),y.add("rr_left"),y.add("rr_top"),o&&(b.rr_position=o.position||"static",y.add("rr_position"),o.transform&&"none"!==o.transform&&(b.rr_transform=o.transform,y.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(b.rr_display=o.display,y.add("rr_display")))}if("iframe"!==m||g(b.src)||(e.contentDocument||(b.rr_src=b.src),delete b.src),l||c)for(const[t,i]of Object.entries(b))"string"!=typeof i&&null!==i||(b[t]=Zd({element:e,name:t,value:i,maskAllElementAttributes:l,maskAttributeFn:c,isGenerated:y.has(t)}));x=!0;try{customElements.get(m)&&(C=!0)}catch(e){}return{type:Wu.Element,tagName:m,attributes:b,childNodes:[],isSVG:(M=e,Boolean("svg"===M.tagName||M.ownerSVGElement)||void 0),needBlock:v,rootId:f,isCustom:C};var M}(e,{doc:i,blockClass:s,blockSelector:r,inlineStylesheet:a,maskInputOptions:l,maskInputFn:u,maskAllElementAttributes:d,maskAttributeFn:h,dataURLOptions:p,inlineImages:g,recordCanvas:_,canvasMaskingConfigured:f,keepIframeSrcFn:v,newlyAddedElement:m,rootId:y});case e.TEXT_NODE:return function(e,t){const{needsMask:i,maskTextFn:n,rootId:s}=t,r=sd.parentNode(e),o=r&&r.tagName;let a=sd.textContent(e);const l="STYLE"===o||void 0,c="SCRIPT"===o||void 0;if(l&&a){try{var u;if(e.nextSibling||e.previousSibling);else if(Id(r.sheet));else if(null===(u=r.sheet)||void 0===u?void 0:u.cssRules){const e=Bd(r.sheet);e&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(e)&&(a=e)}}catch(t){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${t}`,e)}a=sh(a,fh(t.doc))}return c&&(a="SCRIPT_PLACEHOLDER"),!l&&!c&&a&&i&&(a=n?n(a,sd.parentElement(e)):a.replace(/[\S]/g,"*")),{type:Wu.Text,textContent:a||"",isStyle:l,rootId:s}}(e,{doc:i,needsMask:o,maskTextFn:c,rootId:y});case e.CDATA_SECTION_NODE:return{type:Wu.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:Wu.Comment,textContent:sd.textContent(e)||"",rootId:y};default:return!1}}(e,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:g,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,keepIframeSrcFn:E,newlyAddedElement:I});if(!F)return console.warn(e,"not serialized"),null;let A;A=n.hasNode(e)?n.getId(e):function(e,t){if(t.comment&&e.type===Wu.Comment)return!0;if(e.type===Wu.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===function(e){var t;let i;try{i=new URL(e,window.location.href)}catch(e){return null}const n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(t=null==n?void 0:n[1])&&void 0!==t?t:null}(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(Ph(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Ph(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Ph(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&Ph(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Ph(e.attributes.property).match(/^(og|twitter|fb):/)||Ph(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===Ph(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(Ph(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(Ph(e.attributes.name))||Ph(e.attributes.property).match(/^article:/)||Ph(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(Ph(e.attributes.name)))return!0}}return!1}(F,_)||!R&&F.type===Wu.Text&&!F.isStyle&&!F.textContent.replace(/^\s+|\s+$/gm,"").length?-2:uh();const L=Object.assign(F,{id:A});if(n.add(e,L),-2===A)return null;b&&b(e);let O=!l;if(L.type===Wu.Element){O=O&&!L.needBlock,delete L.needBlock;const t=sd.shadowRoot(e);t&&Od(t)&&(L.isShadowHost=!0)}if((L.type===Wu.Document||L.type===Wu.Element)&&O){_.headWhitespace&&L.type===Wu.Element&&"head"===L.tagName&&(R=!1);const t={doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:g,slimDOMOptions:_,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:R,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:x,keepIframeSrcFn:E,depth:T+1,maxDepth:M};if(L.type===Wu.Element&&"textarea"===L.tagName&&void 0!==L.attributes.value);else for(const i of Array.from(sd.childNodes(e))){const e=Ah(i,t);e&&L.childNodes.push(e)}let I=null;if(Ad(e)&&(I=sd.shadowRoot(e)))for(const e of Array.from(sd.childNodes(I))){const i=Ah(e,t);i&&(Od(I)&&(i.isShadow=!0),L.childNodes.push(i))}}const D=sd.parentNode(e);if(D&&Ld(D)&&Od(D)&&(L.isShadow=!0),L.type===Wu.Element&&"iframe"===L.tagName){const t=function(e,t,i){const n=()=>{},s=e.contentWindow;if(!s)return n;let r;try{r=s.document.readyState}catch(e){return n}const o=()=>t();if("complete"!==r){let n=!1,s=null;const r=()=>{n||(n=!0,null!==s&&(clearTimeout(s),s=null),kh(e,"load",a),e.addEventListener("load",o),t())},a=()=>r();return s=setTimeout(r,i),e.addEventListener("load",a),()=>{null!==s&&(clearTimeout(s),s=null),n?kh(e,"load",o):(n=!0,kh(e,"load",a))}}const a="about:blank";let l;try{l=s.location.href}catch(e){return n}if(l!==a||e.src===a||""===e.src){const i=setTimeout(t,0);return e.addEventListener("load",o),()=>{clearTimeout(i),kh(e,"load",o)}}return e.addEventListener("load",o),()=>{kh(e,"load",o)}}(e,()=>{const t=e.contentDocument;if(t&&S){const i=Ah(t,{doc:t,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:g,slimDOMOptions:_,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:R,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:x,keepIframeSrcFn:E,depth:T+1,maxDepth:M});i&&S(e,i)}},w);null==k||k(e,t)}var N,B,q;return L.type===Wu.Element&&"link"===L.tagName&&bh(L.attributes.rel)&&(B=()=>{if(C){const t=n.getMeta(e),l=Ah(e,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:g,slimDOMOptions:_,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:R,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onStylesheetLoad:C,stylesheetLoadTimeout:x,keepIframeSrcFn:E,depth:T,maxDepth:M});l&&C(e,l,t)}},q=x,Ch.has(N=e)||Eh(N)||Ih(N,B,()=>Boolean(Eh(N)),[q])),L}function Lh(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:!1===e?{}:e}var Oh=class e{constructor(...e){Fd(this,"parentElement",null),Fd(this,"parentNode",null),Fd(this,"ownerDocument",void 0),Fd(this,"firstChild",null),Fd(this,"lastChild",null),Fd(this,"previousSibling",null),Fd(this,"nextSibling",null),Fd(this,"ELEMENT_NODE",1),Fd(this,"TEXT_NODE",3),Fd(this,"nodeType",void 0),Fd(this,"nodeName",void 0),Fd(this,"RRNodeType",void 0)}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(t){if(!(t instanceof e))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function Dh(e,t,i=document){const n={capture:!0,passive:!0};return i.addEventListener(e,t,n),()=>$h(i,e,t,n)}function $h(e,t,i,n){Nh(()=>{const s=e.removeEventListener;"function"==typeof s&&(void 0!==n?s.call(e,t,i,n):s.call(e,t,i))})}function Nh(e){try{e()}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}function Bh(e){e.forEach(e=>{if("function"==typeof e)try{e()}catch(e){}})}var qh="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.",Hh={map:{},getId(){return console.warn(qh),-1},getNode(){return console.warn(qh),null},removeNodeFromMap(){console.warn(qh)},has(){return console.warn(qh),!1},reset(){console.warn(qh)}};function zh(e,t,i={}){let n=null,s=0;return function(...r){const o=Date.now();s||!1!==i.leading||(s=o);const a=t-(o-s),l=this;0>=a||a>t?(n&&(clearTimeout(n),n=null),s=o,e.apply(l,r)):n||!1===i.trailing||(n=setTimeout(()=>{s=!1===i.leading?0:Date.now(),n=null,e.apply(l,r)},a))}}function Uh(e,t,i,n,s=window){const r=s.Object.getOwnPropertyDescriptor(e,t),o=()=>Uh(e,t,r||{},!0);if(n)return s.Object.defineProperty(e,t,i),o;const a=function(e){let t="function"==typeof e.setTimeout?e.setTimeout:void 0;try{var i,n;const s=null===(i=e.Zone)||void 0===i||null===(n=i.__symbol__)||void 0===n?void 0:n.call(i,"setTimeout"),r=s?e[s]:void 0;"function"==typeof r&&(t=r)}catch(e){}if(!t)return()=>{};const s=t;return t=>{try{s.call(e,t,0)}catch(e){}}}(s);return s.Object.defineProperty(e,t,{set(e){if(a(()=>{try{i.set.call(this,e)}catch(e){}}),r&&r.set){if(r.get)try{r.get.call(this)}catch(e){return}r.set.call(this,e)}}}),o}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Hh=new Proxy(Hh,{get(e,t,i){return"map"===t&&console.warn(qh),Reflect.get(e,t,i)}}));var Wh=Date.now;function jh(e){var t,i,n,s;const r=e.document;return{left:r.scrollingElement?r.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:r.documentElement.scrollLeft||(null==r?void 0:r.body)&&(null===(t=sd.parentElement(r.body))||void 0===t?void 0:t.scrollLeft)||(null==r||null===(i=r.body)||void 0===i?void 0:i.scrollLeft)||0,top:r.scrollingElement?r.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==r?void 0:r.documentElement.scrollTop)||(null==r?void 0:r.body)&&(null===(n=sd.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 Vh(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Gh(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Qh(e){return e?e.nodeType===e.ELEMENT_NODE?e:sd.parentElement(e):null}function Kh(e,t,i,n){if(!e)return!1;const s=Qh(e);if(!s)return!1;try{if("string"==typeof t){if(s.classList.contains(t))return!0;if(n&&null!==s.closest("."+t))return!0}else if(Sh(s,t,n))return!0}catch(e){}if(i){if(s.matches(i))return!0;if(n&&null!==s.closest(i))return!0}return!1}function Jh(e,t,i){const n=t&&"string"!=typeof t&&(t.global||t.sticky)?new RegExp(t):null;for(;e;){if(n&&(n.lastIndex=0),Kh(e,n||t,i,!0))return!0;const s="getRootNode"in e?sd.getRootNode(e):null;e=(null==s?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?sd.host(s):null}return!1}function Zh(e,t,i){return!("TITLE"!==e.tagName||!i.headTitleMutations)||-2===t.getId(e)}function Yh(e,t){if(Ld(e))return!1;const i=t.getId(e);if(!t.has(i))return!0;const n=sd.parentNode(e);return(!n||n.nodeType!==e.DOCUMENT_NODE)&&(!n||Yh(n,t))}function Xh(e){return Boolean(e.changedTouches)}function ep(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function tp(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function ip(e){return!!e&&(e instanceof Oh&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(sd.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Wh=()=>(new Date).getTime());var np=class{constructor(){Fd(this,"id",1),Fd(this,"styleIDMap",new WeakMap),Fd(this,"idStyleMap",new Map)}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let i;return i=void 0===t?this.id++:t,this.styleIDMap.set(e,i),this.idStyleMap.set(i,e),i}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function sp(e){var t;let i=null;return"getRootNode"in e&&(null===(t=sd.getRootNode(e))||void 0===t?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&sd.host(sd.getRootNode(e))&&(i=sd.host(sd.getRootNode(e))),i}function rp(e){const t=e.ownerDocument;if(!t)return!1;if(sd.contains(t,e))return!0;const i=sd.isConnected(e);return"boolean"==typeof i?i:function(e){const t=e.ownerDocument;if(!t)return!1;const i=function(e){let t,i=e;for(;t=sp(i);)i=t;return i}(e);return sd.contains(t,i)}(e)}var op,ap=(e,t)=>`${e}@${t}`,lp=class{constructor(){Fd(this,"frozen",!1),Fd(this,"locked",!1),Fd(this,"takePendingRecords",void 0),Fd(this,"texts",[]),Fd(this,"attributes",[]),Fd(this,"attributeMap",new WeakMap),Fd(this,"generatedAttributes",new WeakMap),Fd(this,"removes",[]),Fd(this,"mapRemoves",new Set),Fd(this,"movedMap",{}),Fd(this,"addedSet",new Set),Fd(this,"movedSet",new Set),Fd(this,"droppedSet",new Set),Fd(this,"removesSubTreeCache",new Set),Fd(this,"mutationCb",void 0),Fd(this,"blockClass",void 0),Fd(this,"blockSelector",void 0),Fd(this,"maskTextClass",void 0),Fd(this,"maskTextSelector",void 0),Fd(this,"inlineStylesheet",void 0),Fd(this,"maskInputOptions",void 0),Fd(this,"maskTextFn",void 0),Fd(this,"maskInputFn",void 0),Fd(this,"maskAllElementAttributes",void 0),Fd(this,"maskAttributeFn",void 0),Fd(this,"keepIframeSrcFn",void 0),Fd(this,"recordCanvas",void 0),Fd(this,"canvasMaskingConfigured",void 0),Fd(this,"inlineImages",void 0),Fd(this,"slimDOMOptions",void 0),Fd(this,"dataURLOptions",void 0),Fd(this,"doc",void 0),Fd(this,"mirror",void 0),Fd(this,"iframeManager",void 0),Fd(this,"stylesheetManager",void 0),Fd(this,"shadowDomManager",void 0),Fd(this,"canvasManager",void 0),Fd(this,"processedNodeManager",void 0),Fd(this,"unattachedDoc",void 0),Fd(this,"canvasManagerReleased",!1),Fd(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),Fd(this,"emit",()=>{if(this.frozen||this.locked)return;const e=rd(),t=ld();try{this.processBufferedMutations()}finally{i=rd()-e,n=t,ud>0||cd(i,null!=n?n:od)||i>yd.slowestBatchMs&&(yd.slowestBatchMs=i)}var i,n}),Fd(this,"processBufferedMutations",()=>{const e=[],t=new Set,i=e=>{let t=e,i=-2;for(;-2===i;)t=t&&t.nextSibling,i=t&&this.mirror.getId(t);return i};let n;const s=s=>{var r;const o=sd.parentNode(s);if(!o||!rp(s)||"TEXTAREA"===o.tagName)return!0;if(this.isBlockedAtEmission(o))return!0;const a=Ld(o)?this.mirror.getId(sp(s)):this.mirror.getId(o),l=i(s);if(-1===a||-1===l)return!1;null!==(r=n)&&void 0!==r||(n=this.buildSerializationOptions());const c=Ah(s,n);return c&&(e.push({parentId:a,nextId:l,node:c}),t.add(c.id)),!0};for(const e of this.mapRemoves)this.mapRemoves.delete(e),this.mirror.removeNodeFromMap(e);for(const e of this.movedSet)up(this.removesSubTreeCache,e)&&!this.movedSet.has(sd.parentNode(e))||this.addedSet.add(e);for(const e of Array.from(this.addedSet)){const t=dp(this.droppedSet,e),i=up(this.removesSubTreeCache,e),n=this.movedSet.has(e)||dp(this.movedSet,e);!t&&!i||n||(this.droppedSet.add(e),this.addedSet.delete(e))}const r=new Set;let o=null;const a=this.addedSet.values();let l=a.next();for(;this.addedSet.size;){let e=null;if(null!==o)for(e=sd.previousSibling(o);e&&-2===this.mirror.getId(e);)e=sd.previousSibling(e);if(e&&this.addedSet.has(e))o=e;else{for(this.addedSet.has(l.value)||(l=a.next()),o=l.value;;){const e=sd.parentNode(o),t=e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE?sd.host(e):e;if(!t||!this.addedSet.has(t))break;o=t}const e=sd.parentNode(o);if(e&&this.addedSet.has(sd.lastChild(e)))o=sd.lastChild(e);else if(e)for(;;){let e=sd.nextSibling(o);for(;e&&-2===this.mirror.getId(e);)e=sd.nextSibling(e);if(!e||!this.addedSet.has(e))break;o=e}}this.addedSet.delete(o);const t=sd.parentNode(o),i=t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?sd.host(t):t;i&&r.has(i)?r.add(o):s(o)||r.add(o)}r.size>0&&console.warn(`[rrweb] dropped ${r.size} node(s) with unresolved parent at emit`);const c={texts:this.texts.filter(e=>!this.isBlockedAtEmission(e.node)).map(e=>{const t=e.node,i=sd.parentNode(t);return i&&"TEXTAREA"===i.tagName&&this.genTextAreaValueMutation(i),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.filter(e=>!this.isBlockedAtEmission(e.node)).map(e=>{const{attributes:t}=e;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof t.style){const i=JSON.stringify(e.styleDiff),n=JSON.stringify(e._unchangedStyles);t.style.length>i.length&&(i+n).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(const[n,s]of Object.entries(t))if("string"==typeof s||null===s){var i;t[n]=Zd({element:e.node,name:n,value:s,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(i=this.generatedAttributes.get(e.node))||void 0===i?void 0:i.has(n)})}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e},u=[];if(this.inlineStylesheet)for(const{id:e,attributes:t}of c.attributes){if(!("rel"in t)&&!("href"in t))continue;const i=this.mirror.getNode(e);i&&"link"===Kd(i.nodeName)&&bh(i.getAttribute("rel"))&&i.getAttribute("href")&&!i.disabled&&u.push(i)}if(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={},c.texts.length||c.attributes.length||c.removes.length||c.adds.length){this.mutationCb(c);for(const e of u)this.stylesheetManager.inlineLinkStylesheetAfterChange(e,{currentId:()=>this.mirror.getId(e),reserializeWithoutCss:()=>({previous:this.mirror.getMeta(e),current:Ah(e,ct(ct({},this.buildSerializationOptions()),{},{inlineStylesheet:!1}))}),lastSerialization:()=>this.mirror.getMeta(e),readdAsMove:()=>this.recordReinsertion(e)})}}),Fd(this,"bufferBelongsToIframe",e=>this.doc===e.contentDocument),Fd(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));const i=Array.from(sd.childNodes(e),e=>sd.textContent(e)||"").join("");t.attributes.value=Qd({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Xd(e),value:i,maskInputFn:this.maskInputFn})}),Fd(this,"processMutation",e=>{if(!Zh(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=sd.textContent(e.target);Kh(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:wh(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Qh(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{var t;const n=e.target,s=Kd(n.tagName),r=e.attributeName,o=null!==(t=e.attributeNamespace)&&void 0!==t?t:null;let a=function(e,t,i){if(!i)return t;const n=e.getAttributeNodeNS(i,t);if(n)return n.name;if("http://www.w3.org/1999/xlink"===i)return`xlink:${t}`;if("http://www.w3.org/XML/1998/namespace"===i)return`xml:${t}`;if("http://www.w3.org/2000/xmlns/"===i)return"xmlns"===t?t:`xmlns:${t}`;const s=e.lookupPrefix(i);return s?`${s}:${t}`:t}(n,r,o),l=o?n.getAttributeNS(o,r):e.target.getAttribute(r);if("value"===a){const e=n,t=Xd(e);l=Qd({element:e,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:t,value:l,maskInputFn:this.maskInputFn})}if(Kh(e.target,this.blockClass,this.blockSelector,!1)||l===e.oldValue)return;let c=this.attributeMap.get(e.target);const u="iframe"===s&&"src"===a;if(u&&!this.keepIframeSrcFn(l)&&n.contentDocument)return;if("type"===a&&"input"===s&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!yh(s,a)){var i;c||(c={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(c),this.attributeMap.set(e.target,c));const t=mh(this.doc,s,Kd(a),l,n,this.dataURLOptions);if(u&&!this.keepIframeSrcFn(l)&&(a="rr_src"),c.attributes[a]=t,null===(i=this.generatedAttributes.get(e.target))||void 0===i||i.delete(a),"style"===a){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const t=this.unattachedDoc.createElement("span"),i=n.style;e.oldValue&&(t.style.cssText=e.oldValue);for(const e of Array.from(i)){const n=i.getPropertyValue(e),s=i.getPropertyPriority(e);n!==t.style.getPropertyValue(e)||s!==t.style.getPropertyPriority(e)?c.styleDiff[e]=""===s?n:[n,s]:c._unchangedStyles[e]=[n,s]}for(const e of Array.from(t.style))""===i.getPropertyValue(e)&&(c.styleDiff[e]=!1)}else if("open"===a&&"dialog"===s){c.attributes.rr_open_mode=n.matches("dialog:modal")?"modal":"non-modal";let t=this.generatedAttributes.get(e.target);t||(t=new Set,this.generatedAttributes.set(e.target,t)),t.add("rr_open_mode")}}break}case"childList":if(e.removedNodes.forEach(e=>{rp(e)||this.shadowDomManager.removeShadowRootsIn(e)}),Kh(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const i=this.mirror.getId(t),n=Ld(e.target)?this.mirror.getId(sd.host(e.target)):this.mirror.getId(e.target);Kh(e.target,this.blockClass,this.blockSelector,!1)||Zh(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(cp(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===i||Yh(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[ap(i,n)]?cp(this.movedSet,t):(this.removes.push({parentId:n,id:i,isShadow:!(!Ld(e.target)||!Od(e.target))||void 0}),function(e,t){const i=[e];for(;i.length;){const e=i.pop();t.has(e)||(t.add(e),sd.childNodes(e).forEach(e=>i.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.add(t))})}}),Fd(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)){if(this.addedSet.has(e))return this.addedSet.delete(e),void this.addedSet.add(e);if(!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Zh(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let i=null;t&&this.mirror.hasNode(t)&&(i=this.mirror.getId(t)),i&&-1!==i&&(this.movedMap[ap(this.mirror.getId(e),i)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);if(!Kh(e,this.blockClass,this.blockSelector,!1)){if(e.nodeType===e.TEXT_NODE)return;const t=sd.childNodes(e);for(let e=0,i=t.length;i>e;e++){const i=t[e];i&&this.genAdds(i)}if(ip(e)){const t=sd.childNodes(sd.shadowRoot(e));for(let i=0,n=t.length;n>i;i++){const n=t[i];n&&(this.processedNodeManager.add(n,this),this.genAdds(n,e))}}}}}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAllElementAttributes","maskAttributeFn","keepIframeSrcFn","recordCanvas","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]}),this.canvasManager.acquire()}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}readPendingRecordsFrom(e){this.takePendingRecords=()=>e.takeRecords()}reset(){this.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(const e of this.mapRemoves)this.mapRemoves.delete(e),this.mirror.removeNodeFromMap(e)}isBlockedAtEmission(e){return Jh(e,this.blockClass,this.blockSelector)}recordReinsertion(e){var t;const i=sd.parentNode(e);if(!i)return;null===(t=this.takePendingRecords)||void 0===t||t.call(this).forEach(this.processMutation);const n=(e,t)=>({type:"childList",target:i,removedNodes:e,addedNodes:t,oldValue:null,attributeName:null});this.processMutation(n([e],[])),this.processMutation(n([],[e])),this.emit()}buildSerializationOptions(){return{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:e=>{ep(e,this.mirror)&&this.iframeManager.addIframe(e),tp(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),ip(e)&&!Kh(e,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(sd.shadowRoot(e),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onIframeListenerRegistered:(e,t)=>{this.iframeManager.registerLoadListenerDisposer(e,t)},onStylesheetLoad:(e,t,i)=>{this.stylesheetManager.attachLinkElement(e,t,i)}}}};function cp(e,t){const i=[t];for(;i.length;){const t=i.pop();if(e.delete(t),t.nodeType===t.TEXT_NODE)continue;const n=sd.childNodes(t);for(let e=0,t=n.length;t>e;e++){const t=n[e];t&&i.push(t)}}}function up(e,t,i){return 0!==e.size&&function(e,t){const i=sd.parentNode(t);return!!i&&e.has(i)}(e,t)}function dp(e,t){if(0===e.size)return!1;let i=sd.parentNode(t);for(;i;){if(e.has(i))return!0;i=sd.parentNode(i)}return!1}function hp(e){op=e}function pp(){op=void 0}var gp=(e,t="rrweb")=>op?(...i)=>{try{return e(...i)}catch(e){if(op&&!0===op(e,t))return;throw e}}:e,_p=[];function fp(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function vp(e,t){const i=new lp;let n;i.init(e);try{n=new(id())(gp(i.processMutations.bind(i)));const s={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return e.attributeFilter&&e.attributeFilter.length>0&&(s.attributeFilter=e.attributeFilter),n.observe(t,s),i.readPendingRecordsFrom(n),_p.push(i),{observer:n,buffer:i}}catch(e){try{null==n||n.disconnect(),i.destroy(),i.reset()}catch(e){}throw e}}function mp({scrollCb:e,doc:t,mirror:i,blockClass:n,blockSelector:s,sampling:r}){const o=new Map,a=r=>{const a=fp(r);if(!a||Kh(a,n,s,!0))return;const l=i.getId(a);let c,u;if(a===t&&t.defaultView){const e=jh(t.defaultView);c=e.left,u=e.top}else c=a.scrollLeft,u=a.scrollTop;const d=`${c},${u}`;o.get(l)!==d&&(o.set(l,d),e({id:l,x:c,y:u}))},l=[Dh("scroll",gp(zh(gp(e=>a(e)),r.scroll||100)),t)];return"onscrollend"in t&&l.push(Dh("scrollend",gp(a),t)),()=>l.forEach(e=>e())}function yp(e,t){for(let i=_p.length-1;i>=0;i--){const n=_p[i];if(!n)continue;let s=n.bufferBelongsToIframe(e);!s&&t&&t.has(n.bufferDoc())&&(s=!0),s&&(n.reset(),_p.splice(i,1))}}var bp=["INPUT","TEXTAREA","SELECT"],Sp=new WeakMap;function wp(e){return function e(t,i){if(Ip("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||Ip("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||Ip("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||Ip("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const n=Array.from(t.parentRule.cssRules).indexOf(t);return i.unshift(n),e(t.parentRule,i)}if(t.parentStyleSheet){const e=Array.from(t.parentStyleSheet.cssRules).indexOf(t);i.unshift(e)}return i}(e,[])}function kp(e,t,i){let n,s;return e?(e.ownerNode?n=t.getId(e.ownerNode):s=i.getId(e),{styleId:s,id:n}):{}}function Cp({mirror:e,stylesheetManager:t},i){var n,s;let r=null;r=e.getId("#document"===i.nodeName?i:sd.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 e;return null===(e=a.get)||void 0===e?void 0:e.call(this)},set(e){let i;try{var n;i=null===(n=a.set)||void 0===n?void 0:n.call(this,e)}catch(e){if(e&&"object"==typeof e&&"NotAllowedError"===e.name)return;throw e}if(null!==r&&-1!==r)try{t.adoptStyleSheets(e,r)}catch(e){}return i}}),gp(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}var xp=new Set;function Ep(e,t={}){const i=e.doc.defaultView;if(!i)return()=>{};let n,s;!function(e,t){const{mutationCb:i,mousemoveCb:n,mouseInteractionCb:s,scrollCb:r,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p,customElementCb:g}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),i(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),n(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),s(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),r(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),o(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),l(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),c(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),g(...e)}}(e,t);const r=[],o=gp(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const e=_p.indexOf(s);-1!==e&&_p.splice(e,1)}e.shadowDomManager.resetForDoc(e.doc),null==n||n.disconnect()}finally{Bh(r)}}),a=(e,t)=>{const i=gp(()=>{try{return t()}catch(t){throw xp.add(e),t}})();"function"==typeof i&&r.push(i)};try{if(e.recordDOM&&a("mutation",()=>{const t=vp(e,e.doc);n=t.observer,s=t.buffer}),a("move",()=>function({mousemoveCb:e,sampling:t,doc:i,mirror:n}){if(!1===t.mousemove)return()=>{};const s="number"==typeof t.mousemove?t.mousemove:50,r="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let o,a=[];const l=zh(gp(t=>{const i=Date.now()-o;e(a.map(e=>(e.timeOffset-=i,e)),t),a=[],o=null}),r),c=gp(zh(gp(e=>{const t=fp(e),{clientX:i,clientY:s}=Xh(e)?e.changedTouches[0]:e;o||(o=Wh()),a.push({x:i,y:s,id:n.getId(t),timeOffset:Wh()-o}),l("drag"===e.type?Bu.Drag:"touchmove"===e.type?Bu.TouchMove:Bu.MouseMove)}),s,{trailing:!1})),u=[Dh("mousemove",c,i),Dh("touchmove",c,i),Dh("drag",c,i)];return gp(()=>{u.forEach(e=>e())})}(e)),a("mouseInteraction",()=>function({mouseInteractionCb:e,doc:t,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(qu).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]).forEach(r=>{let o=Kd(r);const c=(t=>r=>{const o=fp(r);if(Kh(o,n,s,!0))return;let a=null,c=t;if("pointerType"in r){switch(r.pointerType){case"mouse":a=Hu.Mouse;break;case"touch":a=Hu.Touch;break;case"pen":a=Hu.Pen}a===Hu.Touch&&(qu[t]===qu.MouseDown?c="TouchStart":qu[t]===qu.MouseUp&&(c="TouchEnd"))}else Xh(r)&&(a=Hu.Touch);null!==a?(l=a,(c.startsWith("Touch")&&a===Hu.Touch||c.startsWith("Mouse")&&a===Hu.Mouse)&&(a=null)):qu[t]===qu.Click&&(a=l,l=null);const u=Xh(r)?r.changedTouches[0]:r;if(!u)return;const d=i.getId(o),{clientX:h,clientY:p}=u;gp(e)(ct({type:qu[c],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(r);if(window.PointerEvent)switch(qu[r]){case qu.MouseDown:case qu.MouseUp:o=o.replace("mouse","pointer");break;case qu.TouchStart:case qu.TouchEnd:return}a.push(Dh(o,c,t))}),gp(()=>{a.forEach(e=>e())})}(e)),a("scroll",()=>mp(e)),a("viewportResize",()=>function({viewportResizeCb:e},{win:t}){let i=-1,n=-1;return Dh("resize",gp(zh(gp(()=>{const t=Vh(),s=Gh();i===t&&n===s||(e({width:Number(s),height:Number(t)}),i=t,n=s)}),200)),t)}(e,{win:i})),a("input",()=>function({inputCb:e,doc:t,mirror:i,blockClass:n,blockSelector:s,ignoreClass:r,ignoreSelector:o,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:u}){function d(e){let i=fp(e);const c=e.isTrusted,d=t.defaultView;if(i&&d&&!(i instanceof d.HTMLElement))return;const p=i&&i.tagName;if(i&&"OPTION"===p&&(i=sd.parentElement(i)),!i||!p||0>bp.indexOf(p)||Kh(i,n,s,!0))return;if(i.classList.contains(r)||o&&i.matches(o))return;let g=i.value,_=!1;const f=Xd(i)||"";"radio"===f||"checkbox"===f?_=i.checked:(a[p.toLowerCase()]||a[f])&&(g=Qd({element:i,maskInputOptions:a,tagName:p,type:f,value:g,maskInputFn:l})),h(i,u?{text:g,isChecked:_,userTriggered:c}:{text:g,isChecked:_});const v=i.name;"radio"===f&&v&&_&&t.querySelectorAll(`input[type="radio"][name="${v}"]`).forEach(e=>{if(e!==i){const t=e.value;h(e,u?{text:t,isChecked:!_,userTriggered:!1}:{text:t,isChecked:!_})}})}function h(t,n){const s=Sp.get(t);if(!s||s.text!==n.text||s.isChecked!==n.isChecked){Sp.set(t,n);const s=i.getId(t);gp(e)(ct(ct({},n),{},{id:s}))}}const p=("last"===c.input?["change"]:["input","change"]).map(e=>Dh(e,gp(d),t)),g=t.defaultView;if(!g)return()=>{p.forEach(e=>e())};const _=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value");return _&&_.set&&p.push(...[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]].map(e=>Uh(e[0],e[1],{set(){gp(d)({target:this,isTrusted:!1})}},!1,g))),gp(()=>{Bh(p)})}(e)),a("mediaInteraction",()=>function({mediaInteractionCb:e,blockClass:t,blockSelector:i,mirror:n,sampling:s,doc:r}){const o=gp(r=>zh(gp(s=>{const o=fp(s);if(!o||Kh(o,t,i,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:u,loop:d}=o;e({type:r,id:n.getId(o),currentTime:a,volume:l,muted:c,playbackRate:u,loop:d})}),s.media||500)),a=[Dh("play",o(Uu.Play),r),Dh("pause",o(Uu.Pause),r),Dh("seeked",o(Uu.Seeked),r),Dh("volumechange",o(Uu.VolumeChange),r),Dh("ratechange",o(Uu.RateChange),r)];return gp(()=>{a.forEach(e=>e())})}(e)),e.recordDOM){const t=function(e){const t=new Map,i=new Set;let n=!0;const s=e=>{if(n)try{e()}catch(e){}},r=e=>{var i;const n=t.get(e);if(n){for(;null===(i=n[0])||void 0===i?void 0:i.ready;){const e=n.shift();(null==e?void 0:e.emit)&&s(e.emit)}0===n.length&&t.delete(e)}};return{queueMutation(e,i){if(!e)return void s(i);const n=t.get(e);n?(n.push({emit:i,ready:!0}),r(e)):s(i)},queuePendingMutation(o,a,l){if(!n)return()=>{};let c=t.get(o);c||(c=[],t.set(o,c));const u={emit:a,ready:!1};c.push(u);let d,h=!1,p=!1;const g=()=>{h||p||(h=!0,void 0!==d&&i.delete(d),u.ready=!0,u.emit=void 0,r(o))};try{d=e.setTimeout(g,5e3),h||p?e.clearTimeout(d):i.add(d)}catch(e){g()}return t=>{!p&&n&&(p=!0,void 0!==d&&(e.clearTimeout(d),i.delete(d)),h?t&&s(l):(u.ready=!0,t||(u.emit=void 0),r(o)))}},reset(){n=!1,i.forEach(t=>e.clearTimeout(t)),i.clear(),t.clear()}}}(i);r.push(t.reset),a("styleSheet",()=>function({styleSheetRuleCb:e,mirror:t,stylesheetManager:i},{win:n,mutationQueue:s}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const r=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:gp((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=kp(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&s.queueMutation(r,()=>e({id:c,styleId:u,adds:[{rule:a,index:l}]})),l},"host")}),n.CSSStyleSheet.prototype.addRule=function(e,t,i=this.cssRules.length){return n.CSSStyleSheet.prototype.insertRule.apply(this,[`${e} { ${t} }`,i])};const o=n.CSSStyleSheet.prototype.deleteRule;let a,l;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:gp((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=kp(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&s.queueMutation(r,()=>e({id:c,styleId:u,removes:[{index:a}]})),l},"host")}),n.CSSStyleSheet.prototype.removeRule=function(e){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:gp((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:c}=kp(r,t,i.styleMirror);if(!(o&&-1!==o||c&&-1!==c))return l;const u=s.queuePendingMutation(r,()=>e({id:o,styleId:c,replace:a}),()=>{const t=Bd(r);null!==t&&e({id:o,styleId:c,replace:t})});try{n.call(l,()=>u(!0),()=>u(!1))}catch(e){u(!1)}}catch(e){}return l},"host")})),n.CSSStyleSheet.prototype.replaceSync&&(l=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:gp((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=kp(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&s.queueMutation(r,()=>e({id:c,styleId:u,replaceSync:a})),l},"host")}));const c={};Tp("CSSGroupingRule")?c.CSSGroupingRule=n.CSSGroupingRule:(Tp("CSSMediaRule")&&(c.CSSMediaRule=n.CSSMediaRule),Tp("CSSConditionRule")&&(c.CSSConditionRule=n.CSSConditionRule),Tp("CSSSupportsRule")&&(c.CSSSupportsRule=n.CSSSupportsRule));const u={};return Object.entries(c).forEach(([n,r])=>{u[n]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(u[n].insertRule,{apply:gp((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:c,styleId:u}=kp(r.parentStyleSheet,t,i.styleMirror);if(r.parentStyleSheet&&(c&&-1!==c||u&&-1!==u)){const t=[...wp(r),l];s.queueMutation(r.parentStyleSheet,()=>e({id:c,styleId:u,adds:[{rule:a,index:t}]}))}return l},"host")}),r.prototype.deleteRule=new Proxy(u[n].deleteRule,{apply:gp((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:c,styleId:u}=kp(r.parentStyleSheet,t,i.styleMirror);if(r.parentStyleSheet&&(c&&-1!==c||u&&-1!==u)){const t=[...wp(r),a];s.queueMutation(r.parentStyleSheet,()=>e({id:c,styleId:u,removes:[{index:t}]}))}return l},"host")})}),gp(()=>{n.CSSStyleSheet.prototype.insertRule=r,n.CSSStyleSheet.prototype.deleteRule=o,a&&(n.CSSStyleSheet.prototype.replace=a),l&&(n.CSSStyleSheet.prototype.replaceSync=l),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=u[e].insertRule,t.prototype.deleteRule=u[e].deleteRule})})}(e,{win:i,mutationQueue:t})),a("adoptedStyleSheet",()=>Cp(e,e.doc)),a("styleDeclaration",()=>function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:i,stylesheetManager:n},{win:s,mutationQueue:r}){const o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:gp((s,o,a)=>{var l;const[c,u,d]=a,h=s.apply(o,a);if(i.has(c))return h;const p=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;n.onCssomSheetMutation(p);const{id:g,styleId:_}=kp(p,t,n.styleMirror);if(g&&-1!==g||_&&-1!==_){const t=wp(o.parentRule);r.queueMutation(p,()=>e({id:g,styleId:_,set:{property:c,value:u,priority:d},index:t}))}return h},"host")});const a=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:gp((s,o,a)=>{var l;const[c]=a,u=s.apply(o,a);if(i.has(c))return u;const d=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;n.onCssomSheetMutation(d);const{id:h,styleId:p}=kp(d,t,n.styleMirror);if(h&&-1!==h||p&&-1!==p){const t=wp(o.parentRule);r.queueMutation(d,()=>e({id:h,styleId:p,remove:{property:c},index:t}))}return u},"host")}),gp(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=a})}(e,{win:i,mutationQueue:t})),e.collectFonts&&a("font",()=>function({fontCb:e,doc:t}){const i=t.defaultView;if(!i)return()=>{};const n=[],s=new WeakMap,r=i.FontFace;i.FontFace=function(e,t,i){const n=new r(e,t,i);return s.set(n,{family:e,buffer:"string"!=typeof t,descriptors:i,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),n};const o=nd(t.fonts,"add",function(t){return function(i){return setTimeout(gp(()=>{const t=s.get(i);t&&(e(t),s.delete(i))}),0),t.apply(this,[i])}});return n.push(()=>{i.FontFace=r}),n.push(o),gp(()=>{n.forEach(e=>e())})}(e))}a("selection",()=>function(e){const{doc:t,mirror:i,blockClass:n,blockSelector:s,selectionCb:r}=e;let o=!0;const a=gp(()=>{const e=t.getSelection();if(!e||o&&(null==e?void 0:e.isCollapsed))return;o=e.isCollapsed||!1;const a=[],l=e.rangeCount||0;for(let t=0;l>t;t++){const{startContainer:r,startOffset:o,endContainer:l,endOffset:c}=e.getRangeAt(t);Kh(r,n,s,!0)||Kh(l,n,s,!0)||a.push({start:i.getId(r),startOffset:o,end:i.getId(l),endOffset:c})}r({ranges:a})});return a(),Dh("selectionchange",a)}(e)),a("customElement",()=>function({doc:e,customElementCb:t}){const i=e.defaultView;return i&&i.customElements?nd(i.customElements,"define",function(e){return function(i,n,s){try{t({define:{name:i}})}catch(e){console.warn(`Custom element callback failed for ${i}`)}return e.apply(this,[i,n,s])}}):()=>{}}(e));for(const t of e.plugins)a(`plugin:${t.name}`,()=>t.observer(t.callback,i,t.options))}catch(e){try{o()}catch(e){}throw e}return o}function Ip(e){return void 0!==window[e]}function Tp(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}function Mp(e){const t=window;if("function"==typeof t.requestIdleCallback){const i=t.requestIdleCallback(e,{timeout:2e3});return{cancel(){var e;return null===(e=t.cancelIdleCallback)||void 0===e?void 0:e.call(t,i)}}}const i=setTimeout(e,250);return{cancel:()=>clearTimeout(i)}}var Pp=class{constructor(e){Fd(this,"generateIdFn",void 0),Fd(this,"iframeRemoteIdToLocalIdMap",new WeakMap),Fd(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,i,n){if(0>t)return t;const s=i||this.getRemoteIdToLocalIdMap(e),r=n||this.getLocalIdToRemoteIdMap(e);let o=s.get(t);return void 0===o&&(o=this.generateIdFn(),s.set(t,o),r.set(o,t)),o}getIds(e,t){const i=this.getRemoteIdToLocalIdMap(e),n=this.getLocalIdToRemoteIdMap(e);return t.map(t=>this.getId(e,t,i,n))}getRemoteId(e,t,i){var n;return"number"!=typeof t||0>t?t:null!==(n=(i||this.getLocalIdToRemoteIdMap(e)).get(t))&&void 0!==n?n:-1}getRemoteIds(e,t){const i=this.getLocalIdToRemoteIdMap(e);return t.map(t=>this.getRemoteId(e,t,i))}reset(e){if(!e)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(e),this.iframeLocalIdToRemoteIdMap.delete(e)}getRemoteIdToLocalIdMap(e){let t=this.iframeRemoteIdToLocalIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToLocalIdMap.set(e,t)),t}getLocalIdToRemoteIdMap(e){let t=this.iframeLocalIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeLocalIdToRemoteIdMap.set(e,t)),t}},Rp=class{constructor(e){Fd(this,"iframes",new WeakMap),Fd(this,"crossOriginIframeMap",new WeakMap),Fd(this,"crossOriginIframeMirror",new Pp(uh)),Fd(this,"crossOriginIframeStyleMirror",void 0),Fd(this,"crossOriginIframeRootIdMap",new WeakMap),Fd(this,"mirror",void 0),Fd(this,"mutationCb",void 0),Fd(this,"wrappedEmit",void 0),Fd(this,"loadListener",void 0),Fd(this,"pageHideListener",void 0),Fd(this,"stylesheetManager",void 0),Fd(this,"recordCrossOriginIframes",void 0),Fd(this,"messageHandler",void 0),Fd(this,"nestedIframeListeners",new Map),Fd(this,"attachedWindows",new WeakMap),Fd(this,"attachedDocuments",new WeakMap),Fd(this,"attachedIframes",new Map),Fd(this,"loadListenerDisposers",new WeakMap),Fd(this,"iframeElementsById",new Map),Fd(this,"pageHideHandlers",new WeakMap),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Pp(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}registerLoadListenerDisposer(e,t){let i=this.loadListenerDisposers.get(e);i||(i=new Set,this.loadListenerDisposers.set(e,i)),i.add(t);const n=this.mirror.getId(e);-1!==n&&this.iframeElementsById.set(n,e)}getIframeElementById(e){var t,i,n;return null!==(t=null!==(i=null===(n=this.attachedIframes.get(e))||void 0===n?void 0:n.element)&&void 0!==i?i:this.iframeElementsById.get(e))&&void 0!==t?t:null}forgetIframeId(e){this.attachedIframes.delete(e),this.iframeElementsById.delete(e)}disposeLoadListeners(e){const t=this.loadListenerDisposers.get(e);t&&(t.forEach(e=>Nh(e)),this.loadListenerDisposers.delete(e))}removePageHideListener(e){const t=this.pageHideHandlers.get(e);t&&(t.forEach(({win:e,handler:t})=>{$h(e,"pagehide",t)}),this.pageHideHandlers.delete(e))}addLoadListener(e){this.loadListener=e}addPageHideListener(e){this.pageHideListener=e}removeLoadListener(){this.loadListener=void 0}trackIframeContent(e,t){const i=this.mirror.getId(e);return this.attachedIframes.set(i,{element:e,content:t}),i}attachIframe(e,t){var i;const n=this.trackIframeContent(e,t);if(e.contentDocument){let t=this.attachedDocuments.get(e);t||(t=new Set,this.attachedDocuments.set(e,t)),t.add(e.contentDocument)}this.mutationCb({adds:[{parentId:n,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const s=e.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){const t=this.handleMessage.bind(this);Nh(()=>{s.addEventListener("message",t),this.nestedIframeListeners.set(s,t);let i=this.attachedWindows.get(e);i||(i=new Set,this.attachedWindows.set(e,i)),i.add(s)})}Nh(()=>{const t=e.contentWindow;if(!t)return;let i=this.pageHideHandlers.get(e);if(i)for(const e of i)if(e.win===t)return;const n=()=>{var t;null===(t=this.pageHideListener)||void 0===t||t.call(this,e),e.contentDocument&&this.mirror.removeNodeFromMap(e.contentDocument)};t.addEventListener("pagehide",n),i||(i=new Set,this.pageHideHandlers.set(e,i)),i.add({win:t,handler:n})}),null===(i=this.loadListener)||void 0===i||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const i=this.crossOriginIframeMap.get(e.source);if(!i)return;const n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){switch(t.type){case Nu.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),this.trackIframeContent(e,t.data.node),{timestamp:t.timestamp,type:Nu.IncrementalSnapshot,data:{source:Bu.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Nu.Meta:case Nu.Load:case Nu.DomContentLoaded:return!1;case Nu.Plugin:return t;case Nu.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Nu.IncrementalSnapshot:switch(t.data.source){case Bu.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const i=this.crossOriginIframeRootIdMap.get(e);i&&this.patchRootIdOnNode(t.node,i)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case Bu.Drag:case Bu.TouchMove:case Bu.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case Bu.ViewportResize:return!1;case Bu.MediaInteraction:case Bu.MouseInteraction:case Bu.Scroll:case Bu.CanvasMutation:case Bu.Input:return this.replaceIds(t.data,e,["id"]),t;case Bu.StyleSheetRule:case Bu.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Bu.Font:return t;case Bu.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case Bu.AdoptedStyleSheet:var i;return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(i=t.data.styles)||void 0===i||i.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,i,n){for(const s of n)(Array.isArray(t[s])||"number"==typeof t[s])&&(t[s]=Array.isArray(t[s])?e.getIds(i,t[s]):e.getId(i,t[s]));return t}replaceIds(e,t,i){return this.replace(this.crossOriginIframeMirror,e,t,i)}replaceStyleIds(e,t,i){return this.replace(this.crossOriginIframeStyleMirror,e,t,i)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type===Wu.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}removeIframeById(e){const t=this.attachedIframes.get(e),i=(null==t?void 0:t.element)||this.iframeElementsById.get(e)||this.mirror.getNode(e);if(this.iframeElementsById.delete(e),i){const e=i.contentWindow,t=this.attachedWindows.get(i);t&&(t.forEach(e=>{const t=this.nestedIframeListeners.get(e);t&&($h(e,"message",t),this.nestedIframeListeners.delete(e)),this.crossOriginIframeMap.delete(e)}),this.attachedWindows.delete(i)),e&&this.nestedIframeListeners.has(e)&&($h(e,"message",this.nestedIframeListeners.get(e)),this.nestedIframeListeners.delete(e)),e&&this.crossOriginIframeMap.delete(e),this.iframes.delete(i),this.disposeLoadListeners(i),this.removePageHideListener(i);const n=this.attachedDocuments.get(i);n&&(n.forEach(e=>{Nh(()=>this.mirror.removeNodeFromMap(e))}),Nh(()=>yp(i,n)),this.attachedDocuments.delete(i))}t&&this.attachedIframes.delete(e)}cleanupDetachedIframes(){if(0===this.attachedIframes.size)return;const e=[];this.attachedIframes.forEach((t,i)=>{this.mirror.has(i)||e.push(i)}),e.forEach(e=>this.removeIframeById(e))}reattachIframes(){this.attachedIframes.forEach(({content:e},t)=>{this.mirror.has(t)?this.mutationCb({adds:[{parentId:t,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(t)})}destroy(){this.recordCrossOriginIframes&&$h(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((e,t)=>{$h(t,"message",e)}),this.nestedIframeListeners.clear();const e=new Set;this.iframeElementsById.forEach(t=>e.add(t)),this.attachedIframes.forEach(({element:t})=>e.add(t)),e.forEach(e=>{this.disposeLoadListeners(e),this.removePageHideListener(e)}),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}},Fp=class{constructor(e){Fd(this,"shadowDoms",new Map),Fd(this,"mutationCb",void 0),Fd(this,"scrollCb",void 0),Fd(this,"bypassOptions",void 0),Fd(this,"mirror",void 0),Fd(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){var i,n;if(!Od(e))return;if(this.shadowDoms.has(e))return;const s=null!==(i=null===(n=sd.host(e))||void 0===n?void 0:n.ownerDocument)&&void 0!==i?i:t,r={doc:s,handlers:[]};this.shadowDoms.set(e,r);const{observer:o,buffer:a}=vp(ct(ct({},this.bypassOptions),{},{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);r.handlers.push(()=>{o.disconnect(),a.destroy(),a.releaseCanvasManager();const e=_p.indexOf(a);-1!==e&&_p.splice(e,1)}),r.handlers.push(mp(ct(ct({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(()=>{this.shadowDoms.get(e)===r&&(e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(sd.host(e))),r.handlers.push(Cp({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)))},0)}removeShadowRootsIn(e){if(0===this.shadowDoms.size)return;const t=sd.shadowRoot(e);t&&(this.shadowDoms.has(t)&&this.removeShadowRoot(t),this.removeShadowRootsIn(t)),sd.childNodes(e).forEach(e=>this.removeShadowRootsIn(e))}removeShadowRoot(e){const t=this.shadowDoms.get(e);this.shadowDoms.delete(e),null==t||t.handlers.forEach(Ap)}observeAttachShadow(e){Nh(()=>{const t=e.contentWindow,i=e.contentDocument;t&&i&&this.patchAttachShadow(t.Element,i)})}patchAttachShadow(e,t){const i=this;this.restoreHandlers.push({doc:t,handler:nd(e.prototype,"attachShadow",function(e){return function(n){const s=e.call(this,n),r=sd.shadowRoot(this);return r&&rp(this)&&i.addShadowRoot(r,t),s}})})}reset(){this.restoreHandlers.forEach(({handler:e})=>Ap(e)),this.restoreHandlers=[];const e=this.shadowDoms;this.shadowDoms=new Map,e.forEach(({handlers:e})=>e.forEach(Ap))}resetForDoc(e){const t=[];for(const i of this.restoreHandlers)i.doc===e?Ap(i.handler):t.push(i);this.restoreHandlers=t,this.shadowDoms.forEach((t,i)=>{t.doc===e&&this.removeShadowRoot(i)})}};function Ap(e){try{e()}catch(e){}}var Lp="skip-frame";function Op(e){if("object"!=typeof e||null===e)return!1;const{x:t,y:i,width:n,height:s}=e;return Number.isFinite(t)&&Number.isFinite(i)&&Number.isFinite(n)&&Number.isFinite(s)&&n>=0&&s>=0}for(var Dp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$p="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Np=0;64>Np;Np++)$p[Dp.charCodeAt(Np)]=Np;var Bp=function(e){var t,i=new Uint8Array(e),n=i.length,s="";for(t=0;n>t;t+=3)s+=Dp[i[t]>>2],s+=Dp[(3&i[t])<<4|i[t+1]>>4],s+=Dp[(15&i[t+1])<<2|i[t+2]>>6],s+=Dp[63&i[t+2]];return n%3==2?s=s.substring(0,s.length-1)+"=":n%3==1&&(s=s.substring(0,s.length-2)+"=="),s},qp=!1,Hp=new Map,zp=(e,t,i)=>{if(!e||!jp(e,t)&&"object"!=typeof e)return;const n=function(e,t){let i=Hp.get(e);return i||(i=new Map,Hp.set(e,i)),i.has(t)||i.set(t,[]),i.get(t)}(i,e.constructor.name);let s=n.indexOf(e);return-1===s&&(s=n.length,n.push(e)),s};function Up(e,t,i,n){if(e instanceof Array)return e.map(e=>Up(e,t,i,n));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer)return{rr_type:e.constructor.name,base64:Bp(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Up(e.buffer,t,i,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:i}=e;return{rr_type:t,src:i}}if(e instanceof HTMLCanvasElement){const t="HTMLImageElement";let i;try{i=e.toDataURL(n.type,n.quality)}catch(e){throw function(e){"SecurityError"===(null==e?void 0:e.name)?qp||(qp=!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.",e)):console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read.",e)}(e),e}return{rr_type:t,src:i}}return e instanceof ImageData?{rr_type:e.constructor.name,args:[Up(e.data,t,i,n),e.width,e.height]}:jp(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:zp(e,t,i)}:e}var Wp=(e,t,i,n)=>e.map(e=>Up(e,t,i,n)),jp=(e,t)=>{const i=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(i.find(i=>e instanceof t[i]))},Vp=["webgl","webgl2"];function Gp(e){return"nodeType"in e}function Qp(e,t,i,n){const s=[];try{if(n){const n=function(e,t,i){const n=e.GPUCanvasContext;if((null==n?void 0:n.prototype)&&"function"==typeof n.prototype.configure)return nd(n.prototype,"configure",function(n){return function(s){const r=function(e){const{canvas:t}=e;return t&&"object"==typeof t?t:null}(this);if(!r||Gp(r)&&Kh(r,t,i,!0))return n.call(this,s);Gp(r)&&!("__context"in r)&&(r.__context="webgpu");const o=function(e){const t=e.GPUTextureUsage;return t?t.COPY_SRC|t.RENDER_ATTACHMENT:null}(e);return n.call(this,null!==o&&s?ct(ct({},s),{},{usage:"number"==typeof s.usage?s.usage|o:o}):s)}})}(e,t,i);n&&s.push(n)}const r=nd(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(s,...r){const o=function(e){return"experimental-webgl"===e?"webgl":e}(s);if(!Kh(this,t,i,!0)&&("__context"in this||(this.__context=o),n&&Vp.includes(o)))if(r[0]&&"object"==typeof r[0]){const e=r[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else r.splice(0,1,{preserveDrawingBuffer:!0});return e.apply(this,[s,...r])}});s.push(r)}catch(e){console.warn("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(e=>e())}}function Kp(e,t,i,n,s,r,o){const a=[],l=Object.getOwnPropertyNames(e);for(const c of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if("function"!=typeof e[c])continue;const l=nd(e,c,function(e){return function(...a){const l=e.apply(this,a);if(zp(l,r,this),this.canvas&&"tagName"in this.canvas&&!Kh(this.canvas,n,s,!0)){let e;try{e=Wp(a,r,this,o)}catch(e){}e&&i(this.canvas,{type:t,property:c,args:e})}return l}});a.push(l)}catch(r){const o=Uh(e,c,{set(e){this.canvas&&"tagName"in this.canvas&&!Kh(this.canvas,n,s,!0)&&i(this.canvas,{type:t,property:c,args:[e],setter:!0})}});a.push(o)}return a}var Jp='(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',Zp="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Jp],{type:"text/javascript;charset=utf-8"});function Yp(e){let t;try{if(t=Zp&&(self.URL||self.webkitURL).createObjectURL(Zp),!t)throw"";const i=new Worker(t,{name:null==e?void 0:e.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),i}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Jp),{name:null==e?void 0:e.name})}}var Xp="A page CSP that omits blob: from worker-src or script-src blocks it";function eg(e,...t){console.warn(`[replay] canvas capture: ${e}`,...t)}var tg=class{onFullSnapshot(){var e;null===(e=this.resetFrameDedup)||void 0===e||e.call(this)}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){Fd(this,"pendingCanvasMutations",new Map),Fd(this,"rafStamps",{latestId:0,invokeId:null}),Fd(this,"mirror",void 0),Fd(this,"mutationCb",void 0),Fd(this,"resetObservers",void 0),Fd(this,"frozen",!1),Fd(this,"locked",!1),Fd(this,"rafIdTimestamp",null),Fd(this,"rafIdFlush",null),Fd(this,"refCount",0),Fd(this,"torndown",!1),Fd(this,"resetFrameDedup",null),Fd(this,"processMutation",(e,t)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)});const{sampling:t="all",win:i,blockClass:n,blockSelector:s,recordCanvas:r,dataURLOptions:o,resolutionScale:a,canvasMasking:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,r&&"all"===t&&this.initCanvasMutationObserver(i,n,s,o),r&&"number"==typeof t&&this.initCanvasFPSObserver(t,i,n,s,{dataURLOptions:o,resolutionScale:a,canvasMasking:l})}initCanvasFPSObserver(e,t,i,n,s){var r=this;if(!("OffscreenCanvas"in t))return void eg("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=Qp(t,i,n,!0),l=new Map;let c;try{c=new Yp}catch(e){return eg(`disabled because the encode worker did not start. ${Xp}`,e),void a()}let u=!1;c.onerror=e=>{var t;u=!0,eg(`stopped because the encode worker failed. ${Xp}`,e),cancelAnimationFrame(g),null===(t=c.terminate)||void 0===t||t.call(c),this.resetFrameDedup=null},this.resetFrameDedup=()=>{c.postMessage({resetFrameDedup:!0})},c.onmessage=e=>{const{id:t}=e.data;if(l.set(t,!1),!("base64"in e.data))return;const{base64:i,type:n,displayWidth:s,displayHeight:r}=e.data;this.mutationCb({id:t,type:zu["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 d=!1,h=!1;const p=1e3/e;let g,_=0;const f=e=>{var a;u||(_&&p>e-_||(_=e,(()=>{const e=[],s=t=>{try{t.querySelectorAll("canvas").forEach(t=>{Kh(t,i,n,!0)||e.push(t)}),t.querySelectorAll("*").forEach(e=>{e.shadowRoot&&s(e.shadowRoot)})}catch(e){}};return s(t.document),e})().forEach((a=rt(function*(e){const t=r.mirror.getId(e);if(-1!==t&&!l.get(t)&&0!==e.width&&0!==e.height){l.set(t,!0);try{if(["webgl","webgl2"].includes(e.__context)){var i,n;const s=e.getContext(e.__context);if(null==s||null===(i=s.isContextLost)||void 0===i?void 0:i.call(s))return void l.set(t,!1);!1===(null==s||null===(n=s.getContextAttributes())||void 0===n?void 0:n.preserveDrawingBuffer)&&s.clear(s.COLOR_BUFFER_BIT)}const r=e.clientWidth||e.width,a=e.clientHeight||e.height,u=Math.max(1,Math.round(r*o)),h=Math.max(1,Math.round(a*o)),p=function(e,t,i,n,s,r){if(!e||"function"!=typeof e.regionsFn)return;let o;try{o=e.regionsFn(t)}catch(e){return Lp}if(void 0===o)return;if(!Array.isArray(o)||!o.every(Op))return Lp;const a=i/s,l=n/r;return o.filter(e=>e.width>0&&e.height>0).map(e=>{const t=Math.floor(e.x*a),i=Math.floor(e.y*l);return{x:t,y:i,width:Math.ceil((e.x+e.width)*a)-t,height:Math.ceil((e.y+e.height)*l)-i}})}(s.canvasMasking,e,u,h,r,a);if("skip-frame"===p)return d||(d=!0,eg("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(t,!1);const g=yield createImageBitmap(e,1>o?{resizeWidth:u,resizeHeight:h,resizeQuality:"medium"}:{resizeWidth:u,resizeHeight:h});c.postMessage({id:t,bitmap:g,width:u,height:h,displayWidth:r,displayHeight:a,dataURLOptions:s.dataURLOptions,maskRegions:p},[g])}catch(e){h||(h=!0,eg("dropped a frame because the snapshot failed. A canvas that fails every frame records no canvas frames at all",e)),l.set(t,!1)}}}),function(e){return a.apply(this,arguments)}))),g=requestAnimationFrame(f))};g=requestAnimationFrame(f),this.resetObservers=()=>{var e;a(),cancelAnimationFrame(g),null===(e=c.terminate)||void 0===e||e.call(c),this.resetFrameDedup=null}}initCanvasMutationObserver(e,t,i,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=Qp(e,t,i,!1),r=function(e,t,i,n,s){const r=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[a])continue;const o=nd(t.CanvasRenderingContext2D.prototype,a,function(r){return function(...o){return Kh(this.canvas,i,n,!0)||setTimeout(()=>{let i;try{i=Wp(o,t,this,s)}catch(e){return}e(this.canvas,{type:zu["2D"],property:a,args:i})},0),r.apply(this,o)}});r.push(o)}catch(s){const o=Uh(t.CanvasRenderingContext2D.prototype,a,{set(t){Kh(this.canvas,i,n,!0)||e(this.canvas,{type:zu["2D"],property:a,args:[t],setter:!0})}});r.push(o)}return()=>{r.forEach(e=>e())}}(this.processMutation.bind(this),e,t,i,n),o=function(e,t,i,n,s){const r=[];return void 0!==t.WebGLRenderingContext&&r.push(...Kp(t.WebGLRenderingContext.prototype,zu.WebGL,e,i,n,t,s)),void 0!==t.WebGL2RenderingContext&&r.push(...Kp(t.WebGL2RenderingContext.prototype,zu.WebGL2,e,i,n,t,s)),()=>{r.forEach(e=>e())}}(this.processMutation.bind(this),e,t,i,n);this.resetObservers=()=>{s(),r(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,this.rafIdTimestamp=requestAnimationFrame(e)};this.rafIdTimestamp=requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const i=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,i)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(e);if(!i||-1===t)return;const n=i.map(e=>bs(e,$u)),{type:s}=i[0];this.mutationCb({id:t,type:s,commands:n}),this.pendingCanvasMutations.delete(e)}};function ig(e){var t,i,n;const s={};for(const n of Object.keys(null!==(t=null===(i=e.previous)||void 0===i?void 0:i.attributes)&&void 0!==t?t:{}))s[n]=null;return Object.assign(s,null===(n=e.current)||void 0===n?void 0:n.attributes),delete s.rel,delete s.href,s}var ng,sg,rg,og=class{constructor(e){var t,i,n;Fd(this,"trackedLinkElements",new WeakSet),Fd(this,"pendingDeferredSheets",new Set),Fd(this,"stopped",!1),Fd(this,"changedLinkJobs",new Map),Fd(this,"linksInlinedSinceSnapshot",new WeakSet),Fd(this,"mutationCb",void 0),Fd(this,"adoptedStyleSheetCb",void 0),Fd(this,"maskAllElementAttributes",void 0),Fd(this,"maskAttributeFn",void 0),Fd(this,"blockClass",void 0),Fd(this,"blockSelector",void 0),Fd(this,"styleMirror",new np),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(t=e.maskAllElementAttributes)&&void 0!==t&&t,this.maskAttributeFn=e.maskAttributeFn,this.blockClass=null!==(i=e.blockClass)&&void 0!==i?i:"rr-block",this.blockSelector=null!==(n=e.blockSelector)&&void 0!==n?n:null}isLinkBlocked(e){return Jh(e,this.blockClass,this.blockSelector)}attachLinkElement(e,t,i=null){this.stopped||!("_cssText"in t.attributes)||this.isLinkBlocked(e)||(this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:ig({previous:i,current:t})}]}),this.linksInlinedSinceSnapshot.add(e)),this.trackLinkElement(e)}beginDeferredLinkInlining(e,t,i={}){var n;const s=null!==(n=i.emitCssText)&&void 0!==n?n:i=>this.emitCssTextMutation(e,t,i);if(-1===t||!e.isConnected)return null;let r=null,o=null;try{o=e.sheet,o&&(r=Vd(o))}catch(e){}var a;if(!r||!o)return Md(),null===(a=i.onUninlinable)||void 0===a||a.call(i),null;const l=r;let c=!1;const u={sheet:o,invalidate(){c=!0}};this.pendingDeferredSheets.add(u);let d=!1;return{advance:t=>{if(d)return!0;const n=rd(),r=ld();let a=!0;try{if(c)return d=!0,i.onInvalidatedBySheetMutation?i.onInvalidatedBySheetMutation():Md(),!0;if(!l.advance(t))return a=!1,!1;d=!0;const n=l.text();if(!e.isConnected)return!0;let r=null;try{r=e.sheet}catch(e){}return r!==o?(Md(),!0):n?(this.isLinkBlocked(e)||s(n),!0):(Md(),null===(h=i.onUninlinable)||void 0===h||h.call(i),!0);var h}finally{a&&this.pendingDeferredSheets.delete(u),cd(p=rd()-n,null!=(g=r)?g:od)||(bd.totalMs+=p,p>bd.slowestSliceMs&&(bd.slowestSliceMs=p))}var p,g},remainingRules:()=>l.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(u)}}}onCssomSheetMutation(e){if(e&&0!==this.pendingDeferredSheets.size)for(const t of this.pendingDeferredSheets)t.sheet===e&&(this.pendingDeferredSheets.delete(t),t.invalidate())}inlineLinkStylesheetAfterChange(e,t){this.stopped||-1===t.currentId()||function(e,t){const i=Eh(e),n=Ch.get(e);if(n)return void(n.changedLinkBaseline&&(n.changedLinkBaseline.sheetAtLatestChange=i));const s={sheetAtLatestChange:i},r=()=>{const t=Eh(e);return Boolean(t&&(t!==s.sheetAtLatestChange||t.href===e.href))};r()?t():Ih(e,t,r,Th,s)}(e,()=>this.inlineChangedLinkStylesheet(e,t,3))}inlineChangedLinkStylesheet(e,t,i){var n;const s=t.currentId();if(this.stopped||!e.isConnected||-1===s||this.isLinkBlocked(e))return;null===(n=this.changedLinkJobs.get(e))||void 0===n||n.drop();let r=!1;const o=this.beginDeferredLinkInlining(e,s,{emitCssText:i=>this.emitCssTextMutation(e,s,i,ig(t.reserializeWithoutCss())),onInvalidatedBySheetMutation(){r=!0},onUninlinable:()=>this.readdAsPlainLink(e,t)});if(!o)return;let a=null;const l=()=>{o.discard(),null==a||a.cancel(),a=null,this.changedLinkJobs.get(e)===c&&this.changedLinkJobs.delete(e)},c={remainingRules:()=>o.remainingRules(),runSlice:()=>{try{return this.stopped||this.changedLinkJobs.get(e)!==c||-1===t.currentId()||this.isLinkBlocked(e)?(l(),!0):!!o.advance(200)&&(l(),!r||(i>0?this.inlineChangedLinkStylesheet(e,t,i-1):Md(),!0))}catch(e){return l(),!0}},drop:l};this.changedLinkJobs.set(e,c);const u=e=>{a=null;let t,i=0;do{t=c.runSlice(),i+=1}while(!t&&(e?!e.didTimeout&&e.timeRemaining()>5:10>i));t||(a=Mp(u))};a=Mp(u)}flushChangedLinkInlining(e){let t=0;for(const i of this.changedLinkJobs.values()){let n=!1;for(;!n;){if(Math.floor(i.remainingRules()/200)+1>e-t){i.drop(),Pd(1);break}n=i.runSlice(),t+=1}}return t}inlineDeferredLinkElement(e,t){var i;null===(i=this.beginDeferredLinkInlining(e,t))||void 0===i||i.advance(1/0)}emitCssTextMutation(e,t,i,n={}){this.stopped||(this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t,attributes:ct(ct({},n),{},{_cssText:Zd({element:e,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})})}]}),this.linksInlinedSinceSnapshot.add(e))}readdAsPlainLink(e,t){try{var i,n;if(this.stopped||!e.isConnected||this.isLinkBlocked(e))return;if(!this.linksInlinedSinceSnapshot.has(e)&&!("_cssText"in(null!==(i=null===(n=t.lastSerialization())||void 0===n?void 0:n.attributes)&&void 0!==i?i:{})))return;this.linksInlinedSinceSnapshot.delete(e),t.readdAsMove()}catch(e){}}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const i={id:t,styleIds:[]},n=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{const i=this.styleMirror.add(t);e=i;const s=rd();try{xd(()=>{try{const e=t.rules||t.cssRules;e&&Cd(e)}catch(e){}n.push({styleId:i,rules:Array.from(t.rules||CSSRule,(e,i)=>({rule:qd(e,t.href),index:i}))})})}finally{Ed(rd()-s)}}i.styleIds.push(e)}n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}stop(){this.stopped=!0,this.dropChangedLinkJobs(),xh()}dropChangedLinkJobs(){Array.from(this.changedLinkJobs.values()).forEach(e=>e.drop())}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),this.dropChangedLinkJobs(),this.linksInlinedSinceSnapshot=new WeakSet,xh({keepChangedLinks:!0})}trackStylesheetInLinkElement(e){}},ag=class{constructor(){Fd(this,"nodeMap",new WeakMap),Fd(this,"active",!1)}inOtherBuffer(e,t){const i=this.nodeMap.get(e);return i&&Array.from(i).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},lg=!1;try{if(2!==Array.from([1],e=>2*e)[0]){var cg;const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null===(cg=e.contentWindow)||void 0===cg?void 0:cg.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var ug=new Gd,dg=new Set([Bu.Mutation,Bu.MediaInteraction,Bu.StyleSheetRule,Bu.CanvasMutation,Bu.Font,Bu.Log,Bu.StyleDeclaration,Bu.AdoptedStyleSheet]);function hg(e={}){let t,i=!1,n=!1;const{emit:s,checkoutEveryNms:r,checkoutEveryNth:o,blockClass:a="rr-block",blockSelector:l=null,ignoreClass:c="rr-ignore",ignoreSelector:u=null,maskTextClass:d="rr-mask",maskTextSelector:h=null,inlineStylesheet:p=!0,inlineStylesheetBudgetRules:g,maskAllInputs:_,maskInputOptions:f,slimDOMOptions:v,maskInputFn:m,maskTextFn:y,maskAllElementAttributes:b=!1,maskAttributeFn:S,hooks:w,packFn:k,sampling:C={},dataURLOptions:x={},canvasResolutionScale:E,canvasMasking:I,mousemoveWait:T,recordDOM:M=!0,recordCanvas:P=!1,recordCrossOriginIframes:R=!1,recordAfter:F=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:A=!1,collectFonts:L=!1,inlineImages:O=!1,plugins:D,keepIframeSrcFn:N=()=>!1,ignoreCSSAttributes:B=new Set([]),attributeFilter:q,errorHandler:H}=e;hp(H);const z=ct({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},x),U=!R||window.parent===window;let W=!1;if(!U)try{window.parent.document&&(W=!1)}catch(e){W=!0}if(U&&!s)throw new Error("emit function is required");if(!U&&!W)return()=>{};void 0!==T&&void 0===C.mousemove&&(C.mousemove=T),ug.reset(),xh();const j=!0===_?{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!==f?f:{password:!0},V=Lh(void 0!==v&&v);let G;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=[].forEach)}();let Q=0;const K=new Map;let J,Z;const Y=e=>{for(const t of D||[])t.eventProcessor&&(e=t.eventProcessor(e));return k&&!W&&(e=k(e)),e};ng=(e,t)=>{var i;const n=e;if(n.timestamp=Wh(),!(null===(i=_p[0])||void 0===i?void 0:i.isFrozen())||n.type===Nu.FullSnapshot||n.type===Nu.IncrementalSnapshot&&dg.has(n.data.source)||_p.forEach(e=>e.unfreeze()),U)null==s||s(Y(n),t);else if(W){const e={type:"rrweb",event:Y(n),origin:window.location.origin,isCheckout:t};window.parent.postMessage(e,"*")}if(n.type===Nu.FullSnapshot)G=n,Q=0;else if(n.type===Nu.IncrementalSnapshot){if(n.data.source===Bu.Mutation&&n.data.isAttachIframe)return;Q++,(o&&Q>=o||r&&n.timestamp-G.timestamp>r)&&sg(!0)}};const X=e=>{if(e.removes&&e.removes.length>0){const t=e.adds.length>0?new Set(e.adds.map(e=>e.node.id)):null,i=new Set;if(e.adds.length>0)for(const t of e.adds){const e=ug.getNode(t.node.id);e&&"IFRAME"===e.nodeName&&i.add(e)}e.removes.forEach(({id:e})=>{if(t&&t.has(e))return;const n=re.getIframeElementById(e);n&&i.has(n)?re.forgetIframeId(e):(null==J||J(e),re.removeIframeById(e))}),null==Z||Z(),re.cleanupDetachedIframes()}ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.Mutation},e)})},ee=e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.Scroll},e)}),te=e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.CanvasMutation},e)}),ie=new og({mutationCb:X,adoptedStyleSheetCb:e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.AdoptedStyleSheet},e)}),maskAllElementAttributes:b,maskAttributeFn:S,blockClass:a,blockSelector:l});let ne=!1;const se=()=>{if(!ne){ne=!0;try{var e;const i=null!==(e=null==t?void 0:t.flush())&&void 0!==e?e:0;ie.flushChangedLinkInlining(50-i)}finally{ne=!1}}},re=new Rp({mirror:ug,mutationCb:X,stylesheetManager:ie,recordCrossOriginIframes:R,wrappedEmit:ng});for(const e of D||[])e.getMirror&&e.getMirror({nodeMirror:ug,crossOriginIframeMirror:re.crossOriginIframeMirror,crossOriginIframeStyleMirror:re.crossOriginIframeStyleMirror});const oe=new ag,ae=null==I?void 0:I.configured;rg=new tg({recordCanvas:P,mutationCb:te,win:window,blockClass:a,blockSelector:l,mirror:ug,sampling:C.canvas,dataURLOptions:z,resolutionScale:E,canvasMasking:I});const le=new Fp({mutationCb:X,scrollCb:ee,bypassOptions:{blockClass:a,blockSelector:l,maskTextClass:d,maskTextSelector:h,inlineStylesheet:p,maskInputOptions:j,dataURLOptions:z,maskTextFn:y,maskInputFn:m,maskAllElementAttributes:b,maskAttributeFn:S,recordCanvas:P,canvasMaskingConfigured:ae,inlineImages:O,sampling:C,slimDOMOptions:V,iframeManager:re,stylesheetManager:ie,canvasManager:rg,keepIframeSrcFn:N,processedNodeManager:oe,attributeFilter:q},mirror:ug});sg=(e=!1)=>{if(M){Sd(g);try{if(ng({type:Nu.Meta,data:{href:window.location.href,width:Gh(),height:Vh()}},e),i)return;null==t||t.cancel(),t=void 0,ie.reset(),le.init(),_p.forEach(e=>e.lock());let n=null,s=[];try{n=function(e,t){const{mirror:i=new Gd,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,canvasMaskingConfigured:u,maskAllInputs:d=!1,maskTextFn:h,maskInputFn:p,maskAllElementAttributes:g=!1,maskAttributeFn:_,slimDOM:f=!1,dataURLOptions:v,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onIframeListenerRegistered:w,onStylesheetLoad:k,stylesheetLoadTimeout:C,keepIframeSrcFn:x=()=>!1,maxDepth:E,inlineStylesheetBudgetRules:I}=t||{},T=!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===d?{password:!0}:d,M=Lh(f);Sd(I);try{return Ah(e,{doc:e,mirror:i,blockClass:n,blockSelector:s,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:T,maskTextFn:h,maskInputFn:p,maskAllElementAttributes:g,maskAttributeFn:_,slimDOMOptions:M,dataURLOptions:v,inlineImages:l,recordCanvas:c,canvasMaskingConfigured:u,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onIframeListenerRegistered:w,onStylesheetLoad:k,stylesheetLoadTimeout:C,keepIframeSrcFn:x,newlyAddedElement:!1,maxDepth:E})}finally{wd()}}(document,{mirror:ug,blockClass:a,blockSelector:l,maskTextClass:d,maskTextSelector:h,inlineStylesheet:p,maskAllInputs:j,inlineStylesheetBudgetRules:g,maskTextFn:y,maskInputFn:m,maskAllElementAttributes:b,maskAttributeFn:S,slimDOM:V,dataURLOptions:z,recordCanvas:P,canvasMaskingConfigured:ae,inlineImages:O,onSerialize(e){ep(e,ug)&&re.addIframe(e),tp(e,ug)&&ie.trackLinkElement(e),ip(e)&&le.addShadowRoot(sd.shadowRoot(e),document)},onIframeLoad(e,t){re.attachIframe(e,t),le.observeAttachShadow(e)},onIframeListenerRegistered(e,t){re.registerLoadListenerDisposer(e,t)},onStylesheetLoad(e,t,i){ie.attachLinkElement(e,t,i)},keepIframeSrcFn:N})}finally{s=Td()}if(i)return;if(!n)return console.warn("Failed to snapshot the document");if(ng({type:Nu.FullSnapshot,data:{node:n,initialOffset:jh(window)}},e),i)return;if(_p.forEach(e=>e.unlock()),rg.onFullSnapshot(),s.length){const e=function(e,t,i){let n=!1,s=null,r=0,o=null;const a=()=>null!==o||e.length>r,l=()=>{const i=e[r];e[r]=null,r+=1,i&&Nh(()=>{o=t.beginDeferredLinkInlining(i,ug.getId(i))})},c=()=>{if(!o)return;const e=o;let t=!0;Nh(()=>{t=e.advance(200)}),t&&(o=null)},u=()=>{o||l(),c()},d=e=>{if(s=null,n)return;let t=0;do{try{u()}catch(e){null==o||o.discard(),o=null,Pd(1)}t+=1}while(!n&&a()&&(e?!e.didTimeout&&e.timeRemaining()>5:10>t));n||(a()?s=Mp(d):i())};return s=Mp(d),{cancel(){n=!0,null==o||o.discard(),o=null,null==s||s.cancel(),s=null},flush(){if(n)return 0;n=!0,null==s||s.cancel(),s=null;let t=0,u=0;for(;a()&&50>t;){o||l();const e=o;if(e)if(Math.floor(e.remainingRules()/200)+1>50-t)e.discard(),o=null,u+=1;else{try{c()}catch(e){null==o||o.discard(),o=null,u+=1}t+=1}}if(a()||u>0){let t=u+(null!==o?1:0);for(let i=r;e.length>i;i++)null!==e[i]&&(t+=1);Pd(t),null==o||o.discard(),o=null}return i(),t}}}(s,ie,()=>{t===e&&(t=void 0)});t=e}R&&re.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ie.adoptStyleSheets(document.adoptedStyleSheets,ug.getId(document))}finally{wd()}}};try{const e=[];e.push(Dh("pagehide",()=>{try{se()}catch(e){}t=void 0},window));for(const t of["visibilitychange","freeze","resume"])e.push(Dh(t,ad,document));J=t=>{const i=K.get(t);i&&(i.forEach(t=>{Nh(t);const i=e.indexOf(t);-1!==i&&e.splice(i,1)}),K.delete(t))},Z=()=>{for(const[e]of K){const t=ug.getNode(e);if(t)try{t.contentDocument&&t.contentDocument.defaultView||null==J||J(e)}catch(t){null==J||J(e)}else null==J||J(e)}};const s=e=>{var t;return gp(Ep)({mutationCb:X,mousemoveCb:(e,t)=>ng({type:Nu.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.MouseInteraction},e)}),scrollCb:ee,viewportResizeCb:e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.ViewportResize},e)}),inputCb:e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.Input},e)}),mediaInteractionCb:e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.MediaInteraction},e)}),styleSheetRuleCb:e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.StyleSheetRule},e)}),styleDeclarationCb:e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.StyleDeclaration},e)}),canvasMutationCb:te,fontCb:e=>ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.Font},e)}),selectionCb(e){ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.Selection},e)})},customElementCb(e){ng({type:Nu.IncrementalSnapshot,data:ct({source:Bu.CustomElement},e)})},blockClass:a,ignoreClass:c,ignoreSelector:u,maskTextClass:d,maskTextSelector:h,maskInputOptions:j,inlineStylesheet:p,sampling:C,recordDOM:M,recordCanvas:P,canvasMaskingConfigured:ae,inlineImages:O,userTriggeredOnInput:A,collectFonts:L,doc:e,maskInputFn:m,maskTextFn:y,maskAllElementAttributes:b,maskAttributeFn:S,keepIframeSrcFn:N,blockSelector:l,slimDOMOptions:V,dataURLOptions:z,mirror:ug,iframeManager:re,stylesheetManager:ie,shadowDomManager:le,processedNodeManager:oe,canvasManager:rg,ignoreCSSAttributes:B,attributeFilter:q,plugins:(null==D||null===(t=D.filter(e=>e.observer))||void 0===t?void 0:t.map(e=>({name:e.name,observer:e.observer,options:e.options,callback:t=>ng({type:Nu.Plugin,data:{plugin:e.name,payload:t}})})))||[]},w)};re.addLoadListener(t=>{try{const i=ug.getId(t),n=s(t.contentDocument);if("function"==typeof n&&(e.push(n),-1!==i)){let e=K.get(i);e||(e=new Set,K.set(i,e)),e.add(n)}}catch(e){console.warn(e)}}),re.addPageHideListener(e=>{const t=ug.getId(e);null==J||J(t),yp(e)});let r=-1;const o=e=>ng({type:Nu.Custom,data:{tag:"rrweb/fullscreen",payload:e}}),g=()=>{var e,t,i,n;const s=document,a=null!==(e=null!==(t=null!==(i=null!==(n=s.fullscreenElement)&&void 0!==n?n:s.webkitFullscreenElement)&&void 0!==i?i:s.mozFullScreenElement)&&void 0!==t?t:s.msFullscreenElement)&&void 0!==e?e:null,l=a?ug.getId(a):-1;l!==r&&(-1!==r&&o({id:r,enter:!1}),r=l,-1!==l&&o({id:l,enter:!0}))},_=()=>{if(i||n)return;if(n=!0,sg(),i)return;const t=s(document);i?"function"==typeof t&&Bh([t]):("function"==typeof t&&e.push(t),e.push(Dh("fullscreenchange",g)),e.push(Dh("webkitfullscreenchange",g)),e.push(Dh("mozfullscreenchange",g)),e.push(Dh("MSFullscreenChange",g)),lg=!0)};return["interactive","complete"].includes(document.readyState)?_():(e.push(Dh("DOMContentLoaded",()=>{ng({type:Nu.DomContentLoaded,data:{}}),"DOMContentLoaded"===F&&setTimeout(_,0)})),e.push(Dh("load",()=>{ng({type:Nu.Load,data:{}}),"load"===F&&_()},window))),()=>{i=!0;try{se()}catch(e){}t=void 0,ie.stop(),Bh(e),oe.destroy(),re.removeLoadListener(),re.destroy(),K.clear(),le.reset(),ug.reset(),lg=!1,pp()}}catch(e){console.warn(e)}}hg.addCustomEvent=(e,t)=>{if(!lg)throw new Error("please add custom event after start recording");ng({type:Nu.Custom,data:{tag:e,payload:t}})},hg.freezePage=()=>{_p.forEach(e=>e.freeze())},hg.takeFullSnapshot=e=>{if(!lg)throw new Error("please take full snapshot after start recording");sg(e)},hg.isRecording=()=>lg,hg.mirror=ug,"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 pg=/[a-z][a-z0-9+.-]{0,63}:\/\//i;new RegExp(`^${pg.source}`,"i"),new RegExp(pg.source,"gi");var gg=Object.create(null);function _g(e){return _g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_g(e)}function fg(e,t,i){return(t=function(e){var t=function(e){if("object"!=_g(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=_g(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_g(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}gg.Node=Object.create(null),gg.ShadowRoot=Object.create(null),gg.MutationObserver=Object.create(null),gg.Element=Object.create(null);var vg=class{constructor(e){fg(this,"fileName",void 0),fg(this,"functionName",void 0),fg(this,"lineNumber",void 0),fg(this,"columnNumber",void 0),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${t})`:`${this.fileName}:${e}:${t}`}},mg=/(^|@)\S+:\d+/,yg=/^\s*at .*(\S+:\d+|\(native\))/m,bg=/^(eval@)?(\[native code])?$/,Sg={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(yg)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):[]:[]},extractLocation(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error(`Cannot parse given url: ${e}`);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE(e){return e.stack.split("\n").filter(function(e){return!!e.match(yg)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const i=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=i?t.replace(i[0],""):t;const n=t.split(/\s+/).slice(1),s=this.extractLocation(i?i[1]:n.pop());return new vg({functionName:n.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(s[0])>-1?void 0:s[0],lineNumber:s[1],columnNumber:s[2]})},this)},parseFFOrSafari(e){return e.stack.split("\n").filter(function(e){return!e.match(bg)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new vg({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=e.match(t),n=i&&i[1]?i[1]:void 0,s=this.extractLocation(e.replace(t,""));return new vg({functionName:n,fileName:s[0],lineNumber:s[1],columnNumber:s[2]})}},this)},parseOpera(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9(e){const t=/Line (\d+).*script (?:in )?(\S+)/i,i=e.message.split("\n"),n=[];for(let e=2,s=i.length;s>e;e+=2){const s=t.exec(i[e]);s&&n.push(new vg({fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera10(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=e.stacktrace.split("\n"),n=[];for(let e=0,s=i.length;s>e;e+=2){const s=t.exec(i[e]);s&&n.push(new vg({functionName:s[3]||void 0,fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera11(e){return e.stack.split("\n").filter(function(e){return!!e.match(mg)&&!e.match(/^Error created at/)},this).map(function(e){const t=e.split("@"),i=this.extractLocation(t.pop());return new vg({functionName:(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function wg(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let i=e.localName;if(!i)break;i=i.toLowerCase();const n=e.parentElement,s=[];if(n.children&&n.children.length>0)for(let e=0;n.children.length>e;e++){const t=n.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===i&&s.push(t)}s.length>1&&(i+=`:eq(${s.indexOf(e)})`),t=i+(t?">"+t:""),e=n}return t}function kg(e){return Array.isArray(e)}function Cg(e){return"object"==typeof e&&null!==e&&!kg(e)}function xg(e,t){if(0===t)return!0;const i=Object.keys(e);for(const n of i)if(Cg(e[n])&&xg(e[n],t-1))return!0;return!1}function Eg(e,t){const i={numOfKeysLimit:50,depthOfLimit:4};Object.assign(i,t);const n=[],s=[];return JSON.stringify(e,function(e,t){if(n.length>0){const i=n.indexOf(this);~i?n.splice(i+1):n.push(this),~i?s.splice(i,1/0,e):s.push(e),~n.indexOf(t)&&(t=n[0]===t?"[Circular ~]":"[Circular ~."+s.slice(0,n.indexOf(t)).join(".")+"]")}else n.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(Cg(r=t)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||Cg(r)&&xg(r,i.depthOfLimit))return function(e){let t=e.toString();return i.stringLengthLimit&&t.length>i.stringLengthLimit&&(t=`${t.slice(0,i.stringLengthLimit)}...`),t}(t);var r;if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){const e={};for(const i in t){const n=t[i];e[i]=kg(n)?wg(n.length?n[0]:null):n}return e}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t})}var Ig={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 Tg(e,t,i){const n=i?Object.assign({},Ig,i):Ig,s=n.logger;if(!s)return()=>{};let r;r="string"==typeof s?t[s]:s;let o=0,a=!1,l=!0;const c=[];if(n.level.includes("error")){const i=t=>{const i=t.message;e({level:"error",trace:Sg.parse(t.error).map(e=>e.toString()),payload:[Eg(i,n.stringifyOptions)]})};t.addEventListener("error",i),c.push(()=>{t.removeEventListener("error",i)});const s=t=>{let i,s;t.reason instanceof Error?(i=t.reason,s=[Eg(`Uncaught (in promise) ${i.name}: ${i.message}`,n.stringifyOptions)]):(i=new Error,s=[Eg("Uncaught (in promise)",n.stringifyOptions),Eg(t.reason,n.stringifyOptions)]),e({level:"error",trace:Sg.parse(i).map(e=>e.toString()),payload:s})};t.addEventListener("unhandledrejection",s),c.push(()=>{t.removeEventListener("unhandledrejection",s)})}for(const e of n.level)c.push(u(r,e));return()=>{l=!1,c.forEach(e=>e())};function u(t,i){return t[i]?function(s,r){try{if(!(r in s))return()=>{};const c=s[r],u={next:c},d=(s=>(...r)=>{if(s.apply(t,r),l&&!("assert"===i&&r[0]||a)){a=!0;try{const t=Sg.parse(new Error).map(e=>e.toString()).splice(1),s=("assert"===i?r.slice(1):r).map(e=>Eg(e,n.stringifyOptions));o++,n.lengthThreshold>o?e({level:i,trace:t,payload:s}):o===n.lengthThreshold&&e({level:"warn",trace:[],payload:[Eg("The number of log records reached the threshold.")]})}catch(e){s.apply(t,["rrweb logger error:",e,...r])}finally{a=!1}}})(function(...e){return u.next.apply(this,e)});return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:c},__rrweb_layer__:{enumerable:!1,value:u}})),s[r]=d,()=>{if(s[r]===d)return void(s[r]=u.next);const e=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0};let t=s[r],i=e(t);for(;i;){if(i.next===d)return void(i.next=u.next);t=i.next,i=e(t)}}}catch(e){return()=>{}}}(t,i):()=>{}}}var Mg=e=>({name:"rrweb/console@1",observer:Tg,options:e});const Pg=()=>{},Rg=e=>{var t;if(Ct(e))return null!==(t=e.__posthog_layer__)&&void 0!==t?t:e.__rrweb_layer__};function Fg(e,t,i){try{if(!(t in e))return Pg;const n={next:e[t]},s=i(function(...e){return n.next.apply(this,e)});return Ct(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:n}})),e[t]=s,()=>{if(e[t]===s)return void(e[t]=n.next);let i=e[t],r=Rg(i);for(;r;){if(r.next===s)return void(r.next=n.next);i=r.next,r=Rg(i)}}}catch(e){return Pg}}function Ag(e,t){var i;const n=function(e){try{return"string"==typeof e?new URL(e).hostname:"url"in e?new URL(e.url).hostname:e.hostname}catch(e){return null}}(e),s={hostname:n,isHostDenied:!1};if(!(null===(i=t.payloadHostDenyList)||void 0===i?void 0:i.length)||!(null==n?void 0:n.trim().length))return s;for(const e of t.payloadHostDenyList)if(n.endsWith(e))return{hostname:n,isHostDenied:!0};return s}const Lg=Nr("[Recorder]"),Og=e=>"navigation"===e.entryType,Dg=e=>"resource"===e.entryType,$g=()=>{};function Ng(e,t){var i;return Og(t)&&"complete"===(null===(i=e.document)||void 0===i?void 0:i.readyState)&&t.loadEventEnd>0}function Bg(e,t){return t.recordInitialRequests?e.performance.getEntries().filter(i=>Ng(e,i)||Dg(i)&&t.initiatorTypes.includes(i.initiatorType)):t.performanceEntryTypeToObserve.includes("navigation")?function(e){var t;return"complete"!==(null===(t=e.document)||void 0===t?void 0:t.readyState)?[]:e.performance.getEntriesByType("navigation").filter(t=>Ng(e,t))}(e):[]}function qg(e,t){return!!t&&(Lt(t)||t[e])}function Hg(e){if("undefined"==typeof Request)return!1;if(e instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(e)}catch(e){return!1}}const zg=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function Ug({type:e,recordBody:t,headers:i,url:n}){function s(e){const t=Object.keys(i).find(e=>"content-type"===e.toLowerCase()),n=t&&i[t];return e.some(e=>null==n?void 0:n.toLowerCase().includes(e))}if(!t)return!1;if(function e(t){try{return"string"==typeof t?t.startsWith("blob:"):t instanceof URL?"blob:"===t.protocol:!!Hg(t)&&e(t.url)}catch(e){return!1}}(n))return!1;if(s(zg))return!1;if(Lt(t))return!0;if(kt(t))return s(t);const r=t[e];return Lt(r)?r:s(r)}function Wg(e,t,i,n,s){return jg.apply(this,arguments)}function jg(){return jg=rt(function*(e,t,i,n,s,r=0){if(r>10)return Lg.warn("Failed to get performance entry for request",{url:i,initiatorType:t}),null;const o=function(e,t){for(let i=e.length-1;i>=0;i-=1)if(t(e[i]))return e[i]}(e.performance.getEntriesByName(i),e=>Dg(e)&&e.initiatorType===t&&(It(n)||e.startTime>=n)&&(It(s)||s>=e.startTime));return o||(yield new Promise(e=>setTimeout(e,50*r)),Wg(e,t,i,n,s,r+1))}),jg.apply(this,arguments)}function Vg({body:e,options:t,url:i}){if(Rt(e))return null;const{hostname:n,isHostDenied:s}=Ag(i,t);if(s)return n+" is in deny list";if(Tt(e))return e;if((e=>"u">typeof Document&&e instanceof Document)(e))return e.textContent;if(Ot(e))return io(e);if(xt(e))try{return JSON.stringify(e)}catch(e){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(e)}const Gg=e=>!Pt(e)&&("navigation"===e.entryType||"resource"===e.entryType);function Qg(e,{entry:t,method:i,status:n,networkRequest:s,isInitial:r,start:o,end:a,url:l,initiatorType:c}){o=t?t.startTime:o,a=t?t.responseEnd:a;const u=Math.floor(Date.now()-e.performance.now()),d=Math.floor(u+(o||0)),h=[ct(ct({},t?JSON.parse(JSON.stringify(t.toJSON())):{name:l}),{},{startTime:It(o)?void 0:Math.round(o),endTime:It(a)?void 0:Math.round(a),timeOrigin:u,timestamp:d,method:i,initiatorType:c||(t?t.initiatorType:void 0),status:n,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:r})];if(Gg(t))for(const e of t.serverTiming||[])h.push({timeOrigin:u,timestamp:d,startTime:Math.round(t.startTime),name:e.name,duration:e.duration,entryType:"serverTiming"});return h}const Kg=["video/","audio/"];function Jg(e){return xt(e)&&Ct(e.getReader)&&Ct(e.tee)}const Zg="[SessionReplay] Timeout while trying to read body",Yg="[SessionReplay] Failed to read body";function Xg(e){return`${Yg}: ${e}`}function e_(e){return`[SessionReplay] Body too large to record (> ${e} bytes)`}function t_(e,t){if(!t.streamNetworkBody)return function(e){return new Promise(t=>{const i=setTimeout(()=>t(Zg),500);try{e.clone().text().then(e=>t(e),e=>t(Xg(e))).finally(()=>clearTimeout(i))}catch(e){clearTimeout(i),t(Yg)}})}(e);const i=ta(t);return function(e,t){try{var i,n;const s=null===(i=e.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>t}catch(e){return!1}}(e,i)?Promise.resolve(e_(i)):function(e,t){return new Promise(i=>{let n,s=!1;function r(){try{null==n||n.cancel().catch(()=>{})}catch(e){}}function o(e){s||(s=!0,clearTimeout(a),r(),i(e))}const a=setTimeout(()=>o(Zg),500);let l;try{l=e.clone()}catch(e){return void o(Yg)}const c=l.body;if(!Jg(c)||"undefined"==typeof TextDecoder){try{l.text().then(e=>o(e),e=>o(Xg(e)))}catch(e){o(Yg)}return}try{n=c.getReader()}catch(e){return void o(Yg)}const u=[];let d=0;!function e(){n.read().then(({done:i,value:n})=>{if(s)r();else if(i)o((new TextDecoder).decode(function(e,t){const i=new Uint8Array(t);let n=0;for(const t of e)i.set(t,n),n+=t.byteLength;return i}(u,d)));else{if(n){if(d+n.byteLength>t)return void o(e_(t));d+=n.byteLength,u.push(n)}e()}},e=>o(Xg(e)))}()})}(e,i)}function i_(e){return n_.apply(this,arguments)}function n_(){return n_=rt(function*({r:e,options:t,url:i}){const{hostname:n,isHostDenied:s}=Ag(i,t);return s?Promise.resolve(n+" is in deny list"):t_(e,t)}),n_.apply(this,arguments)}function s_(e){return r_.apply(this,arguments)}function r_(){return r_=rt(function*({r:e,options:t,url:i}){const n=function({r:e,options:t,url:i}){var n;if("chunked"===e.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";const s=null===(n=e.headers.get("Content-Type"))||void 0===n?void 0:n.toLowerCase(),r=Kg.some(e=>null==s?void 0:s.startsWith(e));if(s&&r)return`Content-Type ${s} is not supported`;const{hostname:o,isHostDenied:a}=Ag(i,t);return a?o+" is in deny list":null}({r:e,options:t,url:i});return Pt(n)?t_(e,t):Promise.resolve(n)}),r_.apply(this,arguments)}let o_=null;function a_(e,t,i){if(!("performance"in t))return()=>{};if(o_)return Lg.warn("Network observer already initialised, doing nothing"),()=>{};const n=i?Object.assign({},ia,i):ia;let s=!0,r=!1;const o=t=>{if(!s)return;const i=[];let o=!1;t.requests.forEach(e=>{const t="serverTiming"===e.entryType;if(t&&o)return;let s;try{s=n.maskRequestFn(e)}catch(e){return r||(r=!0,Lg.warn("Network capture masking callback failed; dropping the record. Further masking failures will not be logged for this observer.")),void(t||(o=!0))}t||(o=!s||(e=>!!e&&ua.has(e))(s)),s&&i.push(s)}),i.length>0&&e(ct(ct({},t),{},{requests:i}))},a=function(e,t,i){try{e({requests:Bg(t,i).flatMap(e=>Qg(t,{entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}catch(e){Lg.error("Failed to capture initial performance entries for network capture",e)}const n=t.PerformanceObserver,s=null==n?void 0:n.supportedEntryTypes;if(!n||!kt(s))return;const r=s.filter(e=>i.performanceEntryTypeToObserve.includes(e));if(!r.length)return;const o=new n(n=>{e({requests:n.getEntries().filter(e=>Og(e)||Dg(e)&&i.initiatorTypes.includes(e.initiatorType)&&(e=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)).flatMap(e=>Qg(t,{entry:e,method:void 0,status:void 0,networkRequest:{}}))})});return o.observe({entryTypes:r}),()=>{o.disconnect()}}(o,t,n),l=n.recordHeaders||n.recordBody;if(!a&&!l)return s=!1,$g;let c=()=>{},u=()=>{};return l&&(c=function(e,t,i){if(!i.initiatorTypes.includes("xmlhttprequest"))return()=>{};const n=qg("request",i.recordHeaders),s=qg("response",i.recordHeaders),r=Fg(t.XMLHttpRequest.prototype,"open",r=>function(o,a,l=!0,c,u){const d=this;try{const r=new Request(a),l={};let c,u;const h={},p=d.setRequestHeader.bind(d);d.setRequestHeader=(e,t)=>(h[e]=t,p(e,t)),n&&(l.requestHeaders=h);const g=d.send.bind(d);d.send=e=>(Ug({type:"request",headers:h,url:a,recordBody:i.recordBody})&&(l.requestBody=Vg({body:e,options:i,url:a})),c=t.performance.now(),g(e));const _=()=>{d.removeEventListener("readystatechange",f),d.removeEventListener("error",_),d.removeEventListener("abort",_),d.removeEventListener("timeout",_)},f=()=>{if(d.readyState!==d.DONE)return;_(),u=t.performance.now();const n={};d.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(e=>{const t=e.split(": "),i=t.shift(),s=t.join(": ");i&&(n[i]=s)}),s&&(l.responseHeaders=n),Ug({type:"response",headers:n,url:a,recordBody:i.recordBody})&&(l.responseBody=Vg({body:d.response,options:i,url:a})),Wg(t,"xmlhttprequest",r.url,c,u).then(i=>{e({requests:Qg(t,{entry:i,method:o,status:null==d?void 0:d.status,networkRequest:l,start:c,end:u,url:a.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};d.addEventListener("readystatechange",f),d.addEventListener("error",_),d.addEventListener("abort",_),d.addEventListener("timeout",_)}catch(e){Lg.error("Failed to instrument XHR for network capture",e)}r.call(d,o,a.toString(),l,c,u)});return()=>{r()}}(o,t,n),u=!0===n.captureFetchSynchronously?function(e,t,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=qg("request",i.recordHeaders),s=qg("response",i.recordHeaders),r=Fg(t,"fetch",r=>function(o,a){let l;try{l=new Request(o,a)}catch(e){Lg.error("Failed to instrument fetch for network capture",e);try{return Promise.resolve(r(o,a))}catch(e){return new Promise((t,i)=>i(e))}}const c={};let u,d;const h=rt(function*(){try{const e={};l.headers.forEach((t,i)=>{e[i]=t}),n&&(c.requestHeaders=e),!Jg(null==a?void 0:a.body)&&Ug({type:"request",headers:e,url:o,recordBody:i.recordBody})&&(c.requestBody=yield i_({r:l,options:i,url:o}))}catch(e){Lg.error("Failed to record fetch request for network capture",e)}})(),p=(g=rt(function*(e){try{const t={};e.headers.forEach((e,i)=>{t[i]=e}),s&&(c.responseHeaders=t),Ug({type:"response",headers:t,url:o,recordBody:i.recordBody})&&(c.responseBody=yield s_({r:e,options:i,url:o}))}catch(e){Lg.error("Failed to record fetch response for network capture",e)}}),function(e){return g.apply(this,arguments)});var g;try{u=t.performance.now()}catch(e){}let _;try{_=Hg(o)?r(l):r(o,a)}catch(e){_=new Promise((t,i)=>i(e))}const f=Promise.resolve(_).then(e=>{try{d=t.performance.now()}catch(e){}return{status:"fulfilled",response:e}},e=>({status:"rejected",error:e}));return rt(function*(){let i;try{yield h;const e=yield f;if("rejected"===e.status)throw e.error;return i=e.response,yield p(i),i}finally{(n=i,Wg(t,"fetch",l.url,u,d).then(i=>{e({requests:Qg(t,{entry:i,method:l.method,status:null==n?void 0:n.status,networkRequest:c,start:u,end:d,url:l.url,initiatorType:"fetch"})})})).catch(()=>{})}var n})()});return()=>{r()}}(o,t,n):function(e,t,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=qg("request",i.recordHeaders),s=qg("response",i.recordHeaders),r=Fg(t,"fetch",r=>function(){var o=rt(function*(o,a){let l,c;try{l=new Request(o,a)}catch(e){return Lg.error("Failed to instrument fetch for network capture",e),r(o,a)}const u={};let d,h;try{try{const e={};l.headers.forEach((t,i)=>{e[i]=t}),n&&(u.requestHeaders=e),!Jg(null==a?void 0:a.body)&&Ug({type:"request",headers:e,url:o,recordBody:i.recordBody})&&(u.requestBody=yield i_({r:l,options:i,url:o}))}catch(e){Lg.error("Failed to record fetch request for network capture",e)}d=t.performance.now(),c=Hg(o)?yield r(l):yield r(o,a),h=t.performance.now();try{const e={};c.headers.forEach((t,i)=>{e[i]=t}),s&&(u.responseHeaders=e),Ug({type:"response",headers:e,url:o,recordBody:i.recordBody})&&(u.responseBody=yield s_({r:c,options:i,url:o}))}catch(e){Lg.error("Failed to record fetch response for network capture",e)}return c}finally{Wg(t,"fetch",l.url,d,h).then(i=>{e({requests:Qg(t,{entry:i,method:l.method,status:null==c?void 0:c.status,networkRequest:u,start:d,end:h,url:l.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(e,t){return o.apply(this,arguments)}}());return()=>{r()}}(o,t,n)),o_=()=>{s=!1,null==a||a(),c(),u(),o_=null},o_}const l_=e=>({name:"rrweb/network@1",observer:a_,options:e});var c_,u_,d_,h_,p_,g_,__,f_,v_,m_,y_,b_,S_,w_,k_;d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Mg,getRecordNetworkPlugin:l_},d.__PosthogExtensions__.rrweb={record:hg,version:"v2",wasMaxDepthReached:()=>Fh,resetMaxDepthState(){Fh=!1,Rh=!1},getLastSnapshotCost:()=>gd,getMutationCost:()=>ct({},yd),getObserverInitFailures:()=>xp.size?Array.from(xp):void 0,resetSnapshotCostState(){ud=0,dd=0,hd=0,od=0,pd={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},gd=null,_d=null,fd=[],vd=0,md=0,yd={slowestBatchMs:0},bd={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},d.rrweb={record:hg,version:"v2"},d.rrwebConsoleRecord={getRecordConsolePlugin:Mg},d.getRecordNetworkPlugin=l_,d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initSessionRecording=(e,t)=>new Du(e,t);var C_={},x_=[],E_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,I_=Array.isArray;function T_(e,t){for(var i in t)e[i]=t[i];return e}function M_(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function P_(e,t,i){var n,s,r,o={};for(r in t)"key"==r?n=t[r]:"ref"==r?s=t[r]:o[r]=t[r];if(arguments.length>2&&(o.children=arguments.length>3?c_.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(r in e.defaultProps)void 0===o[r]&&(o[r]=e.defaultProps[r]);return R_(e,o,n,s,null)}function R_(e,t,i,n,s){var r={type:e,props:t,key:i,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==s?++d_:s,__i:-1,__u:0};return null==s&&null!=u_.vnode&&u_.vnode(r),r}function F_(e){return e.children}function A_(e,t){this.props=e,this.context=t}function L_(e,t){if(null==t)return e.__?L_(e.__,e.__i+1):null;for(var i;e.__k.length>t;t++)if(null!=(i=e.__k[t])&&null!=i.__e)return i.__e;return"function"==typeof e.type?L_(e):null}function O_(e){if(e.__P&&e.__d){var t=e.__v,i=t.__e,n=[],s=[],r=T_({},t);r.__v=t.__v+1,u_.vnode&&u_.vnode(r),j_(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[i]:null,n,null==i?L_(t):i,!!(32&t.__u),s),r.__v=t.__v,r.__.__k[r.__i]=r,G_(n,r,s),t.__e=t.__=null,r.__e!=i&&D_(r)}}function D_(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),D_(e)}function $_(e){(!e.__d&&(e.__d=!0)&&h_.push(e)&&!N_.__r++||p_!=u_.debounceRendering)&&((p_=u_.debounceRendering)||g_)(N_)}function N_(){try{for(var e,t=1;h_.length;)h_.length>t&&h_.sort(__),e=h_.shift(),t=h_.length,O_(e)}finally{h_.length=N_.__r=0}}function B_(e,t,i,n,s,r,o,a,l,c,u){var d,h,p,g,_,f,v,m=n&&n.__k||x_,y=t.length;for(l=function(e,t,i,n,s){var r,o,a,l,c,u=i.length,d=u,h=0;for(e.__k=new Array(s),r=0;s>r;r++)null!=(o=t[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=e.__k[r]=R_(null,o,null,null,null):I_(o)?o=e.__k[r]=R_(F_,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=e.__k[r]=R_(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[r]=o,l=r+h,o.__=e,o.__b=e.__b+1,a=null,-1!=(c=o.__i=H_(o,i,l,d))&&(d--,(a=i[c])&&(a.__u|=2)),null==a||null==a.__v?(-1==c&&(s>u?h--:u>s&&h++),"function"!=typeof o.type&&(o.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,o.__u|=4))):e.__k[r]=null;if(d)for(r=0;u>r;r++)null!=(a=i[r])&&!(2&a.__u)&&(a.__e==n&&(n=L_(a)),J_(a,a));return n}(i,t,m,l,y),d=0;y>d;d++)null!=(p=i.__k[d])&&(h=-1!=p.__i&&m[p.__i]||C_,p.__i=d,f=j_(e,p,h,s,r,o,a,l,c,u),g=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&K_(h.ref,null,p),u.push(p.ref,p.__c||g,p)),null==_&&null!=g&&(_=g),(v=!!(4&p.__u))||h.__k===p.__k?(l=q_(p,l,e,v),v&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==f?l=f:g&&(l=g.nextSibling),p.__u&=-7);return i.__e=_,l}function q_(e,t,i,n){var s,r;if("function"==typeof e.type){for(s=e.__k,r=0;s&&s.length>r;r++)s[r]&&(s[r].__=e,t=q_(s[r],t,i,n));return t}e.__e!=t&&(n&&(t&&e.type&&!t.parentNode&&(t=L_(e)),i.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function H_(e,t,i,n){var s,r,o,a=e.key,l=e.type,c=t[i],u=null!=c&&!(2&c.__u);if(null===c&&null==a||u&&a==c.key&&l==c.type)return i;if(n>(u?1:0))for(s=i-1,r=i+1;s>=0||t.length>r;)if(null!=(c=t[o=0>s?r++:s--])&&!(2&c.__u)&&a==c.key&&l==c.type)return o;return-1}function z_(e,t,i){"-"==t[0]?e.setProperty(t,null==i?"":i):e[t]=null==i?"":"number"!=typeof i||E_.test(t)?i:i+"px"}function U_(e,t,i,n,s){var r,o;e:if("style"==t)if("string"==typeof i)e.style.cssText=i;else{if("string"==typeof n&&(e.style.cssText=n=""),n)for(t in n)i&&t in i||z_(e.style,t,"");if(i)for(t in i)n&&i[t]==n[t]||z_(e.style,t,i[t])}else if("o"==t[0]&&"n"==t[1])r=t!=(t=t.replace(y_,"$1")),o=t.toLowerCase(),t=o in e||"onFocusOut"==t||"onFocusIn"==t?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=i,i?n?i[m_]=n[m_]:(i[m_]=b_,e.addEventListener(t,r?w_:S_,r)):e.removeEventListener(t,r?w_:S_,r);else{if("http://www.w3.org/2000/svg"==s)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==i?"":i;break e}catch(e){}"function"==typeof i||(null==i||!1===i&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==i?"":i))}}function W_(e){return function(t){if(this.l){var i=this.l[t.type+e];if(null==t[v_])t[v_]=b_++;else if(i[m_]>t[v_])return;return i(u_.event?u_.event(t):t)}}}function j_(e,t,i,n,s,r,o,a,l,c){var u,d,h,p,g,_,f,v,m,y,$,b,S,w,k,C,x=t.type;if(void 0!==t.constructor)return null;128&i.__u&&(l=!!(32&i.__u),r=[a=t.__e=i.__e]),(u=u_.__b)&&u(t);e:if("function"==typeof x){d=o.length;try{if(m=t.props,y=x.prototype&&x.prototype.render,$=(u=x.contextType)&&n[u.__c],b=u?$?$.props.value:u.__:n,i.__c?v=(h=t.__c=i.__c).__=h.__E:(y?t.__c=h=new x(m,b):(t.__c=h=new A_(m,b),h.constructor=x,h.render=Z_),$&&$.sub(h),h.state||(h.state={}),h.__n=n,p=h.__d=!0,h.__h=[],h._sb=[]),y&&null==h.__s&&(h.__s=h.state),y&&null!=x.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=T_({},h.__s)),T_(h.__s,x.getDerivedStateFromProps(m,h.__s))),g=h.props,_=h.state,h.__v=t,p)y&&null==x.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),y&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(y&&null==x.getDerivedStateFromProps&&m!==g&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,b),t.__v==i.__v||!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,b)){t.__v!=i.__v&&(h.props=m,h.state=h.__s,h.__d=!1),t.__e=i.__e,t.__k=i.__k,t.__k.some(function(e){e&&(e.__=t)}),x_.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&o.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,b),y&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(g,_,f)})}if(h.context=b,h.props=m,h.__P=e,h.__e=!1,S=u_.__r,w=0,y)h.state=h.__s,h.__d=!1,S&&S(t),u=h.render(h.props,h.state,h.context),x_.push.apply(h.__h,h._sb),h._sb=[];else do{h.__d=!1,S&&S(t),u=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&25>++w);h.state=h.__s,null!=h.getChildContext&&(n=T_(T_({},n),h.getChildContext())),y&&!p&&null!=h.getSnapshotBeforeUpdate&&(f=h.getSnapshotBeforeUpdate(g,_)),k=null!=u&&u.type===F_&&null==u.key?Q_(u.props.children):u,a=B_(e,I_(k)?k:[k],t,i,n,s,r,o,a,l,c),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),v&&(h.__E=h.__=null)}catch(e){if(o.length=d,t.__v=null,l||null!=r)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=r&&(r[r.indexOf(a)]=null),t.__e=a}else{if(null!=r)for(C=r.length;C--;)M_(r[C]);V_(t)}else t.__e=i.__e,!t.__k&&i.__k&&(t.__k=i.__k),e.then||V_(t);u_.__e(e,t,i)}}else null==r&&t.__v==i.__v?(t.__k=i.__k,t.__e=i.__e):a=t.__e=function(e,t,i,n,s,r,o,a,l){var c,u,d,h,p,g,_,f=i.props||C_,v=t.props,m=t.type;if("svg"==m?s="http://www.w3.org/2000/svg":"math"==m?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=r)for(c=0;r.length>c;c++)if((p=r[c])&&"setAttribute"in p==!!m&&(m?p.localName==m:3==p.nodeType)){e=p,r[c]=null;break}if(null==e){if(null==m)return document.createTextNode(v);e=document.createElementNS(s,m,v.is&&v),a&&(u_.__m&&u_.__m(t,r),a=!1),r=null}if(null==m)f===v||a&&e.data==v||(e.data=v);else{if(r="textarea"==m&&null!=v.defaultValue?null:r&&c_.call(e.childNodes),!a&&null!=r)for(f={},c=0;e.attributes.length>c;c++)f[(p=e.attributes[c]).name]=p.value;for(c in f)p=f[c],"dangerouslySetInnerHTML"==c?d=p:"children"==c||c in v||"value"==c&&"defaultValue"in v||"checked"==c&&"defaultChecked"in v||U_(e,c,null,p,s);for(c in v)p=v[c],"children"==c?h=p:"dangerouslySetInnerHTML"==c?u=p:"value"==c?g=p:"checked"==c?_=p:a&&"function"!=typeof p||f[c]===p||U_(e,c,p,f[c],s);if(u)a||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),B_("template"==t.type?e.content:e,I_(h)?h:[h],t,i,n,"foreignObject"==m?"http://www.w3.org/1999/xhtml":s,r,o,r?r[0]:i.__k&&L_(i,0),a,l),null!=r)for(c=r.length;c--;)M_(r[c]);a&&"textarea"!=m||(c="value","progress"==m&&null==g?e.removeAttribute("value"):null!=g&&(g!==e[c]||"progress"==m&&!g||"option"==m&&g!=f[c])&&U_(e,c,g,f[c],s),c="checked",null!=_&&_!=e[c]&&U_(e,c,_,f[c],s))}return e}(i.__e,t,i,n,s,r,o,l,c);return(u=u_.diffed)&&u(t),128&t.__u?void 0:a}function V_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(V_))}function G_(e,t,i){for(var n=0;i.length>n;n++)K_(i[n],i[++n],i[++n]);u_.__c&&u_.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){u_.__e(e,t.__v)}})}function Q_(e){return"object"!=typeof e||null==e||e.__b>0?e:I_(e)?e.map(Q_):void 0!==e.constructor?null:T_({},e)}function K_(e,t,i){try{if("function"==typeof e){var n="function"==typeof e.__u;n&&e.__u(),n&&null==t||(e.__u=e(t))}else e.current=t}catch(e){u_.__e(e,i)}}function J_(e,t,i){var n,s;if(u_.unmount&&u_.unmount(e),(n=e.ref)&&(n.current&&n.current!=e.__e||K_(n,null,t)),null!=(n=e.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(e){u_.__e(e,t)}n.base=n.__P=n.__n=null}if(n=e.__k)for(s=0;n.length>s;s++)n[s]&&J_(n[s],t,i||"function"!=typeof e.type);i||M_(e.__e),e.__c=e.__=e.__e=void 0}function Z_(e,t,i){return this.constructor(e,i)}function Y_(e,t,i){var n,s,r,o;t==document&&(t=document.documentElement),u_.__&&u_.__(e,t),s=(n="function"==typeof i)?null:i&&i.__k||t.__k,r=[],o=[],j_(t,e=(!n&&i||t).__k=P_(F_,null,[e]),s||C_,C_,t.namespaceURI,!n&&i?[i]:s?null:t.firstChild?c_.call(t.childNodes):null,r,!n&&i?i:s?s.__e:t.firstChild,n,o),G_(r,e,o),e.props.children=null}c_=x_.slice,u_={__e(e,t,i,n){for(var s,r,o;t=t.__;)if((s=t.__c)&&!s.__)try{if((r=s.constructor)&&null!=r.getDerivedStateFromError&&(s.setState(r.getDerivedStateFromError(e)),o=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(e,n||{}),o=s.__d),o)return s.__E=s}catch(t){e=t}throw e}},d_=0,A_.prototype.setState=function(e,t){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=T_({},this.state);"function"==typeof e&&(e=e(T_({},i),this.props)),e&&T_(i,e),null!=e&&this.__v&&(t&&this._sb.push(t),$_(this))},A_.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),$_(this))},A_.prototype.render=F_,h_=[],g_="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,__=function(e,t){return e.__v.__b-t.__v.__b},N_.__r=0,f_=Math.random().toString(8),v_="__d"+f_,m_="__a"+f_,y_=/(PointerCapture)$|Capture$/i,b_=0,S_=W_(!1),w_=W_(!0),k_=0;var X_=0;function ef(e,t,i,n,s,r){t||(t={});var o,a,l=t;if("ref"in l)for(a in l={},t)"ref"==a?o=t[a]:l[a]=t[a];var c={type:e,props:l,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--X_,__i:-1,__u:0,__source:s,__self:r};if("function"==typeof e&&(o=e.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return u_.vnode&&u_.vnode(c),c}const tf="featureFlagsCommon";function nf({client:e,config:t}){var i;if(!e||!t.uiHost)return;const n=null===(i=e.session)||void 0===i?void 0:i.sessionId;return n?`${t.uiHost}/project/${e.projectToken}/replay/${n}`:void 0}var sf,rf,of,af,lf=0,cf=[],uf=u_,df=uf.__b,hf=uf.__r,pf=uf.diffed,gf=uf.__c,_f=uf.unmount,ff=uf.__;function vf(e,t){uf.__h&&uf.__h(rf,e,lf||t),lf=0;var i=rf.__H||(rf.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function mf(e){return lf=1,function(e,t){var i=vf(sf++,2);if(i.t=e,!i.__c&&(i.__=[Mf(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=rf,!rf.__f)){var n=function(e,t,n){if(!i.__c.__H)return!0;var r=!1,o=i.__c.props!==e;if(i.__c.__H.__.some(function(e){if(e.__N){r=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),s){var a=s.call(this,e,t,n);return r?a||o:a}return!r||o};rf.__f=!0;var s=rf.shouldComponentUpdate,r=rf.componentWillUpdate;rf.componentWillUpdate=function(e,t,i){if(this.__e){var o=s;s=void 0,n(e,t,i),s=o}r&&r.call(this,e,t,i)},rf.shouldComponentUpdate=n}return i.__N||i.__}(Mf,e)}function yf(e,t){var i=vf(sf++,3);!uf.__s&&Tf(i.__H,t)&&(i.__=e,i.u=t,rf.__H.__h.push(i))}function bf(e){return lf=5,Sf(function(){return{current:e}},[])}function Sf(e,t){var i=vf(sf++,7);return Tf(i.__H,t)&&(i.__=e(),i.__H=t,i.__h=e),i.__}function wf(e){var t=rf.context[e.__c],i=vf(sf++,9);return i.c=e,t?(null==i.__&&(i.__=!0,t.sub(rf)),t.props.value):e.__}function kf(){for(var e;e=cf.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ef),t.__h.some(If),t.__h=[]}catch(i){t.__h=[],uf.__e(i,e.__v)}}}uf.__b=function(e){rf=null,df&&df(e)},uf.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ff&&ff(e,t)},uf.__r=function(e){hf&&hf(e),sf=0;var t=(rf=e.__c).__H;t&&(of===rf?(t.__h=[],rf.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.length&&kf(),sf=0)),of=rf},uf.diffed=function(e){pf&&pf(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==cf.push(t)&&af===uf.requestAnimationFrame||((af=uf.requestAnimationFrame)||xf)(kf)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),of=rf=null},uf.__c=function(e,t){t.some(function(e){try{e.__h.some(Ef),e.__h=e.__h.filter(function(e){return!e.__||If(e)})}catch(i){t.some(function(e){e.__h&&(e.__h=[])}),t=[],uf.__e(i,e.__v)}}),gf&&gf(e,t)},uf.unmount=function(e){_f&&_f(e);var t,i=e.__c;i&&i.__H&&(i.__H.__.some(function(e){try{Ef(e)}catch(e){t=e}}),i.__H=void 0,t&&uf.__e(t,i.__v))};var Cf="function"==typeof requestAnimationFrame;function xf(e){var t,i=function(){clearTimeout(n),Cf&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(i,35);Cf&&(t=requestAnimationFrame(i))}function Ef(e){var t=rf,i=e.__c;"function"==typeof i&&(e.__c=void 0,i()),rf=t}function If(e){var t=rf;e.__c=e.__(),rf=t}function Tf(e,t){return!e||e.length!==t.length||t.some(function(t,i){return t!==e[i]})}function Mf(e,t){return"function"==typeof t?t(e):t}const Pf="events",Rf="cancelEvents",Ff="tab",Af="left",Lf="center",Of="right",Df="next_to_trigger",$f="popover",Nf="widget",Bf="external_survey",qf="open",Hf="multiple_choice",zf="single_choice",Uf="rating",Wf="end",jf="always",Vf="survey shown",Gf="survey dismissed",Qf="survey sent",Kf="$survey_id",Jf="$survey_name",Zf="$survey_iteration",Yf="$survey_iteration_start_date",Xf="$survey_last_seen_date",ev="$survey_language",tv="popover",iv=Nr("[Surveys]"),nv="PostHog is not capturing, so a survey response cannot be recorded";function sv(e){return!(!e.start_date||e.end_date)}function rv(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}const ov=(e,t)=>`${e}${function(e){return e.current_iteration&&e.current_iteration>0?`${e.id}_${e.current_iteration}`:e.id}(t)}`,av=e=>ov("seenSurvey_",e),lv=e=>{try{const t=av(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){iv.error("Failed to persist survey seen state",e)}},cv=[$f,Nf,"api"],uv={ignoreConditions:!1,ignoreDelay:!1,displayType:tv};function dv(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);t>i;i++)n[i]=e[i];return n}function hv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,s,r,o,a=[],l=!0,c=!1;try{if(r=(i=i.call(e)).next,0===t);else for(;!(l=(n=r.call(i)).done)&&(a.push(n.value),a.length!==t);l=!0);}catch(e){c=!0,s=e}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(c)throw s}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return dv(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?dv(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const pv=Object.entries,gv=Object.setPrototypeOf,_v=Object.isFrozen,fv=Object.getPrototypeOf,vv=Object.getOwnPropertyDescriptor;let mv=Object.freeze,yv=Object.seal,bv=Object.create,Sv="undefined"!=typeof Reflect&&Reflect,wv=Sv.apply,kv=Sv.construct;mv||(mv=function(e){return e}),yv||(yv=function(e){return e}),wv||(wv=function(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),s=2;i>s;s++)n[s-2]=arguments[s];return e.apply(t,n)}),kv||(kv=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;t>n;n++)i[n-1]=arguments[n];return new e(...i)});const Cv=jv([].forEach),xv=jv([].lastIndexOf),Ev=jv([].pop),Iv=jv([].push),Tv=jv([].splice),Mv=Array.isArray,Pv=jv("".toLowerCase),Rv=jv("".toString),Fv=jv("".match),Av=jv("".replace),Lv=jv("".indexOf),Ov=jv("".trim),Dv=jv((0).toString),$v=jv(Boolean.prototype.toString),Nv="undefined"==typeof BigInt?null:jv(BigInt.prototype.toString),Bv="undefined"==typeof Symbol?null:jv(Symbol.prototype.toString),qv=jv({}.hasOwnProperty),Hv=jv({}.toString),zv=jv(/t/.test),Uv=(Wv=TypeError,function(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];return kv(Wv,t)});var Wv;function jv(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var i=arguments.length,n=new Array(i>1?i-1:0),s=1;i>s;s++)n[s-1]=arguments[s];return wv(e,t,n)}}function Vv(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Pv;if(gv&&gv(e,null),!Mv(t))return e;let n=t.length;for(;n--;){let s=t[n];if("string"==typeof s){const e=i(s);e!==s&&(_v(t)||(t[n]=e),s=e)}e[s]=!0}return e}function Gv(e){for(let t=0;e.length>t;t++)qv(e,t)||(e[t]=null);return e}function Qv(e){const t=bv(null);for(const n of pv(e)){var i=hv(n,2);const s=i[0],r=i[1];qv(e,s)&&(t[s]=Mv(r)?Gv(r):r&&"object"==typeof r&&r.constructor===Object?Qv(r):r)}return t}function Kv(e,t){for(;null!==e;){const i=vv(e,t);if(i){if(i.get)return jv(i.get);if("function"==typeof i.value)return jv(i.value)}e=fv(e)}return function(){return null}}const Jv=mv(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Zv=mv(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Yv=mv(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Xv=mv(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),em=mv(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),tm=mv(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),im=mv(["#text"]),nm=mv(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),sm=mv(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),rm=mv(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),om=mv(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),am=yv(/{{[\w\W]*|^[\w\W]*}}/g),lm=yv(/<%[\w\W]*|^[\w\W]*%>/g),cm=yv(/\${[\w\W]*/g),um=yv(/^data-[\-\w.\u00B7-\uFFFF]+$/),dm=yv(/^aria-[\-\w]+$/),hm=yv(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),pm=yv(/^(?:\w+script|data):/i),gm=yv(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),_m=yv(/^html$/i),fm=yv(/^[a-z][.\w]*(-[.\w]+)+$/i),vm=yv(/<[/\w!]/g),mm=yv(/<[/\w]/g),ym=yv(/<\/no(script|embed|frames)/i),bm=yv(/\/>/i),Sm=function(){return"undefined"==typeof window?null:window},wm=function(e,t,i,n){return qv(e,t)&&Mv(e[t])?Vv(n.base?Qv(n.base):{},e[t],n.transform):i};var km=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Sm();const i=t=>e(t);if(i.version="3.4.13",i.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return i.isSupported=!1,i;let n=t.document;const s=n,r=s.currentScript,o=t.HTMLTemplateElement,a=t.Node,l=t.NodeFilter,c=t.DOMParser,u=t.trustedTypes,d=t.Element.prototype,h=Kv(d,"cloneNode"),p=Kv(d,"remove"),g=Kv(d,"nextSibling"),_=Kv(d,"childNodes"),f=Kv(d,"parentNode"),v=Kv(d,"shadowRoot"),m=Kv(d,"attributes"),y=a&&a.prototype?Kv(a.prototype,"nodeType"):null,b=a&&a.prototype?Kv(a.prototype,"nodeName"):null,S=a&&a.prototype?Kv(a.prototype,"ownerDocument"):null;if("function"==typeof o){const e=n.createElement("template");e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let w,k,C="",x=!1,E=0;const I=function(){if(E>0)throw Uv('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},T=function(e){I(),E++;try{return w.createHTML(e)}finally{E--}},M=n.implementation,P=n.createNodeIterator,R=n.createDocumentFragment,F=n.getElementsByTagName,A=s.importNode;let L={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};i.isSupported="function"==typeof pv&&"function"==typeof f&&M&&void 0!==M.createHTMLDocument;const O=am,D=lm,N=cm,B=um,q=dm,H=pm,z=gm,U=fm;let W=hm,j=null;const V=Vv({},[...Jv,...Zv,...Yv,...em,...im]);let G=null;const Q=Vv({},[...nm,...sm,...rm,...om]);let K=Object.seal(bv(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),J=null,Z=null;const Y=Object.seal(bv(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let X=!0,ee=!0,te=!1,ie=!0,ne=!1,se=!0,re=!1,oe=!1,ae=null,le=null,ce=!1,ue=!1,de=!1,he=!1,pe=!0,ge=!1;const _e="user-content-";let fe=!0,ve=!1,me={},ye=null;const be=Vv({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Se=null;const we=Vv({},["audio","video","img","source","image","track"]);let ke=null;const Ce=Vv({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),xe="http://www.w3.org/1998/Math/MathML",Ee="http://www.w3.org/2000/svg",Ie="http://www.w3.org/1999/xhtml";let Te=Ie,Me=!1,Pe=null;const Re=Vv({},[xe,Ee,Ie],Rv),Fe=mv(["mi","mo","mn","ms","mtext"]);let Ae=Vv({},Fe);const Le=mv(["annotation-xml"]);let Oe=Vv({},Le);const De=Vv({},["title","style","font","a","script"]);let $e=null;const Ne=["application/xhtml+xml","text/html"];let Be=null,qe=null;const He=n.createElement("form"),ze=function(e){return e instanceof RegExp||e instanceof Function},Ue=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(qe&&qe===e)return;e&&"object"==typeof e||(e={}),e=Qv(e),$e=-1===Ne.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Be="application/xhtml+xml"===$e?Rv:Pv,j=wm(e,"ALLOWED_TAGS",V,{transform:Be}),G=wm(e,"ALLOWED_ATTR",Q,{transform:Be}),Pe=wm(e,"ALLOWED_NAMESPACES",Re,{transform:Rv}),ke=wm(e,"ADD_URI_SAFE_ATTR",Ce,{transform:Be,base:Ce}),Se=wm(e,"ADD_DATA_URI_TAGS",we,{transform:Be,base:we}),ye=wm(e,"FORBID_CONTENTS",be,{transform:Be}),J=wm(e,"FORBID_TAGS",Qv({}),{transform:Be}),Z=wm(e,"FORBID_ATTR",Qv({}),{transform:Be}),me=!!qv(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?Qv(e.USE_PROFILES):e.USE_PROFILES),X=!1!==e.ALLOW_ARIA_ATTR,ee=!1!==e.ALLOW_DATA_ATTR,te=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ie=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,ne=e.SAFE_FOR_TEMPLATES||!1,se=!1!==e.SAFE_FOR_XML,re=e.WHOLE_DOCUMENT||!1,ue=e.RETURN_DOM||!1,de=e.RETURN_DOM_FRAGMENT||!1,he=e.RETURN_TRUSTED_TYPE||!1,ce=e.FORCE_BODY||!1,pe=!1!==e.SANITIZE_DOM,ge=e.SANITIZE_NAMED_PROPS||!1,fe=!1!==e.KEEP_CONTENT,ve=e.IN_PLACE||!1,W=function(e){try{return zv(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:hm,Te="string"==typeof e.NAMESPACE?e.NAMESPACE:Ie,Ae=qv(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?Qv(e.MATHML_TEXT_INTEGRATION_POINTS):Vv({},Fe),Oe=qv(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?Qv(e.HTML_INTEGRATION_POINTS):Vv({},Le);const t=qv(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?Qv(e.CUSTOM_ELEMENT_HANDLING):bv(null);if(K=bv(null),qv(t,"tagNameCheck")&&ze(t.tagNameCheck)&&(K.tagNameCheck=t.tagNameCheck),qv(t,"attributeNameCheck")&&ze(t.attributeNameCheck)&&(K.attributeNameCheck=t.attributeNameCheck),qv(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(K.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),yv(K),ne&&(ee=!1),de&&(ue=!0),me&&(j=Vv({},im),G=bv(null),!0===me.html&&(Vv(j,Jv),Vv(G,nm)),!0===me.svg&&(Vv(j,Zv),Vv(G,sm),Vv(G,om)),!0===me.svgFilters&&(Vv(j,Yv),Vv(G,sm),Vv(G,om)),!0===me.mathMl&&(Vv(j,em),Vv(G,rm),Vv(G,om))),Y.tagCheck=null,Y.attributeCheck=null,qv(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?Y.tagCheck=e.ADD_TAGS:Mv(e.ADD_TAGS)&&(j===V&&(j=Qv(j)),Vv(j,e.ADD_TAGS,Be))),qv(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?Y.attributeCheck=e.ADD_ATTR:Mv(e.ADD_ATTR)&&(G===Q&&(G=Qv(G)),Vv(G,e.ADD_ATTR,Be))),qv(e,"ADD_URI_SAFE_ATTR")&&Mv(e.ADD_URI_SAFE_ATTR)&&Vv(ke,e.ADD_URI_SAFE_ATTR,Be),qv(e,"FORBID_CONTENTS")&&Mv(e.FORBID_CONTENTS)&&(ye===be&&(ye=Qv(ye)),Vv(ye,e.FORBID_CONTENTS,Be)),qv(e,"ADD_FORBID_CONTENTS")&&Mv(e.ADD_FORBID_CONTENTS)&&(ye===be&&(ye=Qv(ye)),Vv(ye,e.ADD_FORBID_CONTENTS,Be)),fe&&(j["#text"]=!0),re&&Vv(j,["html","head","body"]),j.table&&(Vv(j,["tbody"]),delete J.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Uv('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Uv('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=w;w=e.TRUSTED_TYPES_POLICY;try{C=T("")}catch(e){throw w=t,e}}else null===e.TRUSTED_TYPES_POLICY?(w=void 0,C=""):(void 0===w&&(x||(k=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let i=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(i=t.getAttribute(n));const s="dompurify"+(i?"#"+i:"");try{return e.createPolicy(s,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+s+" could not be created."),null}}(u,r),x=!0),w=k),w&&"string"==typeof C&&(C=T("")));mv&&mv(e),qe=e},We=Vv({},[...Zv,...Yv,...Xv]),je=Vv({},[...em,...tm]),Ve=function(e){Iv(i.removed,{element:e});try{f(e).removeChild(e)}catch(t){if(p(e),!f(e))throw Uv("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Ge=function(e){Je(e);const t=_(e);if(t){const e=[];Cv(t,t=>{Iv(e,t)}),Cv(e,e=>{try{p(e)}catch(e){}})}const i=m(e);if(i)for(let t=i.length-1;t>=0;--t){const n=i[t],s=n&&n.name;if("string"==typeof s)try{e.removeAttribute(s)}catch(e){}}},Qe=function(e,t){try{Iv(i.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Iv(i.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ue||de)try{Ve(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Ke=function(e){const t=m(e);if(t)for(let i=t.length-1;i>=0;--i){const n=t[i],s=n&&n.name;if("string"==typeof s&&!G[Be(s)])try{e.removeAttribute(s)}catch(e){}}},Je=function(e){const t=[e];for(;t.length>0;){const e=t.pop();1===(y?y(e):e.nodeType)&&Ke(e);const i=_(e);if(i)for(let e=i.length-1;e>=0;--e)t.push(i[e])}},Ze=function(e){let t=null,i=null;if(ce)e="<remove></remove>"+e;else{const t=Fv(e,/^[\r\n\t ]+/);i=t&&t[0]}"application/xhtml+xml"===$e&&Te===Ie&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const s=w?T(e):e;if(Te===Ie)try{t=(new c).parseFromString(s,$e)}catch(e){}if(!t||!t.documentElement){t=M.createDocument(Te,"template",null);try{t.documentElement.innerHTML=Me?C:s}catch(e){}}const r=t.body||t.documentElement;return e&&i&&r.insertBefore(n.createTextNode(i),r.childNodes[0]||null),Te===Ie?F.call(t,re?"html":"body")[0]:re?t.documentElement:r},Ye=function(e){const t=S?S(e):e.ownerDocument;return P.call(t||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Xe=function(e){return e=Av(e,O," "),e=Av(e,D," "),Av(e,N," ")},et=function(e){var t;e.normalize();const i=S?S(e):e.ownerDocument,n=P.call(i||e,e,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let s=n.nextNode();for(;s;)s.data=Xe(s.data),s=n.nextNode();const r=null===(t=e.querySelectorAll)||void 0===t?void 0:t.call(e,"template");r&&Cv(r,e=>{it(e.content)&&et(e.content)})},tt=function(e){const t=b?b(e):null;return"string"==typeof t&&"form"===Be(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==m(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==y(e)||e.childNodes!==_(e))},it=function(e){if(!y||"object"!=typeof e||null===e)return!1;try{return 11===y(e)}catch(e){return!1}},nt=function(e){if(!y||"object"!=typeof e||null===e)return!1;try{return"number"==typeof y(e)}catch(e){return!1}};function st(e,t,n){0!==e.length&&Cv(e,e=>{e.call(i,t,n,qe)})}const rt=function(e,t,i,n){return 0===e.length?t:t===i||t===n?Qv(t):t},ot=function(e,t){if(st(L.beforeSanitizeElements,e,null),e!==t&&null===f(e))return ve&&Je(e),!0;if(tt(e))return Ve(e),!0;const n=Be(b?b(e):e.nodeName);if(j=rt(L.uponSanitizeElement,j,V,ae),st(L.uponSanitizeElement,e,{tagName:n,allowedTags:j}),e!==t&&null===f(e))return ve&&Je(e),!0;if(function(e,t){return!!(se&&e.hasChildNodes()&&!nt(e.firstElementChild)&&zv(vm,e.textContent)&&zv(vm,e.innerHTML))||!(!se||e.namespaceURI!==Ie||"style"!==t||!nt(e.firstElementChild))||7===e.nodeType||!(!se||8!==e.nodeType||!zv(mm,e.data))}(e,n))return Ve(e),!0;if(J[n]||!(Y.tagCheck instanceof Function&&Y.tagCheck(n))&&!j[n]){const i=function(e,t,i){if(!J[t]&&ct(t)){if(K.tagNameCheck instanceof RegExp&&zv(K.tagNameCheck,t))return!1;if(K.tagNameCheck instanceof Function&&K.tagNameCheck(t))return!1}if(fe&&!ye[t]){const t=f(e),n=_(e);if(n&&t)for(let s=n.length-1;s>=0;--s){const r=e===i?h(n[s],!0):n[s];t.insertBefore(r,g(e))}}return Ve(e),!0}(e,n,t);return!1===i&&st(L.afterSanitizeElements,e,null),i}if(1===(y?y(e):e.nodeType)&&!function(e){let t=f(e);t&&t.tagName||(t={namespaceURI:Te,tagName:"template"});const i=Pv(e.tagName),n=Pv(t.tagName);return!!Pe[e.namespaceURI]&&(e.namespaceURI===Ee?function(e,t,i){return t.namespaceURI===Ie?"svg"===e:t.namespaceURI===xe?"svg"===e&&("annotation-xml"===i||Ae[i]):Boolean(We[e])}(i,t,n):e.namespaceURI===xe?function(e,t,i){return t.namespaceURI===Ie?"math"===e:t.namespaceURI===Ee?"math"===e&&Oe[i]:Boolean(je[e])}(i,t,n):e.namespaceURI===Ie?function(e,t,i){return!(t.namespaceURI===Ee&&!Oe[i])&&!(t.namespaceURI===xe&&!Ae[i])&&!je[e]&&(De[e]||!We[e])}(i,t,n):!("application/xhtml+xml"!==$e||!Pe[e.namespaceURI]))}(e))return Ve(e),!0;if(("noscript"===n||"noembed"===n||"noframes"===n)&&zv(ym,e.innerHTML))return Ve(e),!0;if(ne&&3===e.nodeType){const t=Xe(e.textContent);e.textContent!==t&&(Iv(i.removed,{element:e.cloneNode()}),e.textContent=t)}return st(L.afterSanitizeElements,e,null),!1},at=function(e,t,i){if(Z[t])return!1;if(se&&"patchsrc"===t)return!1;if(se&&"for"===t&&"label"!==e&&"output"!==e)return!1;if(pe&&("id"===t||"name"===t)&&(i in n||i in He))return!1;const s=G[t]||Y.attributeCheck instanceof Function&&Y.attributeCheck(t,e);if(ee&&zv(B,t));else if(X&&zv(q,t));else if(s){if(ke[t]);else if(zv(W,Av(i,z,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Lv(i,"data:")||!Se[e])if(te&&!zv(H,Av(i,z,"")));else if(i)return!1}else if(!(ct(e)&&(K.tagNameCheck instanceof RegExp&&zv(K.tagNameCheck,e)||K.tagNameCheck instanceof Function&&K.tagNameCheck(e))&&(K.attributeNameCheck instanceof RegExp&&zv(K.attributeNameCheck,t)||K.attributeNameCheck instanceof Function&&K.attributeNameCheck(t,e))||"is"===t&&K.allowCustomizedBuiltInElements&&(K.tagNameCheck instanceof RegExp&&zv(K.tagNameCheck,i)||K.tagNameCheck instanceof Function&&K.tagNameCheck(i))))return!1;return!0},lt=Vv({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ct=function(e){return!lt[Pv(e)]&&zv(U,e)},ut=function(e,t,i,n){if(w&&"object"==typeof u&&"function"==typeof u.getAttributeType&&!i)switch(u.getAttributeType(e,t)){case"TrustedHTML":return T(n);case"TrustedScriptURL":return function(e){I(),E++;try{return w.createScriptURL(e)}finally{E--}}(n)}return n},dt=function(e,t,n,s){try{n?e.setAttributeNS(n,t,s):e.setAttribute(t,s),tt(e)?Ve(e):Ev(i.removed)}catch(i){Qe(t,e)}},ht=function(e){st(L.beforeSanitizeAttributes,e,null);const t=e.attributes;if(!t||tt(e))return;G=rt(L.uponSanitizeAttribute,G,Q,le);const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:G,forceKeepAttr:void 0};let n=t.length;const s=Be(e.nodeName);for(;n--;){const r=t[n],o=r.name,a=r.namespaceURI,l=r.value,c=Be(o),u=l;let d="value"===o?u:Ov(u);i.attrName=c,i.attrValue=d,i.keepAttr=!0,i.forceKeepAttr=void 0,st(L.uponSanitizeAttribute,e,i),d=i.attrValue,!ge||"id"!==c&&"name"!==c||0===Lv(d,_e)||(Qe(o,e),d=_e+d),se&&zv(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)||"attributename"===c&&Fv(d,"href")?Qe(o,e):i.forceKeepAttr||(!i.keepAttr||!ie&&zv(bm,d)?Qe(o,e):(ne&&(d=Xe(d)),at(s,c,d)?(d=ut(s,c,a,d),d!==u&&dt(e,o,a,d)):Qe(o,e)))}st(L.afterSanitizeAttributes,e,null)},pt=function(e){let t=null;const i=Ye(e);for(st(L.beforeSanitizeShadowDOM,e,null);t=i.nextNode();)if(st(L.uponSanitizeShadowNode,t,null),ot(t,e),ht(t),it(t.content)&&pt(t.content),1===(y?y(t):t.nodeType)){const e=v(t);it(e)&&(gt(e),pt(e))}st(L.afterSanitizeShadowDOM,e,null)},gt=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){pt(e.shadow);continue}const i=e.node,n=1===(y?y(i):i.nodeType),s=_(i);if(s)for(let e=s.length-1;e>=0;--e)t.push({node:s[e],shadow:null});if(n){const e=b?b(i):null;if("string"==typeof e&&"template"===Be(e)){const e=i.content;it(e)&&t.push({node:e,shadow:null})}}if(n){const e=v(i);it(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return i.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=null,o=null,a=null;if(Me=!e,Me&&(e="\x3c!--\x3e"),"string"!=typeof e&&!nt(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return Dv(e);case"boolean":return $v(e);case"bigint":return Nv?Nv(e):"0";case"symbol":return Bv?Bv(e):"Symbol()";case"undefined":default:return Hv(e);case"function":case"object":{if(null===e)return Hv(e);const t=e,i=Kv(t,"toString");if("function"==typeof i){const e=i(t);return"string"==typeof e?e:Hv(e)}return Hv(e)}}}(e)))throw Uv("dirty is not a string, aborting");if(!i.isSupported)return e;oe?(j=ae,G=le):Ue(t),(L.uponSanitizeElement.length>0||L.uponSanitizeAttribute.length>0)&&(j=Qv(j)),L.uponSanitizeAttribute.length>0&&(G=Qv(G)),i.removed=[];const l=ve&&"string"!=typeof e&&nt(e);if(l){!function(e){if(!se)return;const t=[e];for(;t.length>0;){const e=t.pop(),i=y?y(e):e.nodeType;if(7===i||8===i&&zv(mm,e.data)){try{p(e)}catch(e){}continue}if(1===i){const t=e,i=Be(b?b(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute("patchsrc")&&t.removeAttribute("patchsrc"),t.hasAttribute&&t.hasAttribute("for")&&"label"!==i&&"output"!==i&&t.removeAttribute("for")}catch(e){}}const n=_(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}}(e);const t=b?b(e):e.nodeName;if("string"==typeof t){const i=Be(t);if(!j[i]||J[i])throw Ge(e),Uv("root node is forbidden and cannot be sanitized in-place")}if(tt(e))throw Ge(e),Uv("root node is clobbered and cannot be sanitized in-place");try{gt(e)}catch(t){throw Ge(e),t}}else if(nt(e))n=Ze("\x3c!----\x3e"),r=n.ownerDocument.importNode(e,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?n=r:n.appendChild(r),gt(r);else{if(!ue&&!ne&&!re&&-1===e.indexOf("<"))return w&&he?T(e):e;if(n=Ze(e),!n)return ue?null:he?C:""}n&&ce&&Ve(n.firstChild);const c=l?e:n;try{const e=Ye(c);for(;o=e.nextNode();)ot(o,c),ht(o),it(o.content)&&pt(o.content)}catch(t){throw l&&(Ge(e),Cv(i.removed,e=>{e.element&&Je(e.element)})),t}if(l)return Cv(i.removed,e=>{e.element&&Je(e.element)}),ne&&et(e),e;if(ue){if(ne&&et(n),de)for(a=R.call(n.ownerDocument);n.firstChild;)a.appendChild(n.firstChild);else a=n;return(G.shadowroot||G.shadowrootmode)&&(a=A.call(s,a,!0)),a}let u=re?n.outerHTML:n.innerHTML;return re&&j["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&zv(_m,n.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+u),ne&&(u=Xe(u)),w&&he?T(u):u},i.setConfig=function(){Ue(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),oe=!0,ae=j,le=G},i.clearConfig=function(){qe=null,oe=!1,ae=null,le=null,w=k,C=""},i.isValidAttribute=function(e,t,i){qe||Ue({});const n=Be(e),s=Be(t);return at(n,s,i)},i.addHook=function(e,t){"function"==typeof t&&qv(L,e)&&Iv(L[e],t)},i.removeHook=function(e,t){if(qv(L,e)){if(void 0!==t){const i=xv(L[e],t);return-1===i?void 0:Tv(L[e],i,1)[0]}return Ev(L[e])}},i.removeHooks=function(e){qv(L,e)&&(L[e]=[])},i.removeAllHooks=function(){L={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},i}();const Cm=["a","abbr","acronym","area","article","aside","b","bdi","bdo","blockquote","br","caption","center","cite","code","col","colgroup","data","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","footer","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","img","ins","kbd","li","map","mark","nav","ol","p","pre","q","rp","rt","rtc","ruby","s","samp","small","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","time","tr","tt","u","ul","var","wbr"],xm=["style","lang","title","width","height"],Em=["abbr","align","axis","bgcolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"],Im={a:["href","hreflang","target","rel"],bdo:["dir"],blockquote:["cite"],col:["align","char","charoff","span"],colgroup:["align","char","charoff","span"],del:["cite","datetime"],hr:["align","size","width"],img:["align","alt","height","src","width"],ins:["cite","datetime"],ol:["start","type"],q:["cite"],table:["align","bgcolor","border","cellpadding","cellspacing","frame","rules","summary","width"],tbody:["align","char","charoff","valign"],td:Em,tfoot:["align","char","charoff","valign"],th:Em,thead:["align","char","charoff","valign"],tr:["align","bgcolor","char","charoff","valign"]};let Tm;function Mm(e){var t;const i=(null!==(t=Tm)&&void 0!==t?t:Tm=km()).sanitize(e,{ALLOWED_TAGS:Cm,ALLOWED_ATTR:[],ALLOW_ARIA_ATTR:!1,ALLOW_DATA_ATTR:!1,ALLOWED_NAMESPACES:["http://www.w3.org/1999/xhtml"],ADD_ATTR:(e,t)=>-1!==xm.indexOf(e)||{}.hasOwnProperty.call(Im,t)&&-1!==(Im[t]||[]).indexOf(e),RETURN_DOM_FRAGMENT:!0}),n=i.querySelectorAll("a");for(let e=0;n.length>e;e++)n.item(e).relList.add("noopener");const s=document.createElement("div");return s.appendChild(i),s.innerHTML}const Pm=Nr("[Stylesheet Loader]"),Rm="#020617",Fm={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:Of,widgetType:Ff,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,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:Rm,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},Am=[Lf,Af,Of];function Lm(e){if(e.startsWith("#")){let t=e.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(t)&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),/^[0-9A-Fa-f]{6}$/.test(t)?`rgb(${parseInt(t.slice(0,2),16)},${parseInt(t.slice(2,4),16)},${parseInt(t.slice(4,6),16)})`:"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function Om(e=Fm.backgroundColor){let t;"#"===e[0]&&(t=Lm(e)),e.startsWith("rgb")&&(t=e);const i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[e.toLowerCase()];if(i&&(t=Lm(i)),!t)return Rm;const n=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(n){const e=parseInt(n[1]),t=parseInt(n[2]),i=parseInt(n[3]);return Math.sqrt(e*e*.299+t*t*.587+i*i*.114)>127.5?Rm:"white"}return Rm}const Dm=(e,t,i)=>{const n=ty(e),s=document.querySelector(`.${n}`);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};const r=document.createElement("div");((e,t,i)=>{const n=ct(ct({},Fm),i),s=e.style,r=!Am.includes(n.position)||t===Nf&&(null==i?void 0:i.widgetType)===Ff;s.setProperty("--ph-survey-font-family",function(e){if("inherit"===e)return"inherit";const t='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return e?`${e}, ${t}`:`-apple-system, ${t}`}(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)||Om(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",Om(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||Om(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",Om(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)||Om(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,e.type,e.appearance),r.className=n;const o=r.attachShadow({mode:"open"}),a=function(e){const t=((e,t,i)=>{let n=e.createElement("style");n.innerText=t;const s=(e=>{var t;return Ct(e)?e:null==e||null===(t=e.config)||void 0===t?void 0:t.prepare_external_dependency_stylesheet})(i);return s&&(n=s(n)),n||(Pm.error("prepare_external_dependency_stylesheet returned null"),null)})(document,':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)}}',null==e?void 0:e.config.prepareStylesheet);return null==t||t.setAttribute("data-ph-survey-style","true"),t}(t);if(a){const e=o.querySelector("style");e&&o.removeChild(e),o.appendChild(a)}return(i||document.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},$m=e=>{try{const t=av(e);localStorage.getItem(t)||localStorage.setItem(t,"true")}catch(e){iv.error("Failed to persist survey seen state",e)}},Nm=({responses:e,survey:t,surveySubmissionId:i,posthog:n,isSurveyCompleted:s,properties:r,surveyLanguage:o,questionSnapshots:a})=>{var l,c,u;n?(null===(l=n.client)||void 0===l?void 0:l.canCapture)&&($m(t),s&&ey(t),null===(c=n.client)||void 0===c||c.capture(Qf,ct(ct(ct({[Jf]:t.name,[Kf]:t.id,[Zf]:t.current_iteration,[Yf]:t.current_iteration_start_date,sessionRecordingUrl:nf(n)},tc(ct(ct({event:"sent",survey:t,responses:e,submissionId:i,completed:s},!It(o)&&{surveyLanguage:o}),!It(a)&&{questionSnapshots:a}))),r),{},{$set:{[nc(t,"responded")]:!0}})),s&&(window.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:t.id}})),null===(u=n.client)||void 0===u||null===(u=u.getExtension("featureFlagsCommon"))||void 0===u||u.reloadFeatureFlags())):iv.error("[survey sent] event not captured, PostHog instance not found.")},Bm=(e,t,i,n)=>ct({[Jf]:t.name,[Kf]:t.id,[Zf]:t.current_iteration,[Yf]:t.current_iteration_start_date,sessionRecordingUrl:nf(n)},tc(ct(ct(ct(ct({event:e,survey:t},!It(null==i?void 0:i.responses)&&{responses:i.responses}),!It(null==i?void 0:i.surveySubmissionId)&&{submissionId:i.surveySubmissionId}),!It(null==i?void 0:i.surveyLanguage)&&{surveyLanguage:i.surveyLanguage}),!It(null==i?void 0:i.questionSnapshots)&&{questionSnapshots:i.questionSnapshots}))),qm=(e,t,i,n)=>{var s;if(!t)return void iv.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const r=Ym(e),o=r?r.surveyLanguage:n,a=ct(ct(ct({},Bm("dismissed",e,r,t)),o&&{[ev]:o}),{},{$set:{[nc(e,"dismissed")]:!0}});ey(e),$m(e),null===(s=t.client)||void 0===s||s.capture(Gf,a),window.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))},Hm=(e,t)=>{var i,n;if(!t)return void iv.error("[survey abandoned] event not captured, PostHog instance not found.");if(!(null===(i=t.client)||void 0===i?void 0:i.canCapture))return;const s=(e=>ov("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(s))return}catch(e){return}const r=Ym(e);if(r){try{localStorage.setItem(s,"true")}catch(e){}null===(n=t.client)||void 0===n||n.capture("survey abandoned",Bm("abandoned",e,r,t),{delivery:"unload"})}},zm=e=>{const t=e.map(e=>e.id);return t.every(e=>!!e)?t:void 0},Um=(e,t)=>{var i,n,s;return(e=>e.questions.some(e=>{var t;return!!(null===(t=e.branching)||void 0===t?void 0:t.type)}))(e)?e.questions:t?null!==(i=((e,t)=>{if(!t||t.length!==e.questions.length)return null;const i=new Map(e.questions.map(e=>[e.id,e])),n=[];for(const e of t){const t=i.get(e);if(!t)return null;n.push(t)}return n})(e,t.questionOrder))&&void 0!==i?i:e.questions:e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?(n=e.questions,s=_c(e.questions),n.length===s.length&&n.every((e,t)=>e===s[t])?s.reverse():s):e.questions},Wm=e=>uc(e)||Xm(e),jm=function(e){function t(e){var i,n;return this.getChildContext||(i=new Set,(n={})[t.__c]=this,this.getChildContext=function(){return n},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&i.forEach(function(e){e.__e=!0,$_(e)})},this.sub=function(e){i.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){i&&i.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+k_++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),Vm=()=>wf(jm),Gm=({component:e,children:t,renderAsHtml:i,style:n})=>function(e,t,i){var n,s,r,o,a=T_({},e.props);for(r in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)"key"==r?n=t[r]:"ref"==r?s=t[r]:a[r]=void 0===t[r]&&null!=o?o[r]:t[r];return arguments.length>2&&(a.children=arguments.length>3?c_.call(arguments,2):i),R_(e.type,a,n||e.key,s||e.ref,null)}(e,i?{dangerouslySetInnerHTML:{__html:Mm(t)},style:n}:{children:t,style:n});function Qm(e,t){var i,n,s;if(!(null===(i=e.conditions)||void 0===i?void 0:i.url))return!0;const r=null!==(n=ao(t))&&void 0!==n?n:"u">typeof window?window.location.href:void 0;if(!r)return!1;const o=[e.conditions.url],a=function(e){return null!=e?e:"icontains"}(null===(s=e.conditions)||void 0===s?void 0:s.urlMatchType);return pc[a](o,[r])}const Km=e=>ov("inProgressSurvey_",e),Jm={},Zm=(e,t)=>{const i=Km(e);try{localStorage.setItem(i,JSON.stringify(t)),delete Jm[i]}catch(e){iv.error("Error setting in-progress survey state in localStorage",e),Jm[i]=t}},Ym=e=>{const t=Km(e),i=Jm[t];if(i)return i;try{const e=localStorage.getItem(t);if(e)return JSON.parse(e)}catch(e){iv.error("Error getting in-progress survey state from localStorage",e)}return null},Xm=e=>{const t=Ym(e);return!Rt(null==t?void 0:t.surveySubmissionId)},ey=e=>{const t=Km(e);delete Jm[t];try{localStorage.removeItem(t)}catch(e){iv.error("Error clearing in-progress survey state from localStorage",e)}};function ty(e,t=!1){const i=`PostHogSurvey-${e.id}`;return t?`.${i}`:i}function iy(e,t=Of,i){if(e===Bf)return{};switch(t){case"top_left":return{top:"0",left:"0",transform:"translate(30px, 30px)"};case"top_right":return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case"top_center":return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case"middle_left":return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case"middle_right":return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case"middle_center":return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case Af:return{left:"30px"};case Lf:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===Nf&&i===Ff?"60px":"30px"}}}const ny=ef("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ef("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"})}),sy=ef("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ef("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"})}),ry=ef("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ef("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"})}),oy=ef("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ef("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"})}),ay=ef("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ef("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"})}),ly=ef("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:ef("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"})}),cy=ef("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:ef("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"})}),uy=({fill:e="currentColor"}={})=>ef("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:e,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[ef("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),ef("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:e})]}),dy=ef("svg",{width:"80",height:"14",viewBox:"0 0 160 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ef("g",{"clip-path":"url(#ph-survey-logo-clip)",children:[ef("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"}),ef("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"}),ef("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"}),ef("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"})]}),ef("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"}),ef("defs",{children:ef("clipPath",{id:"ph-survey-logo-clip",children:ef("path",{fill:"#fff",d:"M0 0h51.67v28H0z"})})})]});function hy({urlParams:e}){const t=e?Object.entries(e).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&"):"";return ef("a",{href:"https://posthog.com/surveys"+(t?`?${t}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",dy]})}function py({text:e,submitDisabled:t,appearance:i,onSubmit:n,link:s,onPreviewSubmit:r,skipSubmitButton:o,canGoBack:a,onBack:l}){const{isPreviewMode:c}=wf(jm),u=!!a&&!!l,d=!o&&ef("button",{className:"form-submit",disabled:t,"aria-label":"Submit survey",type:"button",onClick(){var e;s&&(null===(e=window)||void 0===e||e.open(s)),c?null==r||r():n()},children:e});return ef("div",{className:"bottom-section",children:[u?ef("div",{className:"form-buttons form-buttons-with-back",children:[ef("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:l,children:i.backButtonText||"Back"}),d]}):d,!i.whiteLabel&&ef(hy,{urlParams:{utm_source:"survey-footer"}})]})}function gy({question:e,forceDisableHtml:t,htmlFor:i}){return ef("div",{class:e.question||e.description?"question-header":"question-header question-header--empty",children:[ef(e.type===qf?"label":"h3",{className:"survey-question",htmlFor:i,children:e.question}),e.description&&Gm({component:P_("p",{className:"survey-question-description"}),children:e.description,renderAsHtml:!t&&"text"!==e.descriptionContentType})]})}function _y({onClick:e}){const{isPreviewMode:t}=wf(jm);return ef("button",{className:"form-cancel",onClick:e,disabled:t,"aria-label":"Close survey",type:"button",children:uy({fill:"black"})})}function fy({header:e,description:t,contentType:i,forceDisableHtml:n,appearance:s,onClose:r}){const{isPopup:o}=wf(jm);return yf(()=>{const e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),r())};return Qr(window,"keydown",e),()=>{window.removeEventListener("keydown",e)}},[r]),ef("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&ef(_y,{onClick:()=>r()}),ef("h3",{className:"thank-you-message-header",children:e}),t&&Gm({component:P_("p",{className:"thank-you-message-body"}),children:t,renderAsHtml:!n&&"text"!==i}),o&&ef(py,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>r()})]})}function vy({header:e,description:t,contentType:i,forceDisableHtml:n,appearance:s,onStart:r}){const{isPopup:o,onPreviewSubmit:a,onPopupSurveyDismissed:l}=wf(jm);return ef("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&ef(_y,{onClick:()=>l()}),e&&ef("h3",{className:"intro-screen-header",children:e}),t&&Gm({component:P_("p",{className:"intro-screen-body"}),children:t,renderAsHtml:!n&&"text"!==i}),ef(py,{text:s.introScreenButtonText||"Get started",submitDisabled:!1,appearance:s,onSubmit:r,onPreviewSubmit:()=>a(null)})]})}const my=e=>kt(e)&&e.every(e=>Tt(e));function yy({question:e,forceDisableHtml:t,appearance:i,onSubmit:n,onPreviewSubmit:s,displayQuestionIndex:r,initialValue:o,canGoBack:a,onBack:l}){const{isPreviewMode:c}=Vm(),u=bf(null),[d,h]=mf(()=>Tt(o)?o:""),p=null==i?void 0:i.disableAutofocus;yf(()=>{p||setTimeout(()=>{var e;c||null===(e=u.current)||void 0===e||e.focus()},100)},[c,p]);const g=`surveyQuestion${r}`,_=Sf(()=>function(e,t,i){const n=e.trim();if(!i&&""===n)return"This field is required";if(""===n)return!1;if(t&&t.length>0)for(const e of t)switch(e.type){case ht:var s;if(void 0!==e.value&&e.value>n.length)return null!==(s=e.errorMessage)&&void 0!==s?s:`Please enter at least ${e.value} characters`;break;case pt:var r;if(void 0!==e.value&&n.length>e.value)return null!==(r=e.errorMessage)&&void 0!==r?r:`Please enter no more than ${e.value} characters`}return!1}(d,e.validation,e.optional),[d,e.validation,e.optional]),f=Ar(e.validation,ht),v=Ar(e.validation,pt),m=Sf(()=>function(e,t){const i=1===e?void 0:e;return i&&t?`Enter ${i}-${t} characters`:i?`Enter at least ${i} ${1===i?"character":"characters"}`:t?`Maximum ${t} ${1===t?"character":"characters"}`:void 0}(f,v),[f,v]),y=()=>{_||n(d.trim())},b=()=>{_||s(d.trim())};return ef(F_,{children:[ef("div",{className:"question-container",children:[ef(gy,{question:e,forceDisableHtml:t,htmlFor:g}),ef("textarea",{ref:u,id:g,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:f,maxLength:v,onInput(e){h(e.currentTarget.value),e.stopPropagation()},onKeyDown(e){e.stopPropagation(),"Enter"!==e.key||!e.metaKey&&!e.ctrlKey||_||(e.preventDefault(),c?b():y())},value:d}),m&&ef("div",{className:"validation-hint",children:m})]}),ef(py,{text:e.buttonText||"Submit",submitDisabled:!!_,appearance:i,onSubmit:y,onPreviewSubmit:b,canGoBack:a,onBack:l})]})}function by({question:e,forceDisableHtml:t,appearance:i,onSubmit:n,onPreviewSubmit:s,canGoBack:r,onBack:o}){return ef(F_,{children:[ef("div",{className:"question-container",children:ef(gy,{question:e,forceDisableHtml:t})}),ef(py,{text:e.buttonText||"Submit",submitDisabled:!1,link:e.link,appearance:i,onSubmit:()=>n("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:r,onBack:o})]})}function Sy({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){var c;const u=e.scale,d=10===e.scale?0:1,[h,p]=mf(()=>Ft(o)?o:kt(o)&&o.length>0&&Ft(parseInt(o[0]))?parseInt(o[0]):Tt(o)&&Ft(parseInt(o))?parseInt(o):null),g="emoji"===e.display&&2===e.scale,{isPreviewMode:_}=Vm(),f=e=>_?r(e):s(e);return ef(F_,{children:[ef("div",{className:"question-container",children:[ef(gy,{question:e,forceDisableHtml:t}),ef("div",{className:"rating-section",children:[ef("div",{className:"rating-options",children:["emoji"===e.display&&ef("div",{className:"rating-options-emoji"+(g?" rating-options-emoji-2":""),children:null===(c=Iy[e.scale])||void 0===c?void 0:c.map((t,n)=>ef("button",{"aria-label":`Rate ${n+1}`,className:`ratings-emoji question-${i}-rating-${n} ${n+1===h?"rating-active":""}`,value:n+1,type:"button",onClick(){const t=n+1;p(t),e.skipSubmitButton&&f(t)},children:t},n))}),"number"===e.display&&ef("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${u-d+1}, minmax(0, 1fr))`},children:Ty(e.scale).map((t,s)=>ef(wy,{displayQuestionIndex:i,active:h===t,appearance:n,num:t,setActiveNumber(t){p(t),e.skipSubmitButton&&f(t)}},s))})]}),!g&&ef("div",{className:"rating-text",children:[ef("div",{children:e.lowerBoundLabel}),ef("div",{children:e.upperBoundLabel})]})]})]}),ef(py,{text:e.buttonText||(null==n?void 0:n.submitButtonText)||"Submit",submitDisabled:Pt(h)&&!e.optional,appearance:n,onSubmit:()=>s(h),onPreviewSubmit:()=>r(h),skipSubmitButton:e.skipSubmitButton,canGoBack:a,onBack:l})]})}function wy({num:e,active:t,displayQuestionIndex:i,setActiveNumber:n}){return ef("button",{"aria-label":`Rate ${e}`,className:`ratings-number question-${i}-rating-${e} ${t?"rating-active":""}`,type:"button",onClick(){n(e)},children:e})}function ky({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){const c=bf(null),u=Sf(()=>(e=>{var t;if(!e.shuffleOptions)return e.choices;const i=[...e.choices],n=e.hasOpenChoice&&null!==(t=i.pop())&&void 0!==t?t:null,s=(r=i,(o=_c(i)).length>1&&r.every((e,t)=>e===o[t])?o.reverse():o);var r,o;return Pt(n)||s.push(n),s})(e),[e]),[d,h]=mf(()=>((e,t)=>Tt(e)||my(e)?e:t===zf?null:[])(o,e.type)),[p,g]=mf(()=>((e,t)=>{if(Tt(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(my(e)){const i=e.find(e=>!t.includes(e));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,u)),{isPreviewMode:_}=Vm(),f=e.type===zf,v=e.type===Hf,m=e.skipSubmitButton&&f&&!e.hasOpenChoice,y=(e,t)=>{if(t){const e=!p.isSelected;return g(t=>ct(ct({},t),{},{isSelected:e,inputValue:e?t.inputValue:""})),f&&h(""),void(e&&setTimeout(()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.focus()},75))}if(f)return h(e),g(e=>ct(ct({},e),{},{isSelected:!1,inputValue:""})),void(m&&(s(e),_&&r(e)));v&&kt(d)&&(d.includes(e)?h(d.filter(t=>t!==e)):h([...d,e]))},b=e=>{e.stopPropagation();const t=e.currentTarget.value;g(e=>ct(ct({},e),{},{inputValue:t})),f&&h(t)},S=e=>{e.stopPropagation(),"Enter"!==e.key||w()||(e.preventDefault(),k()),"Escape"===e.key&&(e.preventDefault(),g(e=>ct(ct({},e),{},{isSelected:!1,inputValue:""})),f&&h(null))},w=()=>!(e.optional||!Pt(d)&&(!kt(d)||p.isSelected||0!==d.length)&&(!p.isSelected||""!==p.inputValue.trim())),k=()=>{p.isSelected&&v?kt(d)&&(_?r([...d,p.inputValue]):s([...d,p.inputValue])):_?r(d):s(d)};return ef(F_,{children:[ef("div",{className:"question-container",children:[ef(gy,{question:e,forceDisableHtml:t}),ef("fieldset",{className:"multiple-choice-options limit-height",children:[ef("legend",{className:"sr-only",children:v?" Select all that apply":" Select one"}),u.map((t,n)=>{const s=!!e.hasOpenChoice&&n===e.choices.length-1,r=`surveyQuestion${i}Choice${n}`,o=`${r}Open`,a=s?p.isSelected:f?d===t:kt(d)&&d.includes(t);return ef("label",{className:s?"choice-option-open":"",children:[ef("div",{className:"response-choice",children:[ef("input",{type:f?"radio":"checkbox",name:r,checked:a,onChange:()=>y(t,s),id:r,"aria-controls":o}),ef("span",{children:s?`${t}:`:t})]}),s&&ef("input",{type:"text",ref:c,id:o,name:`question${i}Open`,value:p.inputValue,onKeyDown:S,onInput:b,onClick(e){p.isSelected||y(t,!0),e.stopPropagation()},"aria-label":`${t} - please specify`})]},n)})]})]}),ef(py,{text:e.buttonText||"Submit",submitDisabled:w(),appearance:n,onSubmit:k,onPreviewSubmit:k,skipSubmitButton:m,canGoBack:a,onBack:l})]})}const Cy=[1,2,3,4,5],xy=[1,2,3,4,5,6,7],Ey=[0,1,2,3,4,5,6,7,8,9,10],Iy={2:[ly,cy],3:[ry,sy,ny],5:[oy,ry,sy,ny,ay]};function Ty(e){switch(e){case 5:default:return Cy;case 7:return xy;case 10:return Ey}}const My=Nr("[Surveys]");function Py(e,t,i){var n;const s=e.questions[t],r=t+1;if(!(null===(n=s.branching)||void 0===n?void 0:n.type))return t===e.questions.length-1?Wf:r;if(s.branching.type===Wf)return Wf;if("specific_question"===s.branching.type){if(Number.isInteger(s.branching.index))return s.branching.index}else if("response_based"===s.branching.type){if(s.type===zf){var o;let e=s.choices.indexOf(`${i}`);if(-1===e&&s.hasOpenChoice&&(e=s.choices.length-1),null===(o=s.branching)||void 0===o||null===(o=o.responseValues)||void 0===o?void 0:o.hasOwnProperty(e)){const t=s.branching.responseValues[e];if(Number.isInteger(t))return t;if(t===Wf)return Wf}}else if(s.type===Uf){var a;if(s.optional&&Rt(i))return r===e.questions.length?Wf:r;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const t=function(e,t){if(2===t){if(1>e||e>2)throw new Error("The response must be in range 1-2");return 1===e?"positive":"negative"}if(3===t){if(1>e||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(1>e||e>5)throw new Error("The response must be in range 1-5");return e>2?3===e?"neutral":"positive":"negative"}if(7===t){if(1>e||e>7)throw new Error("The response must be in range 1-7");return e>3?4===e?"neutral":"positive":"negative"}if(10===t){if(0>e||e>10)throw new Error("The response must be in range 0-10");return e>6?e>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(i,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];if(Number.isInteger(e))return e;if(e===Wf)return Wf}}return r}return My.warn("Falling back to next question index due to unexpected branching type"),r}const Ry=Nr("[SurveyTranslations]");function Fy(e,t){const i=function(e){var t;return function({overrideLanguage:e,storedPersonProperties:t,locale:i},n){const s=sc(e);if(s)return null==n||n.info(`Using override display language: ${s}`),s;const r=function(e){return e&&"object"==typeof e&&"language"in e?sc(e.language):null}(t);if(r)return null==n||n.info(`Using person property language: ${r}`),r;const o=sc(i);return o?(null==n||n.info(`Using detected locale: ${o}`),o):(null==n||n.info("No user language detected"),null)}({overrideLanguage:e.config.overrideLanguage,storedPersonProperties:null===(t=e.client)||void 0===t?void 0:t.kv.get(S),locale:"u">typeof navigator?navigator.language||navigator.userLanguage:void 0},Ry)}(t);if(!i)return Ry.info("No user language detected"),{survey:e,language:null};const n=lc(e,i,Ry);return{survey:n.survey,language:n.matchedKey}}const Ay="ph:show_survey_widget",Ly="PHWidgetSurveyClickListener";function Oy(e,t){try{const i=e.getBoundingClientRect(),n=window.innerHeight,s=window.innerWidth;let r=i.left+i.width/2-t/2;r+t>s-20&&(r=s-t-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:Fm.zIndex}}catch(e){return iv.warn("Failed to calculate trigger position:",e),null}}var Dy=class{constructor(e){var t,i;this._surveyTimeouts=new Map,this._widgetSelectorListeners=new Map,this._renderedTabWidgets=new Map,this._renderedTargets=new Map,this._prefillHandledSurveys=new Set,this._disposed=!1,this._currentLanguage=null,this._surveyIsRendered=!1,this._languageChangeListener=null,this._unsubscribeFeatureFlags=null,this._surveyPopupProps=null,this._loggedFeatureFlagsDisabledWarning=!1,this.handlePageUnload=()=>{var e;const t=null===(e=this._host.client)||void 0===e?void 0:e.kv.get(M);if(t)for(const e of t)Xm(e)&&Hm(e,this._host)},this.handlePopoverSurvey=(e,t,{resumeDelayFromActivation:i=!1}={})=>{var n,s,r,o,a,l,c;if(!(null===(n=this._host.client)||void 0===n?void 0:n.canCapture))return;const{survey:u,language:d}=this._translateSurveyForRendering(e);this._currentLanguage=d,this._surveyPopupProps=null,this._displayOptions=t;const h=this._applyDisplayOverrides(u,t);this._clearSurveyTimeout(h.id);const{properties:p,initialResponses:g}=null!=t?t:{},_=!(!g||0>=Object.keys(g).length)&&this._handleInitialResponses(h,g,p,d);if(_&&!(null===(s=h.appearance)||void 0===s?void 0:s.displayThankYouMessage))return;this._addSurveyToFocus(h);let f={};if((null===(r=h.appearance)||void 0===r?void 0:r.position)===Df&&(null===(o=h.appearance)||void 0===o?void 0:o.widgetSelector)){var v;const e=document.querySelector(h.appearance.widgetSelector);e&&(f=Oy(e,parseInt((null===(v=h.appearance)||void 0===v?void 0:v.maxWidth)||Fm.maxWidth))||{})}const m=(null===(a=h.appearance)||void 0===a?void 0:a.surveyPopupDelaySeconds)||0,{shadow:y}=Dm(h,this._host);this._renderedTargets.set(y,y.host);const b={posthog:this._host,survey:h,removeSurveyFromFocus:this._removeSurveyFromFocus,properties:p,style:f,isSurveyCompleted:_,skipShownEvent:null==t?void 0:t.skipShownEvent,surveyLanguage:d};if(this._surveyPopupProps=b,0>=m)return this._surveyIsRendered=!0,Y_(ef(qy,ct({},b)),y);const S=()=>{this._surveyIsRendered=!0;const{survey:i,language:n}=this._translateSurveyForRendering(e);this._currentLanguage=n;const s=this._applyDisplayOverrides(i,t),r=ct(ct({},b),{},{survey:s,surveyLanguage:n});this._surveyPopupProps=r,Y_(ef(qy,ct(ct({},r),{},{survey:ct(ct({},s),{},{appearance:ct(ct({},s.appearance),{},{surveyPopupDelaySeconds:0})})})),y)},w=()=>{var e;if(!(null===(e=this._host.client)||void 0===e?void 0:e.canCapture)||!this._shouldDisplaySurvey(h))return iv.info(`Survey ${h.id} no longer eligible when its display delay elapsed; not displaying`),this._removeSurveyFromFocus(h);S()},k=i?null===(l=this._host.surveys)||void 0===l||null===(l=l._surveyEventReceiver)||void 0===l||null===(c=l.getActivationTimestamp)||void 0===c?void 0:c.call(l,h.id):void 0,C=Ft(k)?Math.max(0,Date.now()-k):0,x=Math.max(0,1e3*m-C);if(0>=x)return w();const E=window.setTimeout(()=>{this._surveyTimeouts.delete(h.id),w()},x);this._surveyTimeouts.set(h.id,E)},this._handleWidget=e=>{var t;const{survey:i,language:n}=this._translateSurveyForRendering(e),{shadow:s,isNewlyCreated:r}=Dm(i,this._host);this._renderedTargets.set(s,s.host),(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)===Ff&&this._renderedTabWidgets.set(e.id,e),r&&Y_(ef(zy,{posthog:this._host,survey:i,surveyLanguage:n},e.id),s)},this._detachWidgetSelectorListener=e=>{const t=this._widgetSelectorListeners.get(e);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(Ly),this._widgetSelectorListeners.delete(e),iv.info(`Removed click listener for survey ${e}`))},this._removeWidgetSelectorListener=e=>{this._isWidgetSurveyOpen(e)||(this._removeSurveyFromDom(e),this._detachWidgetSelectorListener(e.id))},this._removeTabWidget=e=>{this._isWidgetSurveyOpen(e)||(this._removeSurveyFromDom(e),this._renderedTabWidgets.delete(e.id))},this._isWidgetSurveyOpen=e=>{try{var t;const i=document.querySelector(ty(e,!0));return!!(null==i||null===(t=i.shadowRoot)||void 0===t?void 0:t.querySelector(".ph-survey"))}catch(e){return!1}},this._manageWidgetSelectorListener=(e,t)=>{const i=document.querySelector(t),n=this._widgetSelectorListeners.get(e.id);if(i){if(this._handleWidget(e),n){if(i===n.element)return;iv.info(`Selector element changed for survey ${e.id}. Re-attaching listener.`),this._detachWidgetSelectorListener(e.id)}if(!i.hasAttribute(Ly)){const t=t=>{var i,n;t.stopPropagation();const s=(null===(i=e.appearance)||void 0===i?void 0:i.position)===Df?Oy(t.currentTarget,parseInt((null===(n=e.appearance)||void 0===n?void 0:n.maxWidth)||Fm.maxWidth)):{};window.dispatchEvent(new CustomEvent(Ay,{detail:{surveyId:e.id,position:s}}))};Qr(i,"click",t),i.setAttribute(Ly,"true"),this._widgetSelectorListeners.set(e.id,{element:i,listener:t,survey:e}),iv.info(`Attached click listener for feedback button survey ${e.id}`)}}else n&&this._removeWidgetSelectorListener(e)},this.renderPopover=e=>{var t;if(!(null===(t=this._host.client)||void 0===t?void 0:t.canCapture))return;const{survey:i,language:n}=this._translateSurveyForRendering(e),{shadow:s}=Dm(i,this._host);this._renderedTargets.set(s,s.host),Y_(ef(qy,{posthog:this._host,survey:i,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:n}),s)},this.renderSurvey=(e,t,i)=>{var n;if(!(null===(n=this._host.client)||void 0===n?void 0:n.canCapture))return;const{survey:s,language:r}=this._translateSurveyForRendering(e);let o=!1;this._host.config.prefillFromUrl&&(o=this._handleUrlPrefill(s,r,i)),Y_(ef(qy,{posthog:this._host,survey:s,removeSurveyFromFocus:this._removeSurveyFromFocus,isPopup:!1,properties:i,isSurveyCompleted:o,surveyLanguage:r}),t)},this.getActiveMatchingSurveys=(e,t=!1)=>{var i;null===(i=this._host.surveys)||void 0===i||i.getSurveys(t=>{e(t.filter(e=>this._shouldDisplaySurvey(e)))},t)},this.callSurveysAndEvaluateDisplayLogic=(e=!1)=>{this.getActiveMatchingSurveys(e=>{var t;const i=null===(t=this._host.client)||void 0===t?void 0:t.canCapture,n=e.filter(e=>i&&(e.type===$f||e.type===Nf)),s=new Set(n.map(e=>e.id));for(const e of Array.from(this._surveyTimeouts.keys()))s.has(e)||this.cancelSurvey(e);const r=this._sortSurveysByAppearanceDelay(n),o=new Set,a=new Set;r.forEach(e=>{if(e.type===Nf){var t,i,n,s;if((null===(t=e.appearance)||void 0===t?void 0:t.widgetType)===Ff)return a.add(e.id),void this._handleWidget(e);"selector"===(null===(i=e.appearance)||void 0===i?void 0:i.widgetType)&&(null===(n=e.appearance)||void 0===n?void 0:n.widgetSelector)&&(o.add(e.id),this._manageWidgetSelectorListener(e,null===(s=e.appearance)||void 0===s?void 0:s.widgetSelector))}Pt(this._surveyInFocus)&&e.type===$f&&this.handlePopoverSurvey(e,void 0,{resumeDelayFromActivation:!0})}),this._widgetSelectorListeners.forEach(({survey:e})=>{o.has(e.id)||this._removeWidgetSelectorListener(e)}),this._renderedTabWidgets.forEach((e,t)=>{a.has(t)||this._removeTabWidget(e)})},e)},this._addSurveyToFocus=e=>{Pt(this._surveyInFocus)||iv.error(`Survey ${this._surveyInFocus} already in focus. Cannot add survey ${e.id}.`),this._surveyInFocus=e.id},this._removeSurveyFromFocus=e=>{this._surveyInFocus!==e.id&&iv.error(`Survey ${e.id} is not in focus. Cannot remove survey ${e.id}.`),this._clearSurveyTimeout(e.id),this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0,this._removeSurveyFromDom(e)},this._host=e,this._surveyInFocus=null,this._languageChangeListener=()=>this._onLanguageChange(),Qr(window,"languagechange",this._languageChangeListener),this._unsubscribeFeatureFlags=null!==(t=null===(i=e.client)||void 0===i||null===(i=i.getExtension("featureFlagsCommon"))||void 0===i?void 0:i.onFeatureFlags(()=>this._onLanguageChange()))&&void 0!==t?t:null}_onLanguageChange(){var e;if(Pt(this._surveyInFocus))return;const t=null===(e=this._host.client)||void 0===e?void 0:e.kv.get(M),i=null==t?void 0:t.find(e=>e.id===this._surveyInFocus);if(!i)return;const{survey:n,language:s}=this._translateSurveyForRendering(i);if(s===this._currentLanguage)return;if(this._currentLanguage=s,!this._surveyIsRendered)return;const r=this._applyDisplayOverrides(n,this._displayOptions),{shadow:o}=Dm(r,this._host);Y_(ef(qy,ct(ct({},this._surveyPopupProps),{},{posthog:this._host,survey:r,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:s})),o)}_applyDisplayOverrides(e,t){return(null==t?void 0:t.position)||(null==t?void 0:t.selector)?ct(ct({},e),{},{appearance:ct(ct(ct({},e.appearance),t.position&&{position:t.position}),t.selector&&{widgetSelector:t.selector})}):e}_clearSurveyTimeout(e){const t=this._surveyTimeouts.get(e);t&&(clearTimeout(t),this._surveyTimeouts.delete(e))}cancelSurvey(e){this._surveyTimeouts.has(e)&&(iv.info(`Cancelled pending survey ${e}`),this._clearSurveyTimeout(e),this._surveyInFocus===e&&(this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0))}startAutomaticDisplay(){if(this._disposed||this._automaticDisplayDispose||!1===this._host.config.automaticDisplay)return;this._automaticDisplayDispose=()=>{};const e=function(e){let t;e.callSurveysAndEvaluateDisplayLogic(!0);const i=()=>{It(t)&&(t=setInterval(()=>{e.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},n=()=>{It(t)||(clearInterval(t),t=void 0)};i();const s=()=>{document.hidden?n():(e.callSurveysAndEvaluateDisplayLogic(!1),i())};return Qr(document,"visibilitychange",s),()=>{n(),document.removeEventListener("visibilitychange",s)}}(this);this._disposed?e():this._automaticDisplayDispose=e}clearInMemoryInProgressSurveyState(){(()=>{for(const e of Object.keys(Jm))delete Jm[e]})()}dispose(){var e;this._disposed=!0,null===(e=this._automaticDisplayDispose)||void 0===e||e.call(this),this._automaticDisplayDispose=void 0,this._languageChangeListener&&(window.removeEventListener("languagechange",this._languageChangeListener),this._languageChangeListener=null),this._unsubscribeFeatureFlags&&(this._unsubscribeFeatureFlags(),this._unsubscribeFeatureFlags=null),this._surveyTimeouts.forEach((e,t)=>this._clearSurveyTimeout(t)),this._widgetSelectorListeners.forEach((e,t)=>this._detachWidgetSelectorListener(t)),this._renderedTargets.forEach((e,t)=>{Y_(null,t),null==e||e.remove()}),this._renderedTargets.clear(),this._renderedTabWidgets.clear(),this._surveyInFocus=null}_sortSurveysByAppearanceDelay(e){return e.sort((e,t)=>{var i,n;const s=Xm(e),r=Xm(t);if(s&&!r)return-1;if(!s&&r)return 1;const o=e.schedule===jf,a=t.schedule===jf;return o&&!a?1:!o&&a?-1:((null===(i=e.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)-((null===(n=t.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)})}_translateSurveyForRendering(e){return Fy(e,this._host)}_handleUrlPrefill(e,t,i){if(this._prefillHandledSurveys.has(e.id))return!1;const{params:n}=function(){const e={};let t=!1;const i=window.location.search.replace(/^\?/,"");if(!i)return{params:e,autoSubmit:t};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(e){continue}if("auto_submit"===s&&"true"===r){t=!0;continue}const o=s.match(/^q(\d+)$/);if(o){const t=parseInt(o[1],10);e[t]||(e[t]=[]),e[t].push(r)}}return{params:e,autoSubmit:t}}();if(0===Object.keys(n).length)return!1;iv.info("[Survey Prefill] Detected URL prefill parameters");const s=this._processPrefillData(e,n,t);return!!s&&(this._autoSubmitPrefilledResponses(e,s,i,t),this._prefillHandledSurveys.add(e.id),s.isSurveyCompleted)}_autoSubmitPrefilledResponses(e,t,i,n){const{responses:s,submissionId:r,isSurveyCompleted:o,skippedResponses:a}=t;(Object.keys(a).length>0&&e.enable_partial_responses||o)&&Nm({responses:o?s:a,survey:e,surveySubmissionId:r,posthog:this._host,isSurveyCompleted:o,properties:i,surveyLanguage:n})}_handleInitialResponses(e,t,i,n){const s={};for(const[e,i]of Object.entries(t))s[parseInt(e)]=kt(i)?i.map(String):[String(i)];iv.info("[Survey] Processing initial responses");const r=this._processPrefillData(e,s,n);return!!r&&(this._autoSubmitPrefilledResponses(e,r,i,n),r.isSurveyCompleted)}_processPrefillData(e,t,i){try{const n=function(e,t){const i={};return e.questions.forEach((e,n)=>{if(!t[n]||!e.id)return;const s=t[n],r=Xl(e.id);try{switch(e.type){case zf:{if(!e.choices||0===e.choices.length)return void $r.warn(`[Survey Prefill] Question ${n} has no choices`);const t=parseInt(s[0],10);if(isNaN(t)||0>t||t>=e.choices.length)return void $r.warn(`[Survey Prefill] Invalid choice index for q${n}: ${s[0]}`);i[r]=e.choices[t];break}case Hf:{if(!e.choices||0===e.choices.length)return void $r.warn(`[Survey Prefill] Question ${n} has no choices`);const t=s.map(e=>parseInt(e,10)).filter(t=>!isNaN(t)&&t>=0&&e.choices.length>t);if(0===t.length)return void $r.warn(`[Survey Prefill] No valid choices for q${n}`);const o=[...new Set(t.map(t=>e.choices[t]))];t.length>o.length&&$r.warn(`[Survey Prefill] Removed duplicate choices for q${n}`),i[r]=o;break}case Uf:{const t=parseInt(s[0],10),o=e.scale||10,a=10===o?0:1;if(isNaN(t)||a>t||t>o)return void $r.warn(`[Survey Prefill] Invalid rating for q${n}: ${s[0]} (scale: ${a}-${o})`);i[r]=t;break}default:$r.info(`[Survey Prefill] Question type ${e.type} does not support prefill`)}}catch(e){$r.error(`[Survey Prefill] Error converting q${n}:`,e)}}),i}(e,t);if(0===Object.keys(n).length)return iv.warn("[Survey Prefill] No valid responses after conversion"),null;const s=Tl(),{startQuestionIndex:r,skippedResponses:o,skippedIndices:a}=function(e,t,i){let n=0;const s={},r=[],o=e.questions.length+1;let a=0;for(;e.questions.length>n&&o>a&&(a++,t.includes(n));){const t=e.questions[n];if(!t||!("skipSubmitButton"in t)||!t.skipSubmitButton)break;if(t.id){const e=Xl(t.id);It(i[e])||(s[e]=i[e])}r.push(n);const o=Py(e,n,t.id?i[Xl(t.id)]:null);if(o===Wf)return{startQuestionIndex:e.questions.length,skippedResponses:s,skippedIndices:r};n=o}return{startQuestionIndex:n,skippedResponses:s,skippedIndices:r}}(e,Object.keys(t).map(e=>parseInt(e,10)).filter(t=>{const i=e.questions[t];return(null==i?void 0:i.id)&&!It(n[Xl(i.id)])}),n),l=r>=e.questions.length;return Zm(e,{surveySubmissionId:s,responses:n,lastQuestionIndex:r,questionOrder:zm(e.questions),visitedIndices:a,surveyLanguage:i}),iv.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:n,submissionId:s,startQuestionIndex:r,isSurveyCompleted:l,skippedResponses:o}}catch(e){return iv.error("[Survey Prefill] Error handling prefill:",e),null}}_isSurveyFeatureFlagEnabled(e,t){var i;if(!e)return!0;const n=null===(i=this._host.client)||void 0===i?void 0:i.getExtension(tf),s=!!(null==n?void 0:n.isFeatureEnabled(e,{send_event:!e.startsWith("survey-targeting-")}));let r=!0;t&&(r=(null==n?void 0:n.getFeatureFlag(e,{send_event:!1}))===t||"any"===t);const o=s&&r;return o||this._warnIfFeatureFlagsDisabled(e),o}_warnIfFeatureFlagsDisabled(e){this._loggedFeatureFlagsDisabledWarning||!1!==this._host.config.featureFlagEvaluation||(this._loggedFeatureFlagsDisabledWarning=!0,iv.warn(`Survey feature flag "${e}" evaluated to false because advanced_disable_feature_flags is set. PostHog creates an internal targeting flag for almost every survey, so no survey can display while flags are disabled. To keep surveys working, replace advanced_disable_feature_flags with advanced_only_evaluate_survey_feature_flags, which evaluates survey flags only.`))}_isSurveyConditionMatched(e){return!e.conditions||Qm(e,this._host)&&function(e){var t,i;return function(e,t){var i,n,s;if(!e||0===e.length)return!0;const r="u">typeof window?window:void 0,o="u">typeof globalThis?globalThis:r,a=null==o?void 0:o.navigator,l=null==a?void 0:a.userAgent;if(!l)return!1;const c=Zi(l,{userAgentDataPlatform:null==a||null===(i=a.userAgentData)||void 0===i?void 0:i.platform,maxTouchPoints:null==a?void 0:a.maxTouchPoints,screenWidth:null==r||null===(n=r.screen)||void 0===n?void 0:n.width,screenHeight:null==r||null===(s=r.screen)||void 0===s?void 0:s.height,devicePixelRatio:null==r?void 0:r.devicePixelRatio});return pc[null!=t?t:"icontains"](e,[c])}(null===(t=e.conditions)||void 0===t?void 0:t.deviceTypes,null===(i=e.conditions)||void 0===i?void 0:i.deviceTypesMatchType)}(e)&&function(e){var t,i;return!(null===(t=e.conditions)||void 0===t?void 0:t.selector)||!!(null===(i=document)||void 0===i?void 0:i.querySelector(e.conditions.selector))}(e)}_internalFlagCheckSatisfied(e){var t;return Wm(e)?{satisfied:!0}:e.internal_targeting_flag_key&&function(e){var t;return"recurring"===e.schedule||(null!==(t=e.current_iteration)&&void 0!==t?t:0)>0}(e)&&!(null===(t=this._host.client)||void 0===t||null===(t=t.getExtension("featureFlagsCommon"))||void 0===t?void 0:t.hasLoadedFlags)?(this._warnIfFeatureFlagsDisabled(e.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this._isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key)}}checkSurveyEligibility(e){var t,i;const n={eligible:!0,reason:void 0};if(!sv(e))return n.eligible=!1,n.reason=`Survey is not running. It was completed on ${e.end_date}`,n;if(!cv.includes(e.type))return n.eligible=!1,n.reason=`Surveys of type ${e.type} are never eligible to be shown in the app`,n;const s=null===(t=e.conditions)||void 0===t?void 0:t.linkedFlagVariant;if(!this._isSurveyFeatureFlagEnabled(e.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._isSurveyFeatureFlagEnabled(e.targeting_flag_key))return n.eligible=!1,n.reason="Survey targeting feature flag is not enabled",n;const r=this._internalFlagCheckSatisfied(e);var o;return r.satisfied?(e=>{let t=null;try{t=localStorage.getItem("lastSeenSurveyDate")}catch(e){iv.error("localStorage error: "+e)}return function(e,t){if(!e||!t)return!0;const i="string"==typeof t?new Date(t):t,n=Math.abs((new Date).getTime()-i.getTime());return Math.ceil(n/864e5)>e}(e,t)})(null===(i=e.conditions)||void 0===i?void 0:i.seenSurveyWaitPeriodInDays)?((e=>{let t=null;try{t=localStorage.getItem(av(e))}catch(e){iv.error("localStorage error: "+e)}return!!t&&!Wm(e)})(e)&&(n.eligible=!1,n.reason="Survey has already been seen and it can't be activated again"),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(){var e;return(null===(e=this._host.client)||void 0===e?void 0:e.canCapture)?{eligible:!0}:{eligible:!1,reason:nv}}checkSurveyDisplayEligibility(e){const t=this.checkSurveyCaptureEligibility();return t.eligible?this.checkSurveyEligibility(e):t}checkSurveyRenderability(e){const t=this.checkSurveyDisplayEligibility(e);return t.eligible&&!this._hasActionOrEventTriggeredSurvey(e)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:t}_hasActionOrEventTriggeredSurvey(e){var t;if(!cc(e)&&!rv(e))return!0;const i=null===(t=this._host.surveys)||void 0===t||null===(t=t._surveyEventReceiver)||void 0===t?void 0:t.getSurveys();return!!(null==i?void 0:i.includes(e.id))}_checkFlags(e){var t;return!(null===(t=e.feature_flag_keys)||void 0===t?void 0:t.length)||e.feature_flag_keys.every(({key:e,value:t})=>!e||!t||this._isSurveyFeatureFlagEnabled(t))}_shouldDisplaySurvey(e){return this.checkSurveyEligibility(e).eligible&&this._isSurveyConditionMatched(e)&&this._hasActionOrEventTriggeredSurvey(e)&&this._checkFlags(e)}_removeSurveyFromDom(e){try{const t=document.querySelector(ty(e,!0));(null==t?void 0:t.shadowRoot)&&(Y_(null,t.shadowRoot),this._renderedTargets.delete(t.shadowRoot)),null==t||t.remove()}catch(t){iv.warn(`Failed to remove survey ${e.id} from DOM:`,t)}}getTestAPI(){return{addSurveyToFocus:this._addSurveyToFocus,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyInFocus:this._surveyInFocus,surveyTimeouts:this._surveyTimeouts,handleWidget:this._handleWidget,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this._manageWidgetSelectorListener,sortSurveysByAppearanceDelay:this._sortSurveysByAppearanceDelay.bind(this),checkFlags:this._checkFlags.bind(this),isSurveyFeatureFlagEnabled:this._isSurveyFeatureFlagEnabled.bind(this),onLanguageChange:this._onLanguageChange.bind(this),currentLanguage:this._currentLanguage,surveyIsRendered:this._surveyIsRendered}}};function $y({survey:e,removeSurveyFromFocus:t=()=>{},setSurveyVisible:i,isPreviewMode:n=!1,posthog:s}){yf(()=>{var r;if(n||!(null===(r=e.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var n;const r=e.type===Nf,o=Qm(e,s),a=(null===(n=e.appearance)||void 0===n?void 0:n.widgetType)===Ff&&r;if(!o)return iv.info(`Hiding survey ${e.id} because URL does not match`),i(!1),t(e);a&&(iv.info(`Showing survey ${e.id} because it is a feedback button tab and URL matches`),i(!0))};Qr(window,"popstate",o),Qr(window,"hashchange",o);const a=window.history.pushState,l=window.history.replaceState;return window.history.pushState=function(...e){a.apply(this,e),o()},window.history.replaceState=function(...e){l.apply(this,e),o()},()=>{window.removeEventListener("popstate",o),window.removeEventListener("hashchange",o),window.history.pushState=a,window.history.replaceState=l}},[n,e,t,i,s])}const Ny=200;function By(e="right"){switch(e){case"top":return{top:"0",left:"50%",transform:"translateX(-50%)"};case"left":return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case"bottom":return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function qy({survey:e,forceDisableHtml:t,posthog:i,style:n={},previewPageIndex:s,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:a=()=>{},onPreviewBack:l=()=>{},onPopupSurveyDismissed:c=()=>{},onCloseConfirmationMessage:u=()=>{},properties:d,isSurveyCompleted:h,skipShownEvent:p,surveyLanguage:g}){var _,f,v,m,y,b,S,w,k,C,x,E;const I=bf(null),T=Number.isInteger(s),{isPopupVisible:M,isSurveySent:P,hidePopupWithAnimation:R}=function(e,t,i,n,s,r,o,a,l){const[c,u]=mf(n||0===i||e.type===Bf),[d,h]=mf(!1),p=bf(!1),g=()=>{const t=()=>{r&&s(e),u(!1)};if(p.current)return;const i=null==o?void 0:o.current;i?(p.current=!0,i.style.transition=`opacity ${Ny}ms ease-out`,i.style.opacity="0",setTimeout(()=>{p.current=!1,t()},250)):t()},_=t=>{t.detail.surveyId===e.id&&g()};return yf(()=>{if(!t)return void iv.error("usePopupVisibility hook called without a PostHog instance.");if(n)return;let s;const r=t=>{var i,n;if(t.detail.surveyId===e.id){if(!(null===(i=e.appearance)||void 0===i?void 0:i.displayThankYouMessage))return g();h(!0),(null===(n=e.appearance)||void 0===n?void 0:n.autoDisappear)&&(s&&clearTimeout(s),s=setTimeout(g,5e3))}},o=()=>{var i;if(Qm(e,t)){u(!0);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}window.dispatchEvent(new Event("PHSurveyShown")),a||null===(i=t.client)||void 0===i||i.capture(Vf,ct(ct({[Jf]:e.name,[Kf]:e.id,[Zf]:e.current_iteration,[Yf]:e.current_iteration_start_date},l&&{[ev]:l}),{},{sessionRecordingUrl:nf(t)}))}};Qr(window,"PHSurveyClosed",_),Qr(window,"PHSurveySent",r);const c=i>0?setTimeout(o,i):void 0;return It(c)&&o(),()=>{It(c)||clearTimeout(c),It(s)||clearTimeout(s),window.removeEventListener("PHSurveyClosed",_),window.removeEventListener("PHSurveySent",r)}},[]),$y({survey:e,removeSurveyFromFocus:s,setSurveyVisible:u,isPreviewMode:n,posthog:t}),{isPopupVisible:c,isSurveySent:d,setIsPopupVisible:u,hidePopupWithAnimation:g}}(e,i,(null===(_=e.appearance)||void 0===_?void 0:_.surveyPopupDelaySeconds)?1e3*e.appearance.surveyPopupDelaySeconds:0,T,r,o,I,p,g),F=P||s===e.questions.length||!0===h,[A,L]=mf(!1),O=Sf(()=>!!Ym(e),[e]),D=!(!(null===(f=e.appearance)||void 0===f?void 0:f.introScreenHeader)&&!(null===(v=e.appearance)||void 0===v?void 0:v.introScreenDescription)),N=T?-1===s:!!(null===(m=e.appearance)||void 0===m?void 0:m.displayIntroScreen)&&D&&!A&&!O,B=Sf(()=>{const t=Ym(e),n=(null==t?void 0:t.surveySubmissionId)||Tl()||"";return{isPreviewMode:T,previewPageIndex:s,onPopupSurveyDismissed(){g?qm(e,i,T,g):qm(e,i,T),c()},isPopup:o||!1,surveySubmissionId:n,onPreviewSubmit:a,onPreviewBack:l,posthog:i,properties:d,surveyLanguage:g}},[T,s,o,i,e,c,a,l,d,g]);return M?ef(jm.Provider,{value:B,children:ef("div",{className:"ph-survey",style:ct(ct({},iy(e.type,null===(y=e.appearance)||void 0===y?void 0:y.position,null===(b=e.appearance)||void 0===b?void 0:b.widgetType)),n),ref:I,children:F?ef(fy,{header:(null===(S=e.appearance)||void 0===S?void 0:S.thankYouMessageHeader)||"Thank you!",description:(null===(w=e.appearance)||void 0===w?void 0:w.thankYouMessageDescription)||"",forceDisableHtml:!!t,contentType:null===(k=e.appearance)||void 0===k?void 0:k.thankYouMessageDescriptionContentType,appearance:e.appearance||Fm,onClose(){R(),u()}}):N?ef(vy,{header:(null===(C=e.appearance)||void 0===C?void 0:C.introScreenHeader)||"",description:(null===(x=e.appearance)||void 0===x?void 0:x.introScreenDescription)||"",forceDisableHtml:!!t,contentType:null===(E=e.appearance)||void 0===E?void 0:E.introScreenDescriptionContentType,appearance:e.appearance||Fm,onStart:()=>L(!0)}):ef(Hy,{survey:e,forceDisableHtml:!!t,posthog:i})})}):null}function Hy({survey:e,forceDisableHtml:t,posthog:i}){var n,s;const r=Sf(()=>{const t=Ym(e);if(!t)return null;const i=Ft(t.lastQuestionIndex);return!i||i&&t.lastQuestionIndex>=0&&e.questions.length>t.lastQuestionIndex?t:(ey(e),null)},[e]),[o,a]=mf(()=>((null==r?void 0:r.responses)&&iv.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[l,c]=mf(!1),{previewPageIndex:u,onPopupSurveyDismissed:d,isPopup:h,onPreviewSubmit:p,onPreviewBack:g,surveySubmissionId:_,isPreviewMode:f,properties:v,surveyLanguage:m}=wf(jm),[y,b]=mf(()=>{const t=null==r?void 0:r.lastQuestionIndex,i=Ft(t)&&t>=0&&e.questions.length>t?t:0;return Ft(u)&&u>=0?u:i}),[S,w]=mf(()=>{var t;return(null!==(t=null==r?void 0:r.visitedIndices)&&void 0!==t?t:[]).filter(t=>t>=0&&e.questions.length>t)}),[k,C]=mf(()=>{var t;const i=Ym(e);return null!==(t=null==i?void 0:i.questionSnapshots)&&void 0!==t?t:{}}),x=Sf(()=>zm(Um(e,r)),[e.id,r]),E=Sf(()=>{if(!x||new Set(x).size!==x.length)return Um(e,r);const t=new Map(e.questions.map(e=>[e.id,e])),i=x.map(e=>t.get(e)).filter(e=>!!e);return i.length===x.length?i:e.questions},[x,e.questions,e,r]);yf(()=>{!f||It(u)||0>u||b(u)},[u,f]);const I=!!(null===(n=e.appearance)||void 0===n?void 0:n.allowGoBack)&&(f?(null!=u?u:0)>0:S.length>0),T=E.at(y);return T?ef("form",{className:"survey-form",name:"surveyForm",children:[h&&!0!==(null===(s=e.appearance)||void 0===s?void 0:s.hideCancelButton)&&ef(_y,{onClick(){d()}}),ef("div",{className:"survey-box","data-question-index":y,children:[l&&ef("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),Uy({question:T,forceDisableHtml:t,displayQuestionIndex:y,appearance:e.appearance||Fm,onSubmit:t=>(({res:t,displayQuestionIndex:n,questionId:s})=>{var r;if(!i)return void iv.error("onNextButtonClick called without a PostHog instance.");if(!(null===(r=i.client)||void 0===r?void 0:r.canCapture))return void c(!0);if(c(!1),!s)return void iv.error("onNextButtonClick called without a questionId.");const{responses:l,questionSnapshots:u}=function({responses:e,questionSnapshots:t={}},i,n,s){return{responses:ct(ct({},e),{},{[Xl(i)]:n}),questionSnapshots:(null==s?void 0:s.id)?ct(ct({},t),{},{[s.id]:s.question}):t}}({responses:o,questionSnapshots:k},s,t,E[n]);a(l),C(u);const d=Py(e,n,t),h=d===Wf,p=[...S,n];if(h||(w(p),b(d),Zm(e,{surveySubmissionId:_,responses:l,lastQuestionIndex:d,questionOrder:zm(E),visitedIndices:p,surveyLanguage:m,questionSnapshots:u})),e.enable_partial_responses||h){const t=new Set(p.map(e=>{var t;return null===(t=E[e])||void 0===t?void 0:t.id}).filter(e=>!!e).map(e=>Xl(e))),n=Object.fromEntries(Object.entries(l).filter(([e])=>t.has(e)));Nm({responses:n,survey:e,surveySubmissionId:_,isSurveyCompleted:h,posthog:i,properties:v,surveyLanguage:m,questionSnapshots:u})}})({res:t,displayQuestionIndex:y,questionId:T.id}),onPreviewSubmit:p,initialValue:T.id?o[Xl(T.id)]:void 0,canGoBack:I,onBack(){if(f)return void g();if(0===S.length)return;const t=S[S.length-1],i=S.slice(0,-1);w(i),b(t),Zm(e,{surveySubmissionId:_,responses:o,lastQuestionIndex:t,questionOrder:zm(E),visitedIndices:i,surveyLanguage:m,questionSnapshots:k})}})]})]}):null}function zy({survey:e,forceDisableHtml:t,posthog:i,readOnly:n,surveyLanguage:s}){var r,o,a,l,c,u,d,h;const[p,g]=mf(!0),[_,f]=mf(!1),[v,m]=mf({}),y=bf(void 0),b=()=>{var e;(_||!i||n||(null===(e=i.client)||void 0===e?void 0:e.canCapture))&&f(!_)};if(yf(()=>{var t,s,r;if(!i)return void iv.error("FeedbackWidget called without a PostHog instance.");if(n)return;"tab"===(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)&&m((r=null===(s=e.appearance)||void 0===s?void 0:s.position)&&r!==Of&&r!==Df?{}:{top:"50%",bottom:"auto"});const o=t=>{var i;const n=t;(null===(i=n.detail)||void 0===i?void 0:i.surveyId)===e.id&&(iv.info(`Received show event for feedback button survey ${e.id}`),m(n.detail.position||{}),b())};return Qr(window,Ay,o),()=>{It(y.current)||(clearTimeout(y.current),y.current=void 0),window.removeEventListener(Ay,o)}},[i,n,e.id,null===(r=e.appearance)||void 0===r?void 0:r.widgetType,null===(o=e.appearance)||void 0===o?void 0:o.position,null===(a=e.appearance)||void 0===a?void 0:a.widgetSelector,null===(l=e.appearance)||void 0===l?void 0:l.borderColor]),$y({survey:e,setSurveyVisible:g,posthog:i}),!p)return null;const S=()=>{e.schedule!==jf&&g(!1),It(y.current)||clearTimeout(y.current),y.current=setTimeout(()=>{y.current=void 0,f(!1)},200)};return ef(F_,{children:["tab"===(null===(c=e.appearance)||void 0===c?void 0:c.widgetType)&&ef("button",{className:"ph-survey-widget-tab "+("top"===(null===(u=e.appearance)||void 0===u?void 0:u.tabPosition)?"widget-tab-top":""),onClick:b,disabled:n,style:By(null===(d=e.appearance)||void 0===d?void 0:d.tabPosition),children:(null===(h=e.appearance)||void 0===h?void 0:h.widgetLabel)||""}),_&&ef(qy,{posthog:i,survey:e,forceDisableHtml:t,style:v,onPopupSurveyDismissed:S,onCloseConfirmationMessage:S,surveyLanguage:s})]})}const Uy=({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l})=>{const c={forceDisableHtml:t,appearance:n,onPreviewSubmit(e){r(e)},onSubmit(e){s(e)},initialValue:o,displayQuestionIndex:i,canGoBack:a,onBack:l};switch(e.type){case qf:return P_(yy,ct(ct({},c),{},{question:e,key:e.id}));case"link":return P_(by,ct(ct({},c),{},{question:e,key:e.id}));case Uf:return P_(Sy,ct(ct({},c),{},{question:e,key:e.id}));case zf:case Hf:return P_(ky,ct(ct({},c),{},{question:e,key:e.id}));default:return iv.error(`Unsupported question type: ${e.type}`),null}},Wy="gzip-js",jy="base64";function Vy(e){let t=!0;return{dispose(){if(t){t=!1;const i=e();i&&Ct(i.then)&&i.then(void 0,()=>{})}}}}var Gy=class{on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter(e=>e!==t)}}emit(e,t){for(const i of this._events[e]||[])i(t);for(const i of this._events["*"]||[])i(e,t)}constructor(){this._events={}}};function Qy(e,t,i){if(Rt(e))return!1;switch(i){case"exact":return e===t;case"contains":{const i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}var Ky=class{constructor(e){this._host=e,this._actionRegistry=new Set,this._actionEvents=new Set,this._debugEventEmitter=new Gy,this._checkStep=(e,t)=>this._checkStepEvent(e,t)&&this._checkStepUrl(e,t)&&this._checkStepElement(e,t)&&this._checkStepProperties(e,t),this._checkStepEvent=(e,t)=>!(null==t?void 0:t.event)||(null==e?void 0:e.event)===(null==t?void 0:t.event)}init(){var e,t;It(null===(e=this._host)||void 0===e?void 0:e.subscribeCapture)||(this._captureHookUnsubscribe=null===(t=this._host)||void 0===t?void 0:t.subscribeCapture((e,t)=>{this.on(e,t)}))}dispose(){var e,t,i;null===(e=this._captureHookUnsubscribe)||void 0===e||e.call(this),this._captureHookUnsubscribe=void 0,null===(t=this._host)||void 0===t||null===(i=t.setElementSelectors)||void 0===i||i.call(t,new Set,this),this._debugEventEmitter=new Gy}register(e){var t,i;if(!It(null===(t=this._host)||void 0===t?void 0:t.subscribeCapture)&&(e.forEach(e=>{var t;this._actionRegistry.add(e),null===(t=e.steps)||void 0===t||t.forEach(e=>{this._actionEvents.add((null==e?void 0:e.event)||"")})}),null===(i=this._host)||void 0===i?void 0:i.setElementSelectors)){const e=new Set;this._actionRegistry.forEach(t=>{var i;null===(i=t.steps)||void 0===i||i.forEach(t=>{(null==t?void 0:t.selector)&&e.add(t.selector)})}),this._host.setElementSelectors(e,this)}}replace(e){this._actionRegistry.clear(),this._actionEvents.clear(),this.register(e)}on(e,t){null!=t&&0!=e.length&&(this._actionEvents.has(e)||this._actionEvents.has(t.event))&&this._actionRegistry.forEach(e=>{this._checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)})}_addActionHook(e){this.onAction("actionCaptured",t=>e(t))}_checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(const i of t.steps)if(this._checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(e,t){if(null==t?void 0:t.url){var i;let r=null==e||null===(i=e.properties)||void 0===i?void 0:i.$current_url;if(!(null==e?void 0:e.properties)||!("$current_url"in e.properties))try{var n,s;r=null===(n=this._host)||void 0===n||null===(s=n.getActionUrl)||void 0===s?void 0:s.call(n)}catch(e){return!1}if(!r||"string"!=typeof r)return!1;if(!Qy(r,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t)}_checkStepHref(e,t){var i;if(!(null==t?void 0:t.href))return!0;const n=this._getElementsList(e);if(n.length>0)return n.some(e=>Qy(e.href,t.href,t.href_matching||"exact"));const s=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!s&&Qy(function(e){const t=e.match(/(?::|")href="(.*?)"/);return t?t[1]:""}(s),t.href,t.href_matching||"exact")}_checkStepText(e,t){var i;if(!(null==t?void 0:t.text))return!0;const n=this._getElementsList(e);if(n.length>0)return n.some(e=>Qy(e.text,t.text,t.text_matching||"exact")||Qy(e.$el_text,t.text,t.text_matching||"exact"));const s=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!s&&(r=function(e){const t=[],i=/(?::|")text="(.*?)"/g;let n;for(;!Rt(n=i.exec(e));)t.includes(n[1])||t.push(n[1]);return t}(s),o=t.text,a=t.text_matching||"exact",r.some(e=>Qy(e,o,a)));var r,o,a}_checkStepSelector(e,t){var i,n;if(!(null==t?void 0:t.selector))return!0;const s=null==e||null===(i=e.properties)||void 0===i?void 0:i.$element_selectors;if(null==s?void 0:s.includes(t.selector))return!0;const r=(null==e||null===(n=e.properties)||void 0===n?void 0:n.$elements_chain)||"";if(t.selector_regex&&r)try{return new RegExp(t.selector_regex).test(r)}catch(e){}return!1}_getElementsList(e){var t;return null==(null==e||null===(t=e.properties)||void 0===t?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return!(null==t?void 0:t.properties)||0===t.properties.length||gc(t.properties.reduce((e,t)=>{const i=kt(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}},Jy=class{constructor(e,t){this._onActivationChanged=t,this._pendingActivatedItems=[],this._host=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map}_subscribeSession(){var e,t;this._sessionIdUnsubscribe=null===(e=(t=this._host).subscribeSession)||void 0===e?void 0:e.call(t,e=>this._onSessionIdChanged(e))}_shouldPersistArmedActivation(e){return!1}_getActivationTimestampsKey(){return null}_writeActivationTimestamps(e){}_clearActivationTimestampsStore(){}_doesEventMatchFilter(e,t){return!!e&&gc(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(e,t){const i=new Map;return e.forEach(e=>{var n;null===(n=e.conditions)||void 0===n||null===(n=n[t])||void 0===n||null===(n=n.values)||void 0===n||n.forEach(t=>{if(null==t?void 0:t.name){const n=i.get(t.name)||[];n.push(e.id),i.set(t.name,n)}})}),i}_getMatchingItems(e,t,i){const n=(i===Pf?this._eventToItems:this._cancelEventToItems).get(e);let s=[];return this._getItems(e=>{s=e.filter(e=>null==n?void 0:n.includes(e.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(t=>t.name===e);return this._doesEventMatchFilter(r,t)})}register(e){this._register(e,!1)}replace(e){this._register(e,!0)}_register(e,t){It(this._host.subscribeCapture)||(this._setupEventBasedItems(e,t),this._setupActionBasedItems(e,t))}_setupActionBasedItems(e,t){const i=e.filter(e=>{var t;return null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length});var n;if(t&&this._actionToItems.clear(),0===i.length)return void(t&&(null===(n=this._actionMatcher)||void 0===n||n.replace([])));this._actionMatcher||(this._actionMatcher=new Ky(this._host),this._actionMatcher.init(),this._actionMatcher._addActionHook(e=>this.onAction(e)));const s=[];i.forEach(e=>{var t;null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||t.values.forEach(t=>{if(s.push(t),t.name){var i;const n=null!==(i=this._actionToItems.get(t.name))&&void 0!==i?i:[];n.includes(e.id)||n.push(e.id),this._actionToItems.set(t.name,n)}})}),t?this._actionMatcher.replace(s):this._actionMatcher.register(s)}_mergeItemMaps(e,t){t.forEach((t,i)=>{var n;const s=null!==(n=e.get(i))&&void 0!==n?n:[];t.forEach(e=>{s.includes(e)||s.push(e)}),e.set(i,s)})}_setupEventBasedItems(e,t){var i,n,s;const r=e.filter(e=>{var t,i;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),o=e.filter(e=>{var t,i;return(null===(t=e.conditions)||void 0===t?void 0:t.cancelEvents)&&(null===(i=e.conditions)||void 0===i||null===(i=i.cancelEvents)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),a=this._buildEventToItemMap(e,Pf),l=this._buildEventToItemMap(e,Rf);t?(this._eventToItems=a,this._cancelEventToItems=l):(this._mergeItemMaps(this._eventToItems,a),this._mergeItemMaps(this._cancelEventToItems,l)),(0!==r.length||0!==o.length||e.some(e=>{var t;return null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length}))&&(null!==(i=this._captureHookUnsubscribe)&&void 0!==i||(this._captureHookUnsubscribe=null===(n=(s=this._host).subscribeCapture)||void 0===n?void 0:n.call(s,(e,t)=>{this.onEvent(e,t)})))}onEvent(e,t){var i,n;const s=this._getLogger(),r=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$survey_id)||(null==t||null===(n=t.properties)||void 0===n?void 0:n.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const i=this._activationOutcome(e,r,t);if("consume"===i)return s.info("event consumed activated item, removing it",{event:e,itemId:r}),void this._deactivateItems([r]);if("persist"===i)return s.info("shown item promoted to persisted activation",{event:e,itemId:r}),this._persistActivation(r),void this._clearActivationTimestamps([r])}if(this._cancelEventToItems.has(e)){const i=this._getMatchingItems(e,t,Rf);i.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:i.map(e=>e.id)}),this._deactivateItems(i.map(e=>e.id)),i.forEach(e=>this._cancelPendingItem(e.id)))}if(!this._eventToItems.has(e))return;s.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});const o=this._getMatchingItems(e,t,Pf);this._activateItems(o.map(e=>e.id))}onAction(e){this._actionToItems.has(e)&&this._activateItems(this._actionToItems.get(e)||[])}_activateItems(e){if(0===e.length)return;const t=!!this._host.getSessionId(),i=[];for(const n of e)t&&this._shouldPersistArmedActivation(n)?this._persistActivation(n)&&this._recordActivationTimestamp(n):i.push(n);i.length>0&&(this._pendingActivatedItems=[...new Set([...this._pendingActivatedItems,...i])]),this._getLogger().info("updating activated items",{activatedItems:this.getActivatedIds()}),this._notifyActivationChanged()}_persistActivation(e){this._pendingActivatedItems=this._pendingActivatedItems.filter(t=>t!==e);const t=this._getPersistedActivatedIds();return!t.includes(e)&&(this._setActivatedItems([...t,e]),this._stampActivationSession(),!0)}_deactivateItems(e){const t=new Set(e);this._pendingActivatedItems=this._pendingActivatedItems.filter(e=>!t.has(e));const i=this._getRawPersistedActivatedIds(),n=i.filter(e=>!t.has(e));n.length!==i.length&&(this._setActivatedItems(n),0===n.length&&this._clearActivationSession()),this._clearActivationTimestamps(e),this._notifyActivationChanged()}_notifyActivationChanged(){try{var e;null===(e=this._onActivationChanged)||void 0===e||e.call(this)}catch(e){this._getLogger().error("Error while handling activated items change",e)}}_getRawActivationTimestamps(){const e=this._getActivationTimestampsKey();if(!e)return{};const t=this._host.getProperty(e);return t&&"object"==typeof t?t:{}}_recordActivationTimestamp(e){if(!this._getActivationTimestampsKey())return;const t=this._getRawActivationTimestamps();this._writeActivationTimestamps(ct(ct({},t),{},{[e]:Date.now()}))}_clearActivationTimestamps(e){if(!this._getActivationTimestampsKey())return;const t=this._getRawActivationTimestamps(),i={};let n=!1;for(const[s,r]of Object.entries(t))e.includes(s)?n=!0:i[s]=r;n&&(Et(i)?this._clearActivationTimestampsStore():this._writeActivationTimestamps(i))}_clearAllActivationTimestamps(){this._getActivationTimestampsKey()&&this._clearActivationTimestampsStore()}getActivationTimestamp(e){if(!this._getPersistedActivatedIds().includes(e))return;const t=this._getRawActivationTimestamps()[e];return Ft(t)?t:void 0}_getRawPersistedActivatedIds(){const e=this._getActivatedKey();return this._host.getProperty(e)||[]}_getPersistedActivatedIds(){const e=this._getRawPersistedActivatedIds();if(0===e.length)return[];const t=this._host.getProperty(this._getActivatedSessionKey()),i=this._host.getSessionId();return i&&t===i?e:[]}_stampActivationSession(){const e=this._host.getSessionId();e&&this._setActivatedSession(e)}_clearActivationSession(){this._clearActivatedSession()}_onSessionIdChanged(e){const t=this._host.getProperty(this._getActivatedSessionKey());if(t&&t!==e){const e=this._getRawPersistedActivatedIds(),t=this._getRawActivationTimestamps();e.length>0&&(this._setActivatedItems([]),e.filter(e=>Ft(t[e])).forEach(e=>this._cancelPendingItem(e))),this._clearActivationSession(),this._clearAllActivationTimestamps(),e.length>0&&this._notifyActivationChanged()}}getActivatedIds(){return[...new Set([...this._getPersistedActivatedIds(),...this._pendingActivatedItems])].filter(e=>!this._isItemPermanentlyIneligible(e))}dispose(){var e,t,i;null===(e=this._sessionIdUnsubscribe)||void 0===e||e.call(this),this._sessionIdUnsubscribe=void 0,null===(t=this._captureHookUnsubscribe)||void 0===t||t.call(this),this._captureHookUnsubscribe=void 0,null===(i=this._actionMatcher)||void 0===i||i.dispose(),this._actionMatcher=void 0}reset(){this._pendingActivatedItems=[],this._getRawPersistedActivatedIds().length>0&&this._setActivatedItems([]),this._clearActivationSession(),this._clearAllActivationTimestamps(),this._notifyActivationChanged()}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}},Zy=class extends Jy{constructor(e,t,i,n){var s;super({subscribeCapture(t){const i=e.onEvent(e=>t(e.event,e));return()=>i.dispose()},subscribeSession(t){const i=e.onSession(t);return()=>i.dispose()},getSessionId(){var t;return null===(t=e.session)||void 0===t?void 0:t.sessionId},getProperty:t=>e.kv.get(t),getActionUrl:null==i?void 0:i.getActionUrl,setElementSelectors:null!==(s=null==i?void 0:i.setElementSelectors)&&void 0!==s?s:(t,i)=>{var n;return null===(n=e.getExtension("autocapture"))||void 0===n?void 0:n.setElementSelectors(t,i)}},n),this._client=e,this._surveys=t,this._subscribeSession()}_getActivatedKey(){return F}_getActivatedSessionKey(){return A}_getActivationTimestampsKey(){return L}_writeActivationTimestamps(e){this._client.kv.set({[L]:e})}_clearActivationTimestampsStore(){this._client.kv.remove(L)}_shouldPersistArmedActivation(e){var t;let i;this._getItems(t=>{i=t.find(t=>t.id===e)});const n=null==i||null===(t=i.appearance)||void 0===t?void 0:t.surveyPopupDelaySeconds;return Ft(n)&&n>0}_getShownEventName(){return Vf}_getItems(e){this._surveys.getSurveys(e)}_cancelPendingItem(e){this._surveys.cancelPendingSurvey(e)}_getLogger(){return iv}_setActivatedItems(e){this._client.kv.set({[F]:e})}_setActivatedSession(e){this._client.kv.set({[A]:e})}_clearActivatedSession(){this._client.kv.remove(A)}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t,i){var n;if(e===Qf&&!1===(null==i||null===(n=i.properties)||void 0===n?void 0:n.$survey_completed))return"ignore";let s;return this._getItems(e=>{s=e.find(e=>e.id===t)}),!s||uc(s)?e===Vf?"consume":"ignore":e===Vf?"persist":e===Gf||e===Qf?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}};const Yy=(e,t)=>(null==e?void 0:e.then)?e.then(t):t(e),Xy="SDK is not enabled or survey functionality is not yet loaded",eb="Disabled. Not loading surveys.";var tb=class{constructor(e){this._configSource=e,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this._isInitializingSurveys=!1,this._surveyInitializationFailed=!1,this._surveyCallbacks=[],this._activeMatchingSurveyCallbacks=[],this._getSurveysInFlightPromise=null,this._lastSurveyRefreshFailedAt=null,this._disposed=!1,this._renderTimeouts=new Set,this.onRemoteConfig=e=>{if(this._disposed)return;if(this._config.disableSurveys)return;if(!e.ok)return this._surveyInitializationFailed=!0,this._notifyActiveMatchingSurveyCallbacks({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),iv.warn("Remote config unavailable. Not loading surveys.");const t=e.config.surveys;if(Rt(t))return iv.warn("Flags not loaded yet. Not loading surveys.");this._isSurveysEnabled=Lt(t)?t:t.length>0,iv.info(`flags response received, isSurveysEnabled: ${this._isSurveysEnabled}`),this.loadIfEnabled()},this._notifyActiveMatchingSurveyCallbacks=e=>{this._activeMatchingSurveyCallbacks.slice().forEach(t=>this._notifyActiveMatchingSurveyCallback(t,e))}}setup(e){if(!this._disposed)return this._initializingClient=e,Yy(e.kv.initialize(),()=>{if(this._initializingClient!==e||this._disposed)return;this._initializingClient=void 0,this._client=e;const t=e.onRemoteConfig(this.onRemoteConfig);this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.loadIfEnabled())})}dispose(){var e,t,i,n,s;this._disposed||(this._disposed=!0,this._initializingClient=void 0,this._client=void 0,null===(e=this._remoteConfigSubscription)||void 0===e||e.dispose(),this._remoteConfigSubscription=void 0,null===(t=this._surveyEventReceiver)||void 0===t||t.dispose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(n=i.dispose)||void 0===n||n.call(i),this._surveyManager=null,this._surveyCallbacks=[],this._activeMatchingSurveyCallbacks.forEach(e=>{e.active=!1}),this._activeMatchingSurveyCallbacks=[],null===(s=this._activeMatchingSurveyConditionsUnsubscribe)||void 0===s||s.call(this),this._activeMatchingSurveyConditionsUnsubscribe=void 0,this._getSurveysInFlightPromise=null,this._renderTimeouts.forEach(e=>clearTimeout(e)),this._renderTimeouts.clear())}get _config(){return this._configSource.get()}getRenderContext(){if(!this._client)return;const e=this;return{client:this._client,get config(){return e._config},surveys:e}}initialize(){this.loadIfEnabled()}reset(){var e,t;null===(e=this._surveyManager)||void 0===e||null===(t=e.clearInMemoryInProgressSurveyState)||void 0===t||t.call(e);try{var i;null===(i=this._surveyEventReceiver)||void 0===i||i.reset(),localStorage.removeItem("lastSeenSurveyDate");const e=[];for(let t=0;t<localStorage.length;t++){const i=localStorage.key(t);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}catch(e){}this._notifyActiveMatchingSurveyCallbacks()}loadIfEnabled(){if(this._disposed||!this._client)return;const e=this._config;if(this._surveyManager)return;if(this._isInitializingSurveys)return void iv.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void iv.info(eb);if(e.cookielessMode&&this._client.isOptedOut)return void iv.info("Not loading surveys in cookieless mode without consent.");const t=this._configSource.getExtensions();if(!t)return void this._handleSurveyLoadError("PostHog Extensions not found.");if(It(this._isSurveysEnabled)&&!e.advancedEnableSurveys)return;const i=this._isSurveysEnabled||e.advancedEnableSurveys;this._isInitializingSurveys=!0,this._surveyInitializationFailed=!1;try{const e=t.generateSurveys;if(e)return this._completeSurveyInitialization(e,i),void(this._isInitializingSurveys=!1);const n=t.loadExternalDependency;if(!n)return this._handleSurveyLoadError(R),void(this._isInitializingSurveys=!1);n(e=>{try{if(this._disposed)return;const t=this._configSource.getExtensions();e||!(null==t?void 0:t.generateSurveys)?this._handleSurveyLoadError("Could not load surveys script",e):this._completeSurveyInitialization(t.generateSurveys,i)}finally{this._isInitializingSurveys=!1}})}catch(e){throw this._isInitializingSurveys=!1,this._handleSurveyLoadError("Error initializing surveys",e),e}}_completeSurveyInitialization(e,t){var i;if(this._disposed)return;this._surveyManager=e(t),this._surveyEventReceiver=this._createEventReceiver(this._client,this._notifyActiveMatchingSurveyCallbacks);const n=null===(i=this._client)||void 0===i?void 0:i.kv.get(M);n&&this._registerEventOrActionBasedSurveys(n),iv.info("Surveys loaded successfully"),this._startActiveMatchingSurveyConditions(),this._notifyActiveMatchingSurveyCallbacks(),this._notifySurveyCallbacks({isLoaded:!0})}_createEventReceiver(e,t){return new Zy(e,this,void 0,t)}_handleSurveyLoadError(e,t){this._surveyInitializationFailed=!0,iv.error(e,t),this._notifyActiveMatchingSurveyCallbacks({isLoaded:!1,error:e}),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter(t=>t!==e)}}getSurveys(e,t=!1){if(this._disposed)return;const i=this._client;if(!i)return e([],{isLoaded:!1,error:Xy});if(this._config.disableSurveys)return iv.info(eb),e([]);const n=i.kv.get(M);if(n&&!t)return e(n,{isLoaded:!0}),void(this._shouldBackgroundRefreshSurveys()&&this.getSurveys(()=>{},!0));if(this._getSurveysInFlightPromise)return void this._getSurveysInFlightPromise.then(({surveys:t,context:i})=>{this._disposed||e(t,i)}).catch(e=>iv.error("Error in survey callback",e));const s=i.sendRequest("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this._config.requestTimeoutMs}).then(e=>{try{return this._handleSurveyResponse(i,e)}catch(e){return iv.error("Error processing surveys response",e),this._handleSurveyResponse(i,{statusCode:0,error:e})}},e=>this._handleSurveyResponse(i,{statusCode:0,error:e}));this._getSurveysInFlightPromise=s;const r=()=>{this._getSurveysInFlightPromise===s&&(this._getSurveysInFlightPromise=null)};s.then(t=>{r(),this._disposed||(this._notifyActiveMatchingSurveyCallbacks(t.context),e(t.surveys,t.context))},r).catch(e=>iv.error("Error in survey callback",e))}_handleSurveyResponse(e,t){if(this._disposed)return{surveys:[],context:{isLoaded:!1,error:Xy}};const i=t.statusCode;if(200!==i||!t.json){const e=`Surveys API could not be loaded, status: ${i}`;return 0!==i?iv.error(e):t.error||iv.warn(e),this._lastSurveyRefreshFailedAt=Date.now(),{surveys:[],context:{isLoaded:!1,error:e}}}this._lastSurveyRefreshFailedAt=null;const n=t.json.surveys||[];return e.kv.set({[M]:n,[P]:Date.now()}),this._registerEventOrActionBasedSurveys(n),{surveys:n,context:{isLoaded:!0}}}_registerEventOrActionBasedSurveys(e){const t=e.filter(e=>sv(e)&&(cc(e)||rv(e)));this._registerSurveyTriggers(t)}_registerSurveyTriggers(e){var t;null===(t=this._surveyEventReceiver)||void 0===t||t.replace(e)}_shouldBackgroundRefreshSurveys(){return this._isSurveyCacheStale()&&!this._getSurveysInFlightPromise&&!this._isSurveyRefreshBackingOff()}_isSurveyCacheStale(){var e;const t=null===(e=this._client)||void 0===e?void 0:e.kv.get(P);return Ft(t)&&Date.now()-t>3e5}_isSurveyRefreshBackingOff(){return Ft(this._lastSurveyRefreshFailedAt)&&3e5>Date.now()-this._lastSurveyRefreshFailedAt}markSurveyAsSeen(e,t){var i;const n={id:e,current_iteration:null!==(i=null==t?void 0:t.iteration)&&void 0!==i?i:null};lv(n);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}this._notifyActiveMatchingSurveyCallbacks()}_notifySurveyCallbacks(e){for(const t of this._surveyCallbacks){if(this._disposed)return;try{e.isLoaded?this.getSurveys(t):t([],e)}catch(e){iv.error("Error in survey callback",e)}}}getActiveMatchingSurveys(e,t=!1){if(!Rt(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);iv.warn("init was not called")}onActiveMatchingSurveysChanged(e){var t;if(this._disposed)return()=>{};const i={callback:e,active:!0,revision:0};this._activeMatchingSurveyCallbacks.push(i),this._startActiveMatchingSurveyConditions();const n=null===(t=this._client)||void 0===t?void 0:t.kv.get(M);return this._config.disableSurveys||!this._surveyManager&&this._surveyInitializationFailed&&!this._isInitializingSurveys||!n&&!Rt(this._lastSurveyRefreshFailedAt)&&!this._getSurveysInFlightPromise?this._notifyActiveMatchingSurveyCallback(i,{isLoaded:!1}):this._surveyManager&&this._notifyActiveMatchingSurveyCallback(i),()=>{var e;i.active=!1,this._activeMatchingSurveyCallbacks=this._activeMatchingSurveyCallbacks.filter(e=>e!==i),0===this._activeMatchingSurveyCallbacks.length&&(null===(e=this._activeMatchingSurveyConditionsUnsubscribe)||void 0===e||e.call(this),this._activeMatchingSurveyConditionsUnsubscribe=void 0)}}_startActiveMatchingSurveyConditions(){var e,t,i;this._surveyManager&&this._activeMatchingSurveyCallbacks.length>0&&(null!==(e=this._activeMatchingSurveyConditionsUnsubscribe)&&void 0!==e||(this._activeMatchingSurveyConditionsUnsubscribe=null===(t=(i=this._configSource).onMatchingConditionsChanged)||void 0===t?void 0:t.call(i,this._notifyActiveMatchingSurveyCallbacks)))}_notifyActiveMatchingSurveyCallback(e,t){if(this._disposed||!e.active)return;const i=++e.revision,n=n=>{if(!this._disposed&&e.active&&i===e.revision)try{const i=null!=t?t:{isLoaded:!0},s=JSON.stringify([n,i]);if(s===e.lastResult)return;e.lastResult=s,e.callback(n,i)}catch(e){iv.error("Error in active matching surveys callback",e)}};try{t&&!t.isLoaded?n([]):this.getActiveMatchingSurveys(n)}catch(e){iv.error("Error in active matching surveys callback",e)}}_getSurveyById(e){let t=null;return this.getSurveys(i=>{var n;t=null!==(n=i.find(t=>t.id===e))&&void 0!==n?n:null}),t}_checkSurveyEligibility(e){if(Rt(this._surveyManager))return{eligible:!1,reason:Xy};const t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}_checkSurveyRenderability(e){var t;if(!(null===(t=this._client)||void 0===t?void 0:t.canCapture))return{eligible:!1,reason:nv};if(Rt(this._surveyManager))return{eligible:!1,reason:Xy};const i="string"==typeof e?this._getSurveyById(e):e;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Rt(this._surveyManager))return iv.warn("init was not called"),{visible:!1,disabledReason:Xy};const t=this._checkSurveyRenderability(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Rt(this._surveyManager)?(iv.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Xy})):new Promise(i=>{this.getSurveys(t=>{var n;const s=null!==(n=t.find(t=>t.id===e))&&void 0!==n?n:null;if(s){const e=this._checkSurveyRenderability(s);i({visible:e.eligible,disabledReason:e.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var n,s,r;if(!(null===(n=this._client)||void 0===n?void 0:n.canCapture))return;if(Rt(this._surveyManager))return void iv.warn("init was not called");const o="string"==typeof e?this._getSurveyById(e):e;if(!(null==o?void 0:o.id))return void iv.warn("Survey not found");if(!cv.includes(o.type))return void iv.warn(`Surveys of type ${o.type} cannot be rendered in the app`);const a=null===(s=typeof document>"u"?void 0:document)||void 0===s?void 0:s.querySelector(t);if(a){if(null===(r=o.appearance)||void 0===r?void 0:r.surveyPopupDelaySeconds){iv.info(`Rendering survey ${o.id} with delay of ${o.appearance.surveyPopupDelaySeconds} seconds`);const e=setTimeout(()=>{var t,n,s;this._renderTimeouts.delete(e),!this._disposed&&(null===(t=this._client)||void 0===t?void 0:t.canCapture)&&(iv.info(`Rendering survey ${o.id} with delay of ${null===(n=o.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds} seconds`),null===(s=this._surveyManager)||void 0===s||s.renderSurvey(o,a,i),iv.info(`Survey ${o.id} rendered`))},1e3*o.appearance.surveyPopupDelaySeconds);return void this._renderTimeouts.add(e)}this._surveyManager.renderSurvey(o,a,i)}else iv.warn("Survey element not found")}displaySurvey(e,t){var i,n;if(!(null===(i=this._client)||void 0===i?void 0:i.canCapture))return;if(Rt(this._surveyManager))return void iv.warn("init was not called");const s=this._getSurveyById(e);if(!s)return void iv.warn("Survey not found");let r=s;if((null===(n=s.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)&&t.ignoreDelay&&(r=ct(ct({},s),{},{appearance:ct(ct({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==tv&&t.initialResponses&&iv.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){const e=this._checkSurveyEligibility(s);if(!e.eligible)return void iv.warn("Survey is not eligible to be displayed: ",e.reason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}cancelPendingSurvey(e){Rt(this._surveyManager)?iv.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;null===(e=this._surveyManager)||void 0===e||null===(t=e.handlePageUnload)||void 0===t||t.call(e)}},ib=class{constructor(e){this.disabled=!1===e;const t=xt(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;const n=this.clicks[this.clicks.length-1];if(n&&Math.abs(e-n.x)+Math.abs(t-n.y)<this.thresholdPx&&this.timeoutMs>i-n.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}};const nb=()=>typeof window>"u"?void 0:window,sb=()=>typeof document>"u"?void 0:document,rb="$copy_autocapture",ob=["password","hidden","file","checkbox","button","submit","reset","image"],ab=Nr("[AutoCapture]");function lb(e,t){return t.length>e?t.slice(0,e)+"...":t}function cb(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do{t=t.previousSibling}while(t&&!co(t));return t}function ub(e,{e:t,maskAllElementAttributes:i,maskAllText:n,elementAttributeIgnoreList:s,elementsChainAsString:r,disableCaptureUrlHashes:o}){var a,l;if(!co(e))return{props:{}};const c=[e],u=new Set([e]);let d=e;for(;d.parentNode&&!uo(d,"body")&&1e3>c.length;){if(po(d.parentNode)){const e=d.parentNode.host;if(u.has(e))break;u.add(e),c.push(e),d=e;continue}if(!co(d.parentNode))break;if(u.has(d.parentNode))break;u.add(d.parentNode),c.push(d.parentNode),d=d.parentNode}const h="click"===t.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?c.findIndex(e=>uo(e,"button")||uo(e,"a")):-1;h>0&&(n=n||c.slice(0,h+1).some(e=>!qo(e)||Ho(e)));const p=[],g={};let _,f=!1,v=!1;if(qr(c,e=>{const t=qo(e);if(uo(e,"a")&&!i&&!(null==s?void 0:s.includes("href"))){const i=e.getAttribute("href");f=!!(t&&i&&Ko(i))&&(o?un(i):i)}ft(fo(e),"ph-no-capture")&&(v=!0),p.push(function(e,t,i,n,s=!1){const r=e.tagName.toLowerCase(),o={tag_name:r};bo.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?lb(1024,Jo(e)):lb(1024,mo(e)));const a=fo(e);t||(null==n?void 0:n.includes("class"))||0>=a.length||(o.classes=a.filter(function(e){return""!==e})),qr(e.attributes,function(i){var r;if((!Ho(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==n?void 0:n.includes(i.name))&&!t&&Ko(i.value)&&(!Tt(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let e=i.value;"class"===i.name&&(e=go(e).join(" ")),o["attr__"+i.name]=lb(1024,"href"===i.name&&s?un(e):e)}});let l=1,c=1,u=e;for(;u=cb(u);)l++,u.tagName===e.tagName&&c++;return o.nth_child=l,o.nth_of_type=c,o}(e,i,n,s,o)),qr(function(e){if(!qo(e))return{};const t={};return qr(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){const i=e.name.replace("data-ph-capture-attribute-",""),n=e.value;i&&n&&Ko(n)&&(t[i]=n)}}),t}(e),(e,t)=>{({}).hasOwnProperty.call(g,t)||(g[t]=e)})}),v)return{props:{},explicitNoCapture:v};if(h>0&&(e=c[h],p.splice(0,h)),n||(p[0].$el_text=uo(e,"a")||uo(e,"button")?Jo(e):mo(e)),f){var m,y;p[0].attr__href=f;const e=null===(m=Jr(f))||void 0===m?void 0:m.host,t=null===(y=nb())||void 0===y||null===(y=y.location)||void 0===y?void 0:y.host;e&&t&&e!==t&&(_=f)}return{props:Hr((S=t.type,{$event_type:S,$ce_version:1}),r?{}:{$elements:p},{$elements_chain:(b=p,kt(b)?function(e){return e.map(e=>{var t,i;let n="";if(e.tag_name&&(n+=e.tag_name),e.attr_class){e.attr_class.sort();for(const t of e.attr_class)n+=`.${t.replace(/"/g,"")}`}const s=ct(ct(ct(ct({},e.text?{text:e.text}:{}),{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),r={};return zr(s).sort(([e],[t])=>function(e,t){return t>e?-1:e>t?1:0}(e,t)).forEach(([e,t])=>r[Yo(e.toString())]=Yo(t.toString())),n+=":",n+=zr(r).map(([e,t])=>`${e}="${t}"`).join(""),n}).join(";")}(function(e){return e.map(e=>{var t,i;const n={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(i=e.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:Xo(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return zr(e).filter(([e])=>0===e.indexOf("attr__")).forEach(([e,t])=>n.attributes[e]=t),n})}(b)):"")},(null===(a=p[0])||void 0===a?void 0:a.$el_text)?{$el_text:null===(l=p[0])||void 0===l?void 0:l.$el_text}:{},_&&"click"===t.type?{$external_click_url:_}:{},g),target:e};var b,S}const db="autocapture";var hb=class{_clearPointer(){this._pointerDown=void 0,clearTimeout(this._pointerExpiry),this._pointerExpiry=void 0}_isExcludedPointerTarget(e){var t;if(!qo(e))return!0;const i=null!==(t=this._refreshConfig().css_selector_ignorelist)&&void 0!==t?t:Co,n=new Set;let s=e;for(;s;){if(n.size>=1e3||n.has(s))return!0;n.add(s);const e=s,t=fo(e);if(ft(t,"ph-no-capture")||ft(t,"ph-sensitive")||Ho(e)||i.some(t=>So(e,t)))return!0;const r=s.parentNode;s=po(r)?r.host:r&&co(r)?r:null}return!1}_trackPointer(e){if(!this.isEnabled||"pointercancel"===e.type)return void this._clearPointer();if("pointerdown"===e.type){var t;this._clearPointer();const i=yo(e);return void(e.isPrimary&&0===e.button&&!e.ctrlKey&&i&&co(i)&&(this._pointerDown={target:i,excluded:this._isExcludedPointerTarget(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:null===(t=this._client)||void 0===t?void 0:t.distinctId}))}const i=this._pointerDown;i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this._clearPointer():"pointerup"===e.type&&(i.released=!0,this._pointerExpiry=setTimeout(()=>this._clearPointer(),0)))}_recoverClickTarget(e){var t;const i=this._pointerDown;this._clearPointer();const n=yo(e);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(t=this._client)||void 0===t?void 0:t.distinctId)&&e.pointerId===i.id&&(e.detail>0||"touch"===e.pointerType||"pen"===e.pointerType)&&0===e.button&&5>=Math.abs(e.clientX-i.x)&&5>=Math.abs(e.clientY-i.y)&&n&&(uo(n,"html")||uo(n,"body"))){var s,r,o;if(i.excluded)return null;const e=null!==(s=this._refreshConfig().css_selector_ignorelist)&&void 0!==s?s:Co;return[n,null===(r=sb())||void 0===r?void 0:r.documentElement,null===(o=sb())||void 0===o?void 0:o.body].some(t=>{if(!t)return!1;const i=fo(t);return ft(i,"ph-no-capture")||ft(i,"ph-sensitive")||!qo(t)||Ho(t)||e.some(e=>So(t,e))})?null:i.target}}constructor(e){this._configSource=e,this.name=db,this._initialized=!1,this._isDisabledServerSide=null,this._hasReceivedConfigResponse=!1,this._elementSelectorsByOwner=new Map,this._elementsChainAsString=!1,this._config={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this._disposed=!1,this._configSource.refresh(this._config),this.rageclicks=new ib(this._config.rageclick),this._elementSelectors=null}setup(e){this._compileUrlPatterns(),this._client=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.startIfEnabled())}dispose(){var e;this._disposed||(this._disposed=!0,this._client=void 0,null===(e=this._remoteConfigSubscription)||void 0===e||e.dispose(),this._remoteConfigSubscription=void 0,this._elementSelectorsByOwner.clear(),this._elementSelectors=null,this._removeDomEventHandlers())}_refreshConfig(){return this._configSource.refresh(this._config),this._config}_compileUrlPatterns(){var e,t;return this._refreshConfig(),this._config.url_allowlist=null===(e=this._config.url_allowlist)||void 0===e?void 0:e.map(e=>new RegExp(e)),this._config.url_ignorelist=null===(t=this._config.url_ignorelist)||void 0===t?void 0:t.map(e=>new RegExp(e)),this._config}_addDomEventHandlers(){const e=nb(),t=sb();if(!this.isBrowserSupported())return void ab.info("Disabling Automatic Event Collection because this browser is not supported");if(!e||!t)return;this._listenerWindow=e,this._listenerDocument=t;const i=this._domEventHandler=t=>{t=t||(null==e?void 0:e.event);try{if("blur"===t.type)return void this._clearPointer();if(0===t.type.indexOf("pointer"))return void this._trackPointer(t);const e="click"===t.type?this._recoverClickTarget(t):void 0;if(Pt(e))return;this._captureEvent(t,"$autocapture",e)}catch(e){ab.error("Failed to capture event",e)}};if(Qr(e,"blur",i),Qr(t,"submit",i,{capture:!0}),Qr(t,"change",i,{capture:!0}),Qr(t,"click",i,{capture:!0}),qr(["pointerdown","pointermove","pointerup","pointercancel"],e=>{Qr(t,e,i,{capture:!0})}),this._refreshConfig().capture_copied_text){const i=this._copiedTextHandler=t=>{t=t||(null==e?void 0:e.event);try{this._captureEvent(t,rb)}catch(e){ab.error("Failed to capture clipboard event",e)}};Qr(t,"copy",i,{capture:!0}),Qr(t,"cut",i,{capture:!0}),Qr(t,"paste",i,{capture:!0})}}_removeDomEventHandlers(){const e=this._listenerWindow,t=this._listenerDocument;this._clearPointer(),this._domEventHandler&&(null==e||e.removeEventListener("blur",this._domEventHandler),qr(["pointerdown","pointermove","pointerup","pointercancel"],e=>{null==t||t.removeEventListener(e,this._domEventHandler,!0)}),null==t||t.removeEventListener("submit",this._domEventHandler,!0),null==t||t.removeEventListener("change",this._domEventHandler,!0),null==t||t.removeEventListener("click",this._domEventHandler,!0),this._domEventHandler=void 0),this._copiedTextHandler&&(null==t||t.removeEventListener("copy",this._copiedTextHandler,!0),null==t||t.removeEventListener("cut",this._copiedTextHandler,!0),null==t||t.removeEventListener("paste",this._copiedTextHandler,!0),this._copiedTextHandler=void 0),this._listenerWindow=void 0,this._listenerDocument=void 0,this._initialized=!1}startIfEnabled(){this.isEnabled||this._clearPointer(),!this._disposed&&this._client&&this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){if(this._disposed)return;if(this._hasReceivedConfigResponse=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString);const i=t.autocapture_opt_out;var n;Lt(i)&&(null===(n=this._client)||void 0===n||n.kv.set("$autocapture_disabled_server_side",i),this._isDisabledServerSide=i),this.startIfEnabled()}setElementSelectors(e,t=this){if(this._disposed)return;e.size?this._elementSelectorsByOwner.set(t,new Set(e)):this._elementSelectorsByOwner.delete(t);const i=new Set;this._elementSelectorsByOwner.forEach(e=>{e.forEach(e=>i.add(e))}),this._elementSelectors=i}getElementSelectors(e,t){var i;const n=[];return null===(i=this._elementSelectors)||void 0===i||i.forEach(i=>{var s;const r=null===(s=sb())||void 0===s?void 0:s.querySelectorAll(i);null==r||r.forEach(s=>{e!==s&&t!==s||ft(n,i)||n.push(i)})}),n}get isEnabled(){var e,t;if(this._disposed)return!1;const i=null===(e=this._client)||void 0===e?void 0:e.kv.get(T),n=this._isDisabledServerSide,s=this._refreshConfig();if(!s.remoteRequestsDisabled&&!this._hasReceivedConfigResponse)return!1;const r=s.remoteRequestsDisabled&&!this._hasReceivedConfigResponse;if(Pt(n)&&!Lt(i)&&!r)return!1;const o=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!s.enabled&&!o}_captureEvent(e,t="$autocapture",i){if(!this.isEnabled)return void this._clearPointer();let n=i||yo(e);ho(n)&&(n=n.parentNode||null);const s=this._compileUrlPatterns();var r;"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&s.rageclick&&(null===(r=this.rageclicks)||void 0===r?void 0:r.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&$o(n,s.rageclick)&&this._captureEvent(e,"$rageclick",i);const o=t===rb,a=o?ct(ct({},s),{},{dom_event_allowlist:void 0}):s;if(n&&function(e,t,i,n,s,r){var o;const a=typeof window>"u"?void 0:window;if(!a||No(e))return!1;if((null==i?void 0:i.url_allowlist)&&!_o(i.url_allowlist,r))return!1;if((null==i?void 0:i.url_ignorelist)&&_o(i.url_ignorelist,r))return!1;if(null==i?void 0:i.dom_event_allowlist){const e=i.dom_event_allowlist;if(e&&!e.some(e=>t.type===e))return!1}const{parentIsUsefulElement:l,targetElementList:c}=Bo(e,n);if(!function(e,t){const i=null==t?void 0:t.element_allowlist;if(It(i))return!0;for(const t of e)if(i.some(e=>t.tagName.toLowerCase()===e))return!0;return!1}(c,i))return!1;if(!wo(c,null==i?void 0:i.css_selector_allowlist))return!1;if(wo(c,null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Co))return!1;try{const i=a.getComputedStyle(e);if(i&&"pointer"===i.getPropertyValue("cursor")&&"click"===t.type)return!0}catch(e){}const u=e.tagName.toLowerCase();switch(u){case"html":return!1;case"form":return(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return l?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(bo.indexOf(u)>-1||"true"===e.getAttribute("contenteditable"))}}(n,e,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:s.getCurrentUrl}})){var l;const{props:i,explicitNoCapture:r,target:o}=ub(n,{e:e,maskAllElementAttributes:s.maskAllElementAttributes,maskAllText:s.maskAllText,elementAttributeIgnoreList:s.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString,disableCaptureUrlHashes:s.disableCaptureUrlHashes});if(r)return!1;const a=this.getElementSelectors(n,o);if(a&&a.length>0&&(i.$element_selectors=a),t===rb){const t=e.type||"clipboard";if("paste"!==t){var c,u;const e=null===(c=nb())||void 0===c||null===(c=c.getSelection())||void 0===c?void 0:c.toString(),t=vo(e);if(!t)return!1;i.$selected_content=t,i.$clipboard_text_length=null!==(u=null==e?void 0:e.length)&&void 0!==u?u:0}i.$copy_type=t}if("$autocapture"===t&&"change"===e.type&&s.capture_value_css_selector_allowlist&&!s.maskAllText&&(uo(d=n,"input")?!ft(ob,d.type):uo(d,"textarea")||uo(d,"select")&&!d.multiple)&&function(e,t){var i;if(!qo(e))return!1;const n=null!==(i=t.css_selector_ignorelist)&&void 0!==i?i:Co,s=new Set;let r=e;for(uo(e,"select")&&(r=e.options[e.selectedIndex]||e);r;){const e=r,t=fo(e);if(s.size>=1e3||s.has(r)||ft(t,"ph-sensitive")||ft(t,"ph-no-capture")||n.some(t=>So(e,t)))return!1;s.add(r);const i=r.assignedSlot||r.parentNode;r=po(i)?i.host:i&&co(i)?i:null}return!0}(n,s)&&!n.querySelector(".ph-no-capture, .ph-sensitive")){const e=s.capture_value_css_selector_allowlist;let t=!1;try{t=Ct(e)?!!e(n):kt(e)&&e.some(e=>So(n,e))}catch(e){ab.error("capture_value_css_selector_allowlist threw",e)}t&&(i.$input_value=n.value)}return null===(l=this._client)||void 0===l||l.capture(t,i),!0}var d}isBrowserSupported(){var e;return Ct(null===(e=sb())||void 0===e?void 0:e.querySelectorAll)}};const pb="featureFlags",gb="logs",_b=!!o||!!r,fb=new WeakMap,vb="text/plain";let mb=0,yb=!1;const bb=(e,t)=>{const[i,n]=e.split("#"),[s,r]=i.split("?");if(!r)return e;const o=r.split("&").filter(e=>e.split("=")[0]!==t).join("&");return`${s}${o?`?${o}`:""}${n?`#${n}`:""}`},Sb=(e,t,i=!0)=>{var n;const[s,r]=e.split("?"),o=ct({},t),a=null!==(n=null==r?void 0:r.split("&").map(e=>{var t;const[n,s]=e.split("="),r=i&&null!==(t=o[n])&&void 0!==t?t:s;return delete o[n],`${n}=${r}`}))&&void 0!==n?n:[],l=io(o);return l&&a.push(l),a.length>0?`${s}?${a.join("&")}`:s},wb=e=>{if(e._encodedBody)return e._encodedBody;const{data:t,compression:i}=e;if(!t)return;if(i===Wy){const e=vl(ml(to(t)),{mtime:0});return{contentType:vb,body:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),estimatedSize:e.byteLength}}if(i===jy){const e=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):e}(to(t)),i=(e=>"data="+encodeURIComponent("string"==typeof e?e:to(e)))(e);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const n=to(t);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}},kb=e=>{const t=()=>"sendBeacon"===e.transport?{url:Sb(e.url,{compression:jy}),encodedBody:wb(ct(ct({},e),{},{compression:jy,_encodedBody:void 0}))}:{url:bb(e.url,"compression"),encodedBody:wb(ct(ct({},e),{},{compression:void 0,_encodedBody:void 0}))};let i;try{i=wb(e)}catch(i){if(hs(e.compression,no(e.url,"compression")))return $r.error("Failed to gzip request body, sending uncompressed payload",i),t();throw i}return i&&hs(e.compression,no(e.url,"compression"))&&!((n=i.body)instanceof ArrayBuffer?ds(new Uint8Array(n)):ArrayBuffer.isView(n)&&ds(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(yb=!0,t()):{url:e.url,encodedBody:i};var n},Cb=e=>{try{return kb(e)}catch(i){var t;return $r.error(i),void(null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0,error:i}))}},xb=function(){var e=rt(function*(e){const t=yield ms(to(e.data),Jl.DEBUG,{rethrow:!0});if(!t)return e;const i=yield t.arrayBuffer();return ct(ct({},e),{},{_encodedBody:{contentType:vb,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}}(),Eb=/Failed to fetch|NetworkError|Load failed/i,Ib=e=>"TypeError"===(null==e?void 0:e.name)&&Eb.test((null==e?void 0:e.message)||""),Tb=e=>{try{const t=function(e,t=Date.now(),i=3e5){if("string"!=typeof e||!e)return;const n=e.trim(),s=/^\d+\s*,/.test(n)?n.slice(0,n.indexOf(",")).trim():n;if(/^\d+$/.test(s)){const e=1e3*Math.min(Number(s),i/1e3);return e>0?e:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(s))return;const r=/^\w{3} \w{3} /.test(s)?s+" GMT":s,o=Date.parse(r)-t;return Number.isFinite(o)&&o>0?Math.min(o,i):void 0}(e());return It(t)?void 0:Math.min(t,3e4)}catch(e){return}},Mb=e=>{const t=Cb(e);if(!t)return;const i=new o;fb.set(i,!0);const{url:n,encodedBody:s}=t;i.open(e.method||"GET",n,!0);const{contentType:r,body:a}=null!=s?s:{};qr(e.headers,function(e,t){i.setRequestHeader(t,e)}),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t;const n={statusCode:i.status,text:i.responseText};if(200===i.status)try{n.json=JSON.parse(i.responseText)}catch(e){}null===(t=e.callback)||void 0===t||t.call(e,n,Tb(()=>i.getResponseHeader("Retry-After")))}},i.send(a)},Pb=e=>{const t=Cb(e);if(!t)return;const{url:i,encodedBody:n}=t,{contentType:s,body:o,estimatedSize:l}=null!=n?n:{},c=new Headers;qr(e.headers,function(e,t){c.append(t,e)}),s&&c.append("Content-Type",s);let u=null,d=!1;if(a){const t=new a;u={signal:t.signal,timeout:setTimeout(()=>{d=!0;try{t.abort(cn("AbortError","PostHog request timed out"+((i=e.timeout)?` after ${i}ms`:"")))}catch(e){p(e)}var i},e.timeout)}}let h=!1;const p=t=>{var i;h||(h=!0,d&&"AbortError"===(null==t?void 0:t.name)||Ib(t)?$r.warn(t):$r.error(t),null===(i=e.callback)||void 0===i||i.call(e,{statusCode:0,error:t}))};let g=0;const _=()=>{mb-=g,g=0,u&&clearTimeout(u.timeout)};try{const t=ct({method:(null==e?void 0:e.method)||"GET",headers:c,referrerPolicy:"strict-origin",body:o,signal:null==u?void 0:u.signal},e.fetchOptions),n=null!=l?l:It(o)?0:void 0;t.keepalive="POST"===t.method&&!e._keepaliveDisabled&&!1!==t.keepalive&&t.body===o&&!It(n)&&n>=0&&52428.8>mb+n,t.keepalive&&(g=n,mb+=g),r(i,t).then(t=>t.text().then(i=>{var n;if(h)return;const s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){$r.error(e)}h=!0,_(),null===(n=e.callback)||void 0===n||n.call(e,s,Tb(()=>t.headers.get("Retry-After")))})).catch(e=>{_(),p(e)}).finally(_)}catch(e){_(),p(e)}},Rb=e=>{try{var t;const{url:n,encodedBody:s}=kb(e),{contentType:o,body:a,estimatedSize:l}=null!=s?s:{};if(!a)return;const c=a instanceof Blob?a:new Blob([a],{type:o});if(i.sendBeacon(n,c))return;const u=kt(e.data)?e.data:null===(t=e.data)||void 0===t?void 0:t.batch;if(kt(u)&&u.length>1&&(null!=l?l:0)>16384){const t=Math.ceil(u.length/2),i=t=>kt(e.data)?t:ct(ct({},e.data),{},{batch:t});return Rb(ct(ct({},e),{},{data:i(u.slice(0,t))})),void Rb(ct(ct({},e),{},{data:i(u.slice(t))}))}$r.warn(`Beacon of ~${null!=l?l:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?Pb(ct(ct({},e),{},{_keepaliveDisabled:!0})):Mb(e)}catch(e){$r.warn("Beacon send failed",e)}},Fb=(e,t,i,n)=>{const s="query"===n?"POST"===t?"sent_at":"_":void 0;return Sb(i===Wy?bb(e,"compression"):e,ct(ct({},s?{[s]:Date.now().toString()}:{}),i===Wy?{}:{compression:i}))},Ab=(()=>{const e=[];return r&&e.push({transport:"fetch",method:Pb}),o&&e.push({transport:"XHR",method:Mb}),(null==i?void 0:i.sendBeacon)&&e.push({transport:"sendBeacon",method:Rb}),e})();var Lb=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);const i={};for(const n of e){const e=null==t?void 0:t.get_property(n);It(e)||(i[n]=e)}return i}set(e,t){var i;null===(i=this._instance.persistence)||void 0===i||i.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null===(t=this._instance.persistence)||void 0===t||t.unregister(e)}},Ob=class{constructor(e){this.instance=e,this._logger=$r,this.kv=new Lb(e),this.onSession=e=>Vy(this.instance.onSessionId(t=>{try{e(t)}catch(e){this._logger.error("Browser extension session listener failed",e)}})),this.onEvent=e=>Vy(this.instance._addCaptureHook((t,i)=>{if(i)try{e({event:t,properties:i.properties})}catch(e){this._logger.error("Browser extension event listener failed",e)}})),this.onRemoteConfig=e=>{const t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},i=this.instance._internalEventEmitter.on("extensionsRemoteConfig",t);return this.instance._lastRemoteConfig&&t(this.instance._lastRemoteConfig),Vy(i)}}get logger(){return this._logger}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property("$device_id"))&&void 0!==e?e:this.distinctId}get deviceId(){const e=this.instance.get_property(N);return"string"==typeof e?e:void 0}get library(){return{name:Jl.LIB_NAME,version:Jl.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!==(e=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,n,s;const r=null===(e=this.instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==r?void 0:r.sessionId)&&void 0!==t?t:"",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(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return Ct(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get projectToken(){return this.instance.config.token}getExtension(e){let t;switch(e){case pb:case tf:t=this.instance.featureFlags;break;case gb:t=this.instance.logs;break;case"surveys":t=this.instance.surveys;break;case db:t=this.instance.autocapture}return t}capture(e,t,i){if(!i)return void this.instance.capture(e,t);const n=ct({timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce},"unload"===i.delivery?{transport:"sendBeacon",send_instantly:!0}:{});this.instance.capture(e,t,n)}registerDynamicEventProperties(e){return Vy(this.instance._registerExtensionEventProperties(e))}sendRequest(e){var t=this;return rt(function*(e,i={}){var n;const s=null!==(n=i.target)&&void 0!==n?n:"api",r=i.query?Sb(e,i.query):e,o=t.instance.requestRouter.endpointFor(s,r),a={method:i.method,url:o,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?dt.Base64:void 0,timestampMode:i.sentAt};return"api"===s&&"/i/v1/logs"===e&&(a.batchKey="logs"),"sendBeacon"===i.transport?(t.instance._send_request(a),{statusCode:202}):new Promise(e=>{a.callback=e,t.instance._send_request(a)})}).apply(this,arguments)}},Db=class{constructor(e){this._instance=e}get(){var e,t,i,n;const s=null===(e=this._instance)||void 0===e?void 0:e.config;return{disableSurveys:!!(null==s?void 0:s.disable_surveys),cookielessMode:!!(null==s?void 0:s.cookieless_mode),advancedEnableSurveys:!!(null==s?void 0:s.advanced_enable_surveys),requestTimeoutMs:null!==(t=null==s?void 0:s.surveys_request_timeout_ms)&&void 0!==t?t:1e4,prefillFromUrl:!!(null==s||null===(i=s.surveys)||void 0===i?void 0:i.prefillFromUrl),automaticDisplay:!(null==s?void 0:s.disable_surveys_automatic_display),featureFlagEvaluation:!(null==s?void 0:s.advanced_disable_feature_flags),overrideLanguage:null==s?void 0:s.override_display_language,prepareStylesheet:null==s?void 0:s.prepare_external_dependency_stylesheet,get_current_url:null==s?void 0:s.get_current_url,uiHost:null===(n=this._instance)||void 0===n||null===(n=n.requestRouter)||void 0===n?void 0:n.endpointFor("ui","")}}getExtensions(){const e=null==d?void 0:d.__PosthogExtensions__;if(!e||!this._instance)return;const t=this._instance,{generateSurveys:i,loadExternalDependency:n}=e;return{generateSurveys:i?e=>i(t,e):void 0,loadExternalDependency:n?e=>n(t,"surveys",e):void 0}}onMatchingConditionsChanged(t){var i,n;const s=null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook(e=>{"$pageview"!==e&&e!==Vf&&e!==Gf&&e!==Qf||t()}),r=()=>t();Qr(e,"PHSurveyShown",r);let o=!1;const a=null===(n=this._instance)||void 0===n?void 0:n.onFeatureFlags(()=>{o&&t()});return o=!0,()=>{o=!1,null==s||s(),null==a||a(),null==e||e.removeEventListener("PHSurveyShown",r)}}};const $b=new WeakMap,Nb=(e,t)=>{const i=function(e){var t;const i=new Db(e);if(!e)return{get config(){return i.get()}};if(null===(t=e.surveys)||void 0===t?void 0:t.getRenderContext)return e.surveys.getRenderContext();let n=$b.get(e);return n||(n={client:new Ob(e),get config(){return i.get()},surveys:e.surveys},$b.set(e,n)),n}(e);return i?function(e,t){if(typeof document>"u"||typeof window>"u")return;const i=new Dy(e);return!1===e.config.automaticDisplay?(iv.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i):!1===t?(iv.info("There are no surveys to load or Surveys is disabled in the project settings."),i):(i.startAutomaticDisplay(),i)}(i,t):void 0};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.generateSurveys=Nb,d.extendPostHogWithSurveys=Nb;const Bb=e=>{for(;null==e?void 0:e.__rrweb_original__;)e=e.__rrweb_original__;return e},qb=1e4,Hb=(e,t,i)=>i.remaining>0?t.length>i.remaining?(e.push(t.slice(0,i.remaining)),i.remaining=0,i.truncated=!0,!1):(e.push(t),i.remaining-=t.length,!0):(i.truncated=!0,!1),zb=(e,t,i)=>{const n=JSON.stringify(e);if(i.remaining>=n.length)return Hb(t,n,i);if(i.truncated=!0,2>i.remaining)return!1;let s=0,r=Math.min(e.length,i.remaining-2);for(;r>s;){const t=Math.ceil((s+r)/2);JSON.stringify(e.slice(0,t)).length>i.remaining?r=t-1:s=t}return Hb(t,JSON.stringify(e.slice(0,s)),i)},Ub=e=>void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e,Wb=(e,t,i)=>{if(!i.truncated){if(i.keysRemaining-=1,i.sizeRemaining-=String(t).length+e.length,0>=i.keysRemaining||0>=i.sizeRemaining)return i.truncated=!0,void(i.result.attributes_truncated=!0);i.result[e]=t}},jb=(e,t,i)=>{if(!i.truncated)if(xt(e)){if(i.seen.has(e))return void Wb(t||"circular","[Circular]",i);i.seen.add(e);try{for(const n in e)try{if(!{}.hasOwnProperty.call(e,n))continue;if(jb(e[n],t?`${t}.${n}`:n,i),i.truncated)break}catch(e){continue}}catch(e){}}else Wb(t,e,i)},Vb=(e,t,i,n,s=!1,r)=>{if(!Ub(e))return!s||Hb(t,"null",i);if(Pt(e)||(e=>{try{return Ft(e)||Lt(e)}catch(e){return!1}})(e))return Hb(t,JSON.stringify(e),i);if("string"==typeof e)return zb(e,t,i);if(!xt(e)&&!kt(e))return Hb(t,JSON.stringify(e),i);if(n.has(e))return zb("[Circular]",t,i);n.add(e);try{const r=e.toJSON;if(Ct(r))return Vb(r.call(e),t,i,n,s)}catch(e){}try{const n={}.toString.call(e);if("[object String]"===n)return zb(String(e.valueOf()),t,i);if("[object Number]"===n||"[object Boolean]"===n)return Hb(t,JSON.stringify(e.valueOf()),i)}catch(e){}if(e instanceof Error){const o={};try{for(const t in e)({}).hasOwnProperty.call(e,t)&&(o[t]=e[t])}catch(e){}try{o.name=e.name}catch(e){}try{o.message=e.message}catch(e){}try{o.stack=e.stack}catch(e){}return Vb(o,t,i,n,s,r)}if(kt(e)){if(!Hb(t,"[",i))return!1;for(let s=0;e.length>s;s++){if(s>0&&!Hb(t,",",i))return!1;let r;try{r=e[s]}catch(e){r=void 0}if(!Vb(r,t,i,n,!0))return!1}return Hb(t,"]",i)}if(!Hb(t,"{",i))return!1;let o=!0;try{for(const s in e){if(!{}.hasOwnProperty.call(e,s))continue;if(0>=i.remaining)return i.truncated=!0,!1;let a;try{a=e[s]}catch(e){continue}if(r)try{jb(a,s,r)}catch(e){}if(!Ub(a))continue;const l=`${o?"":","}${JSON.stringify(s)}:`;if(l.length>=i.remaining)return i.truncated=!0,!1;const c=t.length,u=i.remaining,d=i.truncated;if(!Hb(t,l,i))return!1;const h=t.length,p=Vb(a,t,i,n,!1),g=i.truncated;if(t.length!==h){if(o=!1,!p)return!1}else if(t.length=c,i.remaining=u,i.truncated=p?d:g,!p)return!1}}catch(e){}return Hb(t,"}",i)},Gb=(e,t)=>{const i=[],n={remaining:t,truncated:!1},s=xt(e[0])?{result:{},keysRemaining:50,sizeRemaining:qb,truncated:!1,seen:new WeakSet([e[0]])}:void 0;for(let t=0;e.length>t&&(0>=t||Hb(i," ",n))&&Vb(e[t],i,n,new WeakSet,!1,0===t?s:void 0);t++);return{body:i.join("")+(n.truncated?"...":""),truncated:n.truncated,attributes:(null==s?void 0:s.result)||{}}},Qb={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},Kb=e=>"canCapture"in e,Jb=e=>({console:d.console,hostname:d.location.host,getCapturingLogs(){let t;return t=Kb(e)?e.canCapture?e.getExtension(gb):void 0:(Ct(e.is_capturing)?e.is_capturing():!e.has_opted_out_capturing())?e.logs:void 0,t?{captureConsoleLog:i=>((e,t,i)=>{if(Kb(e))return void t.captureConsoleLog(i);const n=(e=>{const t=/^1\.(\d+)\.(\d+)$/.exec(e);if(!t)return;const i=Number(t[1]),n=Number(t[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"})(e.version),s=n?t[n]:void 0;n?Ct(s)&&s.call(t,i):Ct(t.captureConsoleLog)&&t.captureConsoleLog(i)})(e,t,i),captureBufferedConsoleLog(e,i,n){var s;return null===(s=t.captureBufferedConsoleLog)||void 0===s?void 0:s.call(t,e,i,n)}}:void 0}});d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.logs={initializeLogs:e=>(e=>{const t=e.console;let i=e;const n=[],s={host:e.hostname};let r=!1;const o=()=>{i=void 0;for(const e of n)try{e()}catch(e){}};try{for(const e of Object.keys(Qb)){const o=n=>(...o)=>{let a=!1;try{if(o.length>0&&!r&&i){const t=i.getCapturingLogs();if(t){r=!0,a=!0;const{body:i,truncated:n,attributes:l}=Gb(o,qb),c=ct(ct({},s),n?{body_truncated:"true"}:{}),u={level:Qb[e],body:i,attributes:ct(ct({"log.source":`console.${e}`},c),l)};t.captureConsoleLog(u)}}}catch(e){}finally{a&&(r=!1),n.apply(t,o)}},a=t[e];n.push(Fg(t,e,e=>{const t=o(e);return t.__rrweb_original__=Bb(a),t}))}}catch(e){throw o(),e}return o})(Jb(e)),replayConsoleBuffer:(e,t)=>((e,t)=>{const i=e.getCapturingLogs();if(i)for(const s of t)try{var n;const{body:t,truncated:r,attributes:o}=Gb(s.args,qb);null===(n=i.captureBufferedConsoleLog)||void 0===n||n.call(i,{level:Qb[s.level],body:t,attributes:ct(ct({"log.source":`console.${s.level}`,host:e.hostname},r?{body_truncated:"true"}:{}),o)},s.context,s.occurredAtMs)}catch(e){}})(Jb(e),t)};const Zb=e=>qt(e)&&("RangeError"===e.name&&0===e.message.indexOf("Maximum call stack size exceeded")||"InternalError"===e.name&&"too much recursion"===e.message),Yb=Nr("[Error tracking]"),Xb="webkit-masked-url:",eS=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],tS=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Xb],iS=["__firefox__","__gCrWeb"];function nS(){return new Sn([new zn,new Yn,new Wn,new Un,new Jn,new Kn,new Vn,new Zn],function(e,...t){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=Ln.test(n)?n.replace(Ln,"$1"):n;if(!o.match(/\S*Error: /)){for(const i of t){const t=i(o,e);if(t){s.push(t);const e=Dn(s);if(e){for(let t=a.length-1;t>=0;t--){const i=a[t];if(e.start>=i.start+i.length)break;a.pop()}a.push(e)}break}}if(qn(s,a)>=50)break}}const l=[...a].sort((e,t)=>t.start-e.start),c=l[l.length-1];if(c){const e=Nn(s,c);s.splice(c.start-e,e);for(const t of l)t.start-=e}for(const e of l)$n(s,e);return a.some(e=>0===e.start&&s.length===e.length)&&function(e){const t=e.map(e=>`${e.function}|${e.filename}|${e.lineno}|${e.colno}|${e.module}`);let i=0;for(let e=1;t.length>e;e++)Hn(t,e,i)&&(i=e);e.push(...e.splice(0,i))}(s),function(e){if(!e.length)return[];const t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return ct(ct({},e),{},{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||"?"});var i})}(s)}}("web:javascript",Pn,An))}const sS=Nr("[ExceptionAutocapture]"),rS=nS(),oS=(e,t)=>{try{return e()}catch(e){return t}},aS=(e,t)=>oS(()=>e(t()),void 0),lS=e=>oS(()=>Ct(e)&&Ct(e.call),!1),cS=(e,t)=>oS(()=>{e[t].__POSTHOG_INSTRUMENTED__=!0},void 0),uS=(e,t,i)=>{oS(()=>{var i;null===(i=e[t])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),oS(()=>{e[t]=i},void 0)},dS=t=>{const i=e;i||sS.info("window not available, cannot wrap onerror");const n=oS(()=>i.onerror,void 0);return i.onerror=function(...e){var i;return aS(t,()=>rS.buildFromUnknown((([e,t,i,n,s])=>{if(null!=s)return s;if(Tt(e)&&Tt(t)&&t.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:e,filename:t,lineno:i,colno:n})}catch(t){return e}return e})(e),{mechanism:{handled:!1}})),!!lS(n)&&null!==(i=n(...e))&&void 0!==i&&i},cS(i,"onerror"),()=>uS(i,"onerror",n)},hS=(t,i=!1)=>{const n=e;n||sS.info("window not available, cannot wrap onUnhandledRejection");const s=oS(()=>n.onunhandledrejection,void 0);return n.onunhandledrejection=function(e){var n;return aS(t,()=>rS.buildFromUnknown(e,{mechanism:{handled:!1}})),lS(s)?null!==(n=s(e))&&void 0!==n&&n:i},cS(n,"onunhandledrejection"),()=>uS(n,"onunhandledrejection",s)},pS={wrapOnError:dS,wrapUnhandledRejection:hS,wrapConsoleError(e){const t=console;t||sS.info("console not available, cannot wrap console.error");const i=oS(()=>t.error,void 0);return t.error=function(...t){oS(()=>t.length>1&&Tt(t[0])&&(/^\[PostHog\.js\](?: |$)/.test(t[0])||"rrweb logger error:"===t[0]),!1)||aS(e,()=>{let e;e=1==t.length?t[0]:t.join(" ");const i=t.find(e=>e instanceof Error);return rS.buildFromUnknown(i||e,{mechanism:{handled:!0,type:"onconsole"},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),lS(i)&&i(...t)},cS(t,"error"),()=>uS(t,"error",i)}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.errorWrappingFunctions=pS,d.posthogErrorWrappingFunctions=pS;const gS=(e,t)=>{if(!Ct(null==e?void 0:e.capture))return;const i=null==t?void 0:t.autocaptureExceptions,n=!Pt(i)&&"object"==typeof i&&kt(i.errors_to_ignore)?i.errors_to_ignore.reduce((e,t)=>{try{e.push(new RegExp(t))}catch(e){sS.error("Ignoring invalid legacy exception exclusion rule",t,e)}return e},[]):[],s=t=>{try{var i;null===(i=e.capture)||void 0===i||i.call(e,"$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(e){sS.error("Failed to capture exception for a legacy client",e)}};dS(e=>{n.some(t=>e.$exception_list.some(e=>t.test(e.value||"")))||s(e)}),hS(s,!0)};d.extendPostHogWithExceptionAutoCapture=gS,d.extendPostHogWithExceptionAutocapture=gS;const _S="X-POSTHOG-SESSION-ID",fS="X-POSTHOG-WINDOW-ID",vS="X-POSTHOG-DISTINCT-ID",mS=[_S,fS,vS],yS=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],bS=(e,t)=>({}.hasOwnProperty.call(e,t)),SS=e=>"object"==typeof e&&!Pt(e)||Ct(e),wS=e=>"undefined"!=typeof Request&&(e instanceof Request||"[object Request]"==={}.toString.call(e)),kS=t=>{try{var i;return wS(t)?t.url:new URL(t instanceof URL?t.toString():String(t),null==e||null===(i=e.location)||void 0===i?void 0:i.href).toString()}catch(e){return}},CS=(e,t,i,n,s)=>{let r;try{r=new URL(n).hostname}catch(e){return!1}if(!e)return!1;if(kt(e)&&!e.includes(r))return!1;let o=!1;if(i){const{sessionId:e,windowId:t}=i.checkAndGetSessionAndWindowId(!0);s.set(_S,e),s.set(fS,t),o=!0}const a=(e=>Ct(e)?e():e)(t);return a&&"$posthog_cookieless"!==a&&(s.set(vS,a),o=!0),o};d.__PosthogExtensions__=d.__PosthogExtensions__||{};const xS={_patchFetch:(t,i,n)=>Fg(e,"fetch",e=>function(s,r){const o=arguments.length>1?[s,r]:[s];let a=o;try{const e=kS(s);if(e)if(wS(s)){const e=new Request(s,r);CS(t,i,n,e.url,e.headers),a=[e]}else{const o=new Headers(SS(r)?r.headers:void 0);if(CS(t,i,n,e,o)){const e=((e,t)=>{if(It(e)||Pt(e))return{headers:t};if(!SS(e))return;const i=e;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){const e=Object.create(i);return Object.defineProperty(e,"headers",{configurable:!0,enumerable:!0,value:t,writable:!0}),e}return new Proxy({headers:t},{get:(e,t)=>bS(e,t)?Reflect.get(e,t):Reflect.get(i,t,i),has:(e,t)=>bS(e,t)||t in i,ownKeys(e){const t=new Set(Reflect.ownKeys(e));return Reflect.ownKeys(i).forEach(e=>t.add(e)),yS.forEach(e=>{e in i&&t.add(e)}),Array.from(t)},getOwnPropertyDescriptor(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);if(n)return n;if("string"==typeof t&&yS.includes(t)&&t in i)return{configurable:!0,enumerable:!0,get(){return Reflect.get(i,t,i)}};const s=Reflect.getOwnPropertyDescriptor(i,t);return s?ct(ct({},s),{},{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(i)})})(r,o);e&&(a=[s,e])}}}catch(e){a=o}return e.apply(this,a)}),_patchXHR:(t,i,n)=>Fg(e.XMLHttpRequest.prototype,"open",e=>function(s,r,o=!0,a,l){const c=this,u=new Headers,d=kS(r);d&&CS(t,i,n,d,u);const h=e.call(c,s,r,o,a,l);return mS.forEach(e=>{const t=u.get(e);if(t)try{c.setRequestHeader(e,t)}catch(e){}}),h})};d.__PosthogExtensions__.tracingHeadersPatchFns=xS,d.postHogTracingHeadersPatchFns=xS,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(e){const t=this.length;let i=Math.trunc(e)||0;return 0>i&&(i+=t),0>i||i>=t?void 0:this[i]},writable:!0,enumerable:!1,configurable:!0}),"function"!=typeof[].findLast&&Object.defineProperty(Array.prototype,"findLast",{value(e,t){for(let i=this.length-1;i>=0;i--){const n=this[i];if(e.call(t,n,i,this))return n}},writable:!0,enumerable:!1,configurable:!0});var ES=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(e){var t;if(e.hadRecentInput)return;const i=this.i[0],n=this.i.at(-1);this.o&&i&&n&&1e3>e.startTime-n.startTime&&5e3>e.startTime-i.startTime?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),null===(t=this.t)||void 0===t||t.call(this,e)}};const IS=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},TS=e=>{if("loading"===document.readyState)return"loading";const t=IS();if(t){if(t.domInteractive>e)return"loading";if(0===t.domContentLoadedEventStart||t.domContentLoadedEventStart>e)return"dom-interactive";if(0===t.domComplete||t.domComplete>e)return"dom-content-loaded"}return"complete"},MS=e=>{const t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},PS=e=>{let t="";try{for(;9!==(null==e?void 0:e.nodeType);){var i;const n=e,s=n.id?"#"+n.id:[MS(n),...Array.from(null!==(i=n.classList)&&void 0!==i?i:[]).sort()].join(".");if(t.length+s.length>99)return t||s;if(t=t?s+">"+t:s,n.id)break;e=n.parentNode}}catch(e){}return t},RS=new WeakMap;function FS(e,t){let i=RS.get(t);return i||(i=new WeakMap,RS.set(t,i)),i.get(e)||i.set(e,new t),i.get(e)}let AS=-1;const LS=()=>AS,OS=e=>{addEventListener("pageshow",t=>{t.persisted&&(AS=t.timeStamp,e(t))},!0)},DS=(e,t,i,n)=>{let s,r;return o=>{var a;t.value>=0&&(o||n)&&(r=t.value-(null!==(a=s)&&void 0!==a?a:0),(r||void 0===s)&&(s=t.value,t.delta=r,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,i),e(t)))}},$S=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},NS=()=>{var e,t;return null!==(e=null===(t=IS())||void 0===t?void 0:t.activationStart)&&void 0!==e?e:0};let BS=-1;const qS=new Set,HS=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,zS=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of qS)e();isFinite(BS)||(BS="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",zS,!0))}},US=(e=!1)=>{if(e&&(BS=1/0),0>BS){var t;const e=NS(),i=document.prerendering||null===(t=globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e))||void 0===t?void 0:t.startTime;BS=null!=i?i:HS(),addEventListener("visibilitychange",zS,!0),addEventListener("prerenderingchange",zS,!0),OS(()=>{setTimeout(()=>{BS=HS()})})}return{get firstHiddenTime(){return BS},onHidden(e){qS.add(e)}}},WS=(e,t=-1,i,n=0,s,r,o)=>{const a=IS(),l=(null==a?void 0:a.navigationId)||0;let c="navigate";return i?c=i:0>LS()?a&&(document.prerendering||NS()>0?c="prerender":document.wasDiscarded?c="restore":a.type&&(c=a.type.replace(/_/g,"-"))):c="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:n||l,navigationInteractionId:s,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},jS=(e,t,i={})=>{try{const n=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(n.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const i=e.getEntries();n.length>1&&i.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(i)})});for(const t of n)e.observe(ct({type:t,buffered:!0},i));return e}}catch(e){}},VS=e=>{var t,i;return(null===(t=globalThis.PerformanceObserver)||void 0===t||null===(t=t.supportedEntryTypes)||void 0===t?void 0:t.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},GS=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},QS=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var KS=class{constructor(){this.u=void 0}};const JS=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},ZS=[1800,3e3],YS=(e,t={})=>{const i=VS(t);JS(()=>{const n=FS(t,KS),s=US();let r,o=WS("FCP");const a=jS(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(a.disconnect(),s.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-NS(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,r(!0)))});a&&(r=DS(e,o,ZS,t.reportAllChanges),OS(i=>{o=WS("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,LS()),r=DS(e,o,ZS,t.reportAllChanges),$S(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&jS(["soft-navigation"],i=>{i.forEach(i=>{n.u&&i.navigationId&&GS(n.u,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=WS("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=DS(e,o,ZS,t.reportAllChanges),r(!0)})},t)})},XS=[.1,.25],ew=e=>e.find(e=>{var t;return 1===(null===(t=e.node)||void 0===t?void 0:t.nodeType)})||e[0],tw=(e,t={})=>{const i=FS(t=Object.assign({},t),ES),n=new WeakMap;i.t=e=>{var i;if(null==e||null===(i=e.sources)||void 0===i?void 0:i.length){const i=ew(e.sources),o=null==i?void 0:i.node;if(o){var s,r;const e=null!==(s=null===(r=t.generateTarget)||void 0===r?void 0:r.call(t,o))&&void 0!==s?s:PS(o);n.set(i,e)}}},((e,t={})=>{const i=US();YS(QS(()=>{let n,s=WS("CLS",0);const r=FS(t,ES),o=(i,o,a,l,c)=>{s=WS("CLS",0,i,o,a,l,c),r.o=0,n=DS(e,s,XS,t.reportAllChanges)},a=(e=!1)=>{r.o>s.value&&(s.value=r.o,s.entries=r.i),n(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=e=>{for(const t of e)"soft-navigation"!==t.entryType?r.l(t):l(t);a()},u=["layout-shift"];VS(t)&&u.push("soft-navigation");const d=jS(u,c);d&&(n=DS(e,s,XS,t.reportAllChanges),i.onHidden(()=>{c(d.takeRecords()),n(!0)}),OS(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,LS()),$S(n)}),setTimeout(n))}))})(t=>{e((e=>{let t={};if(e.entries.length){var i;const s=e.entries.reduce((e,t)=>e.value>t.value?e:t);if(null==s||null===(i=s.sources)||void 0===i?void 0:i.length){const e=ew(s.sources);e&&(t={largestShiftTarget:n.get(e),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:e,largestShiftEntry:s,loadState:TS(s.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},iw=(e,t={})=>{const i=FS(t=Object.assign({},t),KS);VS(t)&&(i.u=new Map),YS(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:TS(LS())};if("soft-navigation"!==e.navigationType){if(e.entries.length){const i=IS(),n=e.entries.at(-1);if(i){const s=Math.max(0,i.responseStart-(i.activationStart||0));t={timeToFirstByte:s,firstByteToFCP:e.value-s,loadState:TS(e.entries[0].startTime),navigationEntry:i,fcpEntry:n}}}}else{var n;const s=null===(n=i.u)||void 0===n?void 0:n.get(e.navigationId);s&&(t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:"complete",navigationEntry:s})}return Object.assign(e,{attribution:t})})(t))},t)};let nw=0,sw=1/0,rw=0;const ow=e=>{for(const t of e)t.interactionId&&(sw=Math.min(sw,t.interactionId),rw=Math.max(rw,t.interactionId),nw=rw?(rw-sw)/7+1:0)};let aw;const lw=()=>{var e;return aw?nw:null!==(e=performance.interactionCount)&&void 0!==e?e:0};var cw=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return lw()-this.h}D(){this.h=lw(),this.v.length=0,this.p.clear()}S(e){const t=this.T(),i=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==i||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[i]:{k:8,id:-1,entries:[]}}l(e){var t;if(null===(t=this.m)||void 0===t||t.call(this,e),!e.interactionId)return;const i=this.v.at(-1);let n=this.p.get(e.interactionId);if(n||10>this.v.length||e.duration>i.k){var s;if(n?e.duration>n.k?(n.entries=[e],n.k=e.duration):e.duration===n.k&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],k:e.duration},this.p.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.k-e.k),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.p.delete(t.id)}null===(s=this.M)||void 0===s||s.call(this,n)}}};const uw=e=>{const t="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const s=QS(e);let r=-1;const o=()=>{n(r),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:t})}},dw=[200,500],hw=(e,t={})=>{const i=FS(t=Object.assign({},t),cw);let n=[],s=[],r=0;const o=new WeakMap,a=new WeakMap;let l=!1;const c=()=>{l||(uw(u),l=!0)},u=()=>{const e=new Set(i.v.map(e=>o.get(e.entries[0]))),t=s.length-10;s=s.filter((i,n)=>n>=t||e.has(i));const a=new Set;for(const e of s){const t=d(e.startTime,e.processingEnd);for(const e of t)a.add(e)}n=n.filter(e=>e.startTime>r||a.has(e)),l=!1};i.m=e=>{const i=e.startTime+e.duration;let n;r=Math.max(r,e.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(e.startTime,n.startTime),n.processingStart=Math.min(e.processingStart,n.processingStart),n.processingEnd=Math.max(e.processingEnd,n.processingEnd),t.includeProcessedEventEntries&&n.entries.push(e);break}}n||(n={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:i,entries:t.includeProcessedEventEntries?[e]:[]},s.push(n)),e.interactionId&&o.set(e,n),c()},i.M=e=>{if(!a.get(e)){var i;const o=null===(i=e.entries.find(e=>e.target))||void 0===i?void 0:i.target;if(o){var n,s;const i=null!==(n=null===(s=t.generateTarget)||void 0===s?void 0:s.call(t,o))&&void 0!==n?n:PS(o);a.set(e,i)}else{var r;const t=null===(r=e.entries.find(e=>e.targetSelector))||void 0===r?void 0:r.targetSelector;t&&a.set(e,t)}}};const d=(e,t)=>{const i=[];for(const s of n)if(s.startTime+s.duration>=e){if(s.startTime>t)break;i.push(s)}return i};jS(["long-animation-frame"],e=>{n=n.concat(e),c()},t),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=US();JS(()=>{var n;"interactionCount"in performance||aw||(aw=jS(["event"],ow,{durationThreshold:0}));let s,r=WS("INP");const o=FS(t,cw),a=(i,n,a,l,c)=>{o.D(),r=WS("INP",-1,i,n,a,l,c),s=DS(e,r,dw,t.reportAllChanges)},l=()=>{const e=o.S(r.navigationType);e&&e.k!==r.value&&(r.value=e.k,r.entries=e.entries,s())},c=e=>{l(),s(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{uw(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.l(t):c(t);l(),t&&s(!0)})},d=["event","first-input"];VS(t)&&d.push("soft-navigation");const h=jS(d,u,ct(ct({},t),{},{durationThreshold:null!==(n=t.durationThreshold)&&void 0!==n?n:40}));s=DS(e,r,dw,t.reportAllChanges),h&&(i.onHidden(()=>{u(h.takeRecords(),!0)}),OS(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,LS())}))})})(t=>{e((e=>{if(0===e.entries.length){const t={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:e.value,loadState:TS(e.navigationStartTime||0)};return Object.assign(e,{attribution:t})}const t=e.entries[0],n=o.get(t),s=Math.max(n.processingStart,t.startTime),r=Math.max(t.startTime+t.duration,s),l=Math.min(n.processingEnd,r),c=n.entries.sort((e,t)=>e.processingStart-t.processingStart),u=d(t.startTime,l),h=i.p.get(t.interactionId),p={interactionTarget:a.get(h),interactionType:t.name.startsWith("key")?"keyboard":"pointer",interactionTime:t.startTime,nextPaintTime:r,processedEventEntries:c,longAnimationFrameEntries:u,inputDelay:s-t.startTime,processingDuration:l-s,presentationDelay:r-l,loadState:TS(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(e=>{var t;const i=e.interactionTime,n=e.nextPaintTime;if(!(null===(t=e.longAnimationFrameEntries)||void 0===t?void 0:t.length)||!i||!n)return;const s=e.inputDelay,r=e.processingDuration;let o,a,l=0,c=0,u=0,d=0;for(const t of e.longAnimationFrameEntries){c=c+t.startTime+t.duration-t.styleAndLayoutStart;for(const e of t.scripts){const t=e.startTime+e.duration;if(i>t)continue;const n=t-Math.max(i,e.startTime),u=e.duration?n/e.duration*e.forcedStyleAndLayoutDuration:0;l+=n-u,c+=u,n>d&&(a=i+s>e.startTime?"input-delay":i+s+r>e.startTime?"processing-duration":"presentation-delay",o=e,d=n)}}const h=e.longAnimationFrameEntries.at(-1),p=h?h.startTime+h.duration:0;p>=i+s+r&&(u=n-p),o&&a&&(e.longestScript={entry:o,subpart:a,intersectingDuration:d}),e.totalScriptDuration=l,e.totalStyleAndLayoutDuration=c,e.totalPaintDuration=u,e.totalUnattributedDuration=n-i-l-c-u})(p),Object.assign(e,{attribution:p})})(t))},t)};var pw=class{constructor(){this.m=void 0,this.u=void 0}l(e){var t;null===(t=this.m)||void 0===t||t.call(this,e)}};const $=[2500,4e3];let gw=50;const _w=[];jS(["resource"],e=>{for(const t of e)_w.push(t),_w.length>gw&&_w.shift()});const fw=(e,t={})=>{null!=(t=Object.assign({},t)).resourceBufferSize&&(gw=t.resourceBufferSize);const i=FS(t,pw),n=new WeakMap;VS(t)&&(i.u=new Map),i.m=e=>{const i=e.element;if(i){var s,r;const o=null!==(s=null===(r=t.generateTarget)||void 0===r?void 0:r.call(t,i))&&void 0!==s?s:PS(i);n.set(e,o)}else e.id&&n.set(e,`#${e.id}`)},((e,t={})=>{let i=!1;const n=VS(t);JS(()=>{let s,r=US(),o=WS("LCP");const a=FS(t,pw),l=(n,a,l,c,u)=>{o=WS("LCP",-1,n,a,l,c,u),s=DS(e,o,$,t.reportAllChanges),i=!1,"soft-navigation"===n&&(r=US(!0))},c=e=>{var t;a.u&&e.navigationId&&GS(a.u,e),i||s(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const n=null===(t=e.getLargestInteractionContentfulPaint)||void 0===t?void 0:t.call(e);n&&u([n])},u=e=>{t.reportAllChanges||n||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){c(t);continue}let e=0,n=[],l=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-NS(),0),a.l(t),n=[t];else if("interaction-contentful-paint"===t.entryType){var i;const s=t;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,e=Math.max(l-t.startTime,0),s.largestContentfulPaint&&(a.l(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=e,o.entries=n,s())}},d=["largest-contentful-paint"];n&&d.push("interaction-contentful-paint","soft-navigation");const h=jS(d,u);if(h){s=DS(e,o,$,t.reportAllChanges);const r=["keydown","click","visibilitychange"],a=e=>{if(e.isTrusted&&!i){const e=o.id;uw(()=>{if(!i){if(!n){h.disconnect();for(const e of r)removeEventListener(e,a,{capture:!0})}e===o.id&&(i=!0,s(!0))}})}};for(const e of r)addEventListener(e,a,{capture:!0});OS(n=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,LS()),s=DS(e,o,$,t.reportAllChanges),$S(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})})(t=>{e((e=>{let t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var s,r,o;const a=e.entries.at(-1),l=a.url&&(_w.findLast(e=>e.name===a.url)||performance.getEntriesByType("resource").findLast(e=>e.name===a.url));let c;t.target=n.get(a),t.lcpEntry=a,a.url&&(t.url=a.url),l&&(t.lcpResourceEntry=l);let u=0,d=0;if("soft-navigation"!==e.navigationType?(c=IS(),u=null!==(s=null==c?void 0:c.activationStart)&&void 0!==s?s:0,d=null!==(r=null==c?void 0:c.responseStart)&&void 0!==r?r:0):(u=e.navigationStartTime||0,c=null===(o=i.u)||void 0===o?void 0:o.get(e.navigationId)),c){const i=Math.max(0,d-u),n=Math.max(i,l?(l.requestStart||l.startTime)-u:0),s=Math.min(e.value,Math.max(n,l?l.responseEnd-u:0));t=ct(ct({},t),{},{timeToFirstByte:i,resourceLoadDelay:n-i,resourceLoadDuration:s-n,elementRenderDelay:e.value-s,navigationEntry:c})}}return Object.assign(e,{attribution:t})})(t))},t)};let vw=-1;const mw=()=>vw,yw=e=>{addEventListener("pageshow",t=>{t.persisted&&(vw=t.timeStamp,e(t))},!0)},bw=(e,t,i,n)=>{let s,r;return o=>{var a;t.value>=0&&(o||n)&&(r=t.value-(null!==(a=s)&&void 0!==a?a:0),(r||void 0===s)&&(s=t.value,t.delta=r,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,i),e(t)))}},Sw=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},ww=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},kw=()=>{var e,t;return null!==(e=null===(t=ww())||void 0===t?void 0:t.activationStart)&&void 0!==e?e:0};let Cw=-1;const xw=new Set,Ew=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Iw=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of xw)e();isFinite(Cw)||(Cw="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Iw,!0))}},Tw=(e=!1)=>{if(e&&(Cw=1/0),0>Cw){var t;const e=kw(),i=document.prerendering||null===(t=globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e))||void 0===t?void 0:t.startTime;Cw=null!=i?i:Ew(),addEventListener("visibilitychange",Iw,!0),addEventListener("prerenderingchange",Iw,!0),yw(()=>{setTimeout(()=>{Cw=Ew()})})}return{get firstHiddenTime(){return Cw},onHidden(e){xw.add(e)}}},Mw=(e,t=-1,i,n=0,s,r,o)=>{const a=ww(),l=(null==a?void 0:a.navigationId)||0;let c="navigate";return i?c=i:0>mw()?a&&(document.prerendering||kw()>0?c="prerender":document.wasDiscarded?c="restore":a.type&&(c=a.type.replace(/_/g,"-"))):c="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:n||l,navigationInteractionId:s,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},Pw=new WeakMap;function Rw(e,t){let i=Pw.get(t);return i||(i=new WeakMap,Pw.set(t,i)),i.get(e)||i.set(e,new t),i.get(e)}var Fw=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(e){var t;if(e.hadRecentInput)return;const i=this.o[0],n=this.o.at(-1);this.i&&i&&n&&1e3>e.startTime-n.startTime&&5e3>e.startTime-i.startTime?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),null===(t=this.t)||void 0===t||t.call(this,e)}};const Aw=(e,t,i={})=>{try{const n=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(n.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const i=e.getEntries();n.length>1&&i.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(i)})});for(const t of n)e.observe(ct({type:t,buffered:!0},i));return e}}catch(e){}},Lw=e=>{var t,i;return(null===(t=globalThis.PerformanceObserver)||void 0===t||null===(t=t.supportedEntryTypes)||void 0===t?void 0:t.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},Ow=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},Dw=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var $w=class{constructor(){this.l=void 0}};const Nw=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Bw=[1800,3e3],qw=(e,t={})=>{const i=Lw(t);Nw(()=>{const n=Rw(t,$w),s=Tw();let r,o=Mw("FCP");const a=Aw(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(a.disconnect(),s.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-kw(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,r(!0)))});a&&(r=bw(e,o,Bw,t.reportAllChanges),yw(i=>{o=Mw("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,mw()),r=bw(e,o,Bw,t.reportAllChanges),Sw(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Aw(["soft-navigation"],i=>{i.forEach(i=>{n.l&&i.navigationId&&Ow(n.l,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Mw("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=bw(e,o,Bw,t.reportAllChanges),r(!0)})},t)})},Hw=[.1,.25],zw=(e,t={})=>{const i=Tw();qw(Dw(()=>{let n,s=Mw("CLS",0);const r=Rw(t,Fw),o=(i,o,a,l,c)=>{s=Mw("CLS",0,i,o,a,l,c),r.i=0,n=bw(e,s,Hw,t.reportAllChanges)},a=(e=!1)=>{r.i>s.value&&(s.value=r.i,s.entries=r.o),n(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=e=>{for(const t of e)"soft-navigation"!==t.entryType?r.h(t):l(t);a()},u=["layout-shift"];Lw(t)&&u.push("soft-navigation");const d=Aw(u,c);d&&(n=bw(e,s,Hw,t.reportAllChanges),i.onHidden(()=>{c(d.takeRecords()),n(!0)}),yw(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,mw()),Sw(n)}),setTimeout(n))}))};let Uw=0,Ww=1/0,jw=0;const Vw=e=>{for(const t of e)t.interactionId&&(Ww=Math.min(Ww,t.interactionId),jw=Math.max(jw,t.interactionId),Uw=jw?(jw-Ww)/7+1:0)};let Gw;const Qw=()=>{var e;return Gw?Uw:null!==(e=performance.interactionCount)&&void 0!==e?e:0};var Kw=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return Qw()-this.u}M(){this.u=Qw(),this.v.length=0,this.m.clear()}L(e){const t=this._(),i=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==i||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[i]:{P:8,id:-1,entries:[]}}h(e){var t;if(null===(t=this.p)||void 0===t||t.call(this,e),!e.interactionId)return;const i=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||10>this.v.length||e.duration>i.P){var s;if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}null===(s=this.T)||void 0===s||s.call(this,n)}}};const Jw=e=>{const t="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const s=Dw(e);let r=-1;const o=()=>{n(r),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:t})}},Zw=[200,500],Yw=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Tw();Nw(()=>{var n;"interactionCount"in performance||Gw||(Gw=Aw(["event"],Vw,{durationThreshold:0}));let s,r=Mw("INP");const o=Rw(t,Kw),a=(i,n,a,l,c)=>{o.M(),r=Mw("INP",-1,i,n,a,l,c),s=bw(e,r,Zw,t.reportAllChanges)},l=()=>{const e=o.L(r.navigationType);e&&e.P!==r.value&&(r.value=e.P,r.entries=e.entries,s())},c=e=>{l(),s(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{Jw(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):c(t);l(),t&&s(!0)})},d=["event","first-input"];Lw(t)&&d.push("soft-navigation");const h=Aw(d,u,ct(ct({},t),{},{durationThreshold:null!==(n=t.durationThreshold)&&void 0!==n?n:40}));s=bw(e,r,Zw,t.reportAllChanges),h&&(i.onHidden(()=>{u(h.takeRecords(),!0)}),yw(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,mw())}))})};var Xw=class{constructor(){this.p=void 0,this.l=void 0}h(e){var t;null===(t=this.p)||void 0===t||t.call(this,e)}};const ek=[2500,4e3],tk=(e,t={})=>{let i=!1;const n=Lw(t);Nw(()=>{let s,r=Tw(),o=Mw("LCP");const a=Rw(t,Xw),l=(n,a,l,c,u)=>{o=Mw("LCP",-1,n,a,l,c,u),s=bw(e,o,ek,t.reportAllChanges),i=!1,"soft-navigation"===n&&(r=Tw(!0))},c=e=>{var t;a.l&&e.navigationId&&Ow(a.l,e),i||s(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const n=null===(t=e.getLargestInteractionContentfulPaint)||void 0===t?void 0:t.call(e);n&&u([n])},u=e=>{t.reportAllChanges||n||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){c(t);continue}let e=0,n=[],l=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-kw(),0),a.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){var i;const s=t;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,e=Math.max(l-t.startTime,0),s.largestContentfulPaint&&(a.h(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=e,o.entries=n,s())}},d=["largest-contentful-paint"];n&&d.push("interaction-contentful-paint","soft-navigation");const h=Aw(d,u);if(h){s=bw(e,o,ek,t.reportAllChanges);const r=["keydown","click","visibilitychange"],a=e=>{if(e.isTrusted&&!i){const e=o.id;Jw(()=>{if(!i){if(!n){h.disconnect();for(const e of r)removeEventListener(e,a,{capture:!0})}e===o.id&&(i=!0,s(!0))}})}};for(const e of r)addEventListener(e,a,{capture:!0});yw(n=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,mw()),s=bw(e,o,ek,t.reportAllChanges),Sw(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})},ik={onLCP:fw,onCLS:tw,onFCP:iw,onINP:hw,withoutAttribution:{onLCP:tk,onCLS:zw,onFCP:qw,onINP:Yw}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=ik,d.__PosthogExtensions__.postHogWebVitalsCallbacks=ik,d.postHogWebVitalsCallbacks=ik;const nk={onLCP:tk,onCLS:zw,onFCP:qw,onINP:Yw};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=nk,d.__PosthogExtensions__.postHogWebVitalsCallbacks=nk,d.postHogWebVitalsCallbacks=nk,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>nk;const sk={onLCP:fw,onCLS:tw,onFCP:iw,onINP:hw,withoutAttribution:{onLCP:tk,onCLS:zw,onFCP:qw,onINP:Yw}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=sk,d.__PosthogExtensions__.postHogWebVitalsCallbacks=sk,d.postHogWebVitalsCallbacks=sk;const rk={onLCP:tk,onCLS:zw,onFCP:qw,onINP:Yw};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=rk,d.__PosthogExtensions__.postHogWebVitalsCallbacks=rk,d.postHogWebVitalsCallbacks=rk,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>rk;const ok={};function ak(e,t){const i=yo(e);return i?ct({node:i,originalEvent:e,timestamp:Date.now()},t):null}function lk(e){return!!dn(()=>co(e))}function ck(e,t){return Math.abs(e)<Math.abs(t)?0>t?"up":"down":0>e?"left":"right"}function uk(e){return"swipe"===e.type?"$dead_swipe":"$dead_click"}const dk="canvas,video,audio,embed,object";function hk(e,t){return Ft(e)&&e>=t}function pk(e,t=1e3){return e>=0&&t>e?e:void 0}function gk(e,t,i=1e3){return Ft(t)?pk(e-t,i):void 0}var _k=class{_asRequiredConfig(e){var t,i,n,s,r,o,a,l;const c=this._defaultConfig((null==e?void 0:e.__onCapture)||this._captureDeadClick.bind(this));return{element_attribute_ignorelist:null!==(t=null==e?void 0:e.element_attribute_ignorelist)&&void 0!==t?t:c.element_attribute_ignorelist,scroll_threshold_ms:null!==(i=null==e?void 0:e.scroll_threshold_ms)&&void 0!==i?i:c.scroll_threshold_ms,selection_change_threshold_ms:null!==(n=null==e?void 0:e.selection_change_threshold_ms)&&void 0!==n?n:c.selection_change_threshold_ms,mutation_threshold_ms:null!==(s=null==e?void 0:e.mutation_threshold_ms)&&void 0!==s?s:c.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(r=null==e?void 0:e.capture_clicks_with_modifier_keys)&&void 0!==r?r:c.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==e?void 0:e.capture_dead_swipes)&&void 0!==o?o:c.capture_dead_swipes,swipe_threshold_px:null!==(a=null==e?void 0:e.swipe_threshold_px)&&void 0!==a?a:c.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(l=null==e?void 0:e.max_dead_swipes_per_page_load)&&void 0!==l?l:c.max_dead_swipes_per_page_load,css_selector_ignorelist:null==e?void 0:e.css_selector_ignorelist,__onCapture:c.__onCapture}}constructor(e,t){this.instance=e,this._observedRoots=new WeakSet,this._hadSelection=!1,this._clicks=[],this._deadSwipesCaptured=0,this._defaultConfig=e=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,capture_clicks_with_modifier_keys:!1,capture_dead_swipes:!0,swipe_threshold_px:30,max_dead_swipes_per_page_load:10,__onCapture:e}),this._clearMouseSelection=()=>{clearTimeout(this._mouseSelectionTimer),this._mouseSelectionTimer=void 0,this._mouseSelection=void 0},this._onMouseDown=e=>{if(this._observeGesturePath(e),this._clearMouseSelection(),0===e.button){const t={path:e.composedPath(),trusted:e.isTrusted,selectionChanged:!1,selectionInitiallyRelated:!1},i=null==n?void 0:n.getSelection();t.selectionInitiallyRelated="Range"===(null==i?void 0:i.type)&&this._selectionTouchesGesture(i,t),this._mouseSelection=t}},this._onMouseOut=e=>{Pt(e.relatedTarget)&&this._clearMouseSelection()},this._onMouseUp=e=>{const t=this._mouseSelection,i=e;if(!t||0!==i.button||e.isTrusted!==t.trusted)return;const n=e.composedPath();for(const e of t.path)if(lk(e)&&-1!==n.indexOf(e)){t.clickTarget=e;break}t.clickDetail=i.detail,this._mouseSelectionTimer=d.setTimeout(this._clearMouseSelection,0)},this._onClick=e=>{this._observeGesturePath(e);const t=e,i=ak(t,{type:"click"}),n=this._mouseSelection;i&&n&&0===t.button&&t.detail>0&&t.detail===n.clickDetail&&e.isTrusted===n.trusted&&i.node===n.clickTarget&&(i.selectionChangedDuringGesture=n.selectionChanged&&this._config.selection_change_threshold_ms>0,this._clearMouseSelection()),Pt(i)||this._ignore(i)||this._queueCandidate(i),this._scheduleCheck()},this._onScroll=()=>{const e=Date.now();this._lastScroll=e,e%50==0&&this._clicks.forEach(t=>{It(t.scrollDelayMs)&&(t.scrollDelayMs=e-t.timestamp)})},this._onSelectionChange=e=>{var t,i;const s=null==n?void 0:n.getSelection(),r=this._hadSelection;this._hadSelection="Range"===(null==s?void 0:s.type);const o=null==s?void 0:s.focusNode,a=o&&(co(o)?o:o.parentElement),l=null==n?void 0:n.activeElement;let c=l;for(;null==c||null===(t=c.shadowRoot)||void 0===t?void 0:t.activeElement;)c=c.shadowRoot.activeElement;const u=Do(yo(e))||Do(null!=a?a:null)||Do(null!==(i=c)&&void 0!==i?i:null),d="Caret"===(null==s?void 0:s.type)&&c&&!c.shadowRoot&&o&&o!==l&&o.contains(null!=l?l:null);if(!(r||this._hadSelection||u||d))return;const h=Date.now();this._lastSelectionChanged=h;const p=this._mouseSelection;if(p&&(r||this._hadSelection||u)){const t=yo(e);let i;if(Do(t))i=t;else if("Caret"===(null==s?void 0:s.type)){var g;Do(null!==(g=c)&&void 0!==g?g:null)||d?i=c:u&&(i=a)}const n=i?this._selectionIsInGesture(i,p):s&&(o||s.anchorNode)?this._selectionTouchesGesture(s,p):r&&!this._hadSelection&&p.selectionInitiallyRelated;p.selectionChanged=p.selectionChanged||n}this._clicks.forEach(e=>{const t=h-e.timestamp;0>t||!It(e.selectionChangedDelayMs)&&t>=e.selectionChangedDelayMs||(e.selectionChangedDelayMs=t)})},this._onVisibilityChange=()=>{"hidden"===(null==n?void 0:n.visibilityState)&&this._clearMouseSelection();const e=Date.now();this._lastVisibilityChange=e,this._recordLivenessSignal("visibilityChangedDelayMs",e)},this._onFocusChange=()=>{const e=Date.now();this._lastFocusChange=e,this._recordLivenessSignal("focusChangedDelayMs",e)},this._onTouchStart=e=>{this._observeGesturePath(e);const t=e.touches,i=1===(null==t?void 0:t.length)?t[0]:void 0;this._touchStart=i?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this._onTouchCancel=()=>{this._touchStart=void 0},this._onTouchEnd=e=>{var t;const i=this._touchStart;if(this._touchStart=void 0,It(i)||this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)return;const s=e,r=null===(t=s.changedTouches)||void 0===t?void 0:t[0];if(!r)return;const o=r.clientX-i.x,a=r.clientY-i.y,l=o*o+a*a,c=this._config.swipe_threshold_px;if(c*c>l)return;if([this._lastScroll,this._lastMutation,this._lastSelectionChanged].some(e=>Ft(e)&&e>=i.timestamp))return;var u,d;if(this._pageHasUnobservableSurfaces()&&(null!==(u=null==n||null===(d=n.elementsFromPoint)||void 0===d?void 0:d.call(n,i.x,i.y))&&void 0!==u?u:[]).some(e=>{var t;return null===(t=e.matches)||void 0===t?void 0:t.call(e,dk)}))return;const h=ak(s,{type:"swipe",swipeDirection:ck(o,a),swipeDistancePx:Math.round(Math.sqrt(l))});Pt(h)||this._ignore(h)||this._queueCandidate(h),this._scheduleCheck()},this._config=this._asRequiredConfig(t),this._onCapture=this._config.__onCapture}start(e){this._startClickObserver(),this._startScrollObserver(),this._startSelectionChangedObserver(),this._startVisibilityChangeObserver(),this._startFocusChangeObserver(),this._startMutationObserver(e),this._config.capture_dead_swipes&&this._startSwipeObserver()}_startMutationObserver(t){if(!this._mutationObserver){const i=function(t){return function(t,i){const n=ok[t];if(n)return n;let s=i[t];if((e=>Ct(e)&&-1!==e.toString().indexOf("[native code]"))(s)&&!(null==e?void 0:e.Zone))return ok[t]=s.bind(i);const r=i.document;if(r&&Ct(r.createElement)){let e,n=!1;try{e=r.createElement("iframe"),e.hidden=!0,r.head.appendChild(e);const l=e.contentWindow;var o,a;l&&l[t]&&(s=l[t],"MutationObserver"===t&&function(e){return ft(e,"AppleWebKit")&&!ft(e,"Chrome")}(null!==(o=null===(a=i.navigator)||void 0===a?void 0:a.userAgent)&&void 0!==o?o:"")&&(e.classList.add("rr-block","ph-no-capture"),n=!0))}catch(e){$r.warn(`Could not create sandbox iframe for ${t} check, bailing to assignableWindow.${t}: `,e)}finally{!n&&(null==e?void 0:e.parentNode)&&e.parentNode.removeChild(e)}}return s&&Ct(s)?ok[t]=s.bind(i):s}("MutationObserver",t)}(d);this._mutationObserver=new i(e=>{this._onMutation(e)}),this._observeRoot(t)}}_observeRoot(e){e&&this._mutationObserver&&(this._observedRoots.has(e)||(this._mutationObserver.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),this._observedRoots.add(e),this._observeShadowRoots(e)))}_observeShadowRoots(e,t){var i,n;co(e)&&e.shadowRoot&&this._observeRoot(e.shadowRoot);const s=null!==(i=null===(n=e.querySelectorAll)||void 0===n?void 0:n.call(e,"*"))&&void 0!==i?i:[];for(let e=0;s.length>e;e++)null==t||t.add(s[e]),this._observeRoot(s[e].shadowRoot)}_observeGesturePath(e){var t,i;const n=null!==(t=null===(i=e.composedPath)||void 0===i?void 0:i.call(e))&&void 0!==t?t:[];for(let e=0;n.length>e;e++){const t=n[e];lk(t)&&this._observeRoot(t.shadowRoot)}}stop(){var e;null===(e=this._mutationObserver)||void 0===e||e.disconnect(),this._mutationObserver=void 0,this._observedRoots=new WeakSet,d.removeEventListener("click",this._onClick,{capture:!0}),d.removeEventListener("mousedown",this._onMouseDown,{capture:!0}),d.removeEventListener("mouseup",this._onMouseUp,{capture:!0}),d.removeEventListener("mouseout",this._onMouseOut,{capture:!0}),d.removeEventListener("dragstart",this._clearMouseSelection,{capture:!0}),d.removeEventListener("pointercancel",this._clearMouseSelection,{capture:!0}),d.removeEventListener("blur",this._clearMouseSelection),this._clearMouseSelection(),d.removeEventListener("scroll",this._onScroll,{capture:!0}),null==n||n.removeEventListener("selectionchange",this._onSelectionChange),d.removeEventListener("touchstart",this._onTouchStart,{capture:!0}),d.removeEventListener("touchend",this._onTouchEnd,{capture:!0}),d.removeEventListener("touchcancel",this._onTouchCancel,{capture:!0}),null==n||n.removeEventListener("visibilitychange",this._onVisibilityChange),d.removeEventListener("blur",this._onFocusChange),d.removeEventListener("focus",this._onFocusChange),this._touchStart=void 0}_onMutation(e){const t=new Set;for(const n of e)try{var i;if(!1===(null===(i=n.target)||void 0===i?void 0:i.isConnected))continue;this._lastMutation=Date.now();const e=n.addedNodes;for(let i=0;e.length>i;i++){const n=e[i];lk(n)&&!t.has(n)&&this._observeShadowRoots(n,t)}}catch(e){}}_startClickObserver(){Qr(d,"click",this._onClick,{capture:!0}),Qr(d,"mousedown",this._onMouseDown,{capture:!0}),Qr(d,"mouseup",this._onMouseUp,{capture:!0}),Qr(d,"mouseout",this._onMouseOut,{capture:!0}),Qr(d,"dragstart",this._clearMouseSelection,{capture:!0}),Qr(d,"pointercancel",this._clearMouseSelection,{capture:!0}),Qr(d,"blur",this._clearMouseSelection)}_queueCandidate(e){e.selectionChangedDelayMs=gk(e.timestamp,this._lastSelectionChanged,this._config.selection_change_threshold_ms),e.visibilityChangedDelayMs=gk(e.timestamp,this._lastVisibilityChange),e.focusChangedDelayMs=gk(e.timestamp,this._lastFocusChange),this._clicks.push(e)}_scheduleCheck(){this._clicks.length&&It(this._checkClickTimer)&&(this._checkClickTimer=d.setTimeout(()=>{this._checkClicks()},1e3))}_startScrollObserver(){Qr(d,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){var e;this._hadSelection="Range"===(null==n||null===(e=n.getSelection())||void 0===e?void 0:e.type),Qr(n,"selectionchange",this._onSelectionChange)}_selectionIsInGesture(e,t){const i=t.path[0];try{for(;e;){if(-1!==t.path.indexOf(e)||co(i)&&i.contains(e))return!0;e=e.getRootNode().host}}catch(e){}return!1}_selectionTouchesGesture(e,t){const i=t.path[0],n=e.rangeCount>0?e.getRangeAt(0):void 0,s=!!n&&dn(()=>n.startContainer.getRootNode()===i.getRootNode());if(n&&s&&co(i)){var r;if(!n.collapsed)return n.intersectsNode(i);const e=co(n.startContainer)&&null!==(r=n.startContainer.childNodes[n.startOffset])&&void 0!==r?r:n.startContainer;return this._selectionIsInGesture(e,t)}return this._selectionIsInGesture(e.focusNode,t)||this._selectionIsInGesture(e.anchorNode,t)}_startVisibilityChangeObserver(){Qr(n,"visibilitychange",this._onVisibilityChange)}_startFocusChangeObserver(){Qr(d,"blur",this._onFocusChange),Qr(d,"focus",this._onFocusChange)}_recordLivenessSignal(e,t){this._clicks.forEach(i=>{const n=pk(t-i.timestamp);Ft(n)&&(It(i[e])||i[e]>n)&&(i[e]=n)})}_startSwipeObserver(){Qr(d,"touchstart",this._onTouchStart,{capture:!0,passive:!0}),Qr(d,"touchend",this._onTouchEnd,{capture:!0,passive:!0}),Qr(d,"touchcancel",this._onTouchCancel,{capture:!0,passive:!0})}_pageHasUnobservableSurfaces(){const e=It(this._surfacesCheckedAt)||Ft(this._lastMutation)&&this._lastMutation>this._surfacesCheckedAt;return(It(this._hasUnobservableSurfaces)||e)&&(this._surfacesCheckedAt=Date.now(),this._hasUnobservableSurfaces=!!(null==n?void 0:n.querySelector(dk))),!!this._hasUnobservableSurfaces}_ignore(e){return!e||("swipe"===e.type?this._ignoreCommon(e):this._ignoreClick(e))}_ignoreCommon(e){return!(!lo(e.node)&&!this._clicks.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!uo(e.node,"html")&&co(e.node)&&function(e,t){var i;if(!(typeof window>"u"?void 0:window)||No(e))return!1;const n=Lt(t)?Ao:null!==(i=null==t?void 0:t.css_selector_ignorelist)&&void 0!==i?i:Ao,{targetElementList:s}=Bo(e,!1);return!wo(s,n)}(e.node,{css_selector_ignorelist:this._config.css_selector_ignorelist}))}_ignoreClick(e){return!(this._config.capture_clicks_with_modifier_keys||(t=e.originalEvent,!(t.ctrlKey||t.metaKey||t.altKey||t.shiftKey)))||!!this._ignoreCommon(e)||function(e){if(!(typeof window>"u"?void 0:window)||No(e))return!1;const{targetElementList:t}=Bo(e,!1);return t.some(e=>uo(e,"a"))}(e.node);var t}_checkClicks(){if(!this._clicks.length)return;clearTimeout(this._checkClickTimer),this._checkClickTimer=void 0;const e=this._clicks;this._clicks=[];for(const i of e){var t;i.mutationDelayMs=null!==(t=i.mutationDelayMs)&&void 0!==t?t:this._lastMutation&&this._lastMutation>=i.timestamp?this._lastMutation-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const e=hk(i.scrollDelayMs,this._config.scroll_threshold_ms),n=hk(i.selectionChangedDelayMs,this._config.selection_change_threshold_ms),s=hk(i.mutationDelayMs,this._config.mutation_threshold_ms),r=hk(i.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),o=Ft(i.scrollDelayMs)&&this._config.scroll_threshold_ms>i.scrollDelayMs,a=Ft(i.mutationDelayMs)&&this._config.mutation_threshold_ms>i.mutationDelayMs,l=i.selectionChangedDuringGesture||Ft(i.selectionChangedDelayMs)&&this._config.selection_change_threshold_ms>i.selectionChangedDelayMs,c=Ft(i.visibilityChangedDelayMs),u=Ft(i.focusChangedDelayMs);if(!(o||a||l||c||u))if(e||s||r||n){const t=uk(i);if("$dead_swipe"===t){if(this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)continue;this._deadSwipesCaptured++}this._onCapture(i,{[`${t}_last_mutation_timestamp`]:this._lastMutation,[`${t}_event_timestamp`]:i.timestamp,[`${t}_scroll_timeout`]:e,[`${t}_mutation_timeout`]:s,[`${t}_absolute_timeout`]:r,[`${t}_selection_changed_timeout`]:n,[`${t}_visibility_changed_timeout`]:!1})}else this._config.mutation_threshold_ms>i.absoluteDelayMs&&this._clicks.push(i)}this._scheduleCheck()}_captureDeadClick(e,t){const i=uk(e);this.instance.capture(i,ct(ct(ct({},t),ub(e.node,{e:e.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:e.scrollDelayMs,[`${i}_mutation_delay_ms`]:e.mutationDelayMs,[`${i}_absolute_delay_ms`]:e.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:e.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:e.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:e.focusChangedDelayMs,$dead_swipe_direction:e.swipeDirection,$dead_swipe_distance_px:e.swipeDistancePx}),{timestamp:new Date(e.timestamp)})}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new _k(e,t);var fk=class{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return"always"===this._config.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this._config.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){const e=this._storage._get(this._storageKey);return Wt(e)?1:ft(jt,e)?0:-1}get _storage(){const e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?Ol:Al,i=t._is_supported()?t:Gl;if(!this._persistentStore||this._persistentStore!==i){this._persistentStore=i;const t="localStorage"===e?Al:Ol;t._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Wt(t._get(this._storageKey))),t._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(e=>Wt(e))}};const vk=Nr("[Dead Clicks]"),mk=()=>!0,yk=e=>{var t;const i=!!(null===(t=e.instance.persistence)||void 0===t?void 0:t.get_property(Y)),n=e.instance.config.capture_dead_clicks;return Lt(n)?n:!!xt(n)||i};var bk=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Y]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript(()=>{this._start()}):this.stop()}_loadScript(e){var t,i,n;(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)?e():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this.instance,"dead-clicks-autocapture",t=>{t?vk.error("failed to load script",t):e()})}_start(){var e;if(n){if(!this._lazyLoadedDeadClicksAutocapture&&(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)){const e=xt(this.instance.config.capture_dead_clicks)?ct({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this._lazyLoadedDeadClicksAutocapture=d.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this._lazyLoadedDeadClicksAutocapture.start(n),vk.info("starting...")}}else vk.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,vk.info("stopping..."))}};const Sk=Nr("[SegmentIntegration]");function wk(e,t,i=!0){const n=e.config.segment;if(!n)return t();const{analytics:s,filterProperties:r}=(e=>Ct(e.register))(o=n)?{analytics:o}:o;var o;!function(e,t,i,n){const s=t=>{const s=()=>t.anonymousId()||Tl();e.config.get_device_id=s,n&&t.id()&&(e.register({distinct_id:t.id(),$device_id:s()}),e.persistence.set_property(Ie,Ze)),i(n?void 0:t.anonymousId()||void 0)},r=t.user();"then"in r&&Ct(r.then)?r.then(s):s(r)}(e,s,i=>{s.register(((e,t,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||Sk.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=!!t&&n.event.anonymousId===t&&!n.event.userId;r||n.event.userId||n.event.anonymousId===e.get_distinct_id()||(Sk.info("No userId set, resetting PostHog"),e.reset()),r||(t=void 0),n.event.userId&&n.event.userId!==e.get_distinct_id()&&(Sk.info("UserId set, identifying with PostHog"),e.identify(n.event.userId));let o=e.calculateEventProperties(s,n.event.properties);if(!Rt(i)){const e=n.event.properties||{},t={};for(const i of Object.keys(o))St.call(e,i)||(t[i]=o[i]);const s=((e,t)=>{const i=kt(e)?e:[e];let n=ct({},t);for(const e of i)try{if(n=e(n),Rt(n))return null}catch(e){return Sk.error("Error in Segment filterProperties:",e),null}return n})(i,t);if(Rt(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(e){return n(e,e.event.event)},page(e){return n(e,et)},identify(e){return n(e,it)},screen(e){return n(e,"$screen")}}})(e,i,{filterProperties:r})).then(()=>{t()},e=>{Sk.error("Failed to register the Segment integration",e),t()})},i)}const kk="posthog-js";function Ck(e,{organization:t,projectId:i,prefix:n,severityAllowList:s=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var a,l,c,u,d;if("*"!==s&&!s.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});const h=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const p=(null===(a=o.exception)||void 0===a?void 0:a.values)||[],g=p.map(e=>ct(ct({},e),{},{stacktrace:e.stacktrace?ct(ct({},e.stacktrace),{},{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>ct(ct({},e),{},{platform:"web:javascript"}))}):void 0})),_={$exception_message:(null===(l=p[0])||void 0===l?void 0:l.value)||o.message,$exception_type:null===(c=p[0])||void 0===c?void 0:c.type,$exception_level:o.level,$exception_list:g,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(u=p[0])||void 0===u?void 0:u.value)||o.message,$sentry_exception_type:null===(d=p[0])||void 0===d?void 0:d.type,$sentry_tags:o.tags};var f;return t&&i&&(_.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(f=e.exceptions)||void 0===f||f.sendExceptionEvent(_)),o}}var xk=class{constructor(e,t,i,n,s,r){this.name=kk,this.setupOnce=function(o){o(Ck(e,{organization:t,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:null==r||r}))}}},Ek=class{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&($r.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null===(e=this._unsubscribeSessionId)||void 0===e||e.call(this),this._unsubscribeSessionId=void 0}doPageView(t,i){var n;const s=this._previousPageViewProperties(t,i);return this._currentPageview={pathname:null!==(n=null==e?void 0:e.location.pathname)&&void 0!==n?n:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,null===(t=this._currentPageview)||void 0===t?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null===(e=this._currentPageview)||void 0===e?void 0:e.pageViewId}}_previousPageViewProperties(e,t){const i=this._currentPageview;if(!i)return{$pageview_id:t};let n={$pageview_id:t,$prev_pageview_id:i.pageViewId};const s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:e,lastScrollY:t,maxScrollY:i,maxContentHeight:r,lastContentY:o,maxContentY:a}=s;if(!(It(e)||It(t)||It(i)||It(r)||It(o)||It(a))){e=Math.ceil(e),t=Math.ceil(t),i=Math.ceil(i),r=Math.ceil(r),o=Math.ceil(o),a=Math.ceil(a);const s=e>1?Kt(t/e,0,1,$r):1,l=e>1?Kt(i/e,0,1,$r):1,c=r>1?Kt(o/r,0,1,$r):1,u=r>1?Kt(a/r,0,1,$r):1;n=Hr(n,{$prev_pageview_last_scroll:t,$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:c,$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:u})}}return i.pathname&&(n.$prev_pageview_pathname=i.pathname),i.timestamp&&(n.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),n}};const Ik=["flags","surveys"],Tk={[O]:{exposure:"hidden"},[q]:{exposure:"hidden"},[H]:{exposure:"hidden"},[V]:{exposure:"hidden"},[U]:{exposure:"hidden"},[j]:{exposure:"hidden"},[T]:{exposure:"event"},[G]:{exposure:"hidden"},[ee]:{exposure:"hidden"},[Q]:{exposure:"event"},[K]:{exposure:"hidden"},[J]:{exposure:"event"},[Z]:{exposure:"event"},[Y]:{exposure:"event"},[X]:{exposure:"hidden"},[te]:{exposure:"event"},[ie]:{exposure:"hidden"},[ne]:{exposure:"hidden"},[ce]:{exposure:"hidden"},[ue]:{exposure:"event"},[se]:{exposure:"event",shouldSkipFromEventProperties:e=>Pt(e)},[de]:{exposure:"event"},[he]:{exposure:"event"},[pe]:{exposure:"event"},[ve]:{exposure:"event"},[me]:{exposure:"hidden"},[y]:{exposure:"hidden",storageGroup:"flags"},[p]:{exposure:"hidden",storageGroup:"flags"},[h]:{exposure:"hidden"},[g]:{exposure:"hidden",storageGroup:"flags"},[C]:{exposure:"hidden",storageGroup:"flags"},[v]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[m]:{exposure:"hidden",storageGroup:"flags"},[x]:{exposure:"hidden"},[E]:{exposure:"hidden"},[S]:{exposure:"hidden"},[b]:{exposure:"hidden"},[M]:{exposure:"hidden",storageGroup:"surveys"},[P]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[F]:{exposure:"event"},[A]:{exposure:"hidden"},[L]:{exposure:"hidden"},[be]:{exposure:"hidden"},[Se]:{exposure:"hidden"},[we]:{exposure:"hidden"},[ke]:{exposure:"event"},[Ce]:{exposure:"event"},[xe]:{exposure:"event"},[Ee]:{exposure:"event"},[w]:{exposure:"hidden"},[k]:{exposure:"hidden"},[ye]:{exposure:"event"},[_]:{exposure:"hidden"},[f]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ie]:{exposure:"hidden"},[Te]:{exposure:"hidden"},[Me]:{exposure:"hidden"},[Pe]:{exposure:"hidden"},[Re]:{exposure:"hidden"},[Fe]:{exposure:"hidden"},[Ae]:{exposure:"hidden"},[re]:{exposure:"event"},[oe]:{exposure:"event"},[ae]:{exposure:"event"},[le]:{exposure:"event"},[De]:{exposure:"event"},[$e]:{exposure:"event"},[Ne]:{exposure:"hidden"},[Be]:{exposure:"hidden"},[qe]:{exposure:"hidden"},[He]:{exposure:"hidden"},[ze]:{exposure:"hidden"},[Ue]:{exposure:"hidden"},[We]:{exposure:"hidden"},[je]:{exposure:"hidden"},[Ve]:{exposure:"hidden"},[Ke]:{exposure:"event"}},Mk=[[ge,{exposure:"hidden"}],[_e,{exposure:"hidden"}],[fe,{exposure:"hidden"}]],Pk=e=>{const t=Tk[e];if(t)return t;for(const[t,i]of Mk)if(0===e.indexOf(t))return i},Rk={flags:f,surveys:P},Fk=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ak=e=>`${e}_cookie_identity_change_pending`,Lk=e=>{let t="",i=0;for(const n of e){const e=encodeURIComponent(JSON.stringify(n).slice(1,-1)).length;if(i+e>1e3)break;t+=n,i+=e}return t},Ok="main",Dk=[y,p,g,C,v,f,m,S],$k=e=>-1!==Dk.indexOf(e),Nk=[U,j],Bk=e=>-1!==Nk.indexOf(e),qk=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(i){return e===t}},Hk=e=>{if(!e)return{};const t=JSON.parse(e);return xt(t)?t:{}},zk=(e,t)=>{qr(e,(i,n)=>{const s=Pk(n);s&&"event"!==s.exposure||{}.hasOwnProperty.call(t,n)||delete e[n]})};var Uk=class{constructor(t,i,n=!0,s=!t.cookieless_mode){if(this._slotState={},this._splitStorageEligible=!1,this._storesIdentityInCookie=!1,this._splitStorage=!1,this._cookieIdentityChangePending=!1,this._cookieSyncSuppressed=!1,this._pendingCrossTabFeatureFlagChanges=new Map,this._storageMigrationInProgress=!1,this._localIdentityChangePending=!1,this._crossTabFeatureFlagIdentityMismatch=!1,this._metaIdentifierChangePending=new Set,this._crossTabFeatureFlagHandlers=new Set,this._config=t,this._ownsSplitStorage=n,this.props={},this._campaign_params_url=void 0,this._name=(e=>{let t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(t),this._disabled=t.disable_persistence||!!i,this._storage=this._buildStorage(t),this._splitStorage=this._resolveSplitStorage(t),this.load(s),this._markLoadedCrossTabFeatureFlagChangesPending(),t.debug&&$r.info("Persistence loaded",t.persistence,ct({},this.props)),this.update_config(t,t,i),this.save(),e){const t=()=>this.flush();Qr(e,"beforeunload",t,{capture:!1}),Qr(e,"pagehide",t,{capture:!1}),this._onStorage=t=>{if(this._splitStorageEligible&&(!t.storageArea||t.storageArea===(null==e?void 0:e.localStorage))&&t.key)if(t.key!==this._name){if(this._splitStorage){const e=Ik.find(e=>t.key===this._groupEntryName(e));e&&this._syncCrossTabFeatureFlagProperties(t.key,e)}}else this._syncCrossTabFeatureFlagProperties(t.key,Ok)},Qr(e,"storage",this._onStorage)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([e,t])=>{const i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!$k(e)||!0===i)return;if(!0===t)return void this._setCrossTabFeatureFlagChangesPending(e,!0);const n=new Set(i||[]);t.forEach(e=>n.add(e)),n.size&&this._setCrossTabFeatureFlagChangesPending(e,n)})}onCrossTabFeatureFlagChange(e){return this._crossTabFeatureFlagHandlers.add(e),()=>this._crossTabFeatureFlagHandlers.delete(e)}destroy(){this._onStorage&&e&&(e.removeEventListener("storage",this._onStorage),this._onStorage=void 0),this._crossTabFeatureFlagHandlers.clear()}_syncCrossTabFeatureFlagProperties(e,t,i=!0){if(this._disabled)return!1;let n,s;try{if(s=Ol._get(e),Pt(s)){const e=this._slotWriteState(t);return e.storageValue=null,t!==Ok&&(e.persisted=!1),!1}n=Hk(s)}catch(e){return!1}const r=t===Ok?n:Ol._parse(this._name);if(r&&this._hasCrossTabFeatureFlagIdentityMismatch(r))return!1;const o=this._mergeCrossTabFeatureFlagProperties(n,t,i);return t===Ok&&this._splitStorage&&!qk(this._partitionProps().main,n)||this._rememberCrossTabStorageFingerprint(n,t,!0,s),o}_hasCrossTabFeatureFlagIdentityMismatch(e){const t=this.props[D],i=e[D];return!It(t)&&!It(i)&&t!==i}_rememberCrossTabStorageFingerprint(e,t,i,n){const s=this._slotWriteState(t);s.storageValue=n,t!==Ok&&(s.persisted=i);try{s.fingerprint=this._entryFingerprint(e,t)}catch(e){s.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,i){let n=!1;return Dk.forEach(i=>{var s;const r=null===(s=Pk(i))||void 0===s?void 0:s.storageGroup;if(t===Ok&&this._splitStorage&&r||t!==Ok&&r!==t)return;const o=i in e,a=this._mergePendingCrossTabFeatureFlagChanges(i,o?e[i]:void 0),l=this._pendingCrossTabFeatureFlagChanges.has(i)?i in this.props:o;l===i in this.props&&qk(a,this.props[i])||(l?this._setProp(i,a,!1):this._deleteProp(i,!1),n=!0)}),n&&i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()),n}_reconcileCrossTabFeatureFlagPropertiesBeforeWrite(){if(!this._splitStorageEligible)return!1;try{this._crossTabFeatureFlagIdentityMismatch=!1;const e=Ol._get(this._name),t=this._slotWriteState(Ok);let i,n=!1,s=!1;if(e!==t.storageValue)if(Pt(e))t.storageValue=null;else{if(i=Hk(e),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(i),this._crossTabFeatureFlagIdentityMismatch)return!1;s=this._mergeCrossTabFeatureFlagProperties(i,Ok,!1),!this._splitStorage||qk(this._partitionProps().main,i)?this._rememberCrossTabStorageFingerprint(i,Ok,!0,e):t.storageValue=e,n=!0}return this._splitStorage&&Ik.forEach(e=>{const t=Ol._get(this._groupEntryName(e)),r=this._slotWriteState(e),o=i||{},a=n&&Dk.some(t=>{var i;return(null===(i=Pk(t))||void 0===i?void 0:i.storageGroup)===e&&t in o});if(t===r.storageValue&&!a)return;if(Pt(t))return r.storageValue=null,r.persisted=!1,void(a&&(s=this._mergeCrossTabFeatureFlagProperties(o,e,!1)||s));const l=Hk(t);s=this._mergeCrossTabFeatureFlagProperties(l,e,!1)||s,this._rememberCrossTabStorageFingerprint(l,e,!0,t)}),s}catch(e){return!1}}_setCrossTabFeatureFlagChangesPending(e,t){this._pendingCrossTabFeatureFlagChanges.set(e,t);const i=Pk(e);(null==i?void 0:i.volatile)||(this._slotWriteState((this._splitStorage?null==i?void 0:i.storageGroup:void 0)||Ok).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){Dk.forEach(e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{const e=Ol._get(this._name),t=Hk(e);this._slotWriteState(Ok).storageValue=e,Dk.forEach(e=>{var i;const n=this._splitStorage?null===(i=Pk(e))||void 0===i?void 0:i.storageGroup:void 0,s=n?Ol._get(this._groupEntryName(n)):null;if(n){const e=this._slotWriteState(n);e.storageValue=s,e.persisted=!Pt(s)}const r=n&&!Pt(s)?Hk(s):t;e in this.props?this._markPendingCrossTabFeatureFlagChanges(e,r[e],this.props[e]):e in r&&this._setCrossTabFeatureFlagChangesPending(e,!0)})}catch(e){}}_mergePendingCrossTabFeatureFlagChanges(e,t){const i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!i)return t;if(!0===i)return this.props[e];if("$active_feature_flags"===e){const n=new Set(kt(t)?t:[]),s=new Set(kt(this.props[e])?this.props[e]:[]);return i.forEach(e=>s.has(e)?n.add(e):n.delete(e)),Array.from(n)}const n=xt(t)?ct({},t):{},s=xt(this.props[e])?this.props[e]:{};return i.forEach(e=>{e in s?n[e]=s[e]:delete n[e]}),n}_markPendingCrossTabFeatureFlagChanges(e,t,i){if(!$k(e))return;const n=this._pendingCrossTabFeatureFlagChanges.get(e);if(!0===n)return;let s=t;if(this._splitStorageEligible)try{var r;const t=this._splitStorage?null===(r=Pk(e))||void 0===r?void 0:r.storageGroup:void 0,i=t?this._groupEntryName(t):this._name;s=Hk(Ol._get(i))[e]}catch(e){}const o=new Set(n||[]);if("$active_feature_flags"===e){if(!It(t)&&!kt(t)||!It(s)&&!kt(s)||!kt(i))return void this._setCrossTabFeatureFlagChangesPending(e,!0);const n=new Set(t||[]),r=new Set(s||[]),a=new Set(i);new Set([...n,...a]).forEach(e=>{n.has(e)!==a.has(e)&&o.add(e)}),o.forEach(e=>{r.has(e)===a.has(e)&&o.delete(e)})}else{if(!xt(i))return void(qk(s,i)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));{if(!It(t)&&!xt(t)||It(t)&&Et(i)&&It(s))return void this._setCrossTabFeatureFlagChangesPending(e,!0);const n=xt(t)?t:{},r=xt(s)?s:{};new Set([...Object.keys(n),...Object.keys(i)]).forEach(e=>{e in n==e in i&&qk(n[e],i[e])||o.add(e)}),o.forEach(e=>{e in r==e in i&&qk(r[e],i[e])&&o.delete(e)})}}o.size?this._setCrossTabFeatureFlagChangesPending(e,o):this._pendingCrossTabFeatureFlagChanges.delete(e)}_saveDebounceMs(){var e;const t=null===(e=this._config)||void 0===e?void 0:e.persistence_save_debounce_ms;return Ft(t)&&t>0?t:0}_rememberCurrentCookieProperties(e){if(this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase())if(e)try{const t=Hl(e,this._config.cookie_persisted_properties||[]),i=Ul(t,this._config.cookie_persisted_properties||[]),n=JSON.stringify(t)+"|"+JSON.stringify(i),s=Al._get(this._name)||void 0;s&&jl(this._name,s)===n&&(this._lastSeenCookiePropertiesFingerprint=n,this._lastSeenMainCookieValue=s)}catch(e){}else try{const e=Al._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=e?jl(this._name,e):void 0,this._lastSeenMainCookieValue=e}catch(e){}}syncCookieProperties(){return this._syncCookieProperties(this._config)}_syncCookieProperties(e,t=!1){if(this._disabled&&!t||this._cookieSyncSuppressed||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;let i;try{i=Al._get(this._name)||void 0}catch(e){}if(!i||i===this._lastSeenMainCookieValue)return!1;const n=jl(this._name,i);let s;try{s=ql(JSON.parse(i))}catch(e){return!1}if((Al._get(this._name)||void 0)!==i)return!1;this._lastSeenCookiePropertiesFingerprint=n,this._lastSeenMainCookieValue=i;const r=Wl(this._name,i),o=[...$l,...r.properties],a={};if(Object.keys(s).forEach(e=>{const t=s[e];(It(t)||Pt(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(a[e]=!0,delete s[e])}),Et(s))return!1;const l="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,c=this.props,u=c[D],d=c[Ie],h=Hr({},c);[...$l,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==o.indexOf(e)&&!(e in s)&&!a[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){const t=h[e];(r.isValid||-1===$l.indexOf(e)||!1!==t&&0!==t)&&delete h[e]}}),this.props=Hr(h,s),Dk.forEach(e=>{const t=e in this.props;e in c===t&&qk(c[e],this.props[e])||(t?this._markPendingCrossTabFeatureFlagChanges(e,c[e],this.props[e]):this._setCrossTabFeatureFlagChangesPending(e,!0))}),!l||"$user_state"in s||"$user_state"in this.props||this._setProp(Ie,Je);const m=this.props[D],k=this.props[Ie];return!l||m===u&&k===d||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,Kl._set(Ak(this._name),!0),this._deleteProp(S),this._deleteProp(p),this._deleteProp(y),this._deleteProp(g),this._deleteProp(C),this._deleteProp(v),this._deleteProp(f),this._deleteProp(_),this._deleteProp(w),"anonymous"!==k||"identified"!==d&&"anonymous"!==s.$user_state&&(It(u)||m===u)||(zk(this.props,s),this._deleteProp(b)),"identified"===k?this.props.$user_id=m:delete this.props.$user_id,this._deleteProp(q)),!0}consumeCookieIdentityChange(){const e=Ak(this._name),t=this._cookieIdentityChangePending||!!Kl._get(e);return this._cookieIdentityChangePending=!1,t&&Kl._remove(e),t}_beginCookieSyncSuppression(e=!1){return!(this._cookieSyncSuppressed||this._disabled&&!e||!this._config.cookieWinsOnConflict||"localstorage+cookie"!==this._config.persistence.toLowerCase()||(this._cookieSyncSuppressed=!0,0))}_publishSuppressedCookieSnapshot(){this._cookieSyncSuppressed&&(It(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),delete this._slotState[Ok],this._writeNow(!0))}_endCookieSyncSuppression(e=!0){if(this._cookieSyncSuppressed)try{e?this._publishSuppressedCookieSnapshot():It(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0)}finally{this._cookieSyncSuppressed=!1}}isDisabled(){return!!this._disabled}_buildStorage(t){-1===Fk.indexOf(t.persistence.toLowerCase())&&($r.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");const i=((t=[],i=!1,n=()=>!1)=>{const s=[...$l,...t];return ct(ct({},Ol),{},{_rawText(e){return[Al._get(e),Al._get(Nl(e)),Ol._get(e)].join("\0")},_parse(e){try{let r,o={};try{r=Al._get(e)||void 0,o=r?ql(JSON.parse(r)):{}}catch(e){}const a=JSON.parse(Ol._get(e)||"{}");let l;if(i){const i=Wl(e,r),n=[...$l,...i.properties],c={};Object.keys(o).forEach(e=>{const t=o[e];Pt(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(c[e]=t)});const u="distinct_id"in c||"anonymous"===c.$user_state||"identified"===c.$user_state;if(Object.keys(c).length>0){var t;const e=a[D],r=null!==(t=a.$user_state)&&void 0!==t?t:Je;s.forEach(e=>{if(-1!==n.indexOf(e)&&!(e in o)&&(u||"distinct_id"!==e&&"$user_state"!==e)){const t=a[e];(i.isValid||-1===$l.indexOf(e)||!1!==t&&0!==t)&&delete a[e]}}),!u||"$user_state"in o||"$user_state"in a||(a[Ie]=Je),!u||("distinct_id"in c?c[D]:a[D])===e&&("$user_state"in c?c[Ie]:a[Ie])===r||(Dl.forEach(e=>delete a[e]),"identified"===c.$user_state&&"distinct_id"in c?a.$user_id=c[D]:delete a.$user_id,"identified"!==c.$user_state&&(delete a[ye],delete a[b]),delete a.__alias)}l=Hr(a,c)}else l=Hr(o,a);return n()||Ol._set(e,l),l}catch(e){}return null},_set(e,n,s,r,o,a){const l=Ol._set(e,n,void 0,void 0,a);try{const c=Hl(n,t);if(Object.keys(c).length){if(i){const i=Nl(e),u=Ul(c,t);if(Al._set(i,u,s,r,o,a),Al._get(i)!==JSON.stringify(u)){Al._remove(i,r);const t=Hl(n);return Al._set(e,t,s,r,o,a),l}}Al._set(e,c,s,r,o,a)}}catch(e){Ol._error(e)}return l},_remove(t,i){try{null==e||e.localStorage.removeItem(t),Al._remove(t,i),Al._remove(Nl(t),i)}catch(e){Ol._error(e)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict,()=>!!this._disabled);let n,s=!1,r=!1;const o=t.persistence.toLowerCase();return"localstorage"===o&&Ol._is_supported()?(n=Ol,r=!0):"localstorage+cookie"===o&&i._is_supported()?(n=i,r=!0,s=!0):"sessionstorage"===o&&Kl._is_supported()?n=Kl:"memory"===o?n=Gl:"cookie"===o&&Al._is_supported()?(n=Al,s=!0):i._is_supported()?(n=i,r=!0,s=!0):Al._is_supported()?(n=Al,s=!0):n=Gl,this._splitStorageEligible=r,this._storesIdentityInCookie=s,n}_groupEntryName(e){return`${this._name}__${e}`}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){const e={};return qr(this.props,(t,i)=>{const n=Pk(i);if(!n||"event"===n.exposure){var s;if(null==n||null===(s=n.shouldSkipFromEventProperties)||void 0===s?void 0:s.call(n,t))return;e[i]=t}}),e}load(e=!1){if(this._disabled&&!e)return;const t=this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase(),i=t?Ol._parse(this._name):null;let n={};if(t)try{n=ql(Al._parse(this._name)),qr(n,(e,t)=>{(It(e)||Pt(e)||""===e)&&delete n[t]})}catch(e){}const s=this._storage._parse(this._name);if(s&&(this.props=Hr({},s)),this._splitStorage&&this._loadGroupEntries(),t&&s){var r,o;const e=null==i?void 0:i[D],t=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Je,a=s[D],l=null!==(o=s.$user_state)&&void 0!==o?o:Je;if(a!==e||l!==t){this._cookieIdentityChangePending=!0,this._disabled||Kl._set(Ak(this._name),!0);const i=Hr({},this.props);Dl.forEach(e=>delete i[e]),"anonymous"!==l||"identified"!==t&&"anonymous"!==n.$user_state&&(It(e)||a===e)||(zk(i,n),delete i[b]),this.props=i;const s=new Set;Dl.forEach(e=>{var t;const i=null===(t=Pk(e))||void 0===t?void 0:t.storageGroup;i&&s.add(i)}),s.forEach(e=>{if(this._disabled)return;const t={};qr(this.props,(i,n)=>{var s;(null===(s=Pk(n))||void 0===s?void 0:s.storageGroup)===e&&(t[n]=i)}),Et(t)?(Ol._remove(this._groupEntryName(e)),this._slotState[e]={}):Ol._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})})}}Kl._get(Ak(this._name))&&(this._cookieIdentityChangePending=!0)}_loadGroupEntries(){for(const e of Ik){const t=Ol._parse(this._groupEntryName(e));if(t&&!Et(t)){const i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||Hr(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some(t=>{var i;return(null===(i=Pk(t))||void 0===i?void 0:i.storageGroup)===e})}_groupEntryIsStale(e,t){const i=Rk[e];if(!i)return!1;const n=t[i],s=this.props[i];return Ft(n)&&Ft(s)&&s>n}refreshKey(e){this._refreshKeys([e])}_refreshKeys(e){if(this._disabled)return;let t,i=!1;const n=()=>(i||(t=this._storage._parse(this._name),i=!0),t);e.forEach(e=>{var t;if(this._metaIdentifierChangePending.has(e))return;const i=this._splitStorage?null===(t=Pk(e))||void 0===t?void 0:t.storageGroup:void 0,s=i?Ol._parse(this._groupEntryName(i)):n();if(s&&e in s)this._setProp(e,s[e],!1);else{if(i){const t=n();if(t&&e in t)return void this._setProp(e,t[e],!1)}this._deleteProp(e,!1)}})}refreshMetaIdentifiers(){if(this._disabled)return;const e=this._storageSnapshot();(It(e)||e!==this._metaIdentifierStorageSnapshot)&&(this._refreshKeys(Nk),this._rememberMetaIdentifierStorageSnapshot(e))}_rememberMetaIdentifierStorageSnapshot(e=this._storageSnapshot()){this._metaIdentifierStorageSnapshot=0===this._metaIdentifierChangePending.size?e:void 0}_storageSnapshot(){const e=this._storage._rawText?this._storage._rawText(this._name):this._storage._get(this._name);return Tt(e)?e:void 0}save(){if(this._disabled)return;const e=this._saveDebounceMs();e>0?It(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout(()=>{this._pendingSaveTimer=void 0,this._writeNow()},e)):this._writeNow()}flush(){It(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(e=!1){if(this._disabled||this._cookieSyncSuppressed&&!e)return;e||(this.syncCookieProperties(),this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase()||this.refreshMetaIdentifiers());const t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);const i=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)return void(this._config.debug&&$r.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this._splitStorage)return this._writeNowSplit(),void(i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()));const n=this._writeEntry(this._storage,this._name,this.props,Ok);"written"===n&&this._rememberCurrentCookieProperties(this.props),"failed"!==n&&(this._pendingCrossTabFeatureFlagChanges.clear(),this._localIdentityChangePending=!1,this._metaIdentifierChangePending.clear()),"written"===n&&this._rememberMetaIdentifierStorageSnapshot(),i&&this._crossTabFeatureFlagHandlers.forEach(e=>e())}_writeNowSplit(){const{main:e,groups:t}=this._partitionProps(),i=this._writeEntry(this._storage,this._name,e,Ok);"written"===i&&this._rememberCurrentCookieProperties(e),"failed"!==i&&(this._localIdentityChangePending=!1,this._metaIdentifierChangePending.clear(),Dk.forEach(e=>{var t;(null===(t=Pk(e))||void 0===t?void 0:t.storageGroup)||this._pendingCrossTabFeatureFlagChanges.delete(e)})),"written"===i&&this._rememberMetaIdentifierStorageSnapshot();for(const e of Ik){var n;const i=t[e];if(Et(i)&&!(null===(n=this._slotState[e])||void 0===n?void 0:n.persisted)){Dk.forEach(t=>{var i;(null===(i=Pk(t))||void 0===i?void 0:i.storageGroup)===e&&this._pendingCrossTabFeatureFlagChanges.delete(t)});continue}const s=this._writeEntry(Ol,this._groupEntryName(e),i,e);"failed"!==s&&Dk.forEach(t=>{const i=Pk(t);(null==i?void 0:i.storageGroup)!==e||"written"!==s&&i.volatile||this._pendingCrossTabFeatureFlagChanges.delete(t)})}}_partitionProps(){const e={},t={flags:{},surveys:{}};return qr(this.props,(i,n)=>{var s;const r=null===(s=Pk(n))||void 0===s?void 0:s.storageGroup;r?t[r][n]=i:e[n]=i}),{main:e,groups:t}}_entryFingerprint(e,t){if(t===Ok)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;const i={};return qr(e,(e,t)=>{var n;i[t]=(null===(n=Pk(t))||void 0===n?void 0:n.volatile)?"__volatile__":e}),JSON.stringify(i)}_writeEntry(e,t,i,n){const s=this._slotWriteState(n);if(n!==Ok&&!s.dirty&&!It(s.fingerprint))return"skipped";let r;try{if(r=this._entryFingerprint(i,n),r===s.fingerprint)return s.dirty=!1,"skipped"}catch(e){r=void 0}return e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(s.dirty=!1,n!==Ok&&(s.persisted=!0),It(r)||(s.fingerprint=r),this._splitStorageEligible&&(s.storageValue=Ol._get(t)),"written"):(this._config.debug&&$r.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this._markAllCrossTabFeatureFlagChangesPending(),It(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!e&&this._ownsSplitStorage)for(const e of Ik)Ol._remove(this._groupEntryName(e));e?delete this._slotState[Ok]:this._slotState={},this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(xt(e)){this.syncCookieProperties(),It(t)&&(t="None"),this._expire_days=It(i)?this._default_expiry:i;let n=!1;if(qr(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),n=!0)}),n)return this.save(),!0}return!1}register(e,t){if(xt(e)){this.syncCookieProperties(),this._expire_days=It(t)?this._default_expiry:t;let i=!1;if(qr(e,(t,n)=>{e.hasOwnProperty(n)&&(this.props[n]!==t||xt(t)||kt(t))&&(this._setProp(n,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t="string"==typeof e?[e]:e;let i=!1;for(const e of t)e in this.props&&(this._deleteProp(e),i=!0);i&&this.save()}update_campaign_params(){const e=null==n?void 0:n.URL;if(e===this._campaign_params_url)return;const t=Mc(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties),i=!Et(Wr(t));return i&&this.register(t),this._campaign_params_url=e,i?t:void 0}update_search_keyword(){this.register(function(){const e=null==n?void 0:n.referrer;return e?Rc(e):{}}())}update_referrer_info(){var e;this.register_once({$referrer:Oc(),$referring_domain:(null==n?void 0:n.referrer)&&(null===(e=Jr(n.referrer))||void 0===e?void 0:e.host)||Lc},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=Dc(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes);this.register_once({[Fe]:this._storesIdentityInCookie?{r:Lk(e.r),u:e.u?Lk(e.u):void 0}:e},void 0)}get_initial_props(){const e={};qr([Re,Pe],t=>{const i=this.props[t];i&&qr(i,function(t,i){e["$initial_"+mt(i)]=t})});const t=this.props[Fe];if(t){const i=function(e,t=!1){const i=$c(e,t),n={};return qr(i,function(e,t){n[`$initial_${mt(t)}`]=e}),n}(t,this._config.disable_capture_url_hashes);Hr(e,i)}return e}safe_merge(e){return qr(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){const n=e.persistence!==t.persistence,s=!((e,t)=>{if(e.length!==t.length)return!1;const i=[...e].sort(),n=[...t].sort();return i.every((e,t)=>e===n[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=n||s,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!i,l=!!this._disabled&&!a;a||this._syncCookieProperties(t,l),this._config=e,!a&&(n||s||o)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._syncCookieProperties(ct(ct({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));const c=r||o?this._buildStorage(e):this._storage;this._truncateExistingPersonInfoForCookie();const u=this._resolveSplitStorage(e),d=r||u!==this._splitStorage,h=!a&&(d||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(l);this._storageMigrationInProgress=d;try{if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){const e=this.props;this.clear(),this._storage=c,this._splitStorage=u,this.props=e,this.save()}else o&&(this._storage=c,a||(delete this._slotState[Ok],this._writeNow()))}finally{this._storageMigrationInProgress=!1,h&&this._endCookieSyncSuppression()}}_truncateExistingPersonInfoForCookie(){const e=this.props[Fe];if(!this._storesIdentityInCookie||!xt(e)||"string"!=typeof e.r)return;const t=Lk(e.r),i="string"==typeof e.u?Lk(e.u):e.u;t===e.r&&i===e.u||this._setProp(Fe,ct(ct({},e),{},{r:t,u:i}))}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const i=this.props.__timers||{};i[e]=t,this._setProp(V,i),this.save()}remove_event_timer(e){const t=this.props.__timers||{},i=t[e];return It(i)||(delete t[e],this._setProp(V,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t,i=!0){var n;const s=this.props[e];this.props[e]=t,i&&("distinct_id"!==e&&"$user_state"!==e||s===t||(this._localIdentityChangePending=!0),Bk(e)&&!qk(s,t)&&this._metaIdentifierChangePending.add(e),this._markPendingCrossTabFeatureFlagChanges(e,s,t),(null===(n=Pk(e))||void 0===n?void 0:n.volatile)||this._markGroupDirty(e))}_deleteProp(e,t=!0){delete this.props[e],t&&($k(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),Bk(e)&&this._metaIdentifierChangePending.add(e),this._markGroupDirty(e))}_markGroupDirty(e){var t;const i=null===(t=Pk(e))||void 0===t?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}};const Wk=Nr("[RateLimiter]");var jk=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{const t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Wk.info(`${e||"events"} is quota limited.`),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Wk.warn(`could not rate limit - continuing. Error: "${null==e?void 0:e.message}"`,{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null===(e=this.instance.config.rate_limiting)||void 0===e?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null===(e=this.instance.config.rate_limiting)||void 0===e?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,i,n;const{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,o=(new Date).getTime(),a=null!==(t=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_property("$capture_rate_limit"))&&void 0!==t?t:{tokens:s,last:o};a.tokens+=Math.max(0,o-a.last)/1e3*r,a.last=Math.max(a.last,o),a.tokens>s&&(a.tokens=s);const l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){const e=(Ft(a.dropped)?a.dropped:0)+1;a.dropped=e,!this.lastEventRateLimited&&this._captureWarning(e)&&(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}}_isPropertyAllowed(e){const t=this.instance.config.property_denylist;return!kt(t)||!t.includes(e)}_triggeringPage(){var e;if(this._isPropertyAllowed("$current_url")&&this._isPropertyAllowed("$pathname")&&(null==s?void 0:s.pathname))return`${null!==(e=s.origin)&&void 0!==e?e:""}${s.pathname}`}_captureWarning(e){var t,i;const{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,r=this._triggeringPage(),o=this._isPropertyAllowed("$session_id")?null===(t=(i=this.instance).get_session_id)||void 0===t?void 0:t.call(i):void 0,a=[`${e} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${s} events per second and ${n} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}};const Vk=Nr("[RemoteConfig]");var Gk=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null===(e=d._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.config}_loadRemoteConfigJs(e){var t,i,n;(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.loadExternalDependency)?null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return Vk.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Vk.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(e=>{if(!e)return Vk.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(e=>{this._onRemoteConfig(e.json,e)});this._onRemoteConfig(e)})}catch(e){Vk.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||Vk.warn("Failed to fetch remote config from PostHog."):Vk.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){Vk.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null===(i=this._instance.featureFlags)||void 0===i||i.ensureFlagsLoaded()}catch(e){Vk.error("Error loading feature flags",e)}}};let Qk=!_b&&-1===(null==c?void 0:c.indexOf("MSIE"))&&-1===(null==c?void 0:c.indexOf("Mozilla"));function Kk(e,t,i){var n,s,r;i&&(t=ct(ct({},t),{},{callback:e=>i(e)})),e.__loaded?Qk?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null===(s=t.callback)||void 0===s||s.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=ct(ct({},e.config.request_headers),t.headers),t.compression="best-available"===t.compression?null!==(n=e.compression)&&void 0!==n?n:t.compressionFallback:t.compression,(It(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((e,t)=>{var i,n,s;const r=ct(ct({},e),{},{callback:null!=t?t:t=>{var i;return null===(i=e.callback)||void 0===i?void 0:i.call(e,t)}});r.timeout=r.timeout||6e4;const o=null!==(i=r.transport)&&void 0!==i?i:"fetch";"sendBeacon"===o&&It(r.compression)&&r.data&&(r.compression=jy),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(e=>{var t,i;const n=(kt(e)?e:[e]).map(e=>ct(ct({},e),e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})),s=n[0];return{api_key:null!==(t=null==s||null===(i=s.properties)||void 0===i?void 0:i.token)&&void 0!==t?t:null==s?void 0:s.token,batch:n,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((e,t=(new Date).toISOString())=>kt(e)?e.map(e=>ct(ct({},e),{},{sent_at:t})):ct(ct({},e),{},{sent_at:t}))(r.data))),r.url=Fb(r.url,r.method,r.compression,r.timestampMode);const a=Ab.filter(e=>!r.disableTransport||!e.transport||!r.disableTransport.includes(e.transport)),c=null!==(n=null===(s=function(e,t){for(let i=0;e.length>i;i++)if(t(e[i]))return e[i]}(a,e=>e.transport===o))||void 0===s?void 0:s.method)&&void 0!==n?n:a[0].method;if(!c)throw new Error("No available transport method");const u=e=>{try{c(e)}catch(e){var t;Ib(e)?$r.warn(e):$r.error(e),null===(t=r.callback)||void 0===t||t.call(r,{statusCode:0,error:e})}};"sendBeacon"!==o&&!r.preferSyncCompression&&r.data&&r.compression===Wy&&l&&"undefined"!=typeof Promise&&!yb?xb(r).then(e=>{u(e)}).catch(t=>{if(ps(t))return yb=!0,void u(ct(ct({},r),{},{compression:void 0,url:Fb(e.url,e.method,void 0,e.timestampMode)}));gs(t)&&(yb=!0),u(r)}):u(r)})(t,(n,s)=>{var r,o,a;e.rateLimiter.checkForLimiting(n),400>n.statusCode||null===(r=(o=e.config).on_request_error)||void 0===r||r.call(o,n),i?i(n,s):null===(a=t.callback)||void 0===a||a.call(t,n)})):t.fireCallbackOnDrop&&(null===(r=t.callback)||void 0===r||r.call(t,{statusCode:0}))}var Jk=class{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Kt((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,$r.createLogger("flush interval"),3e3),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();const e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this._sendRequestSafely(ct(ct({},e),{},{callback:void 0}),"sendBeacon")})}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){this._isPaused||(this._flushTimeout=setTimeout(()=>{this._clearFlushTimeout(),this._flush()},this._flushTimeoutMs))}_flush(){if(this._queue.length>0){const e=this._formatQueue();for(const t in e)this._sendRequestSafely(e[t])}}_sendRequestSafely(e,t){try{this._sendRequest(e,t)}catch(e){$r.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){const e={},t={};qr(this._queue,i=>{var n;const s=i,r=((s?s.batchKey:null)||s.url)+(s.batchGroup?`:${s.batchGroup}`:"");It(e[r])&&(e[r]=ct(ct({},s),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),t[r]=[]),null===(n=e[r].data)||void 0===n||n.push(s.data),s.callback&&t[r].push(s.callback)});for(const i in t){const n=t[i];n.length&&(e[i].callback=e=>{for(const t of n)t(e)})}return this._queue=[],e}};const Zk=["retriesPerformedSoFar"];var Yk=class{constructor(e){this._instance=e,this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._queue=[],this._areWeOnline=!0,this.resume()}resume(){if(!It(e)&&"onLine"in e.navigator){if(this._areWeOnline=e.navigator.onLine,this._onlineListener)return;this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},Qr(e,"online",this._onlineListener),Qr(e,"offline",this._offlineListener)}}get length(){return this._queue.length}retriableRequest(e,t){let{retriesPerformedSoFar:i}=e,n=bs(e,Zk);At(i)&&(n.url=Sb(n.url,{retry_count:i})),Kk(this._instance,t?ct(ct({},n),{},{transport:t}):n,(e,t)=>{var s;if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=i?i:0))return void this._enqueue(ct({retriesPerformedSoFar:i},n),t);0===e.statusCode&&$r.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,e)})}_enqueue(e,t){const i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;const n=Math.max(function(e){const t=3e3*Math.pow(2,e),i=t/2,n=Math.min(18e5,t),s=(Math.random()-.5)*(n-i);return Math.ceil(n+s)}(i),null!=t?t:0),s=Date.now()+n;this._queue.push({retryAt:s,requestOptions:e});let r=`Enqueued failed request for retry in ${n}`;navigator.onLine||(r+=" (Browser is offline)"),$r.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout(()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()},this._pollIntervalMs)}_flush(){const e=Date.now(),t=[],i=this._queue.filter(i=>e>i.retryAt||(t.push(i),!1));if(this._queue=t,i.length>0)for(const{requestOptions:e}of i)this.retriableRequest(e)}unload(){this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,It(e)||(this._onlineListener&&(e.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(e.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0));for(const{requestOptions:e}of this._queue)try{this._instance._send_request(ct(ct({},e),{},{callback:kt(e.data)?void 0:e.callback,transport:"sendBeacon"}))}catch(e){$r.error(e)}this._queue=[]}},Xk=class{constructor(e){this._instance=e,this._updateScrollData=()=>{var e,t,i,n;this._context||(this._context={});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._context.lastScrollY=Math.ceil(r),this._context.maxScrollY=Math.max(r,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(n=this._context.maxContentHeight)&&void 0!==n?n:0)}}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){const e=this._context;return this._context=void 0,setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){Qr(e,"scroll",this._updateScrollData,{capture:!0}),Qr(e,"scrollend",this._updateScrollData,{capture:!0}),Qr(e,"resize",this._updateScrollData)}scrollElement(){if(this._scrollRoot){const i=kt(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(const n of i){var t;const i=null==e||null===(t=e.document)||void 0===t?void 0:t.querySelector(n);if(i)return i}return}var i;return null==e||null===(i=e.document)||void 0===i?void 0:i.documentElement}_scrollPosition(t){var i,n;const s="y"===t?"scrollTop":"scrollLeft";if(this._scrollRoot){const e=this.scrollElement();return e&&e[s]||0}return e?"y"===t?e.scrollY||e.pageYOffset||(null===(i=e.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:e.scrollX||e.pageXOffset||(null===(n=e.document)||void 0===n||null===(n=n.documentElement)||void 0===n?void 0:n.scrollLeft)||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}};const eC=e=>Dc(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes);var tC=class{constructor(e,t,i,n){this._onSessionIdCallback=e=>{const t=this._getStored();if(t&&t.sessionId===e)return;const i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[Te]:i})},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=n||eC,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[Te]}getSetOnceProps(){var e;const t=null===(e=this._getStored())||void 0===e?void 0:e.props;return t?"r"in t?$c(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){const e={};return qr(Wr(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e[`$session_entry_${mt(i)}`]=t}),e}};const iC=Nr("[SessionId]"),nC=864e5;var sC=class{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var n;if(this._lastPersistedActivityTimestamp=null,this._lastCookieSyncTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new Gy,this._sessionHasBeenIdleTooLong=(e,t)=>!(!At(e)||!At(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._pendingBootstrapSession=void 0,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||Tl,this._windowIdGenerator=i||Tl;const s=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Kt(this._config.session_idle_timeout_seconds||1800,60,36e3,iC.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){const e=Kl._parse(this._window_id_storage_key),t=Kl._parse(this._primary_window_exists_storage_key);e&&!t?this._windowId=e:Kl._remove(this._window_id_storage_key),Kl._set(this._primary_window_exists_storage_key,!0)}(null===(n=this._config.bootstrap)||void 0===n?void 0:n.sessionID)&&this.setBootstrapSessionId(this._config.bootstrap.sessionID),this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return It(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(t=>t!==e)}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&Kl._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Kl._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Kl._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){const t=this._lastPersistedActivityTimestamp;return!Pt(t)&&!Pt(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){const n=t!==this._sessionActivityTimestamp,s=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,s&&!n||s&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[ce]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e;const t=null===(e=this._config)||void 0===e?void 0:e.persistence_save_debounce_ms;return At(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(ce):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(Pt(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this._lastPersistedActivityTimestamp)return;this._refreshSessionIdFromStorage();const[,t,i]=this._getSessionId();t===this._sessionId&&i===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[ce]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}_freshestActivityTimestamp(){const[e]=this._getSessionId(),t=At(e)?e:0,i=At(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){const e=this._persistence.props[ce];return kt(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,this._pendingBootstrapSession=void 0,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}setBootstrapSessionId(e,t=!1){const i=((e,t=(new Date).getTime())=>{try{const i=(e=>{const t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(e);return i>t+6e4?void iC.error("Bootstrap sessionID cannot be in the future"):i}catch(e){return void iC.error("Invalid sessionID in bootstrap",e)}})(e);return!It(i)&&(t?this._pendingBootstrapSession={sessionId:e,sessionStartTimestamp:i}:this._setSessionId(e,(new Date).getTime(),i),!0)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&e&&(e.removeEventListener(Xe,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Kl._remove(this._primary_window_exists_storage_key)},Qr(e,Xe,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,i=!1){if("always"===this._config.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const n=t||(new Date).getTime(),s=this._sessionId;if(i)this._lastCookieSyncTimestamp=n;else if(Pt(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>n||n-this._lastCookieSyncTimestamp>=1e3){var r,o;null===(r=(o=this._persistence).syncCookieProperties)||void 0===r||r.call(o),this._lastCookieSyncTimestamp=n}let[,a,l]=this._getSessionId();const c=!It(s)&&a!==s,u=this._freshestActivityTimestamp();let d=this._getWindowId();const h=this._pendingBootstrapSession,p=!!h&&(h.sessionStartTimestamp>n+6e4||n-h.sessionStartTimestamp>nC),g=h?p:At(l)&&Math.abs(n-l)>nC;let _=!1,f=c,v=!a||!!h;const m=a;let y=!v&&!e&&this._sessionHasBeenIdleTooLong(n,u);if(y&&(y=this._isSessionIdleAfterCrossTabRefresh(n),y||iC.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this._getSessionId(),y||(v=!a||!!h)),v||y||g){f=!1;const e=h&&!p;a=e?h.sessionId:this._sessionIdGenerator(),d=this._windowIdGenerator(),iC.info("new session ID assigned",{sessionId:a,windowId:d,bootstrapped:!!e,changeReason:{noSessionId:v,activityTimeout:y,sessionPastMaximumLength:g}}),l=e?h.sessionStartTimestamp:n,this._pendingBootstrapSession=void 0,_=!0}else d||(d=this._windowIdGenerator(),_=!0),f=f||a!==m,f&&(iC.info("adopted cross-tab session id",{sessionId:a,windowId:d}),_=!0);const b=At(u)&&e&&!g?u:n,S=At(l)?l:(new Date).getTime();this._setWindowId(d),this._setSessionId(a,b,S),e||this._resetIdleTimer();const w={noSessionId:v,activityTimeout:y,sessionPastMaximumLength:g,crossTabAdoption:f};return _&&this._sessionIdChangedHandlers.forEach(e=>e(a,d,w)),{sessionId:a,windowId:d,sessionStartTimestamp:S,changeReason:_?w:void 0,lastActivityTimestamp:u}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){const e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()},1.1*this.sessionTimeoutMs))}};const rC=Object.freeze(["2026-08-30","2026-08-29","2026-06-25","2026-05-30","2026-01-30","2025-11-30","2025-05-24"]),oC=function(e,t){if(!e)return!1;const i=e.userAgent;if(i&&Qt(i,t))return!0;try{const i=null==e?void 0:e.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(e=>Qt(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver};function aC(){return aC=rt(function*(){const e=null==i?void 0:i.userAgentData;if(null==e?void 0:e.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return Tt(i)&&i.length>0?i:void 0}catch(e){return void $r.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}}),aC.apply(this,arguments)}const lC="custom",cC="i.posthog.com",uC=/^\/static\//,dC=["/s/","/e/","/i/"];var hC=class{constructor(e){this._regionCache={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${cC}`,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":lC),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(!uC.test(e))return;const t=this.instance.config.asset_host;return"string"==typeof t&&t.trim().replace(/\/$/,"")||void 0}_urlKey(e){const t=Jr(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,i){if("ui"===e)return i;let n=i;const s=this.instance.config.rewriteRequestPath;if(s){var r;const e=(null===(r=Jr(i))||void 0===r?void 0:r.href)||i;n=s(new URL(e)).toString()}if(s&&"api"===e&&dC.some(e=>0===t.indexOf(e))){const e=this._urlKey(n);if(e){const t=this.apiHost;let i=this._ingestionEndpoints;(null==i?void 0:i.apiHost)===t&&i.rewriteRequestPath===s||(i={apiHost:t,rewriteRequestPath:s,urls:new Set},this._ingestionEndpoints=i),i.urls.add(e)}}return n}isIngestionEndpoint(e){const t=this._ingestionEndpoints,i=this._urlKey(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t=""){if(t&&(t="/"===t[0]?t:`/${t}`),"ui"===e)return this._prepareEndpoint(e,t,this.uiHost+t);if("flags"===e)return this._prepareEndpoint(e,t,this.flagsApiHost+t);if("assets"===e){const i=this._staticAssetHostOverride(t);if(i)return this._prepareEndpoint(e,t,`${i}${t}`)}if(this.region===lC)return this._prepareEndpoint(e,t,this.apiHost+t);const i=cC+t;switch(e){case"assets":return this._prepareEndpoint(e,t,`https://${this.region}-assets.${i}`);case"api":return this._prepareEndpoint(e,t,`https://${this.region}.${i}`)}}};const pC=Nr("[PostHog ExternalIntegrations]"),gC={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var _C=class{constructor(e){this._instance=e}_loadScript(e,t){var i,n;null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,e,e=>{if(e)return pC.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e;for(const[s,r]of Object.entries(null!==(e=this._instance.config.integrations)&&void 0!==e?e:{})){var t,i,n;r&&!(null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t?void 0:t[s])&&this._loadScript(gC[s],()=>{var e;null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e||null===(e=e[s])||void 0===e||e.start(this._instance)}),!r&&(null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[s])&&(null===(n=d.__PosthogExtensions__)||void 0===n||null===(n=n.integrations)||void 0===n||null===(n=n[s])||void 0===n||n.stop())}}};const fC={};let vC=0;const mC=()=>{},yC='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',bC="Surveys module not available",SC="sanitize_properties is deprecated. Use before_send instead",wC="Invalid value for property_denylist config: ",kC=["$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"],CC=["$feature_flag_called","$$heatmap","$snapshot"],xC=e=>"$"===e.charAt(0)&&!ft(CC,e),EC=/^[A-Za-z0-9_-]{1,400}$/,IC=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,TC=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,MC=["token","distinct_id",Oe],PC="posthog",RC=[...rC].sort()[rC.length-1],FC=e=>{const t={};return e&&"unset"!==e?("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0),t):t},AC=t=>{var i;return ct({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Gr(null==n?void 0:n.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:mC,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_replay_sync_fetch:!0,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&Tt(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==e||null===(i=e.location)||void 0===i?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(e){$r.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Ye,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:mC},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Eo,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:FC(e),external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e),cookieWinsOnConflict:!(!e||"unset"===e||"2026-08-29">e)}))(t))},LC=[["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"]],OC=e=>{const t={};for(const[i,n]of LC)It(e[i])||(t[n]=e[i]);const i=Hr({},t,e),n=e.__preview_external_dependency_versioned_paths;return It(n)||(It(e.strict_script_versioning)&&(i.strict_script_versioning=!!n),Tt(n)&&It(e.asset_host)&&(i.asset_host=n)),kt(e.property_blacklist)&&(It(e.property_denylist)?i.property_denylist=e.property_blacklist:kt(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:$r.error(wC+e.property_denylist)),i};var DC=class{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){$r.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},$C=class t{_removeExtension(e){if(!e)return;const t=this._extensions.indexOf(e);-1!==t&&this._extensions.splice(t,1)}_replaceExtension(e,t){var i;return this._removeExtension(e),this._extensions.push(t),null===(i=t.initialize)||void 0===i||i.call(t),t}_inCookielessMode(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}_warnIfVolatileIdentityWithoutStableId(){if(this._hasWarnedAboutVolatileIdentity)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this._inCookielessMode())return;const e="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!e&&!this.config.disable_persistence)return;if(this._hasStableInitialDistinctId)return;let t,i,n;e?(t=`persistence is set to '${this.config.persistence}'`,i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",n="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",i="on every page load",n="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._hasWarnedAboutVolatileIdentity=!0,console.warn("[PostHog.js]",`${t} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${n}`)}_syncCookielessIdentity(){const e=this.persistence;if(!e||this._isConsentTransition)return;if(this._inCookielessMode())return void("on_reject"===this.config.cookieless_mode&&"$posthog_cookieless"!==this.get_distinct_id()&&(this._sync_opt_out_with_persistence(),this._enterCookielessMode()));if("$posthog_cookieless"!==this.get_distinct_id())return;this._is_persistence_disabled()||e.load(!0);const t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){const t=this.config.get_device_id(Tl());this.register({distinct_id:t,$device_id:t}),e.set_property(Ie,Je)}this._sync_opt_out_with_persistence()}get decideEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this._isPageUnloading=!1,this._isShutdown=!1,this.webPerformance=new DC,this._personProcessingSetOncePropertiesSent=!1,this.version=Jl.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new Gy,this._extensions=[],this._extensionEventPropertyProducers=[],this._replayDebugPropertiesPaused=!1,this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._isConsentTransition=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=AC(),this.SentryIntegration=xk,this.sentryIntegration=e=>function(e,t){const i=Ck(e,t);return{name:kk,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new Xk(this),this.pageViewManager=new Ek(this),this.rateLimiter=new jk(this),this.requestRouter=new hC(this),this.consent=new fk(this),this.externalIntegrations=new _C(this);const i=null!==(e=t.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{const n=Tt(e)?{[e]:t}:e;this.setPersonProperties(n),null==i||i({})},set_once:(e,t,i)=>{const n=Tt(e)?{[e]:t}:e;this.setPersonProperties(void 0,n),null==i||i({})}},this.on("eventCaptured",e=>$r.info(`send "${null==e?void 0:e.event}"`,e))}init(e,i,n){if(n&&n!==PC){var s;const r=null!==(s=fC[n])&&void 0!==s?s:new t;return r._init(e,i,n),fC[n]=r,fC[PC][n]=r,r}return this._init(e,i,n)}_init(t,i={},n){var s,r,o;const a=Tt(t)?t.trim():"";if(!a)return $r.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=AC(i.defaults),i.debug=this._checkLocalStorageForDebug(i.debug),this._originalUserConfig=i,this._triggered_notifs=[],i.person_profiles?this._initialPersonProfilesConfig=i.person_profiles:i.process_person&&(this._initialPersonProfilesConfig=i.process_person);const c=AC(i.defaults),u=OC(i),d=Hr({},c,u,{name:n,token:a});xt(c.rageclick)&&xt(u.rageclick)&&(d.rageclick=Hr({},c.rageclick,u.rageclick)),xt(c.session_recording)&&xt(u.session_recording)&&(d.session_recording=Hr({},c.session_recording,u.session_recording)),this.set_config(d),this.config.on_xhr_error&&$r.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Wy;const h=this._is_persistence_disabled(),p=!this._inCookielessMode();if(this.persistence=new Uk(this.config,h,!0,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Uk(ct(ct({},this.config),{},{persistence:"sessionStorage"}),h,!1,p),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!h&&Kl._is_supported()){const e=Kl._parse(this._sessionRegisteredPropertiesStorageKey);kt(e)&&e.forEach(e=>{Tt(e)&&this._sessionRegisteredPropKeys.add(e)})}else Kl._remove(this._sessionRegisteredPropertiesStorageKey);const g=ct({},this.persistence.props),_=ct({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new Jk((e,t)=>this._send_retriable_request(e,t),this.config.request_queue_config),this._retryQueue=new Yk(this),this.__request_queue=[];const f=this._inCookielessMode();f||(this.sessionManager=new sC(this),this.sessionPropsManager=new tC(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this._clearSessionRegisteredProps()})),this._enrollFeatureFlags(),this.config.__preview_deferred_init_extensions?($r.info("Deferring extension initialization to improve startup performance"),this._extensionInitTimeout=setTimeout(()=>{this._extensionInitTimeout=void 0,this._initExtensions(f)},0)):($r.info("Initializing extensions synchronously"),this._initExtensions(f)),Jl.DEBUG=Jl.DEBUG||this.config.debug,Jl.DEBUG&&$r.info("Starting in debug mode",{this:this,config:i,thisC:ct({},this.config),p:g,s:_}),this.config.identity_distinct_id&&!(null===(s=i.bootstrap)||void 0===s?void 0:s.distinctID)&&(i.bootstrap=ct(ct({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const v=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this._hasStableInitialDistinctId=!!v&&!Mt(v),null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID){const e=i.bootstrap.distinctID,t=this.get_distinct_id(),n=this.persistence.get_property(Ie);if(i.bootstrap.isIdentifiedID&&null!=t&&t!==e&&"anonymous"===n)this.identify(e);else if(i.bootstrap.isIdentifiedID&&null!=t&&t!==e&&"identified"===n)$r.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const t=this.config.get_device_id(Tl()),n=i.bootstrap.isIdentifiedID?t:e;this.persistence.set_property(Ie,i.bootstrap.isIdentifiedID?Ze:Je),this.register({distinct_id:e,$device_id:n})}}if(f)this.register_once({distinct_id:Le,$device_id:null},"");else if(!this.get_distinct_id()){const e=this.config.get_device_id(Tl());this.register_once({distinct_id:e,$device_id:e},""),this.persistence.set_property(Ie,Je)}return Qr(e,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Qr(e,"pageshow",e=>{if(this._isPageUnloading=!1,!this._isShutdown){var t;if(e.persisted&&this.persistence){const e=this.persistence.get_property(D),t=this.persistence.get_property(Ie);this.persistence.load(),this._processCookieIdentityChange()||e===this.persistence.get_property("distinct_id")&&t===this.persistence.get_property("$user_state")||this._processIdentityChange()}null===(t=this._retryQueue)||void 0===t||t.resume()}}),i.segment?wk(this,()=>this._loaded()):this._loaded(),Ct(this.config._onCapture)&&this.config._onCapture!==mC&&($r.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&$r.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 aC.apply(this,arguments)}().then(e=>{e&&this.register({[B]:e})}).catch(mC),this}_isSharedExtension(e){const t=e;return Tt(t.name)&&Ct(t.setup)}_enrollExtension(e,t){var i=this;this._isSharedExtension(e)?t.push(rt(function*(){try{yield e.setup(i._getBrowserClientAdapter())}catch(i){$r.error(`Failed to set up extension "${e.name}"`,i);try{var t;yield null===(t=e.dispose)||void 0===t?void 0:t.call(e)}catch(t){$r.error(`Failed to dispose extension "${e.name}"`,t)}}})):this._extensions.push(e)}_enrollFeatureFlags(){var e,i,n,s=this;const r=null!==(e=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==e?e:null===(n=t.__defaultExtensionClasses)||void 0===n?void 0:n.featureFlags;var o,a,l;if(r)if(this.featureFlags&&this.featureFlags instanceof r||(null===(o=this._featureFlagsReloadingUnsubscribe)||void 0===o||o.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new r(this)),Ct(this.featureFlags.onReloading)&&Ct(this.featureFlags.setup)){if(!this._featureFlagsReloadingUnsubscribe){this._featureFlagsReloadingUnsubscribe=this.featureFlags.onReloading(()=>{this._internalEventEmitter.emit("featureFlagsReloading",!0)});const e=this.featureFlags;rt(function*(){try{yield e.setup(s._getBrowserClientAdapter())}catch(t){$r.error("Failed to set up feature flags",t);const i=s._featureFlagsReloadingUnsubscribe;s._featureFlagsReloadingUnsubscribe=void 0;try{null==i||i()}catch(e){$r.error("Failed to unsubscribe feature flag reloading",e)}try{yield e.dispose()}catch(e){$r.error("Failed to dispose feature flags",e)}}})()}}else null===(a=(l=this.featureFlags).initialize)||void 0===a||a.call(l)}_initExtensions(e){const i=performance.now(),n=ct(ct({},t.__defaultExtensionClasses),this.config.__extensionClasses),s=[];var r,o,a,l,c,u,d,h;n.exceptions&&this._extensions.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new n.exceptions(this)),n.historyAutocapture&&this._extensions.push(this.historyAutocapture=new n.historyAutocapture(this)),n.tracingHeaders&&this._extensions.push(this.tracingHeaders=new n.tracingHeaders(this)),n.siteApps&&this._extensions.push(this.siteApps=new n.siteApps(this)),n.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new n.sessionRecording(this)),this.config.disable_scroll_properties||s.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),n.autocapture&&this._enrollExtension(this.autocapture=new n.autocapture(this),s),n.surveys&&this._enrollExtension(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new n.surveys(this),s),n.logs&&this._enrollExtension(this.logs=null!==(a=this.logs)&&void 0!==a?a:new n.logs(this),s),n.metrics&&this._extensions.push(this.metrics=null!==(l=this.metrics)&&void 0!==l?l:new n.metrics(this)),n.conversations&&this._extensions.push(this.conversations=null!==(c=this.conversations)&&void 0!==c?c:new n.conversations(this)),n.productTours&&this._extensions.push(this.productTours=new n.productTours(this)),n.heatmaps&&this._extensions.push(this.heatmaps=new n.heatmaps(this)),n.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new n.webVitalsAutocapture(this)),n.exceptionObserver&&this._extensions.push(this.exceptionObserver=new n.exceptionObserver(this)),n.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new n.deadClicksAutocapture(this,yk)),n.toolbar&&this._extensions.push(this.toolbar=null!==(u=this.toolbar)&&void 0!==u?u:new n.toolbar(this)),n.experiments&&this._extensions.push(this.experiments=null!==(d=this.experiments)&&void 0!==d?d:new n.experiments(this)),n.webMCP&&this._extensions.push(this.webMCP=null!==(h=this.webMCP)&&void 0!==h?h:new n.webMCP(this)),this._extensions.forEach(e=>{e.initialize&&s.push(()=>{var t;null===(t=e.initialize)||void 0===t||t.call(e)})}),s.push(()=>{if(this._pendingRemoteConfig){const e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach(t=>{var i;return null===(i=t.onRemoteConfig)||void 0===i?void 0:i.call(t,e)})}}),this._processInitTaskQueue(s,i)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void(this._extensionInitTimeout=setTimeout(()=>{this._extensionInitTimeout=void 0,this._processInitTaskQueue(e,t)},0));const i=e.shift();if(i)try{i()}catch(e){$r.error("Error initializing extension:",e)}}const i=Math.round(performance.now()-t);this.register_for_session({[De]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[$e]:i}),this.config.__preview_deferred_init_extensions&&$r.info(`PostHog extensions initialized (${i}ms)`)}_onRemoteConfig(e){if(!n||!n.body)return $r.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(e)},500);if(this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.ok){var t;const i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=ft(i.supportedCompression,Wy)?Wy:ft(i.supportedCompression,jy)?jy:void 0),(null===(t=i.analytics)||void 0===t?void 0:t.endpoint)&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Ye}),this._internalEventEmitter.emit("extensionsRemoteConfig",e),this._extensions.forEach(t=>{var i;return null===(i=t.onRemoteConfig)||void 0===i?void 0:i.call(t,e)})}_loaded(){try{this.config.loaded(this)}catch(e){$r.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&(null==s?void 0:s.hostname)){const e=s.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()},1),this._remoteConfigLoader=new Gk(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null===(e=this._requestQueue)||void 0===e||e.enable())}_dom_loaded(){this.is_capturing()&&Br(this.__request_queue,e=>this._send_retriable_request(e)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,n,s,r;this._isPageUnloading=!0,null===(e=this.surveys)||void 0===e||null===(t=e.handlePageUnload)||void 0===t||t.call(e),null===(i=this.metrics)||void 0===i||i.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(tt),null===(n=this.logs)||void 0===n||n.flushLogs("sendBeacon"),null===(s=this._requestQueue)||void 0===s||s.unload(),null===(r=this._retryQueue)||void 0===r||r.unload()):this._shouldCapturePageleave()&&this.capture(tt,null,{transport:"sendBeacon"})}_send_request(e){Kk(this,e)}_send_retriable_request(e,t){this._retryQueue?this._retryQueue.retriableRequest(e,t):this._send_request(t?ct(ct({},e),{},{transport:t}):e)}_execute_array(e){vC++;try{let t;const i=[],n=[],s=[];Br(e,e=>{if(e)if(t=e[0],kt(t))s.push(e);else if(Ct(e))try{e.call(this)}catch(t){$r.error("Error executing queued PostHog call",e,t)}else kt(e)&&"alias"===t?i.push(e):kt(e)&&-1!==t.indexOf("capture")&&Ct(this[t])?s.push(e):n.push(e)});const r=function(e,t){Br(e,function(e){try{if(kt(e[0])){let i=t;qr(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){$r.error("Error executing queued PostHog call",e,t)}})};r(i,this),r(n,this),r(s,this)}finally{vC--}}push(e){if(vC>0&&kt(e)&&Tt(e[0])){const i=t.prototype[e[0]];return void(Ct(i)&&i.apply(this,e.slice(1)))}this._execute_array([e])}get _facebookClickIdChannel(){return{property:z,persistenceKey:U,cookieName:"_fbc",pattern:IC,register:(e,t)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[U]:{value:e,delivered:t}})},unregister:()=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.unregister(U)}}}get _facebookBrowserIdChannel(){return{property:W,persistenceKey:j,cookieName:"_fbp",pattern:TC,register:(e,t)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[j]:{value:e,delivered:t}})},unregister:()=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.unregister(j)}}}_getPersistedMetaIdentifier(e){var t;const i=null===(t=this.persistence)||void 0===t?void 0:t.get_property(e.persistenceKey);return Tt(i)&&e.pattern.test(i)?{value:i,delivered:!1}:xt(i)&&Tt(i.value)&&e.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}_storeMetaIdentifier(e,t,i){return t===(null==i?void 0:i.value)?{value:t,pending:!i.delivered}:(e.register(t,!1),{value:t,pending:!0})}_readMetaCookie(e){if(!this.config.save_campaign_params||this._inCookielessMode())return;const t=Sl(e.cookieName);return Tt(t)&&e.pattern.test(t)?t:void 0}_updateFacebookClickId(e,t,i,n){if(!this.persistence)return;const s=this._facebookClickIdChannel;this.persistence.refreshMetaIdentifiers();const r=this._getPersistedMetaIdentifier(s);if(n)return void s.unregister();if(i)return Tt(t)&&IC.test(t)?this._storeMetaIdentifier(s,t,r):void s.unregister();const o=Tt(e)&&EC.test(e)?e:void 0,a=this._readMetaCookie(s);return a&&((e,t,i)=>{const n=e.split(".");if(t)return n[3]===t;if(!i)return!0;const s=i.value.split(".");return n[3]===s[3]||Number(n[2])>Number(s[2])})(a,o,r)?this._storeMetaIdentifier(s,a,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this._storeMetaIdentifier(s,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}_updateFacebookBrowserId(e,t,i){if(!this.persistence)return;const n=this._facebookBrowserIdChannel;this.persistence.refreshMetaIdentifiers();const s=this._getPersistedMetaIdentifier(n);if(i)return void n.unregister();if(t)return Tt(e)&&TC.test(e)?this._storeMetaIdentifier(n,e,s):void n.unregister();const r=this._readMetaCookie(n);return r?this._storeMetaIdentifier(n,r,s):s?{value:s.value,pending:!s.delivered}:void 0}_markMetaIdentifierDelivered(e,t){if(!this.persistence)return;this.persistence.refreshMetaIdentifiers();const i=this._getPersistedMetaIdentifier(e);(null==i?void 0:i.value)!==t||i.delivered||e.register(t,!0)}capture(e,t,i){var n,s;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue))return void $r.uninitializedWarning("posthog.capture");if(!this.is_capturing())return void $r.info(`Event "${e}" was not captured because capturing is disabled (opted out or consent pending).`);if(It(e)||!Tt(e))return void $r.error("No event name provided to posthog.capture");if(this._syncCookielessIdentity(),"$snapshot"===e&&this._inCookielessMode())return;const r=!this.config.opt_out_useragent_filter&&this._is_bot();if(r&&!this.config.__preview_capture_bot_pageviews)return void $r.info(`Event "${e}" was not captured because the user agent looks like a bot. Set \`opt_out_useragent_filter: true\` to capture it.`);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 $r.critical("This capture call is ignored due to client rate limiting.");let a;(null==t?void 0:t.$current_url)&&!Tt(null==t?void 0:t.$current_url)&&($r.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||(null==i?void 0:i._originatedFromCaptureException)||$r.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(a=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const l=new Date,c=(null==i?void 0:i.timestamp)||l,u=ln(null==i?void 0:i.uuid,Tl);let d={uuid:u,event:e,properties:this.calculateEventProperties(e,t||{},c,u)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&r&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),o&&(d.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens);const h="$feature_flag_called"===e&&!1===d.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!h&&(d.$set=null==i?void 0:i.$set);const p=xt(null==t?void 0:t.$set)?t.$set:void 0,g=kt(null==t?void 0:t.$unset)?t.$unset:[],_=(null==i?void 0:i.$unset)||[],f=e=>{var t;const n=!!(null==i?void 0:i.$set)&&e in i.$set;return{hasProvided:n||!!p&&e in p,provided:n?null==i||null===(t=i.$set)||void 0===t?void 0:t[e]:null==p?void 0:p[e],unset:-1!==g.indexOf(e)||-1!==_.indexOf(e)}},v=f(z),m=f(W),y=[{channel:this._facebookClickIdChannel,hasProvided:v.hasProvided,update:this._updateFacebookClickId(null==a?void 0:a.fbclid,v.provided,v.hasProvided,v.unset)},{channel:this._facebookBrowserIdChannel,hasProvided:m.hasProvided,update:this._updateFacebookBrowserId(m.provided,m.hasProvided,m.unset)}];for(const{channel:e,hasProvided:t,update:i}of y)i&&!0===d.properties.$process_person_profile&&i.pending&&!t&&!h&&(d.$set=ct({[e.property]:i.value},d.$set));const b=null==i?void 0:i.$unset;b&&(d.$unset=b);const S=h?void 0:this._calculate_set_once_properties(null==i?void 0:i.$set_once,e!==nt,e===it);if(S&&(d.$set_once=S),(null==i?void 0:i._noTruncate)||(w=this.config.properties_string_max_length,d=function(e,t){const i=new Set;return function e(n,s){if(n!==Object(n))return t?t(n):n;if(i.has(n))return;let r;if(i.add(n),kt(n))r=[],Br(n,t=>{r.push(e(t))});else{const t={};qr(qt(n)?jr(n):n,(n,s)=>{i.has(n)||(t[s]=e(n,s))}),r=t}return r}(e)}(d,e=>Tt(e)?e.slice(0,w):e)),d.timestamp=c,It(null==i?void 0:i.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=l),h&&(d.properties=((e,t=[])=>{const i={},n=t=>{void 0!==e[t]&&(i[t]=e[t])};return cs.forEach(n),t.forEach(n),i})(d.properties,MC)),e===Gf||e===Qf){const i=null==t?void 0:t[Kf],n=null==t?void 0:t[Zf];lv({id:i,current_iteration:n}),d.$set=ct(ct({},d.$set),{},{[nc({id:i,current_iteration:n},e===Qf?"responded":"dismissed")]:!0})}else e===Vf&&(d.$set=ct(ct({},d.$set),{},{[Xf]:(new Date).toISOString()}));var w;if("product tour shown"===e){const e=null==t?void 0:t.$product_tour_type;e&&(d.$set=ct(ct({},d.$set),{},{[`$product_tour_last_seen_date/${e}`]:(new Date).toISOString()}))}const k=ct(ct({},d.properties.$set),d.$set);if(Et(k)||this.setPersonPropertiesForFlags(k),!Rt(this.config.before_send)){const e=this._runBeforeSend(d);if(!e)return;d=e,d.uuid=ln(d.uuid,Tl)}this.sessionRecording&&!this._replayDebugPropertiesPaused&&xC(e)&&(this._replayDebugPropertiesPaused=!0,setTimeout(()=>this._replayDebugPropertiesPaused=!1,3e4));const C=y.filter(({channel:e,update:t})=>{var i,n,s;const r=null!==(i=null===(n=d.$set)||void 0===n?void 0:n[e.property])&&void 0!==i?i:xt(null===(s=d.properties)||void 0===s?void 0:s.$set)?d.properties.$set[e.property]:void 0;return(null==t?void 0:t.pending)&&r===t.value});this._internalEventEmitter.emit("eventCaptured",d);const x=null!==(n=null==i?void 0:i._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),E="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(x),I=ct(ct(ct({method:"POST",url:x,data:d,compression:"best-available",preferSyncCompression:null==i?void 0:i.send_instantly,timestampMode:E?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},E&&(null===(s=d.properties)||void 0===s?void 0:s.$session_id)?{batchGroup:d.properties.$session_id+(d.properties.$window_id?`-${d.properties.$window_id}`:"")}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),C.length?{fireCallbackOnDrop:!0,callback:e=>{if(e.statusCode>=200&&300>e.statusCode)for(const{channel:e,update:t}of C)this._markMetaIdentifierDelivered(e,t.value)}}:{});if(!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)){var T;let e;!I.transport&&!I.callback&&Et(null!==(T=this.config.request_headers)&&void 0!==T?T:{})&&this._isPageUnloading&&(e="sendBeacon"),this._send_retriable_request(I,e)}else this._requestQueue.enqueue(I);return d}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return null===(t=this._browserClientAdapter)||void 0===t?void 0:t.getExtension(e)}_getBrowserClientAdapter(){var e;return null!==(e=this._browserClientAdapter)&&void 0!==e?e:this._browserClientAdapter=new Ob(this)}_registerExtensionEventProperties(e){this._extensionEventPropertyProducers.push(e);let t=!0;return()=>{if(!t)return;t=!1;const i=this._extensionEventPropertyProducers.indexOf(e);-1!==i&&this._extensionEventPropertyProducers.splice(i,1)}}_processCookieIdentityChange(e=!0){var t;return!!(null===(t=this.persistence)||void 0===t?void 0:t.consumeCookieIdentityChange())&&(this._processIdentityChange(e),!0)}_processIdentityChange(e=!0){var t,i,n;this._cachedPersonProperties=null,"anonymous"===(null===(t=this.persistence)||void 0===t?void 0:t.get_property("$user_state"))&&(null===(n=this.sessionPersistence)||void 0===n||n.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null===(i=this.featureFlags)||void 0===i||i.reset(),e&&this.reloadFeatureFlags()}calculateEventProperties(t,i,r,o,a){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this._syncCookielessIdentity(),this.persistence.syncCookieProperties(),this._processCookieIdentityChange();const l=a?void 0:this.persistence.remove_event_timer(t);let u=ct({},i);if(u.token=this.config.token,u.$config_defaults="latest"===this.config.defaults?RC:this.config.defaults,this._inCookielessMode()&&(u[Oe]=!0),"$snapshot"===t){const e=ct(ct({},this.persistence.properties()),this.sessionPersistence.properties());return u.distinct_id=e.distinct_id,(!Tt(u.distinct_id)&&!Ft(u.distinct_id)||Mt(u.distinct_id))&&$r.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}const d=function(t,i,n,r=!1){var o,a,l,u;if(!c)return{};const d=t?[...xc,...i||[]]:[],[h,p]=Ki(c),[g,_]=function(e){for(let t=0;Xi.length>t;t++){const[i,n,s]=Xi[t],r=e.match(i);if(r){const t=s&&e.match(s)||r;return[n,(null==t?void 0:t[1])||""]}}return["",""]}(c),f=function(){const e="u">typeof navigator?navigator:void 0;return(null==e?void 0:e.brave)?{brave:!0}:{}}(),v={};It(n)||(v.detectGoogleSearchApp=n);const m={},y=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,b=null===(a=navigator)||void 0===a?void 0:a.maxTouchPoints,S=null==e||null===(l=e.screen)||void 0===l?void 0:l.width,w=null==e||null===(u=e.screen)||void 0===u?void 0:u.height,k=null==e?void 0:e.devicePixelRatio;It(y)||(m.userAgentDataPlatform=y),It(b)||(m.maxTouchPoints=b),It(S)||(m.screenWidth=S),It(w)||(m.screenHeight=w),It(k)||(m.devicePixelRatio=k);const C=Hr(Wr({$os:h,$os_version:p,$browser:ji(c,navigator.vendor,f,v),$webview_app:g,$webview_app_version:_,$device:Ji(c),$device_type:Zi(c,m),$timezone:Cc(),$timezone_offset:Nc()}),{$current_url:so(r?un(null==s?void 0:s.href):null==s?void 0:s.href,d,Ic),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:c.length>1e3?c.substring(0,997)+"...":c,$browser_version:Gi(c,navigator.vendor,f,v),$browser_language:Fc(),$browser_language_prefix:Ac(),$screen_height:null==e?void 0:e.screen.height,$screen_width:null==e?void 0:e.screen.width,$viewport_height:null==e?void 0:e.innerHeight,$viewport_width:null==e?void 0:e.innerWidth,$lib:Or.LIB_NAME,$lib_version:Or.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Or.SDK_DIST_CHANNEL&&(C.$sdk_dist_channel=Or.SDK_DIST_CHANNEL),C}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:e,windowId:t}=this.sessionManager.checkAndGetSessionAndWindowId(a,r.getTime(),!0);u.$session_id=e,u.$window_id=t}this.sessionPropsManager&&Hr(u,this.sessionPropsManager.getSessionProps());try{var h;if(this.sessionRecording){const e=this.sessionRecording.sdkDebugProperties,i=!this._replayDebugPropertiesPaused&&xC(t);for(const t in e)(i||ft(kC,t))&&(u[t]=e[t])}u.$sdk_debug_retry_queue_size=null===(h=this._retryQueue)||void 0===h?void 0:h.length}catch(e){u.$sdk_debug_error_capturing_properties=String(e)}let p;if(this.requestRouter.region===lC&&(u.$lib_custom_api_host=this.config.api_host),p="$pageview"!==t||a?"$pageleave"!==t||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),u=Hr(u,p),"$pageview"===t&&n&&(u.title=n.title),!It(l)){const e=r.getTime()-l;u.$duration=parseFloat((e/1e3).toFixed(3))}c&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");const g=this.persistence.properties(),_=this.sessionPersistence.properties(),f=u.$groups,v=g.$groups;xt(f)&&!Et(f)&&(u.$groups=ct(ct({},xt(v)?v:{}),f)),qr(["$referrer","$referring_domain"],e=>{e in g&&delete _[e]});const m={};if(this._extensionEventPropertyProducers.length>0)for(const e of this._extensionEventPropertyProducers.slice())try{Hr(m,e())}catch(e){$r.error("Failed to produce browser extension event properties",e)}u=Hr({},d,g,_,ct(ct({},m),u)),u.$is_identified=this._isIdentified(),kt(this.config.property_denylist)?qr(this.config.property_denylist,function(e){delete u[e]}):$r.error(wC+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const y=this.config.sanitize_properties;y&&($r.error(SC),u=y(u,t));const b=this._hasPersonProcessing();return u.$process_person_profile=b,b&&!a&&this._requirePersonProcessing("_calculate_event_properties"),u}_calculate_set_once_properties(e,t=!0,i=!1){var n;if(!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;const s=this.persistence.get_initial_props(),r=null===(n=this.sessionPropsManager)||void 0===n?void 0:n.getSetOnceProps();let o=Hr({},s,r||{},e||{});const a=this.config.sanitize_properties;return a&&($r.error(SC),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),Et(o)?void 0:o}register(e,t){var i;null===(i=this.persistence)||void 0===i||i.register(e,t)}register_once(e,t,i){var n;null===(n=this.persistence)||void 0===n||n.register_once(e,t,i)}register_for_session(e){var t,i;null===(t=this.persistence)||void 0===t||t.syncCookieProperties(),this._processCookieIdentityChange(),null===(i=this.sessionPersistence)||void 0===i||i.register(e),Object.keys(e).forEach(e=>this._sessionRegisteredPropKeys.add(e)),this._persistSessionRegisteredPropKeys()}unregister(e){var t;null===(t=this.persistence)||void 0===t||t.unregister(e)}unregister_for_session(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e),this._sessionRegisteredPropKeys.delete(e),this._persistSessionRegisteredPropKeys()}_register_single(e,t){this.register({[e]:t})}_clearSessionRegisteredProps(){this._sessionRegisteredPropKeys.forEach(e=>{var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e)}),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()}_persistSessionRegisteredPropKeys(){var e;if(!this._sessionRegisteredPropertiesStorageKey)return;if("memory"===this.config.persistence||(null===(e=this.sessionPersistence)||void 0===e?void 0:e._disabled)||!Kl._is_supported())return void Kl._remove(this._sessionRegisteredPropertiesStorageKey);const t=[];this._sessionRegisteredPropKeys.forEach(e=>t.push(e)),t.length>0?Kl._set(this._sessionRegisteredPropertiesStorageKey,t):Kl._remove(this._sessionRegisteredPropertiesStorageKey)}getFeatureFlag(e,t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null===(t=this.featureFlags)||void 0===t?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i,n;return null!==(i=null===(n=this.featureFlags)||void 0===n?void 0:n.isFeatureEnabled(e,t))&&void 0!==i?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null===(e=this.featureFlags)||void 0===e||e.reloadFeatureFlags()}updateFlags(e,t,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t=!1,i){var n;return null===(n=this.featureFlags)||void 0===n?void 0:n.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:bC}),()=>{})}onSessionId(e){var t,i;return null!==(t=null===(i=this.sessionManager)||void 0===i?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t=!1){this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:bC})}getActiveMatchingSurveys(e,t=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:bC})}onActiveMatchingSurveysChanged(e){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(e):(e([],{isLoaded:!1,error:bC}),()=>{})}renderSurvey(e,t){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(e,t)}displaySurvey(e,t=uv){var i;null===(i=this.surveys)||void 0===i||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null===(t=this.surveys)||void 0===t||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null===(i=this.surveys)||void 0===i?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:bC}}canRenderSurveyAsync(e,t=!1){var i,n;return null!==(i=null===(n=this.surveys)||void 0===n?void 0:n.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:bC})}_validateIdentifyId(e){return!e||Mt(e)?($r.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?($r.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||($r.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return $r.uninitializedWarning("posthog.identify");if(Ft(e)&&(e=e.toString(),$r.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this._validateIdentifyId(e))return;if(!this._requirePersonProcessing("posthog.identify"))return;this._syncCookielessIdentity();const n=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,r=this._processCookieIdentityChange(!1),o=this.persistence._beginCookieSyncSuppression();let a=!1;try{const n=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:n},""),e!==n&&e!==this.get_property("__alias")&&(this.unregister(q),this.register({distinct_id:e}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Je,c=e!==n,u=!c&&o;if(c&&o){var l;const s=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:n};this.persistence.set_property(Ie,Ze),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$identify",s,{$set:t||{},$set_once:i||{}})&&(this._cachedPersonProperties=fc(e,t,i)),null===(l=this.featureFlags)||void 0===l||l.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:n)}else if(u){this.persistence.set_property(Ie,Ze);const n=t||{},s=i||{};this.setPersonPropertiesForFlags({$set:n,$set_once:s},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:n,$set_once:s})&&(this._cachedPersonProperties=fc(e,t,i))}else(t||i)&&this.setPersonProperties(t,i);c||s||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(w)):u&&(t||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence._endCookieSyncSuppression(a)}}setPersonProperties(e,t){if(!e&&!t)return;if(!this._requirePersonProcessing("posthog.setPersonProperties"))return;const i=fc(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}})&&(this._cachedPersonProperties=i)):$r.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var t;const i=(kt(e)?e:[e]).filter(e=>Tt(e)&&e.length>0);0!==i.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null===(t=this.featureFlags)||void 0===t||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this._cachedPersonProperties=null)}group(e,t,i){var n;if(!e||!t)return void $r.error("posthog.group requires a group type and group key");null===(n=this.persistence)||void 0===n||n.syncCookieProperties(),this._processCookieIdentityChange();const s=this.getGroups(),r=s[e]!==t;if(r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:ct(ct({},s),{},{[e]:t})}),(r||i)&&this._hasPersonProcessing()){const n={$group_type:e,$group_key:t};i&&(n.$group_set=i),this.capture(nt,n)}i&&this.setGroupPropertiesForFlags({[e]:i}),r&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t=!0){var i;null===(i=this.featureFlags)||void 0===i||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e=!0){var t;null===(t=this.featureFlags)||void 0===t||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t=!0){var i;this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null===(i=this.featureFlags)||void 0===i||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null===(t=this.featureFlags)||void 0===t||t.resetGroupPropertiesForFlags(e)}reset(e){const t=Lt(e)?e:null==e?void 0:e.resetDeviceID,i=Lt(e)||null==e?void 0:e.bootstrap;this._reset(t,!1,i)}_reset(e,t=!1,i){var n,s,r,o,a,l;if($r.info("reset"),!this.__loaded)return $r.uninitializedWarning("posthog.reset");const c=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(n=this._originalUserConfig)||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._shouldDisableFlags());const u=this.get_property(N),d=this.get_property(B),h=this.get_property(ie);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const p=this.is_capturing();t||this.consent.reset(),t||!p||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const g=null===(a=this.persistence)||void 0===a||null===(l=a._beginCookieSyncSuppression)||void 0===l?void 0:l.call(a),_=this._isConsentTransition;this._isConsentTransition=_||t;let f=!1;try{var v,m,y,b,S,w,k,C,x,E,I,T,M;if(null===(v=this.persistence)||void 0===v||v.clear(),null===(m=this.sessionPersistence)||void 0===m||m.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),It(h)||null===(E=this.persistence)||void 0===E||E.register({$session_recording_remote_config:h}),null===(y=this.surveys)||void 0===y||y.reset(),null===(b=this.featureFlags)||void 0===b||b.reset(),null===(S=this.conversations)||void 0===S||S.reset(),null===(w=this.logs)||void 0===w||w.reset(),null===(k=this.metrics)||void 0===k||k.reset(),null===(C=this.persistence)||void 0===C||C.set_property("$user_state","anonymous"),null===(x=this.sessionManager)||void 0===x||x.resetSessionId(),this._cachedPersonProperties=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Le,$device_id:null},"");else{const t=this.config.get_device_id(Tl());this.register_once({distinct_id:t,$device_id:e?t:u},""),e||It(d)||this.register({[B]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(i.distinctID&&!this._inCookielessMode()&&(null===(M=this.persistence)||void 0===M||M.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(I=this.featureFlags)||void 0===I||I.initialize(),!Rt(c)&&!(null===(T=this.sessionManager)||void 0===T?void 0:T.setBootstrapSessionId(c,!0))){const e=ct({},i);delete e.sessionID,this.config.bootstrap=e}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,f=!0}finally{var P,R;this._isConsentTransition=_,g&&(null===(P=this.persistence)||void 0===P||null===(R=P._endCookieSyncSuppression)||void 0===R||R.call(P,f))}var F;this._lastRemoteConfig&&(null===(F=this.conversations)||void 0===F||F.onRemoteConfig(this._lastRemoteConfig)),this.reloadFeatureFlags()}shutdown(e){var t=this;return rt(function*(){if(!t.__loaded)return void $r.uninitializedWarning("posthog.shutdown");t._isShutdown=!0,clearTimeout(t._extensionInitTimeout),t._extensionInitTimeout=void 0;const e=t._featureFlagsReloadingUnsubscribe;t._featureFlagsReloadingUnsubscribe=void 0;for(const i of[()=>{var e;return null===(e=t.sessionRecording)||void 0===e?void 0:e.dispose()},()=>{var e;return null===(e=t.logs)||void 0===e?void 0:e.flushLogs("sendBeacon")},()=>{var e;return null===(e=t.metrics)||void 0===e?void 0:e.flush("sendBeacon")},()=>{var e;return null===(e=t.metrics)||void 0===e?void 0:e.dispose()},()=>{var e;return null===(e=t.logs)||void 0===e?void 0:e.dispose()},()=>{var e;return null===(e=t.surveys)||void 0===e?void 0:e.dispose()},()=>{var e;return null===(e=t.autocapture)||void 0===e?void 0:e.dispose()},()=>null==e?void 0:e(),()=>{var e;return null===(e=t._requestQueue)||void 0===e?void 0:e.unload()},()=>{var e;return null===(e=t._retryQueue)||void 0===e?void 0:e.unload()},()=>{var e;return null===(e=t.featureFlags)||void 0===e?void 0:e.destroy()},()=>{var e;return null===(e=t.persistence)||void 0===e?void 0:e.destroy()},()=>{var e;return null===(e=t.sessionPersistence)||void 0===e?void 0:e.destroy()}])try{const e=i();e&&Ct(e.then)&&e.then(void 0,e=>{$r.error("Error during shutdown",e)})}catch(e){$r.error("Error during shutdown",e)}})()}setIdentity(e,t){var i;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null===(i=this.conversations)||void 0===i||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(e=this.conversations)||void 0===e||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null===(t=this.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";const{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let n=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${t}`);if((null==e?void 0:e.withTimestamp)&&i){var s;const t=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!i)return n;n+=`?t=${Math.max(Math.floor(((new Date).getTime()-i)/1e3)-t,0)}`}return n}alias(e,t){return e===this.get_property("$people_distinct_id")?($r.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(It(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(q,e),this.capture("$create_alias",{alias:e,distinct_id:t})):($r.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){const t=ct({},this.config);if(xt(e)){var i,n,s,r,o,a,l,c,u,d,h,p,g,_;Hr(this.config,OC(e));const b=this._is_persistence_disabled();if(this.persistence){const e="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;var f,v;if(e&&this.sessionPersistence!==this.persistence&&(null===(f=this.sessionPersistence)||void 0===f||f.remove(),null===(v=this.sessionPersistence)||void 0===v||v.destroy()),this.persistence.update_config(this.config,t,b),e)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new Uk(ct(ct({},this.config),{},{persistence:"sessionStorage"}),b,!1);else{var m;null===(m=this.sessionPersistence)||void 0===m||m.update_config(ct(ct({},this.config),{},{persistence:"sessionStorage"}),ct(ct({},t),{},{persistence:"sessionStorage"}),b)}}const S=this._checkLocalStorageForDebug(this.config.debug);var y;Lt(S)&&(this.config.debug=S),Lt(this.config.debug)&&(this.config.debug?(Jl.DEBUG=!0,Ol._is_supported()&&Ol._set("ph_debug",!0),$r.info("set_config",{config:e,oldConfig:t,newConfig:ct({},this.config)})):(Jl.DEBUG=!1,Ol._is_supported()&&Ol._remove("ph_debug"))),null===(i=this.featureFlags)||void 0===i||null===(n=i.updateConfig)||void 0===n||n.call(i,this.config,this._shouldDisableFlags()),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===(c=this.tracingHeaders)||void 0===c||c.startIfEnabledOrStop(),null===(u=this.autocapture)||void 0===u||u.startIfEnabled(),null===(d=this.heatmaps)||void 0===d||d.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null===(y=this.historyAutocapture)||void 0===y||y.startIfEnabledOrStop()),null===(h=this.exceptionObserver)||void 0===h||h.startIfEnabledOrStop(),null===(p=this.deadClicksAutocapture)||void 0===p||p.startIfEnabledOrStop(),null===(g=this.surveys)||void 0===g||g.loadIfEnabled(),this._sync_opt_out_with_persistence(),null===(_=this.externalIntegrations)||void 0===_||_.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&wk(this,mC,!1)}}_overrideSDKInfo(e,t){Jl.LIB_NAME=e,Jl.LIB_VERSION=t}startSessionRecording(e){const t=!0===e,i={sampling:t||!!(null==e?void 0:e.sampling),linked_flag:t||!!(null==e?void 0:e.linked_flag),url_trigger:t||!!(null==e?void 0:e.url_trigger),event_trigger:t||!!(null==e?void 0:e.event_trigger)};var 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 e;return!!(null===(e=this.sessionRecording)||void 0===e?void 0:e.started)}captureException(e,t){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(ct(ct({},i),t))}catch(e){return}}addExceptionStep(e,t){var i;null===(i=this.exceptions)||void 0===i||i.addExceptionStep(e,t)}captureLog(e){var t;null===(t=this.logs)||void 0===t||t.captureLog(e)}get logger(){var e,i;return null!==(e=null===(i=this.logs)||void 0===i?void 0:i.logger)&&void 0!==e?e:t._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null===(i=this.toolbar)||void 0===i?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null===(t=this.persistence)||void 0===t?void 0:t.props[e]}getSessionProperty(e){var t;return null===(t=this.sessionPersistence)||void 0===t?void 0:t.props[e]}toString(){var e;let t=null!==(e=this.config.name)&&void 0!==e?e:PC;return t!==PC&&(t="posthog."+t),t}_isIdentified(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property("$user_state"))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?void 0:t.get_property("$user_state"))}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&Et(this.getGroups())&&!(null===(e=this.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.__alias)&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.$epp))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?($r.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(Ae,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;const e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_sync_opt_out_with_persistence(){var e,t;const i=this._is_persistence_disabled();var n,s,r;return this.is_capturing()||null===(n=this.logs)||void 0===n||n._onOptOut(),(null===(e=this.persistence)||void 0===e?void 0:e._disabled)!==i&&(null===(s=this.persistence)||void 0===s||s.set_disabled(i)),(null===(t=this.sessionPersistence)||void 0===t?void 0:t._disabled)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),this._persistSessionRegisteredPropKeys(),i}opt_in_capturing(e){var i;if("always"!==this.config.cookieless_mode){if(this._inCookielessMode()){var n,s,r,o,a,l;null===(n=this.sessionRecording)||void 0===n||n.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),null===(s=this.sessionManager)||void 0===s||s.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new sC(this),this.pageViewManager=new Ek(this),this.persistence&&(this.sessionPropsManager=new tC(this,this.sessionManager,this.persistence));const e=null!==(o=null===(a=this.config.__extensionClasses)||void 0===a?void 0:a.sessionRecording)&&void 0!==o?o:null===(l=t.__defaultExtensionClasses)||void 0===l?void 0:l.sessionRecording;var c,u;e&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new e(this)),this._lastRemoteConfig&&(null===(c=this.sessionRecording)||void 0===c||null===(u=c.onRemoteConfig)||void 0===u||u.call(c,this._lastRemoteConfig)))}var d,h,p;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(d=this.surveys)||void 0===d||d.loadIfEnabled(),null===(h=this.conversations)||void 0===h||h.loadIfEnabled()),(It(null==e?void 0:e.captureEventName)||(null==e?void 0:e.captureEventName))&&this.capture(null!==(p=null==e?void 0:e.captureEventName)&&void 0!==p?p:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else $r.warn(yC)}opt_out_capturing(){"always"!==this.config.cookieless_mode?(this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),"on_reject"===this.config.cookieless_mode&&this._enterCookielessMode()):$r.warn(yC)}_enterCookielessMode(){var e,t;const i=this.sessionRecording;null==i||i.dispose({discardBufferedEvents:!0}),"$posthog_cookieless"!==this.get_distinct_id()&&this._reset(!0,!0),this.register({distinct_id:Le,$device_id:null}),this._removeExtension(i),this.sessionRecording=void 0,null===(e=this.sessionManager)||void 0===e||e.destroy(),null===(t=this.pageViewManager)||void 0===t||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return!this._isConsentTransition&&("always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing()))}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return i?oC(i,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){n&&("visible"===n.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(et,{title:n.title},{send_instantly:!0}),this._visibilityStateListener&&(n.removeEventListener(I,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),Qr(n,I,this._visibilityStateListener)))}debug(t){!1===t?(null==e||e.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==e||e.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}_shouldDisableFlags(){const e=this._originalUserConfig||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?($r.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(e,t,i,n,s){const r=t in e&&!Rt(e[t]),o=i in e&&!Rt(e[i]);return r?e[t]:!!o&&(s&&s.warn(`Config field '${i}' is deprecated. Please use '${t}' instead. The old field will be removed in a future major version.`),e[i])}(e,"advanced_disable_flags","advanced_disable_decide",0,$r)}_runBeforeSend(e){var t;if(Rt(this.config.before_send))return e;const i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter($t),n=kt(this.config.before_send)?this.config.before_send:[this.config.before_send];let s=e;for(const t of n)try{if(s=t(s),Rt(s)){const t=`Event '${e.event}' was rejected in beforeSend function`;return Dt(e.event)?$r.warn(`${t}. This can cause unexpected behavior.`):$r.info(t),null}s.properties&&!Et(s.properties)||$r.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(t){return $r.error(`Error in beforeSend function for event '${e.event}':`,t),null}for(const t of i)if(s.properties&&Rt(s.properties[t]))return $r.warn(`Event '${e.event}' had its '${t}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return s}getPageViewId(){var e;return null===(e=this.pageViewManager._currentPageview)||void 0===e?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){const t=Lt(e)&&!e,i=Ol._is_supported()&&"true"===Ol._get("ph_debug");return!t&&(!!i||e)}};$C.__defaultExtensionClasses={},$C._noopLogger=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(let i=0;t.length>i;i++)e.prototype[t[i]]=Ur(e.prototype[t[i]])}($C,["identify"]);const NC=["[data-ph-capture-value]"];var BC=class{constructor(e){this._instance=e}refresh(e){var t;const i=this._instance.config,n=xt(i.autocapture)?i.autocapture:void 0;e.enabled=!!i.autocapture,e.rageclick=i.rageclick,e.maskAllElementAttributes=i.mask_all_element_attributes,e.maskAllText=i.mask_all_text,e.disableCaptureUrlHashes=i.disable_capture_url_hashes,e.getCurrentUrl=i.get_current_url,e.remoteRequestsDisabled=this._instance._shouldDisableFlags(),e.url_allowlist=null==n?void 0:n.url_allowlist,e.url_ignorelist=null==n?void 0:n.url_ignorelist,e.dom_event_allowlist=null==n?void 0:n.dom_event_allowlist,e.element_allowlist=null==n?void 0:n.element_allowlist,e.css_selector_allowlist=null==n?void 0:n.css_selector_allowlist,e.css_selector_ignorelist=null==n?void 0:n.css_selector_ignorelist,e.element_attribute_ignorelist=null==n?void 0:n.element_attribute_ignorelist,e.capture_copied_text=null==n?void 0:n.capture_copied_text,e.capture_value_css_selector_allowlist=null!==(t=null==n?void 0:n.capture_value_css_selector_allowlist)&&void 0!==t?t:NC}};const qC=Nr("[ExceptionAutocapture]"),HC=Nr("[TracingHeaders]"),zC=Nr("[Web Vitals]"),UC=9e5,WC=["CLS","FCP","INP","LCP"],jC=["INP","LCP"],VC=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],GC=Nr("[SessionRecording]"),QC=[Ne,Be,qe,He,ze,Ue,We,je,Ve],KC=Nr("[Heatmaps]");function JC(e){return xt(e)&&"clientX"in e&&"clientY"in e&&Ft(e.clientX)&&Ft(e.clientY)}const ZC=Nr("[Product Tours]"),YC=e=>{var t;return!e.config.disable_product_tours&&!!(null===(t=e.persistence)||void 0===t?void 0:t.get_property(X))},XC=["$set_once","$set"],ex=Nr("[SiteApps]"),tx="Error while initializing PostHog app with config id ",ix=(null==e?void 0:e.location)?ro(e.location.hash,"__posthog")||ro(location.hash,"state"):null,nx="_postHogToolbarParams",sx=Nr("[Toolbar]"),rx=Nr("[FeatureFlags]"),ox=Nr("[FeatureFlags]",{debugEnabled:!0}),ax="\" failed. Feature flags didn't load in time.",lx=[502,504],cx=["click","keydown","wheel","touchstart","pointerdown"],ux="connection_error",dx=e=>{const t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},hx=e=>{const t={};for(const[i,n]of zr(e||{}))n&&(t[i]=n);return t};var px=class{constructor(e){this.name="featureFlags",this._override_warning=!1,this.featureFlagEventHandlers=[],this._logger=rx,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._reloadingHandlers=[],this._pendingReloads=new Set,this._activeReloads=new Set,this._hasLoadedFlags=!1,this._requestInFlight=!1,this._requestGeneration=0,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._firingFeatureFlagsCallbacks=!1,this._flagsLoadedFromRemote=!1,this._staleCacheRefreshTriggered=!1,this._consecutiveStatusZeroFailures=0,this._hadUserInteraction=!1,this._onOnline=()=>{const e=this._hasStatusZeroCircuitBreakerTripped();this._consecutiveStatusZeroFailures=0,e&&this.reloadFeatureFlags()},this._refreshIfDue=()=>{var e,t;const i=this._refreshIntervalMs,n=null!==(e=this._dueRefreshIntervalMs)&&void 0!==e?e:i;It(i)||It(n)||this._config.remoteRequestsDisabled||!this._document||"hidden"===this._document.visibilityState||Date.now()-(null!==(t=this._lastRefreshAt)&&void 0!==t?t:0)<n||(this._dueRefreshIntervalMs=this._hadUserInteraction||!this._config.idleRefreshBackoff?i:Math.min(2*n,36e5),this._hadUserInteraction=!1,this.reloadFeatureFlags(),this._scheduleNextRefresh())},this._onUserInteraction=()=>{this._hadUserInteraction&&this._dueRefreshIntervalMs===this._refreshIntervalMs||this._resumeConfiguredInterval()},this._onVisibilityChange=()=>{var e;"visible"===(null===(e=this._document)||void 0===e?void 0:e.visibilityState)&&this._resumeConfiguredInterval()},this._configSource=e}get _crossTabPersistence(){}_onConfigUpdated(){this._client&&this._syncAutomaticRefresh()}setup(e){try{this._window=typeof window>"u"?void 0:window,this._document=typeof document>"u"?void 0:document}catch(e){this._window=void 0,this._document=void 0}return this._initializingClient=e,this._logger=e.logger.createLogger("[FeatureFlags]"),Yy(e.kv.initialize(),()=>{this._initializingClient===e&&(this._initializingClient=void 0,this._client=e,this._finishSetup(e))})}_finishSetup(e){var t;if(this._client===e)return this._window&&Qr(this._window,"online",this._onOnline),this._syncAutomaticRefresh(),this._dynamicProperties=e.registerDynamicEventProperties(()=>this._isCacheStale()?this._baseEventProperties:this._eventPropertiesWithFlagValues),this._crossTabPersistenceUnsubscribe=null===(t=this._crossTabPersistence)||void 0===t?void 0:t.onCrossTabFeatureFlagChange(()=>{this._clearBootstrapState(),this._rebuildEventProperties(),this._fireFeatureFlagsCallbacks()}),this._rebuildEventProperties(),this.initialize()}_resumeConfiguredInterval(){this._hadUserInteraction=!0,this._dueRefreshIntervalMs=this._refreshIntervalMs,this._refreshIfDue()}_syncAutomaticRefresh(){var e;const t=this._config.refreshIntervalMs,i=!this._config.remoteRequestsDisabled&&this._document&&!It(t)&&t>0?t:void 0;this._config.idleRefreshBackoff||(this._dueRefreshIntervalMs=i),i!==this._refreshIntervalMs&&(this._stopAutomaticRefresh(),It(i)||(this._refreshIntervalMs=i,this._dueRefreshIntervalMs=i,this._scheduleNextRefresh(),(null===(e=this._document)||void 0===e?void 0:e.addEventListener)&&(Qr(this._document,I,this._onVisibilityChange),Br(cx,e=>{Qr(this._document,e,this._onUserInteraction,{capture:!0})}))))}_scheduleNextRefresh(){It(this._refreshIntervalMs)||(It(this._refreshInterval)||clearInterval(this._refreshInterval),this._lastRefreshAt=Date.now(),this._refreshInterval=setInterval(this._refreshIfDue,this._refreshIntervalMs))}_stopAutomaticRefresh(){var e,t;It(this._refreshInterval)||(clearInterval(this._refreshInterval),this._refreshInterval=void 0,null===(e=this._document)||void 0===e||null===(t=e.removeEventListener)||void 0===t||t.call(e,"visibilitychange",this._onVisibilityChange),Br(cx,e=>{var t,i;null===(t=this._document)||void 0===t||null===(i=t.removeEventListener)||void 0===i||i.call(t,e,this._onUserInteraction,{capture:!0})})),this._refreshIntervalMs=void 0,this._dueRefreshIntervalMs=void 0,this._hadUserInteraction=!1,this._lastRefreshAt=void 0}destroy(){this._dispose()}dispose(){this._dispose()}_dispose(){var e,t,i;this._stopAutomaticRefresh(),this._requestGeneration++,this._additionalReloadRequested=!1,this._initializingClient=void 0,this._settleReloads(this._pendingReloads,"cancelled"),this._settleReloads(this._activeReloads,"cancelled"),this._client&&(this._clearDebouncer(),null===(e=this._dynamicProperties)||void 0===e||e.dispose(),this._dynamicProperties=void 0,null===(t=this._crossTabPersistenceUnsubscribe)||void 0===t||t.call(this),this._crossTabPersistenceUnsubscribe=void 0,this._reloadingHandlers=[],null===(i=this._window)||void 0===i||i.removeEventListener("online",this._onOnline),this._client=void 0)}get _config(){return this._configSource.get()}_prop(e){var t;return this._bootstrapState&&e in this._bootstrapState?this._bootstrapState[e]:null===(t=this._client)||void 0===t?void 0:t.kv.get(e)}_clearBootstrapState(){return!!this._bootstrapState&&(this._bootstrapState=void 0,!0)}_fallBackToPersistedFlags(){var e;return!It(null===(e=this._client)||void 0===e?void 0:e.kv.get("$enabled_feature_flags"))&&this._clearBootstrapState()}_set(e){this._persist(()=>{var t;return null===(t=this._client)||void 0===t?void 0:t.kv.set(e)})}_markCrossTabFeatureFlagSnapshot(e,t,i){if(!this._crossTabPersistence||!e.$enabled_feature_flags)return;const n=this._prop("$enabled_feature_flags")||{},s=e.$enabled_feature_flags||{},r=t.flags||t.featureFlags,o=t.flags?Object.entries(t.flags).filter(([,e])=>!(null==e?void 0:e.failed)).map(([e])=>e):[],a=!!t.errorsWhileComputingFlags&&!!t.flags,l=a?o:i&&!kt(r)?Object.keys(r||{}):Array.from(new Set([...Object.keys(n),...Object.keys(s)])),c=this._prop("$feature_flag_payloads")||{},u=e.$feature_flag_payloads||{},d=a||i?l:Array.from(new Set([...Object.keys(c),...Object.keys(u)])),h=!a&&!i,_=!!h||l,b=!!h||d,S={[p]:_,[y]:_,[C]:b};e.$feature_flag_details&&(S[g]=_);for(const t of[v,f,m])It(e[t])||(S[t]=!0);this._crossTabPersistence.markCrossTabFeatureFlagChanges(S)}_remove(e){this._persist(()=>{var t;return null===(t=this._client)||void 0===t?void 0:t.kv.remove(e)})}_persist(e){try{e()}catch(e){this._logger.error("Failed to update feature flag persistence",e)}}_rebuildEventProperties(){const e={};for(const t of[p,C,v,x]){const i=this._prop(t);It(i)||(e[t]=i)}this._baseEventProperties=e;const t=ct({},e),i=this._prop(y);if(i)for(const[e,n]of Object.entries(i))t[`$feature/${e}`]=n;this._eventPropertiesWithFlagValues=t}_isCacheStale(){const e=this._config.cacheTtlMs;if(!e||0>=e)return!1;const t=this._prop(f);return"number"!=typeof t||Date.now()-t>e}_checkAndTriggerStaleRefresh(){return!!this._isCacheStale()&&(this._staleCacheRefreshTriggered||this._requestInFlight||(this._staleCacheRefreshTriggered=!0,this._logger.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_getValidEvaluationEnvironments(){const e=this._config.evaluationContexts;return(null==e?void 0:e.length)?e.filter(e=>{const t=e&&"string"==typeof e&&e.trim().length>0;return t||this._logger.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}_getValidFlagKeys(){const e=this._config.flagKeys;if(!It(e))return e.filter(e=>{const t=e&&"string"==typeof e&&e.trim().length>0;return t||this._logger.error("Invalid flag key found:",e,"Expected non-empty string"),t})}initialize(){var e,t;const i=this._config,n=null!==(e=null===(t=i.bootstrap)||void 0===t?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(n).length){var s,r;const e=null!==(s=null===(r=i.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:{},t=Object.keys(n).filter(e=>!It(n[e])).reduce((e,t)=>(e[t]=n[t],e),{}),o=Object.keys(e).filter(e=>t[e]).reduce((t,i)=>(t[i]=e[i],t),{});return this._receivedFeatureFlags({featureFlags:t,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(e,t,i){var n,s;const r=(null==i?void 0:i.merge)&&null!==(n=this._prop("$enabled_feature_flags"))&&void 0!==n?n:{},o=(null==i?void 0:i.merge)&&null!==(s=this._prop("$feature_flag_payloads"))&&void 0!==s?s:{},a=ct(ct({},r),e),l=ct(ct({},o),t),c={};for(const[e,t]of Object.entries(a))c[e]={key:e,enabled:as(t),variant:ls(t),reason:void 0,metadata:It(null==l?void 0:l[e])?void 0:{id:0,version:void 0,description:void 0,payload:l[e]}};this._receivedFeatureFlags({flags:c})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this._prop(g),t=this._prop(x),i=this._prop(E);if(!i&&!t)return e||{};const n=Hr({},e||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(const e of s){var r,o;const s=n[e],a=null==t?void 0:t[e],l=It(a)?null!==(r=null==s?void 0:s.enabled)&&void 0!==r&&r:!!a,c=It(a)?null==s?void 0:s.variant:"string"==typeof a?a:void 0,u=null==i?void 0:i[e],d=ct(ct({},s),{},{enabled:l,variant:l?null!=c?c:null==s?void 0:s.variant:void 0});l!==(null==s?void 0:s.enabled)&&(d.original_enabled=null==s?void 0:s.enabled),c!==(null==s?void 0:s.variant)&&(d.original_variant=null==s?void 0:s.variant),u&&(d.metadata=ct(ct({},null==s?void 0:s.metadata),{},{payload:u,original_payload:null==s||null===(o=s.metadata)||void 0===o?void 0:o.payload})),n[e]=d}return this._override_warning||(this._logger.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:n}),this._override_warning=!0),n}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{const n=e[i];return{key:i,enabled:as(n),variant:ls(n),payload:os(t[i])}})}getFlagVariants(){const e=this._prop(y),t=this._prop(x);if(!t)return e||{};const i=Hr({},e||{}),n=Object.keys(t);for(let e=0;n.length>e;e++)i[n[e]]=t[n[e]];return this._override_warning||(this._logger.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){const e=this._prop(C),t=this._prop(E);if(!t)return e||{};const i=Hr({},e||{}),n=Object.keys(t);for(let e=0;n.length>e;e++)i[n[e]]=t[n[e]];return this._override_warning||(this._logger.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this._override_warning=!0),i}reloadFeatureFlags(){this._reloadingDisabled||this._config.featureFlagsDisabled||this._hasStatusZeroCircuitBreakerTripped()||(this._firingFeatureFlagsCallbacks&&this._logger.warn("reloadFeatureFlags() was called inside an onFeatureFlags callback. This callback also runs when flags change in other tabs, so this can cause a request loop."),this._requestInFlight&&(this._additionalReloadRequested=!0),this._reloadDebouncer||(this._reloadingHandlers.slice().forEach(e=>{try{e()}catch(e){this._logger.error("Error while running feature flags reloading callback",e)}}),this._reloadDebouncer=setTimeout(()=>{this._callFlagsEndpoint()},5)))}reloadFeatureFlagsAsync(){return!this._client||this._reloadingDisabled||this._config.featureFlagsDisabled||this._config.remoteRequestsDisabled||this._hasStatusZeroCircuitBreakerTripped()?Promise.resolve({status:"skipped"}):new Promise(e=>{this._pendingReloads.add(e),this.reloadFeatureFlags()})}_settleReloads(e,t){e.forEach(e=>e({status:t})),e.clear()}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}onReloading(e){return this._reloadingHandlers.push(e),()=>{this._reloadingHandlers=this._reloadingHandlers.filter(t=>t!==e)}}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}resetFlagCallReported(){this._remove(w)}_callFlagsEndpoint(e){var t;this._clearDebouncer();const i=this._client;if(!i||this._config.remoteRequestsDisabled||this._hasStatusZeroCircuitBreakerTripped())return void this._settleReloads(this._pendingReloads,"skipped");if(this._requestInFlight)return void(this._additionalReloadRequested=!0);const n={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:ct(ct(ct({},i.initialPersonProperties),this._prop("$stored_person_properties")||{}),{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this._prop(b),timezone:Cc()};It(i.deviceId)||(n.$device_id=i.deviceId),((null==e?void 0:e.disableFlags)||this._config.featureFlagsDisabled)&&(n.disable_flags=!0);const s=this._getValidEvaluationEnvironments();s.length&&(n.evaluation_contexts=s);const r=this._getValidFlagKeys();It(r)||(n.flag_keys=r);const o=this._config.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this._requestGeneration,c=this._pendingReloads;this._pendingReloads=new Set,this._activeReloads=c,this._requestInFlight=!0;const u=()=>{this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())},d=e=>{var t,i;const s=null!==(t=e.json)&&void 0!==t?t:{},r=200!==e.statusCode;if(this._requestInFlight=!1,l!==this._requestGeneration)return void u();if(this._trackStatusZeroReachability(e.statusCode),r||this._additionalReloadRequested||(this.$anon_distinct_id=void 0),n.disable_flags&&!this._additionalReloadRequested)return void this._settleReloads(c,"skipped");this._flagsLoadedFromRemote=!r;const a=[];e.error?a.push(e.error instanceof Error&&"AbortError"===e.error.name?"timeout":e.error instanceof Error?ux:"unknown_error"):200!==e.statusCode&&a.push(`api_error_${e.statusCode}`),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");const d=!!(null===(i=s.quotaLimited)||void 0===i?void 0:i.includes("feature_flags"));d&&a.push("quota_limited"),this._set({[_]:a}),d?this._logger.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):n.disable_flags||this._receivedFeatureFlags(s,r,{partialResponse:o}),this._settleReloads(c,n.disable_flags?"skipped":a.length||!s.flags&&!s.featureFlags?"error":"loaded"),u()},h=e=>{this._requestInFlight=!1,l===this._requestGeneration?(this._set({[_]:[ux]}),this._logger.error("Feature flag request failed",e),this._fallBackToPersistedFlags()&&this._fireFeatureFlagsCallbacks(!0),this._settleReloads(c,"error"),u()):u()};let p=null!==(t=this._config.requestMaxRetries)&&void 0!==t?t:1;const g=()=>p>0&&l===this._requestGeneration,f=()=>{if(l!==this._requestGeneration||!this._client||this._config.remoteRequestsDisabled)return this._requestInFlight=!1,this._settleReloads(c,"skipped"),void u();try{i.sendRequest(a,{target:"flags",method:"POST",body:n,compression:this._config.compression,sentAt:"body",timeoutMs:this._config.requestTimeoutMs}).then(e=>{if((e=>lx.includes(e.statusCode)||(e=>0===e.statusCode&&e.error instanceof Error&&"AbortError"===e.error.name)(e))(e)&&g())return p--,void setTimeout(f,500);d(e)}).catch(h)}catch(e){h(e)}};f()}_hasStatusZeroCircuitBreakerTripped(){return Yr(this._consecutiveStatusZeroFailures,3)}_trackStatusZeroReachability(e){this._consecutiveStatusZeroFailures=Xr(e,this._consecutiveStatusZeroFailures,3,()=>this._logger.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t={}){var i;if(t.fresh&&!this._flagsLoadedFromRemote)return;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return void this._logger.warn('getFeatureFlag for key "'+e+ax);if(this._checkAndTriggerStaleRefresh())return;const n=this.getFeatureFlagResult(e,t);return null!==(i=null==n?void 0:n.variant)&&void 0!==i?i:null==n?void 0:n.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this._flagsLoadedFromRemote)return;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return void this._logger.warn('getFeatureFlagResult for key "'+e+ax);if(this._checkAndTriggerStaleRefresh())return;const i=this.getFlagVariants(),n=e in i,s=i[e],r=this.getFlagPayloads()[e],o=String(s),a=this._prop("$feature_flag_request_id")||void 0,l=this._prop("$feature_flag_evaluated_at")||void 0;let c,u=this._prop("$flag_call_reported")||{};if(this._config.deduplicateCallsPerSession){var d;const e=null===(d=this._client)||void 0===d||null===(d=d.session)||void 0===d?void 0:d.sessionId,t=this._prop(k);e&&e!==t&&(u={},c=e)}if(!t.send_event&&"send_event"in t)c&&this._set({[w]:u,[k]:c});else{var h,p;const t=null===(h=this._client)||void 0===h?void 0:h.canCapture;if(!t&&Object.keys(u).length>0&&(u={},this._set({[w]:u})),t&&!(null===(p=u[e])||void 0===p?void 0:p.includes(o))){var g,_,f,v,m,y,b,S,C,x,E,I,T;kt(u[e])?u[e].push(o):u[e]=[o],this._set(ct({[w]:u},c?{[k]:c}:{}));const t=this.getFeatureFlagDetails(e),i=[...null!==(g=this._prop("$feature_flag_errors"))&&void 0!==g?g:[]];It(s)&&i.push("flag_missing");const n={$feature_flag:e,$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!==(_=null===(f=this._config.bootstrap)||void 0===f||null===(f=f.featureFlags)||void 0===f?void 0:f[e])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(v=null===(m=this._config.bootstrap)||void 0===m||null===(m=m.featureFlagPayloads)||void 0===m?void 0:m[e])&&void 0!==v?v:null,$used_bootstrap_value:!this._flagsLoadedFromRemote};It(null==t||null===(y=t.metadata)||void 0===y?void 0:y.has_experiment)||(n.$feature_flag_has_experiment=t.metadata.has_experiment),It(null==t||null===(b=t.metadata)||void 0===b?void 0:b.version)||(n.$feature_flag_version=t.metadata.version);const d=null!==(S=null==t||null===(C=t.reason)||void 0===C?void 0:C.description)&&void 0!==S?S:null==t||null===(x=t.reason)||void 0===x?void 0:x.code;d&&(n.$feature_flag_reason=d),(null==t||null===(E=t.metadata)||void 0===E?void 0:E.id)&&(n.$feature_flag_id=t.metadata.id),It(null==t?void 0:t.original_variant)&&It(null==t?void 0:t.original_enabled)||(n.$feature_flag_original_response=It(t.original_variant)?t.original_enabled:t.original_variant),(null==t||null===(I=t.metadata)||void 0===I?void 0:I.original_payload)&&(n.$feature_flag_original_payload=null==t||null===(T=t.metadata)||void 0===T?void 0:T.original_payload),i.length&&(n.$feature_flag_error=i.join(",")),this._captureFeatureFlagCalled(n)}else c&&this._set({[w]:u,[k]:c})}return n?{key:e,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:os(r)}:void 0}_captureFeatureFlagCalled(e){try{var t;null===(t=this._client)||void 0===t||t.capture("$feature_flag_called",e)}catch(e){this._logger.error("Failed to capture feature flag call",e)}}getRemoteConfigPayload(e,t){this._getRemoteConfigPayload(e,t)}_getRemoteConfigPayload(e,t){var i=this;return rt(function*(){const n=i._client;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._getValidEvaluationEnvironments();r.length&&(s.evaluation_contexts=r);const o=i._getValidFlagKeys();let a;It(o)||(s.flag_keys=o);try{var l;const t=null===(l=(yield n.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:i._config.compression,sentAt:"body",timeoutMs:i._config.requestTimeoutMs})).json)||void 0===l?void 0:l.featureFlagPayloads;a=(null==t?void 0:t[e])||void 0}catch(e){return void i._logger.error("Remote config feature flag request failed",e)}try{t(a)}catch(e){i._logger.error("Remote config feature flag callback failed",e)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this._flagsLoadedFromRemote)return t.defaultValue;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return this._logger.warn('isFeatureEnabled for key "'+e+ax),t.defaultValue;const i=this.getFeatureFlag(e,t);return It(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){this._receivedFeatureFlags(e,t,i)}_receivedFeatureFlags(e,t,i){if(!this._client)return;this._hasLoadedFlags=!0;const n=((e,t={},i={},n={},s,r=rx)=>{const o=((e,t)=>{const i=e.flags;if(i){const t=Object.fromEntries(Object.keys(i).map(e=>{var t;return[e,null!==(t=i[e].variant)&&void 0!==t?t:i[e].enabled]})),n=Object.fromEntries(Object.keys(i).filter(e=>i[e].enabled).filter(e=>{var t;return!It(null===(t=i[e].metadata)||void 0===t?void 0:t.payload)}).map(e=>{var t;return[e,null===(t=i[e].metadata)||void 0===t?void 0:t.payload]}));return ct(ct({},e),{},{featureFlags:t,featureFlagPayloads:n})}return e.featureFlags&&t.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e,r),a=o.flags,l=o.featureFlags,c=o.featureFlagPayloads;if(!l)return;const u=e.requestId,d=e.evaluatedAt;if(kt(l)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const e={};if(l)for(let t=0;l.length>t;t++)e[l[t]]=!0;return{[p]:l,[y]:e,[m]:!1}}let h=l,_=c,b=a;if(null==s?void 0:s.partialResponse){const e=Object.keys(h),s=_||{};h=ct(ct({},t),h),_=ct(ct({},i),s),e.forEach(e=>{e in s||null==_||delete _[e]}),b=ct(ct({},n),b)}else if(e.errorsWhileComputingFlags)if(a){const e=new Set(Object.keys(a).filter(e=>{var t;return!(null===(t=a[e])||void 0===t?void 0:t.failed)}));h=ct(ct({},t),Object.fromEntries(Object.entries(h).filter(([t])=>e.has(t))));const s=Object.fromEntries(Object.entries(_||{}).filter(([t])=>e.has(t)));_=ct(ct({},i),s),e.forEach(e=>{e in s||null==_||delete _[e]}),b=ct(ct({},n),Object.fromEntries(Object.entries(b||{}).filter(([t])=>e.has(t))))}else h=ct(ct({},t),h),_=ct(ct({},i),_),b=ct(ct({},n),b);return ct(ct({[p]:Object.keys(hx(h)),[y]:h||{},[C]:_||{},[g]:b||{},[m]:!0===e.minimalFlagCalledEvents},u?{[v]:u}:{}),d?{[f]:d}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this._logger);if(n)if(!1===(null==i?void 0:i.persist)){const e=!It(this._client.kv.get(y));this._bootstrapState=n,e||this._set(n)}else this._clearBootstrapState(),this._markCrossTabFeatureFlagSnapshot(n,e,!!(null==i?void 0:i.partialResponse)),this._set(n);else t&&this._fallBackToPersistedFlags();t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}override(e,t=!1){this._logger.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this._overrideFeatureFlags(e)}_overrideFeatureFlags(e){if(this._client){if(!1===e)return this._remove([x,E]),this._fireFeatureFlagsCallbacks(),void ox.info("All overrides cleared");if(kt(e))return this._set({[x]:dx(e)}),this._fireFeatureFlagsCallbacks(),void ox.info("Flag overrides set",{flags:e});if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t;const i=e;this._override_warning=Boolean(null!==(t=i.suppressWarning)&&void 0!==t&&t);const n={},s=i.flags,r=i.payloads;return s&&(n[x]=kt(s)?dx(s):s),r&&(n[E]=r),Object.keys(n).length&&this._set(n),!1===s&&!1===r?this._remove([x,E]):!1===s?this._remove(x):!1===r&&this._remove(E),this._fireFeatureFlagsCallbacks(),!1===s?ox.info("Flag overrides cleared"):s&&ox.info("Flag overrides set",{flags:s}),void(!1===r?ox.info("Payload overrides cleared"):r&&ox.info("Payload overrides set",{payloads:r}))}if(e&&"object"==typeof e)return this._set({[x]:e}),this._fireFeatureFlagsCallbacks(),void ox.info("Flag overrides set",{flags:e});this._logger.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this._logger.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){const{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();try{e(t,i)}catch(e){this._logger.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var n;const s=(this._prop("$early_access_features")||[]).find(t=>t.flagKey===e),r={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:r};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i);const a=ct(ct({},this.getFlagVariants()),{},{[e]:t});null===(n=this._crossTabPersistence)||void 0===n||n.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(r)}),this._set({[p]:Object.keys(hx(a)),[y]:a,[S]:ct(ct({},this._prop("$stored_person_properties")||{}),r)}),this._fireFeatureFlagsCallbacks();try{var l;null===(l=this._client)||void 0===l||l.capture("$feature_enrollment_update",o)}catch(e){this._logger.error("Failed to capture early access feature enrollment",e)}}getEarlyAccessFeatures(e,t=!1,i){const n=this._prop(h);!n||t?this._getEarlyAccessFeatures(e,i):e(n)}_getEarlyAccessFeatures(e,t){var i=this;return rt(function*(){const n=i._client;if(!n)return;const s=t?`&${t.map(e=>`stage=${e}`).join("&")}`:"";let r;try{const e=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${s}`,{target:"api",method:"GET",sentAt:"query"});if(!e.json)return;r=e.json.earlyAccessFeatures,i._set({[h]:r})}catch(e){return void i._logger.error("Early access feature request failed",e)}try{e(r)}catch(e){i._logger.error("Early access feature callback failed",e)}})()}_prepareFeatureFlagsForCallbacks(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}_fireFeatureFlagsCallbacks(e){this._rebuildEventProperties();const{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks(),n=this._firingFeatureFlagsCallbacks;this._firingFeatureFlagsCallbacks=!0,this.featureFlagEventHandlers.forEach(n=>{try{n(t,i,{errorsLoading:e})}catch(e){this._logger.error("Error while running feature flags callback",e)}}),this._firingFeatureFlagsCallbacks=n}setPersonPropertiesForFlags(e,t=!0){this._setPersonPropertiesForFlags(e,t)}_setPersonPropertiesForFlags(e,t=!0){const i=this._prop("$stored_person_properties")||{},n=(null==e?void 0:e.$set)||((null==e?void 0:e.$set_once)?{}:e),s=null==e?void 0:e.$set_once,r={};if(s)for(const e in s)({}).hasOwnProperty.call(s,e)&&(e in i||(r[e]=s[e]));this._set({[S]:ct(ct(ct({},i),r),n)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const i=ct({},this._prop("$stored_person_properties")||{});e.forEach(e=>{delete i[e]}),this._set({[S]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this._remove(S),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const i=this._prop("$stored_group_properties")||{},n=ct({},i);for(const t of Object.keys(e))n[t]=ct(ct({},i[t]),e[t]);this._set({[b]:n}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this._prop("$stored_group_properties")||{};this._set({[b]:ct(ct({},t),{},{[e]:{}})})}else this._remove(b)}reset(){this._requestGeneration++,this._settleReloads(this._pendingReloads,"cancelled"),this._settleReloads(this._activeReloads,"cancelled"),this._additionalReloadRequested=!1,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._bootstrapState=void 0,this._hasLoadedFlags=!1,this._reloadingDisabled=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1,this._consecutiveStatusZeroFailures=0}};const gx=Nr("[FeatureFlags]");var _x=class{constructor(e,t=!1){this._loggedEvaluationEnvironmentsDeprecation=!1,this.update(e,t)}update(e,t){this._snapshot=((e,t)=>{var i,n,s,r,o,a,l,c;return{bootstrap:{featureFlags:null!==(i=null===(n=e.bootstrap)||void 0===n?void 0:n.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(s=null===(r=e.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:void 0},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=e.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:It(e.remote_config_refresh_interval_ms),requestTimeoutMs:e.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!==(a=e.feature_flag_request_max_retries)&&void 0!==a?a:1),compression:e.disable_compression?void 0:"best-available",evaluationContexts:null!==(l=null!==(c=e.evaluation_contexts)&&void 0!==c?c:e.evaluation_environments)&&void 0!==l?l:[],flagKeys:kt(e.flag_keys)?e.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this._loggedEvaluationEnvironmentsDeprecation||(gx.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._loggedEvaluationEnvironmentsDeprecation=!0),It(e.flag_keys)||kt(e.flag_keys)||gx.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this._snapshot}};const fx="Refusing to render web experiment since the viewer is a likely bot",vx={ADD_ATTR:(e,t)=>"target"===e&&"a"===t||"form"===e&&/^(button|fieldset|input|output|select|textarea)$/.test(t),ADD_URI_SAFE_ATTR:["form"]};let mx;const yx={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>dc(t,e),not_regex:(e,t)=>!dc(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},bx=Nr("[Conversations]"),Sx="Conversations not available yet.";function wx(e,t){var i,n,s,r,o,a,l;const c=null!==(i=null==e?void 0:e.flushIntervalMs)&&void 0!==i?i:3e3,u=null!==(n=null==e?void 0:e.maxBufferSize)&&void 0!==n?n:100,d=(null==t?void 0:t.consoleCapture)?void 0:null!==(s=null==e?void 0:e.maxLogsPerInterval)&&void 0!==s?s:1e3,h=It(d)?Math.max(u,2048):Math.max(u,d),p=ct(ct({},function(){let e="",t="";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&&([e,t]=Ki(s))}catch(e){}return function(e,t){const i=function(e){if(e)return{}.hasOwnProperty.call(pr,e)?pr[e]:e}(e);return ct(ct({},i?{"os.name":i}:{}),t?{"os.version":t}:{})}(e,t)}()),null==e?void 0:e.resourceAttributes);return{serviceName:null!==(r=null!==(o=null==p?void 0:p["service.name"])&&void 0!==o?o:null==e?void 0:e.serviceName)&&void 0!==r?r:null==t?void 0:t.serviceNameDefault,serviceVersion:null!==(a=null==p?void 0:p["service.version"])&&void 0!==a?a:null==e?void 0:e.serviceVersion,environment:null!==(l=null==p?void 0:p["deployment.environment"])&&void 0!==l?l:null==e?void 0:e.environment,resourceAttributes:p,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:c,maxBufferSize:u,maxQueueSize:h,maxBatchRecordsPerPost:100,rateCapWindowMs:c,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const kx=["debug","log","warn","error","info"],Cx="console",xx="__posthogHandledLogsRequestError",Ex=(e,t)=>{const i=e instanceof Error?e:new Error(t);return i[xx]=!0,i},Ix=e=>!!e&&"object"==typeof e&&!0===e[xx];var Tx=class{get _coreLogger(){return ct(ct({},this._logger),{},{error:(...e)=>{e.some(Ix)||this._logger.error(...e)}})}constructor(e,t){var i;this._configSource=e,this._getSdkContext=t,this.name="logs",this._isLogsEnabled=!1,this._isLoaded=!1,this._isLoading=!1,this._logger=Nr("[logs]"),this._queue=[],this._consoleQueue=[],this._consecutiveStatusZeroFailures=0,this._setupStarted=!1,this._disposed=!1,this._consoleBuffer=[],this._consoleRecorderUnpatchers=[],this._isRecordingConsole=!1,this._isRecordingConsoleEntry=!1,this._listeningForReconnect=!1,this._onReconnect=()=>{var e,t;this._disposed||(this._consecutiveStatusZeroFailures=0,null===(e=this._core)||void 0===e||e.onReconnect(),null===(t=this._consoleCore)||void 0===t||t.onReconnect())},this._isLogsEnabled=!!(null===(i=e.get())||void 0===i?void 0:i.captureConsoleLogs)}get _isRequestReady(){return!0}_getConsoleLoader(){}_listenForReconnect(){if(!this._listeningForReconnect){try{this._window=typeof window>"u"?void 0:window}catch(e){this._window=void 0}this._window&&(Qr(this._window,"online",this._onReconnect),this._listeningForReconnect=!0)}}_buildCore(e,t,i,n){this._listenForReconnect();const s=wx(this._configSource.get(),i);return[new kr(this._createHost(e,t),s,this._coreLogger,()=>this._getSdkContext(),e=>e(),void 0,n),s]}_getCore(){const e=this._configSource.get();var t;return this._core&&this._resolvedFrom===e||(null===(t=this._core)||void 0===t||t.reset(),this._resolvedFrom=e,[this._core,this._resolvedConfig]=this._buildCore(()=>this._queue,e=>{this._queue=e})),this._core}_getConsoleCore(){const e=this._configSource.get();var t;return this._consoleCore&&this._consoleResolvedFrom===e||(null===(t=this._consoleCore)||void 0===t||t.reset(),this._consoleResolvedFrom=e,[this._consoleCore,this._consoleResolvedConfig]=this._buildCore(()=>this._consoleQueue,e=>{this._consoleQueue=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Cx)),this._consoleCore}setup(e){if(!this._disposed&&!this._setupStarted)return this._setupStarted=!0,this._client=e,this._logger=e.logger.createLogger("[logs]"),Yy(e.kv.initialize(),()=>{this._disposed||this._finishSetup(e)})}_finishSetup(e){var t;this._listenForReconnect(),(null===(t=this._configSource.get())||void 0===t?void 0:t.captureConsoleLogs)&&(this._isLogsEnabled=!0),(this._isLogsEnabled||this._configSource.remoteConfigWillArrive&&e.kv.get(this._configSource.captureHintKey))&&this._startConsoleRecorder();let i=!1;const n=e.onRemoteConfig(e=>{var t;i=e.ok&&!0===(null===(t=e.config.logs)||void 0===t?void 0:t.captureConsoleLogs),this.onRemoteConfig(e)});this._disposed?n.dispose():(this._remoteConfigSubscription=n,i||this.loadIfEnabled())}dispose(){var e,t,i,n,s,r,o;this._disposed||(this._disposed=!0,this._stopConsoleRecorder(),null===(e=this._remoteConfigSubscription)||void 0===e||e.dispose(),this._remoteConfigSubscription=void 0,this._client=void 0,this._isLoading=!1,null===(t=this._window)||void 0===t||t.removeEventListener("online",this._onReconnect),null===(i=this._consoleLogsDispose)||void 0===i||i.call(this),this._consoleLogsDispose=void 0,null===(n=this._core)||void 0===n||n.clearQueue(),null===(s=this._consoleCore)||void 0===s||s.clearQueue(),null===(r=this._core)||void 0===r||r.reset(),null===(o=this._consoleCore)||void 0===o||o.reset())}onRemoteConfig(e){var t,i;if(this._disposed)return;const n=e.ok?null===(t=e.config.logs)||void 0===t?void 0:t.captureConsoleLogs:void 0;Rt(n)?this._stopRecorderStartedByPersistedHint():(null===(i=this._client)||void 0===i||i.kv.set(this._configSource.captureHintKey,!!n),n?(this._isLogsEnabled=!0,this._isLoaded||this._startConsoleRecorder(),this.loadIfEnabled()):this._stopRecorderStartedByPersistedHint())}reset(){var e,t,i,n;this._stopConsoleRecorder(),null===(e=this._core)||void 0===e||e.clearQueue(),this._queue=[],null===(t=this._core)||void 0===t||t.reset(),null===(i=this._consoleCore)||void 0===i||i.clearQueue(),this._consoleQueue=[],null===(n=this._consoleCore)||void 0===n||n.reset(),this._consecutiveStatusZeroFailures=0}captureLog(e){!this._disposed&&this._client&&this._getCore().captureLog(e)}captureConsoleLog(e){!this._disposed&&this._client&&this._getConsoleCore().captureLog(e)}captureBufferedConsoleLog(e,t,i){!this._disposed&&this._client&&this._getConsoleCore().captureLog(e,{context:t,occurredAtMs:i})}_onOptOut(){var e;this._stopConsoleRecorder(),null===(e=this._consoleCore)||void 0===e||e.clearQueue(),this._consoleQueue=[]}_stopRecorderStartedByPersistedHint(){this._isLogsEnabled||this._stopConsoleRecorder()}_startConsoleRecorder(){var e;if(this._isRecordingConsole||!(null===(e=this._window)||void 0===e?void 0:e.console))return;const t=wx(this._configSource.get()).maxBufferSize;let i=!0;this._consoleRecorderUnpatchers.push(()=>{i=!1});for(const e of kx){let n;try{n=Bb(this._window.console[e])}catch(e){continue}n&&this._consoleRecorderUnpatchers.push(Fg(this._window.console,e,s=>{const r=(...n)=>{try{i&&this._recordConsoleEntry(e,n,t)}catch(e){}return s.apply(this._window.console,n)};return r.__rrweb_original__=n,r}))}this._isRecordingConsole=!0,this._consoleRecorderTimeout=setTimeout(()=>{this._stopConsoleRecorder()},3e4)}_recordConsoleEntry(e,t,i){var n;if(this._isRecordingConsole&&!this._isRecordingConsoleEntry&&0!==t.length)if(null===(n=this._client)||void 0===n?void 0:n.canCapture){if(i>this._consoleBuffer.length){this._isRecordingConsoleEntry=!0;try{this._consoleBuffer.push({level:e,args:t,occurredAtMs:Date.now(),context:this._getSdkContext()})}finally{this._isRecordingConsoleEntry=!1}}}else this._stopConsoleRecorder()}_stopConsoleRecorder(){if(this._consoleBuffer=[],this._isRecordingConsole){this._isRecordingConsole=!1,this._consoleRecorderTimeout&&(clearTimeout(this._consoleRecorderTimeout),this._consoleRecorderTimeout=void 0);for(const e of this._consoleRecorderUnpatchers)e();this._consoleRecorderUnpatchers=[]}}_takeConsoleBuffer(){const e=this._consoleBuffer;return this._stopConsoleRecorder(),e}get logger(){return this._capture_logger||(this._capture_logger={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this._capture_logger}flushLogs(e){this._client&&(e?this._flushViaTransport(e):(this._core&&this._core.flush().catch(e=>this._logFlushError(e)),this._consoleCore&&this._consoleCore.flush().catch(e=>this._logFlushError(e))))}flush(){var e=this;return rt(function*(){var t,i;const n=null===(t=e._core)||void 0===t?void 0:t.flush().catch(t=>e._logFlushError(t)),s=null===(i=e._consoleCore)||void 0===i?void 0:i.flush().catch(t=>e._logFlushError(t));yield n,yield s})()}_logFlushError(e){Ix(e)||this._logger.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this._disposed||!this._isLogsEnabled||this._isLoaded||this._isLoading)return;const e=this._getConsoleLoader();if(e){this._isLoading=!0;try{e((e,t)=>{if(this._isLoading=!1,!this._disposed&&this._isLogsEnabled)if(e||!t)this._logger.error("Could not load logs script",e),this._stopConsoleRecorder();else{const e=this._takeConsoleBuffer();this._consoleLogsDispose=t.initialize(this._client),this._isLoaded=!0,e.length>0&&t.replay(this._client,e)}})}catch(e){throw this._isLoading=!1,e}}else this._stopConsoleRecorder()}_createHost(e,t){const i=this._client;return{get isDisabled(){return!1},get optedOut(){return!i.canCapture},getPersistedProperty:t=>t===ut.LogsQueue?e():void 0,setPersistedProperty(e,i){e===ut.LogsQueue&&t(null!=i?i:[])},_sendLogsBatch:e=>this._sendLogsBatch(e),getLibraryId:()=>i.library.name,getLibraryVersion:()=>i.library.version}}_sendLogsBatch(e){return new Promise(t=>{if(Yr(this._consecutiveStatusZeroFailures,3))return void t({kind:"fatal",error:Ex(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const n=e=>{i||(i=!0,clearTimeout(s),t(e))},s=setTimeout(()=>{this._logger.warn("Logs request timed out before receiving a response"),n({kind:"retry-later",error:Ex(void 0,"logs request timed out")})},9e4),r=this._isRequestReady;this._client.sendRequest("/i/v1/logs",{method:"POST",query:{token:this._client.projectToken},body:e,compression:"best-available",timeoutMs:6e4}).then(e=>{var t;const i=e.statusCode;this._trackEndpointReachability(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?(e.error||this._logger.warn("Logs request failed before receiving an HTTP response"),n({kind:"retry-later",error:Ex(e.error,"logs request failed before receiving an HTTP response")})):n({kind:"retry-later",error:null!==(t=e.error)&&void 0!==t?t:new Error(`logs request failed with status ${i}`)})},e=>{n({kind:"retry-later",error:e})})})}_trackEndpointReachability(e,t){(0!==e||t)&&(this._consecutiveStatusZeroFailures=Xr(e,this._consecutiveStatusZeroFailures,3,()=>this._logger.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}_flushViaTransport(e){this._queue.length>0&&this._drainQueueViaTransport(e,this._queue,this._resolvedConfig,this._client.library.name,e=>{this._queue=e}),this._consoleQueue.length>0&&this._drainQueueViaTransport(e,this._consoleQueue,this._consoleResolvedConfig,Cx,e=>{this._consoleQueue=e})}_drainQueueViaTransport(e,t,i,n,s){if(0===t.length)return;const r=t.map(e=>e.record);s([]);const o=yr(r,mr(i,this._client.library.name,this._client.library.version),n,this._client.library.version);this._client.sendRequest("/i/v1/logs",{method:"POST",query:{token:this._client.projectToken},body:o,compression:"best-available",transport:e,timeoutMs:6e4}).catch(e=>this._logFlushError(e))}};const Mx=Nr("[NetworkMetrics]"),Px=()=>{var t;return(null==e||null===(t=e.performance)||void 0===t?void 0:t.now)?e.performance.now():Date.now()},Rx={"http:":80,"https:":443},Fx=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),Ax=(e,t)=>{var i;const n=String(t);return{method:String(e).toUpperCase(),url:(null===(i=Jr(n))||void 0===i?void 0:i.href)||n}},Lx=(e,t,i,n,s,r,o=!1)=>{try{var a,l;const c=s();if(!c)return;const u=i||void 0,d=Px()-n,h=Jr(t.url);if(h&&"http:"!==h.protocol&&"https:"!==h.protocol)return;const p={url:(null==h?void 0:h.href)||t.url,method:t.method},g=Ct(c.name)?c.name(p):Tt(c.name)?c.name:"http.client.request.duration";if(!g)return;const _=o&&!u?void 0:((e,t)=>e?400>e?void 0:String(e):(null==t?void 0:t.name)||"_OTHER")(u,r),f=ct(ct(ct(ct(ct({},(e=>{const t=Fx.has(e)?e:"_OTHER";return ct({"http.request.method":t},"_OTHER"===t&&e!==t?{"http.request.method_original":e}:{})})(p.method)),h?(e=>{return{"server.address":e.hostname.startsWith("[")&&e.hostname.endsWith("]")?e.hostname.slice(1,-1):e.hostname,"server.port":Number(e.port)||Rx[e.protocol],"url.scheme":e.protocol.slice(0,-1),"url.template":(t=e.pathname,t.split("/").map(e=>(e=>/^\d+$/.test(e)||e.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(e))(e)?":id":e).join("/"))};var t})(h):{}),u?{"http.response.status_code":u}:{}),_?{"error.type":_}:{}),null===(a=c.attributes)||void 0===a?void 0:a.call(c,p,{status:u,durationMs:d}));null===(l=e.metrics)||void 0===l||l.histogram(g,d,{unit:"ms",attributes:f})}catch(e){Mx.error("Failed to record network metric",e)}},Ox=()=>{},Dx=(t,i)=>Ct(null==e?void 0:e.fetch)?Fg(e,"fetch",e=>function(...n){const s=Px(),r=e.apply(this,n);if(!i())return r;try{var o,a,l;const[e,c]=n,u=Ax(null!==(o=null!==(a=null==c?void 0:c.method)&&void 0!==a?a:null==e?void 0:e.method)&&void 0!==o?o:"GET",null!==(l=null==e?void 0:e.url)&&void 0!==l?l:e);return r.then(e=>(Lx(t,u,null==e?void 0:e.status,s,i,void 0,!0),e),e=>{throw Lx(t,u,void 0,s,i,e),e})}catch(e){return Mx.error("Failed to observe fetch",e),r}}):Ox,$x=(t,i)=>{var n;const s=null==e||null===(n=e.XMLHttpRequest)||void 0===n?void 0:n.prototype;if(!s)return Ox;const r=new WeakMap,o=Fg(s,"open",e=>function(...t){try{(()=>fb.has(this))()||r.set(this,Ax(t[0],t[1]))}catch(e){Mx.error("Failed to observe XHR open",e)}return e.apply(this,t)}),a=Fg(s,"send",e=>function(...n){let s;try{const e=r.get(this);if(e&&i()){const n=Px();s=()=>{this.removeEventListener("loadend",s),Lx(t,e,this.status,n,i)},Qr(this,"loadend",s)}}catch(e){Mx.error("Failed to observe XHR send",e)}try{return e.apply(this,n)}catch(e){throw s&&this.removeEventListener("loadend",s),e}});return()=>{o(),a()}},Nx=new WeakMap,Bx=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),qx={maxStringLength:2048,truncationSuffix:"..."},Hx={maxStringLength:2048,truncationSuffix:"..."};function zx(e){if(e)return!0===e?{intent:!0,model:!0}:{intent:!1!==e.intent,model:!1!==e.model}}function Ux(e,t){return{}.hasOwnProperty.call(e,t)}function Wx(e,t){const i=Object.create(e);return t&&Object.defineProperty(i,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:t}),i}function jx(e,t,i=!1){if(!Tt(e))return;const n=e.trim();return n?(i?ir(n,qx):n).slice(0,t):void 0}function Vx(e){try{return xt(e)&&!0===e.isError}catch(e){return!1}}function Gx(e){return ir(e||"Unknown error",Hx).slice(0,2048)}function Qx(e,t){try{return Gx(t?function(e){try{if(!xt(e)||!kt(e.content))return;return e.content.filter(e=>xt(e)&&"text"===e.type&&Tt(e.text)).map(e=>e.text).join(" ").trim()||void 0}catch(e){return}}(e):xt(e)&&Tt(e.message)?e.message:Tt(e)?e:String(e))}catch(e){return"Unknown error"}}function Kx(e,t,i){return t.errorResult?[{type:"Error",value:i,mechanism:{type:"generic",handled:!0,synthetic:!0,exception_id:0}}]:e.buildProperties(t.error,{handled:!0}).$exception_list.map(e=>ct(ct({},e),{},{value:Gx(e.value)}))}function Jx(e,t){if(t)return"Error";try{if(!xt(e))return"Error";let t=Tt(e.name)?e.name.trim():"";const i=e.constructor;return t&&"Error"!==t||!Ct(i)||"Error"===i.name||(t=i.name),(t||"Error").slice(0,256)}catch(e){return"Error"}}function Zx(e,t){return{message:Qx(e,t),type:Jx(e,t)}}const Yx={featureFlags:class extends px{constructor(e){const t=new _x(e.config,e._shouldDisableFlags());super(t),this.name=pb,this._instance=e,this._mutableConfigSource=t}get _crossTabPersistence(){return this._instance.persistence}updateConfig(e,t){this._mutableConfigSource.update(e,t),this._onConfigUpdated()}}},Xx={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!!(null===(e=this._lazyLoadedSessionRecording)||void 0===e?void 0:e.isStarted)}get status(){var e,t;return"awaiting_config"===this._recordingStatus||"missing_config"===this._recordingStatus?this._recordingStatus:null!==(e=null===(t=this._lazyLoadedSessionRecording)||void 0===t?void 0:t.status)&&void 0!==e?e:this._recordingStatus}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=da,this._persistFlagsOnSessionListener=void 0,this._sessionRecordingDisposed=!1,this._documentWasEverVisible=(()=>{var t,i;if(!(null==n?void 0:n.visibilityState)||"visible"===n.visibilityState)return!0;const s=null==e||null===(t=e.performance)||void 0===t||null===(i=t.getEntriesByType)||void 0===i?void 0:i.call(t,"visibility-state");return!(null==s?void 0:s.length)||s.some(e=>"visible"===e.name)})(),this._onVisibilityChange=()=>{var e,t;"visible"===(null==n?void 0:n.visibilityState)&&(this._documentWasEverVisible=!0,null===(e=this._lazyLoadedSessionRecording)||void 0===e||null===(t=e.setDocumentWasEverVisible)||void 0===t||t.call(e,!0))},!this._instance.sessionManager)throw GC.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this._config.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==n?void 0:n.addEventListener)&&Qr(n,"visibilitychange",this._onVisibilityChange)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this._sessionRecordingDisposed=!0,null==n||null===(t=n.removeEventListener)||void 0===t||t.call(n,"visibilitychange",this._onVisibilityChange),e?this._discardRecording(!0):this.stopRecording()}get _isRecordingEnabled(){var t;const i=!!(null===(t=this._instance.get_property("$session_recording_remote_config"))||void 0===t?void 0:t.enabled),n=!this._config.disable_session_recording,s=this._config.disable_session_recording||this._instance.consent.isOptedOut();return e&&i&&n&&!s}startIfEnabledOrStop(e){var t;if(this._sessionRecordingDisposed)return;if(this._isRecordingEnabled&&(null===(t=this._lazyLoadedSessionRecording)||void 0===t?void 0:t.isStarted))return;const i=!It(Object.assign)&&!It(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),GC.info("starting")):(this._recordingStatus=da,this.stopRecording())}_lazyLoadAndStart(e){var t,i;if(this._isRecordingEnabled)if("awaiting_config"!==this._recordingStatus&&"missing_config"!==this._recordingStatus&&(this._recordingStatus=fa),(null==d||null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.rrweb)||void 0===t?void 0:t.record)&&(null===(i=d.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this._onScriptLoaded(e);else{var n,s;const t=this._instance.sessionManager;null===(n=d.__PosthogExtensions__)||void 0===n||null===(s=n.loadExternalDependency)||void 0===s||s.call(n,this._instance,this._scriptName,i=>{if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager===t)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),GC.error("could not load recorder",i)):void this._onScriptLoaded(e);this._recordingStatus="disabled"})}}stopRecording(){var e,t;null===(e=this._persistFlagsOnSessionListener)||void 0===e||e.call(this),this._persistFlagsOnSessionListener=void 0,null===(t=this._lazyLoadedSessionRecording)||void 0===t||t.stop()}_discardRecording(e=!1){var t,i;null===(t=this._persistFlagsOnSessionListener)||void 0===t||t.call(this),this._persistFlagsOnSessionListener=void 0,null===(i=this._lazyLoadedSessionRecording)||void 0===i||i.discard({discardProducerEvents:e})}_resetSampling(){var e,t;null===(e=this._persistence)||void 0===e||e.unregister("$session_is_sampled"),null===(t=this._persistence)||void 0===t||t.unregister("$replay_sample_rate")}_validateSampleRate(e,t){if(Rt(e))return null;const i=Ft(e)?e:parseFloat(e);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(GC.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):i;var n}_persistRemoteConfig(e){if(this._persistence){var t,i;const n=this._persistence,s=()=>{var t;const i=!1===e.sessionRecording?void 0:e.sessionRecording,s=this._validateSampleRate(null===(t=this._config.session_recording)||void 0===t?void 0:t.sampleRate,"session_recording.sampleRate"),r=this._validateSampleRate(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:r;Rt(o)&&this._resetSampling();const a=null==i?void 0:i.minimumDurationMilliseconds;n.register({[ie]:ct(ct({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:ct({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:It(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===(t=this._persistFlagsOnSessionListener)||void 0===t||t.call(this),this._persistFlagsOnSessionListener=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.onSessionId(s)}}onRemoteConfig(e){const t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this._persistRemoteConfig(t),void this._discardRecording()):(this._persistRemoteConfig(t),void this.startIfEnabledOrStop()):("awaiting_config"===this._recordingStatus&&(this._recordingStatus="missing_config",this._instance.register_for_session({[Be]:!0}),GC.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var i;(null===(i=this._lazyLoadedSessionRecording)||void 0===i?void 0:i.log)?this._lazyLoadedSessionRecording.log(e,t):GC.warn("log called before recorder was ready")}get _scriptName(){var e,t;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.get_property(ie);return(null==i||null===(t=i.scriptConfig)||void 0===t?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){const e=this._instance.get_property(ie);if(!e)return!1;let t;try{t="object"==typeof e?e:JSON.parse(e)}catch(e){return GC.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}return!Rt(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}_onScriptLoaded(e){var t,i,n;if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager){if(!(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.initSessionRecording))return GC.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Ne]:!0});var s;if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null===(s=d.__PosthogExtensions__)||void 0===s?void 0:s.initSessionRecording(this._instance,this._documentWasEverVisible),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if("missing_config"===this._recordingStatus||"awaiting_config"===this._recordingStatus)return;return this._recordingStatus="awaiting_config",GC.info("persisted remote config is stale, requesting fresh config before starting"),void new Gk(this._instance).load()}this._recordingStatus=fa,null===(i=(n=this._lazyLoadedSessionRecording).setDocumentWasEverVisible)||void 0===i||i.call(n,this._documentWasEverVisible),this._lazyLoadedSessionRecording.start(e)}else this._recordingStatus=da}onRRwebEmit(e){var t,i;null===(t=this._lazyLoadedSessionRecording)||void 0===t||null===(i=t.onRRwebEmit)||void 0===i||i.call(t,e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||null===(t=this._persistence)||void 0===t||t.register({$replay_override_linked_flag:!0}),null===(e=this._lazyLoadedSessionRecording)||void 0===e||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null===(t=this._persistence)||void 0===t||t.register({$replay_override_sampling:!0}),null===(e=this._lazyLoadedSessionRecording)||void 0===e||e.overrideSampling()}overrideTrigger(e){var t,i;this._lazyLoadedSessionRecording||null===(i=this._persistence)||void 0===i||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(t=this._lazyLoadedSessionRecording)||void 0===t||t.overrideTrigger(e)}get sdkDebugProperties(){var e;const t={};for(const e of QC){var i;const n=null===(i=this._instance.sessionPersistence)||void 0===i?void 0:i.get_property(e);It(n)||(t[e]=n)}return ct(ct({},t),(null===(e=this._lazyLoadedSessionRecording)||void 0===e?void 0:e.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(e,t){var i;return!!(null===(i=this._lazyLoadedSessionRecording)||void 0===i?void 0:i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;null===(e=this._lazyLoadedSessionRecording)||void 0===e||null===(t=e.flushBeforeIdentityReset)||void 0===t||t.call(e)}}},eE={autocapture:class extends hb{constructor(e){super(new BC(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._isFlushingPageview=!1,this._instance=e,this._lastLocation=this._getCurrentLocation()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this._getCaptureOptions();return!!(e.path||e.search||this._shouldCaptureHashChanges(e))}startIfEnabled(){this.isEnabled&&($r.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this._lastLocation=this._getCurrentLocation(),this.startIfEnabled()}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,this._hashchangeListener&&this._hashchangeListener(),this._hashchangeListener=void 0,$r.info("History API monitoring stopped")}monitorHistoryChanges(){e&&e.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener(),this._shouldCaptureHashChanges()&&this._setupHashchangeListener())}_patchHistoryMethod(t){var i;if(!e||(null===(i=e.history[t])||void 0===i?void 0:i.__posthog_wrapped__))return;const n=this;Fg(e.history,t,i=>function(s,r,o){var a;n._isUrlChanging(o)&&n._flushPendingPageview(),i.call(this,s,r,o),n._capturePageview(t,!n._isFlushingPageview&&"popstate"!==(null==e||null===(a=e.event)||void 0===a?void 0:a.type))})}_getCurrentLocation(){const t=null==e?void 0:e.location;if(null==t?void 0:t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}_getCaptureOptions(){const e=this._instance.config.capture_pageview;return"history_change"===e?{path:!0}:xt(e)?e:{}}_shouldCaptureHashChanges(e=this._getCaptureOptions()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}_hasLocationChanged(e){const t=this._getCaptureOptions(),i=this._lastLocation;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this._shouldCaptureHashChanges(t)&&e.hash!==i.hash))}_capturePageview(e,t=!1){try{t||this._flushPendingPageview();const i=this._getCurrentLocation();if(!i)return;if(this._hasLocationChanged(i)){const i=()=>this._instance.capture(et,{navigation_type:e});t?(this._pendingPageview=i,Promise.resolve().then(()=>this._flushPendingPageview())):i()}this._lastLocation=i}catch(t){$r.error(`Error capturing ${e} pageview`,t)}}_isUrlChanging(t){var i,n;return!(Rt(t)||!e)&&(null===(i=Jr(String(t)))||void 0===i?void 0:i.href)!==(null===(n=e.location)||void 0===n?void 0:n.href)}_flushPendingPageview(){const e=this._pendingPageview;if(e){this._pendingPageview=void 0,this._isFlushingPageview=!0;try{e()}catch(e){$r.error("Error capturing deferred pageview",e)}finally{this._isFlushingPageview=!1}this._lastLocation=this._getCurrentLocation()}}_setupPopstateListener(){if(this._popstateListener)return;const t=()=>{this._capturePageview("popstate")};Qr(e,"popstate",t),this._popstateListener=()=>{e&&e.removeEventListener("popstate",t)}}_setupHashchangeListener(){if(this._hashchangeListener)return;const t=()=>{this._capturePageview("hashchange")};Qr(e,"hashchange",t),this._hashchangeListener=()=>{e&&e.removeEventListener("hashchange",t)}}},heatmaps:class{get _config(){return this.instance.config}constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!!(null===(t=this.instance.persistence)||void 0===t?void 0:t.props[G]),this.rageclicks=new ib(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return xt(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Rt(this._config.capture_heatmaps)?Rt(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;KC.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("heatmaps"in t))return;const i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[G]:i}),this._enabledServerSide=i,this.startIfEnabled()}getAndClearBuffer(){const e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){JC(e.originalEvent)&&this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval=function(e){return"visible"===(null==e?void 0:e.visibilityState)}(n)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){e&&n&&(this._flushHandler=this._flush.bind(this),Qr(e,Xe,this._flushHandler),this._onClickHandler=t=>this._onClick(t||(null==e?void 0:e.event)),Qr(n,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=t=>this._onMouseMove(t||(null==e?void 0:e.event)),Qr(n,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new bk(this.instance,mk,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),Qr(n,I,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var t;e&&n&&(this._flushHandler&&e.removeEventListener(Xe,this._flushHandler),this._onClickHandler&&n.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&n.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&n.removeEventListener(I,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null===(t=this._deadClicksCapture)||void 0===t||t.stop(),this._initialized=!1)}_getProperties(t,i){const n=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(t,i,n){let s=t;for(;s&&co(s)&&!uo(s,"body");){if(s===n)return!1;let t;try{var r,o,a;t=null===(r=null!==(o=null===(a=s.ownerDocument)||void 0===a?void 0:a.defaultView)&&void 0!==o?o:e)||void 0===r?void 0:r.getComputedStyle(s).position}catch(e){return!1}if(ft(i,t))return!0;s=ko(s)}return!1}(yo(t),["fixed","sticky"],r);return{x:t.clientX+(o?0:s),y:t.clientY+(o?0:n),target_fixed:o,type:i}}_onClick(e,t="click"){var i;if(lo(e.target)||!JC(e))return;const n=this._getProperties(e,t);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(e.clientX,e.clientY,(new Date).getTime()))&&$o(yo(e),this.instance.config.rageclick)&&this._capture(ct(ct({},n),{},{type:"rageclick"})),this._capture(n)}_onMouseMove(e){!lo(e.target)&&JC(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(e,"mousemove"))},500))}_capture(t){if(!e)return;const i=this._config.disable_capture_url_hashes?un(e.location.href):e.location.href,n=this._config.custom_personal_data_properties,s=this._config.mask_personal_data_properties?[...xc,...n||[]]:[],r=so(i,s,Ic);this._buffer=this._buffer||{},this._buffer[r]||(this._buffer[r]=[]),this._buffer[r].push(t)}_flush(){this._buffer&&!Et(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:bk,webVitalsAutocapture:class{constructor(t){var i;this._instance=t,this._enabledServerSide=!1,this._initialized=!1,this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=(e=!1)=>{clearTimeout(this._delayedFlushTimer),this._delayedFlushTimer=void 0,0!==this._buffer.metrics.length&&(this._instance.capture("$web_vitals",ct({$current_url:this._buffer.url},this._buffer.metrics.reduce((e,t)=>ct(ct({},e),{},{[`$web_vitals_${t.name}_event`]:ct({},t),[`$web_vitals_${t.name}_value`]:t.value}),{})),e?{transport:"sendBeacon",send_instantly:!0}:void 0),this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=e=>{var t;if(this._buffer=this._buffer||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Rt(null==e?void 0:e.name)||Rt(null==e?void 0:e.value))return void zC.error("Invalid metric received",e);const i="string"==typeof e.navigationURL?e.navigationURL:void 0,n=this._maskedURL(i);if(It(n))return;const s=Ft(e.navigationId)||"string"==typeof e.navigationId?`navigation:${e.navigationId}`:`url:${n}`;if(this._maxAllowedValue&&e.value>=this._maxAllowedValue)return void zC.error("Ignoring metric with value >= "+this._maxAllowedValue,e);this._buffer.navigationKey!==s&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),It(this._buffer.navigationKey)&&(this._buffer.navigationKey=s,this._buffer.url=n),this._buffer.firstMetricTimestamp=It(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp;const r=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0),o=ct(ct(ct({},e),i?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete o.entries,xt(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){const t={};for(const i of VC){const n="url"===i&&"string"==typeof e.attribution[i]?this._maskedURL(e.attribution[i]):e.attribution[i];It(n)||(t[i]=n)}o.attribution=t}else delete o.attribution;It(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this._buffer.metrics.push(o),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()},this._startCapturing=()=>{if(this._initialized)return;let t,i,n,s,r=!1;const o=d.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this._callbackFlavor])||("web-vitals"===this._callbackFlavor&&It(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!It(l)){const e=l.withoutAttribution,o=this.attributionMetrics;r=!It(e),t=o.indexOf("LCP")>-1?l.onLCP:(null==e?void 0:e.onLCP)||l.onLCP,i=o.indexOf("CLS")>-1?l.onCLS:(null==e?void 0:e.onCLS)||l.onCLS,n=o.indexOf("FCP")>-1?l.onFCP:(null==e?void 0:e.onFCP)||l.onFCP,s=o.indexOf("INP")>-1?l.onINP:(null==e?void 0:e.onINP)||l.onINP}if(!(t&&i&&n&&s))return void zC.error("web vitals callbacks not loaded - not starting");const c={reportSoftNavs:this.useSoftNavs},u=r&&this.attributionMetrics.indexOf("INP")>-1?ct(ct({},c),{},{includeProcessedEventEntries:!1}):c;this.allowedMetrics.indexOf("LCP")>-1&&t(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("CLS")>-1&&i(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("FCP")>-1&&n(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("INP")>-1&&s(this._addToBuffer.bind(this),u);const h=null==e?void 0:e.document;Qr(h,I,()=>{"hidden"===(null==h?void 0:h.visibilityState)&&this._flushToCapture(!0)}),Qr(e,"pagehide",()=>this._flushToCapture(!0)),this._initialized=!0},this._enabledServerSide=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[Z]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const i=xt(this._perfConfig)?null===(e=this._perfConfig)||void 0===e?void 0:e.web_vitals_allowed_metrics:void 0;return Rt(i)?(null===(t=this._instance.persistence)||void 0===t?void 0:t.props.$web_vitals_allowed_metrics)||WC:i}get flushToCaptureTimeoutMs(){return(xt(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=xt(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return Lt(e)?e?WC:[]:kt(e)?e:jC}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=xt(this._perfConfig)?this._perfConfig.__preview_web_vitals_soft_navs:void 0;return null!=e&&e}get _maxAllowedValue(){const e=xt(this._perfConfig)&&Ft(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:UC;return e>0&&6e4>=e?UC:e}get isEnabled(){const e=null==s?void 0:s.protocol;if("http:"!==e&&"https:"!==e)return zC.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=xt(this._perfConfig)?this._perfConfig.web_vitals:Lt(this._perfConfig)?this._perfConfig:void 0;return Lt(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(zC.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const i=xt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,n=xt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Z]:i}),this._instance.persistence.register({[te]:n})),this._enabledServerSide=i,this.startIfEnabled()}get _callbackFlavor(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}_loadScript(e){var t;const i=d.__PosthogExtensions__,n=this._callbackFlavor,s=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==s?void 0:s[n])||"web-vitals"===n&&It(s)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?e():null==i||null===(t=i.loadExternalDependency)||void 0===t||t.call(i,this._instance,n,t=>{t?zC.error("failed to load script",t):e()})}_maskedURL(t){const i=t||(null==e?void 0:e.location.href);if(!i)return void zC.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?un(i):i,s=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...xc,...s||[]]:[];return so(n,r,Ic)}}},tE={exceptionObserver:class{constructor(t){var i;this._startCapturing=()=>{var t;if(!e||!this.isEnabled||!(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions))return;const i=d.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=d.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=d.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=i(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=n(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=s(this.captureException.bind(this)))}catch(e){qC.error("failed to start",e),this._stopCapturing()}},this._instance=t,this._remoteEnabled=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[Q]),this._rateLimiter=new Jt(ct(ct({},function(e={}){var t,i,n,s;return{refillRate:null!==(t=null!==(i=e.exceptionRateLimiterRefillRate)&&void 0!==i?i:e.__exceptionRateLimiterRefillRate)&&void 0!==t?t:1,bucketSize:null!==(n=null!==(s=e.exceptionRateLimiterBucketSize)&&void 0!==s?s:e.__exceptionRateLimiterBucketSize)&&void 0!==n?n:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,_logger:qC})),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return xt(e)?t=ct(ct({},t),e):(It(e)?this._remoteEnabled:e)&&(t=ct(ct({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(qC.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,i,n;(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions)?e():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"exception-autocapture",t=>{if(t)return qC.error("failed to load script",t);e()})}_stopCapturing(){var e,t,i;null===(e=this._unwrapOnError)||void 0===e||e.call(this),this._unwrapOnError=void 0,null===(t=this._unwrapUnhandledRejection)||void 0===t||t.call(this),this._unwrapUnhandledRejection=void 0,null===(i=this._unwrapConsoleError)||void 0===i||i.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this._remoteEnabled=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Q]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}onConfigChange(){this._config=this._requiredConfig()}captureException(e){try{var t,i,n;const s=null!==(t=null==e||null===(i=e.$exception_list)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.type)&&void 0!==t?t:"Exception";if(this._rateLimiter.consumeRateLimit(s))return void qC.info("Skipping exception capture because of client rate limiting.",{exception:s});null===(n=this._instance.exceptions)||void 0===n||n.sendExceptionEvent(e)}catch(e){}}},exceptions:class{constructor(e){var t,i;this._suppressionRules=[],this._errorPropertiesBuilder=nS(),this._instance=e,this._suppressionRules=null!==(t=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==t?t:[],this._exceptionStepsConfig=ns(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new ss(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=ns(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,i,n;if(!e.ok)return;const s=e.config;if(!("errorTracking"in s))return;const r=null!==(t=null===(i=s.errorTracking)||void 0===i?void 0:i.suppressionRules)&&void 0!==t?t:[],o=null===(n=s.errorTracking)||void 0===n?void 0:n.captureExtensionExceptions;this._suppressionRules=r,this._instance.persistence&&this._instance.persistence.register({[K]:this._suppressionRules,[J]:o})}get _captureExtensionExceptions(){var e;const t=!!this._instance.get_property(J),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this._errorPropertiesBuilder.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this._exceptionStepsConfig.enabled)try{if(!Tt(e)||0===e.trim().length)return void Yb.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:i,droppedKeys:n}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};const t=[];return{sanitizedProperties:Object.keys(e).reduce((i,n)=>ts.has(n)?(t.push(n),i):(i[n]=e[n],i),{}),droppedKeys:t}}(this._coerceExceptionStepProperties(t));n.length>0&&Yb.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this._exceptionStepsBuffer.add(ct({[Xn]:e,[es]:(new Date).toISOString()},i))}catch(e){Yb.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return this._addDroppedExceptionStep("Exception dropped: matched a suppression rule"),void Yb.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by a browser extension"),void Yb.info("Skipping exception capture because it was thrown by an extension");if(!this._captureExtensionExceptions&&this._isInjectedBrowserScriptException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by an injected browser script"),void Yb.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by the PostHog SDK"),void Yb.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this._exceptionStepsConfig.enabled&&Rt(e.$exception_steps)?this._addBufferedExceptionSteps(e):e,n=function(){if("u">typeof process){var e;const t=null===(e=process.env.POSTHOG_RELEASE_ID)||void 0===e?void 0:e.trim();if(t)return t}const t=globalThis._posthogReleaseId;return"string"==typeof t&&t.length>0?t:void 0}();n&&(i.$release_id=n);try{const e=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return e&&this._exceptionStepsBuffer.clear(),e}catch(e){return Zb(e)||Yb.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void(Zb(e)||Yb.error("Failed to process exception event. Ignoring this exception.",e))}}_addBufferedExceptionSteps(e){try{const t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:ct(ct({},e),{},{$exception_steps:t})}catch(t){return Yb.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[Xn]:e,[es]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return xt(e)?ct({},e):{}}_getExceptionStepsConfig(){var e,t;return null!==(e=null===(t=this._instance.config.error_tracking)||void 0===t?void 0:t.exception_steps)&&void 0!==e?e:{}}_matchesSuppressionRule(e){if(0===e.length)return!1;try{const t=e.reduce((e,{type:t,value:i})=>(Tt(t)&&t.length>0&&e.$exception_types.push(t),Tt(i)&&i.length>0&&e.$exception_values.push(i),e),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some(e=>{const i=e.values.map(e=>{const i=pc[e.operator],n=t[e.key];if(!i||!n)return!1;const s=kt(e.value)?e.value:[e.value];return s.length>0&&i(s,n)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}catch(e){return Yb.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}_isExtensionException(e){const t=e.flatMap(e=>{var t,i;return null!==(t=null===(i=e.stacktrace)||void 0===i?void 0:i.frames)&&void 0!==t?t:[]}),i=t.filter(({filename:e})=>!!e&&tS.some(t=>e.startsWith(t)));return 0!==i.length&&(!i.every(({filename:e})=>!!e&&e.startsWith(Xb))||e.some(({type:e,value:t})=>"NoResponse"===e||Tt(t)&&eS.some(({value:e,exact:i})=>i?t===e:t.includes(e)))&&!t.some(({in_app:e,filename:t})=>e&&!(null==t?void 0:t.startsWith(Xb))))}_isInjectedBrowserScriptException(e){return e.some(({value:e})=>Tt(e)&&iS.some(t=>e.includes(t)))}_isPostHogException(e){if(e.length>0){var t,i,n,s;const r=null!==(t=null===(i=e[0].stacktrace)||void 0===i?void 0:i.frames)&&void 0!==t?t:[],o=r[r.length-1];return null!==(n=null==o||null===(s=o.filename)||void 0===s?void 0:s.includes("posthog.com/static"))&&void 0!==n&&n}return!1}_isExceptionList(e){return!Rt(e)&&kt(e)}}},iE=ct({productTours:class{get _persistence(){return this._instance.persistence}constructor(e){this._productTourManager=null,this._cachedTours=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var i,n;if(this._persistence&&this._persistence.register({[X]:!!t.productTours}),!YC(this._instance))return!this._productTourManager&&Rt(null===(i=this._persistence)||void 0===i?void 0:i.props.ph_product_tours)||ZC.info("product tours disabled; stopping and clearing cached tours"),null===(n=this._productTourManager)||void 0===n||n.stop(),this._productTourManager=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this._productTourManager&&YC(this._instance)&&this._loadScript(()=>this._startProductTours())}_loadScript(e){var t,i,n;(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)?e():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"product-tours",t=>{t?ZC.error("Could not load product tours script",t):e()})}_startProductTours(){var e;!this._productTourManager&&(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)&&(this._productTourManager=d.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(kt(this._cachedTours)&&!t)return void e(this._cachedTours,{isLoaded:!0});const i=this._persistence;if(i){const n=i.props[be];if(kt(n)&&!t)return this._cachedTours=n,void e(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:t=>{if(!YC(this._instance))return void e([],{isLoaded:!0});const n=t.statusCode;if(200!==n||!t.json){const i=`Product Tours API could not be loaded, status: ${n}`;return 0===n?t.error||ZC.warn(i):ZC.error(i),void e([],{isLoaded:!1,error:i})}const s=kt(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=s,i&&i.register({[be]:s}),e(s,{isLoaded:!0})}})}getActiveProductTours(e){Rt(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript(()=>{var t;this._startProductTours(),null===(t=this._productTourManager)||void 0===t||t.previewTour(e)})}dismissProductTour(){var e;null===(e=this._productTourManager)||void 0===e||e.dismissTour("user_clicked_skip")}nextStep(){var e;null===(e=this._productTourManager)||void 0===e||e.nextStep()}previousStep(){var e;null===(e=this._productTourManager)||void 0===e||e.previousStep()}clearCache(){var e;this._cachedTours=null,null===(e=this._persistence)||void 0===e||e.unregister("ph_product_tours")}resetTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.resetTour(e)}resetAllTours(){var e;null===(e=this._productTourManager)||void 0===e||e.resetAllTours()}cancelPendingTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.cancelPendingTour(e)}}},Yx),nE={siteApps:class{constructor(e){this._instance=e,this._siteAppElementPatchCount=0,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(!t)return;const i=this.globalsForEvent(t);this._bufferedInvocations.push(i),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}get siteAppLoaders(){var e;return null===(e=d._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,i,n,s,r,o,a;if(!e)throw new Error("Event payload is required");const l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(const[e,t]of Object.entries(u))l[e]={id:c[e],type:e,properties:t};const{$set_once:d,$set:h}=e;return{event:ct(ct({},bs(e,XC)),{},{properties:ct(ct(ct({},e.properties),h?{$set:ct(ct({},null!==(t=null===(i=e.properties)||void 0===i?void 0:i.$set)&&void 0!==t?t:{}),h)}:{}),d?{$set_once:ct(ct({},null!==(n=null===(s=e.properties)||void 0===s?void 0:s.$set_once)&&void 0!==n?n:{}),d)}:{}),elements_chain:null!==(r=null===(o=e.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(a=e.properties)||void 0===a?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}_prepareElementForSiteApp(e){var t;const i=null===(t=e.tagName)||void 0===t?void 0:t.toLowerCase();if("style"===i&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(e)||(ex.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===i&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(e)||(ex.error("prepare_external_dependency_script returned null"),null)}return e}_patchSiteAppElementInsertionMethods(){var e,t,i,s,r,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const c=null==n?void 0:n.defaultView,u=null==c||null===(e=c.Node)||void 0===e?void 0:e.prototype;if(!c||!u)return()=>{};if(this._siteAppElementPatchCount++,this._restoreSiteAppElementPatches)return this._releaseSiteAppElementPatches();const d=[],h=this,p=new WeakSet,g=(e,t,i)=>{if(!(null==e?void 0:e[t]))return;const n=e[t];e[t]=i(n),d.push(()=>{e[t]=n})},_=e=>{if(p.has(e))return e;const t=h._prepareElementForSiteApp(e);return t&&p.add(t),t},f=e=>e.map(e=>"string"==typeof e?e:_(e)).filter(e=>!Pt(e));return g(u,"appendChild",e=>function(t){const i=_(t);return i?e.call(this,i):t}),g(u,"insertBefore",e=>function(t,i){const n=_(t);return n?e.call(this,n,i):t}),g(u,"replaceChild",e=>function(t,i){const n=_(t);return n?e.call(this,n,i):i}),[null===(t=c.Element)||void 0===t?void 0:t.prototype,null===(i=c.Document)||void 0===i?void 0:i.prototype,null===(s=c.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(e=>{g(e,"append",e=>function(...t){return e.apply(this,f(t))}),g(e,"prepend",e=>function(...t){return e.apply(this,f(t))})}),[null===(r=c.Element)||void 0===r?void 0:r.prototype,null===(o=c.CharacterData)||void 0===o?void 0:o.prototype,null===(a=c.DocumentType)||void 0===a?void 0:a.prototype].forEach(e=>{g(e,"before",e=>function(...t){return e.apply(this,f(t))}),g(e,"after",e=>function(...t){return e.apply(this,f(t))}),g(e,"replaceWith",e=>function(...t){const i=f(t);return t.length&&!i.length?void 0:e.apply(this,i)})}),g(null===(l=c.Element)||void 0===l?void 0:l.prototype,"insertAdjacentElement",e=>function(t,i){const n=_(i);return n?e.call(this,t,n):null}),this._restoreSiteAppElementPatches=()=>{d.forEach(e=>e()),this._restoreSiteAppElementPatches=void 0},this._releaseSiteAppElementPatches()}_releaseSiteAppElementPatches(){let e=!1;return()=>{var t;e||(e=!0,this._siteAppElementPatchCount--,0===this._siteAppElementPatchCount&&(null===(t=this._restoreSiteAppElementPatches)||void 0===t||t.call(this)))}}_runWithPreparedSiteAppElements(e,t=!0){const i=this._patchSiteAppElementInsertionMethods();try{const n=e(i);return t&&i(),n}catch(e){throw i(),e}}setupSiteApp(e){const t=this.apps[e.id],i=()=>{var i;!t.errored&&this._bufferedInvocations.length&&(ex.info(`Processing ${this._bufferedInvocations.length} events for site app with id ${e.id}`),this._bufferedInvocations.forEach(e=>this._runWithPreparedSiteAppElements(()=>{var i;return null===(i=t.processEvent)||void 0===i?void 0:i.call(t,e)})),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null===(i=this._stopBuffering)||void 0===i||i.call(this))};let n=!1;const s=s=>{t.errored=!s,t.loaded=!0,ex.info(`Site app with id ${e.id} ${s?"loaded":"errored"}`),n&&i()};try{const{processEvent:i}=this._runWithPreparedSiteAppElements(t=>e.init({posthog:this._instance,callback(e){t(),s(e)}}),!1);i&&(t.processEvent=i),n=!0}catch(t){ex.error(tx+e.id,t),s(!1)}if(n&&t.loaded)try{i()}catch(i){ex.error(`Error while processing buffered events PostHog app with config id ${e.id}`,i),t.errored=!0}}_setupSiteApps(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}_onCapturedEvent(e){if(0===Object.keys(this.apps).length)return;const t=this.globalsForEvent(e);for(const i of Object.values(this.apps))try{this._runWithPreparedSiteAppElements(()=>{var e;return null===(e=i.processEvent)||void 0===e?void 0:e.call(i,t)})}catch(t){ex.error(`Error while processing event ${e.event} for site app ${i.id}`,t)}}onRemoteConfig(e){var t,i,n;if(null===(t=this.siteAppLoaders)||void 0===t?void 0:t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",e=>this._onCapturedEvent(e))):void ex.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this._stopBuffering)||void 0===i||i.call(this),!e.ok)return;const s=e.config;if(null===(n=s.siteApps)||void 0===n?void 0:n.length)if(this.isEnabled)for(const{id:e,url:t}of s.siteApps){var r,o;d[`__$$ph_site_app_${e}`]=this._instance,null===(r=d.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,t,t=>{if(t)return ex.error(tx+e,t)})}else ex.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},sE={tracingHeaders:class{constructor(e){this._instance=e,this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._hostnamesForPatch=void 0,this._startCapturing=()=>{const e=this._syncHostnamesForPatch();var t,i;e?(It(this._restoreXHRPatch)&&(this._restoreXHRPatch=null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.tracingHeadersPatchFns)||void 0===t?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),It(this._restoreFetchPatch)&&(this._restoreFetchPatch=null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this._stopCapturing()}}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,i,n;(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.tracingHeadersPatchFns)?e():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"tracing-headers",t=>{if(t)return HC.error("failed to load script",t);e()})}_getConfiguredHostnames(){var e,t;return null!==(e=null!==(t=this._instance.config.tracing_headers)&&void 0!==t?t:this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}_syncHostnamesForPatch(){const e=this._getConfiguredHostnames();return kt(e)?(kt(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(kt(this._hostnamesForPatch)&&this._hostnamesForPatch.splice(0),this._hostnamesForPatch=e||void 0,this._hostnamesForPatch)}_stopCapturing(){var e,t;null===(e=this._restoreXHRPatch)||void 0===e||e.call(this),null===(t=this._restoreFetchPatch)||void 0===t||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0}startIfEnabledOrStop(){this._syncHostnamesForPatch()?this._loadScript(this._startCapturing):this._stopCapturing()}}},rE=ct({surveys:class extends tb{constructor(e){super(new Db(e))}}},Yx),oE={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){d.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=d.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t=void 0,i=void 0,s=void 0){var r,o;if(Kr(this.instance.config))return!1;if(!e||!n)return!1;t=null!==(r=t)&&void 0!==r?r:e.location,s=null!==(o=s)&&void 0!==o?o:e.history;try{if(!i){try{e.localStorage.setItem("test","test"),e.localStorage.removeItem("test")}catch(e){return!1}i=null==e?void 0:e.localStorage}const n=ix||ro(t.hash,"__posthog")||ro(t.hash,"state");let r;const o=n?dn(()=>JSON.parse(atob(decodeURIComponent(n))))||dn(()=>JSON.parse(decodeURIComponent(n))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?t.hash=o.desiredHash:s?s.replaceState(s.state,"",t.pathname+t.search):t.hash="")):(r=JSON.parse(i.getItem(nx)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(e){return!1}}_callLoadToolbar(e){const t=d.ph_load_toolbar||d.ph_load_editor;!Rt(t)&&Ct(t)?t(e,this.instance):sx.warn("No toolbar load function found")}loadToolbar(t){const i=!!(null==n?void 0:n.getElementById("__POSTHOG_TOOLBAR__"));if(!e||i)return!1;const s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=ct(ct({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(e.localStorage.setItem(nx,JSON.stringify(ct(ct({},r),{},{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(r);else if(0===this._getToolbarState()){var o,a;this._setToolbarState(1),null===(o=d.__PosthogExtensions__)||void 0===o||null===(a=o.loadExternalDependency)||void 0===a||a.call(o,this.instance,"toolbar",e=>{if(e)return sx.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(r)}),Qr(e,"turbolinks:load",()=>{this._setToolbarState(0),this.loadToolbar(r)})}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,i=void 0){return this.maybeLoadToolbar(e,t,i)}}},aE=ct({experiments:class t{get _config(){return this._instance.config}constructor(e){this._instance=e,this.getWebExperimentsAndEvaluateDisplayLogic=(e=!1)=>{this.getWebExperiments(e=>{t._logInfo("retrieved web experiments from the server"),this._flagToExperiments=new Map,e.forEach(e=>{if(e.feature_flag_key){var i;this._flagToExperiments&&(t._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null===(i=this._flagToExperiments)||void 0===i||i.set(e.feature_flag_key,e));const n=this._instance.getFeatureFlag(e.feature_flag_key);Tt(n)&&e.variants[n]&&this._applyTransforms(e.name,n,e.variants[n].transforms)}else if(e.variants)for(const i in e.variants){const n=e.variants[i];t._matchesTestVariant(n,this._instance)&&this._applyTransforms(e.name,i,n.transforms)}})},e)},this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())t._logInfo(fx);else if(!this._config.disable_web_experiments){if(Rt(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t._logInfo("applying feature flags",e),e.forEach(e=>{var t;if(this._flagToExperiments&&(null===(t=this._flagToExperiments)||void 0===t?void 0:t.has(e))){var i;const t=this._instance.getFeatureFlag(e),n=null===(i=this._flagToExperiments)||void 0===i?void 0:i.get(e);t&&(null==n?void 0:n.variants[t])&&this._applyTransforms(n.name,t,n.variants[t].transforms)}})}}previewWebExperiment(){const e=t.getWindowLocation();if(null==e?void 0:e.search){const i=no(null==e?void 0:e.search,"__experiment_id"),n=no(null==e?void 0:e.search,"__experiment_variant");i&&n&&(t._logInfo(`previewing web experiments ${i} && ${n}`),this.getWebExperiments(e=>{this._showPreviewWebExperiment(parseInt(i),n,e)},!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._config.disable_web_experiments&&!i)return e([]);const n=this._instance.get_property("$web_experiments");if(n&&!t)return e(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this._config.token}`),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}_showPreviewWebExperiment(e,i,n){const s=n.filter(t=>t.id===e);s&&s.length>0&&(t._logInfo(`Previewing web experiment [${s[0].name}] with variant [${i}]`),this._applyTransforms(s[0].name,i,s[0].variants[i].transforms))}static _matchesTestVariant(e,i){return!Rt(e.conditions)&&t._matchUrlConditions(e,i)&&t._matchUTMConditions(e)}static _matchUrlConditions(e,i){var n;if(Rt(e.conditions)||Rt(null===(n=e.conditions)||void 0===n?void 0:n.url))return!0;const s=t.getWindowLocation();if(s){var r,o,a;const t=oo(i,s.href);return!(null===(r=e.conditions)||void 0===r?void 0:r.url)||yx[null!==(o=null===(a=e.conditions)||void 0===a?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](e.conditions.url,t)}return!1}static getWindowLocation(){return null==e?void 0:e.location}static _matchUTMConditions(e){var t;if(Rt(e.conditions)||Rt(null===(t=e.conditions)||void 0===t?void 0:t.utm))return!0;const i=Mc();if(i.utm_source){var n,s,r,o,a,l,c,u;const t=!(null===(n=e.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)||(null===(s=e.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)==i.utm_campaign,d=!(null===(r=e.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=e.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==i.utm_source,h=!(null===(a=e.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)||(null===(l=e.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)==i.utm_medium,p=!(null===(c=e.conditions)||void 0===c||null===(c=c.utm)||void 0===c?void 0:c.utm_term)||(null===(u=e.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)==i.utm_term;return t&&h&&p&&d}return!1}static _logInfo(e,...t){$r.info(`[WebExperiments] ${e}`,t)}static _sanitizeLinkTargets(e){("http://www.w3.org/1999/xhtml"===e.namespaceURI&&"template"===e.localName?e.content:e).querySelectorAll("a[target], template").forEach(e=>{var i;if("template"===e.localName)return void("http://www.w3.org/1999/xhtml"===e.namespaceURI&&t._sanitizeLinkTargets(e));if("http://www.w3.org/1999/xhtml"!==e.namespaceURI||"_blank"!==(null===(i=e.getAttribute("target"))||void 0===i?void 0:i.toLowerCase()))return void e.removeAttribute("target");const n=(e.getAttribute("rel")||"").split(/\s+/).filter(e=>e&&!/^(opener|noopener)$/i.test(e));n.push("noopener"),e.setAttribute("rel",n.join(" "))})}_applyTransforms(e,i,n){this._is_bot()?t._logInfo(fx):"control"!==i?n.forEach(n=>{if(n.selector){var s;t._logInfo(`applying transform of variant ${i} for experiment ${e} `,n);const r=null===(s=document)||void 0===s?void 0:s.querySelectorAll(n.selector),o=new Map;null==r||r.forEach(e=>{if("script"===e.localName.toLowerCase())return;const i=e;if(n.html){var s;const a="http://www.w3.org/1998/Math/MathML"===e.namespaceURI&&"annotation-xml"===e.localName&&(null===(s=e.getAttribute("encoding"))||void 0===s?void 0:s.toLowerCase())||"",l=JSON.stringify([e.namespaceURI,e.localName,a]);let c=o.get(l);if(Rt(c)){var r;const i=null!==(r=mx)&&void 0!==r?r:mx=km(),s=e.ownerDocument.implementation.createHTMLDocument(""),u=s.createElementNS(e.namespaceURI,e.localName);a&&u.setAttribute("encoding",a);const d=s.createRange();d.selectNodeContents(u);const h="http://www.w3.org/2000/svg"===e.namespaceURI&&/^(foreignObject|desc|title)$/.test(e.localName)||/^(text\/html|application\/xhtml\+xml)$/.test(a)?"http://www.w3.org/1999/xhtml":e.namespaceURI,p=d.createContextualFragment(n.html);"http://www.w3.org/1998/Math/MathML"===e.namespaceURI&&/^(mi|mo|mn|ms|mtext)$/.test(e.localName)?(u.appendChild(p),i.sanitize(u,ct(ct({},vx),{},{NAMESPACE:h||void 0,IN_PLACE:!0}))):("http://www.w3.org/1999/xhtml"===u.namespaceURI&&"template"===u.localName?u.content:u).appendChild(i.sanitize(p,ct(ct({},vx),{},{NAMESPACE:h||void 0,RETURN_DOM_FRAGMENT:!0}))),t._sanitizeLinkTargets(u),c=u.innerHTML,o.set(l,c)}i.innerHTML=c}n.css&&i.setAttribute("style",n.css)})}}):t._logInfo("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?oC(i,this._config.custom_blocked_useragents):void 0}}},Yx),lE={conversations:class{constructor(e){this._instance=e,this._isConversationsEnabled=void 0,this._conversationsManager=null,this._isInitializing=!1,this._remoteConfig=null,this._loadFailed=!1,this._resetGeneration=0,this._pendingPanelAction=null,this._theme=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations)return void(this._pendingPanelAction=null);if(this._remoteConfigSuccessful=e.ok,!e.ok)return;const t=e.config.conversations;Rt(t)?this._pendingPanelAction=null:(Lt(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this._isConversationsEnabled||(this._pendingPanelAction=null),this.loadIfEnabled())}reset(){var e;null===(e=this._conversationsManager)||void 0===e||e.reset(),this._conversationsManager=null,this._resetGeneration++,this._isConversationsEnabled=void 0,this._remoteConfig=null,this._remoteConfigSuccessful=void 0,this._loadFailed=!1,this._pendingPanelAction=null}loadIfEnabled(){if(this._conversationsManager)return;if(this._isInitializing)return;if(this._instance.config.disable_conversations)return;if(Kr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=null==d?void 0:d.__PosthogExtensions__;if(e&&!It(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{const t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);const i=e.loadExternalDependency;if(!i)return void this._handleLoadError(R);const n=this._resetGeneration;i(this._instance,"conversations",t=>{if(n!==this._resetGeneration)return this._isInitializing=!1,void this.loadIfEnabled();t||!e.initConversations?this._handleLoadError("Could not load conversations script",t):this._completeInitialization(e.initConversations),this._isInitializing=!1})}catch(e){this._handleLoadError("Error initializing conversations",e),this._isInitializing=!1}}else bx.error("Conversations enabled but missing token in remote config.")}_completeInitialization(e){if(this._remoteConfig){try{this._conversationsManager=e(this._remoteConfig,this._instance),this._loadFailed=!1,bx.info("Conversations loaded successfully")}catch(e){return void this._handleLoadError("Error completing conversations initialization",e)}this._theme&&this._conversationsManager.setTheme(this._theme),this._applyPendingPanelAction()}else bx.error("Cannot complete initialization: remote config is null")}_applyPendingPanelAction(){const e=this._pendingPanelAction;this._pendingPanelAction=null,this._conversationsManager&&e&&("open"===e?this._conversationsManager.open():this._conversationsManager.close())}_handleLoadError(e,t){bx.error(e,t),this._conversationsManager=null,this._isInitializing=!1,this._loadFailed=!0}show(){this._conversationsManager?this._conversationsManager.show():bx.warn("Conversations not loaded yet.")}hide(){"open"===this._pendingPanelAction&&(this._pendingPanelAction=null),this._conversationsManager&&this._conversationsManager.hide()}open(){this._conversationsManager?(this._pendingPanelAction=null,this._conversationsManager.open()):this._pendingPanelAction="open"}close(){this._conversationsManager?(this._pendingPanelAction=null,this._conversationsManager.close()):this._pendingPanelAction="close"}setTheme(e){var t,i;this._theme=ct(ct(ct({},this._theme),e),{},{dark:ct(ct({},null===(t=this._theme)||void 0===t?void 0:t.dark),null==e?void 0:e.dark)}),null===(i=this._conversationsManager)||void 0===i||i.setTheme(e)}isAvailable(){return!0===this._isConversationsEnabled&&!Pt(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Kr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this._remoteConfigSuccessful?"remote_config_failed":It(this._isConversationsEnabled)?this._remoteConfigSuccessful?"disabled_in_project":"remote_config_pending":this._isConversationsEnabled?Rt(this._remoteConfig)||!this._remoteConfig.token?"missing_token":(null==d?void 0:d.__PosthogExtensions__)?this._isInitializing?"initializing":this._loadFailed?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,i){var n=this;return rt(function*(){return n._conversationsManager?n._conversationsManager.sendMessage(e,t,i):(bx.warn(Sx),null)})()}getMessages(e,t){var i=this;return rt(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(bx.warn(Sx),null)})()}markAsRead(e){var t=this;return rt(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(bx.warn(Sx),null)})()}getTickets(e){var t=this;return rt(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(bx.warn(Sx),null)})()}requestRestoreLink(e){var t=this;return rt(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(bx.warn(Sx),null)})()}restoreFromToken(e){var t=this;return rt(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(bx.warn(Sx),null)})()}restoreFromUrlToken(){var e=this;return rt(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(bx.warn(Sx),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}_onIdentityChanged(){var e;null===(e=this._conversationsManager)||void 0===e||e.setIdentity()}_onIdentityCleared(){var e;null===(e=this._conversationsManager)||void 0===e||e.clearIdentity()}}},cE={logs:class extends Tx{constructor(e){super({get(){var t;return null==e||null===(t=e.config)||void 0===t?void 0:t.logs},captureHintKey:ee,get remoteConfigWillArrive(){var t,i;return!(null===(t=e._shouldDisableFlags)||void 0===t?void 0:t.call(e))||!!(null===(i=d._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[e.config.token])||void 0===i?void 0:i.config)}},()=>function(e){var t;const i={};if(i.distinctId=e.get_distinct_id(),e.sessionManager){const{sessionId:t,windowId:n,sessionStartTimestamp:s,lastActivityTimestamp:r}=e.sessionManager.checkAndGetSessionAndWindowId(!0);i.sessionId=t,i.windowId=n,Rt(s)||(i.sessionStartTimestamp=s),Rt(r)||(i.lastActivityTimestamp=r)}if((null==d||null===(t=d.location)||void 0===t?void 0:t.href)&&(i.currentUrl=e.config.disable_capture_url_hashes?un(d.location.href):d.location.href),e.featureFlags){const t=e.featureFlags.getFlags();t&&t.length>0&&(i.activeFeatureFlags=t)}return i}(e)),this._instance=e,this.name=gb,this._listenForReconnect()}get _isRequestReady(){return this._instance.__loaded}_getConsoleLoader(){const e=Nr("[logs]"),t=null==d?void 0:d.__PosthogExtensions__;if(!t)return void e.error("PostHog Extensions not found.");const i=t.loadExternalDependency;if(i)return e=>{i(this._instance,"logs",i=>{const n=t.logs;e(i,(null==n?void 0:n.initializeLogs)?{initialize:e=>n.initializeLogs(e),replay(e,t){var i;return null===(i=n.replayConsoleBuffer)||void 0===i?void 0:i.call(n,e,t)}}:void 0)})};e.error(R)}}},uE={metrics:class{constructor(e){this._instance=e,this._logger=Nr("[metrics]"),this._disposed=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this._disposed)return;const t=!!(null===(e=this._instance.config.metrics)||void 0===e?void 0:e.network);t&&!this._stopNetworkMetrics?this._stopNetworkMetrics=(e=>{let t=!0;const i=()=>t?(e=>{var t;const i=null===(t=e.config.metrics)||void 0===t?void 0:t.network;return!0===i?{}:i||void 0})(e):void 0,n=Dx(e,i),s=$x(e,i);return()=>{t=!1,n(),s()}})(this._instance):!t&&this._stopNetworkMetrics&&(this._stopNetworkMetrics(),this._stopNetworkMetrics=void 0)}_getCore(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.metrics;var i;return this._core&&this._resolvedFrom===t||(null===(i=this._core)||void 0===i||i.reset(),this._resolvedFrom=t,this._core=new Rr(this._createHost(),function(e){var t,i,n,s,r;const o=null==e?void 0:e.resourceAttributes;return{serviceName:null!==(t=null==o?void 0:o["service.name"])&&void 0!==t?t:null==e?void 0:e.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==e?void 0:e.serviceVersion,environment:null!==(n=null==o?void 0:o["deployment.environment"])&&void 0!==n?n:null==e?void 0:e.environment,resourceAttributes:o,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:null!==(s=null==e?void 0:e.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(r=null==e?void 0:e.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(t),this._logger)),this._core}count(e,t=1,i){this._getCore().count(e,t,i)}gauge(e,t,i){this._getCore().gauge(e,t,i)}histogram(e,t,i){this._getCore().histogram(e,t,i)}flush(e){if(!this._core)return Promise.resolve();if(e){const t=this._core.drainWindow();return t&&this._sendMetricsBatch(t,e),Promise.resolve()}return this._core.flush().catch(e=>this._logger.error("PostHog metrics flush failed:",e))}reset(){var e;null===(e=this._core)||void 0===e||e.reset()}dispose(){var e,t;this._disposed=!0,null===(e=this._stopNetworkMetrics)||void 0===e||e.call(this),this._stopNetworkMetrics=void 0,null===(t=this._core)||void 0===t||t.reset()}_createHost(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},_sendMetricsBatch:e=>t._sendMetricsBatch(e),getLibraryId:()=>Jl.LIB_NAME,getLibraryVersion:()=>Jl.LIB_VERSION}}_sendMetricsBatch(e,t){return new Promise(i=>{let n=!1;const s=e=>{n||(n=!0,clearTimeout(r),i(e))},r=setTimeout(()=>s({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(ct(ct({method:"POST",url:this._metricsUrl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(e){const t=e.statusCode;if(t>=200&&300>t)s({kind:"ok"});else if(413===t)s({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)s({kind:"fatal",error:new Error(`metrics request failed with status ${t}`)});else{var i;s({kind:"retry-later",error:null!==(i=e.error)&&void 0!==i?i:new Error(`metrics request failed with status ${t}`)})}}}))})}_metricsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},dE={webMCP:class{constructor(e){this._instance=e,this._isPatched=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this._isPatched)return;const e=null==n?void 0:n.modelContext;if(!e||!Ct(e.registerTool))return;const t=Nx.get(e);if(t)return t.instances.add(this._instance),void(this._isPatched=!0);const i={instances:new Set([this._instance])},s=e.registerTool,r=this;Fg(e,"registerTool",e=>{const t=e;return function(e,...n){let s=e;try{s=r._wrapTool(e,i)}catch(i){return t.call(this,e,...n)}return t.call(this,s,...n)}}),e.registerTool!==s&&(Nx.set(e,i),this._isPatched=!0)}_wrapTool(e,t){if(!e||!Ct(e.execute))return e;const i=e.execute,n=this,{tool:s,injected:r}=function(e,t){const i={intent:!1,model:!1},n=e.inputSchema;if(!function(e){return!!It(e)||xt(e)&&Object.keys(e).every(e=>Bx.has(e)||e.startsWith("x-"))&&!0!==e.additionalProperties&&!xt(e.additionalProperties)&&(!e.type||"object"===e.type)&&(!e.properties||xt(e.properties))&&(!e.required||kt(e.required))}(n))return{tool:Wx(e),injected:i};const s=(null==n?void 0:n.properties)||{},r=e=>Ux(s,e)||kt(null==n?void 0:n.required)&&n.required.includes(e);if(i.intent=t.intent&&!r("context"),i.model=t.model&&!r("llm_model"),!i.intent&&!i.model)return{tool:Wx(e),injected:i};const o=ct({},s),a=kt(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:Wx(e,ct(ct({},n),{},{type:(null==n?void 0:n.type)||"object",properties:o,required:a})),injected:i}}(e,function(e){const t={intent:!1,model:!1};for(const i of e.instances){const e=zx(i.config.capture_webmcp);t.intent||(t.intent=!0===(null==e?void 0:e.intent)),t.model||(t.model=!0===(null==e?void 0:e.model))}return t}(t));return Object.defineProperty(s,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...o){const a=new Date,l=function(e,t){if(!xt(e))return{};try{const i=t.intent?jx(e.context,2048,!0):void 0,n=t.model?jx(e.llm_model,256):void 0;return ct(ct({},i&&"{}"!==i?{intent:i}:{}),n&&"unknown"!==n.toLowerCase()?{model:n}:{})}catch(e){return{}}}(o[0],r),c=function(e,t){const i=e[0];if(!xt(i))return e;try{const n=t.intent&&Ux(i,"context"),s=t.model&&Ux(i,"llm_model");if(!n&&!s)return e;const r=ct({},i);return n&&delete r.context,s&&delete r.llm_model,[r,...e.slice(1)]}catch(t){return e}}(o,r);let u;try{u=i.apply(this===s?e:this,c)}catch(e){throw n._captureToolCall(t,s,a,{error:e,errorResult:!1},l),e}if((d=u)&&"function"==typeof d.then)return Promise.resolve(u).then(e=>{const i=Vx(e)?{error:e,errorResult:!0}:void 0;return n._captureToolCall(t,s,a,i,l),e},e=>{throw n._captureToolCall(t,s,a,{error:e,errorResult:!1},l),e});var d;const h=Vx(u)?{error:u,errorResult:!0}:void 0;return n._captureToolCall(t,s,a,h,l),u}}),s}_captureToolCall(e,t,i,n,r){const o=Date.now()-i.getTime();let a;for(const c of e.instances){var l;const e=zx(c.config.capture_webmcp);if(e){n&&!a&&(a=Zx(n.error,n.errorResult));try{c.capture("$mcp_tool_call",ct(ct(ct({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:t.name,$mcp_resource_name:t.name,$mcp_tool_description:t.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}:{}),e.intent&&r.intent?{$mcp_intent:r.intent,$mcp_intent_source:"context_parameter"}:{}),e.model&&r.model?{$mcp_llm_model:r.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:i})}catch(e){continue}if(n&&a&&c.exceptions&&(null===(l=c.exceptionObserver)||void 0===l?void 0:l.isEnabled))try{const e={$exception_list:Kx(c.exceptions,n,a.message),$exception_level:"error",$exception_source:"mcp.tool_call",$mcp_interface:"webmcp",$mcp_tool_name:t.name,$mcp_resource_name:t.name,$mcp_tool_description:t.description,$mcp_server_name:null==s?void 0:s.hostname};c.exceptionObserver.captureException(e)}catch(e){}}}}}};$C.__defaultExtensionClasses=ct({},ct(ct(ct(ct(ct(ct(ct(ct(ct(ct(ct(ct(ct(ct({},Yx),Xx),eE),tE),iE),nE),rE),sE),oE),aE),lE),cE),uE),dE)),function(){Jl.SDK_DIST_CHANNEL="cdn";const t=d.posthog;if(t&&!kt(t._i)&&Ct(t.init))return;const i=fC[PC]=new $C;if(t){const e=[];qr(t._i,function(n){if(n&&kt(n)){const s=i.init(n[0],n[1],n[2]),r=t[n[2]]||t;s.__loaded&&-1===e.indexOf(r)&&(e.push(r),s._execute_array.call(s.people,r.people),s._execute_array(r))}});const n=t.people;if(!i.__loaded&&kt(t)){const e=i.init;let s=!0;i.init=(r,o,a)=>{const l=e.call(i,r,o,a);return s&&l===i&&l.__loaded&&(s=!1,i.init=e,l._execute_array.call(l.people,n),l._execute_array(t)),l}}}i.__SV=1,d.posthog=i,function(){function t(){t.done||(t.done=!0,Qk=!1,qr(fC,function(e){e._dom_loaded()}))}(null==n?void 0:n.addEventListener)?"complete"===n.readyState?t():Qr(n,"DOMContentLoaded",t,{capture:!1}):e&&$r.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}()}();
|
|
2
2
|
//# sourceMappingURL=array.full.no-external.js.map
|