posthog-js 1.433.2 → 1.433.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/default-extensions.js.map +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.full.cjs +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.cjs +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.mjs.map +1 -1
- package/dist/module.no-external.cjs +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.js.map +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/module.slim.no-external.js.map +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/lib/package.json +1 -1
- package/lib/src/request.js +3 -1
- package/lib/src/request.js.map +1 -1
- package/package.json +6 -6
package/dist/module.full.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="u">typeof window?window:void 0,e="u">typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,n=null==e?void 0:e.document,s=null==e?void 0:e.location,r=null==e?void 0:e.fetch,o=(null==e?void 0:e.XMLHttpRequest)&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,l=null==e?void 0:e.AbortController,a=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent;function h(){return!(!t||!1===t.navigator.onLine)}const c="undefined"!=typeof globalThis?globalThis:t;c&&"undefined"==typeof self&&(c.self=c),c&&"undefined"==typeof File&&(c.File=function(){});const d=null!=t?t:{},v="$people_distinct_id",f="distinct_id",p="$device_id",g="$device_model",m="__alias",y="__cmpns",_="$fbc",b="$fbc_persistence",w="$fbp",k="$fbp_persistence",S="__timers",x="$autocapture_disabled_server_side",C="$heatmaps_enabled_server_side",T="$exception_capture_enabled_server_side",E="$error_tracking_suppression_rules",I="$error_tracking_capture_extension_exceptions",M="$web_vitals_enabled_server_side",R="$dead_clicks_enabled_server_side",P="$product_tours_enabled_server_side",O="$logs_capture_enabled_server_side",A="$web_vitals_allowed_metrics",F="$session_recording_remote_config",D="$session_recording_enabled_server_side",L="$replay_sample_rate",N="$replay_override_sampling",q="$replay_override_linked_flag",B="$replay_override_url_trigger",j="$replay_override_event_trigger",H="$sesid",U="$session_is_sampled",z="$session_past_minimum_duration",W="$session_recording_url_trigger_activated_session",V="$session_recording_event_trigger_activated_session",G="$posthog_sr_group_event_trigger_",Z="$posthog_sr_group_url_trigger_",Q="$posthog_sr_group_sampling_",J="$debug_first_full_snapshot_timestamp",K="$sess_rec_flush_size",Y="$enabled_feature_flags",X="$active_feature_flags",tt="$early_access_features",et="$feature_flag_details",it="$feature_flag_payloads",nt="$feature_flag_request_id",st="$minimal_flag_called_events",rt="$override_feature_flags",ot="$override_feature_flag_payloads",lt="$stored_person_properties",at="$stored_group_properties",ut="$groups",ht="$surveys",ct="$surveys_loaded_at",dt="$surveys_activated",vt="$surveys_activated_session",ft="$surveys_activated_timestamps",pt="ph_product_tours",gt="$product_tours_activated",mt="$product_tours_activated_session",yt="$conversations_widget_session_id",_t="$conversations_ticket_id",bt="$conversations_widget_state",wt="$conversations_user_traits",kt="$flag_call_reported",St="$flag_call_reported_session_id",xt="$feature_flag_errors",Ct="$feature_flag_evaluated_at",$t="$user_state",Tt="$client_session_props",Et="$capture_rate_limit",It="$initial_campaign_params",Mt="$initial_referrer_info",Rt="$initial_person_info",Pt="$epp",Ot="$posthog_cookieless",At="$cookieless_mode",Ft="$sdk_debug_extensions_init_method",Dt="$sdk_debug_extensions_init_time_ms",Lt="$sdk_debug_recording_script_not_loaded",Nt="$sdk_debug_replay_event_trigger_status",qt="$sdk_debug_replay_linked_flag_trigger_status",Bt="$sdk_debug_replay_matched_recording_trigger_groups",jt="$sdk_debug_replay_pending_trigger_conditions",Ht="$sdk_debug_replay_remote_trigger_matching_config",Ut="$sdk_debug_replay_trigger_groups_count",zt="$sdk_debug_replay_url_trigger_status",Wt="$sdk_debug_rrweb_attached",Vt="$sdk_debug_rrweb_start_attempted",Gt="$session_recording_start_reason",Zt="PostHog loadExternalDependency extension not found.",Qt="anonymous",Jt="identified",Kt="identified_only",Yt="visibilitychange",Xt="beforeunload",te="$pageview",ee="$pageleave",ie="$identify",ne="$groupidentify";function se(t,e,i,n,s,r,o){try{var l=t[r](o),a=l.value}catch(t){return void i(t)}l.done?e(a):Promise.resolve(a).then(n,s)}function re(t){return function(){var e=this,i=arguments;return new Promise(function(n,s){var r=t.apply(e,i);function o(t){se(r,n,s,o,l,"next",t)}function l(t){se(r,n,s,o,l,"throw",t)}o(void 0)})}}function oe(t){return oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},oe(t)}function le(t,e,i){return(e=function(t){var e=function(t){if("object"!=oe(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=oe(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==oe(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ae(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function ue(t){for(var e=1;arguments.length>e;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ae(Object(i),!0).forEach(function(e){le(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ae(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}var he=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),ce=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const de="min_length",ve="max_length",fe=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],pe=["token"];function ge(t,e){return-1!==t.indexOf(e)}const me=function(t){return t.trim()},ye=function(t){return t.replace(/^\$/,"")};function _e(t){var e;const i=[];return null!==(e=JSON.stringify(t,function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(e))return"[Circular]";i.push(e)}return e}}))&&void 0!==e?e:"null"}const be=Object.prototype,we=be.hasOwnProperty,ke=be.toString,Se=Array.isArray||function(t){return"[object Array]"===ke.call(t)},xe=t=>"function"==typeof t,Ce=t=>t===Object(t)&&!Se(t),$e=t=>{if(Ce(t)){for(const e in t)if(we.call(t,e))return!1;return!0}return!1},Te=t=>void 0===t,Ee=t=>"[object String]"==ke.call(t),Ie=t=>Ee(t)&&0===t.trim().length,Me=t=>null===t,Re=t=>Te(t)||Me(t),Pe=t=>"[object Number]"==ke.call(t)&&t==t,Oe=t=>Pe(t)&&t>0,Ae=t=>"[object Boolean]"===ke.call(t),Fe=t=>t instanceof FormData,De=t=>ge(fe,t),Le=t=>ge(pe,t);function Ne(t){return null===t||"object"!=typeof t}function qe(t,e){return{}.toString.call(t)===`[object ${e}]`}function Be(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return He(t,Error)}}function je(t){return"u">typeof Event&&He(t,Event)}function He(t,e){try{return t instanceof e}catch(t){return!1}}const Ue=[!0,"true",1,"1","yes"],ze=t=>ge(Ue,t),We=[!1,"false",0,"0","no"],Ve=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Ge=function(t,e=[]){if(!t)return!1;const i=t.toLowerCase();return Ve.concat(e).some(t=>{const e=t.toLowerCase();return-1!==i.indexOf(e)})};function Ze(t,e,i,n,s){return e>i&&(n.warn("min cannot be greater than max."),e=i),Pe(t)?t>i?(n.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(n.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(n.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Ze(null!=s?s:i,e,i,n))}var Qe=class{constructor(t){this.C={},this.I=t.I,this.R=Ze(t.bucketSize,0,100,t.$),this.A=Ze(t.refillRate,0,this.R,t.$),this.O=Ze(t.refillInterval,0,864e5,t.$)}F(t,e){const i=Math.floor((e-t.lastAccess)/this.O);i>0&&(t.tokens=Math.min(t.tokens+i*this.A,this.R),t.lastAccess=t.lastAccess+i*this.O)}consumeRateLimit(t){var e;const i=Date.now(),n=String(t);let s=this.C[n];return s?this.F(s,i):(s={tokens:this.R,lastAccess:i},this.C[n]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null===(e=this.I)||void 0===e||e.call(this,t)),0===s.tokens)}stop(){this.C={}}};const Je="Mobile",Ke="Android",Ye="Tablet",Xe="Android Tablet",ti="iPad",ei="Apple Watch",ii="Safari",ni="BlackBerry",si="Samsung Internet",ri="Chrome",oi="Chrome iOS",li="Internet Explorer",ai="Internet Explorer Mobile",ui="Opera",hi="Microsoft Edge",ci="Firefox",di="Firefox iOS",vi="Nintendo",fi="PlayStation",pi="Xbox",gi="Android Mobile",mi="Mobile Safari",yi="Windows",_i="Windows Phone",bi="Nokia",wi="Ouya",ki="Generic "+Je.toLowerCase(),Si="Generic "+Ye.toLowerCase(),xi="Konqueror",Ci="Oculus Browser",$i="Vivaldi",Ti="Yandex",Ei="Whale",Ii="DuckDuckGo",Mi="Pale Moon",Ri="Waterfox",Pi="Brave",Oi="Claude",Ai="Codex",Fi="ChatGPT",Di="Google Search App",Li=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ni=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),qi=new RegExp(pi,"i"),Bi=new RegExp("PlayStation \\w+","i"),ji=new RegExp("Nintendo \\w+","i"),Hi=new RegExp("BlackBerry|PlayBook|BB10","i"),Ui={"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"},zi=function(t,e,i,n){e=e||"";const s=function(t){return(null==t?void 0:t.brave)?Pi:null}(i);return s||((null==n?void 0:n.detectGoogleSearchApp)&&ge(t,"GSA/")?Di:ge(t," OPR/")&&ge(t,"Mini")?"Opera Mini":ge(t," OPR/")?ui:Hi.test(t)?ni:ge(t,"IEMobile")||ge(t,"WPDesktop")?ai:ge(t,"OculusBrowser")?Ci:ge(t,"SamsungBrowser")?si:ge(t,"Edge")||ge(t,"Edg/")?hi:ge(t,"Vivaldi/")?$i:ge(t,"YaBrowser/")?Ti:ge(t,"Whale/")?Ei:ge(t,"DuckDuckGo/")||ge(t,"Ddg/")?Ii:ge(t,"Claude/")?Oi:ge(t,"Codex/")?Ai:ge(t,"ChatGPT/")?Fi:ge(t,"FBIOS")?"Facebook Mobile":ge(t,"UCWEB")||ge(t,"UCBrowser")?"UC Browser":ge(t,"CriOS")?oi:ge(t,"CrMo")||ge(t,ri)?ri:ge(t,Ke)&&ge(t,ii)?gi:ge(t,"FxiOS")?di:ge(t.toLowerCase(),xi.toLowerCase())?xi:ge(t,"Brave/")?Pi:((t,e)=>e&&ge(e,"Apple")||function(t){return ge(t,ii)&&!ge(t,ri)&&!ge(t,Ke)}(t))(t,e)?ge(t,Je)?mi:ii:ge(t,"PaleMoon/")?Mi:ge(t,"Waterfox/")?Ri:ge(t,ci)?ci:ge(t,"MSIE")||ge(t,"Trident/")?li:ge(t,"Gecko")?ci:"")},Wi={[ai]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[hi]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[ri]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[oi]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[ii]:[Li],[mi]:[Li],[ui]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ci]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[di]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[xi]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ni]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Li],[gi]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[si]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Ci]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[$i]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ti]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Ei]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Pi]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Oi]:[Ni],[Ai]:[Ni],[Fi]:[Ni],[Ii]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Mi]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Ri]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Di]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[li]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Vi=function(t,e,i,n){const s=zi(t,e,i,n),r=Wi[s];if(Te(r))return null;for(let e=0;r.length>e;e++){const i=t.match(r[e]);if(i)return parseFloat(i[i.length-2])}return null},Gi=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[pi,t&&t[1]||""]],[new RegExp(vi,"i"),[vi,""]],[new RegExp(fi,"i"),[fi,""]],[Hi,[ni,""]],[new RegExp(yi,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[_i,""];if(new RegExp(Je).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){let t=Ui[i[1]]||"";return/arm/i.test(e)&&(t="RT"),[yi,t]}return[yi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let e="";return t&&t.length>=3&&(e=Te(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Ke,[t[2],t[3],t[4]||"0"].join(".")]:[Ke,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Zi=function(t){for(let e=0;Gi.length>e;e++){const[i,n]=Gi[e],s=i.exec(t),r=s&&(xe(n)?n(s,t):n);if(r)return r}return["",""]},Qi=function(t){return ji.test(t)?vi:Bi.test(t)?fi:qi.test(t)?pi:new RegExp(wi,"i").test(t)?wi:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?_i:/iPad/.test(t)?ti:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ei:Hi.test(t)?ni:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(bi,"i").test(t)?bi:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Je).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Ke:Xe:new RegExp("(pda|Mobile)","i").test(t)?ki:new RegExp(Ye,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?Si:""},Ji=function(t,e){var i;const n=Qi(t);return n===ti||n===Xe||"Kobo"===n||"Kindle Fire"===n||n===Si?Ye:n===vi||n===pi||n===fi||n===wi?"Console":n===ei?"Wearable":n?Je:"Android"===(null==e?void 0:e.userAgentDataPlatform)&&(null!==(i=null==e?void 0:e.maxTouchPoints)&&void 0!==i?i:0)>0?600>Math.min(null!==(s=null==e?void 0:e.screenWidth)&&void 0!==s?s:0,null!==(r=null==e?void 0:e.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==e?void 0:e.devicePixelRatio)&&void 0!==o?o:1)?Je:Ye:"Desktop";var s,r,o},Ki=/\bFBAV\/(\d+(?:\.\d+)*)/i,Yi=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Ki],[/\bFBAN\/EMA\b/i,"Facebook Lite",Ki],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Ki],[/\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"]],Xi="[Truncated]",tn="[Unserializable]";function en(t){let e="";for(let i=0;t.length>i;i++){const n=t.charCodeAt(i);if(55296>n||n>56319)e+=56320>n||n>57343?t[i]:"�";else{const n=t.charCodeAt(i+1);56320>n||n>57343?e+="�":(e+=t[i]+t[i+1],i++)}}return e}function nn(t,e){if(!e)return t;let i=[];try{i=Object.keys(e)}catch(t){i=[]}for(const n of i){let i;try{i=e[n]}catch(t){i=tn}Object.defineProperty(t,n,{value:i,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;const sn=3e5;var rn=class{record(t){if("too-large"===t.kind)return;if("retry-later"!==t.kind)return void this.reset();if(!t.retryAfterMs)return;const e=this.isOpen(),i=Date.now(),n=Math.min(t.retryAfterMs,sn);if(!e)return this.ts=i,void(this.es=i+n);this.es=Math.max(this.es,Math.min(i+n,this.ts+sn))}remainingMs(){const t=Date.now();if(this.ts-5e3>t)return this.reset(),0;const e=Math.min(sn,Math.max(0,this.es-t));return 0===e&&this.reset(),e}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const on=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ln(t,e){return"string"==typeof(i=t)&&on.test(i)?t:e();var i}function an(t,e){const i=new Error(e);try{Object.defineProperty(i,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return i}function un(t){return t?t.split("#")[0]:t}function hn(t){try{return t()}catch(t){return}}function cn(t,e){const i=setTimeout(t,e);return null!=i&&i.unref&&(null==i||i.unref()),i}function dn(t,e,i){return vn.apply(this,arguments)}function vn(){return(vn=re(function*(t,e,i){let n;try{return yield Promise.race([t,new Promise((t,s)=>{n=cn(()=>{try{null==i||i(),t()}catch(t){s(t)}},e)})])}finally{clearTimeout(n)}})).apply(this,arguments)}let fn,pn,gn;function mn(t){const e=globalThis._posthogChunkIds;if(!e)return;const i=Object.keys(e);return gn&&i.length===pn||(pn=i.length,gn=i.reduce((i,n)=>{fn||(fn={});const s=fn[n];if(s)i[s[0]]=s[1];else{const s=t(n);for(let t=s.length-1;t>=0;t--){const r=s[t],o=null==r?void 0:r.filename,l=e[n];if(o&&l){i[o]=l,fn[n]=[o,l];break}}}return i},{})),gn}var yn=class{constructor(t,e,i=[]){this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e={}){const i=e&&e.mechanism||{handled:!0,type:"generic"},n=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),r=this.parseStacktrace(n,s);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(t){var e=this;return re(function*(){for(const i of t)i.stacktrace&&i.stacktrace.frames&&Se(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t})()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null===(e=t.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){let i,n;return null!=t.cause&&(i=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(n=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),ue(ue({},t),{},{cause:i,stack:n})}applyChunkIds(t,e){return t.map(t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t))}applyCoercers(t,e){for(const i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return re(function*(){let i=t;for(const t of e.modifiers)i=yield t(i);return i})()}convertToExceptionList(t,e){var i,n,s;const r={type:t.type,value:t.value,mechanism:{type:null!==(i=e.type)&&void 0!==i?i:"generic",handled:null===(n=e.handled)||void 0===n||n,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(r.stacktrace={type:"raw",frames:t.stack});const o=[r];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,ue(ue({},e),{},{handled:!0}))),o}buildParsingContext(t){var e;return{chunkIdMap:mn(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,i=0){const n=(i,n)=>{if(4>=n){const s=this.buildCoercingContext(t,e,n);return this.applyCoercers(i,s)}};return ue(ue({},e),{},{syntheticException:0==i?e.syntheticException:void 0,mechanism:t,apply:t=>n(t,i),next:t=>n(t,i+1)})}};const _n=/^([a-z][a-z0-9.+-]+):/i,bn=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function wn(t){if(!t||"<anonymous>"===t)return!1;const e=_n.exec(t);return!e||bn.includes(e[1].toLowerCase())}function kn(t,e,i,n,s){const r={platform:t,filename:e,function:"<anonymous>"===i?"?":i,in_app:wn(e)};return Te(n)||(r.lineno=n),Te(s)||(r.colno=s),r}const Sn=(t,e)=>{const i=-1!==t.indexOf("safari-extension"),n=-1!==t.indexOf("safari-web-extension");return i||n?[-1!==t.indexOf("@")?t.split("@")[0]:"?",i?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},xn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Cn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,$n=/\((\S*)(?::(\d+))(?::(\d+))\)/,Tn=(t,e)=>{const i=xn.exec(t);if(i){const[,t,n,s]=i;return kn(e,t,"?",+n,+s)}const n=Cn.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){const t=$n.exec(n[2]);t&&(n[2]=t[1],n[3]=t[2],n[4]=t[3])}const[t,i]=Sn(n[1]||"?",n[2]);return kn(e,i,t,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},En=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,In=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Mn=(t,e)=>{const i=En.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const t=In.exec(i[3]);t&&(i[1]=i[1]||"eval",i[3]=t[1],i[4]=t[2],i[5]="")}let t=i[3],n=i[1]||"?";return[n,t]=Sn(n,t),kn(e,t,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Rn=/\(error: (.*)\)/;function Pn(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function On(t){for(let e=1;10>=e;e++){const i=t.length-2*e;if(0>i)break;let n=!0;for(let s=0;e>s;s++)if(!Pn(t[i+s],t[i+e+s])){n=!1;break}if(n){for(let n=0;e>n;n++)t[i+n]=t[i+e+n];return t.length=i+e,{start:i,length:e}}}}function An(t,e){const i=e.start+e.length,n=Dn(t,e);n&&t.splice(i+n===t.length?i:e.start,n)}function Fn(t,e){let i=e.start;for(;i>0&&Pn(t[i-1],t[i-1+e.length]);)i--;return e.start-i}function Dn(t,e){const i=e.start+e.length;let n=i;for(;t.length>n&&Pn(t[n],t[n-e.length]);)n++;return n-i}function Ln(t,e){const i=e[0];let n=t.length-(i?Fn(t,i):0);for(const i of e)n-=Dn(t,i);return n}function Nn(t,e,i){for(let n=0;t.length>n;n++){const s=t[(e+n)%t.length],r=t[(i+n)%t.length];if(s!==r)return r>s}return!1}var qn=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){const i=Ee(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){const e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${e}: ${t.message}`:e}isDOMException(t){return qe(t,"DOMException")}isDOMError(t){return qe(t,"DOMError")}},Bn=class{match(t){return Be(t)}coerce(t,e){var i;const n=this.getStack(t),s=void 0===n;return{type:this.getType(t),value:this.getMessage(t,e),stack:null!=n?n:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,cause:t.cause?e.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,e){const i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}},jn=class{match(t){return!!qe(t,"ErrorEvent")&&(null!=t.error||this.lr(t))}coerce(t,e){var i;if(null!=t.error)return e.apply(t.error);const n=e.apply(t.message);return ue(ue({},n),{},{stack:null!==(i=this.ur(t))&&void 0!==i?i:n.stack,synthetic:!0})}lr(t){return Ee(t.message)&&t.message.length>0}ur(t){var e,i;const n=t,s=null!==(e=n.lineno)&&void 0!==e?e:0,r=null!==(i=n.colno)&&void 0!==i?i:0;if(Ee(n.filename)&&0!==n.filename.length&&0!==s)return`Error\n at ${n.filename}:${s}:${r}`}};const Hn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Un=class{match(t){return"string"==typeof t}coerce(t,e){var i;const[n,s]=this.getInfos(t);return{type:null!=n?n:"Error",value:null!=s?s:t,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}getInfos(t){let e="Error",i=t;const n=t.match(Hn);return n&&(e=n[1],i=n[2]),[e,i]}};const zn=["fatal","error","warning","log","info","debug"];function Wn(t,e=40){const i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(let t=i.length;t>0;t--){const n=i.slice(0,t).join(", ");if(e>=n.length)return t===i.length?n:n.length>e?`${n.slice(0,e)}...`:n}return""}var Vn=class{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,n;const s=this.getErrorPropertyFromObject(t);return s?e.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(i=this.getStack(t))&&void 0!==i?i:null===(n=e.syntheticException)||void 0===n?void 0:n.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(je(t))return t.constructor.name;const e="name"in t?t.name:void 0;return Ee(e)&&!Ie(e)?e:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){let e=`'${t.name}' captured as exception`;return"message"in t&&"string"==typeof t.message&&(e+=` with message: '${t.message}'`),e}if("message"in t&&"string"==typeof t.message)return t.message;const e=this.getObjectClassName(t);return`${e&&"Object"!==e?`'${e}'`:"Object"} captured as exception with keys: ${Wn(t)}`}isSeverityLevel(t){return Ee(t)&&!Ie(t)&&zn.indexOf(t)>=0}getStack(t){try{return Ee(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:Ee(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(const e in t)if({}.hasOwnProperty.call(t,e)){const i=t[e];if(Be(i))return i}}getObjectClassName(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}},Gn=class{match(t){return je(t)}coerce(t,e){var i;const n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${Wn(t)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Zn=class{match(t){return Ne(t)}coerce(t,e){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Qn=class{match(t){return qe(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!je(t))return!1;try{const e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i;const n=this.getUnhandledRejectionReason(t);return Ne(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}:e.apply(n)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}};const Jn="$message",Kn="$timestamp",Yn=new Set([Jn,Kn]),Xn={enabled:!0,max_bytes:32768};function ts(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Xn.enabled,max_bytes:is(t.max_bytes,Xn.max_bytes)}:ue({},Xn)}var es=class{constructor(t){this.ns=[],this.ss=0,this.Mr=ts(t)}setConfig(t){this.Mr=ts(t),this.rs()}add(t){const e=function(t){let e;try{e=_e(t)}catch(t){return}try{const t=JSON.parse(e);if(!Ce(t))return;const i=t,n=i[Jn],s=i[Kn];if(!Ee(n)||0===n.trim().length)return;if(!Ee(s)&&!Pe(s))return;return{step:i,json:e}}catch(t){return}}(t);if(!e)return;const i=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;const e=encodeURIComponent(t);let i=0;for(let t=0;e.length>t;t++)"%"===e[t]?(i+=1,t+=2):i+=1;return i}(e.json);i>this.Mr.max_bytes||(this.ns.push({step:e.step,bytes:i}),this.ss+=i,this.rs())}getAttachable(){return this.ns.map(t=>t.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Mr.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function is(t,e){if(!Pe(t)||1/0===t||-1/0===t)return e;const i=Math.floor(t);return 0>i?e:i}const ns=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function ss(t){return"string"==typeof t||t}function rs(t){return"string"==typeof t?t:void 0}const os=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],ls="NativeGzipValidationError",as=t=>t.length>=2&&31===t[0]&&139===t[1],us=(t,e)=>t===ce.GZipJS||e===ce.GZipJS||"gzip"===e,hs=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),cs=t=>{if(!t||"object"!=typeof t)return!1;const e="name"in t?String(t.name):"";return hs(t)||e===ls};let ds;const vs=t=>{throw an(ls,`Native gzip produced invalid output: ${t}`)},fs=(ps=re(function*(t,e){18>t.size&&vs("too-short");const i=new Uint8Array(yield t.slice(0,10).arrayBuffer());as(i)&&8===i[2]||vs("invalid-header");const n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{const e=(()=>{if(ds)return ds;ds=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)e=1&e?3988292384^e>>>1:e>>>1;ds[t]=e>>>0}return ds})();let i=4294967295;for(let n=0;t.length>n;n++)i=e[255&(i^t[n])]^i>>>8;return(4294967295^i)>>>0})(e)&&vs("invalid-crc");const s=e.length>>>0;n.getUint32(4,!0)!==s&&vs("invalid-size")}),function(t,e){return ps.apply(this,arguments)});var ps;function gs(t){return ms.apply(this,arguments)}function ms(){return ms=re(function*(t,e=!0,i){try{const e=(new TextEncoder).encode(t),i=new globalThis.CompressionStream("gzip"),s=i.writable.getWriter(),r=s.write(e).then(()=>s.close()).catch((n=re(function*(t){try{yield s.abort(t)}catch(t){}throw t}),function(t){return n.apply(this,arguments)})),o=new Response(i.readable).blob(),[l]=yield Promise.all([o,r]);return yield fs(l,e),l}catch(t){if(null==i?void 0:i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}var n}),ms.apply(this,arguments)}function ys(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;r.length>n;n++)e.includes(i=r[n])||{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}const _s={}.propertyIsEnumerable;function bs(t,e){try{return Ss(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function ws(t,e,i,n){if(0>=i.remainingNodes)return{stringValue:Xi};if(i.remainingNodes--,Ae(t))return{boolValue:t};if("bigint"==typeof t)return function(t,e){const i=t.toString(),n=BigInt("9223372036854775808");return t>=n||-n>t?(null==e||e.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}(t,e);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const i=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==e||e.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:en(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(i.ancestors.has(t))return{stringValue:"[Circular]"};if(n>=20)return{stringValue:Xi};if(t instanceof Date){const e=t.getTime(),i=Number.isFinite(e)?t.toISOString():String(t);return{stringValue:"string"==typeof i?en(i):String(i)}}i.ancestors.add(t);try{try{const s=t.toJSON;if("function"==typeof s)return ws(s.call(t),e,i,n+1)}catch(t){}return Se(t)?{arrayValue:{values:ks(t,e,i,n+1)}}:{kvlistValue:{values:Ss(t,e,i,n+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:en(String(t))}}function ks(t,e,i,n){const s=[],r=Math.min(t.length,1e3);let o=0;for(;r>o&&i.remainingNodes>0;o++)try{const r=o in t?t[o]:void 0;if(Re(r))continue;s.push(ws(r,e,i,n))}catch(t){s.push({stringValue:tn})}return t.length>o&&s.push({stringValue:Xi}),s}function Ss(t,e,i,n){const s=[];for(const r in t)if(_s.call(t,r)){if(!r){null==e||e.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=i.remainingNodes){null==e||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=t[r];if(Me(o)||Te(o))continue;s.push({key:en(r),value:ws(o,e,i,n)})}catch(t){s.push({key:en(r),value:{stringValue:tn}})}}return s}function xs(t,e,i){return ue(ue(ue(ue({},nn({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":e,"telemetry.sdk.version":i})}const Cs=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function $s(t,e){const i=nn({},t),n={};for(const t of Cs)({}).hasOwnProperty.call(i,t)&&(n[t]=i[t],delete i[t]);return[...bs(i,e),...bs(n,e)]}const Ts={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 Es={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}},Is=Es.info;function Ms(t){try{return en(String(t))}catch(t){return tn}}function Rs(t,e,i,n){const s=t.level||"info",{text:r,number:o}=Es[s]||Is,l=function(t=Date.now()){return String(t)+"000000"}(Pe(n)?n:void 0),a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),Re(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),Re(e.lastActivityTimestamp)||(a.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(a["url.full"]=e.currentUrl),e.screenName&&(a["screen.name"]=e.screenName),e.appState&&(a["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(a.feature_flags=e.activeFeatureFlags);const u=ue({},a),h=t.attributes;if(h){let t=[];try{t=Object.keys(h)}catch(e){t=[]}for(const e of t){let t;try{t=h[e]}catch(e){t=tn}Object.defineProperty(u,e,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const c={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:r,body:{stringValue:Ms(t.body)},attributes:bs(u,i)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),Te(t.trace_flags)||(c.flags=t.trace_flags),c}function Ps(t,e,i){return xs(t,e,i)}function Os(t,e,i,n){return{resourceLogs:[{resource:{attributes:$s(e)},scopeLogs:[{scope:{name:i,version:n},logRecords:t}]}]}}var As=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.hs}arm(t){this.clear(),this.us=Date.now()+t,this.hs=cn(()=>{this.hs=void 0,this.ls()},t)}armNoEarlierThan(t){this.hs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function Fs(){return.75+.5*Math.random()}function Ds(t,e,i,n){const s=Math.min(Math.max(0,e-1),6),r=t*Math.pow(2,s);return Math.round((void 0===n?r:Math.min(r,Math.max(n,t)))*i)}var Ls=class{constructor(t,e,i,n,s,r=()=>Promise.resolve(),o){var l;this._instance=t,this.Mr=e,this.$=i,this.cs=n,this.ds=s,this.vs=r,this.fs=o,this.ps=new As(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new rn,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=e.maxBufferSize,this.Is=Math.max(null!==(l=e.maxQueueSize)&&void 0!==l?l:e.maxBufferSize,e.maxBufferSize),this.Ms=e.flushIntervalMs,this.Es=e.maxBatchRecordsPerPost,this.Ps=e.rateCapWindowMs,this.Rs=e.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(he.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(t,e){var i;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==t?void 0:t.body))return;const n=this.Os(t);if(null===n)return;if(!n.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const s={record:Rs(n,null!==(i=null==e?void 0:e.context)&&void 0!==i?i:this.cs(),this.$,null==e?void 0:e.occurredAtMs)};this.ds(()=>this.Ls(s))}Os(t){const e=this.Mr.beforeSend;if(!e)return t;const i=Se(e)?e:[e];let n=t;for(const t of i)try{const e=t(n);if(!e)return this.$.info("Log was rejected in beforeSend function"),null;n=e}catch(t){return this.$.error("Error in beforeSend function for log:",t),null}return n}Ds(){if(void 0===this.Rs)return!0;const t=Date.now(),e=t-this.xs;return this.Ps>e&&e>=0||(this.xs=t,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var t=this;return re(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null})),t.ys})()}Ns(){var t=this;return re(function*(){var e;t.ps.clear();let i=null!==(e=t._instance.getPersistedProperty(he.LogsQueue))&&void 0!==e?e:[];if(0===i.length)return;const n=i.length;let s=0;for(;i.length>0&&n>s;){var r,o;const e=t._s;t.bs=0;const n=Math.min(i.length,t.Es),l=i.slice(0,n),a=Os(l.map(t=>t.record),t.qs(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.js(a);if(t._s!==e)return;if("too-large"===u.kind&&l.length>1)t.Es=Math.max(1,Math.floor(l.length/2)),t.$.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${t.Es}`);else{if(t.ws.record(u),t.ps.pending&&t.ps.arm(Math.max(t.Ms,t.ws.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.Mr.maxBatchRecordsPerPost>t.Es&&(t.Es=Math.min(t.Mr.maxBatchRecordsPerPost,t.Es+1)),yield t.Bs(l.length),i=null!==(o=t._instance.getPersistedProperty(he.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===u.kind)throw u.error}}})()}Bs(t){var e=this;return re(function*(){var i;const n=Math.max(0,t-e.bs),s=null!==(i=e._instance.getPersistedProperty(he.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(he.LogsQueue,s.slice(n)),yield e.vs()})()}qs(){return Ps(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var e;if(this._instance.optedOut)return;const i=null!==(e=this._instance.getPersistedProperty(he.LogsQueue))&&void 0!==e?e:[];this.Is>i.length||(i.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(he.LogsQueue,i),this.Ts>i.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(Ds(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const t=this._instance.getPersistedProperty(he.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return re(function*(){e.ps.clear();const i=e.flush().catch(()=>{});void 0!==t?yield dn(i,t):yield i})()}flushWithTimeout(t){var e=this;return re(function*(){const i=e.flush();yield dn(i,t,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},t=>{this.ks++,this.Ss=Fs(),this.$.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const Ns=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function qs(t){return String(t)+"000000"}function Bs(t,e,i,n){let s="";return n&&(s=Object.keys(n).sort().map(t=>`${JSON.stringify(t)}:${JSON.stringify(n[t])}`).join(",")),`${t}\0${e}\0${null!=i?i:""}\0${s}`}var js=class{constructor(t,e,i){this._instance=t,this.Mr=e,this.$=i,this.zs=new Map,this.ps=new As(()=>this.flush().catch(t=>{this.$.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new rn,this.ks=0,this.Ss=1,this.Gs=0}count(t,e=1,i){this.Zs({name:t,type:"count",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(t,e,i){this.Zs({name:t,type:"gauge",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(t,e,i){this.Zs({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var t=this;const e=this.ys,i=function(){var i=re(function*(){e&&(yield e.catch(()=>{})),yield t.Qs()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this.ys===i&&(this.ys=null)});return this.ys=i,i}drainWindow(){if(0===this.zs.size)return null;const t=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const e=this.Os(t);if(null===e)return;if(!e.name||"string"!=typeof e.name)return void this.$.warn("Dropping metric with empty name");if("number"!=typeof e.value||!Number.isFinite(e.value))return void this.$.warn(`Dropping metric '${e.name}': value must be a finite number`);if("count"===e.type&&0>e.value)return void this.$.warn(`Dropping count '${e.name}': counters are monotonic, value must be >= 0`);let i,n;try{i=e.attributes?ue({},e.attributes):void 0,n=Bs(e.type,e.name,e.unit,i)}catch(t){return void this.$.warn(`Dropping metric '${e.name}': attributes could not be serialized`,t)}let s=this.zs.get(n);if(!s){if(!this.Ks())return;s={name:e.name,type:e.type,unit:e.unit,attributes:i,windowStartMs:Date.now()},this.zs.set(n,s)}const r=this.Ws.get(e.name);void 0===r?this.Ws.set(e.name,e.type):r===e.type||this.Vs.has(e.name)||(this.Vs.add(e.name),this.$.warn(`Metric name '${e.name}' is already used as a ${r}; recording it as a ${e.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(s,e.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(t,e){switch(t.type){case"count":var i;t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case"gauge":t.last=e;break;case"histogram":{t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(Ns.length+1).fill(0)});const i=t.hist;i.count+=1,i.sum+=e,i.min=Math.min(i.min,e),i.max=Math.max(i.max,e),i.bucketCounts[function(t,e){for(let i=0;e.length>i;i++)if(e[i]>=t)return i;return e.length}(e,Ns)]+=1;break}}}Os(t){const e=this.Mr.beforeSend;if(!e)return t;const i=Se(e)?e:[e];let n=t;for(const t of i)try{const e=t(n);if(!e)return this.$.info("Metric was rejected in beforeSend function"),null;n=e}catch(t){return this.$.error("Error in beforeSend function for metric:",t),null}return n}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(Ds(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var t=this;return re(function*(){if(t.ps.clear(),0===t.zs.size)return;const e=t.zs;t.zs=new Map,t.Us=!1,t.Ws=new Map,t.Vs=new Set;const i=t.Gs,n=yield t._instance.Ys(t.Js(e));if(i===t.Gs)switch(t.ws.record(n),"retry-later"===n.kind?(t.ks++,t.Ss=Fs()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.Hs()),n.kind){case"ok":return;case"retry-later":return t.lo(e),void t.ps.armNoEarlierThan(t.Hs());case"too-large":return void t.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.$.error("Failed to send metrics batch:",n.error)}})()}Js(t){return e=this.ao(t),i=function(t,e,i){return xs(t,e,i)}(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:$s(i)},scopeMetrics:[{scope:{name:n,version:s},metrics:e}]}]};var e,i,n,s}ao(t){const e=qs(Date.now()),i=new Map;for(const o of t.values()){var n;const t=Bs(o.type,o.name,o.unit,void 0);let l=i.get(t);l||(l=ue({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},i.set(t,l));const a=bs(null!==(n=o.attributes)&&void 0!==n?n:{},this.$),u=qs(o.windowStartMs);if("count"===o.type){var s;const t={attributes:a,startTimeUnixNano:u,timeUnixNano:e,asDouble:null!==(s=o.total)&&void 0!==s?s:0};l.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t={attributes:a,timeUnixNano:e,asDouble:null!==(r=o.last)&&void 0!==r?r:0};l.gauge.dataPoints.push(t)}else o.hist&&l.histogram.dataPoints.push({attributes:a,startTimeUnixNano:u,timeUnixNano:e,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Ns})}return Array.from(i.values())}lo(t){for(const[n,s]of t){const t=this.zs.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,s.windowStartMs),t.type){case"count":var e,i;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(i=s.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(s.hist)if(t.hist){t.hist.count+=s.hist.count,t.hist.sum+=s.hist.sum,t.hist.min=Math.min(t.hist.min,s.hist.min),t.hist.max=Math.max(t.hist.max,s.hist.max);for(let e=0;t.hist.bucketCounts.length>e;e++)t.hist.bucketCounts[e]+=s.hist.bucketCounts[e]}else t.hist=s.hist}else this.Ks()&&this.zs.set(n,s)}}};function Hs(t,e){if(!t)return;const i=t.find(t=>t.type===e);return null==i?void 0:i.value}const Us="0.8.3",zs={DEBUG:!1,LIB_VERSION:Us,LIB_NAME:"browser-common",JS_SDK_VERSION:Us},Ws=(e,{debugEnabled:i}={})=>{const n={N(n,...s){t&&(zs.DEBUG||t.POSTHOG_DEBUG||i)&&!Te(t.console)&&t.console&&("__rrweb_original__"in t.console[n]?t.console[n].__rrweb_original__:t.console[n])(e,...s)},debug(...t){n.N("debug",...t)},info(...t){n.N("log",...t)},warn(...t){n.N("warn",...t)},error(...t){n.N("error",...t)},critical(...t){console.error(e,...t)},uninitializedWarning(t){n.error(`You must initialize PostHog before calling ${t}`)},createLogger:(t,i)=>Ws(`${e} ${t}`,i)};return n},Vs=Ws("[PostHog.js]"),Gs=Vs.createLogger;function Zs(t,e){Se(t)&&t.forEach(e)}function Qs(t,e){if(!Re(t))if(Se(t))t.forEach(e);else if(Fe(t))t.forEach((t,i)=>e(t,i));else for(const i in t)we.call(t,i)&&e(t[i],i)}const Js=function(t,...e){for(const i of e)for(const e in i)void 0!==i[e]&&(t[e]=i[e]);return t};function Ks(t){const e=Object.keys(t);let i=e.length;const n=new Array(i);for(;i--;)n[i]=[e[i],t[e[i]]];return n}const Ys=function(t){return function(...e){try{return t.apply(this,e)}catch(t){Vs.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Vs.critical(t)}}},Xs=function(t){const e={};return Qs(t,function(t,i){(Ee(t)&&t.length>0||Pe(t))&&(e[i]=t)}),e};function tr(t){const e=ue({},t);for(const i of["name","message","stack","cause","errors"])try{i in t&&(e[i]=t[i])}catch(t){}return e}const er=["herokuapp.com","vercel.app","netlify.app"];function ir(t){const e=null==t?void 0:t.hostname;if(!Ee(e))return!1;const i=e.split(".").slice(-2).join(".");for(const t of er)if(i===t)return!1;return!0}function nr(t,e,i,n){const{capture:s=!1,passive:r=!0}=null!=n?n:{};null==t||t.addEventListener(e,i,{capture:s,passive:r})}function sr(t){return"ph_toolbar_internal"===t.name}const rr=["localhost","127.0.0.1"],or=(t,e)=>{try{let i;return JSON.stringify(t,(t,e)=>{var n;return Be(e)?(null!==(n=i)&&void 0!==n||(i=new WeakMap),i.has(e)||i.set(e,tr(e)),i.get(e)):"bigint"==typeof e?e.toString():e},e)}catch(e){return _e(t)}},lr=t=>{const e=null==n?void 0:n.createElement("a");return Te(e)?null:(e.href=t,e)},ar=function(t,e="&"){let i,n;const s=[];return Qs(t,function(t,e){Te(t)||Te(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),n=encodeURIComponent(e),s[s.length]=n+"="+i)}),s.join(e)},ur=function(t,e){const i=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let n;for(let t=0;i.length>t;t++){const s=i[t].split("=");if(s[0]===e){n=s;break}}if(!Se(n)||2>n.length)return"";{let t=n[1];try{t=decodeURIComponent(t)}catch(e){Vs.error("Skipping decoding for malformed query param: "+t)}return t.replace(/\+/g," ")}},hr=function(t,e,i){if(!t||!e||!e.length)return t;const n=t.split("#"),s=n[1],r=(n[0]||"").split("?"),o=r[1],l=r[0],a=(o||"").split("&"),u=[];for(let t=0;a.length>t;t++){const n=a[t].split("=");Se(n)&&(e.includes(n[0])?u.push(n[0]+"="+i):u.push(a[t]))}let h=l;return null!=o&&(h+="?"+u.join("&")),null!=s&&(h+="#"+s),h},cr=function(t,e){const i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},dr=(t,e)=>t>=e&&h(),vr=(t,e,i,n)=>{if(0===t){if(h()){const t=e+1;return t===i&&n(),t}return e}return 0};function fr(t,e){var i;const n=null==t||null===(i=t.config)||void 0===i?void 0:i.get_current_url;if(!xe(n))return e;try{const t=n(e);return Ee(t)&&t?t:e}catch(t){return Vs.error("Error in get_current_url, falling back to window.location.href",t),e}}function pr(e){var i;const n=null==t||null===(i=t.location)||void 0===i?void 0:i.href;return Te(n)?void 0:fr(e,n)}function gr(t){var e;return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!!(null===(e=t.closest)||void 0===e?void 0:e.call(t,".toolbar-global-fade-container")))}function mr(t){return!!t&&1===t.nodeType}function yr(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function _r(t){return!!t&&3===t.nodeType}function br(t){return!!t&&11===t.nodeType&&mr(t.host)}function wr(t){return t?me(t).split(/\s+/):[]}function kr(t,e){const i=pr(e);return!!(i&&t&&t.some(t=>i.match(t)))}function Sr(t){let e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return wr(e)}function xr(t){return Re(t)?null:me(t).split(/(\s+)/).filter(t=>Kr(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Cr(t){let e="";return Hr(t)&&!Ur(t)&&t.childNodes&&t.childNodes.length&&Qs(t.childNodes,function(t){var i;_r(t)&&t.textContent&&(e+=null!==(i=xr(t.textContent))&&void 0!==i?i:"")}),me(e)}function $r(t){var e;return Te(t.target)?t.srcElement||null:(null===(e=t.target)||void 0===e?void 0:e.shadowRoot)?t.composedPath()[0]||null:t.target||null}const Tr=["a","button","form","input","select","textarea","label"];function Er(t,e){const i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!i&&i.call(t,e)}catch(t){return!1}}function Ir(t,e){if(Te(e))return!0;for(const i of t)if(e.some(t=>Er(i,t)))return!0;return!1}function Mr(t){const e=t.parentNode;return!(!e||!mr(e))&&e}const Rr=[".ph-no-autocapture","[data-ph-no-autocapture]"],Pr=["next","previous","prev",">","<"],Or=[...Pr,"+","-","−","–"],Ar=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Fr=[".ph-no-deadclick",".ph-no-capture"],Dr=[".ph-no-rageclick",".ph-no-capture"],Lr=["","text","search","email","password","url","tel","number"];function Nr(t){return!(!t||!mr(t))&&(!!yr(t,"textarea")||(yr(t,"input")?ge(Lr,(t.getAttribute("type")||"").toLowerCase()):function(t){var e;if(t.isContentEditable)return!0;const i=null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"contenteditable");return"true"===i||""===i}(t)))}function qr(e,i){if(!t||Br(e))return!1;let n,s,r;var o,l;if(Ae(i)?(n=!!i&&Dr,s=void 0,r=!1):(n=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Dr,s=null==i?void 0:i.content_ignorelist,r=null!==(l=null==i?void 0:i.ignore_text_selection)&&void 0!==l&&l),!1===n)return!1;if(r&&Nr(e))return!1;const{targetElementList:a}=jr(e,!1);return!function(t,e){if(!1===t||Te(t))return!1;let i;if(!0===t)i=Pr;else{if(!Se(t))return!1;if(t.length>10)return Vs.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map(t=>t.toLowerCase())}return e.some(({safeText:t,ariaLabel:e})=>i.some(i=>Ar(t,i)||Ar(e,i)))}(s,a.map(t=>{var e;return{safeText:Cr(t).toLowerCase(),ariaLabel:(null===(e=t.getAttribute("aria-label"))||void 0===e?void 0:e.toLowerCase().trim())||""}}))&&!Ir(a,n)}const Br=t=>!t||yr(t,"html")||!mr(t),jr=(e,i)=>{if(!t||Br(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const s=[e];let r=e;for(;r.parentNode&&!yr(r,"body");){if(br(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}const e=Mr(r);if(!e)break;if(i||Tr.indexOf(e.tagName.toLowerCase())>-1)n=!0;else try{const i=t.getComputedStyle(e);i&&"pointer"===i.getPropertyValue("cursor")&&(n=!0)}catch(t){}s.push(e),r=e}return{parentIsUsefulElement:n,targetElementList:s}};function Hr(t){const e=new Set;let i=0;for(let n=t;n.parentNode&&!yr(n,"body");n=n.parentNode){if(i++>=1e3||e.has(n))return!1;e.add(n);const t=Sr(n);if(ge(t,"ph-sensitive")||ge(t,"ph-no-capture"))return!1}if(ge(Sr(t),"ph-include"))return!0;const n=t.type||"";if(Ee(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}const s=t.name||t.id||"";return!Ee(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Ur(t){return!!(yr(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||yr(t,"select")||yr(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const zr=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}))$"),Wr=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Vr=[16,15,14,13],Gr=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Zr=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Qr=/[0-9A-Za-z_]/;function Jr(t){let e=0,i=!1;for(let n=t.length-1;n>=0;n--){let s=t.charCodeAt(n)-48;i&&(s*=2,s>9&&(s-=9)),e+=s,i=!i}return e%10==0}function Kr(t,e=!0){if(Re(t))return!1;if(Ee(t)){if(t=me(t),e?zr.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(Wr.lastIndex=0;e=Wr.exec(t);){const t=e[2];if(!t)continue;const i=t.replace(/[- ]/g,"");for(let t=0;i.length>t;t++)for(const e of Vr){const n=t+e;if(i.length>=n){const e=i.slice(t,n);if(zr.test(e)&&Jr(e))return!0}}}return!1}(t))return!1;if(e?Gr.test(t):function(t){let e;for(Zr.lastIndex=0;e=Zr.exec(t);){const t=e[1],i=e[3];if(!(t&&i&&Qr.test(t)&&Qr.test(i)))return!0}return!1}(t))return!1}return!0}function Yr(t){let e=Cr(t);return e=`${e} ${Xr(t)}`.trim(),Kr(e)?e:""}function Xr(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Qs(t.childNodes,function(t){var i;if(t&&"span"===(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=Cr(t);e=`${e} ${i}`.trim(),t.childNodes&&t.childNodes.length&&(e=`${e} ${Xr(t)}`.trim())}catch(t){Vs.error("[AutoCapture]",t)}}),e}function to(t){return t.replace(/"|\\"/g,'\\"')}function eo(t){const e=t.attr__class;if(e)return Se(e)?e:wr(e)}const io=1e6;function no(t){var e;return Math.min(io,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:io)}const so={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:io,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"],streamNetworkBody:!1},ro=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],oo=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],lo=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],ao=t=>{Re(t)||Qs(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return ro.includes(e)||lo.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},uo=["/s/","/e/","/i/"];function ho(t,e,i,n){if(Re(t))return t;let s=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return Ee(s)&&(s=parseInt(s)),s>i?`[SessionRecording] ${n} body too large to record (${s} bytes)`:t}function co(t,e){if(Re(t))return t;let i=t;return Kr(i,!1)||(i="[SessionRecording] "+e+" body redacted"),Qs(oo,t=>{(null==i?void 0:i.length)&&-1!==(null==i?void 0:i.indexOf(t))&&(i="[SessionRecording] "+e+" body redacted as might contain: "+t)}),i}const vo=new WeakSet,fo="disabled",po="sampled",go="active",mo="buffering",yo="paused",_o="lazy_loading",bo="rrweb_error",wo="trigger_activated",ko="trigger_pending",So="trigger_disabled";function xo(t,e,i,n,s,r){return 0===e?So:(null==t?void 0:t.get_property(i?n+i:s))===r?wo:ko}function Co(t,e,i){return e.some(e=>{var n;return"regex"===e.matching&&(null!==(n=null==i?void 0:i.get(e.url))&&void 0!==n?n:new RegExp(e.url)).test(t)})}function $o(t){return t.includes("trigger_activated")?wo:t.includes("trigger_pending")?ko:So}function To(t){const e=new Set(t);switch(e.delete(So),e.size){case 0:return So;case 1:return Array.from(e)[0];default:return ko}}var Eo=class{constructor(t){this.q=t}triggerStatus(t){return $o(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return $o(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},Io=class{constructor(t){this.q=t}triggerStatus(t){return To(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return To(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},Mo=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return wo}stop(){}};const Ro=t=>"sessionRecording"in t;var Po=class{constructor(t,e){this._instance=t,this.j=[],this.B=[],this.H=new Map,this.U=new Map,this.W="",this.urlBlocked=!1,this.V=e}onConfig(t){var e,i;this.j=(Ro(t)?Ce(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.B=(Ro(t)?Ce(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.Z()}Z(){this.H.clear(),this.U.clear();for(const t of this.j)if("regex"===t.matching&&!this.H.has(t.url))try{this.H.set(t.url,new RegExp(t.url))}catch(e){Vs.error("Invalid URL trigger regex pattern:",t.url,e)}for(const t of this.B)if("regex"===t.matching&&!this.U.has(t.url))try{this.U.set(t.url,new RegExp(t.url))}catch(e){Vs.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}G(t){return xo(this._instance,this.j.length,this.V,Z,W,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[zt]:e}),e}triggerStatusNoSideEffects(t){return this.G(t)}isCurrentUrlBlocked(){const t=pr(this._instance);if(!t)return!1;try{return Co(t,this.B,this.U)}catch(t){return!0}}checkUrlBlocklist(t,e){const i=pr(this._instance);if(!i)return;if(i===this.W)return;this.W=i;const n=this.urlBlocked,s=Co(i,this.B,this.U);n&&s||(s&&!n?t():!s&&n&&e())}checkUrlTriggerConditions(t,e,i,n){const s=pr(this._instance);if(!s)return;if(s===this.W)return;this.W=s;const r=this.urlBlocked,o=Co(s,this.B,this.U);o&&!r?t():!o&&r&&e();const l=this.G(n)===wo,a=Co(s,this.j,this.H);!l&&a&&i("url",s)}stop(){this.W=""}},Oo=class{constructor(t){this._instance=t,this.linkedFlag=null,this.linkedFlagSeen=!1,this.J=()=>{}}triggerStatus(){const t=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[qt]:t}),t}triggerStatusNoSideEffects(){let t=ko;return Re(this.linkedFlag)&&(t=So),this.linkedFlagSeen&&(t=wo),t}onConfig(t,e){var i;if(this.linkedFlag=(Ro(t)?Ce(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!Re(this.linkedFlag)&&!this.linkedFlagSeen){const t=Ee(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=Ee(this.linkedFlag)?null:this.linkedFlag.variant;this.J=this._instance.onFeatureFlags((n,s)=>{let r=!1;if(Ce(s)&&t in s){const e=s[t];r=Ae(e)?!0===e:i?e===i:!!e}const o=r&&!this.linkedFlagSeen;this.linkedFlagSeen=r,o&&e(t,i)})}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.J()}},Ao=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(Ro(t)?Ce(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}X(t){return xo(this._instance,this.K.length,this.V,G,V,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Nt]:e}),e}triggerStatusNoSideEffects(t){return this.X(t)}checkEventTriggerConditions(t,e,i){if(0===this.K.length)return;const n=this.X(i)===wo,s=this.K.includes(t);!n&&s&&e("event",t)}stop(){}},Fo=class{constructor(t,e,i){if(this._instance=t,this.group=e,this.Y=new Po(t,e.id),this.tt=new Ao(t,e.id),this.et=new Oo(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){const t=(e.conditions.events||[]).map(t=>t.name),n={urlTriggers:e.conditions.urls||[],eventTriggers:t,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.Y.onConfig(n),this.tt.onConfig(n),this.et.onConfig(n,i);const s=[this.tt,this.Y,this.et];this.nt="any"===e.conditions.matchType?new Eo(s):new Io(s)}else this.nt=new Mo}triggerStatus(t){return this.nt.triggerStatus(t)}triggerStatusNoSideEffects(t){return this.nt.triggerStatusNoSideEffects(t)}getPendingTriggerConditions(t){return"trigger_pending"!==this.triggerStatusNoSideEffects(t)?[]:[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===ko).map(({label:t})=>t)}checkEventTriggerConditions(t,e,i){this.tt.checkEventTriggerConditions(t,e,i)}checkUrlTriggerConditions(t,e,i,n){this.Y.checkUrlTriggerConditions(t,e,i,n)}activateTrigger(t,e){var i;const n="url"===t?Z+this.group.id:G+this.group.id;null===(i=this._instance.persistence)||void 0===i||i.register({[n]:e})}stop(){this.Y.stop(),this.tt.stop(),this.et.stop()}};function Do(t){if(t.rrwebError)return bo;if(!t.receivedFlags)return mo;if(!t.isRecordingEnabled)return fo;if(t.urlTriggerMatching.urlBlocked)return yo;const e=!0===t.isSampled,i=new Eo([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?po:"trigger_activated"===i?go:"trigger_pending"===i?mo:!1===t.isSampled?fo:go}function Lo(t){if(t.rrwebError)return bo;if(!t.receivedFlags)return mo;if(!t.isRecordingEnabled)return fo;if(t.urlTriggerMatching.urlBlocked)return yo;const e=new Io([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),i=e!==So,n=Ae(t.isSampled);return i&&"trigger_pending"===e?mo:i&&"trigger_disabled"===e||n&&!t.isSampled?fo:!0===t.isSampled?po:go}function No(){const t=[];return function(e,i){if(Ce(i)||Se(i)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(i)?"[Circular]":(t.push(i),i)}return i}}function qo(t){const e=JSON.stringify(t,No());return e?new Blob([e]).size:0}function Bo(t){if(Me(t))return 4;if(Te(t))return 0;switch(typeof t){case"string":return t.length+2;case"number":return String(t).length;case"boolean":return t?4:5;case"object":{if(Se(t)){let e=2;for(let i=0;t.length>i;i++){i>0&&(e+=1);const n=t[i];e+=Te(n)||Me(n)?4:Bo(n)}return e}const e=t;let i=2,n=!0;for(const t in e){if(!{}.hasOwnProperty.call(e,t))continue;const s=e[t];Te(s)||(n||(i+=1),n=!1,i+=t.length+3+Bo(s))}return i}default:return 0}}function jo(t,e=6606028.8){if(t.size>=e&&t.data.length>1){const e=Math.floor(t.data.length/2),i=t.sizes.slice(0,e),n=t.sizes.slice(e);return[jo({size:i.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),jo({size:n.reduce((t,e)=>t+e,0),data:t.data.slice(e),sizes:n,sessionId:t.sessionId,windowId:t.windowId})].flatMap(t=>t)}return[t]}var Ho=Uint8Array,Uo=Uint16Array,zo=Uint32Array,Wo=new Ho([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Vo=new Ho([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Go=new Ho([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Zo=function(t,e){for(var i=new Uo(31),n=0;31>n;++n)i[n]=e+=1<<t[n-1];var s=new zo(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]},Qo=Zo(Wo,2),Jo=Qo[1];Qo[0][28]=258,Jo[258]=28;for(var Ko=Zo(Vo,0)[1],Yo=new Uo(32768),Xo=0;32768>Xo;++Xo){var tl=(43690&Xo)>>>1|(21845&Xo)<<1;Yo[Xo]=((65280&(tl=(61680&(tl=(52428&tl)>>>2|(13107&tl)<<2))>>>4|(3855&tl)<<4))>>>8|(255&tl)<<8)>>>1}var el=function(t,e,i){for(var n=t.length,s=0,r=new Uo(e);n>s;++s)++r[t[s]-1];var o,l=new Uo(e);for(s=0;e>s;++s)l[s]=l[s-1]+r[s-1]<<1;if(i){o=new Uo(1<<e);var a=15-e;for(s=0;n>s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],c=l[t[s]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)o[Yo[c]>>>a]=u}else for(o=new Uo(n),s=0;n>s;++s)o[s]=Yo[l[t[s]-1]++]>>>15-t[s];return o},il=new Ho(288);for(Xo=0;144>Xo;++Xo)il[Xo]=8;for(Xo=144;256>Xo;++Xo)il[Xo]=9;for(Xo=256;280>Xo;++Xo)il[Xo]=7;for(Xo=280;288>Xo;++Xo)il[Xo]=8;var nl=new Ho(32);for(Xo=0;32>Xo;++Xo)nl[Xo]=5;var sl=el(il,9,0),rl=el(nl,5,0),ol=function(t){return(t/8|0)+(7&t&&1)},ll=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var n=new(t instanceof Uo?Uo:t instanceof zo?zo:Ho)(i-e);return n.set(t.subarray(e,i)),n},al=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8},ul=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8,t[n+2]|=i>>>16},hl=function(t,e){for(var i=[],n=0;t.length>n;++n)t[n]&&i.push({s:n,f:t[n]});var s=i.length,r=i.slice();if(!s)return[new Ho(0),0];if(1==s){var o=new Ho(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(t,e){return t.f-e.f}),i.push({s:-1,f:25001});var l=i[0],a=i[1],u=0,h=1,c=2;for(i[0]={s:-1,f:l.f+a.f,l:l,r:a};h!=s-1;)l=i[i[c].f>i[u].f?u++:c++],a=i[u!=h&&i[c].f>i[u].f?u++:c++],i[h++]={s:-1,f:l.f+a.f,l:l,r:a};var d=r[0].s;for(n=1;s>n;++n)r[n].s>d&&(d=r[n].s);var v=new Uo(d+1),f=cl(i[h-1],v,0);if(f>e){n=0;var p=0,g=f-e,m=1<<g;for(r.sort(function(t,e){return v[e.s]-v[t.s]||t.f-e.f});s>n;++n){var y=r[n].s;if(e>=v[y])break;p+=m-(1<<f-v[y]),v[y]=e}for(p>>>=g;p>0;){var _=r[n].s;e>v[_]?p-=1<<e-v[_]++-1:++n}for(;n>=0&&p;--n){var b=r[n].s;v[b]==e&&(--v[b],++p)}f=e}return[new Ho(v),f]},cl=function(t,e,i){return-1==t.s?Math.max(cl(t.l,e,i+1),cl(t.r,e,i+1)):e[t.s]=i},dl=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Uo(++e),n=0,s=t[0],r=1,o=function(t){i[n++]=t},l=1;e>=l;++l)if(t[l]==s&&l!=e)++r;else{if(!s&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(s),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(s);r=1,s=t[l]}return[i.subarray(0,n),e]},vl=function(t,e){for(var i=0,n=0;e.length>n;++n)i+=t[n]*e[n];return i},fl=function(t,e,i){var n=i.length,s=ol(e+2);t[s]=255&n,t[s+1]=n>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var r=0;n>r;++r)t[s+r+4]=i[r];return 8*(s+4+n)},pl=function(t,e,i,n,s,r,o,l,a,u,h){al(e,h++,i),++s[256];for(var c=hl(s,15),d=c[0],v=c[1],f=hl(r,15),p=f[0],g=f[1],m=dl(d),y=m[0],_=m[1],b=dl(p),w=b[0],k=b[1],S=new Uo(19),x=0;y.length>x;++x)S[31&y[x]]++;for(x=0;w.length>x;++x)S[31&w[x]]++;for(var C=hl(S,7),T=C[0],E=C[1],I=19;I>4&&!T[Go[I-1]];--I);var M,R,P,O,A=u+5<<3,F=vl(s,il)+vl(r,nl)+o,D=vl(s,d)+vl(r,p)+o+14+3*I+vl(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(F>=A&&D>=A)return fl(e,h,t.subarray(a,a+u));if(al(e,h,1+(F>D)),h+=2,F>D){M=el(d,v,0),R=d,P=el(p,g,0),O=p;var L=el(T,E,0);for(al(e,h,_-257),al(e,h+5,k-1),al(e,h+10,I-4),h+=14,x=0;I>x;++x)al(e,h+3*x,T[Go[x]]);h+=3*I;for(var N=[y,w],q=0;2>q;++q){var B=N[q];for(x=0;B.length>x;++x)al(e,h,L[j=31&B[x]]),h+=T[j],j>15&&(al(e,h,B[x]>>>5&127),h+=B[x]>>>12)}}else M=sl,R=il,P=rl,O=nl;for(x=0;l>x;++x)if(n[x]>255){var j;ul(e,h,M[257+(j=n[x]>>>18&31)]),h+=R[j+257],j>7&&(al(e,h,n[x]>>>23&31),h+=Wo[j]);var H=31&n[x];ul(e,h,P[H]),h+=O[H],H>3&&(ul(e,h,n[x]>>>5&8191),h+=Vo[H])}else ul(e,h,M[n[x]]),h+=R[n[x]];return ul(e,h,M[256]),h+R[256]},gl=new zo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ml=new Ho(0),yl=function(){for(var t=new zo(256),e=0;256>e;++e){for(var i=e,n=9;--n;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),_l=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function bl(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,n=0;e.length>n;++n)i=yl[255&i^e[n]]^i>>>8;t=i},d(){return 4294967295^t}}}(),n=t.length;i.p(t);var s,r,o,l,a,u=(s=t,r=e,o=function(t){return 10+(t.filename&&t.filename.length+1||0)}(e),l=8,function(t,e,i,n,s,r){var o=t.length,l=new Ho(n+o+5*(1+Math.floor(o/7e3))+s),a=l.subarray(n,l.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var c=h+65535;o>c?u=fl(a,u,t.subarray(h,c)):(a[h]=r,u=fl(a,u,t.subarray(h,o)))}else{for(var d=gl[e-1],v=d>>>13,f=8191&d,p=(1<<i)-1,g=new Uo(32768),m=new Uo(p+1),y=Math.ceil(i/3),_=2*y,b=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<_)&p},w=new zo(25e3),k=new Uo(288),S=new Uo(32),x=0,C=0,T=(h=0,0),E=0,I=0;o>h;++h){var M=b(h),R=32767&h,P=m[M];if(g[R]=P,m[M]=R,h>=E){var O=o-h;if((x>7e3||T>24576)&&O>423){u=pl(t,a,0,w,k,S,C,T,I,h-I,u),T=x=C=0,I=h;for(var A=0;286>A;++A)k[A]=0;for(A=0;30>A;++A)S[A]=0}var F=2,D=0,L=f,N=R-P&32767;if(O>2&&M==b(h-N))for(var q=Math.min(v,O)-1,B=Math.min(32767,h),j=Math.min(258,O);B>=N&&--L&&R!=P;){if(t[h+F]==t[h+F-N]){for(var H=0;j>H&&t[h+H]==t[h+H-N];++H);if(H>F){if(F=H,D=N,H>q)break;var U=Math.min(N,H-2),z=0;for(A=0;U>A;++A){var W=h-N+A+32768&32767,V=W-g[W]+32768&32767;V>z&&(z=V,P=W)}}}N+=(R=P)-(P=g[R])+32768&32767}if(D){w[T++]=268435456|Jo[F]<<18|Ko[D];var G=31&Jo[F],Z=31&Ko[D];C+=Wo[G]+Vo[Z],++k[257+G],++S[Z],E=h+F,++x}else w[T++]=t[h],++k[t[h]]}}u=pl(t,a,r,w,k,S,C,T,I,h-I,u),r||(u=fl(a,u,ml))}return ll(l,0,n+ol(u)+s)}(s,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+r.mem,o,l,!a)),h=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&_l(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var n=0;i.length>=n;++n)t[n+10]=i.charCodeAt(n)}}(u,e),_l(u,h-8,i.d()),_l(u,h-4,n),u}function wl(t,e){var i=t.length;if(!e&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new Ho(t.length+(t.length>>>1)),s=0,r=function(t){n[s++]=t},o=0;i>o;++o){if(s+5>n.length){var l=new Ho(s+8+(i-o<<1));l.set(n),n=l}var a=t.charCodeAt(o);128>a||e?r(a):2048>a?(r(192|a>>>6),r(128|63&a)):a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&t.charCodeAt(++o))>>>18),r(128|a>>>12&63),r(128|a>>>6&63),r(128|63&a)):(r(224|a>>>12),r(128|a>>>6&63),r(128|63&a))}return ll(n,0,s)}function kl(t,e){var i="";if(!e&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var n=0;t.length>n;){var s=t[n++];128>s||e?i+=String.fromCharCode(s):224>s?i+=String.fromCharCode((31&s)<<6|63&t[n++]):240>s?i+=String.fromCharCode((15&s)<<12|(63&t[n++])<<6|63&t[n++]):(s=((15&s)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,i+=String.fromCharCode(55296|s>>10,56320|1023&s))}return i}var Sl=class{constructor(t,e={}){var i,n,s,r;this._rrweb=t,this.it=e,this.rt={},this.ot=Date.now(),this.st=-1/0,this.ut=()=>{const t=Date.now(),e=t-this.ot;e>0?(this.ct=Math.min(this.dt,this.ct+e/1e3*this.ht),this.ot=t):this.ot=t},this.ft=t=>{if(!this.rt[t]){var e,i;this.rt[t]=!0;const n=this.vt(t);null===(e=(i=this.it).onBlockedNode)||void 0===e||e.call(i,t,n)}},this.yt=t=>{const e=this.vt(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){const t=e.closest("svg");if(t)return[this._rrweb.mirror.getId(t),t]}return[t,e]},this.vt=t=>this._rrweb.mirror.getNode(t),this.bt=t=>{var e,i,n,s,r,o,l,a;return(null!==(e=null===(i=t.removes)||void 0===i?void 0:i.length)&&void 0!==e?e:0)+(null!==(n=null===(s=t.attributes)||void 0===s?void 0:s.length)&&void 0!==n?n:0)+(null!==(r=null===(o=t.texts)||void 0===o?void 0:o.length)&&void 0!==r?r:0)+(null!==(l=null===(a=t.adds)||void 0===a?void 0:a.length)&&void 0!==l?l:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;const e=t.data,i=this.bt(e);if(e.attributes){const t=e.attributes.length;e.attributes=e.attributes.filter(t=>{const[e]=this.yt(t.id);return!this.wt.consumeRateLimit(e)&&t});const i=t-e.attributes.length;var n,s;i>0&&(null===(n=(s=this.it).onDroppedAttributeMutations)||void 0===n||n.call(s,i))}const r=this.bt(e);if(0===r&&i!==r)return;if(this.kt)return t;this.ut();const o=Bo(t);var l,a;return o>this.ct?(null===(l=(a=this.it).onDroppedOversizedMutation)||void 0===l||l.call(a,o),void this._t()):(this.ct-=o,t)},this._t=()=>{if(this.St)return;const t=Math.max(0,this.xt-(Date.now()-this.st));this.St=setTimeout(()=>{var t,e;this.St=void 0,this.st=Date.now(),null===(t=(e=this.it).requestFullSnapshot)||void 0===t||t.call(e)},t)},this.wt=new Qe({bucketSize:null!==(i=this.it.bucketSize)&&void 0!==i?i:100,refillRate:null!==(n=this.it.refillRate)&&void 0!==n?n:10,refillInterval:1e3,I:this.ft,$:Vs}),this.dt=null!==(s=this.it.bytesBucketSize)&&void 0!==s?s:0,this.ht=null!==(r=this.it.bytesRefillRate)&&void 0!==r?r:25600,this.kt=!Number.isFinite(this.dt)||0>=this.dt,this.ct=this.dt;const o=this.it.resyncIntervalMs;this.xt=Pe(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this.rt={},this.St&&(clearTimeout(this.St),this.St=void 0),this.st=Date.now()}stop(){this.wt.stop(),this.reset(),this.ct=this.dt,this.ot=Date.now(),this.st=-1/0}};const xl=t=>{if(n){try{const e=t+"=",i=n.cookie.split(";").filter(t=>t.length);for(let t=0;i.length>t;t++){let n=i[t];for(;" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Pe(t)&&isFinite(t)&&Math.floor(t)===t});var Cl=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,i,n,s){if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(n)||!Number.isInteger(s)||0>e||0>i||0>n||0>s||e>0xffffffffffff||i>4095||n>1073741823||s>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/256,r[5]=e,r[6]=112|i>>>8,r[7]=i,r[8]=128|n>>>24,r[9]=n>>>16,r[10]=n>>>8,r[11]=n,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new t(r)}toString(){let t="";for(let e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(let e=0;16>e;e++){const i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}},$l=class{generate(){const t=this.generateOrAbort();if(!Te(t))return t;{this.Ct=0;const t=this.generateOrAbort();if(Te(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return Pe(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Ct)this.Ct=t,this.Mt();else{if(this.Ct>=t+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return Cl.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new El}};let Tl=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!Te(t.crypto)&&crypto.getRandomValues&&(Tl=t=>crypto.getRandomValues(t));var El=class{nextUint32(){return this.Rt.length>this.$t||(Tl(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let Il;const Ml=()=>Rl().toString(),Rl=()=>(Il||(Il=new $l)).generate();let Pl="";const Ol=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Al=null;const Fl={Et(){if(!Me(Al))return Al;if(Al=!1,n)try{const t=`__ph_cookie_support_${Ml()}`;Fl.At(t,"xyz"),Al='"xyz"'===xl(t),Fl.Lt(t)}catch(t){Al=!1}return Al},Pt(t){Vs.error("cookieStore error: "+t)},Ot:xl,Dt(t){let e;try{e=JSON.parse(Fl.Ot(t))||{}}catch(t){}return e},At(t,e,i,s,r){if(!n)return!1;try{let o="",l="";const a=function(t,e){if(e){let e=function(t,e=n){if(Pl)return Pl;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";const i=t.split(".");let s=Math.min(i.length,8);const r="dmn_chk_"+Ml();for(;!Pl&&s--;){const t=i.slice(s).join("."),n=r+"=1;domain=."+t+";path=/";e.cookie=n+";max-age=3",e.cookie.includes(r)&&(e.cookie=n+";max-age=0",Pl=t)}return Pl}(t);if(!e){const i=(t=>{const e=t.match(Ol);return e?e[0]:""})(t);i!==e&&Vs.info("Warning: cookie subdomain discovery mismatch",i,e),e=i}return e?"; domain=."+e:""}return""}(n.location.hostname,s);if(i){const t=new Date;t.setTime(t.getTime()+864e5*i),o="; expires="+t.toUTCString()}r&&(l="; secure");const u=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+a+l;return u.length>3686.4&&Vs.warn("cookieStore warning: large cookie, len="+u.length),n.cookie=u,!0}catch(t){return!1}},Lt(t,e){if(null==n?void 0:n.cookie)try{Fl.At(t,"",-1,e)}catch(t){return}}};let Dl=null;const Ll={Et(){if(!Me(Dl))return Dl;let e=!0;if(Te(t))e=!1;else try{const t="__mplssupport__";Ll.At(t,"xyz"),'"xyz"'!==Ll.Ot(t)&&(e=!1),Ll.Lt(t)}catch(t){e=!1}return e||Vs.error("localStorage unsupported; falling back to cookie store"),Dl=e,e},Pt(t){Vs.error("localStorage error: "+t)},Ot(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Ll.Pt(t)}return null},Dt(t){try{return JSON.parse(Ll.Ot(t))||{}}catch(t){}return null},At(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Ll.Pt(t)}return!1},Lt(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Ll.Pt(t)}}},Nl=[lt,X,Y,et,it,nt,Ct,xt,kt],ql=[p,f,H,U,Pt,Rt,b,$t],Bl=t=>t+"_cpm",jl=["__proto__","constructor","prototype"],Hl=t=>{if(!Ce(t))return{};const e={};return Object.keys(t).forEach(i=>{-1===jl.indexOf(i)&&(e[i]=t[i])}),e},Ul=(t,e=[])=>{const i={};return[...ql,...e].forEach(e=>{const n=t[e];Te(n)||Me(n)||""===n||(i[e]=n)}),i},zl=t=>{let e=5381,i=2166136261;for(let n=0;t.length>n;n++){const s=t.charCodeAt(n);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},Wl=(t,e)=>({p:e,f:zl(JSON.stringify(t))}),Vl=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const i=Fl.Dt(Bl(t)),n=(null==i?void 0:i.f)===zl(e)&&Se(i.p);return{properties:n?i.p:[],isValid:n}}catch(t){return{properties:[],isValid:!1}}},Gl=(t,e)=>e+"|"+(Fl.Ot(Bl(t))||""),Zl={},Ql={Et:()=>!0,Pt(t){Vs.error("memoryStorage error: "+t)},Ot:t=>t in Zl?Zl[t]:null,Dt:t=>t in Zl?Zl[t]:null,At:(t,e)=>(Zl[t]=e,!0),Lt(t){delete Zl[t]}};let Jl=null;const Kl={Et(){if(!Me(Jl))return Jl;if(Jl=!0,Te(t))Jl=!1;else try{const t="__support__";Kl.At(t,"xyz"),'"xyz"'!==Kl.Ot(t)&&(Jl=!1),Kl.Lt(t)}catch(t){Jl=!1}return Jl},Pt(t){Vs.error("sessionStorage error: ",t)},Ot(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Kl.Pt(t)}return null},Dt(t){try{return JSON.parse(Kl.Ot(t))||null}catch(t){}return null},At(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Kl.Pt(t)}return!1},Lt(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Kl.Pt(t)}}};zs.DEBUG=!1,zs.LIB_VERSION="1.433.2",zs.LIB_NAME="web";var Yl=zs,Xl=class{constructor(t){if(!t.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.Ft=t.get_property.bind(t),this.Nt=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.Nt(K,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){const e=this.Ft(K);return Ce(i=e)&&Ee(i.sessionId)&&Pe(i.size)&&e.sessionId===t?e.size:0;var i}};function ta(t,e){return function(t){let e=0;for(let i=0;t.length>i;i++)e=(e<<5)-e+t.charCodeAt(i),e|=0;return Math.abs(e)}(t)%100<Ze(100*e,0,100,Vs)}function ea(t){return`$survey_response_${t}`}function ia(t,e){if(!e)return null;const i=t[ea(e)];return Se(i)?[...i]:i}function na(t={},e,i){const n={};return e.questions.forEach(e=>{if(Te(e.originalQuestionIndex))return;const i=0===(s=e.originalQuestionIndex)?"$survey_response":`$survey_response_${s}`;var s;const r=ia(t,e.id);Te(r)||(n[i]=r)}),ue(ue({$survey_questions:e.questions.map(e=>{var n,s;return{id:e.id,question:null!==(n=null==i?void 0:i[null!==(s=e.id)&&void 0!==s?s:""])&&void 0!==n?n:e.question,response:ia(t,e.id)}})},t),n)}function sa(t={}){return Object.values(t).some(t=>!Re(t))}function ra(t,e){let i=`$survey_${e}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(i=`$survey_${e}/${t.id}/${t.current_iteration}`),i}function oa(t){return"string"==typeof t&&t.trim()?t.trim():null}function la(t){return t.toLowerCase()}function aa(t,e,i){if(!t||!e)return null;const n=la(e),s=Object.keys(t).find(t=>la(t)===n);if(s)return null==i||i.debug(`Found exact translation match: ${s}`),s;if(n.includes("-")){const s=n.split("-")[0],r=Object.keys(t).find(t=>la(t)===s);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${e})`),r}return null}const ua=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function ha(t,e,i){var n;const s=aa(t.translations,e,i),r=ue({},t);let o=!1;if(s){var l;const e=null===(l=t.translations)||void 0===l?void 0:l[s];if(e)if(null==i||i.info(`Applying survey-level translation for language: ${s}`),Te(e.name)||(r.name=e.name,o=!0),r.appearance){const t=ue({},r.appearance);for(const i of ua){const n=e[i];Te(n)||(t[i]=n,o=!0)}r.appearance=t}else(function(t){return ua.some(e=>!Te(t[e]))})(e)&&(o=!0)}const a=t.questions.map(t=>function(t,e,i){var n;const s=aa(t.translations,e,i);if(!s)return{question:t,matchedKey:null,hasChanges:!1};const r=null===(n=t.translations)||void 0===n?void 0:n[s];if(!r)return{question:t,matchedKey:null,hasChanges:!1};const o=ue({},t);let l=!1;return Te(r.question)||(o.question=r.question,l=!0),Te(r.description)||(o.description=r.description,l=!0),Te(r.buttonText)||(o.buttonText=r.buttonText,l=!0),"link"in o&&!Te(r.link)&&(o.link=r.link,l=!0),"lowerBoundLabel"in o&&!Te(r.lowerBoundLabel)&&(o.lowerBoundLabel=r.lowerBoundLabel,l=!0),"upperBoundLabel"in o&&!Te(r.upperBoundLabel)&&(o.upperBoundLabel=r.upperBoundLabel,l=!0),"choices"in o&&function(t){return Se(t.choices)}(r)&&(o.choices=r.choices,l=!0),{question:l?o:t,matchedKey:l?s:null,hasChanges:l}}(t,e,i)),u=a.map(t=>t.question),h=a.some(t=>t.hasChanges);let c=null;return s||(c=(null===(n=a.find(t=>t.matchedKey))||void 0===n?void 0:n.matchedKey)||null),h&&(r.questions=u,o=!0,null==i||i.info(`Applied question-level translations for language: ${e}`)),{survey:r,matchedKey:o?s||c:null}}function ca(t){var e;return!!(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)}function da(t){var e;return ca(t)&&!!(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e?void 0:e.repeatedActivation)||"always"===t.schedule}const va=(t,e)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},fa=t=>t.toLowerCase(),pa={exact:(t,e)=>e.some(e=>t.some(t=>e===t)),is_not:(t,e)=>e.every(e=>t.every(t=>e!==t)),regex:(t,e)=>e.some(e=>t.some(t=>va(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!va(e,t))),icontains:(t,e)=>e.map(fa).some(e=>t.map(fa).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(fa).every(e=>t.map(fa).every(t=>!e.includes(t))),gt:(t,e)=>e.some(e=>{const i=parseFloat(e);return!isNaN(i)&&t.some(t=>i>parseFloat(t))}),lt:(t,e)=>e.some(e=>{const i=parseFloat(e);return!isNaN(i)&&t.some(t=>i<parseFloat(t))})};function ga(t,e){return!t||Object.entries(t).every(([t,i])=>{const n=null==e?void 0:e[t];if(null==n)return!1;const s=pa[i.operator];return!!s&&s(i.values,[String(n)])})}function ma(t,e,i){return or({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}const ya=new Set(["is_not","not_icontains","not_regex"]);function _a(t,e,i){return!t||0===t.length||t.every(t=>{const n="person"===t.type?i:e,s=null==n?void 0:n[t.key],r=t.operator||"exact";if(Te(s)||Me(s))return ya.has(r);const o=pa[r];return!!o&&!Te(t.value)&&!Me(t.value)&&o(Se(t.value)?t.value.map(String):[String(t.value)],Se(s)?s.map(String):[String(s)])})}const ba=Gs("[SessionRecording]");function wa(t,e){return e?t:"!"+t}function ka(t,e){return t===e||t!=="!"+e&&null}var Sa=class{constructor(t,e,i,n,s,r,o){this._instance=t,this.Y=e,this.tt=i,this.et=n,this.qt=s,this.jt=r,this.Bt=o,this.Ht=null,this.zt=Lo}onRemoteConfig(t){this.Ht=Pe(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ut=new Eo([this.tt,this.Y]),this.zt=Do):(this.Ut=new Io([this.tt,this.Y]),this.zt=Lo),this._instance.register_for_session({[Ht]:t.triggerMatchType}),this.Y.onConfig(t),this.tt.onConfig(t),this.et.onConfig(t,(t,e)=>{this.qt("linked_flag_matched",{flag:t,variant:e}),this.Bt()})}getStatus(t){return this.zt({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){const e=this._instance.get_property("$session_recording_remote_config"),i=null==e?void 0:e.minimumDurationMilliseconds;return Pe(i)?i:null}checkUrlTriggers(t,e,i,n){this.Y.checkUrlTriggerConditions(e,i,n,t)}setupEventTriggerListeners(t,e,i){if(0!==this.tt.K.length&&Re(this.Wt))return this.Wt=t(t=>{try{this.tt.checkEventTriggerConditions(t.event,i,e)}catch(t){ba.error("Could not activate event trigger",t)}}),this.Wt}makeSamplingDecisions(t){var e;const i=this.Ht;var n,s;if(!Pe(i))return null===(n=this._instance.persistence)||void 0===n||n.unregister("$session_is_sampled"),void(null===(s=this._instance.persistence)||void 0===s||s.unregister("$replay_sample_rate"));const r=this._instance.get_property(U),o=this._instance.get_property(L),l=ka(r,t),a=Pe(o)&&o!==i,u=Te(o)&&r===t,h=a||u||!Ae(l),c=h?ta(t,i):l;h&&(c?this.qt("sampled"):ba.warn(`Sample rate (${i}) has determined that this sessionId (${t}) will not be sent to the server.`)),null===(e=this._instance.persistence)||void 0===e||e.register({$session_is_sampled:wa(t,c),$replay_sample_rate:Me(o)&&r===t?null:i})}ensureSamplingDecision(t){if(!Pe(this.Ht))return;const e=this._instance.get_property(U);Ae(ka(e,t))||this.makeSamplingDecisions(t)}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,i,n,s;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_recording_event_trigger_activated_session"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_recording_url_trigger_activated_session"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_is_sampled"),null===(n=this._instance.persistence)||void 0===n||n.unregister("$replay_sample_rate"),null===(s=this._instance.persistence)||void 0===s||s.unregister("$session_past_minimum_duration")}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null===(e=this.Ut)||void 0===e?void 0:e.triggerStatus(t))===ko}getPendingTriggerConditions(t){return[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===ko).map(({label:t})=>t)}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.tt.stop(),this.Y.stop(),this.et.stop()}},xa=class{constructor(t,e,i,n,s){this._instance=t,this.Y=e,this.qt=i,this.Vt=n,this.Bt=s,this.Zt=[],this.Gt=new Map,this.Qt=!1}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Jt(t.triggerGroups),this._instance.register_for_session({[Ht]:"v2_trigger_groups",[Ut]:t.triggerGroups.length}),this.Y.onConfig(t)):ba.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return bo;if(!t.receivedFlags)return mo;if(!t.isRecordingEnabled)return fo;if(t.urlTriggerMatching.urlBlocked)return yo;const e=t.triggerGroupMatchers,i=t.triggerGroupSamplingResults;if(0===e.length)return fo;let n=!1,s=!1;for(const r of e){const e=r.triggerStatus(t.sessionId);if("trigger_activated"===e){const t=r.group.id,e=i.get(t);Te(e)?Vs.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(s=!0)}else"trigger_pending"===e&&(n=!0)}return s?po:n?mo:fo}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Zt,triggerGroupSamplingResults:this.Gt,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){let e=null;for(const i of this.Zt)if("trigger_activated"===i.triggerStatus(t)){const t=i.group.minDurationMs;Pe(t)&&(Me(e)||e>t)&&(e=t)}return e}checkUrlTriggers(t,e,i,n){this.Y.checkUrlBlocklist(e,i);for(const n of this.Zt)n.checkUrlTriggerConditions(e,i,e=>{this.Kt(n,void 0)&&(n.activateTrigger(e,t),this.updateActiveTriggers(t),this.Bt(e))},t)}setupEventTriggerListeners(t,e,i){return this.Wt=t(t=>{var i;if(this.Qt)return ba.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(i=this.Wt)||void 0===i||i.call(this),void(this.Wt=void 0);try{for(const i of this.Zt)i.checkEventTriggerConditions(t.event,n=>{if(!this.Kt(i,t.properties))return;const s=(i.group.conditions.events||[]).filter(e=>e.name===t.event),r=this._instance.get_property(lt);s.some(e=>!e.properties||0===e.properties.length||_a(e.properties,t.properties,r))&&(i.activateTrigger(n,e),this.updateActiveTriggers(e),this.Bt(n))},e)}catch(t){ba.error("Could not activate event trigger for trigger groups",t)}}),this.Wt}makeSamplingDecisions(t){for(const i of this.Zt){var e;const n=i.group,s=n.id,r=n.sampleRate,o=Q+s,l=this._instance.get_property(o);let a=null,u=!1,h=!1,c=!1;if(Ce(l)){const e=l.sessionId,i=l.sampleRate,n=l.sampled;u="string"==typeof e&&e!==t,h=Pe(i)&&i!==r,a=e===t&&Pe(i)&&i===r&&Ae(n)?n:null}else a=l===t||null,u="string"==typeof l&&l!==t,c=l===t;const d=u||h||c||!Ae(a),v=d?ta(t+s,r):a;d&&this.Vt("triggerGroupSamplingDecisionMade",{group_id:s,group_name:n.name,sampleRate:r,isSampled:v}),this.Gt.set(s,v),null===(e=this._instance.persistence)||void 0===e||e.register({[o]:{sessionId:t,sampleRate:r,sampled:v}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Qt=!0}clearConditionalRecordingPersistence(){var t,e,i;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$replay_sample_rate"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_past_minimum_duration");for(const t of this.Zt){var n,s,r;const e=t.group.id;null===(n=this._instance.persistence)||void 0===n||n.unregister("$posthog_sr_group_event_trigger_"+e),null===(s=this._instance.persistence)||void 0===s||s.unregister("$posthog_sr_group_url_trigger_"+e),null===(r=this._instance.persistence)||void 0===r||r.unregister("$posthog_sr_group_sampling_"+e)}}updateActiveTriggers(t){const e=[];for(const i of this.Zt){const n=i.group,s=n.id,r="trigger_activated"===i.triggerStatus(t),o=!0===this.Gt.get(s);r&&e.push({id:s,name:n.name,matched:!0,sampled:o})}this._instance.register_for_session({[Bt]:e})}hasPendingTriggers(t){for(const e of this.Zt)if("trigger_pending"===e.triggerStatus(t))return!0;return!1}getPendingTriggerConditions(t){return this.Zt.flatMap(e=>"trigger_pending"!==e.triggerStatusNoSideEffects(t)?[]:e.getPendingTriggerConditions(t).map(t=>`trigger group "${e.group.name}": ${t}`))}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear(),this.Y.stop()}Kt(t,e){const i=t.group.conditions.properties;return!i||0===i.length||_a(i,e,this._instance.get_property(lt))}Jt(t){this.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear();for(const e of t){const t=new Fo(this._instance,e,(t,i)=>{this.qt("linked_flag_matched",{flag:t,variant:i,group_id:e.id,group_name:e.name}),this.Bt()});this.Zt.push(t)}}};const Ca=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],$a=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ca],Ta="<masked>",Ea=["li_fat_id"];function Ia(t,e,i){if(!n)return{};const s=e?[...Ca,...i||[]]:[],r=Ma(hr(n.URL,s,Ta),t),o=function(){const t={};return Qs(Ea,function(e){const i=xl(e);t[e]=i||null}),t}();return Js(o,r)}function Ma(t,e){const i=$a.concat(e||[]),n={};return Qs(i,function(e){const i=ur(t,e);n[e]=i||null}),n}function Ra(t){const e=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!Me(e)){s.$search_engine=e;const t=n?ur(n.referrer,i):"";t.length&&(s.ph_keyword=t)}return s}function Pa(){return navigator.language||navigator.userLanguage}function Oa(){const t=Pa();return"string"==typeof t?t.split("-")[0]:void 0}const Aa="$direct";function Fa(){return(null==n?void 0:n.referrer)||Aa}function Da(t,e,i=!1){const n=t?[...Ca,...e||[]]:[],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:Fa().substring(0,1e3),u:o?hr(o,n,Ta):void 0}}function La(t,e=!1){var i;const{r:n,u:s}=t,r=e?un(s):s,o={$referrer:n,$referring_domain:null==n?void 0:n==Aa?Aa:null===(i=lr(n))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const t=lr(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const e=Ma(r);Js(o,e)}if(n){const t=Ra(n);Js(o,t)}return o}function Na(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function qa(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const Ba=1e5,ja=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Ha=[],Ua=()=>!1,za="@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(" "),Wa="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Va="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(" "),Ga="Accommodation AdministrativeArea Country Place State".split(" "),Za={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:Wa,publisher:Va},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Ha},Offer:{seller:Va},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:Va,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Va,areaServed:Ga,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Ha}},Qa=[["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(" "),Za.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Za.Event],[Va,Za.Organization],[Ga,Za.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Za.Product]];function Ja(t,e){return we.call(t,e)?t[e]:void 0}function Ka(t){const e=typeof t;return Me(t)||"string"===e||"number"===e||"boolean"===e}function Ya(t,e){return e&&function(t){return Ee(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function Xa(t,e){return Se(t)&&t.every(Ka)?t.map(t=>Ya(t,e)).filter(t=>!Te(t)):Ka(t)?Ya(t,e):void 0}function tu(t,e){if("string"!=typeof t)return;const i=t.trim(),n=i.indexOf("#"),s=0>n?i:i.slice(n+1);if(!(!s||0>n&&(/^[a-z][a-z\d+.-]*:/i.test(i)||i.includes("/")||i.includes("?"))))try{return e(s)?s:void 0}catch(t){return}}function eu(t){if(we.call(Za,t))return Za[t];for(const[e,i]of Qa)if(e.includes(t))return i}function iu(t,e,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0})}function nu(t,e,i,n){if(Se(t)){const s=t.map(t=>nu(t,e,i,n)).filter(t=>!Te(t));return s.length?s:void 0}return su(t,e,i,n)||void 0}function su(t,e,i,n){if(!Ce(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(i))return null;const s=Ja(t,"@type"),r=function(t){const e=new Set,i="string"==typeof t?[t]:Se(t)?t:[],n=[];for(const t of i){if("string"!=typeof t)continue;const i=t.replace(/^https?:\/\/schema\.org\//,"");if(100>=i.length&&ja.test(i)&&!e.has(i)&&(e.add(i),n.push(i),20===n.length))break}return n}(s),o=r.filter(t=>!!eu(t)&&(!n||!n.length||n.includes(t))),l={};for(const n of za){const o="@type"===n?r.length?"string"==typeof s?r[0]:r:void 0:"@id"===n?tu(Ja(t,n),e):Xa(Ja(t,n),i.maskUrl);Te(o)||iu(l,n,o)}for(const n of o){const s=eu(n);for(const n of Object.keys(s)){const r=Ja(t,n),o=s[n];if(!0===o){const t=Xa(r,i.maskUrl);Te(t)||iu(l,n,t)}else{const t=nu(r,e,i,o);Te(t)||iu(l,n,t)}}}const a=nu(Ja(t,"@graph"),e,i);return Te(a)||iu(l,"@graph",a),Object.keys(l).length?l:null}function ru(t,e,i){if(!Ce(t))return null;const n=Ja(t,"@context");if("string"!=typeof n||!/^https?:\/\/schema\.org\/?$/.test(n))return null;const s=su(t,e,i);return s?ue({"@context":"https://schema.org"},s):null}function ou(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function lu(t,e,i){if("string"==typeof e?t.classList.contains(e):e&&Array.from(t.classList).some(t=>(e.lastIndex=0,e.test(t))))return!0;try{return!!i&&t.matches(i)}catch(t){return!1}}function au(t,e,i){for(let n=t;n;){if(lu(n,e,i))return!0;const t=n.parentNode;n=n.parentElement||(t&&t.nodeType===t.DOCUMENT_FRAGMENT_NODE?t.host:null)}return!1}function uu(t){return ou(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(ou)}function hu(t){return Te(t)?void 0:Math.round(t)}function cu(t){return Ce(t)?t.network_timing:t}const du=Gs("[SessionRecording]"),vu=[1,2,3,4,5,6,7,12],fu=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function pu(){var t;return null==d||null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function gu(){var t;return null===(t=pu())||void 0===t?void 0:t.record}function mu(t){try{return JSON.stringify(t)}catch(e){return JSON.stringify(t,No())}}function yu(t){return kl(bl(wl(mu(t))),!0)}function _u(t){return bu.apply(this,arguments)}function bu(){return(bu=re(function*(t){const e=yield gs(mu(t),Yl.DEBUG,{rethrow:!0});return kl(new Uint8Array(yield e.arrayBuffer()),!0)})).apply(this,arguments)}let wu,ku;const Su="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let xu=!1;function Cu(t){var e;return Se(t)&&0===t.length?(wu=null!==(e=wu)&&void 0!==e?e:yu([]),wu):yu(t)}function $u(t){return Tu.apply(this,arguments)}function Tu(){return(Tu=re(function*(t){var e;return Se(t)&&0===t.length?wu||(ku=null!==(e=ku)&&void 0!==e?e:_u([]).then(t=>(wu=t,t)).catch(t=>{throw wu=void 0,ku=void 0,t}),ku):_u(t)})).apply(this,arguments)}function Eu(t){return Su&&!xu&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function Iu(t){return{event:t,size:Bo(t)}}function Mu(t,e){return ue(ue({},t),{},{data:e,cv:"2024-10"})}function Ru(t,e){return ue(ue({},t),{},{cv:"2024-10",data:ue(ue({},t.data),e)})}function Pu(t){try{if(2===t.type)return Iu(Mu(t,yu(t.data)));if(3===t.type&&0===t.data.source)return Iu(Ru(t,{texts:Cu(t.data.texts),attributes:Cu(t.data.attributes),removes:Cu(t.data.removes),adds:Cu(t.data.adds)}));if(3===t.type&&8===t.data.source)return Iu(Ru(t,{adds:t.data.adds?yu(t.data.adds):void 0,removes:t.data.removes?yu(t.data.removes):void 0}))}catch(t){du.error("could not compress event - will use uncompressed event",t)}return{event:t,size:qo(t)}}function Ou(){return Ou=re(function*(t){try{if(2===t.type)return Iu(Mu(t,yield _u(t.data)));if(3===t.type&&0===t.data.source){const[e,i,n,s]=yield Promise.all([$u(t.data.texts),$u(t.data.attributes),$u(t.data.removes),$u(t.data.adds)]);return Iu(Ru(t,{texts:e,attributes:i,removes:n,adds:s}))}if(3===t.type&&8===t.data.source){const[e,i]=yield Promise.all([t.data.adds?_u(t.data.adds):void 0,t.data.removes?_u(t.data.removes):void 0]);return Iu(Ru(t,{adds:e,removes:i}))}}catch(e){return cs(e)&&(xu=!0),du.error("could not compress event asynchronously - trying synchronous compression",e),Pu(t)}return{event:t,size:qo(t)}}),Ou.apply(this,arguments)}function Au(t,e){return 5===t.type&&t.data.tag===e}function Fu(t){return Au(t,"sessionIdle")}function Du(t){return Au(t,"$session_ending")}function Lu(t){return Au(t,"$session_starting")}var Nu=class{get sessionId(){return this.Xt}get Yt(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get te(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get ee(){return ka(this._instance.get_property(U),this.sessionId)}get Ht(){var t;const e=null===(t=this.ne)||void 0===t?void 0:t.sampleRate;return Pe(e)?e:null}get ie(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t,e){this._instance=t,this.oe="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.se=void 0,this.ae=!1,this.le=Date.now(),this.ue=!1,this.ce=[],this.de="unknown",this.he=0,this.fe=0,this.ve=0,this.pe=0,this.me=!1,this.ge=!1,this.ye=!1,this.be=!1,this.we=!1,this.ke=!1,this._e=!1,this.Se=!1,this.xe=!1,this.Ce=!1,this.Me=!1,this.Ie=!1,this.Te=[],this.Re=void 0,this.$e=void 0,this.Ee=!1,this.Ae=[],this.Oe=0,this.Le=0,this.Pe=!1,this.De=void 0,this.Wt=void 0,this.Fe=void 0,this.Ne=void 0,this.qe=void 0,this.je=(t,e,i)=>{var n,s,r,o;if(!i)return;if(t===this.Xt&&e===this.Be)return;const l=!i.noSessionId&&(i.activityTimeout||i.sessionPastMaximumLength),a=this.Xt,u=this.Be;var h;if(l&&this.Vt("$session_ending",{currentSessionId:a,currentWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le,flushed_size:null===(h=this.He)||void 0===h?void 0:h.currentTrackedSize(a)}),null===(n=this._instance.persistence)||void 0===n||n.unregister("$debug_first_full_snapshot_timestamp"),this._e=!1,null===(s=pu())||void 0===s||null===(r=s.resetMaxDepthState)||void 0===r||r.call(s),this.Vt("$session_id_change",{sessionId:t,windowId:e,changeReason:i}),this.ze(),!(!1===this.de&&this.isStarted||this.Xt===t&&this.Be===e)){const e=this.Xt!==t&&!1!==this.de;this.de="unknown",this.Ue(e)}l&&this.Vt("$session_starting",{previousSessionId:a,previousWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le}),null===(o=this.re)||void 0===o||o.makeSamplingDecisions(t)},this.We=!1,this.Ve=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[z])===this.Xt},this.Ze=()=>{var t,e;if(0===this.Rt.data.length)return null;const i=null===(t=this.Rt.data[0])||void 0===t?void 0:t.timestamp,n=null===(e=this.Rt.data[this.Rt.data.length-1])||void 0===e?void 0:e.timestamp;return Pe(i)&&Pe(n)?n-i:null},this.Ge=()=>{var t,e;const i=this.ie;if(!Pe(i))return!1;if(null===(t=null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.strictMinimumDuration)||void 0===t||!t){const t=this.Qe;return Pe(t)&&t>=0&&i>t}if(this.Ve())return!1;const n=this.Ze();return!!Me(n)||i>n||(null===(s=this._instance.persistence)||void 0===s||s.register({$session_past_minimum_duration:this.Xt}),!1);var s},this.Je=()=>{"buffering"!==this.status?(this.me&&this.ge&&this.Ke&&!this.ye&&this.Xe(void 0),this.Ye(),this.tn(!0)):this.en()},this.nn=()=>{this.Je()},this.rn=()=>{this.Vt("browser offline",{})},this.sn=()=>{this.Vt("browser online",{})},this.an=()=>{(null==n?void 0:n.visibilityState)&&("visible"===n.visibilityState&&(this.Ke=!0),this.Vt("window "+n.visibilityState,{}))},this.Ke=null==e||e;const{sessionId:i,windowId:s,sessionStartTimestamp:r}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=i,this.Be=s,this._sessionStartTimestamp=r,this.et=new Oo(this._instance),this.Y=new Po(this._instance),this.tt=new Ao(this._instance),this.Rt=this.en(),this.ln="ph_replay_pending_buffer_"+JSON.stringify([this._instance.config.persistence_name||this._instance.config.token,this._instance.config.token]),this.Yt.sessionTimeoutMs>this.te||du.warn(`session_idle_threshold_ms (${this.te}) is greater than the session timeout (${this.Yt.sessionTimeoutMs}). Session will never be detected as idle`),this.He=new Xl(this._instance)}setDocumentWasEverVisible(t){t&&(this.Ke=!0)}get un(){var t,e,i,n,s,r,o,l,a;const u=null===(t=this.ne)||void 0===t?void 0:t.masking,h={maskAllInputs:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.maskAllInputs,maskTextSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.maskTextSelector,blockSelector:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.blockSelector,maskAllElementAttributes:null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.maskAllElementAttributes},c=null!==(r=null==h?void 0:h.maskAllInputs)&&void 0!==r?r:null==u?void 0:u.maskAllInputs,d=null!==(o=null==h?void 0:h.maskTextSelector)&&void 0!==o?o:null==u?void 0:u.maskTextSelector,v=null!==(l=null==h?void 0:h.blockSelector)&&void 0!==l?l:null==u?void 0:u.blockSelector,f=null!==(a=null==h?void 0:h.maskAllElementAttributes)&&void 0!==a?a:null==u?void 0:u.maskAllElementAttributes;return Te(c)&&Te(d)&&Te(v)&&Te(f)?void 0:{maskAllInputs:null==c||c,maskTextSelector:d,blockSelector:v,maskAllElementAttributes:f}}cn(){var t;if(this.xe)return;const e=null===(t=this.ne)||void 0===t?void 0:t.masking;if(Re(e))return;const i=this._instance.config.session_recording,n=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(t=>{const n=null==i?void 0:i[t],s=e[t];return!Te(n)&&n!==s});0!==n.length&&(this.xe=!0,du.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+n.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==i?void 0:i.maskAllInputs,maskTextSelector:null==i?void 0:i.maskTextSelector,blockSelector:null==i?void 0:i.blockSelector,maskAllElementAttributes:null==i?void 0:i.maskAllElementAttributes},project:e}))}get dn(){var t;return Ze(null===(t=this._instance.config.session_recording.canvasCapture)||void 0===t?void 0:t.resolutionScale,.1,1,Gs("canvas recording resolution scale"),1)}get hn(){var t,e,i,n,s,r,o;const l=this._instance.config.session_recording.captureCanvas,a=null===(t=this.ne)||void 0===t?void 0:t.canvasRecording,u=null!==(e=null!==(i=null==l?void 0:l.recordCanvas)&&void 0!==i?i:null==a?void 0:a.enabled)&&void 0!==e&&e,h=null!==(n=null!==(s=null==l?void 0:l.canvasFps)&&void 0!==s?s:null==a?void 0:a.fps)&&void 0!==n?n:4;let c=null!==(r=null!==(o=null==l?void 0:l.canvasQuality)&&void 0!==o?o:null==a?void 0:a.quality)&&void 0!==r?r:.4;if("string"==typeof c){const t=parseFloat(c);c=isNaN(t)?.4:t}return{enabled:u,fps:Ze(h,0,12,Gs("canvas recording fps"),4),quality:Ze(c,0,1,Gs("canvas recording quality"),.4)}}get fn(){var t;const e=!!(null===(t=this.ne)||void 0===t?void 0:t.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return null!=i?i:e}get vn(){var t,e,i;const n=null===(t=this.ne)||void 0===t?void 0:t.networkPayloadCapture,s={recordHeaders:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.recordBody},r=(null==s?void 0:s.recordHeaders)||(null==n?void 0:n.recordHeaders),o=(null==s?void 0:s.recordBody)||(null==n?void 0:n.recordBody),l=cu(this._instance.config.capture_performance),a=cu(null==n?void 0:n.capturePerformance),u=!!(Ae(l)?l:a);return r||o||u?{recordHeaders:r,recordBody:o,recordPerformance:u}:void 0}pn(){var t,e;const i=[],n=null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;n&&this.fn&&i.push(n());const r=null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordNetworkPlugin;if(this.vn&&xe(r))if(!rr.includes(s.hostname)||this._forceAllowLocalhostNetworkCapture){const t=xe(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(r(((t,e,i)=>{const n={payloadSizeLimitBytes:so.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...so.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...so.payloadHostDenyList]},s=!1!==t.session_recording.recordHeaders&&e.recordHeaders,r=!1!==t.session_recording.recordBody&&e.recordBody,o=!1!==t.capture_performance&&e.recordPerformance,l=(t=>{const e=no(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=ho(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=ho(t.responseBody,t.responseHeaders,e,"Response")),t)})(n),a=e=>{return l(((t,e,i)=>{var n;if(null==i?void 0:i(t.name))return;const s=lr(t.name);let r=0===e.indexOf("http")?null===(n=lr(e))||void 0===n?void 0:n.pathname:e;"/"===r&&(r="");const o=null==s?void 0:s.pathname.replace(r||"","");return s&&o&&uo.some(t=>0===o.indexOf(t))?void 0:t})((ao((n=e).requestHeaders),ao(n.responseHeaders),n),t.api_host,i));var n},u=xe(t.session_recording.maskNetworkRequestFn);return u&&xe(t.session_recording.maskCapturedNetworkRequestFn)&&Vs.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),u&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{const i=t.session_recording.maskNetworkRequestFn({url:e.name});return!i&&e.isInitial?i:ue(ue({},e),{},{name:null==i?void 0:i.url})}),n.maskRequestFn=xe(t.session_recording.maskCapturedNetworkRequestFn)?e=>{var i,n;const s=a(e);if(!s)return;const r=s.isInitial?{name:"",entryType:s.entryType,startTime:s.startTime,duration:s.duration,endTime:s.endTime,timeOrigin:s.timeOrigin,timestamp:s.timestamp,isInitial:!0}:void 0,o=null===(i=(n=t.session_recording).maskCapturedNetworkRequestFn)||void 0===i?void 0:i.call(n,s);return Re(o)&&r?(vo.add(r),r):null!=o?o:void 0}:t=>function(t){if(!Te(t))return t.requestBody=co(t.requestBody,"Request"),t.responseBody=co(t.responseBody,"Response"),t}(a(t)),ue(ue(ue({},so),n),{},{recordHeaders:s,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.vn,t)))}else du.info("NetworkCapture not started because we are on localhost.");return i}mn(t){return this._instance.config.disable_capture_url_hashes?un(t):t}gn(t,e=!1){const i=e?un(t):this.mn(t),n=this._instance.config.mask_personal_data_properties?[...Ca,...this._instance.config.custom_personal_data_properties||[]]:[];return this.yn(hr(i,n,Ta))}yn(t){const e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var i;const n=e.maskCapturedNetworkRequestFn({name:t});return null!==(i=null==n?void 0:n.name)&&void 0!==i?i:null==n?void 0:n.url}if(e.maskNetworkRequestFn){const i=e.maskNetworkRequestFn({url:t});return null==i?void 0:i.url}return t}bn(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.ce.length?this.ce.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):du.warn("could not emit queued rrweb event.",e,t),!1}}Vt(t,e){return this.bn(fu(()=>gu().addCustomEvent(t,e)))}wn(){var t;return this.ae&&!0===(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)&&!this.Y.urlBlocked&&!0!==this.de}kn(t){if(!this.wn())return!1;try{const e=gu();return!!e&&(e.addCustomEvent("$json_ld",t),this.wn())}catch(t){return!1}}_n(t=!1){Promise.resolve().then(()=>{var e;return null===(e=this.Sn)||void 0===e?void 0:e.scan(t)})}xn(){try{if(this._instance.config.capture_pageview||!t)return;const e=new URL(t.location.href),i=this.gn(e.origin+e.pathname+e.search);this.Cn!==i&&(this.Cn=i,this.Vt("$url_changed",{href:i}))}catch(t){}}Mn(){if(this.ce.length){const t=[...this.ce];this.ce=[],t.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this.bn(t)})}}jt(){return this.bn(fu(()=>gu().takeFullSnapshot()))}get In(){var t,e,i;if((null===(t=this.re)||void 0===t?void 0:t.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var n;const t=null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.trigger_pending_buffer_interval_millis;return Pe(t)&&Number.isFinite(t)&&t>=1e3&&36e5>=t?t:6e4}return null!==(e=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.full_snapshot_interval_millis)&&void 0!==e?e:3e5}Tn(){if(this.Rn&&clearInterval(this.Rn),!0===this.de)return;const t=this.In;t&&(this.Rn=setInterval(()=>{this.jt()},t))}Bt(t){"event"===t&&this.$n(),!this.Y.urlBlocked&&["sampled","active"].includes(this.status)&&this.Tn()}En(){var t;this.Y.urlBlocked||(this.Y.urlBlocked=!0,null===(t=this.Sn)||void 0===t||t.scan(),clearInterval(this.Rn),du.info("recording paused due to URL blocker"),this.Vt("recording paused",{reason:"url blocker"}))}An(){var t;this.Y.urlBlocked&&(null===(t=this.Sn)||void 0===t||t.scan(),this.Y.urlBlocked=!1,this.jt(),this._n(),this.Tn(),this.Vt("recording resumed",{reason:"left blocked url"}),du.info("recording resumed"))}On(t,e){var i;if("event"===t&&this.$n(),!this.ue&&(null===(i=this.re)||void 0===i?void 0:i.hasPendingTriggers(this.sessionId))){this.ue=!0;try{var n,s;const i="url"===t?W:V;null===(n=this._instance.persistence)||void 0===n||n.register({[i]:this.sessionId}),null===(s=this.re)||void 0===s||s.updateActiveTriggers(this.sessionId),this.Bt(),this.tn(),this.qt(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.ue=!1}}}get isStarted(){return!!this.se}get ne(){const t=this._instance.get_property(F);if(!t)return;let e;try{e=Ce(t)?t:JSON.parse(t)}catch(t){return void du.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.We){var i;const n=null!==(i=e.cache_timestamp)&&void 0!==i?i:Date.now();if(Date.now()-n>36e5)return void du.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t})}return e}Ln(t,e,i){this._instance.get_property(t)&&(e(),i())}start(e){var i,s;const r=this.ne;if(!r)return void du.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const t=!1!==this.de&&!this.be;this.Xe(t?"no_interaction_since_recording_started":void 0),this.be=!1,this.ge=t,this.ye=!1}this.Pe&&(this.Pn(),this.en());const{sessionId:o,windowId:l,sessionStartTimestamp:a}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=o,this.Be=l,this._sessionStartTimestamp=a,this.Dn(),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),(null==r?void 0:r.endpoint)&&(this.oe=null==r?void 0:r.endpoint),this.re=2===(null==r?void 0:r.version)&&(null==r?void 0:r.triggerGroups)&&r.triggerGroups.length>0?new xa(this._instance,this.Y,this.qt.bind(this),this.Vt.bind(this),this.Bt.bind(this)):new Sa(this._instance,this.Y,this.tt,this.et,this.qt.bind(this),this.jt.bind(this),this.Bt.bind(this)),this.re.onRemoteConfig(r),null===(s=this.Wt)||void 0===s||s.call(this),this.Wt=this.re.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(t,e)=>this.On(t,e)),this.Ln(N,()=>{this.overrideSampling()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(N)}),this.Ln(q,()=>{this.overrideLinkedFlag()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(q)}),this.Ln(j,()=>{this.overrideTrigger("event")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(j)}),this.Ln(B,()=>{this.overrideTrigger("url")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(B)}),this.re.makeSamplingDecisions(this.sessionId),this.Fn(),this.we||(nr(t,"beforeunload",this.Je),nr(t,"pagehide",this.nn),nr(t,"offline",this.rn),nr(t,"online",this.sn),nr(n,"visibilitychange",this.an),!this.Fe&&xe(this.Yt.onSessionId)&&(this.Fe=this.Yt.onSessionId(this.je)),!this.Ne&&xe(this.Yt.on)?this.Ne=this.Yt.on("forcedIdleReset",()=>{this.ze(),this.de="unknown",this.stop(),this.qe=this.Yt.onSessionId((t,e,i)=>{var n;null===(n=this.qe)||void 0===n||n.call(this),this.qe=void 0,this.je(t,e,i)})}):xe(this.Yt.on)||du.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Re(this.De)&&(this.De=this._instance.on("eventCaptured",t=>{try{if("$pageview"===t.event){const e=(null==t?void 0:t.properties.$current_url)?this.gn(t.properties.$current_url):"";if(!e)return;this.Vt("$pageview",{href:e})}}catch(t){du.error("Could not add $pageview to rrweb session",t)}})),"active"===this.status&&this.qt(e||"recording_initialized"))}Nn(){var e,i,s,r,o,l;null==t||t.removeEventListener("beforeunload",this.Je),null==t||t.removeEventListener("pagehide",this.nn),null==t||t.removeEventListener("offline",this.rn),null==t||t.removeEventListener("online",this.sn),null==n||n.removeEventListener("visibilitychange",this.an),clearInterval(this.Rn),this.qn(),null===(e=this.De)||void 0===e||e.call(this),this.De=void 0,null===(i=this.Wt)||void 0===i||i.call(this),this.Wt=void 0,null===(s=this.Fe)||void 0===s||s.call(this),this.Fe=void 0,null===(r=this.Ne)||void 0===r||r.call(this),this.Ne=void 0,null===(o=this.qe)||void 0===o||o.call(this),this.qe=void 0,null===(l=this.re)||void 0===l||l.stop(),this.jn(),this.Pn()}Pn(){this.Le+=1,this.Ae=[],this.Oe=0,this.Bn=void 0,this.Pe=!1}jn(){var t,e;null===(t=this.Hn)||void 0===t||t.stop(),this.ce=[],null===(e=this.Sn)||void 0===e||e.stop(),this.Sn=void 0,this.ae=!1;try{var i;null===(i=this.se)||void 0===i||i.call(this)}catch(t){du.warn("could not stop rrweb",t)}this.se=void 0}zn(){if(!this.Bn||0===this.Oe)return!1;if(this.Pe)return!0;this.Pe=!0,this.Un=void 0;const t=this.Le;return this.qn(),this.jn(),this.Bn.catch(()=>{}).then(()=>{t===this.Le&&(this.Pe=!1,this.tn(),this.en(),this.Wn(),this.Nn(),du.info("stopped"))}).catch(()=>{this.Pe=!1,this.Wn(),this.Nn(),du.info("stopped")}),!0}stop(){if(this.jn(),this.We)this.Ye();else if(this.zn())return;this.tn(),this.en(),this.Wn(),this.Nn(),du.info("stopped")}Wn(){this.Xe(void 0,{preserveLogDedup:this.We}),this.ge=!1}flushBeforeIdentityReset(){(this.isStarted||this.Pe)&&(this.Ye(),this.tn())}Ue(t){this.We=!0,this.le=Date.now();try{var e,i;this.stop(),this.Vn=void 0,this.Zn=void 0,this.fe=0,this.ve=0,this.pe=0,null===(e=pu())||void 0===e||null===(i=e.resetSnapshotCostState)||void 0===i||i.call(e),this.start("session_id_changed")}finally{this.We=!1}this.Xe(t?"no_interaction_since_session_rotated":void 0),this.ge=!1}Xe(t,{preserveLogDedup:e=!1}={}){if(this.me=!Te(t),this.Un=t,Te(t))return void(e||(this.Gn=void 0));if(this.We)return;const i=`${this.sessionId}:${t}`;i!==this.Gn&&(this.Gn=i,du.info(`holding buffer: ${t}. nothing is uploaded until the user interacts with the page`))}$n(){this.isStarted||(this.be=!0),this.me&&(this.Xe(void 0),this.ge=!1,this.ye&&(this.ye=!1,this.jt()),this.Qn())}discard({discardProducerEvents:t=!1}={}){this.me=!0,t&&(this.en(),this.jn()),this.en(),this.Nn(),this.en(),this.Wn(),du.info("discarded")}Jn(t,e,i,n,s){const r={$snapshot_bytes:i,$snapshot_data:e,$session_id:n,$window_id:s};"disabled"!==this.status?(this.Kn(t,n),this.Xn(r)):this.en()}Yn(){try{this.ti()}catch(t){this.Se||(this.Se=!0,du.error("could not track full snapshot cost",t))}}ti(){var t,e;const i=null===(t=pu())||void 0===t||null===(e=t.getLastSnapshotCost)||void 0===e?void 0:e.call(t);i&&i!==this.Zn&&(this.Zn=i,this.Vn&&this.Vn.durationMs>=i.durationMs||(this.Vn=i),500>i.durationMs||du.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}))}Kn(t,e){2!==t.type?3===t.type&&(Te(this.Re)||this.Re===e||this.$e===e||(this.$e=e,du.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.jt())):this.Re=e}ei(t){t.counted&&t.generation===this.Le&&(this.Oe=Math.max(0,this.Oe-1)),t.counted=!1,this.Ae=this.Ae.filter(e=>e!==t)}ni(t,e,i){t.processed||t.generation!==this.Le||(t.processed=!0,this.Jn(t.event,e,i,t.targetSessionId,t.targetWindowId))}ii(t){try{let e=t.event,i=qo(t.event);if(t.compressionEnabled)try{({event:e,size:i}=Pu(t.event))}catch(t){du.error("could not process queued compression event - will use uncompressed event",t)}try{this.ni(t,e,i)}catch(t){du.error("could not capture queued compression event",t)}}finally{this.ei(t)}}Ye(){[...this.Ae].forEach(t=>{this.ii(t)})}ri(t,e,i,n){var s=this;const r={event:t,compressionEnabled:e,targetSessionId:i,targetWindowId:n,generation:this.Le,processed:!1,counted:!0};this.Ae.push(r),this.Oe+=1;const o=(l=re(function*(){try{if(r.processed)return;let i,n;try{const s=e?Eu(t)?yield function(t){return Ou.apply(this,arguments)}(t):Pu(t):{event:t,size:qo(t)};i=s.event,n=s.size}catch(e){du.error("could not process queued compression event - will use uncompressed event",e),i=t,n=qo(t)}s.ni(r,i,n)}finally{s.ei(r)}}),function(){return l.apply(this,arguments)});var l;this.Bn=this.Bn?this.Bn.catch(()=>{}).then(o):o()}onRRwebEmit(e){var i,n,s,r,o,l,a,u,h,c,d,v,f;if(!this._instance.sessionManager)return;if(this.Mn(),!e||!Ce(e))return;if(4===e.type){const t=this.gn(e.data.href);if(this.Cn=t,!t)return;e.data.href=t}else this.xn();if(null===(i=this.re)||void 0===i||i.checkUrlTriggers(this.sessionId,()=>this.En(),()=>this.An(),(t,e)=>this.On(t,e)),this.Y.urlBlocked&&!function(t){return 5===t.type&&"recording paused"===t.data.tag}(e))return;2===e.type&&((null===(c=pu())||void 0===c||null===(d=c.wasMaxDepthReached)||void 0===d?void 0:d.call(c))&&(this._e=!0),this.Yn(),Promise.resolve().then(()=>this.Yn()),this.Tn(),null===(v=this.Hn)||void 0===v||v.reset(),null===(f=this._instance.persistence)||void 0===f||f.register_once({$debug_first_full_snapshot_timestamp:e.timestamp},void 0));const p=2===e.type&&(null===(n=this.re)||void 0===n?void 0:n.hasPendingTriggers(this.sessionId));p&&this.oi();const g=this.Hn?this.Hn.throttleMutations(e):e;if(!g)return void(!0===this.de&&this.he++);const m=function(t){const e=t;if(e&&Ce(e)&&6===e.type&&Ce(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));const i=[];for(let t=0;e.data.payload.payload.length>t;t++)i.push(e.data.payload.payload[t]&&e.data.payload.payload[t].length>2e3?e.data.payload.payload[t].slice(0,2e3)+"...[truncated]":e.data.payload.payload[t]);return e.data.payload.payload=i,t}return t}(g),y=function(t){return Du(t)?t.data.payload:null}(m),_=function(t){return Lu(t)?t.data.payload:null}(m),b=function(t){return Fu(t)?t.data.payload:null}(m);y||_?(null==y?void 0:y.lastActivityTimestamp)&&(m.timestamp=y.lastActivityTimestamp):(null==b?void 0:b.sessionId)||this.si(m),2===e.type&&(this.Te.push([this.Xt,e.timestamp]),this.Te.length>6&&(this.Te=this.Te.slice(-6)));const w=null!==(s=null!==(r=null!==(o=null==y?void 0:y.currentSessionId)&&void 0!==o?o:null==_?void 0:_.nextSessionId)&&void 0!==r?r:null==b?void 0:b.sessionId)&&void 0!==s?s:this.Xt,k=null!==(l=null!==(a=null!==(u=null==y?void 0:y.currentWindowId)&&void 0!==u?u:null==_?void 0:_.nextWindowId)&&void 0!==a?a:null==b?void 0:b.windowId)&&void 0!==l?l:this.Be;if(!0===this.de&&!function(t){return Fu(t)||Du(t)||Lu(t)}(m))return void(function(t){return 2===t.type||4===t.type||3===t.type&&9!==t.data.source}(m)&&this.he++);2===m.type&&(this.he=0),b&&(m.timestamp=b.lastActivityTimestamp+b.threshold);const S=this.ae;this.ae=!0,p?this._n(!0):S||this._n();const x=null===(h=this._instance.config.session_recording.compress_events)||void 0===h||h;if(5===m.type&&"$json_ld"===m.data.tag){let e;try{e=t?this.gn(t.location.href):void 0}catch(t){}m.data.href=e}if(this.Oe>0||x&&Eu(m))return void this.ri(m,x,w,k);const{event:C,size:T}=x?Pu(m):{event:m,size:qo(m)};this.Jn(m,C,T,w,k)}get status(){return this.re?this.re.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.ee,rrwebError:this.we,urlTriggerMatching:this.Y,eventTriggerMatching:this.tt,linkedFlagMatching:this.et,remoteConfig:this.ne}):fo}log(t,e="log"){var i;null===(i=this._instance.sessionRecording)||void 0===i||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.et.linkedFlagSeen=!0,this.jt(),this.$n(),this.qt("linked_flag_overridden")}overrideSampling(){var t;null===(t=this._instance.persistence)||void 0===t||t.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this.jt(),this.$n(),this.qt("sampling_overridden")}overrideTrigger(t){this.On(t),this.$n()}ai(){try{var e;const i=null==t||null===(e=t.location)||void 0===e?void 0:e.href;if(!i)return;const n=this.gn(i);if(!n)return;return new URL(n).hostname||void 0}catch(t){return}}qn(){this.li&&(clearTimeout(this.li),this.li=void 0)}Qn(){this.li||(this.li=setTimeout(()=>{this.tn()},2e3))}ui(){return this.Re!==this.Rt.sessionId&&0!==this.Rt.data.length&&this.Rt.data.every(t=>5===(null==t?void 0:t.type)&&!Du(t)&&!Lu(t))}ci(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}di(t){if("buffering"!==t)return Te(this.hi)||this._instance.register_for_session({[jt]:[]}),void(this.hi=void 0);const e=this.ci();if(0===e.length)return Te(this.hi)||this._instance.register_for_session({[jt]:[]}),void(this.hi=void 0);const i=e.join(", "),n=`${this.sessionId}:${i}`;n!==this.hi&&(this.hi=n,this._instance.register_for_session({[jt]:e}),du.info(`buffering: ${i}`))}fi(){var t;return"memory"!==this._instance.config.persistence&&!0!==(null===(t=this._instance.persistence)||void 0===t?void 0:t.pi)&&Kl.Et()}mi(){0!==this.Rt.data.length&&this.Rt.size!==this.gi&&943718.4>=this.Rt.size&&this.fi()&&(this.gi=this.Rt.size,Kl.At(this.ln,this.Rt))}Dn(){if(this.Ee||!this.fi())return;this.Ee=!0;const t=Kl.Dt(this.ln);Kl.Lt(this.ln),Ce(t)&&Se(t.data)&&0!==t.data.length&&Se(t.sizes)&&t.sizes.length===t.data.length&&Pe(t.size)&&t.sessionId===this.Xt&&t.windowId===this.Be&&(this.Rt.data.length>0||(this.Rt=t))}tn(t=!1){var e;if(this.qn(),this.me)return this.Rt;if(this.ui())return this.Rt.size>943718.4?this.en():(t&&this.mi(),this.Rt);const i=this.Rt;null===(e=this.re)||void 0===e||e.ensureSamplingDecision(this.sessionId);const n=this.Ge(),s=this.status;if(this.di(s),"buffering"===s||"paused"===s||"disabled"===s||n)return!t||"active"!==s&&"sampled"!==s||this.mi(),this.Qn(),this.Rt;if(this.Rt!==i)return this.Rt;if(i.data.length>0){var r;const t=this.ai();jo(i).forEach(e=>{try{var i;null===(i=this.He)||void 0===i||i.trackSize(e.sessionId,e.size),this.yi({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:Yl.LIB_NAME,$lib_version:Yl.LIB_VERSION,$snapshot_host:t})}catch(t){du.warn("could not capture snapshot chunk - skipping it",t)}}),Te(this.gi)||(Kl.Lt(this.ln),this.gi=void 0),null===(r=this.re)||void 0===r||r.onFlushComplete()}return this.en()}Xn(t){var e;const i=2+((null===(e=this.Rt)||void 0===e?void 0:e.data.length)||0),n=t.$session_id,s=this.Rt.sessionId!==n;if(s||!0!==this.de&&!this.me&&this.Rt.size+t.$snapshot_bytes+i>943718.4){const e=this.Xt;if(this.Rt=this.tn(),this.Xt!==e)return;s&&this.Rt.data.length>0&&(this.Rt=this.en()),this.Rt.sessionId=n,this.Rt.windowId=t.$window_id}this.me&&(this.ye||this.Rt.size+t.$snapshot_bytes+i>943718.4)?this.ye||(this.ye=!0,this.Rt=this.en()):(this.Rt.size+=t.$snapshot_bytes,this.Rt.data.push(t.$snapshot_data),this.Rt.sizes.push(t.$snapshot_bytes),!0===this.de||this.me||this.Qn())}yi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.oe),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get Qe(){var t,e;const i=null===(t=this.Rt)||void 0===t?void 0:t.data[(null===(e=this.Rt)||void 0===e?void 0:e.data.length)-1];return i?i.timestamp-this._sessionStartTimestamp:null}oi(){if(!this.Rt||0===this.Rt.data.length)return this.en();let t=-1;for(let e=this.Rt.data.length-1;e>=0;e--)if(4===this.Rt.data[e].type){t=e;break}return 0>t?this.en():(this.Rt.data=this.Rt.data.slice(t),this.Rt.sizes=this.Rt.sizes.slice(t),this.Rt.size=this.Rt.sizes.reduce((t,e)=>t+e,0),this.Rt)}en(){return this.Rt={size:0,data:[],sizes:[],sessionId:this.Xt,windowId:this.Be},this.Rt}qt(t,e){this._instance.register_for_session({[Gt]:t}),du.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Vt("$recording_started",ue({reason:t},e))}bi(t){var e;return 3===t.type&&-1!==vu.indexOf(null===(e=t.data)||void 0===e?void 0:e.source)}si(t){const e=this.bi(t);e||!0===this.de||t.timestamp-this.le>this.te&&(this.de=!0,clearInterval(this.Rn),this.Vt("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.le,threshold:this.te,bufferLength:this.Rt.data.length,bufferSize:this.Rt.size,sessionId:this.Xt,windowId:this.Be}),this.tn());const{windowId:i,sessionId:n}=this.Yt.checkAndGetSessionAndWindowId(!e,t.timestamp);let s=!1;if(e&&(this.le=t.timestamp,this.de)){const e="unknown"===this.de;this.de=!1,e||(this.Vt("sessionNoLongerIdle",{reason:"user activity",type:t.type}),s=!0)}const r=this.Xt!==n,o=this.Be!==i;if(this.Be=i,this.Xt=n,r||o){const t=r&&!1!==this.de;t&&(this.de="unknown"),this.Ue(t)}else if(e&&this.$n(),s){var l;const t=["sampled","active"].includes(this.status)||(null===(l=this.re)||void 0===l?void 0:l.hasPendingTriggers(this.sessionId));this.he>0&&t&&this.jt(),this._n(),this.Tn()}}ze(){var t;null===(t=this.re)||void 0===t||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e,i,n,s,r,o,l,a,u,h,c;const d=null===(t=pu())||void 0===t||null===(e=t.getDeferredStylesheetStats)||void 0===e?void 0:e.call(t);return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this.Un,$sdk_debug_replay_internal_buffer_length:this.Rt.data.length,$sdk_debug_replay_internal_buffer_size:this.Rt.size,$sdk_debug_current_session_duration:this.Qe,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(i=this.He)||void 0===i?void 0:i.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Te,$snapshot_max_depth_exceeded:this._e,$sdk_debug_replay_slowest_full_snapshot_ms:hu(null===(n=this.Vn)||void 0===n?void 0:n.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:hu(null===(s=this.Vn)||void 0===s?void 0:s.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null===(r=this.Vn)||void 0===r?void 0:r.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null===(o=this.Vn)||void 0===o?void 0:o.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null===(l=this.Vn)||void 0===l?void 0:l.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==d?void 0:d.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==d?void 0:d.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==d?void 0:d.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:hu(null==d?void 0:d.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:hu(null==d?void 0:d.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:hu(null===(a=pu())||void 0===a||null===(u=a.getMutationCost)||void 0===u||null===(u=u.call(a))||void 0===u?void 0:u.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null===(h=pu())||void 0===h||null===(c=h.getDiscardedDurationSamples)||void 0===c?void 0:c.call(h),$sdk_debug_replay_throttled_mutations_dropped:this.fe,$sdk_debug_replay_oversized_mutations_dropped:this.ve,$sdk_debug_replay_oversized_mutation_bytes_dropped:this.pe,$sdk_debug_replay_rrweb_error:this.we,[Wt]:!!this.se,[Vt]:this.ke}}Fn(){var e;if(this.se)return;this.ke=!0;const i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},s=this._instance.config.session_recording;for(const[t,e]of Object.entries(s||{}))if(t in i)if("maskInputOptions"===t)i.maskInputOptions=ue({password:!0},e);else if("sampling"===t){const t=null!=e?e:{},n={};Te(t.mousemove)||(n.mousemove=t.mousemove),Te(t.mouseInteraction)||(n.mouseInteraction=t.mouseInteraction),i.sampling=n}else i[t]=e;var r,o,l,a;!0===(null==s?void 0:s.captureJsonLd)&&!0!==i.slimDOMOptions&&"all"!==i.slimDOMOptions&&(i.slimDOMOptions=ue(ue({},i.slimDOMOptions),{},{script:!0})),this.hn&&this.hn.enabled&&(i.recordCanvas=!0,i.sampling=ue(ue({},i.sampling),{},{canvas:this.hn.fps}),i.dataURLOptions={type:"image/webp",quality:this.hn.quality},i.canvasResolutionScale=this.dn,i.canvasMasking={configured:()=>{var t;return xe(null===(t=this._instance.config.session_recording)||void 0===t||null===(t=t.canvasCapture)||void 0===t?void 0:t.maskRegionsFn)},regionsFn:t=>{var e;const i=null===(e=this._instance.config.session_recording)||void 0===e||null===(e=e.canvasCapture)||void 0===e?void 0:e.maskRegionsFn;if(xe(i))try{var n;return null!==(n=i(t))&&void 0!==n?n:null}catch(t){return this.Me||(this.Me=!0,du.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.un&&(i.maskAllInputs=null===(r=this.un.maskAllInputs)||void 0===r||r,i.maskTextSelector=null!==(o=this.un.maskTextSelector)&&void 0!==o?o:void 0,i.blockSelector=null!==(l=this.un.blockSelector)&&void 0!==l?l:void 0,i.maskAllElementAttributes=null!==(a=this.un.maskAllElementAttributes)&&void 0!==a&&a),i.maskAllElementAttributes&&i.maskAttributeFn&&(i.maskAttributeFn=void 0,this.Ce||(this.Ce=!0,du.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.cn();const u=gu();if(!u)return void du.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this.Hn=null!==(e=this.Hn)&&void 0!==e?e:new Sl(u,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,e)=>{const i=`Too many mutations on node '${t}'. Rate limiting. This could be due to SVG animations or something similar`;du.info(i,{node:e}),this.log("[SessionRecording] "+i,"warn")},onDroppedAttributeMutations:t=>this.fe+=t,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this.In,onDroppedOversizedMutation:t=>{0===this.ve&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this.ve+=1,this.pe+=t},requestFullSnapshot:()=>this.jt()});const h=this.pn();if(this.se=u(ue({emit:t=>{this.onRRwebEmit(t)},plugins:h,errorHandler:(t,e)=>"rrweb"===e&&(this.Ie||(this.Ie=!0,du.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},i)),!this.se)return this.we=!0,void du.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.we=!1,!0===(null==s?void 0:s.captureJsonLd)&&n&&(null==t?void 0:t.MutationObserver)&&!this.Sn&&(this.Sn=function(t,e,i){const n=new WeakMap,s=i.getCaptureState||(()=>!0);let r=Ba;const o=function(t,e){const i=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?Ua:i=>{const n=t.getElementById(i);return!!n&&"SCRIPT"!==n.nodeName&&(!e.isRecordedElement||e.isRecordedElement(n))&&!au(n,e.blockClass,e.blockSelector)}}(t,i),l=e=>{try{const l=s();if(!r||!1===l||!e.isConnected||e.ownerDocument!==t||function(t,e){return au(t,e.blockClass,e.blockSelector)||au(t,e.maskTextClass,e.maskTextSelector)}(e,i))return;const a=function(t,e=Ua,i){if(!t||t.length>Ba)return null;try{const n=JSON.parse(t),s={maskUrl:i,remainingNodes:2048,exceeded:!1},r=Se(n)?n.map(t=>ru(t,e,s)):ru(n,e,s);if(s.exceeded||Me(r)||Se(r)&&(!r.length||r.some(Me)))return null;const o=JSON.stringify(r);return o.length>2e4?null:[r,o]}catch(t){return null}}(e.text,o,i.maskUrl);if(!a)return void n.delete(e);const[u,h]=a;if(Me(l))return void n.set(e,h);if(n.get(e)!==h){if(h.length>r)return void(r=0);i.emit(u)&&(n.set(e,h),r-=h.length)}}catch(t){return}};try{const i=new e(t=>{try{if(!r||!1===s())return;const e=t=>{for(const e of uu(t))l(e)};for(const i of t)if("childList"===i.type)ou(i.target)&&l(i.target),i.addedNodes.forEach(e);else if("characterData"===i.type){const t=i.target.parentNode;t&&ou(t)&&l(t)}else"attributes"===i.type&&ou(i.target)&&l(i.target)}catch(t){return}});return i.observe(t,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(e=!1){r&&!1!==s()&&uu(t.documentElement).forEach(t=>{e&&n.delete(t),l(t)})},stop(){return i.disconnect()}}}catch(t){return{scan(){},stop(){}}}}(n,t.MutationObserver,{maskUrl:t=>this.gn(t),attributeFilter:i.attributeFilter,blockClass:i.blockClass,blockSelector:i.blockSelector,isRecordedElement:t=>u.mirror.getId(t)>0,maskAllElementAttributes:i.maskAllElementAttributes,maskAttributeFn:i.maskAttributeFn,maskTextClass:i.maskTextClass,maskTextSelector:i.maskTextSelector,getCaptureState:()=>{var t;return!0!==(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)||this.Y.urlBlocked||this.Y.isCurrentUrlBlocked()?null:this.wn()},emit:t=>this.kn(t)}),this.Y.isCurrentUrlBlocked()&&this.Sn.scan()),this.le=Date.now(),this.de=Ae(this.de)?this.de:"unknown",this.tryAddCustomEvent("$remote_config_received",this.ne),this.Vt("$session_options",{sessionRecordingOptions:i,activePlugins:h.map(t=>null==t?void 0:t.name)}),this.Vt("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(t,e){return this.Vt(t,e)}};const qu=["type"];var Bu=function(t){return t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t}({}),ju=function(t){return t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t}({}),Hu=function(t){return t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t}({}),Uu=function(t){return t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t}({}),zu=function(t){return t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t}({}),Wu=function(t){return t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t}({}),Vu=function(t){return t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t}({});function Gu(t,e){return-1!==t.indexOf(e)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var Zu={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Qu={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Ju={};function Ku(t){if(Ju[t])return Ju[t];const e=function(t){var e,i;const n=null===(e=globalThis)||void 0===e||null===(e=e.Zone)||void 0===e||null===(i=e.__symbol__)||void 0===i?void 0:i.call(e,t);return n&&globalThis[n]?globalThis[n]:void 0}(t)||globalThis[t],i=e.prototype,n=t in Zu?Zu[t]:void 0,s=Boolean(n&&n.every(t=>{var e;return Boolean(null===(e=Object.getOwnPropertyDescriptor(i,t))||void 0===e||null===(e=e.get)||void 0===e?void 0:e.toString().includes("[native code]"))})),r=t in Qu?Qu[t]:void 0,o=Boolean(r&&r.every(t=>{var e;return"function"==typeof i[t]&&(null===(e=i[t])||void 0===e?void 0:e.toString().includes("[native code]"))}));if(s&&o)return Ju[t]=e.prototype,e.prototype;const l=document.createElement("iframe");l.style.display="none";let a=!1;try{document.body.appendChild(l);const n=l.contentWindow;if(!n)return e.prototype;const s=n[t].prototype;return s?(function(t){return Gu(t,"AppleWebKit")&&!Gu(t,"Chrome")}(navigator.userAgent)&&(l.classList.add("rr-block","ph-no-capture"),l.setAttribute("__rrwebUntaintedPrototype",t),a=!0),Ju[t]=s):i}catch(t){return i}finally{!a&&l.parentNode&&document.body.removeChild(l)}}var Yu=Object.create(null);function Xu(t,e,i){var n;const s=Yu[t],r=s[i];if(r)return r.call(e);const o=Ku(t),l=null===(n=Object.getOwnPropertyDescriptor(o,i))||void 0===n?void 0:n.get;return l?(s[i]=l,l.call(e)):e[i]}Yu.Node=Object.create(null),Yu.ShadowRoot=Object.create(null),Yu.MutationObserver=Object.create(null),Yu.Element=Object.create(null);var th,eh={};function ih(t,e,i){const n=`${t}.${String(i)}`;if(eh[n])return eh[n].bind(e);const s=Ku(t)[i];return"function"!=typeof s?e[i]:(eh[n]=s,s.bind(e))}function nh(){return Ku("MutationObserver").constructor}function sh(t,e,i){try{if(!(e in t))return()=>{};const n=t[e],s={next:n},r=i(function(...t){return s.next.apply(this,t)});return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:n},__rrweb_layer__:{enumerable:!1,value:s}})),t[e]=r,()=>{if(t[e]===r)return void(t[e]=s.next);const i=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let n=t[e],o=i(n);for(;o;){if(o.next===r)return void(o.next=s.next);n=o.next,o=i(n)}}}catch(t){return()=>{}}}var rh={childNodes:t=>Xu("Node",t,"childNodes"),parentNode:t=>Xu("Node",t,"parentNode"),parentElement:t=>Xu("Node",t,"parentElement"),textContent:t=>Xu("Node",t,"textContent"),isConnected(t){if(void 0===th){var e;const t=null===(e=Object.getOwnPropertyDescriptor(Ku("Node"),"isConnected"))||void 0===e?void 0:e.get;th=(null==t?void 0:t.toString().includes("[native code]"))?t:null}return null==th?void 0:th.call(t)},contains:(t,e)=>ih("Node",t,"contains")(e),getRootNode:t=>ih("Node",t,"getRootNode")(),host:t=>t&&"host"in t?Xu("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?Xu("Element",t,"shadowRoot"):null,querySelector:(t,e)=>ih("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>ih("Element",t,"querySelectorAll")(e),mutationObserver:nh,patch:sh};function oh(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var lh=0;function ah(){lh+=1}function uh(){return lh}function hh(t,e){return(e!==lh||t>6e4)&&!0}var ch=0,dh=0,vh=0,fh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},ph=null,gh=null,mh=[],yh=0,_h=0,bh={slowestBatchMs:0},wh={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function kh(t){(ch+=1)>1||(fh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},mh=[],yh=0,gh=(t=>t&&t>0?t:null)(t),dh=oh(),vh=lh)}function Sh(){return 0===ch?ph||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(ch-=1)>0?fh:(fh.durationMs=oh()-dh,fh.deferredStylesheetCount=yh,wh.deferredCount+=yh,gh=null,hh(fh.durationMs,vh)?fh:ph=fh)}function xh(t,e,i){let n=t.length;if(i>=32)return n;for(let s=0;t.length>s;s++){const r=t[s];try{const t=r.cssRules;if(t&&t.length)n+=xh(t,e,i+1);else if(e&&r.styleSheet){const t=r.styleSheet;if(!e.has(t)){e.add(t);const s=t.rules||t.cssRules;s&&(n+=xh(s,e,i+1))}}}catch(t){}}return n}function Ch(t){if(0===ch)return;const e=xh(t,null,0);fh.cssRuleCount+=e,_h>0&&(fh.nonDeferrableCssRuleCount+=e)}function $h(t){_h+=1;try{return t()}finally{_h-=1}}function Th(t){ch>0&&(fh.stylesheetMs+=t)}function Eh(t){if(0===ch||null===gh)return!1;const e=fh.cssRuleCount-fh.nonDeferrableCssRuleCount;return e>=gh||e+function(t){try{const e=t&&(t.rules||t.cssRules);if(!e)return 0;const i=new WeakSet;return i.add(t),xh(e,i,0)}catch(t){return 0}}(t)>gh}function Ih(){const t=mh;return mh=[],t}function Mh(){wh.failedCount+=1}function Rh(t){t>0&&(wh.abandonedCount+=t)}function Ph(t){return Ph="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ph(t)}function Oh(t,e,i){return(e=function(t){var e=function(t){if("object"!=Ph(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Ph(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ph(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ah(t){return t.nodeType===t.ELEMENT_NODE}function Fh(t){const e=t&&"host"in t&&"mode"in t&&rh.host(t)||null;return Boolean(e&&"shadowRoot"in e&&rh.shadowRoot(e)===t)}function Dh(t){return"[object ShadowRoot]"==={}.toString.call(t)}function Lh(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}function Nh(t){const{cssText:e}=t;if(3>e.split('"').length)return e;const i=["@import",`url(${JSON.stringify(t.href)})`];return""===t.layerName?i.push("layer"):t.layerName&&i.push(`layer(${t.layerName})`),t.supportsText&&i.push(`supports(${t.supportsText})`),t.media.length&&i.push(t.media.mediaText),i.join(" ")+";"}var qh=0;function Bh(t){const e=0===qh,i=e?oh():0;qh+=1;try{const e=t.rules||t.cssRules;if(!e)return null;Ch(e);let i=t.href;return!i&&t.ownerNode&&(i=t.ownerNode.baseURI),Lh(Array.from(e,t=>jh(t,i)).join(""))}catch(t){return null}finally{qh-=1,e&&Th(oh()-i)}}function jh(t,e){if(Uh(t)){let e;try{e=Bh(t.styleSheet)||Nh(t)}catch(i){e=t.cssText}try{var i;if(e&&(null===(i=t.styleSheet)||void 0===i?void 0:i.href))return rc(e,t.styleSheet.href)}catch(t){}return e}{let i=t.cssText;return zh(t)&&t.selectorText.includes(":")&&(i=Hh(i)),e?rc(i,e):i}}function Hh(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function Uh(t){return"styleSheet"in t}function zh(t){return"selectorText"in t}var Wh=/^-?[A-Za-z_][\w-]*$/,Vh=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Gh(t){const e=[];let i=!1,n=null;const s=new Map;function r(t){const s=e.pop();if("group"===s.kind){if(null===t){for(;e.length>0&&"group"===e[e.length-1].kind;)e.pop();return void r(null)}const i=e[e.length-1];return i.parts.push(t),void(i.index+=1)}if(!s.importRule)return i=!0,void(n=t);o(e[e.length-1],s.importRule,t)}function o(t,e,i){try{let s;try{s=i||Nh(e)}catch(t){s=e.cssText}try{var n;s&&(null===(n=e.styleSheet)||void 0===n?void 0:n.href)&&(s=rc(s,e.styleSheet.href))}catch(t){}s&&t.parts.push(s),t.index+=1}catch(t){r(null)}}function l(t){const i=t.rules[t.index];if("sheet"===t.kind&&Uh(i)){const n=s.get(i);return null===n?(t.parts.push(i.cssText),void(t.index+=1)):n?void e.push({kind:"sheet",sheet:n.sheet,rules:n.rules,sheetHref:n.sheetHref,index:0,parts:[],importRule:i}):void o(t,i,null)}if(function(t,i){try{const n=function(t){const e=t;if(!e.cssRules||0===e.cssRules.length)return null;if(e.media&&"string"==typeof e.media.mediaText)return`@media ${e.media.mediaText} {`;if(zh(t)){if("number"==typeof e.type&&1!==e.type)return null;const i=e.style?e.style.cssText:"";return`${t.selectorText} {${i?" "+i:""}`}if("containerName"in e)return"string"!=typeof e.containerQuery||e.containerName&&!Wh.test(e.containerName)?null:`@container ${e.containerName?`${e.containerName} `:""}${e.containerQuery} {`;if("string"==typeof e.conditionText){let n="";try{var i;n=(null===(i=t.constructor)||void 0===i?void 0:i.name)||""}catch(t){return null}return""===n||"Object"===n||"CSSSupportsRule"===n?`@supports ${e.conditionText} {`:null}return"string"==typeof e.name?"keyText"in e.cssRules[0]?Wh.test(e.name)?`@keyframes ${e.name} {`:null:""===e.name?"@layer {":Vh.test(e.name)?`@layer ${e.name} {`:null:null}(t);if(null===n)return!1;const s=i.sheetHref;return e.push({kind:"group",rules:Array.from(t.cssRules),sheetHref:s,index:0,parts:[],prelude:s?rc(n,s):n,fixColons:"sheet"===i.kind&&zh(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(i,t))return;let n=i.cssText;"sheet"===t.kind&&zh(i)&&i.selectorText.includes(":")&&(n=Hh(n)),t.parts.push(t.sheetHref?rc(n,t.sheetHref):n),t.index+=1}return function(t){try{const i=t.rules||t.cssRules;if(!i)return!1;Ch(i);let n=t.href;!n&&t.ownerNode&&(n=t.ownerNode.baseURI);const r=Array.from(i);return e.push({kind:"sheet",sheet:t,rules:r,sheetHref:n,index:0,parts:[],importRule:null}),function(t,e){const i=[{sheet:e,rules:t,index:0}];for(;i.length>0;){const t=i[i.length-1];if(t.index>=t.rules.length){i.pop();continue}const e=t.rules[t.index];if(t.index+=1,!Uh(e)||s.has(e))continue;let n=null;try{n=e.styleSheet}catch(t){s.set(e,null);continue}if(n&&!i.some(t=>t.sheet===n))try{const t=n.rules||n.cssRules;if(!t)continue;Ch(t);let r=n.href;!r&&n.ownerNode&&(r=n.ownerNode.baseURI);const o=Array.from(t);s.set(e,{sheet:n,rules:o,sheetHref:r}),i.push({sheet:n,rules:o,index:0})}catch(t){}}}(r,t),!0}catch(t){return!1}}(t)||(i=!0),{advance(t){if(i)return!0;const s=oh();let o=t>0?t:1;try{for(;!i&&o>0;){const t=e[e.length-1];if(t.index>=t.rules.length){let e=null;try{if("group"===t.kind){const i=t.prelude+t.parts.join("")+"}";e=t.fixColons?Hh(i):i}else e=Lh(t.parts.join(""))}catch(t){}r(e);continue}o-=1;try{l(t)}catch(t){r(null)}}}catch(t){i=!0,n=null}finally{Th(oh()-s)}return i},text:()=>i?n:null,remainingRules(){if(i)return 0;let t=0;for(const i of e)t+=i.rules.length-i.index;return t}}}var Zh=class{constructor(){Oh(this,"idNodeMap",new Map),Oh(this,"nodeMetaMap",new WeakMap)}getId(t){var e,i;return t&&null!==(e=null===(i=this.getMeta(t))||void 0===i?void 0:i.id)&&void 0!==e?e:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const e=this.getId(t);if(this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach(t=>this.removeNodeFromMap(t)),Ah(t)){const e=rh.shadowRoot(t);e&&this.removeNodeFromMap(e),"IFRAME"===t.nodeName&&t.contentDocument&&this.removeNodeFromMap(t.contentDocument)}}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){this.idNodeMap.set(e.id,t),this.nodeMetaMap.set(t,e)}replace(t,e){const i=this.getNode(t);if(i){const t=this.nodeMetaMap.get(i);t&&this.nodeMetaMap.set(e,t)}this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Qh({element:t,maskInputOptions:e,tagName:i,type:n,value:s,maskInputFn:r}){let o=s||"";const l=n&&Jh(n);return(e[i.toLowerCase()]||l&&e[l])&&(o=r?r(o,t):"*".repeat(o.length)),o}function Jh(t){return t.toLowerCase()}var Kh=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 Yh({element:t,name:e,value:i,maskAllElementAttributes:n,maskAttributeFn:s,isGenerated:r=!1}){return i?n?r&&Kh.has(Jh(e))?i:"*".repeat(i.length):s?s(e,i,t):i:i}var Xh="__rrweb_original__";function tc(t){try{const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?Jh(e):null}catch(t){return null}}var ec=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ic=/^(?:[a-z+]+:)?\/\//i,nc=/^www\..*/i,sc=/^(data:)([^,]*),(.*)/i;function rc(t,e){return(t||"").replace(ec,(t,i,n,s,r,o)=>{const l=n||r||o,a=i||s||"";if(!l)return t;if(ic.test(l)||nc.test(l))return`url(${a}${l}${a})`;if(sc.test(l))return`url(${a}${l}${a})`;if("/"===l[0])return`url(${a}${function(t){let e="";return e=t.indexOf("//")>-1?t.split("/").slice(0,3).join("/"):t.split("/")[0],e=e.split("?")[0],e}(e)+l}${a})`;const u=e.split("/"),h=l.split("/");u.pop();for(const t of h)"."!==t&&(".."===t?u.pop():u.push(t));return`url(${a}${u.join("/")}${a})`})}var oc,lc,ac=new Map,uc=1,hc=new RegExp("[^a-z0-9-_:]");function cc(){return uc++}var dc=/^[^ \t\n\r\u000c]+/,vc=/^[, \t\n\r\u000c]+/,fc=new WeakMap;function pc(t,e){return e&&""!==e.trim()?gc(t,e):e}function gc(t,e){let i=fc.get(t);if(i||(i=t.createElement("a"),fc.set(t,i)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return i.setAttribute("href",e),i.href}function mc(t,e){return(null==e?void 0:e.maxBase64ImageLength)?function(t,e){return e&&t.length>e?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":t}(t,e.maxBase64ImageLength):t}function yc(t,e,i,n,s,r){if(!n)return n;if("src"===i||"href"===i&&("use"!==e||"#"!==n[0])){if("link"===e&&s){var o;const t=null===(o=s.sheet)||void 0===o?void 0:o.href;if(t)return t}const i=pc(t,n);if(i.startsWith("data:")){if("img"===e&&s){let t=i;return((null==r?void 0:r.type)||void 0!==(null==r?void 0:r.quality))&&(t=function(t,e,i,n){if(1e5>e.length)return e;if(!t.complete||0===t.naturalWidth)return e;if(t.naturalWidth>4096||t.naturalHeight>4096)return e;const s=ac.get(e);if(s&&s.type===i&&s.quality===n)return s.result;try{const s=document.createElement("canvas");s.width=t.naturalWidth,s.height=t.naturalHeight;const r=s.getContext("2d");if(!r)return e;r.drawImage(t,0,0);const o=s.toDataURL(i||"image/webp",null!=n?n:.4),l=e.length>o.length?o:e;if(ac.size>=10){const t=ac.keys().next().value;void 0!==t&&ac.delete(t)}return ac.set(e,{type:i,quality:n,result:l}),l}catch(t){return e}}(s,i,r.type,r.quality)),mc(t,r)}if("image"===e)return mc(i,r)}return i}if("xlink:href"===i&&"#"!==n[0]){const i=pc(t,n);return"image"===e&&i.startsWith("data:")?mc(i,r):i}return"background"!==i||"table"!==e&&"td"!==e&&"th"!==e?"srcset"===i?function(t,e){if(""===e.trim())return e;let i=0;function n(t){let n;const s=t.exec(e.substring(i));return s?(n=s[0],i+=n.length,n):""}const s=[];for(;n(vc),e.length>i;){let r=n(dc);if(","===r.slice(-1))r=pc(t,r.substring(0,r.length-1)),s.push(r);else{let n="";r=pc(t,r);let o=!1;for(;;){const t=e.charAt(i);if(""===t){s.push((r+n).trim());break}if(o)")"===t&&(o=!1);else{if(","===t){i+=1,s.push((r+n).trim());break}"("===t&&(o=!0)}n+=t,i+=1}}}return s.join(", ")}(t,n):"style"===i?rc(n,gc(t)):"object"===e&&"data"===i?pc(t,n):n:pc(t,n)}function _c(t,e,i){return("video"===t||"audio"===t)&&"autoplay"===Jh(e)}function bc(t,e,i){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!i&&bc(rh.parentNode(t),e,i);for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!i&&bc(rh.parentNode(t),e,i)}function wc(t,e,i,n){let s;if(Ah(t)){if(s=t,!rh.childNodes(s).length)return!1}else{if(null===rh.parentElement(t))return!1;s=rh.parentElement(t)}try{if("string"==typeof e){if(n){if(s.closest(`.${e}`))return!0}else if(s.classList.contains(e))return!0}else if(bc(s,e,n))return!0;if(i)if(n){if(s.closest(i))return!0}else if(s.matches(i))return!0}catch(t){}return!1}function kc(t,e,i){const n=t.removeEventListener;"function"==typeof n&&n.call(t,e,i)}var Sc=new Map;function xc(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function Cc(t){return null==t?"":t.toLowerCase()}var $c=!1,Tc=!1;function Ec(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,maskTextClass:o,maskTextSelector:l,skipChild:a=!1,inlineStylesheet:u=!0,maskInputOptions:h={},maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v=!1,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g={},inlineImages:m=!1,recordCanvas:y=!1,canvasMaskingConfigured:_,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k=5e3,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:T=()=>!1,newlyAddedElement:E=!1,depth:I=0,maxDepth:M=50}=e;let{needsMask:R}=e,{preserveWhiteSpace:P=!0}=e;if(I>=M)return Tc=!0,$c||($c=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${M}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;R||(R=wc(t,o,l,void 0===R)),ch>0&&(fh.nodeCount+=1);const O=function(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:o,inlineStylesheet:l,maskInputOptions:a={},maskTextFn:u,maskInputFn:h,maskAllElementAttributes:c=!1,maskAttributeFn:d,dataURLOptions:v={},inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y=!1}=e,_=function(t,e){if(!e.hasNode(t))return;const i=e.getId(t);return 1===i?void 0:i}(i,n);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:Vu.Document,childNodes:[],compatMode:t.compatMode}:{type:Vu.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:Vu.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:_};case t.ELEMENT_NODE:return function(t,e){const{doc:i,blockClass:n,blockSelector:s,inlineStylesheet:r,maskInputOptions:o={},maskInputFn:l,maskAllElementAttributes:a=!1,maskAttributeFn:u,dataURLOptions:h={},inlineImages:c,recordCanvas:d,canvasMaskingConfigured:v,keepIframeSrcFn:f,newlyAddedElement:p=!1,rootId:g}=e,m=function(t,e,i){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(i)return t.matches(i)}catch(t){}return!1}(t,n,s),y=function(t){if(t instanceof HTMLFormElement)return"form";const e=Jh(t.tagName);return hc.test(e)?"div":e}(t),_=new Set;let b={};const w=t.attributes.length;for(let e=0;w>e;e++){const n=t.attributes[e];_c(y,n.name)||(b[n.name]=yc(i,y,Jh(n.name),n.value,t,h))}if("link"===y&&r&&!m){let e=t.sheet;if(!e){const n=function(t){return t.href}(t);n&&(e=xc(i,n),!e&&n.includes(".css"))&&(e=xc(i,window.location.origin+"/"+n.replace(window.location.href,"")))}let n=null;e&&(Eh(e)?ch>0&&(mh.push(t),yh+=1):n=Bh(e)),n&&(delete b.rel,delete b.href,b._cssText=n)}if("style"===y&&t.sheet&&!(t.innerText||rh.textContent(t)||"").trim().length){const e=$h(()=>Bh(t.sheet));e&&(b._cssText=e)}if("input"===y||"textarea"===y||"select"===y){const e=t.value,i=t.checked;"radio"!==b.type&&"checkbox"!==b.type&&"submit"!==b.type&&"button"!==b.type&&e?b.value=Qh({element:t,type:tc(t),tagName:y,value:e,maskInputOptions:o,maskInputFn:l}):i&&(b.checked=i)}if("option"===y&&(t.selected&&!o.select?b.selected=!0:delete b.selected),"dialog"===y&&t.open){try{b.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){b.rr_open_mode="modal",b.ph_rr_could_not_detect_modal=!0}_.add("rr_open_mode")}if("canvas"===y&&d&&!(null==v?void 0:v()))if("2d"===t.__context)(function(t){const e=t.getContext("2d");if(!e)return!0;for(let i=0;t.width>i;i+=50)for(let n=0;t.height>n;n+=50){const s=e.getImageData;if(new Uint32Array((Xh in s?s[Xh]:s).call(e,i,n,Math.min(50,t.width-i),Math.min(50,t.height-n)).data.buffer).some(t=>0!==t))return!1}return!0})(t)||(b.rr_dataURL=t.toDataURL(h.type,h.quality));else if(!("__context"in t)){const e=t.toDataURL(h.type,h.quality),n=i.createElement("canvas");n.width=t.width,n.height=t.height,e!==n.toDataURL(h.type,h.quality)&&(b.rr_dataURL=e)}let k,S=!1;if("img"===y&&c){oc||(oc=i.createElement("canvas"),lc=oc.getContext("2d"));const e=t,n=e.currentSrc||e.getAttribute("src")||"<unknown-src>",s=e.crossOrigin,r=(e,i)=>S?Yh({element:t,name:e,value:i,maskAllElementAttributes:a,maskAttributeFn:u}):i,o=()=>{kc(e,"load",o);try{oc.width=e.naturalWidth,oc.height=e.naturalHeight,lc.drawImage(e,0,0);const t=oc.toDataURL(h.type,h.quality);b.rr_dataURL=r("rr_dataURL",t)}catch(t){if("anonymous"!==e.crossOrigin)return e.crossOrigin="anonymous",void(e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o));console.warn(`Cannot inline img src=${n}! Error: ${t}`)}"anonymous"===e.crossOrigin&&(s?b.crossOrigin=r("crossOrigin",s):e.removeAttribute("crossorigin"))};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if("audio"===y||"video"===y){const e=b;e.rr_mediaState=t.paused?"paused":"played",_.add("rr_mediaState"),e.rr_mediaCurrentTime=t.currentTime,e.rr_mediaPlaybackRate=t.playbackRate,e.rr_mediaMuted=t.muted,e.rr_mediaLoop=t.loop,e.rr_mediaVolume=t.volume}if(p||(t.scrollLeft&&(b.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(b.rr_scrollTop=t.scrollTop)),m){var x,C,T;const{width:e,height:n,left:s,top:r}=t.getBoundingClientRect(),o=null===(x=i.defaultView)||void 0===x?void 0:x.getComputedStyle(t);b={class:b.class,rr_width:`${e}px`,rr_height:`${n}px`,rr_left:`${Math.floor(s+((null===(C=i.defaultView)||void 0===C?void 0:C.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(T=i.defaultView)||void 0===T?void 0:T.scrollY)||0))}px`},_.add("rr_width"),_.add("rr_height"),_.add("rr_left"),_.add("rr_top"),o&&(b.rr_position=o.position||"static",_.add("rr_position"),o.transform&&"none"!==o.transform&&(b.rr_transform=o.transform,_.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(b.rr_display=o.display,_.add("rr_display")))}if("iframe"!==y||f(b.src)||(t.contentDocument||(b.rr_src=b.src),delete b.src),a||u)for(const[e,i]of Object.entries(b))"string"!=typeof i&&null!==i||(b[e]=Yh({element:t,name:e,value:i,maskAllElementAttributes:a,maskAttributeFn:u,isGenerated:_.has(e)}));S=!0;try{customElements.get(y)&&(k=!0)}catch(t){}return{type:Vu.Element,tagName:y,attributes:b,childNodes:[],isSVG:(E=t,Boolean("svg"===E.tagName||E.ownerSVGElement)||void 0),needBlock:m,rootId:g,isCustom:k};var E}(t,{doc:i,blockClass:s,blockSelector:r,inlineStylesheet:l,maskInputOptions:a,maskInputFn:h,maskAllElementAttributes:c,maskAttributeFn:d,dataURLOptions:v,inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y,rootId:_});case t.TEXT_NODE:return function(t,e){const{needsMask:i,maskTextFn:n,rootId:s}=e,r=rh.parentNode(t),o=r&&r.tagName;let l=rh.textContent(t);const a="STYLE"===o||void 0,u="SCRIPT"===o||void 0;if(a&&l){try{var h;if(t.nextSibling||t.previousSibling);else if(Eh(r.sheet));else if(null===(h=r.sheet)||void 0===h?void 0:h.cssRules){const t=Bh(r.sheet);t&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(t)&&(l=t)}}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}l=rc(l,gc(e.doc))}return u&&(l="SCRIPT_PLACEHOLDER"),!a&&!u&&l&&i&&(l=n?n(l,rh.parentElement(t)):l.replace(/[\S]/g,"*")),{type:Vu.Text,textContent:l||"",isStyle:a,rootId:s}}(t,{doc:i,needsMask:o,maskTextFn:u,rootId:_});case t.CDATA_SECTION_NODE:return{type:Vu.CDATA,textContent:"",rootId:_};case t.COMMENT_NODE:return{type:Vu.Comment,textContent:rh.textContent(t)||"",rootId:_};default:return!1}}(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:_,keepIframeSrcFn:T,newlyAddedElement:E});if(!O)return console.warn(t,"not serialized"),null;let A;A=n.hasNode(t)?n.getId(t):function(t,e){if(e.comment&&t.type===Vu.Comment)return!0;if(t.type===Vu.Element){if(e.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel&&"script"===t.attributes.as||"modulepreload"===t.attributes.rel)||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&"js"===function(t){var e;let i;try{i=new URL(t,window.location.href)}catch(t){return null}const n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(e=null==n?void 0:n[1])&&void 0!==e?e:null}(t.attributes.href)))return!0;if(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(Cc(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Cc(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Cc(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&Cc(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Cc(t.attributes.property).match(/^(og|twitter|fb):/)||Cc(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===Cc(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(Cc(t.attributes.name)))return!0;if(e.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(e.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(Cc(t.attributes.name))||Cc(t.attributes.property).match(/^article:/)||Cc(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(Cc(t.attributes.name)))return!0}}return!1}(O,p)||!P&&O.type===Vu.Text&&!O.isStyle&&!O.textContent.replace(/^\s+|\s+$/gm,"").length?-2:cc();const F=Object.assign(O,{id:A});if(n.add(t,F),-2===A)return null;b&&b(t);let D=!a;if(F.type===Vu.Element){D=D&&!F.needBlock,delete F.needBlock;const e=rh.shadowRoot(t);e&&Dh(e)&&(F.isShadowHost=!0)}if((F.type===Vu.Document||F.type===Vu.Element)&&D){p.headWhitespace&&F.type===Vu.Element&&"head"===F.tagName&&(P=!1);const e={doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:l,skipChild:a,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:_,preserveWhiteSpace:P,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I+1,maxDepth:M};if(F.type===Vu.Element&&"textarea"===F.tagName&&void 0!==F.attributes.value);else for(const i of Array.from(rh.childNodes(t))){const t=Ec(i,e);t&&F.childNodes.push(t)}let E=null;if(Ah(t)&&(E=rh.shadowRoot(t)))for(const t of Array.from(rh.childNodes(E))){const i=Ec(t,e);i&&(Dh(E)&&(i.isShadow=!0),F.childNodes.push(i))}}const L=rh.parentNode(t);if(L&&Fh(L)&&Dh(L)&&(F.isShadow=!0),F.type===Vu.Element&&"iframe"===F.tagName){const e=function(t,e,i){const n=()=>{},s=t.contentWindow;if(!s)return n;let r;try{r=s.document.readyState}catch(t){return n}const o=()=>e();if("complete"!==r){let n=!1,s=null;const r=()=>{n||(n=!0,null!==s&&(clearTimeout(s),s=null),kc(t,"load",l),t.addEventListener("load",o),e())},l=()=>r();return s=setTimeout(r,i),t.addEventListener("load",l),()=>{null!==s&&(clearTimeout(s),s=null),n?kc(t,"load",o):(n=!0,kc(t,"load",l))}}const l="about:blank";let a;try{a=s.location.href}catch(t){return n}if(a!==l||t.src===l||""===t.src){const i=setTimeout(e,0);return t.addEventListener("load",o),()=>{clearTimeout(i),kc(t,"load",o)}}return t.addEventListener("load",o),()=>{kc(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&w){const i=Ec(e,{doc:e,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:_,preserveWhiteSpace:P,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I+1,maxDepth:M});i&&w(t,i)}},k);null==S||S(t,e)}return F.type===Vu.Element&&"link"===F.tagName&&"stylesheet"===F.attributes.rel&&function(e,a,S){if(Sc.has(e))return;let E;try{E=e.sheet}catch(t){return}if(E)return;const O=new AbortController;let A=!1;const F=()=>{if(!A){A=!0;try{(()=>{if(x){const e=Ec(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:_,preserveWhiteSpace:P,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I,maxDepth:M});e&&x(t,e)}})()}finally{Sc.delete(e),O.abort()}}},D=setTimeout(F,S);O.signal.addEventListener("abort",()=>clearTimeout(D),{once:!0}),e.addEventListener("load",F,{signal:O.signal,once:!0}),Sc.set(e,O)}(t,0,C),F}function Ic(t){return!0===t||"all"===t?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===t,headMetaDescKeywords:"all"===t,headTitleMutations:"all"===t}:!1===t?{}:t}var Mc=class t{constructor(...t){Oh(this,"parentElement",null),Oh(this,"parentNode",null),Oh(this,"ownerDocument",void 0),Oh(this,"firstChild",null),Oh(this,"lastChild",null),Oh(this,"previousSibling",null),Oh(this,"nextSibling",null),Oh(this,"ELEMENT_NODE",1),Oh(this,"TEXT_NODE",3),Oh(this,"nodeType",void 0),Oh(this,"nodeName",void 0),Oh(this,"RRNodeType",void 0)}get childNodes(){const t=[];let e=this.firstChild;for(;e;)t.push(e),e=e.nextSibling;return t}contains(e){if(!(e instanceof t))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,e){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function Rc(t,e,i=document){const n={capture:!0,passive:!0};return i.addEventListener(t,e,n),()=>Pc(i,t,e,n)}function Pc(t,e,i,n){Oc(()=>{const s=t.removeEventListener;"function"==typeof s&&(void 0!==n?s.call(t,e,i,n):s.call(t,e,i))})}function Oc(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function Ac(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var Fc="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.",Dc={map:{},getId(){return console.warn(Fc),-1},getNode(){return console.warn(Fc),null},removeNodeFromMap(){console.warn(Fc)},has(){return console.warn(Fc),!1},reset(){console.warn(Fc)}};function Lc(t,e,i={}){let n=null,s=0;return function(...r){const o=Date.now();s||!1!==i.leading||(s=o);const l=e-(o-s),a=this;0>=l||l>e?(n&&(clearTimeout(n),n=null),s=o,t.apply(a,r)):n||!1===i.trailing||(n=setTimeout(()=>{s=!1===i.leading?0:Date.now(),n=null,t.apply(a,r)},l))}}function Nc(t,e,i,n,s=window){const r=s.Object.getOwnPropertyDescriptor(t,e);return s.Object.defineProperty(t,e,n?i:{set(t){if(setTimeout(()=>{try{i.set.call(this,t)}catch(t){}},0),r&&r.set){if(r.get)try{r.get.call(this)}catch(t){return}r.set.call(this,t)}}}),()=>Nc(t,e,r||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Dc=new Proxy(Dc,{get(t,e,i){return"map"===e&&console.warn(Fc),Reflect.get(t,e,i)}}));var qc=Date.now;function Bc(t){var e,i,n,s;const r=t.document;return{left:r.scrollingElement?r.scrollingElement.scrollLeft:void 0!==t.pageXOffset?t.pageXOffset:r.documentElement.scrollLeft||(null==r?void 0:r.body)&&(null===(e=rh.parentElement(r.body))||void 0===e?void 0:e.scrollLeft)||(null==r||null===(i=r.body)||void 0===i?void 0:i.scrollLeft)||0,top:r.scrollingElement?r.scrollingElement.scrollTop:void 0!==t.pageYOffset?t.pageYOffset:(null==r?void 0:r.documentElement.scrollTop)||(null==r?void 0:r.body)&&(null===(n=rh.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 jc(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Hc(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Uc(t){return t?t.nodeType===t.ELEMENT_NODE?t:rh.parentElement(t):null}function zc(t,e,i,n){if(!t)return!1;const s=Uc(t);if(!s)return!1;try{if("string"==typeof e){if(s.classList.contains(e))return!0;if(n&&null!==s.closest("."+e))return!0}else if(bc(s,e,n))return!0}catch(t){}if(i){if(s.matches(i))return!0;if(n&&null!==s.closest(i))return!0}return!1}function Wc(t,e,i){return!("TITLE"!==t.tagName||!i.headTitleMutations)||-2===e.getId(t)}function Vc(t,e){if(Fh(t))return!1;const i=e.getId(t);if(!e.has(i))return!0;const n=rh.parentNode(t);return(!n||n.nodeType!==t.DOCUMENT_NODE)&&(!n||Vc(n,e))}function Gc(t){return Boolean(t.changedTouches)}function Zc(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Qc(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Jc(t){return!!t&&(t instanceof Mc&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(rh.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(qc=()=>(new Date).getTime());var Kc=class{constructor(){Oh(this,"id",1),Oh(this,"styleIDMap",new WeakMap),Oh(this,"idStyleMap",new Map)}getId(t){var e;return null!==(e=this.styleIDMap.get(t))&&void 0!==e?e:-1}has(t){return this.styleIDMap.has(t)}add(t,e){if(this.has(t))return this.getId(t);let i;return i=void 0===e?this.id++:e,this.styleIDMap.set(t,i),this.idStyleMap.set(i,t),i}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Yc(t){var e;let i=null;return"getRootNode"in t&&(null===(e=rh.getRootNode(t))||void 0===e?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&rh.host(rh.getRootNode(t))&&(i=rh.host(rh.getRootNode(t))),i}function Xc(t){const e=t.ownerDocument;if(!e)return!1;if(rh.contains(e,t))return!0;const i=rh.isConnected(t);return"boolean"==typeof i?i:function(t){const e=t.ownerDocument;if(!e)return!1;const i=function(t){let e,i=t;for(;e=Yc(i);)i=e;return i}(t);return rh.contains(e,i)}(t)}function td(t){return"__ln"in t}var ed,id=class{constructor(){Oh(this,"length",0),Oh(this,"head",null),Oh(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let e=this.head;for(let i=0;t>i;i++)e=(null==e?void 0:e.next)||null;return e}addNode(t){const e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&td(t.previousSibling)){const i=t.previousSibling.__ln.next;e.next=i,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,i&&(i.previous=e)}else if(t.nextSibling&&td(t.nextSibling)&&t.nextSibling.__ln.previous){const i=t.nextSibling.__ln.previous;e.previous=i,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,i&&(i.next=e)}else this.head&&(this.head.previous=e),e.next=this.head,this.head=e;null===e.next&&(this.tail=e),this.length++}removeNode(t){const e=t.__ln;this.head&&(e.previous?(e.previous.next=e.next,e.next?e.next.previous=e.previous:this.tail=e.previous):(this.head=e.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},nd=(t,e)=>`${t}@${e}`,sd=class{constructor(){Oh(this,"frozen",!1),Oh(this,"locked",!1),Oh(this,"texts",[]),Oh(this,"attributes",[]),Oh(this,"attributeMap",new WeakMap),Oh(this,"generatedAttributes",new WeakMap),Oh(this,"removes",[]),Oh(this,"mapRemoves",new Set),Oh(this,"movedMap",{}),Oh(this,"addedSet",new Set),Oh(this,"movedSet",new Set),Oh(this,"droppedSet",new Set),Oh(this,"removesSubTreeCache",new Set),Oh(this,"mutationCb",void 0),Oh(this,"blockClass",void 0),Oh(this,"blockSelector",void 0),Oh(this,"maskTextClass",void 0),Oh(this,"maskTextSelector",void 0),Oh(this,"inlineStylesheet",void 0),Oh(this,"maskInputOptions",void 0),Oh(this,"maskTextFn",void 0),Oh(this,"maskInputFn",void 0),Oh(this,"maskAllElementAttributes",void 0),Oh(this,"maskAttributeFn",void 0),Oh(this,"keepIframeSrcFn",void 0),Oh(this,"recordCanvas",void 0),Oh(this,"canvasMaskingConfigured",void 0),Oh(this,"inlineImages",void 0),Oh(this,"slimDOMOptions",void 0),Oh(this,"dataURLOptions",void 0),Oh(this,"doc",void 0),Oh(this,"mirror",void 0),Oh(this,"iframeManager",void 0),Oh(this,"stylesheetManager",void 0),Oh(this,"shadowDomManager",void 0),Oh(this,"canvasManager",void 0),Oh(this,"processedNodeManager",void 0),Oh(this,"unattachedDoc",void 0),Oh(this,"canvasManagerReleased",!1),Oh(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),Oh(this,"emit",()=>{if(this.frozen||this.locked)return;const t=oh(),e=uh();try{this.processBufferedMutations()}finally{i=oh()-t,n=e,ch>0||hh(i,null!=n?n:lh)||i>bh.slowestBatchMs&&(bh.slowestBatchMs=i)}var i,n}),Oh(this,"processBufferedMutations",()=>{const t=[],e=new Set,i=new id,n=t=>{let e=t,i=-2;for(;-2===i;)e=e&&e.nextSibling,i=e&&this.mirror.getId(e);return i};let s;const r=r=>{var o;const l=rh.parentNode(r);if(!l||!Xc(r)||"TEXTAREA"===l.tagName)return;if(this.isBlockedAtEmission(l))return;const a=Fh(l)?this.mirror.getId(Yc(r)):this.mirror.getId(l),u=n(r);if(-1===a||-1===u)return i.addNode(r);null!==(o=s)&&void 0!==o||(s={doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:t=>{Zc(t,this.mirror)&&this.iframeManager.addIframe(t),Qc(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Jc(t)&&!zc(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(rh.shadowRoot(t),this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onIframeListenerRegistered:(t,e)=>{this.iframeManager.registerLoadListenerDisposer(t,e)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}});const h=Ec(r,s);h&&(t.push({parentId:a,nextId:u,node:h}),e.add(h.id))};for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t);for(const t of this.movedSet)od(this.removesSubTreeCache,t)&&!this.movedSet.has(rh.parentNode(t))||r(t);for(const t of this.addedSet)ld(this.droppedSet,t)||od(this.removesSubTreeCache,t)?ld(this.movedSet,t)?r(t):this.droppedSet.add(t):r(t);let o=null;for(;i.length;){let t=null;if(o){const e=this.mirror.getId(rh.parentNode(o.value)),i=n(o.value);-1!==e&&-1!==i&&(t=o)}if(!t){let e=i.tail;for(;e;){const i=e;if(e=e.previous,i){const e=this.mirror.getId(rh.parentNode(i.value));if(-1===n(i.value))continue;if(-1!==e){t=i;break}{const e=rh.parentNode(i.value);if(e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=rh.host(e);if(-1!==this.mirror.getId(n)){t=i;break}}}}}}if(!t){for(;i.head;)i.removeNode(i.head.value);break}o=t.previous,i.removeNode(t.value),r(t.value)}const l={texts:this.texts.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const e=t.node,i=rh.parentNode(e);return i&&"TEXTAREA"===i.tagName&&this.genTextAreaValueMutation(i),{id:this.mirror.getId(e),value:t.value}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),attributes:this.attributes.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const{attributes:e}=t;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof e.style){const i=JSON.stringify(t.styleDiff),n=JSON.stringify(t._unchangedStyles);e.style.length>i.length&&(i+n).split("var(").length===e.style.split("var(").length&&(e.style=t.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(const[n,s]of Object.entries(e))if("string"==typeof s||null===s){var i;e[n]=Yh({element:t.node,name:n,value:s,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(i=this.generatedAttributes.get(t.node))||void 0===i?void 0:i.has(n)})}return{id:this.mirror.getId(t.node),attributes:e}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),removes:this.removes,adds:t};this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.generatedAttributes=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},(l.texts.length||l.attributes.length||l.removes.length||l.adds.length)&&this.mutationCb(l)}),Oh(this,"bufferBelongsToIframe",t=>this.doc===t.contentDocument),Oh(this,"genTextAreaValueMutation",t=>{let e=this.attributeMap.get(t);e||(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(e),this.attributeMap.set(t,e));const i=Array.from(rh.childNodes(t),t=>rh.textContent(t)||"").join("");e.attributes.value=Qh({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:tc(t),value:i,maskInputFn:this.maskInputFn})}),Oh(this,"processMutation",t=>{if(!Wc(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const e=rh.textContent(t.target);zc(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:wc(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,Uc(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break}case"attributes":{var e;const n=t.target,s=Jh(n.tagName),r=t.attributeName,o=null!==(e=t.attributeNamespace)&&void 0!==e?e:null;let l=function(t,e,i){if(!i)return e;const n=t.getAttributeNodeNS(i,e);if(n)return n.name;if("http://www.w3.org/1999/xlink"===i)return`xlink:${e}`;if("http://www.w3.org/XML/1998/namespace"===i)return`xml:${e}`;if("http://www.w3.org/2000/xmlns/"===i)return"xmlns"===e?e:`xmlns:${e}`;const s=t.lookupPrefix(i);return s?`${s}:${e}`:e}(n,r,o),a=o?n.getAttributeNS(o,r):t.target.getAttribute(r);if("value"===l){const t=n,e=tc(t);a=Qh({element:t,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:a,maskInputFn:this.maskInputFn})}if(zc(t.target,this.blockClass,this.blockSelector,!1)||a===t.oldValue)return;let u=this.attributeMap.get(t.target);const h="iframe"===s&&"src"===l;if(h&&!this.keepIframeSrcFn(a)&&n.contentDocument)return;if("type"===l&&"input"===s&&"password"===(t.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!_c(s,l)){var i;u||(u={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(u),this.attributeMap.set(t.target,u));const e=yc(this.doc,s,Jh(l),a,n,this.dataURLOptions);if(h&&!this.keepIframeSrcFn(a)&&(l="rr_src"),u.attributes[l]=e,null===(i=this.generatedAttributes.get(t.target))||void 0===i||i.delete(l),"style"===l){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const e=this.unattachedDoc.createElement("span"),i=n.style;t.oldValue&&(e.style.cssText=t.oldValue);for(const t of Array.from(i)){const n=i.getPropertyValue(t),s=i.getPropertyPriority(t);n!==e.style.getPropertyValue(t)||s!==e.style.getPropertyPriority(t)?u.styleDiff[t]=""===s?n:[n,s]:u._unchangedStyles[t]=[n,s]}for(const t of Array.from(e.style))""===i.getPropertyValue(t)&&(u.styleDiff[t]=!1)}else if("open"===l&&"dialog"===s){u.attributes.rr_open_mode=n.matches("dialog:modal")?"modal":"non-modal";let e=this.generatedAttributes.get(t.target);e||(e=new Set,this.generatedAttributes.set(t.target,e)),e.add("rr_open_mode")}}break}case"childList":if(zc(t.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===t.target.tagName)return void this.genTextAreaValueMutation(t.target);t.addedNodes.forEach(e=>this.genAdds(e,t.target)),t.removedNodes.forEach(e=>{const i=this.mirror.getId(e),n=Fh(t.target)?this.mirror.getId(rh.host(t.target)):this.mirror.getId(t.target);zc(t.target,this.blockClass,this.blockSelector,!1)||Wc(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(rd(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===i||Vc(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[nd(i,n)]?rd(this.movedSet,e):(this.removes.push({parentId:n,id:i,isShadow:!(!Fh(t.target)||!Dh(t.target))||void 0}),function(t,e){const i=[t];for(;i.length;){const t=i.pop();e.has(t)||(e.add(t),rh.childNodes(t).forEach(t=>i.push(t)))}}(e,this.removesSubTreeCache))),this.mapRemoves.add(e))})}}),Oh(this,"genAdds",(t,e)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)){if(this.addedSet.has(t))return this.addedSet.delete(t),void this.addedSet.add(t);if(!this.movedSet.has(t)){if(this.mirror.hasNode(t)){if(Wc(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let i=null;e&&this.mirror.hasNode(e)&&(i=this.mirror.getId(e)),i&&-1!==i&&(this.movedMap[nd(this.mirror.getId(t),i)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!zc(t,this.blockClass,this.blockSelector,!1)){if(t.nodeType===t.TEXT_NODE)return;const e=rh.childNodes(t);for(let t=0,i=e.length;i>t;t++){const i=e[t];i&&this.genAdds(i)}if(Jc(t)){const e=rh.childNodes(rh.shadowRoot(t));for(let i=0,n=e.length;n>i;i++){const n=e[i];n&&(this.processedNodeManager.add(n,this),this.genAdds(n,t))}}}}}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAllElementAttributes","maskAttributeFn","keepIframeSrcFn","recordCanvas","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(e=>{this[e]=t[e]}),this.canvasManager.acquire()}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t)}isBlockedAtEmission(t){const e=this.blockClass,i=e&&"string"!=typeof e&&(e.global||e.sticky)?new RegExp(e):null;for(;t;){if(i&&(i.lastIndex=0),zc(t,i||e,this.blockSelector,!0))return!0;const n="getRootNode"in t?rh.getRootNode(t):null;t=(null==n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?rh.host(n):null}return!1}};function rd(t,e){const i=[e];for(;i.length;){const e=i.pop();if(t.delete(e),e.nodeType===e.TEXT_NODE)continue;const n=rh.childNodes(e);for(let t=0,e=n.length;e>t;t++){const e=n[t];e&&i.push(e)}}}function od(t,e,i){return 0!==t.size&&function(t,e){const i=rh.parentNode(e);return!!i&&t.has(i)}(t,e)}function ld(t,e){if(0===t.size)return!1;let i=rh.parentNode(e);for(;i;){if(t.has(i))return!0;i=rh.parentNode(i)}return!1}function ad(t){ed=t}function ud(){ed=void 0}var hd=(t,e="rrweb")=>ed?(...i)=>{try{return t(...i)}catch(t){if(ed&&!0===ed(t,e))return;throw t}}:t,cd=[];function dd(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch(t){}return t&&t.target}function vd(t,e){const i=new sd;let n;i.init(t);try{n=new(nh())(hd(i.processMutations.bind(i)));const s={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return t.attributeFilter&&t.attributeFilter.length>0&&(s.attributeFilter=t.attributeFilter),n.observe(e,s),cd.push(i),{observer:n,buffer:i}}catch(t){try{null==n||n.disconnect(),i.destroy(),i.reset()}catch(t){}throw t}}function fd({scrollCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){const o=new Map,l=r=>{const l=dd(r);if(!l||zc(l,n,s,!0))return;const a=i.getId(l);let u,h;if(l===e&&e.defaultView){const t=Bc(e.defaultView);u=t.left,h=t.top}else u=l.scrollLeft,h=l.scrollTop;const c=`${u},${h}`;o.get(a)!==c&&(o.set(a,c),t({id:a,x:u,y:h}))},a=[Rc("scroll",hd(Lc(hd(t=>l(t)),r.scroll||100)),e)];return"onscrollend"in e&&a.push(Rc("scrollend",hd(l),e)),()=>a.forEach(t=>t())}function pd(t,e){for(let i=cd.length-1;i>=0;i--){const n=cd[i];if(!n)continue;let s=n.bufferBelongsToIframe(t);!s&&e&&e.has(n.bufferDoc())&&(s=!0),s&&(n.reset(),cd.splice(i,1))}}var gd=["INPUT","TEXTAREA","SELECT"],md=new WeakMap;function yd(t){return function t(e,i){if(kd("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||kd("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||kd("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||kd("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);return i.unshift(n),t(e.parentRule,i)}if(e.parentStyleSheet){const t=Array.from(e.parentStyleSheet.cssRules).indexOf(e);i.unshift(t)}return i}(t,[])}function _d(t,e,i){let n,s;return t?(t.ownerNode?n=e.getId(t.ownerNode):s=i.getId(t),{styleId:s,id:n}):{}}function bd({mirror:t,stylesheetManager:e},i){var n,s;let r=null;r=t.getId("#document"===i.nodeName?i:rh.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,l=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==r&&-1!==r&&o&&l?(Object.defineProperty(i,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var t;return null===(t=l.get)||void 0===t?void 0:t.call(this)},set(t){let i;try{var n;i=null===(n=l.set)||void 0===n?void 0:n.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==r&&-1!==r)try{e.adoptStyleSheets(t,r)}catch(t){}return i}}),hd(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function wd(t,e={}){const i=t.doc.defaultView;if(!i)return()=>{};let n,s;!function(t,e){const{mutationCb:i,mousemoveCb:n,mouseInteractionCb:s,scrollCb:r,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:u,styleDeclarationCb:h,canvasMutationCb:c,fontCb:d,selectionCb:v,customElementCb:f}=t;t.mutationCb=(...t)=>{e.mutation&&e.mutation(...t),i(...t)},t.mousemoveCb=(...t)=>{e.mousemove&&e.mousemove(...t),n(...t)},t.mouseInteractionCb=(...t)=>{e.mouseInteraction&&e.mouseInteraction(...t),s(...t)},t.scrollCb=(...t)=>{e.scroll&&e.scroll(...t),r(...t)},t.viewportResizeCb=(...t)=>{e.viewportResize&&e.viewportResize(...t),o(...t)},t.inputCb=(...t)=>{e.input&&e.input(...t),l(...t)},t.mediaInteractionCb=(...t)=>{e.mediaInteaction&&e.mediaInteaction(...t),a(...t)},t.styleSheetRuleCb=(...t)=>{e.styleSheetRule&&e.styleSheetRule(...t),u(...t)},t.styleDeclarationCb=(...t)=>{e.styleDeclaration&&e.styleDeclaration(...t),h(...t)},t.canvasMutationCb=(...t)=>{e.canvasMutation&&e.canvasMutation(...t),c(...t)},t.fontCb=(...t)=>{e.font&&e.font(...t),d(...t)},t.selectionCb=(...t)=>{e.selection&&e.selection(...t),v(...t)},t.customElementCb=(...t)=>{e.customElement&&e.customElement(...t),f(...t)}}(t,e);const r=[],o=hd(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=cd.indexOf(s);-1!==t&&cd.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==n||n.disconnect()}finally{Ac(r)}});try{if(t.recordDOM){const e=vd(t,t.doc);n=e.observer,s=e.buffer}if(r.push(function({mousemoveCb:t,sampling:e,doc:i,mirror:n}){if(!1===e.mousemove)return()=>{};const s="number"==typeof e.mousemove?e.mousemove:50,r="number"==typeof e.mousemoveCallback?e.mousemoveCallback:500;let o,l=[];const a=Lc(hd(e=>{const i=Date.now()-o;t(l.map(t=>(t.timeOffset-=i,t)),e),l=[],o=null}),r),u=hd(Lc(hd(t=>{const e=dd(t),{clientX:i,clientY:s}=Gc(t)?t.changedTouches[0]:t;o||(o=qc()),l.push({x:i,y:s,id:n.getId(e),timeOffset:qc()-o}),a("undefined"!=typeof DragEvent&&t instanceof DragEvent?ju.Drag:t instanceof MouseEvent?ju.MouseMove:ju.TouchMove)}),s,{trailing:!1})),h=[Rc("mousemove",u,i),Rc("touchmove",u,i),Rc("drag",u,i)];return hd(()=>{h.forEach(t=>t())})}(t)),r.push(function({mouseInteractionCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){if(!1===r.mouseInteraction)return()=>{};const o=!0===r.mouseInteraction||void 0===r.mouseInteraction?{}:r.mouseInteraction,l=[];let a=null;return Object.keys(Hu).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t]).forEach(r=>{let o=Jh(r);const u=(e=>r=>{const o=dd(r);if(zc(o,n,s,!0))return;let l=null,u=e;if("pointerType"in r){switch(r.pointerType){case"mouse":l=Uu.Mouse;break;case"touch":l=Uu.Touch;break;case"pen":l=Uu.Pen}l===Uu.Touch&&(Hu[e]===Hu.MouseDown?u="TouchStart":Hu[e]===Hu.MouseUp&&(u="TouchEnd"))}else Gc(r)&&(l=Uu.Touch);null!==l?(a=l,(u.startsWith("Touch")&&l===Uu.Touch||u.startsWith("Mouse")&&l===Uu.Mouse)&&(l=null)):Hu[e]===Hu.Click&&(l=a,a=null);const h=Gc(r)?r.changedTouches[0]:r;if(!h)return;const c=i.getId(o),{clientX:d,clientY:v}=h;hd(t)(ue({type:Hu[u],id:c,x:d,y:v},null!==l&&{pointerType:l}))})(r);if(window.PointerEvent)switch(Hu[r]){case Hu.MouseDown:case Hu.MouseUp:o=o.replace("mouse","pointer");break;case Hu.TouchStart:case Hu.TouchEnd:return}l.push(Rc(o,u,e))}),hd(()=>{l.forEach(t=>t())})}(t)),r.push(fd(t)),r.push(function({viewportResizeCb:t},{win:e}){let i=-1,n=-1;return Rc("resize",hd(Lc(hd(()=>{const e=jc(),s=Hc();i===e&&n===s||(t({width:Number(s),height:Number(e)}),i=e,n=s)}),200)),e)}(t,{win:i})),r.push(function({inputCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,ignoreClass:r,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:u,userTriggeredOnInput:h}){function c(t){let i=dd(t);const u=t.isTrusted,c=e.defaultView;if(i&&c&&!(i instanceof c.HTMLElement))return;const v=i&&i.tagName;if(i&&"OPTION"===v&&(i=rh.parentElement(i)),!i||!v||0>gd.indexOf(v)||zc(i,n,s,!0))return;if(i.classList.contains(r)||o&&i.matches(o))return;let f=i.value,p=!1;const g=tc(i)||"";"radio"===g||"checkbox"===g?p=i.checked:(l[v.toLowerCase()]||l[g])&&(f=Qh({element:i,maskInputOptions:l,tagName:v,type:g,value:f,maskInputFn:a})),d(i,h?{text:f,isChecked:p,userTriggered:u}:{text:f,isChecked:p});const m=i.name;"radio"===g&&m&&p&&e.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach(t=>{if(t!==i){const e=t.value;d(t,h?{text:e,isChecked:!p,userTriggered:!1}:{text:e,isChecked:!p})}})}function d(e,n){const s=md.get(e);if(!s||s.text!==n.text||s.isChecked!==n.isChecked){md.set(e,n);const s=i.getId(e);hd(t)(ue(ue({},n),{},{id:s}))}}const v=("last"===u.input?["change"]:["input","change"]).map(t=>Rc(t,hd(c),e)),f=e.defaultView;if(!f)return()=>{v.forEach(t=>t())};const p=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value");return p&&p.set&&v.push(...[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]].map(t=>Nc(t[0],t[1],{set(){hd(c)({target:this,isTrusted:!1})}},!1,f))),hd(()=>{Ac(v)})}(t)),r.push(function({mediaInteractionCb:t,blockClass:e,blockSelector:i,mirror:n,sampling:s,doc:r}){const o=hd(r=>Lc(hd(s=>{const o=dd(s);if(!o||zc(o,e,i,!0))return;const{currentTime:l,volume:a,muted:u,playbackRate:h,loop:c}=o;t({type:r,id:n.getId(o),currentTime:l,volume:a,muted:u,playbackRate:h,loop:c})}),s.media||500)),l=[Rc("play",o(Wu.Play),r),Rc("pause",o(Wu.Pause),r),Rc("seeked",o(Wu.Seeked),r),Rc("volumechange",o(Wu.VolumeChange),r),Rc("ratechange",o(Wu.RateChange),r)];return hd(()=>{l.forEach(t=>t())})}(t)),t.recordDOM){const e=function(t){const e=new Map,i=new Set;let n=!0;const s=t=>{if(n)try{t()}catch(t){}},r=t=>{var i;const n=e.get(t);if(n){for(;null===(i=n[0])||void 0===i?void 0:i.ready;){const t=n.shift();(null==t?void 0:t.emit)&&s(t.emit)}0===n.length&&e.delete(t)}};return{queueMutation(t,i){if(!t)return void s(i);const n=e.get(t);n?(n.push({emit:i,ready:!0}),r(t)):s(i)},queuePendingMutation(o,l,a){if(!n)return()=>{};let u=e.get(o);u||(u=[],e.set(o,u));const h={emit:l,ready:!1};u.push(h);let c,d=!1,v=!1;const f=()=>{d||v||(d=!0,void 0!==c&&i.delete(c),h.ready=!0,h.emit=void 0,r(o))};try{c=t.setTimeout(f,5e3),d||v?t.clearTimeout(c):i.add(c)}catch(t){f()}return e=>{!v&&n&&(v=!0,void 0!==c&&(t.clearTimeout(c),i.delete(c)),d?e&&s(a):(h.ready=!0,e||(h.emit=void 0),r(o)))}},reset(){n=!1,i.forEach(e=>t.clearTimeout(e)),i.clear(),e.clear()}}}(i);r.push(e.reset),r.push(function({styleSheetRuleCb:t,mirror:e,stylesheetManager:i},{win:n,mutationQueue:s}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const r=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:hd((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=_d(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,adds:[{rule:l,index:a}]})),a},"host")}),n.CSSStyleSheet.prototype.addRule=function(t,e,i=this.cssRules.length){return n.CSSStyleSheet.prototype.insertRule.apply(this,[`${t} { ${e} }`,i])};const o=n.CSSStyleSheet.prototype.deleteRule;let l,a;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:hd((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=_d(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,removes:[{index:l}]})),a},"host")}),n.CSSStyleSheet.prototype.removeRule=function(t){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},n.CSSStyleSheet.prototype.replace&&(l=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(l,{apply:hd((n,r,o)=>{const[l]=o,a=n.apply(r,o);try{const n=null==a?void 0:a.then;if(r.ownerNode||!a||"function"!=typeof n)return a;i.onCssomSheetMutation(r);const{id:o,styleId:u}=_d(r,e,i.styleMirror);if(!(o&&-1!==o||u&&-1!==u))return a;const h=s.queuePendingMutation(r,()=>t({id:o,styleId:u,replace:l}),()=>{const e=Bh(r);null!==e&&t({id:o,styleId:u,replace:e})});try{n.call(a,()=>h(!0),()=>h(!1))}catch(t){h(!1)}}catch(t){}return a},"host")})),n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:hd((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=_d(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,replaceSync:l})),a},"host")}));const u={};Sd("CSSGroupingRule")?u.CSSGroupingRule=n.CSSGroupingRule:(Sd("CSSMediaRule")&&(u.CSSMediaRule=n.CSSMediaRule),Sd("CSSConditionRule")&&(u.CSSConditionRule=n.CSSConditionRule),Sd("CSSSupportsRule")&&(u.CSSSupportsRule=n.CSSSupportsRule));const h={};return Object.entries(u).forEach(([n,r])=>{h[n]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(h[n].insertRule,{apply:hd((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:h}=_d(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||h&&-1!==h)){const e=[...yd(r),a];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:h,adds:[{rule:l,index:e}]}))}return a},"host")}),r.prototype.deleteRule=new Proxy(h[n].deleteRule,{apply:hd((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:h}=_d(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||h&&-1!==h)){const e=[...yd(r),l];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:h,removes:[{index:e}]}))}return a},"host")})}),hd(()=>{n.CSSStyleSheet.prototype.insertRule=r,n.CSSStyleSheet.prototype.deleteRule=o,l&&(n.CSSStyleSheet.prototype.replace=l),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(u).forEach(([t,e])=>{e.prototype.insertRule=h[t].insertRule,e.prototype.deleteRule=h[t].deleteRule})})}(t,{win:i,mutationQueue:e})),r.push(bd(t,t.doc)),r.push(function({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:i,stylesheetManager:n},{win:s,mutationQueue:r}){const o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:hd((s,o,l)=>{var a;const[u,h,c]=l,d=s.apply(o,l);if(i.has(u))return d;const v=null===(a=o.parentRule)||void 0===a?void 0:a.parentStyleSheet;n.onCssomSheetMutation(v);const{id:f,styleId:p}=_d(v,e,n.styleMirror);if(f&&-1!==f||p&&-1!==p){const e=yd(o.parentRule);r.queueMutation(v,()=>t({id:f,styleId:p,set:{property:u,value:h,priority:c},index:e}))}return d},"host")});const l=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:hd((s,o,l)=>{var a;const[u]=l,h=s.apply(o,l);if(i.has(u))return h;const c=null===(a=o.parentRule)||void 0===a?void 0:a.parentStyleSheet;n.onCssomSheetMutation(c);const{id:d,styleId:v}=_d(c,e,n.styleMirror);if(d&&-1!==d||v&&-1!==v){const e=yd(o.parentRule);r.queueMutation(c,()=>t({id:d,styleId:v,remove:{property:u},index:e}))}return h},"host")}),hd(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=l})}(t,{win:i,mutationQueue:e})),t.collectFonts&&r.push(function({fontCb:t,doc:e}){const i=e.defaultView;if(!i)return()=>{};const n=[],s=new WeakMap,r=i.FontFace;i.FontFace=function(t,e,i){const n=new r(t,e,i);return s.set(n,{family:t,buffer:"string"!=typeof e,descriptors:i,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),n};const o=sh(e.fonts,"add",function(e){return function(i){return setTimeout(hd(()=>{const e=s.get(i);e&&(t(e),s.delete(i))}),0),e.apply(this,[i])}});return n.push(()=>{i.FontFace=r}),n.push(o),hd(()=>{n.forEach(t=>t())})}(t))}r.push(function(t){const{doc:e,mirror:i,blockClass:n,blockSelector:s,selectionCb:r}=t;let o=!0;const l=hd(()=>{const t=e.getSelection();if(!t||o&&(null==t?void 0:t.isCollapsed))return;o=t.isCollapsed||!1;const l=[],a=t.rangeCount||0;for(let e=0;a>e;e++){const{startContainer:r,startOffset:o,endContainer:a,endOffset:u}=t.getRangeAt(e);zc(r,n,s,!0)||zc(a,n,s,!0)||l.push({start:i.getId(r),startOffset:o,end:i.getId(a),endOffset:u})}r({ranges:l})});return l(),Rc("selectionchange",l)}(t)),r.push(function({doc:t,customElementCb:e}){const i=t.defaultView;return i&&i.customElements?sh(i.customElements,"define",function(t){return function(i,n,s){try{e({define:{name:i}})}catch(t){console.warn(`Custom element callback failed for ${i}`)}return t.apply(this,[i,n,s])}}):()=>{}}(t));for(const e of t.plugins)r.push(e.observer(e.callback,i,e.options))}catch(t){try{o()}catch(t){}throw t}return o}function kd(t){return void 0!==window[t]}function Sd(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var xd=class{constructor(t){Oh(this,"generateIdFn",void 0),Oh(this,"iframeRemoteIdToLocalIdMap",new WeakMap),Oh(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=t}getId(t,e,i,n){if(0>e)return e;const s=i||this.getRemoteIdToLocalIdMap(t),r=n||this.getLocalIdToRemoteIdMap(t);let o=s.get(e);return void 0===o&&(o=this.generateIdFn(),s.set(e,o),r.set(o,e)),o}getIds(t,e){const i=this.getRemoteIdToLocalIdMap(t),n=this.getLocalIdToRemoteIdMap(t);return e.map(e=>this.getId(t,e,i,n))}getRemoteId(t,e,i){var n;return"number"!=typeof e||0>e?e:null!==(n=(i||this.getLocalIdToRemoteIdMap(t)).get(e))&&void 0!==n?n:-1}getRemoteIds(t,e){const i=this.getLocalIdToRemoteIdMap(t);return e.map(e=>this.getRemoteId(t,e,i))}reset(t){if(!t)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(t),this.iframeLocalIdToRemoteIdMap.delete(t)}getRemoteIdToLocalIdMap(t){let e=this.iframeRemoteIdToLocalIdMap.get(t);return e||(e=new Map,this.iframeRemoteIdToLocalIdMap.set(t,e)),e}getLocalIdToRemoteIdMap(t){let e=this.iframeLocalIdToRemoteIdMap.get(t);return e||(e=new Map,this.iframeLocalIdToRemoteIdMap.set(t,e)),e}},Cd=class{constructor(t){Oh(this,"iframes",new WeakMap),Oh(this,"crossOriginIframeMap",new WeakMap),Oh(this,"crossOriginIframeMirror",new xd(cc)),Oh(this,"crossOriginIframeStyleMirror",void 0),Oh(this,"crossOriginIframeRootIdMap",new WeakMap),Oh(this,"mirror",void 0),Oh(this,"mutationCb",void 0),Oh(this,"wrappedEmit",void 0),Oh(this,"loadListener",void 0),Oh(this,"pageHideListener",void 0),Oh(this,"stylesheetManager",void 0),Oh(this,"recordCrossOriginIframes",void 0),Oh(this,"messageHandler",void 0),Oh(this,"nestedIframeListeners",new Map),Oh(this,"attachedWindows",new WeakMap),Oh(this,"attachedDocuments",new WeakMap),Oh(this,"attachedIframes",new Map),Oh(this,"loadListenerDisposers",new WeakMap),Oh(this,"iframeElementsById",new Map),Oh(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new xd(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}registerLoadListenerDisposer(t,e){let i=this.loadListenerDisposers.get(t);i||(i=new Set,this.loadListenerDisposers.set(t,i)),i.add(e);const n=this.mirror.getId(t);-1!==n&&this.iframeElementsById.set(n,t)}getIframeElementById(t){var e,i,n;return null!==(e=null!==(i=null===(n=this.attachedIframes.get(t))||void 0===n?void 0:n.element)&&void 0!==i?i:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){const e=this.loadListenerDisposers.get(t);e&&(e.forEach(t=>Oc(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{Pc(t,"pagehide",e)}),this.pageHideHandlers.delete(t))}addLoadListener(t){this.loadListener=t}addPageHideListener(t){this.pageHideListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,e){const i=this.mirror.getId(t);return this.attachedIframes.set(i,{element:t,content:e}),i}attachIframe(t,e){var i;const n=this.trackIframeContent(t,e);if(t.contentDocument){let e=this.attachedDocuments.get(t);e||(e=new Set,this.attachedDocuments.set(t,e)),e.add(t.contentDocument)}this.mutationCb({adds:[{parentId:n,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const s=t.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){const e=this.handleMessage.bind(this);Oc(()=>{s.addEventListener("message",e),this.nestedIframeListeners.set(s,e);let i=this.attachedWindows.get(t);i||(i=new Set,this.attachedWindows.set(t,i)),i.add(s)})}Oc(()=>{const e=t.contentWindow;if(!e)return;let i=this.pageHideHandlers.get(t);if(i)for(const t of i)if(t.win===e)return;const n=()=>{var e;null===(e=this.pageHideListener)||void 0===e||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument)};e.addEventListener("pagehide",n),i||(i=new Set,this.pageHideHandlers.set(t,i)),i.add({win:e,handler:n})}),null===(i=this.loadListener)||void 0===i||i.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const e=t;if("rrweb"!==e.data.type||e.origin!==e.data.origin)return;if(!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const n=this.transformCrossOriginEvent(i,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}transformCrossOriginEvent(t,e){switch(e.type){case Bu.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t);const i=e.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(e.data.node,i),this.trackIframeContent(t,e.data.node),{timestamp:e.timestamp,type:Bu.IncrementalSnapshot,data:{source:ju.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Bu.Meta:case Bu.Load:case Bu.DomContentLoaded:return!1;case Bu.Plugin:return e;case Bu.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case Bu.IncrementalSnapshot:switch(e.data.source){case ju.Mutation:return e.data.adds.forEach(e=>{this.replaceIds(e,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(e.node,t);const i=this.crossOriginIframeRootIdMap.get(t);i&&this.patchRootIdOnNode(e.node,i)}),e.data.removes.forEach(e=>{this.replaceIds(e,t,["parentId","id"])}),e.data.attributes.forEach(e=>{this.replaceIds(e,t,["id"])}),e.data.texts.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case ju.Drag:case ju.TouchMove:case ju.MouseMove:return e.data.positions.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case ju.ViewportResize:return!1;case ju.MediaInteraction:case ju.MouseInteraction:case ju.Scroll:case ju.CanvasMutation:case ju.Input:return this.replaceIds(e.data,t,["id"]),e;case ju.StyleSheetRule:case ju.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case ju.Font:return e;case ju.Selection:return e.data.ranges.forEach(e=>{this.replaceIds(e,t,["start","end"])}),e;case ju.AdoptedStyleSheet:var i;return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),null===(i=e.data.styles)||void 0===i||i.forEach(e=>{this.replaceStyleIds(e,t,["styleId"])}),e}}return!1}replace(t,e,i,n){for(const s of n)(Array.isArray(e[s])||"number"==typeof e[s])&&(e[s]=Array.isArray(e[s])?t.getIds(i,e[s]):t.getId(i,e[s]));return e}replaceIds(t,e,i){return this.replace(this.crossOriginIframeMirror,t,e,i)}replaceStyleIds(t,e,i){return this.replace(this.crossOriginIframeStyleMirror,t,e,i)}replaceIdOnNode(t,e){this.replaceIds(t,e,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(t=>{this.replaceIdOnNode(t,e)})}patchRootIdOnNode(t,e){t.type===Vu.Document||t.rootId||(t.rootId=e),"childNodes"in t&&t.childNodes.forEach(t=>{this.patchRootIdOnNode(t,e)})}removeIframeById(t){const e=this.attachedIframes.get(t),i=(null==e?void 0:e.element)||this.iframeElementsById.get(t)||this.mirror.getNode(t);if(this.iframeElementsById.delete(t),i){const t=i.contentWindow,e=this.attachedWindows.get(i);e&&(e.forEach(t=>{const e=this.nestedIframeListeners.get(t);e&&(Pc(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(i)),t&&this.nestedIframeListeners.has(t)&&(Pc(t,"message",this.nestedIframeListeners.get(t)),this.nestedIframeListeners.delete(t)),t&&this.crossOriginIframeMap.delete(t),this.iframes.delete(i),this.disposeLoadListeners(i),this.removePageHideListener(i);const n=this.attachedDocuments.get(i);n&&(n.forEach(t=>{Oc(()=>this.mirror.removeNodeFromMap(t))}),Oc(()=>pd(i,n)),this.attachedDocuments.delete(i))}e&&this.attachedIframes.delete(t)}cleanupDetachedIframes(){if(0===this.attachedIframes.size)return;const t=[];this.attachedIframes.forEach((e,i)=>{this.mirror.has(i)||t.push(i)}),t.forEach(t=>this.removeIframeById(t))}reattachIframes(){this.attachedIframes.forEach(({content:t},e)=>{this.mirror.has(e)?this.mutationCb({adds:[{parentId:e,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(e)})}destroy(){this.recordCrossOriginIframes&&Pc(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{Pc(e,"message",t)}),this.nestedIframeListeners.clear();const t=new Set;this.iframeElementsById.forEach(e=>t.add(e)),this.attachedIframes.forEach(({element:e})=>t.add(e)),t.forEach(t=>{this.disposeLoadListeners(t),this.removePageHideListener(t)}),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}},$d=class{constructor(t){Oh(this,"shadowDoms",new WeakSet),Oh(this,"mutationCb",void 0),Oh(this,"scrollCb",void 0),Oh(this,"bypassOptions",void 0),Oh(this,"mirror",void 0),Oh(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,e){var i,n;if(!Dh(t))return;if(this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=null!==(i=null===(n=rh.host(t))||void 0===n?void 0:n.ownerDocument)&&void 0!==i?i:e,{observer:r,buffer:o}=vd(ue(ue({},this.bypassOptions),{},{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push({doc:s,handler(){r.disconnect(),o.destroy(),o.releaseCanvasManager();const t=cd.indexOf(o);-1!==t&&cd.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:fd(ue(ue({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))}),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(rh.host(t))),this.restoreHandlers.push({doc:s,handler:bd({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)})},0)}observeAttachShadow(t){t.contentWindow&&t.contentDocument&&this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,e){const i=this;this.restoreHandlers.push({doc:e,handler:sh(t.prototype,"attachShadow",function(t){return function(n){const s=t.call(this,n),r=rh.shadowRoot(this);return r&&Xc(this)&&i.addShadowRoot(r,e),s}})})}reset(){this.restoreHandlers.forEach(({handler:t})=>{try{t()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){const e=[];for(const i of this.restoreHandlers)if(i.doc===t)try{i.handler()}catch(t){}else e.push(i);this.restoreHandlers=e}},Td="skip-frame";function Ed(t){if("object"!=typeof t||null===t)return!1;const{x:e,y:i,width:n,height:s}=t;return Number.isFinite(e)&&Number.isFinite(i)&&Number.isFinite(n)&&Number.isFinite(s)&&n>=0&&s>=0}for(var Id="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Md="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Rd=0;64>Rd;Rd++)Md[Id.charCodeAt(Rd)]=Rd;var Pd=function(t){var e,i=new Uint8Array(t),n=i.length,s="";for(e=0;n>e;e+=3)s+=Id[i[e]>>2],s+=Id[(3&i[e])<<4|i[e+1]>>4],s+=Id[(15&i[e+1])<<2|i[e+2]>>6],s+=Id[63&i[e+2]];return n%3==2?s=s.substring(0,s.length-1)+"=":n%3==1&&(s=s.substring(0,s.length-2)+"=="),s},Od=new Map,Ad=(t,e,i)=>{if(!t||!Ld(t,e)&&"object"!=typeof t)return;const n=function(t,e){let i=Od.get(t);return i||(i=new Map,Od.set(t,i)),i.has(e)||i.set(e,[]),i.get(e)}(i,t.constructor.name);let s=n.indexOf(t);return-1===s&&(s=n.length,n.push(t)),s};function Fd(t,e,i,n){if(t instanceof Array)return t.map(t=>Fd(t,e,i,n));if(null===t)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer)return{rr_type:t.constructor.name,base64:Pd(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Fd(t.buffer,e,i,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const e=t.constructor.name,{src:i}=t;return{rr_type:e,src:i}}return t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL(n.type,n.quality)}:t instanceof ImageData?{rr_type:t.constructor.name,args:[Fd(t.data,e,i,n),t.width,t.height]}:Ld(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:Ad(t,e,i)}:t}var Dd=(t,e,i,n)=>t.map(t=>Fd(t,e,i,n)),Ld=(t,e)=>{const i=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(t=>"function"==typeof e[t]);return Boolean(i.find(i=>t instanceof e[i]))},Nd=["webgl","webgl2"];function qd(t){return"nodeType"in t}function Bd(t,e,i,n){const s=[];try{if(n){const n=function(t,e,i){const n=t.GPUCanvasContext;if((null==n?void 0:n.prototype)&&"function"==typeof n.prototype.configure)return sh(n.prototype,"configure",function(n){return function(s){const r=function(t){const{canvas:e}=t;return e&&"object"==typeof e?e:null}(this);if(!r||qd(r)&&zc(r,e,i,!0))return n.call(this,s);qd(r)&&!("__context"in r)&&(r.__context="webgpu");const o=function(t){const e=t.GPUTextureUsage;return e?e.COPY_SRC|e.RENDER_ATTACHMENT:null}(t);return n.call(this,null!==o&&s?ue(ue({},s),{},{usage:"number"==typeof s.usage?s.usage|o:o}):s)}})}(t,e,i);n&&s.push(n)}const r=sh(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(s,...r){const o=function(t){return"experimental-webgl"===t?"webgl":t}(s);if(!zc(this,e,i,!0)&&("__context"in this||(this.__context=o),n&&Nd.includes(o)))if(r[0]&&"object"==typeof r[0]){const t=r[0];t.preserveDrawingBuffer||(t.preserveDrawingBuffer=!0)}else r.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[s,...r])}});s.push(r)}catch(t){console.warn("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(t=>t())}}function jd(t,e,i,n,s,r,o){const l=[],a=Object.getOwnPropertyNames(t);for(const u of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))try{if("function"!=typeof t[u])continue;const a=sh(t,u,function(t){return function(...l){const a=t.apply(this,l);if(Ad(a,r,this),this.canvas&&"tagName"in this.canvas&&!zc(this.canvas,n,s,!0)){const t=Dd(l,r,this,o);i(this.canvas,{type:e,property:u,args:t})}return a}});l.push(a)}catch(r){const o=Nc(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!zc(this.canvas,n,s,!0)&&i(this.canvas,{type:e,property:u,args:[t],setter:!0})}});l.push(o)}return l}var Hd='(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',Ud="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Hd],{type:"text/javascript;charset=utf-8"});function zd(t){let e;try{if(e=Ud&&(self.URL||self.webkitURL).createObjectURL(Ud),!e)throw"";const i=new Worker(e,{name:null==t?void 0:t.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),i}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Hd),{name:null==t?void 0:t.name})}}var Wd,Vd,Gd,Zd=class{onFullSnapshot(){var t;null===(t=this.resetFrameDedup)||void 0===t||t.call(this)}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(t){Oh(this,"pendingCanvasMutations",new Map),Oh(this,"rafStamps",{latestId:0,invokeId:null}),Oh(this,"mirror",void 0),Oh(this,"mutationCb",void 0),Oh(this,"resetObservers",void 0),Oh(this,"frozen",!1),Oh(this,"locked",!1),Oh(this,"rafIdTimestamp",null),Oh(this,"rafIdFlush",null),Oh(this,"refCount",0),Oh(this,"torndown",!1),Oh(this,"resetFrameDedup",null),Oh(this,"processMutation",(t,e)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(t)||this.pendingCanvasMutations.set(t,[]),this.pendingCanvasMutations.get(t).push(e)});const{sampling:e="all",win:i,blockClass:n,blockSelector:s,recordCanvas:r,dataURLOptions:o,resolutionScale:l,canvasMasking:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,r&&"all"===e&&this.initCanvasMutationObserver(i,n,s,o),r&&"number"==typeof e&&this.initCanvasFPSObserver(e,i,n,s,{dataURLOptions:o,resolutionScale:l,canvasMasking:a})}initCanvasFPSObserver(t,e,i,n,s){var r=this;if(!("OffscreenCanvas"in e))return;const o="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,l=Bd(e,i,n,!0),a=new Map;let u;try{u=new zd}catch(t){return}let h=!1;u.onerror=()=>{var t;h=!0,cancelAnimationFrame(d),null===(t=u.terminate)||void 0===t||t.call(u),this.resetFrameDedup=null},this.resetFrameDedup=()=>{u.postMessage({resetFrameDedup:!0})},u.onmessage=t=>{const{id:e}=t.data;if(a.set(e,!1),!("base64"in t.data))return;const{base64:i,type:n,displayWidth:s,displayHeight:r}=t.data;this.mutationCb({id:e,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})};const c=1e3/t;let d,v=0;const f=t=>{var l;h||(v&&c>t-v||(v=t,(()=>{const t=[],s=e=>{try{e.querySelectorAll("canvas").forEach(e=>{zc(e,i,n,!0)||t.push(e)}),e.querySelectorAll("*").forEach(t=>{t.shadowRoot&&s(t.shadowRoot)})}catch(t){}};return s(e.document),t})().forEach((l=re(function*(t){const e=r.mirror.getId(t);if(!a.get(e)&&0!==t.width&&0!==t.height){a.set(e,!0);try{if(["webgl","webgl2"].includes(t.__context)){var i,n;const s=t.getContext(t.__context);if(null==s||null===(i=s.isContextLost)||void 0===i?void 0:i.call(s))return void a.set(e,!1);!1===(null==s||null===(n=s.getContextAttributes())||void 0===n?void 0:n.preserveDrawingBuffer)&&s.clear(s.COLOR_BUFFER_BIT)}const r=t.clientWidth||t.width,l=t.clientHeight||t.height,h=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(l*o)),d=function(t,e,i,n,s,r){if(!t||"function"!=typeof t.regionsFn)return;let o;try{o=t.regionsFn(e)}catch(t){return Td}if(void 0===o)return;if(!Array.isArray(o)||!o.every(Ed))return Td;const l=i/s,a=n/r;return o.filter(t=>t.width>0&&t.height>0).map(t=>{const e=Math.floor(t.x*l),i=Math.floor(t.y*a);return{x:e,y:i,width:Math.ceil((t.x+t.width)*l)-e,height:Math.ceil((t.y+t.height)*a)-i}})}(s.canvasMasking,t,h,c,r,l);if("skip-frame"===d)return void a.set(e,!1);const v=yield createImageBitmap(t,1>o?{resizeWidth:h,resizeHeight:c,resizeQuality:"medium"}:{resizeWidth:h,resizeHeight:c});u.postMessage({id:e,bitmap:v,width:h,height:c,displayWidth:r,displayHeight:l,dataURLOptions:s.dataURLOptions,maskRegions:d},[v])}catch(t){a.set(e,!1)}}}),function(t){return l.apply(this,arguments)}))),d=requestAnimationFrame(f))};d=requestAnimationFrame(f),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(d),null===(t=u.terminate)||void 0===t||t.call(u),this.resetFrameDedup=null}}initCanvasMutationObserver(t,e,i,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=Bd(t,e,i,!1),r=function(t,e,i,n,s){const r=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const l of o)try{if("function"!=typeof e.CanvasRenderingContext2D.prototype[l])continue;const o=sh(e.CanvasRenderingContext2D.prototype,l,function(r){return function(...o){return zc(this.canvas,i,n,!0)||setTimeout(()=>{const i=Dd(o,e,this,s);t(this.canvas,{type:zu["2D"],property:l,args:i})},0),r.apply(this,o)}});r.push(o)}catch(s){const o=Nc(e.CanvasRenderingContext2D.prototype,l,{set(e){zc(this.canvas,i,n,!0)||t(this.canvas,{type:zu["2D"],property:l,args:[e],setter:!0})}});r.push(o)}return()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,i,n),o=function(t,e,i,n,s){const r=[];return void 0!==e.WebGLRenderingContext&&r.push(...jd(e.WebGLRenderingContext.prototype,zu.WebGL,t,i,n,e,s)),void 0!==e.WebGL2RenderingContext&&r.push(...jd(e.WebGL2RenderingContext.prototype,zu.WebGL2,t,i,n,e,s)),()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,i,n);this.resetObservers=()=>{s(),r(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,e)=>{const i=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,i)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,e){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(t);if(!i||-1===e)return;const n=i.map(t=>ys(t,qu)),{type:s}=i[0];this.mutationCb({id:e,type:s,commands:n}),this.pendingCanvasMutations.delete(t)}},Qd=class{constructor(t){var e;Oh(this,"trackedLinkElements",new WeakSet),Oh(this,"pendingDeferredSheets",new Set),Oh(this,"mutationCb",void 0),Oh(this,"adoptedStyleSheetCb",void 0),Oh(this,"maskAllElementAttributes",void 0),Oh(this,"maskAttributeFn",void 0),Oh(this,"styleMirror",new Kc),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(e=t.maskAllElementAttributes)&&void 0!==e&&e,this.maskAttributeFn=t.maskAttributeFn}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}beginDeferredLinkInlining(t,e){if(-1===e||!t.isConnected)return null;let i=null,n=null;try{n=t.sheet,n&&(i=Gh(n))}catch(t){}if(!i||!n)return Mh(),null;const s=i;let r=!1;const o={sheet:n,invalidate(){r=!0}};this.pendingDeferredSheets.add(o);let l=!1;return{advance:i=>{if(l)return!0;const a=oh(),u=uh();let h=!0;try{if(r)return l=!0,Mh(),!0;if(!s.advance(i))return h=!1,!1;l=!0;const o=s.text();if(!t.isConnected)return!0;let a=null;try{a=t.sheet}catch(t){}return a!==n?(Mh(),!0):o?(this.emitCssTextMutation(t,e,o),!0):(Mh(),!0)}finally{h&&this.pendingDeferredSheets.delete(o),hh(c=oh()-a,null!=(d=u)?d:lh)||(wh.totalMs+=c,c>wh.slowestSliceMs&&(wh.slowestSliceMs=c))}var c,d},remainingRules:()=>s.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(t){if(t&&0!==this.pendingDeferredSheets.size)for(const e of this.pendingDeferredSheets)e.sheet===t&&(this.pendingDeferredSheets.delete(e),e.invalidate())}inlineDeferredLinkElement(t,e){var i;null===(i=this.beginDeferredLinkInlining(t,e))||void 0===i||i.advance(1/0)}emitCssTextMutation(t,e,i){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e,attributes:{_cssText:Yh({element:t,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){if(0===t.length)return;const i={id:e,styleIds:[]},n=[];for(const e of t){let t;if(this.styleMirror.has(e))t=this.styleMirror.getId(e);else{const i=this.styleMirror.add(e);t=i;const s=oh();try{$h(()=>{try{const t=e.rules||e.cssRules;t&&Ch(t)}catch(t){}n.push({styleId:i,rules:Array.from(e.rules||CSSRule,(t,i)=>({rule:jh(t,e.href),index:i}))})})}finally{Th(oh()-s)}}i.styleIds.push(t)}n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),Sc.forEach(t=>t.abort()),Sc.clear()}trackStylesheetInLinkElement(t){}},Jd=class{constructor(){Oh(this,"nodeMap",new WeakMap),Oh(this,"active",!1)}inOtherBuffer(t,e){const i=this.nodeMap.get(t);return i&&Array.from(i).some(t=>t!==e)}add(t,e){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(e))}destroy(){}},Kd=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var Yd;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(Yd=t.contentWindow)||void 0===Yd?void 0:Yd.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var Xd=new Zh,tv=new Set([ju.Mutation,ju.MediaInteraction,ju.StyleSheetRule,ju.CanvasMutation,ju.Font,ju.Log,ju.StyleDeclaration,ju.AdoptedStyleSheet]);function ev(t){const e=window;if("function"==typeof e.requestIdleCallback){const i=e.requestIdleCallback(t,{timeout:2e3});return{cancel(){var t;return null===(t=e.cancelIdleCallback)||void 0===t?void 0:t.call(e,i)}}}const i=setTimeout(t,250);return{cancel:()=>clearTimeout(i)}}function iv(t={}){let e;const{emit:i,checkoutEveryNms:n,checkoutEveryNth:s,blockClass:r="rr-block",blockSelector:o=null,ignoreClass:l="rr-ignore",ignoreSelector:a=null,maskTextClass:u="rr-mask",maskTextSelector:h=null,inlineStylesheet:c=!0,inlineStylesheetBudgetRules:d,maskAllInputs:v,maskInputOptions:f,slimDOMOptions:p,maskInputFn:g,maskTextFn:m,maskAllElementAttributes:y=!1,maskAttributeFn:_,hooks:b,packFn:w,sampling:k={},dataURLOptions:S={},canvasResolutionScale:x,canvasMasking:C,mousemoveWait:T,recordDOM:E=!0,recordCanvas:I=!1,recordCrossOriginIframes:M=!1,recordAfter:R=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:P=!1,collectFonts:O=!1,inlineImages:A=!1,plugins:F,keepIframeSrcFn:D=()=>!1,ignoreCSSAttributes:L=new Set([]),attributeFilter:N,errorHandler:q}=t;ad(q);const B=ue({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},S),j=!M||window.parent===window;let H=!1;if(!j)try{window.parent.document&&(H=!1)}catch(t){H=!0}if(j&&!i)throw new Error("emit function is required");if(!j&&!H)return()=>{};void 0!==T&&void 0===k.mousemove&&(k.mousemove=T),Xd.reset();const U=!0===v?{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},z=Ic(void 0!==p&&p);let W;!function(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();let V=0;const G=new Map;let Z,Q;const J=t=>{for(const e of F||[])e.eventProcessor&&(t=e.eventProcessor(t));return w&&!H&&(t=w(t)),t};Wd=(t,e)=>{var r;const o=t;if(o.timestamp=qc(),!(null===(r=cd[0])||void 0===r?void 0:r.isFrozen())||o.type===Bu.FullSnapshot||o.type===Bu.IncrementalSnapshot&&tv.has(o.data.source)||cd.forEach(t=>t.unfreeze()),j)null==i||i(J(o),e);else if(H){const t={type:"rrweb",event:J(o),origin:window.location.origin,isCheckout:e};window.parent.postMessage(t,"*")}if(o.type===Bu.FullSnapshot)W=o,V=0;else if(o.type===Bu.IncrementalSnapshot){if(o.data.source===ju.Mutation&&o.data.isAttachIframe)return;V++,(s&&V>=s||n&&o.timestamp-W.timestamp>n)&&Vd(!0)}};const K=t=>{if(t.removes&&t.removes.length>0){const e=t.adds.length>0?new Set(t.adds.map(t=>t.node.id)):null,i=new Set;if(t.adds.length>0)for(const e of t.adds){const t=Xd.getNode(e.node.id);t&&"IFRAME"===t.nodeName&&i.add(t)}t.removes.forEach(({id:t})=>{if(e&&e.has(t))return;const n=et.getIframeElementById(t);n&&i.has(n)?et.forgetIframeId(t):(null==Z||Z(t),et.removeIframeById(t))}),null==Q||Q(),et.cleanupDetachedIframes()}Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.Mutation},t)})},Y=t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.Scroll},t)}),X=t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.CanvasMutation},t)}),tt=new Qd({mutationCb:K,adoptedStyleSheetCb:t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.AdoptedStyleSheet},t)}),maskAllElementAttributes:y,maskAttributeFn:_}),et=new Cd({mirror:Xd,mutationCb:K,stylesheetManager:tt,recordCrossOriginIframes:M,wrappedEmit:Wd});for(const t of F||[])t.getMirror&&t.getMirror({nodeMirror:Xd,crossOriginIframeMirror:et.crossOriginIframeMirror,crossOriginIframeStyleMirror:et.crossOriginIframeStyleMirror});const it=new Jd,nt=null==C?void 0:C.configured;Gd=new Zd({recordCanvas:I,mutationCb:X,win:window,blockClass:r,blockSelector:o,mirror:Xd,sampling:k.canvas,dataURLOptions:B,resolutionScale:x,canvasMasking:C});const st=new $d({mutationCb:K,scrollCb:Y,bypassOptions:{blockClass:r,blockSelector:o,maskTextClass:u,maskTextSelector:h,inlineStylesheet:c,maskInputOptions:U,dataURLOptions:B,maskTextFn:m,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:_,recordCanvas:I,canvasMaskingConfigured:nt,inlineImages:A,sampling:k,slimDOMOptions:z,iframeManager:et,stylesheetManager:tt,canvasManager:Gd,keepIframeSrcFn:D,processedNodeManager:it,attributeFilter:N},mirror:Xd});Vd=(t=!1)=>{if(E){kh(d);try{Wd({type:Bu.Meta,data:{href:window.location.href,width:Hc(),height:jc()}},t),null==e||e.cancel(),e=void 0,tt.reset(),st.init(),cd.forEach(t=>t.lock());let i=null,n=[];try{i=function(t,e){const{mirror:i=new Zh,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:u=!1,canvasMaskingConfigured:h,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f=!1,maskAttributeFn:p,slimDOM:g=!1,dataURLOptions:m,preserveWhiteSpace:y,onSerialize:_,onIframeLoad:b,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C=()=>!1,maxDepth:T,inlineStylesheetBudgetRules:E}=e||{},I=!0===c?{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===c?{password:!0}:c,M=Ic(g);kh(E);try{return Ec(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:I,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f,maskAttributeFn:p,slimDOMOptions:M,dataURLOptions:m,inlineImages:a,recordCanvas:u,canvasMaskingConfigured:h,preserveWhiteSpace:y,onSerialize:_,onIframeLoad:b,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C,newlyAddedElement:!1,maxDepth:T})}finally{Sh()}}(document,{mirror:Xd,blockClass:r,blockSelector:o,maskTextClass:u,maskTextSelector:h,inlineStylesheet:c,maskAllInputs:U,inlineStylesheetBudgetRules:d,maskTextFn:m,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:_,slimDOM:z,dataURLOptions:B,recordCanvas:I,canvasMaskingConfigured:nt,inlineImages:A,onSerialize(t){Zc(t,Xd)&&et.addIframe(t),Qc(t,Xd)&&tt.trackLinkElement(t),Jc(t)&&st.addShadowRoot(rh.shadowRoot(t),document)},onIframeLoad(t,e){et.attachIframe(t,e),st.observeAttachShadow(t)},onIframeListenerRegistered(t,e){et.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){tt.attachLinkElement(t,e)},keepIframeSrcFn:D})}finally{n=Ih()}if(!i)return console.warn("Failed to snapshot the document");if(Wd({type:Bu.FullSnapshot,data:{node:i,initialOffset:Bc(window)}},t),cd.forEach(t=>t.unlock()),Gd.onFullSnapshot(),n.length){const t=function(t,e,i){let n=!1,s=null,r=0,o=null;const l=()=>null!==o||t.length>r,a=()=>{const i=t[r];t[r]=null,r+=1,i&&Oc(()=>{o=e.beginDeferredLinkInlining(i,Xd.getId(i))})},u=()=>{if(!o)return;const t=o;let e=!0;Oc(()=>{e=t.advance(200)}),e&&(o=null)},h=()=>{o||a(),u()},c=t=>{if(s=null,n)return;let e=0;do{try{h()}catch(t){null==o||o.discard(),o=null,Rh(1)}e+=1}while(!n&&l()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));n||(l()?s=ev(c):i())};return s=ev(c),{cancel(){n=!0,null==o||o.discard(),o=null,null==s||s.cancel(),s=null},flush(){if(n)return;n=!0,null==s||s.cancel(),s=null;let e=0,h=0;for(;l()&&50>e;){o||a();const t=o;if(t)if(Math.floor(t.remainingRules()/200)+1>50-e)t.discard(),o=null,h+=1;else{try{u()}catch(t){null==o||o.discard(),o=null,h+=1}e+=1}}if(l()||h>0){let e=h+(null!==o?1:0);for(let i=r;t.length>i;i++)null!==t[i]&&(e+=1);Rh(e),null==o||o.discard(),o=null}i()}}}(n,tt,()=>{e===t&&(e=void 0)});e=t}M&&et.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&tt.adoptStyleSheets(document.adoptedStyleSheets,Xd.getId(document))}finally{Sh()}}};try{const t=[];t.push(Rc("pagehide",()=>{try{null==e||e.flush()}catch(t){}e=void 0},window));for(const e of["visibilitychange","freeze","resume"])t.push(Rc(e,ah,document));Z=e=>{const i=G.get(e);i&&(i.forEach(e=>{Oc(e);const i=t.indexOf(e);-1!==i&&t.splice(i,1)}),G.delete(e))},Q=()=>{for(const[t]of G){const e=Xd.getNode(t);if(e)try{e.contentDocument&&e.contentDocument.defaultView||null==Z||Z(t)}catch(e){null==Z||Z(t)}else null==Z||Z(t)}};const i=t=>{var e;return hd(wd)({mutationCb:K,mousemoveCb:(t,e)=>Wd({type:Bu.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.MouseInteraction},t)}),scrollCb:Y,viewportResizeCb:t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.ViewportResize},t)}),inputCb:t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.Input},t)}),mediaInteractionCb:t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.MediaInteraction},t)}),styleSheetRuleCb:t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.StyleSheetRule},t)}),styleDeclarationCb:t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.StyleDeclaration},t)}),canvasMutationCb:X,fontCb:t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.Font},t)}),selectionCb(t){Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.Selection},t)})},customElementCb(t){Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.CustomElement},t)})},blockClass:r,ignoreClass:l,ignoreSelector:a,maskTextClass:u,maskTextSelector:h,maskInputOptions:U,inlineStylesheet:c,sampling:k,recordDOM:E,recordCanvas:I,canvasMaskingConfigured:nt,inlineImages:A,userTriggeredOnInput:P,collectFonts:O,doc:t,maskInputFn:g,maskTextFn:m,maskAllElementAttributes:y,maskAttributeFn:_,keepIframeSrcFn:D,blockSelector:o,slimDOMOptions:z,dataURLOptions:B,mirror:Xd,iframeManager:et,stylesheetManager:tt,shadowDomManager:st,processedNodeManager:it,canvasManager:Gd,ignoreCSSAttributes:L,attributeFilter:N,plugins:(null==F||null===(e=F.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({observer:t.observer,options:t.options,callback:e=>Wd({type:Bu.Plugin,data:{plugin:t.name,payload:e}})})))||[]},b)};et.addLoadListener(e=>{try{const n=Xd.getId(e),s=i(e.contentDocument);if("function"==typeof s&&(t.push(s),-1!==n)){let t=G.get(n);t||(t=new Set,G.set(n,t)),t.add(s)}}catch(t){console.warn(t)}}),et.addPageHideListener(t=>{const e=Xd.getId(t);null==Z||Z(e),pd(t)});let n=-1;const s=t=>Wd({type:Bu.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),d=()=>{var t,e,i,r;const o=document,l=null!==(t=null!==(e=null!==(i=null!==(r=o.fullscreenElement)&&void 0!==r?r:o.webkitFullscreenElement)&&void 0!==i?i:o.mozFullScreenElement)&&void 0!==e?e:o.msFullscreenElement)&&void 0!==t?t:null,a=l?Xd.getId(l):-1;a!==n&&(-1!==n&&s({id:n,enter:!1}),n=a,-1!==a&&s({id:a,enter:!0}))},v=()=>{Vd();const e=i(document);"function"==typeof e&&t.push(e),t.push(Rc("fullscreenchange",d)),t.push(Rc("webkitfullscreenchange",d)),t.push(Rc("mozfullscreenchange",d)),t.push(Rc("MSFullscreenChange",d)),Kd=!0};return["interactive","complete"].includes(document.readyState)?v():(t.push(Rc("DOMContentLoaded",()=>{Wd({type:Bu.DomContentLoaded,data:{}}),"DOMContentLoaded"===R&&v()})),t.push(Rc("load",()=>{Wd({type:Bu.Load,data:{}}),"load"===R&&v()},window))),()=>{try{null==e||e.flush()}catch(t){}e=void 0,Ac(t),it.destroy(),et.removeLoadListener(),et.destroy(),G.clear(),st.reset(),Xd.reset(),Kd=!1,ud()}}catch(t){console.warn(t)}}iv.addCustomEvent=(t,e)=>{if(!Kd)throw new Error("please add custom event after start recording");Wd({type:Bu.Custom,data:{tag:t,payload:e}})},iv.freezePage=()=>{cd.forEach(t=>t.freeze())},iv.takeFullSnapshot=t=>{if(!Kd)throw new Error("please take full snapshot after start recording");Vd(t)},iv.mirror=Xd,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var nv=Object.create(null);function sv(t){return sv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sv(t)}function rv(t,e,i){return(e=function(t){var e=function(t){if("object"!=sv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=sv(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==sv(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}nv.Node=Object.create(null),nv.ShadowRoot=Object.create(null),nv.MutationObserver=Object.create(null),nv.Element=Object.create(null);var ov=class{constructor(t){rv(this,"fileName",void 0),rv(this,"functionName",void 0),rv(this,"lineNumber",void 0),rv(this,"columnNumber",void 0),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){const t=this.lineNumber||"",e=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${t}:${e})`:`${this.fileName}:${t}:${e}`}},lv=/(^|@)\S+:\d+/,av=/^\s*at .*(\S+:\d+|\(native\))/m,uv=/^(eval@)?(\[native code])?$/,hv={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(av)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):[]:[]},extractLocation(t){if(-1===t.indexOf(":"))return[t];const e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));if(!e)throw new Error(`Cannot parse given url: ${t}`);return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE(t){return t.stack.split("\n").filter(function(t){return!!t.match(av)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let e=t.replace(/^\s+/,"").replace(/\(eval code/g,"(");const i=e.match(/ (\((.+):(\d+):(\d+)\)$)/);e=i?e.replace(i[0],""):e;const n=e.split(/\s+/).slice(1),s=this.extractLocation(i?i[1]:n.pop());return new ov({functionName:n.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(s[0])>-1?void 0:s[0],lineNumber:s[1],columnNumber:s[2]})},this)},parseFFOrSafari(t){return t.stack.split("\n").filter(function(t){return!t.match(uv)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new ov({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(e),n=i&&i[1]?i[1]:void 0,s=this.extractLocation(t.replace(e,""));return new ov({functionName:n,fileName:s[0],lineNumber:s[1],columnNumber:s[2]})}},this)},parseOpera(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9(t){const e=/Line (\d+).*script (?:in )?(\S+)/i,i=t.message.split("\n"),n=[];for(let t=2,s=i.length;s>t;t+=2){const s=e.exec(i[t]);s&&n.push(new ov({fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera10(t){const e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=t.stacktrace.split("\n"),n=[];for(let t=0,s=i.length;s>t;t+=2){const s=e.exec(i[t]);s&&n.push(new ov({functionName:s[3]||void 0,fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera11(t){return t.stack.split("\n").filter(function(t){return!!t.match(lv)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),i=this.extractLocation(e.pop());return new ov({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function cv(t){if(!t||!t.outerHTML)return"";let e="";for(;t.parentElement;){let i=t.localName;if(!i)break;i=i.toLowerCase();const n=t.parentElement,s=[];if(n.children&&n.children.length>0)for(let t=0;n.children.length>t;t++){const e=n.children[t];e.localName&&e.localName.toLowerCase&&e.localName.toLowerCase()===i&&s.push(e)}s.length>1&&(i+=`:eq(${s.indexOf(t)})`),e=i+(e?">"+e:""),t=n}return e}function dv(t){return Array.isArray(t)}function vv(t){return"object"==typeof t&&null!==t&&!dv(t)}function fv(t,e){if(0===e)return!0;const i=Object.keys(t);for(const n of i)if(vv(t[n])&&fv(t[n],e-1))return!0;return!1}function pv(t,e){const i={numOfKeysLimit:50,depthOfLimit:4};Object.assign(i,e);const n=[],s=[];return JSON.stringify(t,function(t,e){if(n.length>0){const i=n.indexOf(this);~i?n.splice(i+1):n.push(this),~i?s.splice(i,1/0,t):s.push(t),~n.indexOf(e)&&(e=n[0]===e?"[Circular ~]":"[Circular ~."+s.slice(0,n.indexOf(e)).join(".")+"]")}else n.push(e);if(null===e)return e;if(void 0===e)return"undefined";if(vv(r=e)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||vv(r)&&fv(r,i.depthOfLimit))return function(t){let e=t.toString();return i.stringLengthLimit&&e.length>i.stringLengthLimit&&(e=`${e.slice(0,i.stringLengthLimit)}...`),e}(e);var r;if("bigint"==typeof e)return e.toString()+"n";if(e instanceof Event){const t={};for(const i in e){const n=e[i];t[i]=dv(n)?cv(n.length?n[0]:null):n}return t}return e instanceof Node?e instanceof HTMLElement?e?e.outerHTML:"":e.nodeName:e instanceof Error?e.stack?e.stack+"\nEnd of stack for Error object":e.name+": "+e.message:e})}var gv={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 mv(t,e,i){const n=i?Object.assign({},gv,i):gv,s=n.logger;if(!s)return()=>{};let r;r="string"==typeof s?e[s]:s;let o=0,l=!1,a=!0;const u=[];if(n.level.includes("error")){const i=e=>{const i=e.message;t({level:"error",trace:hv.parse(e.error).map(t=>t.toString()),payload:[pv(i,n.stringifyOptions)]})};e.addEventListener("error",i),u.push(()=>{e.removeEventListener("error",i)});const s=e=>{let i,s;e.reason instanceof Error?(i=e.reason,s=[pv(`Uncaught (in promise) ${i.name}: ${i.message}`,n.stringifyOptions)]):(i=new Error,s=[pv("Uncaught (in promise)",n.stringifyOptions),pv(e.reason,n.stringifyOptions)]),t({level:"error",trace:hv.parse(i).map(t=>t.toString()),payload:s})};e.addEventListener("unhandledrejection",s),u.push(()=>{e.removeEventListener("unhandledrejection",s)})}for(const t of n.level)u.push(h(r,t));return()=>{a=!1,u.forEach(t=>t())};function h(e,i){return e[i]?function(s,r){try{if(!(r in s))return()=>{};const u=s[r],h={next:u},c=(s=>(...r)=>{if(s.apply(e,r),a&&!("assert"===i&&r[0]||l)){l=!0;try{const e=hv.parse(new Error).map(t=>t.toString()).splice(1),s=("assert"===i?r.slice(1):r).map(t=>pv(t,n.stringifyOptions));o++,n.lengthThreshold>o?t({level:i,trace:e,payload:s}):o===n.lengthThreshold&&t({level:"warn",trace:[],payload:[pv("The number of log records reached the threshold.")]})}catch(t){s.apply(e,["rrweb logger error:",t,...r])}finally{l=!1}}})(function(...t){return h.next.apply(this,t)});return"function"==typeof c&&(c.prototype=c.prototype||{},Object.defineProperties(c,{__rrweb_original__:{enumerable:!1,value:u},__rrweb_layer__:{enumerable:!1,value:h}})),s[r]=c,()=>{if(s[r]===c)return void(s[r]=h.next);const t=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let e=s[r],i=t(e);for(;i;){if(i.next===c)return void(i.next=h.next);e=i.next,i=t(e)}}}catch(t){return()=>{}}}(e,i):()=>{}}}var yv=t=>({name:"rrweb/console@1",observer:mv,options:t});const _v=()=>{},bv=t=>{var e;if(xe(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function wv(t,e,i){try{if(!(e in t))return _v;const n={next:t[e]},s=i(function(...t){return n.next.apply(this,t)});return xe(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:n}})),t[e]=s,()=>{if(t[e]===s)return void(t[e]=n.next);let i=t[e],r=bv(i);for(;r;){if(r.next===s)return void(r.next=n.next);i=r.next,r=bv(i)}}}catch(t){return _v}}function kv(t,e){var i;const n=function(t){try{return"string"==typeof t?new URL(t).hostname:"url"in t?new URL(t.url).hostname:t.hostname}catch(t){return null}}(t),s={hostname:n,isHostDenied:!1};if(!(null===(i=e.payloadHostDenyList)||void 0===i?void 0:i.length)||!(null==n?void 0:n.trim().length))return s;for(const t of e.payloadHostDenyList)if(n.endsWith(t))return{hostname:n,isHostDenied:!0};return s}const Sv=Gs("[Recorder]"),xv=t=>"navigation"===t.entryType,Cv=t=>"resource"===t.entryType;function $v(t,e){return!!e&&(Ae(e)||e[t])}function Tv(t){if("undefined"==typeof Request)return!1;if(t instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(t)}catch(t){return!1}}const Ev=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function Iv({type:t,recordBody:e,headers:i,url:n}){function s(t){const e=Object.keys(i).find(t=>"content-type"===t.toLowerCase()),n=e&&i[e];return t.some(t=>null==n?void 0:n.toLowerCase().includes(t))}if(!e)return!1;if(function t(e){try{return"string"==typeof e?e.startsWith("blob:"):e instanceof URL?"blob:"===e.protocol:!!Tv(e)&&t(e.url)}catch(t){return!1}}(n))return!1;if(s(Ev))return!1;if(Ae(e))return!0;if(Se(e))return s(e);const r=e[t];return Ae(r)?r:s(r)}function Mv(t,e,i,n,s){return Rv.apply(this,arguments)}function Rv(){return Rv=re(function*(t,e,i,n,s,r=0){if(r>10)return Sv.warn("Failed to get performance entry for request",{url:i,initiatorType:e}),null;const o=function(t,e){for(let i=t.length-1;i>=0;i-=1)if(e(t[i]))return t[i]}(t.performance.getEntriesByName(i),t=>Cv(t)&&t.initiatorType===e&&(Te(n)||t.startTime>=n)&&(Te(s)||s>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*r)),Mv(t,e,i,n,s,r+1))}),Rv.apply(this,arguments)}function Pv({body:t,options:e,url:i}){if(Re(t))return null;const{hostname:n,isHostDenied:s}=kv(i,e);if(s)return n+" is in deny list";if(Ee(t))return t;if((t=>"u">typeof Document&&t instanceof Document)(t))return t.textContent;if(Fe(t))return ar(t);if(Ce(t))try{return JSON.stringify(t)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}const Ov=t=>!Me(t)&&("navigation"===t.entryType||"resource"===t.entryType);function Av({entry:t,method:e,status:i,networkRequest:n,isInitial:s,start:r,end:o,url:l,initiatorType:a}){r=t?t.startTime:r,o=t?t.responseEnd:o;const u=Math.floor(Date.now()-performance.now()),h=Math.floor(u+(r||0)),c=[ue(ue({},t?t.toJSON():{name:l}),{},{startTime:Te(r)?void 0:Math.round(r),endTime:Te(o)?void 0:Math.round(o),timeOrigin:u,timestamp:h,method:e,initiatorType:a||(t?t.initiatorType:void 0),status:i,requestHeaders:n.requestHeaders,requestBody:n.requestBody,responseHeaders:n.responseHeaders,responseBody:n.responseBody,isInitial:s})];if(Ov(t))for(const e of t.serverTiming||[])c.push({timeOrigin:u,timestamp:h,startTime:Math.round(t.startTime),name:e.name,duration:e.duration,entryType:"serverTiming"});return c}const Fv=["video/","audio/"];function Dv(t){return Ce(t)&&xe(t.getReader)&&xe(t.tee)}const Lv="[SessionReplay] Timeout while trying to read body",Nv="[SessionReplay] Failed to read body";function qv(t){return`${Nv}: ${t}`}function Bv(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function jv(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const i=setTimeout(()=>e(Lv),500);try{t.clone().text().then(t=>e(t),t=>e(qv(t))).finally(()=>clearTimeout(i))}catch(t){clearTimeout(i),e(Nv)}})}(t);const i=no(e);return function(t,e){try{var i,n;const s=null===(i=t.headers)||void 0===i||null===(n=i.get)||void 0===n?void 0:n.call(i,"content-length");if(!s)return!1;const r=parseInt(s,10);return Number.isFinite(r)&&r>e}catch(t){return!1}}(t,i)?Promise.resolve(Bv(i)):function(t,e){return new Promise(i=>{let n,s=!1;function r(){try{null==n||n.cancel().catch(()=>{})}catch(t){}}function o(t){s||(s=!0,clearTimeout(l),r(),i(t))}const l=setTimeout(()=>o(Lv),500);let a;try{a=t.clone()}catch(t){return void o(Nv)}const u=a.body;if(!Dv(u)||"undefined"==typeof TextDecoder){try{a.text().then(t=>o(t),t=>o(qv(t)))}catch(t){o(Nv)}return}try{n=u.getReader()}catch(t){return void o(Nv)}const h=[];let c=0;!function t(){n.read().then(({done:i,value:n})=>{if(s)r();else if(i)o((new TextDecoder).decode(function(t,e){const i=new Uint8Array(e);let n=0;for(const e of t)i.set(e,n),n+=e.byteLength;return i}(h,c)));else{if(n){if(c+n.byteLength>e)return void o(Bv(e));c+=n.byteLength,h.push(n)}t()}},t=>o(qv(t)))}()})}(t,i)}function Hv(){return Hv=re(function*({r:t,options:e,url:i}){const{hostname:n,isHostDenied:s}=kv(i,e);return s?Promise.resolve(n+" is in deny list"):jv(t,e)}),Hv.apply(this,arguments)}function Uv(){return Uv=re(function*({r:t,options:e,url:i}){const n=function({r:t,options:e,url:i}){var n;if("chunked"===t.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";const s=null===(n=t.headers.get("Content-Type"))||void 0===n?void 0:n.toLowerCase(),r=Fv.some(t=>null==s?void 0:s.startsWith(t));if(s&&r)return`Content-Type ${s} is not supported`;const{hostname:o,isHostDenied:l}=kv(i,e);return l?o+" is in deny list":null}({r:t,options:e,url:i});return Me(n)?jv(t,e):Promise.resolve(n)}),Uv.apply(this,arguments)}let zv=null;function Wv(t,e,i){if(!("performance"in e))return()=>{};if(zv)return Sv.warn("Network observer already initialised, doing nothing"),()=>{};const n=i?Object.assign({},so,i):so;let s=!0;const r=e=>{if(!s)return;const i=[];let r=!1;e.requests.forEach(t=>{const e="serverTiming"===t.entryType;if(e&&r)return;const s=n.maskRequestFn(t);e||(r=!s||(t=>!!t&&vo.has(t))(s)),s&&i.push(s)}),i.length>0&&t(ue(ue({},e),{},{requests:i}))},o=function(t,e,i){i.recordInitialRequests&&t({requests:e.performance.getEntries().filter(t=>xv(t)||Cv(t)&&i.initiatorTypes.includes(t.initiatorType)).flatMap(t=>Av({entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0});const n=new e.PerformanceObserver(e=>{t({requests:e.getEntries().filter(t=>xv(t)||Cv(t)&&i.initiatorTypes.includes(t.initiatorType)&&(t=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>Av({entry:t,method:void 0,status:void 0,networkRequest:{}}))})}),s=PerformanceObserver.supportedEntryTypes.filter(t=>i.performanceEntryTypeToObserve.includes(t));return n.observe({entryTypes:s}),()=>{n.disconnect()}}(r,e,n);let l=()=>{},a=()=>{};return(n.recordHeaders||n.recordBody)&&(l=function(t,e,i){if(!i.initiatorTypes.includes("xmlhttprequest"))return()=>{};const n=$v("request",i.recordHeaders),s=$v("response",i.recordHeaders),r=wv(e.XMLHttpRequest.prototype,"open",r=>function(o,l,a=!0,u,h){const c=this;try{const r=new Request(l),a={};let u,h;const d={},v=c.setRequestHeader.bind(c);c.setRequestHeader=(t,e)=>(d[t]=e,v(t,e)),n&&(a.requestHeaders=d);const f=c.send.bind(c);c.send=t=>(Iv({type:"request",headers:d,url:l,recordBody:i.recordBody})&&(a.requestBody=Pv({body:t,options:i,url:l})),u=e.performance.now(),f(t));const p=()=>{c.removeEventListener("readystatechange",g),c.removeEventListener("error",p),c.removeEventListener("abort",p),c.removeEventListener("timeout",p)},g=()=>{if(c.readyState!==c.DONE)return;p(),h=e.performance.now();const n={};c.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(t=>{const e=t.split(": "),i=e.shift(),s=e.join(": ");i&&(n[i]=s)}),s&&(a.responseHeaders=n),Iv({type:"response",headers:n,url:l,recordBody:i.recordBody})&&(a.responseBody=Pv({body:c.response,options:i,url:l})),Mv(e,"xmlhttprequest",r.url,u,h).then(e=>{t({requests:Av({entry:e,method:o,status:null==c?void 0:c.status,networkRequest:a,start:u,end:h,url:l.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};c.addEventListener("readystatechange",g),c.addEventListener("error",p),c.addEventListener("abort",p),c.addEventListener("timeout",p)}catch(t){Sv.error("Failed to instrument XHR for network capture",t)}r.call(c,o,l.toString(),a,u,h)});return()=>{r()}}(r,e,n),a=function(t,e,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=$v("request",i.recordHeaders),s=$v("response",i.recordHeaders),r=wv(e,"fetch",r=>function(){var o=re(function*(o,l){let a,u;try{a=new Request(o,l)}catch(t){return Sv.error("Failed to instrument fetch for network capture",t),r(o,l)}const h={};let c,d;try{try{const t={};a.headers.forEach((e,i)=>{t[i]=e}),n&&(h.requestHeaders=t),!Dv(null==l?void 0:l.body)&&Iv({type:"request",headers:t,url:o,recordBody:i.recordBody})&&(h.requestBody=yield function(t){return Hv.apply(this,arguments)}({r:a,options:i,url:o}))}catch(t){Sv.error("Failed to record fetch request for network capture",t)}c=e.performance.now(),u=Tv(o)?yield r(a):yield r(o,l),d=e.performance.now();try{const t={};u.headers.forEach((e,i)=>{t[i]=e}),s&&(h.responseHeaders=t),Iv({type:"response",headers:t,url:o,recordBody:i.recordBody})&&(h.responseBody=yield function(t){return Uv.apply(this,arguments)}({r:u,options:i,url:o}))}catch(t){Sv.error("Failed to record fetch response for network capture",t)}return u}finally{Mv(e,"fetch",a.url,c,d).then(e=>{t({requests:Av({entry:e,method:a.method,status:null==u?void 0:u.status,networkRequest:h,start:c,end:d,url:a.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(t,e){return o.apply(this,arguments)}}());return()=>{r()}}(r,e,n)),zv=()=>{s=!1,o(),l(),a(),zv=null},zv}const Vv=t=>({name:"rrweb/network@1",observer:Wv,options:t});var Gv,Zv,Qv,Jv,Kv,Yv,Xv,tf,ef,nf,sf,rf,of,lf,af;d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:yv,getRecordNetworkPlugin:Vv},d.__PosthogExtensions__.rrweb={record:iv,version:"v2",wasMaxDepthReached:()=>Tc,resetMaxDepthState(){Tc=!1,$c=!1},getLastSnapshotCost:()=>ph,getMutationCost:()=>ue({},bh),resetSnapshotCostState(){ch=0,dh=0,vh=0,lh=0,fh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},ph=null,gh=null,mh=[],yh=0,_h=0,bh={slowestBatchMs:0},wh={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},d.rrweb={record:iv,version:"v2"},d.rrwebConsoleRecord={getRecordConsolePlugin:yv},d.getRecordNetworkPlugin=Vv,d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initSessionRecording=(t,e)=>new Nu(t,e);var uf,hf,cf,df,vf={},ff=[],pf=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,gf=Array.isArray;function mf(t,e){for(var i in e)t[i]=e[i];return t}function yf(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function _f(t,e,i){var n,s,r,o={};for(r in e)"key"==r?n=e[r]:"ref"==r?s=e[r]:o[r]=e[r];if(arguments.length>2&&(o.children=arguments.length>3?Gv.call(arguments,2):i),"function"==typeof t&&null!=t.defaultProps)for(r in t.defaultProps)void 0===o[r]&&(o[r]=t.defaultProps[r]);return bf(t,o,n,s,null)}function bf(t,e,i,n,s){var r={type:t,props:e,key:i,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==s?++Qv:s,__i:-1,__u:0};return null==s&&null!=Zv.vnode&&Zv.vnode(r),r}function wf(t){return t.children}function kf(t,e){this.props=t,this.context=e}function Sf(t,e){if(null==e)return t.__?Sf(t.__,t.__i+1):null;for(var i;t.__k.length>e;e++)if(null!=(i=t.__k[e])&&null!=i.__e)return i.__e;return"function"==typeof t.type?Sf(t):null}function xf(t){if(t.__P&&t.__d){var e=t.__v,i=e.__e,n=[],s=[],r=mf({},e);r.__v=e.__v+1,Zv.vnode&&Zv.vnode(r),Af(t.__P,r,e,t.__n,t.__P.namespaceURI,32&e.__u?[i]:null,n,null==i?Sf(e):i,!!(32&e.__u),s),r.__v=e.__v,r.__.__k[r.__i]=r,Df(n,r,s),e.__e=e.__=null,r.__e!=i&&Cf(r)}}function Cf(t){if(null!=(t=t.__)&&null!=t.__c)return t.__e=t.__c.base=null,t.__k.some(function(e){if(null!=e&&null!=e.__e)return t.__e=t.__c.base=e.__e}),Cf(t)}function $f(t){(!t.__d&&(t.__d=!0)&&Jv.push(t)&&!Tf.__r++||Kv!=Zv.debounceRendering)&&((Kv=Zv.debounceRendering)||Yv)(Tf)}function Tf(){try{for(var t,e=1;Jv.length;)Jv.length>e&&Jv.sort(Xv),t=Jv.shift(),e=Jv.length,xf(t)}finally{Jv.length=Tf.__r=0}}function Ef(t,e,i,n,s,r,o,l,a,u,h){var c,d,v,f,p,g,m,y=n&&n.__k||ff,_=e.length;for(a=function(t,e,i,n,s){var r,o,l,a,u,h=i.length,c=h,d=0;for(t.__k=new Array(s),r=0;s>r;r++)null!=(o=e[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=t.__k[r]=bf(null,o,null,null,null):gf(o)?o=t.__k[r]=bf(wf,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=t.__k[r]=bf(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):t.__k[r]=o,a=r+d,o.__=t,o.__b=t.__b+1,l=null,-1!=(u=o.__i=Mf(o,i,a,c))&&(c--,(l=i[u])&&(l.__u|=2)),null==l||null==l.__v?(-1==u&&(s>h?d--:h>s&&d++),"function"!=typeof o.type&&(o.__u|=4)):u!=a&&(u==a-1?d--:u==a+1?d++:(u>a?d--:d++,o.__u|=4))):t.__k[r]=null;if(c)for(r=0;h>r;r++)null!=(l=i[r])&&!(2&l.__u)&&(l.__e==n&&(n=Sf(l)),qf(l,l));return n}(i,e,y,a,_),c=0;_>c;c++)null!=(v=i.__k[c])&&(d=-1!=v.__i&&y[v.__i]||vf,v.__i=c,g=Af(t,v,d,s,r,o,l,a,u,h),f=v.__e,v.ref&&d.ref!=v.ref&&(d.ref&&Nf(d.ref,null,v),h.push(v.ref,v.__c||f,v)),null==p&&null!=f&&(p=f),(m=!!(4&v.__u))||d.__k===v.__k?(a=If(v,a,t,m),m&&d.__e&&(d.__e=null)):"function"==typeof v.type&&void 0!==g?a=g:f&&(a=f.nextSibling),v.__u&=-7);return i.__e=p,a}function If(t,e,i,n){var s,r;if("function"==typeof t.type){for(s=t.__k,r=0;s&&s.length>r;r++)s[r]&&(s[r].__=t,e=If(s[r],e,i,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=Sf(t)),i.insertBefore(t.__e,e||null)),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function Mf(t,e,i,n){var s,r,o,l=t.key,a=t.type,u=e[i],h=null!=u&&!(2&u.__u);if(null===u&&null==l||h&&l==u.key&&a==u.type)return i;if(n>(h?1:0))for(s=i-1,r=i+1;s>=0||e.length>r;)if(null!=(u=e[o=0>s?r++:s--])&&!(2&u.__u)&&l==u.key&&a==u.type)return o;return-1}function Rf(t,e,i){"-"==e[0]?t.setProperty(e,null==i?"":i):t[e]=null==i?"":"number"!=typeof i||pf.test(e)?i:i+"px"}function Pf(t,e,i,n,s){var r,o;t:if("style"==e)if("string"==typeof i)t.style.cssText=i;else{if("string"==typeof n&&(t.style.cssText=n=""),n)for(e in n)i&&e in i||Rf(t.style,e,"");if(i)for(e in i)n&&i[e]==n[e]||Rf(t.style,e,i[e])}else if("o"==e[0]&&"n"==e[1])r=e!=(e=e.replace(sf,"$1")),o=e.toLowerCase(),e=o in t||"onFocusOut"==e||"onFocusIn"==e?o.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=i,i?n?i[nf]=n[nf]:(i[nf]=rf,t.addEventListener(e,r?lf:of,r)):t.removeEventListener(e,r?lf:of,r);else{if("http://www.w3.org/2000/svg"==s)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==i?"":i;break t}catch(t){}"function"==typeof i||(null==i||!1===i&&"-"!=e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==i?"":i))}}function Of(t){return function(e){if(this.l){var i=this.l[e.type+t];if(null==e[ef])e[ef]=rf++;else if(i[nf]>e[ef])return;return i(Zv.event?Zv.event(e):e)}}}function Af(t,e,i,n,s,r,o,l,a,u){var h,c,d,v,f,p,g,m,y,_,$,b,w,k,S,x,C=e.type;if(void 0!==e.constructor)return null;128&i.__u&&(a=!!(32&i.__u),r=[l=e.__e=i.__e]),(h=Zv.__b)&&h(e);t:if("function"==typeof C){c=o.length;try{if(y=e.props,_=C.prototype&&C.prototype.render,$=(h=C.contextType)&&n[h.__c],b=h?$?$.props.value:h.__:n,i.__c?m=(d=e.__c=i.__c).__=d.__E:(_?e.__c=d=new C(y,b):(e.__c=d=new kf(y,b),d.constructor=C,d.render=Bf),$&&$.sub(d),d.state||(d.state={}),d.__n=n,v=d.__d=!0,d.__h=[],d._sb=[]),_&&null==d.__s&&(d.__s=d.state),_&&null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=mf({},d.__s)),mf(d.__s,C.getDerivedStateFromProps(y,d.__s))),f=d.props,p=d.state,d.__v=e,v)_&&null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),_&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(_&&null==C.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,b),e.__v==i.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,b)){e.__v!=i.__v&&(d.props=y,d.state=d.__s,d.__d=!1),e.__e=i.__e,e.__k=i.__k,e.__k.some(function(t){t&&(t.__=e)}),ff.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break t}null!=d.componentWillUpdate&&d.componentWillUpdate(y,d.__s,b),_&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(f,p,g)})}if(d.context=b,d.props=y,d.__P=t,d.__e=!1,w=Zv.__r,k=0,_)d.state=d.__s,d.__d=!1,w&&w(e),h=d.render(d.props,d.state,d.context),ff.push.apply(d.__h,d._sb),d._sb=[];else do{d.__d=!1,w&&w(e),h=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&25>++k);d.state=d.__s,null!=d.getChildContext&&(n=mf(mf({},n),d.getChildContext())),_&&!v&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(f,p)),S=null!=h&&h.type===wf&&null==h.key?Lf(h.props.children):h,l=Ef(t,gf(S)?S:[S],e,i,n,s,r,o,l,a,u),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),m&&(d.__E=d.__=null)}catch(t){if(o.length=c,e.__v=null,a||null!=r)if(t.then){for(e.__u|=a?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;null!=r&&(r[r.indexOf(l)]=null),e.__e=l}else{if(null!=r)for(x=r.length;x--;)yf(r[x]);Ff(e)}else e.__e=i.__e,!e.__k&&i.__k&&(e.__k=i.__k),t.then||Ff(e);Zv.__e(t,e,i)}}else null==r&&e.__v==i.__v?(e.__k=i.__k,e.__e=i.__e):l=e.__e=function(t,e,i,n,s,r,o,l,a){var u,h,c,d,v,f,p,g=i.props||vf,m=e.props,y=e.type;if("svg"==y?s="http://www.w3.org/2000/svg":"math"==y?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=r)for(u=0;r.length>u;u++)if((v=r[u])&&"setAttribute"in v==!!y&&(y?v.localName==y:3==v.nodeType)){t=v,r[u]=null;break}if(null==t){if(null==y)return document.createTextNode(m);t=document.createElementNS(s,y,m.is&&m),l&&(Zv.__m&&Zv.__m(e,r),l=!1),r=null}if(null==y)g===m||l&&t.data==m||(t.data=m);else{if(r="textarea"==y&&null!=m.defaultValue?null:r&&Gv.call(t.childNodes),!l&&null!=r)for(g={},u=0;t.attributes.length>u;u++)g[(v=t.attributes[u]).name]=v.value;for(u in g)v=g[u],"dangerouslySetInnerHTML"==u?c=v:"children"==u||u in m||"value"==u&&"defaultValue"in m||"checked"==u&&"defaultChecked"in m||Pf(t,u,null,v,s);for(u in m)v=m[u],"children"==u?d=v:"dangerouslySetInnerHTML"==u?h=v:"value"==u?f=v:"checked"==u?p=v:l&&"function"!=typeof v||g[u]===v||Pf(t,u,v,g[u],s);if(h)l||c&&(h.__html==c.__html||h.__html==t.innerHTML)||(t.innerHTML=h.__html),e.__k=[];else if(c&&(t.innerHTML=""),Ef("template"==e.type?t.content:t,gf(d)?d:[d],e,i,n,"foreignObject"==y?"http://www.w3.org/1999/xhtml":s,r,o,r?r[0]:i.__k&&Sf(i,0),l,a),null!=r)for(u=r.length;u--;)yf(r[u]);l&&"textarea"!=y||(u="value","progress"==y&&null==f?t.removeAttribute("value"):null!=f&&(f!==t[u]||"progress"==y&&!f||"option"==y&&f!=g[u])&&Pf(t,u,f,g[u],s),u="checked",null!=p&&p!=t[u]&&Pf(t,u,p,g[u],s))}return t}(i.__e,e,i,n,s,r,o,a,u);return(h=Zv.diffed)&&h(e),128&e.__u?void 0:l}function Ff(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(Ff))}function Df(t,e,i){for(var n=0;i.length>n;n++)Nf(i[n],i[++n],i[++n]);Zv.__c&&Zv.__c(e,t),t.some(function(e){try{t=e.__h,e.__h=[],t.some(function(t){t.call(e)})}catch(t){Zv.__e(t,e.__v)}})}function Lf(t){return"object"!=typeof t||null==t||t.__b>0?t:gf(t)?t.map(Lf):void 0!==t.constructor?null:mf({},t)}function Nf(t,e,i){try{if("function"==typeof t){var n="function"==typeof t.__u;n&&t.__u(),n&&null==e||(t.__u=t(e))}else t.current=e}catch(t){Zv.__e(t,i)}}function qf(t,e,i){var n,s;if(Zv.unmount&&Zv.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Nf(n,null,e)),null!=(n=t.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(t){Zv.__e(t,e)}n.base=n.__P=n.__n=null}if(n=t.__k)for(s=0;n.length>s;s++)n[s]&&qf(n[s],e,i||"function"!=typeof t.type);i||yf(t.__e),t.__c=t.__=t.__e=void 0}function Bf(t,e,i){return this.constructor(t,i)}function jf(t,e,i){var n,s,r,o;e==document&&(e=document.documentElement),Zv.__&&Zv.__(t,e),s=(n="function"==typeof i)?null:i&&i.__k||e.__k,r=[],o=[],Af(e,t=(!n&&i||e).__k=_f(wf,null,[t]),s||vf,vf,e.namespaceURI,!n&&i?[i]:s?null:e.firstChild?Gv.call(e.childNodes):null,r,!n&&i?i:s?s.__e:e.firstChild,n,o),Df(r,t,o),t.props.children=null}Gv=ff.slice,Zv={__e(t,e,i,n){for(var s,r,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((r=s.constructor)&&null!=r.getDerivedStateFromError&&(s.setState(r.getDerivedStateFromError(t)),o=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(t,n||{}),o=s.__d),o)return s.__E=s}catch(e){t=e}throw t}},Qv=0,kf.prototype.setState=function(t,e){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=mf({},this.state);"function"==typeof t&&(t=t(mf({},i),this.props)),t&&mf(i,t),null!=t&&this.__v&&(e&&this._sb.push(e),$f(this))},kf.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),$f(this))},kf.prototype.render=wf,Jv=[],Yv="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Xv=function(t,e){return t.__v.__b-e.__v.__b},Tf.__r=0,tf=Math.random().toString(8),ef="__d"+tf,nf="__a"+tf,sf=/(PointerCapture)$|Capture$/i,rf=0,of=Of(!1),lf=Of(!0),af=0;var Hf=0,Uf=[],zf=Zv,Wf=zf.__b,Vf=zf.__r,Gf=zf.diffed,Zf=zf.__c,Qf=zf.unmount,Jf=zf.__;function Kf(t,e){zf.__h&&zf.__h(hf,t,Hf||e),Hf=0;var i=hf.__H||(hf.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function Yf(t){return Hf=1,function(t,e){var i=Kf(uf++,2);if(i.t=t,!i.__c&&(i.__=[up(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=hf,!hf.__f)){var n=function(t,e,n){if(!i.__c.__H)return!0;var r=!1,o=i.__c.props!==t;if(i.__c.__H.__.some(function(t){if(t.__N){r=!0;var e=t.__[0];t.__=t.__N,t.__N=void 0,e!==t.__[0]&&(o=!0)}}),s){var l=s.call(this,t,e,n);return r?l||o:l}return!r||o};hf.__f=!0;var s=hf.shouldComponentUpdate,r=hf.componentWillUpdate;hf.componentWillUpdate=function(t,e,i){if(this.__e){var o=s;s=void 0,n(t,e,i),s=o}r&&r.call(this,t,e,i)},hf.shouldComponentUpdate=n}return i.__N||i.__}(up,t)}function Xf(t,e){var i=Kf(uf++,3);!zf.__s&&ap(i.__H,e)&&(i.__=t,i.u=e,hf.__H.__h.push(i))}function tp(t){return Hf=5,ep(function(){return{current:t}},[])}function ep(t,e){var i=Kf(uf++,7);return ap(i.__H,e)&&(i.__=t(),i.__H=e,i.__h=t),i.__}function ip(t){var e=hf.context[t.__c],i=Kf(uf++,9);return i.c=t,e?(null==i.__&&(i.__=!0,e.sub(hf)),e.props.value):t.__}function np(){for(var t;t=Uf.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(op),e.__h.some(lp),e.__h=[]}catch(i){e.__h=[],zf.__e(i,t.__v)}}}zf.__b=function(t){hf=null,Wf&&Wf(t)},zf.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Jf&&Jf(t,e)},zf.__r=function(t){Vf&&Vf(t),uf=0;var e=(hf=t.__c).__H;e&&(cf===hf?(e.__h=[],hf.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.length&&np(),uf=0)),cf=hf},zf.diffed=function(t){Gf&&Gf(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==Uf.push(e)&&df===zf.requestAnimationFrame||((df=zf.requestAnimationFrame)||rp)(np)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),cf=hf=null},zf.__c=function(t,e){e.some(function(t){try{t.__h.some(op),t.__h=t.__h.filter(function(t){return!t.__||lp(t)})}catch(i){e.some(function(t){t.__h&&(t.__h=[])}),e=[],zf.__e(i,t.__v)}}),Zf&&Zf(t,e)},zf.unmount=function(t){Qf&&Qf(t);var e,i=t.__c;i&&i.__H&&(i.__H.__.some(function(t){try{op(t)}catch(t){e=t}}),i.__H=void 0,e&&zf.__e(e,i.__v))};var sp="function"==typeof requestAnimationFrame;function rp(t){var e,i=function(){clearTimeout(n),sp&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(i,35);sp&&(e=requestAnimationFrame(i))}function op(t){var e=hf,i=t.__c;"function"==typeof i&&(t.__c=void 0,i()),hf=e}function lp(t){var e=hf;t.__c=t.__(),hf=e}function ap(t,e){return!t||t.length!==e.length||e.some(function(e,i){return e!==t[i]})}function up(t,e){return"function"==typeof e?e(t):e}const hp={GZipJS:"gzip-js",Base64:"base64"},cp={Activation:"events",Cancellation:"cancelEvents"},dp={Button:"button",Tab:"tab",Selector:"selector"},vp={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},fp={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},pp={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},gp={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},mp={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},yp={Once:"once",Recurring:"recurring",Always:"always"},_p={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},bp={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},wp={Popover:"popover",Inline:"inline"};function kp(t){let e=!0;return{dispose(){if(e){e=!1;const i=t();i&&xe(i.then)&&i.then(void 0,()=>{})}}}}const Sp=Gs("[Surveys]"),xp="PostHog is not capturing, so a survey response cannot be recorded";function Cp(t){return xe(t.is_capturing)?t.is_capturing():!t.has_opted_out_capturing()}function $p(t){return!(!t.start_date||t.end_date)}function Tp(t){var e;return!!(null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)}const Ep=(t,e)=>`${t}${function(t){return t.current_iteration&&t.current_iteration>0?`${t.id}_${t.current_iteration}`:t.id}(e)}`,Ip=t=>Ep("seenSurvey_",t),Mp=t=>{try{const e=Ip(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){Sp.error("Failed to persist survey seen state",t)}},Rp=[pp.Popover,pp.Widget,pp.API],Pp={ignoreConditions:!1,ignoreDelay:!1,displayType:wp.Popover},Op="logs",Ap=Gs("[Stylesheet Loader]"),Fp=t,Dp=n,Lp="#020617",Np={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:vp.Right,widgetType:dp.Tab,widgetLabel:"Feedback",widgetColor:"black",zIndex:String(2147483645),disabledButtonOpacity:"0.6",maxWidth:"300px",textSubtleColor:"#939393",boxPadding:"20px 24px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"10px",shuffleQuestions:!1,surveyPopupDelaySeconds:void 0,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:Lp,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},qp=[vp.Center,vp.Left,vp.Right];function Bp(t){if(t.startsWith("#")){let e=t.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(e)&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),/^[0-9A-Fa-f]{6}$/.test(e)?`rgb(${parseInt(e.slice(0,2),16)},${parseInt(e.slice(2,4),16)},${parseInt(e.slice(4,6),16)})`:"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function jp(t=Np.backgroundColor){let e;"#"===t[0]&&(e=Bp(t)),t.startsWith("rgb")&&(e=t);const i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[t.toLowerCase()];if(i&&(e=Bp(i)),!e)return Lp;const n=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(n){const t=parseInt(n[1]),e=parseInt(n[2]),i=parseInt(n[3]);return Math.sqrt(t*t*.299+e*e*.587+i*i*.114)>127.5?Lp:"white"}return Lp}const Hp=(t,e,i)=>{const n=lg(t),s=Dp.querySelector(`.${n}`);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};const r=Dp.createElement("div");((t,e,i)=>{const n=ue(ue({},Np),i),s=t.style,r=!qp.includes(n.position)||e===pp.Widget&&(null==i?void 0:i.widgetType)===dp.Tab;s.setProperty("--ph-survey-font-family",function(t){if("inherit"===t)return"inherit";const e='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return t?`${t}, ${e}`:`-apple-system, ${e}`}(n.fontFamily)),s.setProperty("--ph-survey-box-padding",n.boxPadding),s.setProperty("--ph-survey-max-width",n.maxWidth),s.setProperty("--ph-survey-z-index",n.zIndex),s.setProperty("--ph-survey-border-color",n.borderColor),r?(s.setProperty("--ph-survey-border-radius",n.borderRadius),s.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(s.setProperty("--ph-survey-border-bottom","none"),s.setProperty("--ph-survey-border-radius",`${n.borderRadius} ${n.borderRadius} 0 0`)),s.setProperty("--ph-survey-background-color",n.backgroundColor),s.setProperty("--ph-survey-box-shadow",n.boxShadow),s.setProperty("--ph-survey-disabled-button-opacity",n.disabledButtonOpacity),s.setProperty("--ph-survey-submit-button-color",n.submitButtonColor),s.setProperty("--ph-survey-submit-button-text-color",(null==i?void 0:i.submitButtonTextColor)||jp(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",jp(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||jp(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",jp(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 l=o||n.inputBackground;o||"white"!==n.backgroundColor||(l="#f8f8f8"),s.setProperty("--ph-survey-input-background",l);const a=(null==i?void 0:i.inputTextColor)||jp(l);s.setProperty("--ph-survey-input-text-color",a),s.setProperty("--ph-survey-rating-text-color",a),s.setProperty("--ph-survey-scrollbar-thumb-color",n.scrollbarThumbColor),s.setProperty("--ph-survey-scrollbar-track-color",n.scrollbarTrackColor),s.setProperty("--ph-survey-outline-color",n.outlineColor)})(r,t.type,t.appearance),r.className=n;const o=r.attachShadow({mode:"open"}),l=function(t){const e=((t,e,i)=>{let n=t.createElement("style");n.innerText=e;const s=(t=>{var e;return xe(t)?t:null==t||null===(e=t.config)||void 0===e?void 0:e.prepare_external_dependency_stylesheet})(i);return s&&(n=s(n)),n||(Ap.error("prepare_external_dependency_stylesheet returned null"),null)})(Dp,':host{--ph-survey-font-family:-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--ph-survey-box-padding:20px 24px;--ph-survey-max-width:300px;--ph-survey-z-index:calc(2147480000 + 3645);--ph-survey-border-color:#dcdcdc;--ph-survey-border-bottom:1.5px solid var(--ph-survey-border-color);--ph-survey-border-radius:10px;--ph-survey-background-color:#eeeded;--ph-survey-box-shadow:0 4px 12px #00000026;--ph-survey-submit-button-color:black;--ph-survey-submit-button-text-color:white;--ph-survey-rating-bg-color:white;--ph-survey-rating-text-color:#020617;--ph-survey-rating-active-bg-color:black;--ph-survey-rating-active-text-color:white;--ph-survey-text-primary-color:#020617;--ph-survey-text-subtle-color:#939393;--ph-widget-color:#e0a045;--ph-widget-text-color:white;--ph-survey-scrollbar-thumb-color:var(--ph-survey-border-color);--ph-survey-scrollbar-track-color:var(--ph-survey-background-color);--ph-survey-outline-color:#3b82f6cc;--ph-survey-input-background:white;--ph-survey-input-text-color:#020617;--ph-survey-disabled-button-opacity:.6}.ph-survey{min-width:300px;width:var(--ph-survey-max-width);max-width:85%;z-index:var(--ph-survey-z-index);height:fit-content;margin:0;position:fixed;bottom:0}.ph-survey h3,.ph-survey p{margin:0}.ph-survey *{box-sizing:border-box;font-family:var(--ph-survey-font-family);color:var(--ph-survey-text-primary-color)}.ph-survey textarea,.ph-survey input[type=text],.ph-survey .multiple-choice-options label{color:var(--ph-survey-input-text-color);background:var(--ph-survey-input-background);border:1.5px solid var(--ph-survey-border-color);border-radius:4px;padding:10px;transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey textarea,.ph-survey input[type=text]{transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input{margin:0}.ph-survey textarea:focus,.ph-survey textarea:focus-visible,.ph-survey input[type=text]:focus,.ph-survey input[type=text]:focus-visible,.ph-survey .form-submit:focus,.ph-survey .form-submit:focus-visible,.ph-survey input[type=checkbox]:focus,.ph-survey input[type=radio]:focus,.ph-survey input[type=checkbox]:focus-visible,.ph-survey input[type=radio]:focus-visible{outline:1.5px solid var(--ph-survey-outline-color);border-color:var(--ph-survey-rating-active-bg-color);outline-offset:2px}.ph-survey textarea:focus:not(:focus-visible),.ph-survey input[type=text]:focus:not(:focus-visible),.ph-survey button:focus:not(:focus-visible),.ph-survey input[type=checkbox]:focus:not(:focus-visible),.ph-survey input[type=radio]:focus:not(:focus-visible){outline:none}.ph-survey textarea:hover:not(:focus),.ph-survey input[type=text]:hover:not(:focus){border-color:var(--ph-survey-rating-active-bg-color)}@media (max-width:768px){.ph-survey textarea,.ph-survey input[type=text]{font-size:1rem}}.ph-survey .multiple-choice-options label,.ph-survey .rating-options-number,.ph-survey .form-cancel,.ph-survey input[type=checkbox],.ph-survey input[type=radio]{border:1.5px solid var(--ph-survey-border-color)}.ph-survey label,.ph-survey input[type=checkbox],.ph-survey input[type=radio],.ph-survey .ratings-emoji,.ph-survey .ratings-number,.ph-survey .footer-branding,.ph-survey .form-cancel,.ph-survey .form-submit{transition:all .2s ease-out}@media (prefers-reduced-motion:no-preference){.ph-survey button:active,.ph-survey input[type=checkbox]:active,.ph-survey input[type=radio]:active,.ph-survey label:active{transition-duration:.1s}}.ph-survey-widget-tab{background:var(--ph-widget-color);color:var(--ph-widget-text-color);text-align:center;cursor:pointer;z-index:var(--ph-survey-z-index);border:none;border-radius:3px 3px 0 0;padding:10px 12px;transition:padding .2s ease-out;position:fixed}.ph-survey-widget-tab:hover:not(.widget-tab-top){padding-bottom:16px}.ph-survey-widget-tab.widget-tab-top{border-radius:0 0 3px 3px}.ph-survey-widget-tab.widget-tab-top:hover{padding-top:16px}@keyframes ph-survey-fade-in{0%{opacity:0}to{opacity:1}}.survey-box{flex-direction:column;gap:16px;display:flex}.bottom-section{flex-direction:column;gap:8px;display:flex}.thank-you-message-header~.bottom-section,.intro-screen-header~.bottom-section{padding-top:16px}.question-container,.thank-you-message,.intro-screen{flex-direction:column;gap:8px;display:flex}.survey-question{font-size:14px;font-weight:500}.survey-question-description{opacity:.8;padding-top:4px;font-size:13px}.survey-question-description,.thank-you-message-body,.intro-screen-body{word-wrap:break-word;overflow-wrap:break-word}:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) img,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) video,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) iframe,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) embed,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) object,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) svg{max-width:100%;height:auto}.question-textarea-wrapper{flex-direction:column;display:flex}.survey-form{animation:.3s ease-out forwards ph-survey-fade-in}.survey-form,.thank-you-message,.intro-screen{text-align:left;width:100%;z-index:var(--ph-survey-z-index);border:1.5px solid var(--ph-survey-border-color);border-bottom:var(--ph-survey-border-bottom);background:var(--ph-survey-background-color);border-radius:var(--ph-survey-border-radius);box-shadow:var(--ph-survey-box-shadow);padding:var(--ph-survey-box-padding);margin:0;position:relative}.survey-form textarea,.survey-form input[type=text]{min-width:100%}.survey-form textarea:focus,.survey-form textarea:focus-visible{box-shadow:0 4px 12px #00000014}.survey-form textarea:focus:not(:focus-visible){box-shadow:none}.survey-box .question-header--empty~.multiple-choice-options,.survey-box .question-header--empty~textarea{margin-top:0}.multiple-choice-options{border:none;flex-direction:column;gap:8px;margin:0;padding:1px 0;font-size:14px;display:flex}.multiple-choice-options label,.multiple-choice-options .response-choice{color:inherit;align-items:center;gap:8px;display:flex}.multiple-choice-options label{cursor:pointer;font-size:13px}.multiple-choice-options label:hover:not(:has(input:checked)){border-color:var(--ph-survey-text-subtle-color);box-shadow:0 2px 8px #00000014}.multiple-choice-options label:has(input:checked){border-color:var(--ph-survey-rating-active-bg-color);box-shadow:0 1px 4px #0000000d}.multiple-choice-options label.choice-option-open{flex-wrap:wrap}.multiple-choice-options label span{color:inherit}.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ph-survey-input-background);cursor:pointer;z-index:1;border-radius:3px;flex-shrink:0;width:1rem;height:1rem;transition:all .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out;position:relative}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):focus{transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):hover{border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):active{transform:scale(.95)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked{background:var(--ph-survey-rating-active-bg-color);border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked:hover{transform:scale(1.05)}.multiple-choice-options input[type=checkbox]:checked:after{border:solid var(--ph-survey-rating-active-text-color);border-width:0 2px 2px 0;width:4px;height:8px;animation:.2s ease-out .1s forwards ph-survey-checkmark-reveal;left:4px;transform:rotate(45deg)scale(0)}.multiple-choice-options input[type=radio]:checked:after{background:var(--ph-survey-rating-active-text-color);border-radius:50%;width:6px;height:6px;animation:.15s ease-out 50ms forwards ph-survey-radio-reveal;top:5px;left:5px;transform:scale(0)}.multiple-choice-options input[type=checkbox]:checked:after,.multiple-choice-options input[type=radio]:checked:after{content:"";box-sizing:content-box;position:absolute}.multiple-choice-options input[type=radio]{border-radius:50%}.multiple-choice-options input[type=radio]:checked{border:none}:is(.multiple-choice-options input[type=checkbox]:checked,.multiple-choice-options input[type=radio]:checked)~*{font-weight:700}.multiple-choice-options .choice-option-open input[type=text]::placeholder{color:var(--ph-survey-text-subtle-color);font-weight:400}.rating-options-emoji{justify-content:space-between;display:flex}.rating-options-emoji-2{justify-content:space-around}.ratings-emoji{opacity:.5;background-color:#0000;border:none;padding:0;font-size:16px}.ratings-emoji:hover{cursor:pointer;opacity:1;transform:scale(1.15)}.ratings-emoji.rating-active{opacity:1}.ratings-emoji svg{fill:var(--ph-survey-text-primary-color);transition:fill .2s ease-out}.rating-options-number{border-radius:6px;grid-auto-columns:1fr;grid-auto-flow:column;display:grid;overflow:hidden}.rating-options-number .ratings-number{border-right:1px solid var(--ph-survey-border-color);text-align:center;cursor:pointer;color:var(--ph-survey-rating-text-color);border-top:none;border-bottom:none;border-left:none;font-weight:700}.rating-options-number .ratings-number:last-of-type{border-right:0}.rating-options-number .ratings-number.rating-active{background:var(--ph-survey-rating-active-bg-color);color:var(--ph-survey-rating-active-text-color)}.ratings-number{background-color:var(--ph-survey-rating-bg-color);border:none;padding:8px 0}.ratings-number .rating-active{background-color:var(--ph-survey-rating-active-bg-color)}.ratings-number{cursor:pointer}@media (hover:hover) and (pointer:fine){.ratings-number:hover:not(.rating-active){background-color:color-mix(in srgb, var(--ph-survey-rating-active-bg-color) 14%, var(--ph-survey-rating-bg-color))}}.rating-text{opacity:.7;flex-direction:row;justify-content:space-between;font-size:11px;display:flex}.form-buttons{flex-direction:row;gap:8px;width:100%;display:flex}.form-buttons-with-back>.form-submit{flex:auto;min-width:0}.form-submit{text-align:center;cursor:pointer;user-select:none;background:var(--ph-survey-submit-button-color);color:var(--ph-survey-submit-button-text-color);border:none;border-radius:6px;min-width:100%;padding:12px;font-weight:700;box-shadow:0 2px #0000000b}.form-submit:not([disabled]):hover{transform:scale(1.02);box-shadow:0 4px 8px #0000001a}.form-submit:not([disabled]):active{transform:scale(.98);box-shadow:0 1px 2px #0000000d}.form-submit[disabled]{opacity:var(--ph-survey-disabled-button-opacity);cursor:not-allowed}.form-back{text-align:center;cursor:pointer;user-select:none;color:var(--ph-survey-text-primary-color);border:1.5px solid var(--ph-survey-border-color);background:0 0;border-radius:6px;flex:none;padding:12px 16px;font-weight:600}.form-back:hover{transform:scale(1.02)}.form-back:active{transform:scale(.98)}.validation-hint{opacity:.7;margin-top:4px;font-size:12px}.form-cancel{cursor:pointer;background:#fff;border-radius:100%;padding:12px;line-height:0;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.form-cancel:hover{opacity:.7;transform:translate(50%,-50%)scale(1.1)}.footer-branding{opacity:.6;justify-content:center;align-items:center;gap:4px;font-size:11px;font-weight:500;text-decoration:none;display:flex}.footer-branding:hover{opacity:1}.footer-branding a{text-decoration:none}.thank-you-message{text-align:center}.thank-you-message-header{margin:10px 0 0}.thank-you-message-body{opacity:.8;font-size:14px}.intro-screen{text-align:center;animation:.3s ease-out forwards ph-survey-fade-in}.intro-screen-header{margin:10px 0 0}.intro-screen-body{opacity:.8;font-size:14px}.limit-height{scrollbar-width:thin;scrollbar-color:var(--ph-survey-scrollbar-thumb-color) var(--ph-survey-scrollbar-track-color);max-height:256px;overflow:hidden auto}.limit-height::-webkit-scrollbar{width:8px}.limit-height::-webkit-scrollbar-track{background:var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb{background-color:var(--ph-survey-scrollbar-thumb-color);border:2px solid var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb:hover{background-color:var(--ph-survey-text-subtle-color)}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.ph-survey *{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@keyframes ph-survey-checkmark-reveal{0%{opacity:0;transform:rotate(45deg)scale(0)}50%{opacity:1;transform:rotate(45deg)scale(1.2)}to{opacity:1;transform:rotate(45deg)scale(1)}}@keyframes ph-survey-radio-reveal{0%{opacity:0;transform:scale(0)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}',t);return null==e||e.setAttribute("data-ph-survey-style","true"),e}(e);if(l){const t=o.querySelector("style");t&&o.removeChild(t),o.appendChild(l)}return(i||Dp.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},Up=({responses:t,survey:e,surveySubmissionId:i,posthog:n,isSurveyCompleted:s,properties:r,surveyLanguage:o,questionSnapshots:l})=>{var a;n?Cp(n)&&(Mp(e),n.capture(_p.SENT,ue(ue(ue(ue({[bp.SURVEY_NAME]:e.name,[bp.SURVEY_ID]:e.id,[bp.SURVEY_ITERATION]:e.current_iteration,[bp.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,[bp.SURVEY_SUBMISSION_ID]:i,[bp.SURVEY_COMPLETED]:s},o&&{[bp.SURVEY_LANGUAGE]:o}),{},{sessionRecordingUrl:null===(a=n.get_session_replay_url)||void 0===a?void 0:a.call(n)},na(t,e,l)),r),{},{$set:{[ra(e,"responded")]:!0}})),s&&(Fp.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:e.id}})),og(e),n.reloadFeatureFlags())):Sp.error("[survey sent] event not captured, PostHog instance not found.")},zp=(t,e,i)=>{var n;return ue(ue({[bp.SURVEY_NAME]:t.name,[bp.SURVEY_ID]:t.id,[bp.SURVEY_ITERATION]:t.current_iteration,[bp.SURVEY_ITERATION_START_DATE]:t.current_iteration_start_date,[bp.SURVEY_PARTIALLY_COMPLETED]:sa(null==e?void 0:e.responses)},(null==e?void 0:e.surveyLanguage)&&{[bp.SURVEY_LANGUAGE]:e.surveyLanguage}),{},{sessionRecordingUrl:null===(n=i.get_session_replay_url)||void 0===n?void 0:n.call(i),[bp.SURVEY_SUBMISSION_ID]:null==e?void 0:e.surveySubmissionId},na(null==e?void 0:e.responses,t,null==e?void 0:e.questionSnapshots))},Wp=(t,e,i,n)=>{if(!e)return void Sp.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const s=sg(t),r=s?s.surveyLanguage:n;e.capture(_p.DISMISSED,ue(ue(ue({},zp(t,s,e)),r&&{[bp.SURVEY_LANGUAGE]:r}),{},{$set:{[ra(t,"dismissed")]:!0}})),og(t),Mp(t),Fp.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:t.id}}))},Vp=(t,e)=>{if(!e)return void Sp.error("[survey abandoned] event not captured, PostHog instance not found.");const i=(t=>Ep("abandonedSurvey_",t))(t);try{if("true"===localStorage.getItem(i))return}catch(t){return}const n=sg(t);if(n){try{localStorage.setItem(i,"true")}catch(t){}e.capture(_p.ABANDONED,zp(t,n,e),{transport:"sendBeacon"})}},Gp=t=>t.map(t=>({sort:Math.floor(10*Math.random()),value:t})).sort((t,e)=>t.sort-e.sort).map(t=>t.value),Zp=(t,e)=>t.length===e.length&&t.every((t,i)=>t===e[i])?e.reverse():e,Qp=t=>{const e=t.map(t=>t.id);return e.every(t=>!!t)?e:void 0},Jp=(t,e)=>{return(t=>t.questions.some(t=>{var e;return!!(null===(e=t.branching)||void 0===e?void 0:e.type)}))(t)?t.questions:e?null!==(i=((t,e)=>{if(!e||e.length!==t.questions.length)return null;const i=new Map(t.questions.map(t=>[t.id,t])),n=[];for(const t of e){const e=i.get(t);if(!e)return null;n.push(e)}return n})(t,e.questionOrder))&&void 0!==i?i:t.questions:t.appearance&&t.appearance.shuffleQuestions&&!t.enable_partial_responses?Zp(t.questions,Gp(t.questions)):t.questions;var i},Kp=t=>da(t)||rg(t),Yp=function(t){function e(t){var i,n;return this.getChildContext||(i=new Set,(n={})[e.__c]=this,this.getChildContext=function(){return n},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(t){this.props.value!=t.value&&i.forEach(function(t){t.__e=!0,$f(t)})},this.sub=function(t){i.add(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){i&&i.delete(t),e&&e.call(t)}}),t.children}return e.__c="__cC"+af++,e.__=t,e.Provider=e.__l=(e.Consumer=function(t,e){return t.children(e)}).contextType=e,e}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),Xp=()=>ip(Yp),tg=({component:t,children:e,renderAsHtml:i,style:n})=>function(t,e,i){var n,s,r,o,l=mf({},t.props);for(r in t.type&&t.type.defaultProps&&(o=t.type.defaultProps),e)"key"==r?n=e[r]:"ref"==r?s=e[r]:l[r]=void 0===e[r]&&null!=o?o[r]:e[r];return arguments.length>2&&(l.children=arguments.length>3?Gv.call(arguments,2):i),bf(t.type,l,n||t.key,s||t.ref,null)}(t,i?{dangerouslySetInnerHTML:{__html:e},style:n}:{children:e,style:n});function eg(t,e){var i,n;if(!(null===(i=t.conditions)||void 0===i?void 0:i.url))return!0;const s=pr(e);if(!s)return!1;const r=[t.conditions.url],o=function(t){return null!=t?t:"icontains"}(null===(n=t.conditions)||void 0===n?void 0:n.urlMatchType);return pa[o](r,[s])}const ig=t=>Ep("inProgressSurvey_",t),ng=(t,e)=>{try{localStorage.setItem(ig(t),JSON.stringify(e))}catch(t){Sp.error("Error setting in-progress survey state in localStorage",t)}},sg=t=>{try{const e=localStorage.getItem(ig(t));if(e)return JSON.parse(e)}catch(t){Sp.error("Error getting in-progress survey state from localStorage",t)}return null},rg=t=>{const e=sg(t);return!Re(null==e?void 0:e.surveySubmissionId)},og=t=>{try{localStorage.removeItem(ig(t))}catch(t){Sp.error("Error clearing in-progress survey state from localStorage",t)}};function lg(t,e=!1){const i=`PostHogSurvey-${t.id}`;return e?`.${i}`:i}function ag(t,e=vp.Right,i){if(t===pp.ExternalSurvey)return{};switch(e){case vp.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case vp.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case vp.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case vp.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case vp.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case vp.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case vp.Left:return{left:"30px"};case vp.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:t===pp.Widget&&i===dp.Tab?"60px":"30px"}}}var ug=0;function hg(t,e,i,n,s,r){e||(e={});var o,l,a=e;if("ref"in a)for(l in a={},e)"ref"==l?o=e[l]:a[l]=e[l];var u={type:t,props:a,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ug,__i:-1,__u:0,__source:s,__self:r};if("function"==typeof t&&(o=t.defaultProps))for(l in o)void 0===a[l]&&(a[l]=o[l]);return Zv.vnode&&Zv.vnode(u),u}const cg=hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:hg("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"})}),dg=hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:hg("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"})}),vg=hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:hg("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"})}),fg=hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:hg("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"})}),pg=hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:hg("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"})}),gg=hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:hg("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"})}),mg=hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:hg("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"})}),yg=({fill:t="currentColor"}={})=>hg("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:t,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[hg("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),hg("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:t})]}),_g=hg("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[hg("g",{"clip-path":"url(#clip0_2415_6911)",children:[hg("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:hg("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),hg("g",{mask:"url(#mask0_2415_6911)",children:[hg("path",{d:"M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z",fill:"#1D4AFF"}),hg("path",{d:"M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z",fill:"#F9BD2B"}),hg("path",{d:"M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z",fill:"currentColor"}),hg("path",{d:"M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z",fill:"#1D4AFF"}),hg("path",{d:"M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z",fill:"#F54E00"}),hg("path",{d:"M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z",fill:"currentColor"})]})]}),hg("defs",{children:hg("clipPath",{id:"clip0_2415_6911",children:hg("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function bg({urlParams:t}){const e=t?Object.entries(t).map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"):"";return hg("a",{href:"https://posthog.com/surveys"+(e?`?${e}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",_g]})}function wg({text:e,submitDisabled:i,appearance:n,onSubmit:s,link:r,onPreviewSubmit:o,skipSubmitButton:l,canGoBack:a,onBack:u}){const{isPreviewMode:h}=ip(Yp),c=!!a&&!!u,d=!l&&hg("button",{className:"form-submit",disabled:i,"aria-label":"Submit survey",type:"button",onClick(){r&&(null==t||t.open(r)),h?null==o||o():s()},children:e});return hg("div",{className:"bottom-section",children:[c?hg("div",{className:"form-buttons form-buttons-with-back",children:[hg("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:u,children:n.backButtonText||"Back"}),d]}):d,!n.whiteLabel&&hg(bg,{urlParams:{utm_source:"survey-footer"}})]})}function kg({question:t,forceDisableHtml:e,htmlFor:i}){return hg("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[hg(t.type===gp.Open?"label":"h3",{className:"survey-question",htmlFor:i,children:t.question}),t.description&&tg({component:_f("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!e&&"text"!==t.descriptionContentType})]})}function Sg({onClick:t}){const{isPreviewMode:e}=ip(Yp);return hg("button",{className:"form-cancel",onClick:t,disabled:e,"aria-label":"Close survey",type:"button",children:yg({fill:"black"})})}const xg=t;function Cg({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onClose:r}){const{isPopup:o}=ip(Yp);return Xf(()=>{const t=t=>{"Enter"!==t.key&&"Escape"!==t.key||(t.preventDefault(),r())};return nr(xg,"keydown",t),()=>{xg.removeEventListener("keydown",t)}},[r]),hg("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&hg(Sg,{onClick:()=>r()}),hg("h3",{className:"thank-you-message-header",children:t}),e&&tg({component:_f("p",{className:"thank-you-message-body"}),children:e,renderAsHtml:!n&&"text"!==i}),o&&hg(wg,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>r()})]})}function $g({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onStart:r}){const{isPopup:o,onPreviewSubmit:l,onPopupSurveyDismissed:a}=ip(Yp);return hg("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&hg(Sg,{onClick:()=>a()}),t&&hg("h3",{className:"intro-screen-header",children:t}),e&&tg({component:_f("p",{className:"intro-screen-body"}),children:e,renderAsHtml:!n&&"text"!==i}),hg(wg,{text:s.introScreenButtonText||"Get started",submitDisabled:!1,appearance:s,onSubmit:r,onPreviewSubmit:()=>l(null)})]})}const Tg=t=>Se(t)&&t.every(t=>Ee(t));function Eg({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,displayQuestionIndex:r,initialValue:o,canGoBack:l,onBack:a}){const{isPreviewMode:u}=Xp(),h=tp(null),[c,d]=Yf(()=>Ee(o)?o:""),v=null==i?void 0:i.disableAutofocus;Xf(()=>{v||setTimeout(()=>{var t;u||null===(t=h.current)||void 0===t||t.focus()},100)},[u,v]);const f=`surveyQuestion${r}`,p=ep(()=>function(t,e,i){const n=t.trim();if(!i&&""===n)return"This field is required";if(""===n)return!1;if(e&&e.length>0)for(const t of e)switch(t.type){case de:var s;if(void 0!==t.value&&t.value>n.length)return null!==(s=t.errorMessage)&&void 0!==s?s:`Please enter at least ${t.value} characters`;break;case ve:var r;if(void 0!==t.value&&n.length>t.value)return null!==(r=t.errorMessage)&&void 0!==r?r:`Please enter no more than ${t.value} characters`}return!1}(c,t.validation,t.optional),[c,t.validation,t.optional]),g=Hs(t.validation,de),m=Hs(t.validation,ve),y=ep(()=>function(t,e){const i=1===t?void 0:t;return i&&e?`Enter ${i}-${e} characters`:i?`Enter at least ${i} ${1===i?"character":"characters"}`:e?`Maximum ${e} ${1===e?"character":"characters"}`:void 0}(g,m),[g,m]),_=()=>{p||n(c.trim())},b=()=>{p||s(c.trim())};return hg(wf,{children:[hg("div",{className:"question-container",children:[hg(kg,{question:t,forceDisableHtml:e,htmlFor:f}),hg("textarea",{ref:h,id:f,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:g,maxLength:m,onInput(t){d(t.currentTarget.value),t.stopPropagation()},onKeyDown(t){t.stopPropagation(),"Enter"!==t.key||!t.metaKey&&!t.ctrlKey||p||(t.preventDefault(),u?b():_())},value:c}),y&&hg("div",{className:"validation-hint",children:y})]}),hg(wg,{text:t.buttonText||"Submit",submitDisabled:!!p,appearance:i,onSubmit:_,onPreviewSubmit:b,canGoBack:l,onBack:a})]})}function Ig({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,canGoBack:r,onBack:o}){return hg(wf,{children:[hg("div",{className:"question-container",children:hg(kg,{question:t,forceDisableHtml:e})}),hg(wg,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:()=>n("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:r,onBack:o})]})}function Mg({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:l,onBack:a}){var u;const h=t.scale,c=10===t.scale?0:1,[d,v]=Yf(()=>Pe(o)?o:Se(o)&&o.length>0&&Pe(parseInt(o[0]))?parseInt(o[0]):Ee(o)&&Pe(parseInt(o))?parseInt(o):null),f="emoji"===t.display&&2===t.scale,{isPreviewMode:p}=Xp(),g=t=>p?r(t):s(t);return hg(wf,{children:[hg("div",{className:"question-container",children:[hg(kg,{question:t,forceDisableHtml:e}),hg("div",{className:"rating-section",children:[hg("div",{className:"rating-options",children:["emoji"===t.display&&hg("div",{className:"rating-options-emoji"+(f?" rating-options-emoji-2":""),children:null===(u=Dg[t.scale])||void 0===u?void 0:u.map((e,n)=>hg("button",{"aria-label":`Rate ${n+1}`,className:`ratings-emoji question-${i}-rating-${n} ${n+1===d?"rating-active":""}`,value:n+1,type:"button",onClick(){const e=n+1;v(e),t.skipSubmitButton&&g(e)},children:e},n))}),"number"===t.display&&hg("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${h-c+1}, minmax(0, 1fr))`},children:Lg(t.scale).map((e,s)=>hg(Rg,{displayQuestionIndex:i,active:d===e,appearance:n,num:e,setActiveNumber(e){v(e),t.skipSubmitButton&&g(e)}},s))})]}),!f&&hg("div",{className:"rating-text",children:[hg("div",{children:t.lowerBoundLabel}),hg("div",{children:t.upperBoundLabel})]})]})]}),hg(wg,{text:t.buttonText||(null==n?void 0:n.submitButtonText)||"Submit",submitDisabled:Me(d)&&!t.optional,appearance:n,onSubmit:()=>s(d),onPreviewSubmit:()=>r(d),skipSubmitButton:t.skipSubmitButton,canGoBack:l,onBack:a})]})}function Rg({num:t,active:e,displayQuestionIndex:i,setActiveNumber:n}){return hg("button",{"aria-label":`Rate ${t}`,className:`ratings-number question-${i}-rating-${t} ${e?"rating-active":""}`,type:"button",onClick(){n(t)},children:t})}function Pg({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:l,onBack:a}){const u=tp(null),h=ep(()=>(t=>{if(!t.shuffleOptions)return t.choices;const e=t.choices;let i="";t.hasOpenChoice&&(i=e.pop());const n=Zp(e,Gp(e));return t.hasOpenChoice&&(t.choices.push(i),n.push(i)),n})(t),[t]),[c,d]=Yf(()=>((t,e)=>Ee(t)||Tg(t)?t:e===gp.SingleChoice?null:[])(o,t.type)),[v,f]=Yf(()=>((t,e)=>{if(Ee(t)&&!e.includes(t))return{isSelected:!0,inputValue:t};if(Tg(t)){const i=t.find(t=>!e.includes(t));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,h)),{isPreviewMode:p}=Xp(),g=t.type===gp.SingleChoice,m=t.type===gp.MultipleChoice,y=t.skipSubmitButton&&g&&!t.hasOpenChoice,_=(t,e)=>{if(e){const t=!v.isSelected;return f(e=>ue(ue({},e),{},{isSelected:t,inputValue:t?e.inputValue:""})),g&&d(""),void(t&&setTimeout(()=>{var t;return null===(t=u.current)||void 0===t?void 0:t.focus()},75))}if(g)return d(t),f(t=>ue(ue({},t),{},{isSelected:!1,inputValue:""})),void(y&&(s(t),p&&r(t)));m&&Se(c)&&(c.includes(t)?d(c.filter(e=>e!==t)):d([...c,t]))},b=t=>{t.stopPropagation();const e=t.currentTarget.value;f(t=>ue(ue({},t),{},{inputValue:e})),g&&d(e)},w=t=>{t.stopPropagation(),"Enter"!==t.key||k()||(t.preventDefault(),S()),"Escape"===t.key&&(t.preventDefault(),f(t=>ue(ue({},t),{},{isSelected:!1,inputValue:""})),g&&d(null))},k=()=>!(t.optional||!Me(c)&&(!Se(c)||v.isSelected||0!==c.length)&&(!v.isSelected||""!==v.inputValue.trim())),S=()=>{v.isSelected&&m?Se(c)&&(p?r([...c,v.inputValue]):s([...c,v.inputValue])):p?r(c):s(c)};return hg(wf,{children:[hg("div",{className:"question-container",children:[hg(kg,{question:t,forceDisableHtml:e}),hg("fieldset",{className:"multiple-choice-options limit-height",children:[hg("legend",{className:"sr-only",children:m?" Select all that apply":" Select one"}),h.map((e,n)=>{const s=!!t.hasOpenChoice&&n===t.choices.length-1,r=`surveyQuestion${i}Choice${n}`,o=`${r}Open`,l=s?v.isSelected:g?c===e:Se(c)&&c.includes(e);return hg("label",{className:s?"choice-option-open":"",children:[hg("div",{className:"response-choice",children:[hg("input",{type:g?"radio":"checkbox",name:r,checked:l,onChange:()=>_(e,s),id:r,"aria-controls":o}),hg("span",{children:s?`${e}:`:e})]}),s&&hg("input",{type:"text",ref:u,id:o,name:`question${i}Open`,value:v.inputValue,onKeyDown:w,onInput:b,onClick(t){v.isSelected||_(e,!0),t.stopPropagation()},"aria-label":`${e} - please specify`})]},n)})]})]}),hg(wg,{text:t.buttonText||"Submit",submitDisabled:k(),appearance:n,onSubmit:S,onPreviewSubmit:S,skipSubmitButton:y,canGoBack:l,onBack:a})]})}const Og=[1,2,3,4,5],Ag=[1,2,3,4,5,6,7],Fg=[0,1,2,3,4,5,6,7,8,9,10],Dg={2:[gg,mg],3:[vg,dg,cg],5:[fg,vg,dg,cg,pg]};function Lg(t){switch(t){case 5:default:return Og;case 7:return Ag;case 10:return Fg}}const Ng=Gs("[Surveys]");function qg(t,e,i){var n;const s=t.questions[e],r=e+1;if(!(null===(n=s.branching)||void 0===n?void 0:n.type))return e===t.questions.length-1?mp.End:r;if(s.branching.type===mp.End)return mp.End;if(s.branching.type===mp.SpecificQuestion){if(Number.isInteger(s.branching.index))return s.branching.index}else if(s.branching.type===mp.ResponseBased){if(s.type===gp.SingleChoice){var o;let t=s.choices.indexOf(`${i}`);if(-1===t&&s.hasOpenChoice&&(t=s.choices.length-1),null===(o=s.branching)||void 0===o||null===(o=o.responseValues)||void 0===o?void 0:o.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===mp.End?mp.End:r}}else if(s.type===gp.Rating){var l;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const t=function(t,e){if(2===e){if(1>t||t>2)throw new Error("The response must be in range 1-2");return 1===t?"positive":"negative"}if(3===e){if(1>t||t>3)throw new Error("The response must be in range 1-3");return 1===t?"negative":2===t?"neutral":"positive"}if(5===e){if(1>t||t>5)throw new Error("The response must be in range 1-5");return t>2?3===t?"neutral":"positive":"negative"}if(7===e){if(1>t||t>7)throw new Error("The response must be in range 1-7");return t>3?4===t?"neutral":"positive":"negative"}if(10===e){if(0>t||t>10)throw new Error("The response must be in range 0-10");return t>6?t>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(i,s.scale);if(null===(l=s.branching)||void 0===l||null===(l=l.responseValues)||void 0===l?void 0:l.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===mp.End?mp.End:r}}return r}return Ng.warn("Falling back to next question index due to unexpected branching type"),r}const Bg=Gs("[SurveyTranslations]");function jg(t,e){const i=function(t){return function({overrideLanguage:t,storedPersonProperties:e,locale:i},n){const s=oa(t);if(s)return null==n||n.info(`Using override display language: ${s}`),s;const r=function(t){return t&&"object"==typeof t&&"language"in t?oa(t.language):null}(e);if(r)return null==n||n.info(`Using person property language: ${r}`),r;const o=oa(i);return o?(null==n||n.info(`Using detected locale: ${o}`),o):(null==n||n.info("No user language detected"),null)}({overrideLanguage:t.config.override_display_language,storedPersonProperties:xe(t.get_property)?t.get_property(lt):void 0,locale:Pa()},Bg)}(e);if(!i)return Bg.info("No user language detected"),{survey:t,language:null};const n=ha(t,i,Bg);return{survey:n.survey,language:n.matchedKey}}const Hg=t,Ug=n,zg="ph:show_survey_widget",Wg="PHWidgetSurveyClickListener";function Vg(t,e){try{const i=t.getBoundingClientRect(),n=Hg.innerHeight,s=Hg.innerWidth;let r=i.left+i.width/2-e/2;r+e>s-20&&(r=s-e-20),20>r&&(r=20);const o=n-i.bottom,l=250>o&&i.top>o;return{position:"fixed",top:l?"auto":`${i.bottom+12}px`,left:`${r}px`,right:"auto",bottom:l?n-i.top+12+"px":"auto",zIndex:Np.zIndex}}catch(t){return Sp.warn("Failed to calculate trigger position:",t),null}}var Gg=class{constructor(t){this.wi=new Map,this.ki=new Map,this.Si=new Map,this.xi=new Map,this.Ci=new Set,this.Mi=null,this.Ii=!1,this.Ti=null,this.Ri=null,this.$i=null,this.Ei=!1,this.handlePageUnload=()=>{const t=this._posthog.get_property(ht);if(t)for(const e of t)rg(e)&&Vp(e,this._posthog)},this.handlePopoverSurvey=(t,e,{resumeDelayFromActivation:i=!1}={})=>{var n,s,r,o,l,a;if(!Cp(this._posthog))return;const{survey:u,language:h}=this.Ai(t);this.Mi=h,this.$i=null,this.Oi=e;const c=this.Li(u,e);this.Pi(c.id);const{properties:d,initialResponses:v}=null!=e?e:{},f=!(!v||0>=Object.keys(v).length)&&this.Di(c,v,d,h);if(f&&!(null===(n=c.appearance)||void 0===n?void 0:n.displayThankYouMessage))return;this.Fi(c);let p={};if((null===(s=c.appearance)||void 0===s?void 0:s.position)===vp.NextToTrigger&&(null===(r=c.appearance)||void 0===r?void 0:r.widgetSelector)){const t=Ug.querySelector(c.appearance.widgetSelector);var g;t&&(p=Vg(t,parseInt((null===(g=c.appearance)||void 0===g?void 0:g.maxWidth)||Np.maxWidth))||{})}const m=(null===(o=c.appearance)||void 0===o?void 0:o.surveyPopupDelaySeconds)||0,{shadow:y}=Hp(c,this._posthog);this.xi.set(y,y.host);const _={posthog:this._posthog,survey:c,removeSurveyFromFocus:this.Ni,properties:d,style:p,isSurveyCompleted:f,skipShownEvent:null==e?void 0:e.skipShownEvent,surveyLanguage:h};if(this.$i=_,0>=m)return this.Ii=!0,jf(hg(Yg,ue({},_)),y);const b=()=>{this.Ii=!0;const{survey:i,language:n}=this.Ai(t);this.Mi=n;const s=this.Li(i,e),r=ue(ue({},_),{},{survey:s,surveyLanguage:n});this.$i=r,jf(hg(Yg,ue(ue({},r),{},{survey:ue(ue({},s),{},{appearance:ue(ue({},s.appearance),{},{surveyPopupDelaySeconds:0})})})),y)},w=()=>{if(!Cp(this._posthog)||!this.qi(c))return Sp.info(`Survey ${c.id} no longer eligible when its display delay elapsed; not displaying`),this.Ni(c);b()},k=i?null===(l=this._posthog.surveys)||void 0===l||null===(l=l._surveyEventReceiver)||void 0===l||null===(a=l.getActivationTimestamp)||void 0===a?void 0:a.call(l,c.id):void 0,S=Pe(k)?Math.max(0,Date.now()-k):0,x=Math.max(0,1e3*m-S);if(0>=x)return w();const C=Hg.setTimeout(()=>{this.wi.delete(c.id),w()},x);this.wi.set(c.id,C)},this.ji=t=>{var e;const{survey:i,language:n}=this.Ai(t),{shadow:s,isNewlyCreated:r}=Hp(i,this._posthog);this.xi.set(s,s.host),(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===dp.Tab&&this.Si.set(t.id,t),r&&jf(hg(tm,{posthog:this._posthog,survey:i,surveyLanguage:n},t.id),s)},this.Bi=t=>{const e=this.ki.get(t);e&&(e.element.removeEventListener("click",e.listener),e.element.removeAttribute(Wg),this.ki.delete(t),Sp.info(`Removed click listener for survey ${t}`))},this.Hi=t=>{this.zi(t)||(this.Ui(t),this.Bi(t.id))},this.Wi=t=>{this.zi(t)||(this.Ui(t),this.Si.delete(t.id))},this.zi=t=>{try{var e;const i=Ug.querySelector(lg(t,!0));return!!(null==i||null===(e=i.shadowRoot)||void 0===e?void 0:e.querySelector(".ph-survey"))}catch(t){return!1}},this.Vi=(t,e)=>{const i=Ug.querySelector(e),n=this.ki.get(t.id);if(i){if(this.ji(t),n){if(i===n.element)return;Sp.info(`Selector element changed for survey ${t.id}. Re-attaching listener.`),this.Bi(t.id)}if(!i.hasAttribute(Wg)){const e=e=>{var i,n;e.stopPropagation();const s=(null===(i=t.appearance)||void 0===i?void 0:i.position)===vp.NextToTrigger?Vg(e.currentTarget,parseInt((null===(n=t.appearance)||void 0===n?void 0:n.maxWidth)||Np.maxWidth)):{};Hg.dispatchEvent(new CustomEvent(zg,{detail:{surveyId:t.id,position:s}}))};nr(i,"click",e),i.setAttribute(Wg,"true"),this.ki.set(t.id,{element:i,listener:e,survey:t}),Sp.info(`Attached click listener for feedback button survey ${t.id}`)}}else n&&this.Hi(t)},this.renderPopover=t=>{if(!Cp(this._posthog))return;const{survey:e,language:i}=this.Ai(t),{shadow:n}=Hp(e,this._posthog);this.xi.set(n,n.host),jf(hg(Yg,{posthog:this._posthog,survey:e,removeSurveyFromFocus:this.Ni,surveyLanguage:i}),n)},this.renderSurvey=(t,e,i)=>{var n;if(!Cp(this._posthog))return;const{survey:s,language:r}=this.Ai(t);let o=!1;(null===(n=this._posthog.config)||void 0===n||null===(n=n.surveys)||void 0===n?void 0:n.prefillFromUrl)&&(o=this.Zi(s,r,i)),jf(hg(Yg,{posthog:this._posthog,survey:s,removeSurveyFromFocus:this.Ni,isPopup:!1,properties:i,isSurveyCompleted:o,surveyLanguage:r}),e)},this.getActiveMatchingSurveys=(t,e=!1)=>{var i;null===(i=this._posthog)||void 0===i||null===(i=i.surveys)||void 0===i||i.getSurveys(e=>{t(e.filter(t=>this.qi(t)))},e)},this.callSurveysAndEvaluateDisplayLogic=(t=!1)=>{this.getActiveMatchingSurveys(t=>{const e=Cp(this._posthog),i=t.filter(t=>e&&(t.type===pp.Popover||t.type===pp.Widget)),n=new Set(i.map(t=>t.id));for(const t of Array.from(this.wi.keys()))n.has(t)||this.cancelSurvey(t);const s=this.Gi(i),r=new Set,o=new Set;s.forEach(t=>{if(t.type===pp.Widget){var e,i,n,s;if((null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===dp.Tab)return o.add(t.id),void this.ji(t);(null===(i=t.appearance)||void 0===i?void 0:i.widgetType)===dp.Selector&&(null===(n=t.appearance)||void 0===n?void 0:n.widgetSelector)&&(r.add(t.id),this.Vi(t,null===(s=t.appearance)||void 0===s?void 0:s.widgetSelector))}Me(this.Qi)&&t.type===pp.Popover&&this.handlePopoverSurvey(t,void 0,{resumeDelayFromActivation:!0})}),this.ki.forEach(({survey:t})=>{r.has(t.id)||this.Hi(t)}),this.Si.forEach((t,e)=>{o.has(e)||this.Wi(t)})},t)},this.Fi=t=>{Me(this.Qi)||Sp.error(`Survey ${this.Qi} already in focus. Cannot add survey ${t.id}.`),this.Qi=t.id},this.Ni=t=>{this.Qi!==t.id&&Sp.error(`Survey ${t.id} is not in focus. Cannot remove survey ${t.id}.`),this.Pi(t.id),this.Qi=null,this.Mi=null,this.Ii=!1,this.$i=null,this.Oi=void 0,this.Ui(t)},this._posthog=t,this.Qi=null,this.Ti=()=>this.Ji(),nr(Hg,"languagechange",this.Ti),this.Ri=t.onFeatureFlags(()=>this.Ji())}Ji(){if(Me(this.Qi))return;const t=this._posthog.get_property(ht),e=null==t?void 0:t.find(t=>t.id===this.Qi);if(!e)return;const{survey:i,language:n}=this.Ai(e);if(n===this.Mi)return;if(this.Mi=n,!this.Ii)return;const s=this.Li(i,this.Oi),{shadow:r}=Hp(s,this._posthog);jf(hg(Yg,ue(ue({},this.$i),{},{posthog:this._posthog,survey:s,removeSurveyFromFocus:this.Ni,surveyLanguage:n})),r)}get Ki(){var t,e,i;return null!==(t=null===(e=(i=this._posthog).getExtension)||void 0===e?void 0:e.call(i,"featureFlags"))&&void 0!==t?t:this._posthog.featureFlags}Li(t,e){return(null==e?void 0:e.position)||(null==e?void 0:e.selector)?ue(ue({},t),{},{appearance:ue(ue(ue({},t.appearance),e.position&&{position:e.position}),e.selector&&{widgetSelector:e.selector})}):t}Pi(t){const e=this.wi.get(t);e&&(clearTimeout(e),this.wi.delete(t))}cancelSurvey(t){this.wi.has(t)&&(Sp.info(`Cancelled pending survey ${t}`),this.Pi(t),this.Qi===t&&(this.Qi=null,this.Mi=null,this.Ii=!1,this.$i=null,this.Oi=void 0))}setAutomaticDisplayDispose(t){this.Xi=t}dispose(){var t;null===(t=this.Xi)||void 0===t||t.call(this),this.Xi=void 0,this.Ti&&(Hg.removeEventListener("languagechange",this.Ti),this.Ti=null),this.Ri&&(this.Ri(),this.Ri=null),this.wi.forEach((t,e)=>this.Pi(e)),this.ki.forEach((t,e)=>this.Bi(e)),this.xi.forEach((t,e)=>{jf(null,e),null==t||t.remove()}),this.xi.clear(),this.Si.clear(),this.Qi=null}Gi(t){return t.sort((t,e)=>{var i,n;const s=rg(t),r=rg(e);if(s&&!r)return-1;if(!s&&r)return 1;const o=t.schedule===yp.Always,l=e.schedule===yp.Always;return o&&!l?1:!o&&l?-1:((null===(i=t.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)-((null===(n=e.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)})}Ai(t){return jg(t,this._posthog)}Zi(t,e,i){if(this.Ci.has(t.id))return!1;const{params:n}=function(){const t={};let e=!1;const i=Hg.location.search.replace(/^\?/,"");if(!i)return{params:t,autoSubmit:e};const n=i.split("&");for(const i of n){const[n,s]=i.split("=");if(!n||Te(s))continue;const r=decodeURIComponent(n),o=decodeURIComponent(s);if("auto_submit"===r&&"true"===o){e=!0;continue}const l=r.match(/^q(\d+)$/);if(l){const e=parseInt(l[1],10);t[e]||(t[e]=[]),t[e].push(o)}}return{params:t,autoSubmit:e}}();if(0===Object.keys(n).length)return!1;Sp.info("[Survey Prefill] Detected URL prefill parameters");const s=this.Yi(t,n,e);return!!s&&(this.tr(t,s,i,e),this.Ci.add(t.id),s.isSurveyCompleted)}tr(t,e,i,n){const{responses:s,submissionId:r,isSurveyCompleted:o,skippedResponses:l}=e;(Object.keys(l).length>0&&t.enable_partial_responses||o)&&Up({responses:o?s:l,survey:t,surveySubmissionId:r,posthog:this._posthog,isSurveyCompleted:o,properties:i,surveyLanguage:n})}Di(t,e,i,n){const s={};for(const[t,i]of Object.entries(e))s[parseInt(t)]=Se(i)?i.map(String):[String(i)];Sp.info("[Survey] Processing initial responses");const r=this.Yi(t,s,n);return!!r&&(this.tr(t,r,i,n),r.isSurveyCompleted)}Yi(t,e,i){try{const n=function(t,e){const i={};return t.questions.forEach((t,n)=>{if(!e[n]||!t.id)return;const s=e[n],r=ea(t.id);try{switch(t.type){case gp.SingleChoice:{if(!t.choices||0===t.choices.length)return void Vs.warn(`[Survey Prefill] Question ${n} has no choices`);const e=parseInt(s[0],10);if(isNaN(e)||0>e||e>=t.choices.length)return void Vs.warn(`[Survey Prefill] Invalid choice index for q${n}: ${s[0]}`);i[r]=t.choices[e];break}case gp.MultipleChoice:{if(!t.choices||0===t.choices.length)return void Vs.warn(`[Survey Prefill] Question ${n} has no choices`);const e=s.map(t=>parseInt(t,10)).filter(e=>!isNaN(e)&&e>=0&&t.choices.length>e);if(0===e.length)return void Vs.warn(`[Survey Prefill] No valid choices for q${n}`);const o=[...new Set(e.map(e=>t.choices[e]))];e.length>o.length&&Vs.warn(`[Survey Prefill] Removed duplicate choices for q${n}`),i[r]=o;break}case gp.Rating:{const e=parseInt(s[0],10),o=t.scale||10;if(isNaN(e)||0>e||e>o)return void Vs.warn(`[Survey Prefill] Invalid rating for q${n}: ${s[0]} (scale: 0-${o})`);i[r]=e;break}default:Vs.info(`[Survey Prefill] Question type ${t.type} does not support prefill`)}}catch(t){Vs.error(`[Survey Prefill] Error converting q${n}:`,t)}}),i}(t,e);if(0===Object.keys(n).length)return Sp.warn("[Survey Prefill] No valid responses after conversion"),null;const s=Ml(),{startQuestionIndex:r,skippedResponses:o,skippedIndices:l}=function(t,e,i){let n=0;const s={},r=[],o=t.questions.length+1;let l=0;for(;t.questions.length>n&&o>l&&(l++,e.includes(n));){const e=t.questions[n];if(!e||!("skipSubmitButton"in e)||!e.skipSubmitButton)break;if(e.id){const t=ea(e.id);Te(i[t])||(s[t]=i[t])}r.push(n);const o=qg(t,n,e.id?i[ea(e.id)]:null);if(o===mp.End)return{startQuestionIndex:t.questions.length,skippedResponses:s,skippedIndices:r};n=o}return{startQuestionIndex:n,skippedResponses:s,skippedIndices:r}}(t,Object.keys(e).map(t=>parseInt(t,10)),n),a=r>=t.questions.length;return ng(t,{surveySubmissionId:s,responses:n,lastQuestionIndex:r,questionOrder:Qp(t.questions),visitedIndices:l,surveyLanguage:i}),Sp.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:n,submissionId:s,startQuestionIndex:r,isSurveyCompleted:a,skippedResponses:o}}catch(t){return Sp.error("[Survey Prefill] Error handling prefill:",t),null}}er(t,e=void 0){if(!t)return!0;const i=this.Ki,n=!!(null==i?void 0:i.isFeatureEnabled(t,{send_event:!t.startsWith("survey-targeting-")}));let s=!0;e&&(s=(null==i?void 0:i.getFeatureFlag(t,{send_event:!1}))===e||"any"===e);const r=n&&s;return r||this.nr(t),r}nr(t){var e;!this.Ei&&(null===(e=this._posthog.config)||void 0===e?void 0:e.advanced_disable_feature_flags)&&(this.Ei=!0,Sp.warn(`Survey feature flag "${t}" evaluated to false because advanced_disable_feature_flags is set. PostHog creates an internal targeting flag for almost every survey, so no survey can display while flags are disabled. To keep surveys working, replace advanced_disable_feature_flags with advanced_only_evaluate_survey_feature_flags, which evaluates survey flags only.`))}ir(e){return!e.conditions||eg(e,this._posthog)&&function(e){var n,s;return function(e,n){var s,r,o;if(!e||0===e.length)return!0;if(!u)return!1;const l=Ji(u,{userAgentDataPlatform:null==i||null===(s=i.userAgentData)||void 0===s?void 0:s.platform,maxTouchPoints:null==i?void 0:i.maxTouchPoints,screenWidth:null==t||null===(r=t.screen)||void 0===r?void 0:r.width,screenHeight:null==t||null===(o=t.screen)||void 0===o?void 0:o.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio});return pa[null!=n?n:"icontains"](e,[l])}(null===(n=e.conditions)||void 0===n?void 0:n.deviceTypes,null===(s=e.conditions)||void 0===s?void 0:s.deviceTypesMatchType)}(e)&&function(t){var e;return!(null===(e=t.conditions)||void 0===e?void 0:e.selector)||!!(null==Dp?void 0:Dp.querySelector(t.conditions.selector))}(e)}rr(t){var e;return Kp(t)?{satisfied:!0}:t.internal_targeting_flag_key&&function(t){var e;return"recurring"===t.schedule||(null!==(e=t.current_iteration)&&void 0!==e?e:0)>0}(t)&&!(null===(e=this.Ki)||void 0===e?void 0:e.hasLoadedFlags)?(this.nr(t.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this.er(t.internal_targeting_flag_key)}}checkSurveyEligibility(t){var e,i;const n={eligible:!0,reason:void 0};if(!$p(t))return n.eligible=!1,n.reason=`Survey is not running. It was completed on ${t.end_date}`,n;if(!Rp.includes(t.type))return n.eligible=!1,n.reason=`Surveys of type ${t.type} are never eligible to be shown in the app`,n;const s=null===(e=t.conditions)||void 0===e?void 0:e.linkedFlagVariant;if(!this.er(t.linked_flag_key,s))return n.eligible=!1,n.reason=s?`Survey linked feature flag is not enabled for variant ${s}`:"Survey linked feature flag is not enabled",n;if(!this.er(t.targeting_flag_key))return n.eligible=!1,n.reason="Survey targeting feature flag is not enabled",n;const r=this.rr(t);var o;return r.satisfied?function(t,e){if(!t||!e)return!0;const i="string"==typeof e?new Date(e):e,n=Math.abs((new Date).getTime()-i.getTime());return Math.ceil(n/864e5)>t}(null===(i=t.conditions)||void 0===i?void 0:i.seenSurveyWaitPeriodInDays,Ll.Ot("lastSeenSurveyDate"))?(t=>!!Ll.Ot(Ip(t))&&!Kp(t))(t)?(n.eligible=!1,n.reason="Survey has already been seen and it can't be activated again",n):n:(n.eligible=!1,n.reason="Survey wait period has not passed",n):(n.eligible=!1,n.reason=null!==(o=r.reason)&&void 0!==o?o:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",n)}checkSurveyCaptureEligibility(){return Cp(this._posthog)?{eligible:!0}:{eligible:!1,reason:xp}}checkSurveyDisplayEligibility(t){const e=this.checkSurveyCaptureEligibility();return e.eligible?this.checkSurveyEligibility(t):e}checkSurveyRenderability(t){const e=this.checkSurveyDisplayEligibility(t);return e.eligible&&!this.sr(t)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:e}sr(t){var e;if(!ca(t)&&!Tp(t))return!0;const i=null===(e=this._posthog.surveys)||void 0===e||null===(e=e._surveyEventReceiver)||void 0===e?void 0:e.getSurveys();return!!(null==i?void 0:i.includes(t.id))}ar(t){var e;return!(null===(e=t.feature_flag_keys)||void 0===e?void 0:e.length)||t.feature_flag_keys.every(({key:t,value:e})=>!t||!e||this.er(e))}qi(t){return this.checkSurveyEligibility(t).eligible&&this.ir(t)&&this.sr(t)&&this.ar(t)}Ui(t){try{const e=Ug.querySelector(lg(t,!0));(null==e?void 0:e.shadowRoot)&&(jf(null,e.shadowRoot),this.xi.delete(e.shadowRoot)),null==e||e.remove()}catch(e){Sp.warn(`Failed to remove survey ${t.id} from DOM:`,e)}}getTestAPI(){return{addSurveyToFocus:this.Fi,removeSurveyFromFocus:this.Ni,surveyInFocus:this.Qi,surveyTimeouts:this.wi,handleWidget:this.ji,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this.Vi,sortSurveysByAppearanceDelay:this.Gi,checkFlags:this.ar.bind(this),isSurveyFeatureFlagEnabled:this.er.bind(this),onLanguageChange:this.Ji.bind(this),currentLanguage:this.Mi,surveyIsRendered:this.Ii}}};function Zg(t,e){if(!Ug||!Hg)return;const i=new Gg(t);if(t.config.disable_surveys_automatic_display)return Sp.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===e)return Sp.info("There are no surveys to load or Surveys is disabled in the project settings."),i;let n;i.callSurveysAndEvaluateDisplayLogic(!0);const s=()=>{Te(n)&&(n=setInterval(()=>{i.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},r=()=>{Te(n)||(clearInterval(n),n=void 0)};s();const o=()=>{Ug.hidden?r():(i.callSurveysAndEvaluateDisplayLogic(!1),s())};return nr(Ug,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{r(),Ug.removeEventListener("visibilitychange",o)}),i}function Qg({survey:t,removeSurveyFromFocus:e=()=>{},setSurveyVisible:i,isPreviewMode:n=!1,posthog:s}){Xf(()=>{var r;if(n||!(null===(r=t.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var n;const r=t.type===pp.Widget,o=eg(t,s),l=(null===(n=t.appearance)||void 0===n?void 0:n.widgetType)===dp.Tab&&r;if(!o)return Sp.info(`Hiding survey ${t.id} because URL does not match`),i(!1),e(t);l&&(Sp.info(`Showing survey ${t.id} because it is a feedback button tab and URL matches`),i(!0))};nr(Hg,"popstate",o),nr(Hg,"hashchange",o);const l=Hg.history.pushState,a=Hg.history.replaceState;return Hg.history.pushState=function(...t){l.apply(this,t),o()},Hg.history.replaceState=function(...t){a.apply(this,t),o()},()=>{Hg.removeEventListener("popstate",o),Hg.removeEventListener("hashchange",o),Hg.history.pushState=l,Hg.history.replaceState=a}},[n,t,e,i,s])}const Jg=200;function Kg(t=fp.Right){switch(t){case fp.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case fp.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case fp.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function Yg({survey:t,forceDisableHtml:e,posthog:i,style:n={},previewPageIndex:s,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:l=()=>{},onPreviewBack:a=()=>{},onPopupSurveyDismissed:u=()=>{},onCloseConfirmationMessage:h=()=>{},properties:c,isSurveyCompleted:d,skipShownEvent:v,surveyLanguage:f}){var p,g,m,y,_,b,w,k,S,x,C,T;const E=tp(null),I=Number.isInteger(s),{isPopupVisible:M,isSurveySent:R,hidePopupWithAnimation:P}=function(t,e,i,n,s,r,o,l,a){const[u,h]=Yf(n||0===i||t.type===pp.ExternalSurvey),[c,d]=Yf(!1),v=tp(!1),f=()=>{const e=()=>{r&&s(t),h(!1)};if(v.current)return;const i=null==o?void 0:o.current;i?(v.current=!0,i.style.transition=`opacity ${Jg}ms ease-out`,i.style.opacity="0",setTimeout(()=>{v.current=!1,e()},250)):e()},p=e=>{e.detail.surveyId===t.id&&f()};return Xf(()=>{if(!e)return void Sp.error("usePopupVisibility hook called without a PostHog instance.");if(n)return;let s;const r=e=>{var i,n;if(e.detail.surveyId===t.id){if(!(null===(i=t.appearance)||void 0===i?void 0:i.displayThankYouMessage))return f();d(!0),(null===(n=t.appearance)||void 0===n?void 0:n.autoDisappear)&&(s&&clearTimeout(s),s=setTimeout(f,5e3))}},o=()=>{if(eg(t,e)){var i;h(!0),Hg.dispatchEvent(new Event("PHSurveyShown")),l||e.capture(_p.SHOWN,ue(ue({[bp.SURVEY_NAME]:t.name,[bp.SURVEY_ID]:t.id,[bp.SURVEY_ITERATION]:t.current_iteration,[bp.SURVEY_ITERATION_START_DATE]:t.current_iteration_start_date},a&&{[bp.SURVEY_LANGUAGE]:a}),{},{sessionRecordingUrl:null===(i=e.get_session_replay_url)||void 0===i?void 0:i.call(e)}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}};nr(Hg,"PHSurveyClosed",p),nr(Hg,"PHSurveySent",r);const u=i>0?setTimeout(o,i):void 0;return Te(u)&&o(),()=>{Te(u)||clearTimeout(u),Te(s)||clearTimeout(s),Hg.removeEventListener("PHSurveyClosed",p),Hg.removeEventListener("PHSurveySent",r)}},[]),Qg({survey:t,removeSurveyFromFocus:s,setSurveyVisible:h,isPreviewMode:n,posthog:e}),{isPopupVisible:u,isSurveySent:c,setIsPopupVisible:h,hidePopupWithAnimation:f}}(t,i,(null===(p=t.appearance)||void 0===p?void 0:p.surveyPopupDelaySeconds)?1e3*t.appearance.surveyPopupDelaySeconds:0,I,r,o,E,v,f),O=R||s===t.questions.length||!0===d,[A,F]=Yf(!1),D=ep(()=>!!sg(t),[t]),L=!(!(null===(g=t.appearance)||void 0===g?void 0:g.introScreenHeader)&&!(null===(m=t.appearance)||void 0===m?void 0:m.introScreenDescription)),N=I?-1===s:!!(null===(y=t.appearance)||void 0===y?void 0:y.displayIntroScreen)&&L&&!A&&!D,q=ep(()=>{const e=sg(t),n=(null==e?void 0:e.surveySubmissionId)||Ml();return{isPreviewMode:I,previewPageIndex:s,onPopupSurveyDismissed(){f?Wp(t,i,I,f):Wp(t,i,I),u()},isPopup:o||!1,surveySubmissionId:n,onPreviewSubmit:l,onPreviewBack:a,posthog:i,properties:c,surveyLanguage:f}},[I,s,o,i,t,u,l,a,c,f]);return M?hg(Yp.Provider,{value:q,children:hg("div",{className:"ph-survey",style:ue(ue({},ag(t.type,null===(_=t.appearance)||void 0===_?void 0:_.position,null===(b=t.appearance)||void 0===b?void 0:b.widgetType)),n),ref:E,children:O?hg(Cg,{header:(null===(w=t.appearance)||void 0===w?void 0:w.thankYouMessageHeader)||"Thank you!",description:(null===(k=t.appearance)||void 0===k?void 0:k.thankYouMessageDescription)||"",forceDisableHtml:!!e,contentType:null===(S=t.appearance)||void 0===S?void 0:S.thankYouMessageDescriptionContentType,appearance:t.appearance||Np,onClose(){P(),h()}}):N?hg($g,{header:(null===(x=t.appearance)||void 0===x?void 0:x.introScreenHeader)||"",description:(null===(C=t.appearance)||void 0===C?void 0:C.introScreenDescription)||"",forceDisableHtml:!!e,contentType:null===(T=t.appearance)||void 0===T?void 0:T.introScreenDescriptionContentType,appearance:t.appearance||Np,onStart:()=>F(!0)}):hg(Xg,{survey:t,forceDisableHtml:!!e,posthog:i})})}):null}function Xg({survey:t,forceDisableHtml:e,posthog:i}){var n,s;const r=ep(()=>{const e=sg(t);if(!e)return null;const i=Pe(e.lastQuestionIndex);return!i||i&&e.lastQuestionIndex>=0&&t.questions.length>e.lastQuestionIndex?e:(og(t),null)},[t]),[o,l]=Yf(()=>((null==r?void 0:r.responses)&&Sp.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[a,u]=Yf(!1),{previewPageIndex:h,onPopupSurveyDismissed:c,isPopup:d,onPreviewSubmit:v,onPreviewBack:f,surveySubmissionId:p,isPreviewMode:g,properties:m,surveyLanguage:y}=ip(Yp),[_,b]=Yf(()=>{const e=null==r?void 0:r.lastQuestionIndex,i=Pe(e)&&e>=0&&t.questions.length>e?e:0;return Pe(h)&&h>=0?h:i}),[w,k]=Yf(()=>{var e;return(null!==(e=null==r?void 0:r.visitedIndices)&&void 0!==e?e:[]).filter(e=>e>=0&&t.questions.length>e)}),[S,x]=Yf(()=>{var e;const i=sg(t);return null!==(e=null==i?void 0:i.questionSnapshots)&&void 0!==e?e:{}}),C=ep(()=>Qp(Jp(t,r)),[t.id,r]),T=ep(()=>{if(!C||new Set(C).size!==C.length)return Jp(t,r);const e=new Map(t.questions.map(t=>[t.id,t])),i=C.map(t=>e.get(t)).filter(t=>!!t);return i.length===C.length?i:t.questions},[C,t.questions,t,r]);Xf(()=>{!g||Te(h)||0>h||b(h)},[h,g]);const E=!!(null===(n=t.appearance)||void 0===n?void 0:n.allowGoBack)&&(g?(null!=h?h:0)>0:w.length>0),I=T.at(_);return I?hg("form",{className:"survey-form",name:"surveyForm",children:[d&&!0!==(null===(s=t.appearance)||void 0===s?void 0:s.hideCancelButton)&&hg(Sg,{onClick(){c()}}),hg("div",{className:"survey-box","data-question-index":_,children:[a&&hg("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),em({question:I,forceDisableHtml:e,displayQuestionIndex:_,appearance:t.appearance||Np,onSubmit:e=>(({res:e,displayQuestionIndex:n,questionId:s})=>{if(!i)return void Sp.error("onNextButtonClick called without a PostHog instance.");if(!Cp(i))return void u(!0);if(u(!1),!s)return void Sp.error("onNextButtonClick called without a questionId.");const r=ea(s),a=ue(ue({},o),{},{[r]:e});l(a);const h=T[n],c=(null==h?void 0:h.id)?ue(ue({},S),{},{[h.id]:h.question}):S;x(c);const d=qg(t,n,e),v=d===mp.End,f=[...w,n];if(v||(k(f),b(d),ng(t,{surveySubmissionId:p,responses:a,lastQuestionIndex:d,questionOrder:Qp(T),visitedIndices:f,surveyLanguage:y,questionSnapshots:c})),t.enable_partial_responses||v){const e=new Set(f.map(t=>{var e;return null===(e=T[t])||void 0===e?void 0:e.id}).filter(t=>!!t).map(t=>ea(t))),n=Object.fromEntries(Object.entries(a).filter(([t])=>e.has(t)));Up({responses:n,survey:t,surveySubmissionId:p,isSurveyCompleted:v,posthog:i,properties:m,surveyLanguage:y,questionSnapshots:c})}})({res:e,displayQuestionIndex:_,questionId:I.id}),onPreviewSubmit:v,initialValue:I.id?o[ea(I.id)]:void 0,canGoBack:E,onBack(){if(g)return void f();if(0===w.length)return;const e=w[w.length-1],i=w.slice(0,-1);k(i),b(e),ng(t,{surveySubmissionId:p,responses:o,lastQuestionIndex:e,questionOrder:Qp(T),visitedIndices:i,surveyLanguage:y,questionSnapshots:S})}})]})]}):null}function tm({survey:t,forceDisableHtml:e,posthog:i,readOnly:n,surveyLanguage:s}){var r,o,l,a,u,h,c;const[d,v]=Yf(!0),[f,p]=Yf(!1),[g,m]=Yf({}),y=tp(void 0),_=()=>{(f||!i||n||Cp(i))&&p(!f)};if(Xf(()=>{var e;if(!i)return void Sp.error("FeedbackWidget called without a PostHog instance.");if(n)return;"tab"===(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)&&m({top:"50%",bottom:"auto"});const s=e=>{var i;const n=e;(null===(i=n.detail)||void 0===i?void 0:i.surveyId)===t.id&&(Sp.info(`Received show event for feedback button survey ${t.id}`),m(n.detail.position||{}),_())};return nr(Hg,zg,s),()=>{Te(y.current)||(clearTimeout(y.current),y.current=void 0),Hg.removeEventListener(zg,s)}},[i,n,t.id,null===(r=t.appearance)||void 0===r?void 0:r.widgetType,null===(o=t.appearance)||void 0===o?void 0:o.widgetSelector,null===(l=t.appearance)||void 0===l?void 0:l.borderColor]),Qg({survey:t,setSurveyVisible:v,posthog:i}),!d)return null;const b=()=>{t.schedule!==yp.Always&&v(!1),Te(y.current)||clearTimeout(y.current),y.current=setTimeout(()=>{y.current=void 0,p(!1)},200)};return hg(wf,{children:["tab"===(null===(a=t.appearance)||void 0===a?void 0:a.widgetType)&&hg("button",{className:"ph-survey-widget-tab "+((null===(u=t.appearance)||void 0===u?void 0:u.tabPosition)===fp.Top?"widget-tab-top":""),onClick:_,disabled:n,style:Kg(null===(h=t.appearance)||void 0===h?void 0:h.tabPosition),children:(null===(c=t.appearance)||void 0===c?void 0:c.widgetLabel)||""}),f&&hg(Yg,{posthog:i,survey:t,forceDisableHtml:e,style:g,onPopupSurveyDismissed:b,onCloseConfirmationMessage:b,surveyLanguage:s})]})}const em=({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:l,onBack:a})=>{const u={forceDisableHtml:e,appearance:n,onPreviewSubmit(t){r(t)},onSubmit(t){s(t)},initialValue:o,displayQuestionIndex:i,canGoBack:l,onBack:a};switch(t.type){case gp.Open:return _f(Eg,ue(ue({},u),{},{question:t,key:t.id}));case gp.Link:return _f(Ig,ue(ue({},u),{},{question:t,key:t.id}));case gp.Rating:return _f(Mg,ue(ue({},u),{},{question:t,key:t.id}));case gp.SingleChoice:case gp.MultipleChoice:return _f(Pg,ue(ue({},u),{},{question:t,key:t.id}));default:return Sp.error(`Unsupported question type: ${t.type}`),null}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.generateSurveys=Zg,d.extendPostHogWithSurveys=Zg;const im=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},nm=1e4,sm=(t,e,i)=>i.remaining>0?e.length>i.remaining?(t.push(e.slice(0,i.remaining)),i.remaining=0,i.truncated=!0,!1):(t.push(e),i.remaining-=e.length,!0):(i.truncated=!0,!1),rm=(t,e,i)=>{const n=JSON.stringify(t);if(i.remaining>=n.length)return sm(e,n,i);if(i.truncated=!0,2>i.remaining)return!1;let s=0,r=Math.min(t.length,i.remaining-2);for(;r>s;){const e=Math.ceil((s+r)/2);JSON.stringify(t.slice(0,e)).length>i.remaining?r=e-1:s=e}return sm(e,JSON.stringify(t.slice(0,s)),i)},om=t=>void 0!==t&&"function"!=typeof t&&"symbol"!=typeof t&&"bigint"!=typeof t,lm=(t,e,i)=>{if(!i.truncated){if(i.keysRemaining-=1,i.sizeRemaining-=String(e).length+t.length,0>=i.keysRemaining||0>=i.sizeRemaining)return i.truncated=!0,void(i.result.attributes_truncated=!0);i.result[t]=e}},am=(t,e,i)=>{if(!i.truncated)if(Ce(t)){if(i.seen.has(t))return void lm(e||"circular","[Circular]",i);i.seen.add(t);try{for(const n in t)try{if(!{}.hasOwnProperty.call(t,n))continue;if(am(t[n],e?`${e}.${n}`:n,i),i.truncated)return}catch(t){continue}}catch(t){}}else lm(e,t,i)},um=(t,e,i,n,s=!1,r)=>{if(!om(t))return!s||sm(e,"null",i);if(Me(t)||(t=>{try{return Pe(t)||Ae(t)}catch(t){return!1}})(t))return sm(e,JSON.stringify(t),i);if("string"==typeof t)return rm(t,e,i);if(!Ce(t)&&!Se(t))return sm(e,JSON.stringify(t),i);if(n.has(t))return rm("[Circular]",e,i);n.add(t);try{const r=t.toJSON;if(xe(r))return um(r.call(t),e,i,n,s)}catch(t){}try{const n={}.toString.call(t);if("[object String]"===n)return rm(String(t.valueOf()),e,i);if("[object Number]"===n||"[object Boolean]"===n)return sm(e,JSON.stringify(t.valueOf()),i)}catch(t){}if(t instanceof Error){const o={};try{for(const e in t)({}).hasOwnProperty.call(t,e)&&(o[e]=t[e])}catch(t){}try{o.name=t.name}catch(t){}try{o.message=t.message}catch(t){}try{o.stack=t.stack}catch(t){}return um(o,e,i,n,s,r)}if(Se(t)){if(!sm(e,"[",i))return!1;for(let s=0;t.length>s;s++){if(s>0&&!sm(e,",",i))return!1;let r;try{r=t[s]}catch(t){r=void 0}if(!um(r,e,i,n,!0))return!1}return sm(e,"]",i)}if(!sm(e,"{",i))return!1;let o=!0;try{for(const s in t){if(!{}.hasOwnProperty.call(t,s))continue;if(0>=i.remaining)return i.truncated=!0,!1;let l;try{l=t[s]}catch(t){continue}if(r)try{am(l,s,r)}catch(t){}if(!om(l))continue;const a=`${o?"":","}${JSON.stringify(s)}:`;if(a.length>=i.remaining)return i.truncated=!0,!1;const u=e.length,h=i.remaining,c=i.truncated;if(!sm(e,a,i))return!1;const d=e.length,v=um(l,e,i,n,!1),f=i.truncated;if(e.length!==d){if(o=!1,!v)return!1}else if(e.length=u,i.remaining=h,i.truncated=v?c:f,!v)return!1}}catch(t){}return sm(e,"}",i)},hm=(t,e)=>{const i=[],n={remaining:e,truncated:!1},s=Ce(t[0])?{result:{},keysRemaining:50,sizeRemaining:nm,truncated:!1,seen:new WeakSet([t[0]])}:void 0;for(let e=0;t.length>e&&(0>=e||sm(i," ",n))&&um(t[e],i,n,new WeakSet,!1,0===e?s:void 0);e++);return{body:i.join("")+(n.truncated?"...":""),truncated:n.truncated,attributes:(null==s?void 0:s.result)||{}}},cm={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},dm=t=>"canCapture"in t,vm=t=>dm(t)?t.canCapture?t.getExtension(Op):void 0:t.is_capturing()?t.logs:void 0,fm=(t,e,i)=>{if(dm(t))return void e.captureConsoleLog(i);const n=(t=>{const e=/^1\.(\d+)\.(\d+)$/.exec(t);if(!e)return;const i=Number(e[1]),n=Number(e[2]);return 392>i||i>419?void 0:410===i?n>4?n>10?void 0:"de":"le":418===i?n>3?n>10?n>14?n>17?void 0:"vi":"ci":"ui":"he":419===i?n>2?void 0:"vi":410>i?"le":"he"})(t.version),s=n?e[n]:void 0;xe(s)&&s.call(e,i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.logs={initializeLogs(t){let e=t;const i=[],n={host:d.location.host};let s=!1;for(const t of Object.keys(cm)){const r=i=>(...r)=>{let o=!1;try{const i=e;if(r.length>0&&!s&&i){const e=vm(i);if(e){s=!0,o=!0;const{body:l,truncated:a,attributes:u}=hm(r,nm),h=ue(ue({},n),a?{body_truncated:"true"}:{}),c={level:cm[t],body:l,attributes:ue(ue({"log.source":`console.${t}`},h),u)};fm(i,e,c)}}}catch(t){}finally{o&&(s=!1),i.apply(d.console,r)}},o=d.console[t];i.push(wv(d.console,t,t=>{const e=r(t);return e.__rrweb_original__=im(o),e}))}return()=>{e=void 0,i.forEach(t=>t())}},replayConsoleBuffer(t,e){const i=vm(t);if(i)for(const t of e)try{var n;const{body:e,truncated:s,attributes:r}=hm(t.args,nm);null===(n=i.captureBufferedConsoleLog)||void 0===n||n.call(i,{level:cm[t.level],body:e,attributes:ue(ue({"log.source":`console.${t.level}`,host:d.location.host},s?{body_truncated:"true"}:{}),r)},t.context,t.occurredAtMs)}catch(t){}}};const pm=t=>Be(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),gm=Gs("[Error tracking]"),mm="webkit-masked-url:",ym=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],_m=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",mm],bm=["__firefox__","__gCrWeb"];function wm(){return new yn([new qn,new Qn,new jn,new Bn,new Gn,new Vn,new Un,new Zn],function(t,...e){return(i,n=0)=>{const s=[],r=i.split("\n"),o=Math.min(r.length,n+1e3),l=[];for(let i=n;o>i;i++){const n=r[i];if(n.length>1024)continue;const o=Rn.test(n)?n.replace(Rn,"$1"):n;if(!o.match(/\S*Error: /)){for(const i of e){const e=i(o,t);if(e){s.push(e);const t=On(s);if(t){for(let e=l.length-1;e>=0;e--){const i=l[e];if(t.start>=i.start+i.length)break;l.pop()}l.push(t)}break}}if(Ln(s,l)>=50)break}}const a=[...l].sort((t,e)=>e.start-t.start),u=a[a.length-1];if(u){const t=Fn(s,u);s.splice(u.start-t,t);for(const e of a)e.start-=t}for(const t of a)An(s,t);return l.some(t=>0===t.start&&s.length===t.length)&&function(t){const e=t.map(t=>`${t.function}|${t.filename}|${t.lineno}|${t.colno}|${t.module}`);let i=0;for(let t=1;e.length>t;t++)Nn(e,t,i)&&(i=t);t.push(...t.splice(0,i))}(s),function(t){if(!t.length)return[];const e=Array.from(t);return e.reverse(),e.slice(0,50).map(t=>{return ue(ue({},t),{},{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||"?"});var i})}(s)}}("web:javascript",Tn,Mn))}const km=Gs("[ExceptionAutocapture]"),Sm=wm(),xm=(t,e)=>{try{return t()}catch(t){return e}},Cm=(t,e)=>xm(()=>t(e()),void 0),$m=t=>xm(()=>xe(t)&&xe(t.call),!1),Tm=(t,e)=>xm(()=>{t[e].__POSTHOG_INSTRUMENTED__=!0},void 0),Em=(t,e,i)=>{xm(()=>{var i;null===(i=t[e])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),xm(()=>{t[e]=i},void 0)},Im=e=>{const i=t;i||km.info("window not available, cannot wrap onerror");const n=xm(()=>i.onerror,void 0);return i.onerror=function(...t){var i;return Cm(e,()=>Sm.buildFromUnknown((([t,e,i,n,s])=>{if(null!=s)return s;if(Ee(t)&&Ee(e)&&e.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:t,filename:e,lineno:i,colno:n})}catch(e){return t}return t})(t),{mechanism:{handled:!1}})),!!$m(n)&&null!==(i=n(...t))&&void 0!==i&&i},Tm(i,"onerror"),()=>Em(i,"onerror",n)},Mm=(e,i=!1)=>{const n=t;n||km.info("window not available, cannot wrap onUnhandledRejection");const s=xm(()=>n.onunhandledrejection,void 0);return n.onunhandledrejection=function(t){var n;return Cm(e,()=>Sm.buildFromUnknown(t,{mechanism:{handled:!1}})),$m(s)?null!==(n=s(t))&&void 0!==n&&n:i},Tm(n,"onunhandledrejection"),()=>Em(n,"onunhandledrejection",s)},Rm={wrapOnError:Im,wrapUnhandledRejection:Mm,wrapConsoleError(t){const e=console;e||km.info("console not available, cannot wrap console.error");const i=xm(()=>e.error,void 0);return e.error=function(...e){xm(()=>e.length>1&&Ee(e[0])&&(/^\[PostHog\.js\](?: |$)/.test(e[0])||"rrweb logger error:"===e[0]),!1)||Cm(t,()=>{let t;t=1==e.length?e[0]:e.join(" ");const i=e.find(t=>t instanceof Error);return Sm.buildFromUnknown(i||t,{mechanism:{handled:!0,type:"onconsole"},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),$m(i)&&i(...e)},Tm(e,"error"),()=>Em(e,"error",i)}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.errorWrappingFunctions=Rm,d.posthogErrorWrappingFunctions=Rm;const Pm=(t,e)=>{if(!xe(null==t?void 0:t.capture))return;const i=null==e?void 0:e.autocaptureExceptions,n=!Me(i)&&"object"==typeof i&&Se(i.errors_to_ignore)?i.errors_to_ignore.reduce((t,e)=>{try{t.push(new RegExp(e))}catch(t){km.error("Ignoring invalid legacy exception exclusion rule",e,t)}return t},[]):[],s=e=>{try{var i;null===(i=t.capture)||void 0===i||i.call(t,"$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(t){km.error("Failed to capture exception for a legacy client",t)}};Im(t=>{n.some(e=>t.$exception_list.some(t=>e.test(t.value||"")))||s(t)}),Mm(s,!0)};d.extendPostHogWithExceptionAutoCapture=Pm,d.extendPostHogWithExceptionAutocapture=Pm;const Om="X-POSTHOG-SESSION-ID",Am="X-POSTHOG-WINDOW-ID",Fm="X-POSTHOG-DISTINCT-ID",Dm=[Om,Am,Fm],Lm=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],Nm=(t,e)=>({}.hasOwnProperty.call(t,e)),qm=t=>"object"==typeof t&&!Me(t)||xe(t),Bm=t=>"undefined"!=typeof Request&&(t instanceof Request||"[object Request]"==={}.toString.call(t)),jm=e=>{try{var i;return Bm(e)?e.url:new URL(e instanceof URL?e.toString():String(e),null==t||null===(i=t.location)||void 0===i?void 0:i.href).toString()}catch(t){return}},Hm=(t,e,i,n,s)=>{let r;try{r=new URL(n).hostname}catch(t){return!1}if(!t)return!1;if(Se(t)&&!t.includes(r))return!1;let o=!1;if(i){const{sessionId:t,windowId:e}=i.checkAndGetSessionAndWindowId(!0);s.set(Om,t),s.set(Am,e),o=!0}const l=(t=>xe(t)?t():t)(e);return l&&"$posthog_cookieless"!==l&&(s.set(Fm,l),o=!0),o};d.__PosthogExtensions__=d.__PosthogExtensions__||{};const Um={_patchFetch:(e,i,n)=>wv(t,"fetch",t=>function(s,r){const o=arguments.length>1?[s,r]:[s];let l=o;try{const t=jm(s);if(t)if(Bm(s)){const t=new Request(s,r);Hm(e,i,n,t.url,t.headers),l=[t]}else{const o=new Headers(qm(r)?r.headers:void 0);if(Hm(e,i,n,t,o)){const t=((t,e)=>{if(Te(t)||Me(t))return{headers:e};if(!qm(t))return;const i=t;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){const t=Object.create(i);return Object.defineProperty(t,"headers",{configurable:!0,enumerable:!0,value:e,writable:!0}),t}return new Proxy({headers:e},{get:(t,e)=>Nm(t,e)?Reflect.get(t,e):Reflect.get(i,e,i),has:(t,e)=>Nm(t,e)||e in i,ownKeys(t){const e=new Set(Reflect.ownKeys(t));return Reflect.ownKeys(i).forEach(t=>e.add(t)),Lm.forEach(t=>{t in i&&e.add(t)}),Array.from(e)},getOwnPropertyDescriptor(t,e){const n=Reflect.getOwnPropertyDescriptor(t,e);if(n)return n;if("string"==typeof e&&Lm.includes(e)&&e in i)return{configurable:!0,enumerable:!0,get(){return Reflect.get(i,e,i)}};const s=Reflect.getOwnPropertyDescriptor(i,e);return s?ue(ue({},s),{},{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(i)})})(r,o);t&&(l=[s,t])}}}catch(t){l=o}return t.apply(this,l)}),_patchXHR:(e,i,n)=>wv(t.XMLHttpRequest.prototype,"open",t=>function(s,r,o=!0,l,a){const u=this,h=new Headers,c=jm(r);c&&Hm(e,i,n,c,h);const d=t.call(u,s,r,o,l,a);return Dm.forEach(t=>{const e=h.get(t);if(e)try{u.setRequestHeader(t,e)}catch(t){}}),d})};d.__PosthogExtensions__.tracingHeadersPatchFns=Um,d.postHogTracingHeadersPatchFns=Um,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(t){const e=this.length;let i=Math.trunc(t)||0;return 0>i&&(i+=e),0>i||i>=e?void 0:this[i]},writable:!0,enumerable:!1,configurable:!0}),"function"!=typeof[].findLast&&Object.defineProperty(Array.prototype,"findLast",{value(t,e){for(let i=this.length-1;i>=0;i--){const n=this[i];if(t.call(e,n,i,this))return n}},writable:!0,enumerable:!1,configurable:!0});var zm=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(t){var e;if(t.hadRecentInput)return;const i=this.i[0],n=this.i.at(-1);this.o&&i&&n&&1e3>t.startTime-n.startTime&&5e3>t.startTime-i.startTime?(this.o+=t.value,this.i.push(t)):(this.o=t.value,this.i=[t]),null===(e=this.t)||void 0===e||e.call(this,t)}};const Wm=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Vm=t=>{if("loading"===document.readyState)return"loading";const e=Wm();if(e){if(e.domInteractive>t)return"loading";if(0===e.domContentLoadedEventStart||e.domContentLoadedEventStart>t)return"dom-interactive";if(0===e.domComplete||e.domComplete>t)return"dom-content-loaded"}return"complete"},Gm=t=>{const e=t.nodeName;return 1===t.nodeType?e.toLowerCase():e.toUpperCase().replace(/^#/,"")},Zm=t=>{let e="";try{for(;9!==(null==t?void 0:t.nodeType);){var i;const n=t,s=n.id?"#"+n.id:[Gm(n),...Array.from(null!==(i=n.classList)&&void 0!==i?i:[]).sort()].join(".");if(e.length+s.length>99)return e||s;if(e=e?s+">"+e:s,n.id)break;t=n.parentNode}}catch(t){}return e},Qm=new WeakMap;function Jm(t,e){let i=Qm.get(e);return i||(i=new WeakMap,Qm.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}let Km=-1;const Ym=()=>Km,Xm=t=>{addEventListener("pageshow",e=>{e.persisted&&(Km=e.timeStamp,t(e))},!0)},ty=(t,e,i,n)=>{let s,r;return o=>{var l;e.value>=0&&(o||n)&&(r=e.value-(null!==(l=s)&&void 0!==l?l:0),(r||void 0===s)&&(s=e.value,e.delta=r,e.rating=((t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good")(e.value,i),t(e)))}},ey=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},iy=()=>{var t,e;return null!==(t=null===(e=Wm())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let ny=-1;const sy=new Set,ry=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,oy=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of sy)t();isFinite(ny)||(ny="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",oy,!0))}},ly=(t=!1)=>{if(t&&(ny=1/0),0>ny){var e;const t=iy(),i=document.prerendering||null===(e=globalThis.performance.getEntriesByType("visibility-state").find(e=>"hidden"===e.name&&e.startTime>=t))||void 0===e?void 0:e.startTime;ny=null!=i?i:ry(),addEventListener("visibilitychange",oy,!0),addEventListener("prerenderingchange",oy,!0),Xm(()=>{setTimeout(()=>{ny=ry()})})}return{get firstHiddenTime(){return ny},onHidden(t){sy.add(t)}}},ay=(t,e=-1,i,n=0,s,r,o)=>{const l=Wm(),a=(null==l?void 0:l.navigationId)||0;let u="navigate";return i?u=i:0>Ym()?l&&(document.prerendering||iy()>0?u="prerender":document.wasDiscarded?u="restore":l.type&&(u=l.type.replace(/_/g,"-"))):u="back-forward-cache",{name:t,value:e,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:u,navigationId:n||a,navigationInteractionId:s,navigationURL:r||(null==l?void 0:l.name),navigationStartTime:o||0}},uy=(t,e,i={})=>{try{const n=t.filter(t=>PerformanceObserver.supportedEntryTypes.includes(t));if(n.length>0){const t=new PerformanceObserver(t=>{queueMicrotask(()=>{const i=t.getEntries();n.length>1&&i.sort((t,e)=>t.startTime+t.duration-(e.startTime+e.duration)),e(i)})});for(const e of n)t.observe(ue({type:e,buffered:!0},i));return t}}catch(t){}},hy=t=>{var e,i;return(null===(e=globalThis.PerformanceObserver)||void 0===e||null===(e=e.supportedEntryTypes)||void 0===e?void 0:e.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&t&&t.reportSoftNavs},cy=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},dy=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var vy=class{constructor(){this.u=void 0}};const fy=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},py=[1800,3e3],gy=(t,e={})=>{const i=hy(e);fy(()=>{const n=Jm(e,vy),s=ly();let r,o=ay("FCP");const l=uy(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(l.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-iy(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});l&&(r=ty(t,o,py,e.reportAllChanges),Xm(i=>{o=ay("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Ym()),r=ty(t,o,py,e.reportAllChanges),ey(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&uy(["soft-navigation"],i=>{i.forEach(i=>{n.u&&i.navigationId&&cy(n.u,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=ay("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=ty(t,o,py,e.reportAllChanges),r(!0)})},e)})},my=[.1,.25],yy=t=>t.find(t=>{var e;return 1===(null===(e=t.node)||void 0===e?void 0:e.nodeType)})||t[0],_y=(t,e={})=>{const i=Jm(e=Object.assign({},e),zm),n=new WeakMap;i.t=t=>{var i;if(null==t||null===(i=t.sources)||void 0===i?void 0:i.length){const i=yy(t.sources),o=null==i?void 0:i.node;if(o){var s,r;const t=null!==(s=null===(r=e.generateTarget)||void 0===r?void 0:r.call(e,o))&&void 0!==s?s:Zm(o);n.set(i,t)}}},((t,e={})=>{const i=ly();gy(dy(()=>{let n,s=ay("CLS",0);const r=Jm(e,zm),o=(i,o,l,a,u)=>{s=ay("CLS",0,i,o,l,a,u),r.o=0,n=ty(t,s,my,e.reportAllChanges)},l=(t=!1)=>{r.o>s.value&&(s.value=r.o,s.entries=r.i),n(t)},a=t=>{l(!0),o("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},u=t=>{for(const e of t)"soft-navigation"!==e.entryType?r.l(e):a(e);l()},h=["layout-shift"];hy(e)&&h.push("soft-navigation");const c=uy(h,u);c&&(n=ty(t,s,my,e.reportAllChanges),i.onHidden(()=>{u(c.takeRecords()),n(!0)}),Xm(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Ym()),ey(n)}),setTimeout(n))}))})(e=>{t((t=>{let e={};if(t.entries.length){var i;const s=t.entries.reduce((t,e)=>t.value>e.value?t:e);if(null==s||null===(i=s.sources)||void 0===i?void 0:i.length){const t=yy(s.sources);t&&(e={largestShiftTarget:n.get(t),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:t,largestShiftEntry:s,loadState:Vm(s.startTime)})}}return Object.assign(t,{attribution:e})})(e))},e)},by=(t,e={})=>{const i=Jm(e=Object.assign({},e),vy);hy(e)&&(i.u=new Map),gy(e=>{t((t=>{let e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:Vm(Ym())};if("soft-navigation"!==t.navigationType){if(t.entries.length){const i=Wm(),n=t.entries.at(-1);if(i){const s=Math.max(0,i.responseStart-(i.activationStart||0));e={timeToFirstByte:s,firstByteToFCP:t.value-s,loadState:Vm(t.entries[0].startTime),navigationEntry:i,fcpEntry:n}}}}else{var n;const s=null===(n=i.u)||void 0===n?void 0:n.get(t.navigationId);s&&(e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:"complete",navigationEntry:s})}return Object.assign(t,{attribution:e})})(e))},e)};let wy=0,ky=1/0,Sy=0;const xy=t=>{for(const e of t)e.interactionId&&(ky=Math.min(ky,e.interactionId),Sy=Math.max(Sy,e.interactionId),wy=Sy?(Sy-ky)/7+1:0)};let Cy;const $y=()=>{var t;return Cy?wy:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var Ty=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return $y()-this.h}D(){this.h=$y(),this.v.length=0,this.p.clear()}S(t){const e=this.T(),i=Math.min(this.v.length-1,Math.floor(e/50));return!e||-1!==i||"soft-navigation"!==t&&"back-forward-cache"!==t?this.v[i]:{k:8,id:-1,entries:[]}}l(t){var e;if(null===(e=this.m)||void 0===e||e.call(this,t),!t.interactionId)return;const i=this.v.at(-1);let n=this.p.get(t.interactionId);if(n||10>this.v.length||t.duration>i.k){var s;if(n?t.duration>n.k?(n.entries=[t],n.k=t.duration):t.duration===n.k&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],k:t.duration},this.p.set(n.id,n),this.v.push(n)),this.v.sort((t,e)=>e.k-t.k),this.v.length>10){const t=this.v.splice(10);for(const e of t)this.p.delete(e.id)}null===(s=this.M)||void 0===s||s.call(this,n)}}};const Ey=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=dy(t);let r=-1;const o=()=>{n(r),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:e})}},Iy=[200,500],My=(t,e={})=>{const i=Jm(e=Object.assign({},e),Ty);let n=[],s=[],r=0;const o=new WeakMap,l=new WeakMap;let a=!1;const u=()=>{a||(Ey(h),a=!0)},h=()=>{const t=new Set(i.v.map(t=>o.get(t.entries[0]))),e=s.length-10;s=s.filter((i,n)=>n>=e||t.has(i));const l=new Set;for(const t of s){const e=c(t.startTime,t.processingEnd);for(const t of e)l.add(t)}n=n.filter(t=>t.startTime>r||l.has(t)),a=!1};i.m=t=>{const i=t.startTime+t.duration;let n;r=Math.max(r,t.processingEnd);for(let r=s.length-1;r>=0;r--){const o=s[r];if(8>=Math.abs(i-o.renderTime)){n=o,n.startTime=Math.min(t.startTime,n.startTime),n.processingStart=Math.min(t.processingStart,n.processingStart),n.processingEnd=Math.max(t.processingEnd,n.processingEnd),e.includeProcessedEventEntries&&n.entries.push(t);break}}n||(n={startTime:t.startTime,processingStart:t.processingStart,processingEnd:t.processingEnd,renderTime:i,entries:e.includeProcessedEventEntries?[t]:[]},s.push(n)),t.interactionId&&o.set(t,n),u()},i.M=t=>{if(!l.get(t)){var i;const o=null===(i=t.entries.find(t=>t.target))||void 0===i?void 0:i.target;if(o){var n,s;const i=null!==(n=null===(s=e.generateTarget)||void 0===s?void 0:s.call(e,o))&&void 0!==n?n:Zm(o);l.set(t,i)}else{var r;const e=null===(r=t.entries.find(t=>t.targetSelector))||void 0===r?void 0:r.targetSelector;e&&l.set(t,e)}}};const c=(t,e)=>{const i=[];for(const s of n)if(s.startTime+s.duration>=t){if(s.startTime>e)break;i.push(s)}return i};uy(["long-animation-frame"],t=>{n=n.concat(t),u()},e),((t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=ly();fy(()=>{var n;"interactionCount"in performance||Cy||(Cy=uy(["event"],xy,{durationThreshold:0}));let s,r=ay("INP");const o=Jm(e,Ty),l=(i,n,l,a,u)=>{o.D(),r=ay("INP",-1,i,n,l,a,u),s=ty(t,r,Iy,e.reportAllChanges)},a=()=>{const t=o.S(r.navigationType);t&&t.k!==r.value&&(r.value=t.k,r.entries=t.entries,s())},u=t=>{a(),s(!0),l("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},h=(t,e=!1)=>{Ey(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.l(e):u(e);a(),e&&s(!0)})},c=["event","first-input"];hy(e)&&c.push("soft-navigation");const d=uy(c,h,ue(ue({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=ty(t,r,Iy,e.reportAllChanges),d&&(i.onHidden(()=>{h(d.takeRecords(),!0)}),Xm(()=>{l("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Ym())}))})})(e=>{t((t=>{if(0===t.entries.length){const e={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:t.value,loadState:Vm(t.navigationStartTime||0)};return Object.assign(t,{attribution:e})}const e=t.entries[0],n=o.get(e),s=Math.max(n.processingStart,e.startTime),r=Math.max(e.startTime+e.duration,s),a=Math.min(n.processingEnd,r),u=n.entries.sort((t,e)=>t.processingStart-e.processingStart),h=c(e.startTime,a),d=i.p.get(e.interactionId),v={interactionTarget:l.get(d),interactionType:e.name.startsWith("key")?"keyboard":"pointer",interactionTime:e.startTime,nextPaintTime:r,processedEventEntries:u,longAnimationFrameEntries:h,inputDelay:s-e.startTime,processingDuration:a-s,presentationDelay:r-a,loadState:Vm(e.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(t=>{var e;const i=t.interactionTime,n=t.nextPaintTime;if(!(null===(e=t.longAnimationFrameEntries)||void 0===e?void 0:e.length)||!i||!n)return;const s=t.inputDelay,r=t.processingDuration;let o,l,a=0,u=0,h=0,c=0;for(const e of t.longAnimationFrameEntries){u=u+e.startTime+e.duration-e.styleAndLayoutStart;for(const t of e.scripts){const e=t.startTime+t.duration;if(i>e)continue;const n=e-Math.max(i,t.startTime),h=t.duration?n/t.duration*t.forcedStyleAndLayoutDuration:0;a+=n-h,u+=h,n>c&&(l=i+s>t.startTime?"input-delay":i+s+r>t.startTime?"processing-duration":"presentation-delay",o=t,c=n)}}const d=t.longAnimationFrameEntries.at(-1),v=d?d.startTime+d.duration:0;v>=i+s+r&&(h=n-v),o&&l&&(t.longestScript={entry:o,subpart:l,intersectingDuration:c}),t.totalScriptDuration=a,t.totalStyleAndLayoutDuration=u,t.totalPaintDuration=h,t.totalUnattributedDuration=n-i-a-u-h})(v),Object.assign(t,{attribution:v})})(e))},e)};var Ry=class{constructor(){this.m=void 0,this.u=void 0}l(t){var e;null===(e=this.m)||void 0===e||e.call(this,t)}};const $=[2500,4e3];let Py=50;const Oy=[];uy(["resource"],t=>{for(const e of t)Oy.push(e),Oy.length>Py&&Oy.shift()});const Ay=(t,e={})=>{null!=(e=Object.assign({},e)).resourceBufferSize&&(Py=e.resourceBufferSize);const i=Jm(e,Ry),n=new WeakMap;hy(e)&&(i.u=new Map),i.m=t=>{const i=t.element;if(i){var s,r;const o=null!==(s=null===(r=e.generateTarget)||void 0===r?void 0:r.call(e,i))&&void 0!==s?s:Zm(i);n.set(t,o)}else t.id&&n.set(t,`#${t.id}`)},((t,e={})=>{let i=!1;const n=hy(e);fy(()=>{let s,r=ly(),o=ay("LCP");const l=Jm(e,Ry),a=(n,l,a,u,h)=>{o=ay("LCP",-1,n,l,a,u,h),s=ty(t,o,$,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=ly(!0))},u=t=>{var e;l.u&&t.navigationId&&cy(l.u,t),i||s(!0),a("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime);const n=null===(e=t.getLargestInteractionContentfulPaint)||void 0===e?void 0:e.call(t);n&&h([n])},h=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],a=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-iy(),0),l.l(e),n=[e];else if("interaction-contentful-paint"===e.entryType){var i;const s=e;if(!o.navigationId)continue;if("interactionId"in s&&s.interactionId!=o.navigationInteractionId)continue;a=(null===(i=s.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,t=Math.max(a-e.startTime,0),s.largestContentfulPaint&&(l.l(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>a&&(o.value=t,o.entries=n,s())}},c=["largest-contentful-paint"];n&&c.push("interaction-contentful-paint","soft-navigation");const d=uy(c,h);if(d){s=ty(t,o,$,e.reportAllChanges);const r=["keydown","click","visibilitychange"],l=t=>{if(t.isTrusted&&!i){const t=o.id;Ey(()=>{if(!i){if(!n){d.disconnect();for(const t of r)removeEventListener(t,l,{capture:!0})}t===o.id&&(i=!0,s(!0))}})}};for(const t of r)addEventListener(t,l,{capture:!0});Xm(n=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Ym()),s=ty(t,o,$,e.reportAllChanges),ey(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})})(e=>{t((t=>{let e={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:t.value};if(t.entries.length){var s,r,o;const l=t.entries.at(-1),a=l.url&&(Oy.findLast(t=>t.name===l.url)||performance.getEntriesByType("resource").findLast(t=>t.name===l.url));let u;e.target=n.get(l),e.lcpEntry=l,l.url&&(e.url=l.url),a&&(e.lcpResourceEntry=a);let h=0,c=0;if("soft-navigation"!==t.navigationType?(u=Wm(),h=null!==(s=null==u?void 0:u.activationStart)&&void 0!==s?s:0,c=null!==(r=null==u?void 0:u.responseStart)&&void 0!==r?r:0):(h=t.navigationStartTime||0,u=null===(o=i.u)||void 0===o?void 0:o.get(t.navigationId)),u){const i=Math.max(0,c-h),n=Math.max(i,a?(a.requestStart||a.startTime)-h:0),s=Math.min(t.value,Math.max(n,a?a.responseEnd-h:0));e=ue(ue({},e),{},{timeToFirstByte:i,resourceLoadDelay:n-i,resourceLoadDuration:s-n,elementRenderDelay:t.value-s,navigationEntry:u})}}return Object.assign(t,{attribution:e})})(e))},e)};let Fy=-1;const Dy=()=>Fy,Ly=t=>{addEventListener("pageshow",e=>{e.persisted&&(Fy=e.timeStamp,t(e))},!0)},Ny=(t,e,i,n)=>{let s,r;return o=>{var l;e.value>=0&&(o||n)&&(r=e.value-(null!==(l=s)&&void 0!==l?l:0),(r||void 0===s)&&(s=e.value,e.delta=r,e.rating=((t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good")(e.value,i),t(e)))}},qy=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},By=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},jy=()=>{var t,e;return null!==(t=null===(e=By())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let Hy=-1;const Uy=new Set,zy=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Wy=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of Uy)t();isFinite(Hy)||(Hy="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",Wy,!0))}},Vy=(t=!1)=>{if(t&&(Hy=1/0),0>Hy){var e;const t=jy(),i=document.prerendering||null===(e=globalThis.performance.getEntriesByType("visibility-state").find(e=>"hidden"===e.name&&e.startTime>=t))||void 0===e?void 0:e.startTime;Hy=null!=i?i:zy(),addEventListener("visibilitychange",Wy,!0),addEventListener("prerenderingchange",Wy,!0),Ly(()=>{setTimeout(()=>{Hy=zy()})})}return{get firstHiddenTime(){return Hy},onHidden(t){Uy.add(t)}}},Gy=(t,e=-1,i,n=0,s,r,o)=>{const l=By(),a=(null==l?void 0:l.navigationId)||0;let u="navigate";return i?u=i:0>Dy()?l&&(document.prerendering||jy()>0?u="prerender":document.wasDiscarded?u="restore":l.type&&(u=l.type.replace(/_/g,"-"))):u="back-forward-cache",{name:t,value:e,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:u,navigationId:n||a,navigationInteractionId:s,navigationURL:r||(null==l?void 0:l.name),navigationStartTime:o||0}},Zy=new WeakMap;function Qy(t,e){let i=Zy.get(e);return i||(i=new WeakMap,Zy.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}var Jy=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(t){var e;if(t.hadRecentInput)return;const i=this.o[0],n=this.o.at(-1);this.i&&i&&n&&1e3>t.startTime-n.startTime&&5e3>t.startTime-i.startTime?(this.i+=t.value,this.o.push(t)):(this.i=t.value,this.o=[t]),null===(e=this.t)||void 0===e||e.call(this,t)}};const Ky=(t,e,i={})=>{try{const n=t.filter(t=>PerformanceObserver.supportedEntryTypes.includes(t));if(n.length>0){const t=new PerformanceObserver(t=>{queueMicrotask(()=>{const i=t.getEntries();n.length>1&&i.sort((t,e)=>t.startTime+t.duration-(e.startTime+e.duration)),e(i)})});for(const e of n)t.observe(ue({type:e,buffered:!0},i));return t}}catch(t){}},Yy=t=>{var e,i;return(null===(e=globalThis.PerformanceObserver)||void 0===e||null===(e=e.supportedEntryTypes)||void 0===e?void 0:e.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&t&&t.reportSoftNavs},Xy=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},t_=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var e_=class{constructor(){this.l=void 0}};const i_=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},n_=[1800,3e3],s_=(t,e={})=>{const i=Yy(e);i_(()=>{const n=Qy(e,e_),s=Vy();let r,o=Gy("FCP");const l=Ky(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(l.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-jy(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});l&&(r=Ny(t,o,n_,e.reportAllChanges),Ly(i=>{o=Gy("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Dy()),r=Ny(t,o,n_,e.reportAllChanges),qy(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Ky(["soft-navigation"],i=>{i.forEach(i=>{n.l&&i.navigationId&&Xy(n.l,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Gy("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Ny(t,o,n_,e.reportAllChanges),r(!0)})},e)})},r_=[.1,.25],o_=(t,e={})=>{const i=Vy();s_(t_(()=>{let n,s=Gy("CLS",0);const r=Qy(e,Jy),o=(i,o,l,a,u)=>{s=Gy("CLS",0,i,o,l,a,u),r.i=0,n=Ny(t,s,r_,e.reportAllChanges)},l=(t=!1)=>{r.i>s.value&&(s.value=r.i,s.entries=r.o),n(t)},a=t=>{l(!0),o("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},u=t=>{for(const e of t)"soft-navigation"!==e.entryType?r.h(e):a(e);l()},h=["layout-shift"];Yy(e)&&h.push("soft-navigation");const c=Ky(h,u);c&&(n=Ny(t,s,r_,e.reportAllChanges),i.onHidden(()=>{u(c.takeRecords()),n(!0)}),Ly(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Dy()),qy(n)}),setTimeout(n))}))};let l_=0,a_=1/0,u_=0;const h_=t=>{for(const e of t)e.interactionId&&(a_=Math.min(a_,e.interactionId),u_=Math.max(u_,e.interactionId),l_=u_?(u_-a_)/7+1:0)};let c_;const d_=()=>{var t;return c_?l_:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var v_=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return d_()-this.u}M(){this.u=d_(),this.v.length=0,this.m.clear()}L(t){const e=this._(),i=Math.min(this.v.length-1,Math.floor(e/50));return!e||-1!==i||"soft-navigation"!==t&&"back-forward-cache"!==t?this.v[i]:{P:8,id:-1,entries:[]}}h(t){var e;if(null===(e=this.p)||void 0===e||e.call(this,t),!t.interactionId)return;const i=this.v.at(-1);let n=this.m.get(t.interactionId);if(n||10>this.v.length||t.duration>i.P){var s;if(n?t.duration>n.P?(n.entries=[t],n.P=t.duration):t.duration===n.P&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],P:t.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((t,e)=>e.P-t.P),this.v.length>10){const t=this.v.splice(10);for(const e of t)this.m.delete(e.id)}null===(s=this.T)||void 0===s||s.call(this,n)}}};const f_=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=t_(t);let r=-1;const o=()=>{n(r),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:e})}},p_=[200,500],g_=(t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Vy();i_(()=>{var n;"interactionCount"in performance||c_||(c_=Ky(["event"],h_,{durationThreshold:0}));let s,r=Gy("INP");const o=Qy(e,v_),l=(i,n,l,a,u)=>{o.M(),r=Gy("INP",-1,i,n,l,a,u),s=Ny(t,r,p_,e.reportAllChanges)},a=()=>{const t=o.L(r.navigationType);t&&t.P!==r.value&&(r.value=t.P,r.entries=t.entries,s())},u=t=>{a(),s(!0),l("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},h=(t,e=!1)=>{f_(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.h(e):u(e);a(),e&&s(!0)})},c=["event","first-input"];Yy(e)&&c.push("soft-navigation");const d=Ky(c,h,ue(ue({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=Ny(t,r,p_,e.reportAllChanges),d&&(i.onHidden(()=>{h(d.takeRecords(),!0)}),Ly(()=>{l("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Dy())}))})};var m_=class{constructor(){this.p=void 0,this.l=void 0}h(t){var e;null===(e=this.p)||void 0===e||e.call(this,t)}};const y_=[2500,4e3],__=(t,e={})=>{let i=!1;const n=Yy(e);i_(()=>{let s,r=Vy(),o=Gy("LCP");const l=Qy(e,m_),a=(n,l,a,u,h)=>{o=Gy("LCP",-1,n,l,a,u,h),s=Ny(t,o,y_,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=Vy(!0))},u=t=>{var e;l.l&&t.navigationId&&Xy(l.l,t),i||s(!0),a("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime);const n=null===(e=t.getLargestInteractionContentfulPaint)||void 0===e?void 0:e.call(t);n&&h([n])},h=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],a=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-jy(),0),l.h(e),n=[e];else if("interaction-contentful-paint"===e.entryType){var i;const s=e;if(!o.navigationId)continue;if("interactionId"in s&&s.interactionId!=o.navigationInteractionId)continue;a=(null===(i=s.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,t=Math.max(a-e.startTime,0),s.largestContentfulPaint&&(l.h(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>a&&(o.value=t,o.entries=n,s())}},c=["largest-contentful-paint"];n&&c.push("interaction-contentful-paint","soft-navigation");const d=Ky(c,h);if(d){s=Ny(t,o,y_,e.reportAllChanges);const r=["keydown","click","visibilitychange"],l=t=>{if(t.isTrusted&&!i){const t=o.id;f_(()=>{if(!i){if(!n){d.disconnect();for(const t of r)removeEventListener(t,l,{capture:!0})}t===o.id&&(i=!0,s(!0))}})}};for(const t of r)addEventListener(t,l,{capture:!0});Ly(n=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Dy()),s=Ny(t,o,y_,e.reportAllChanges),qy(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})},b_={onLCP:Ay,onCLS:_y,onFCP:by,onINP:My,withoutAttribution:{onLCP:__,onCLS:o_,onFCP:s_,onINP:g_}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=b_,d.__PosthogExtensions__.postHogWebVitalsCallbacks=b_,d.postHogWebVitalsCallbacks=b_;const w_={onLCP:__,onCLS:o_,onFCP:s_,onINP:g_};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=w_,d.__PosthogExtensions__.postHogWebVitalsCallbacks=w_,d.postHogWebVitalsCallbacks=w_,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>w_;const k_={onLCP:Ay,onCLS:_y,onFCP:by,onINP:My,withoutAttribution:{onLCP:__,onCLS:o_,onFCP:s_,onINP:g_}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=k_,d.__PosthogExtensions__.postHogWebVitalsCallbacks=k_,d.postHogWebVitalsCallbacks=k_;const S_={onLCP:__,onCLS:o_,onFCP:s_,onINP:g_};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=S_,d.__PosthogExtensions__.postHogWebVitalsCallbacks=S_,d.postHogWebVitalsCallbacks=S_,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>S_;var x_=class{constructor(t){this.disabled=!1===t;const e=Ce(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;const n=this.clicks[this.clicks.length-1];if(n&&Math.abs(t-n.x)+Math.abs(e-n.y)<this.thresholdPx&&this.timeoutMs>i-n.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}};const C_="$copy_autocapture",$_=Gs("[AutoCapture]");function T_(t,e){return e.length>t?e.slice(0,t)+"...":e}function E_(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do{e=e.previousSibling}while(e&&!mr(e));return e}function I_(e,{e:i,maskAllElementAttributes:n,maskAllText:s,elementAttributeIgnoreList:r,elementsChainAsString:o,disableCaptureUrlHashes:l}){var a,u;if(!mr(e))return{props:{}};const h=[e],c=new Set([e]);let d=e;for(;d.parentNode&&!yr(d,"body")&&1e3>h.length;){if(br(d.parentNode)){const t=d.parentNode.host;if(c.has(t))break;c.add(t),h.push(t),d=t;continue}if(!mr(d.parentNode))break;if(c.has(d.parentNode))break;c.add(d.parentNode),h.push(d.parentNode),d=d.parentNode}const v="click"===i.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?h.findIndex(t=>yr(t,"button")||yr(t,"a")):-1;v>0&&(s=s||h.slice(0,v+1).some(t=>!Hr(t)||Ur(t)));const f=[],p={};let g,m=!1,y=!1;if(Qs(h,t=>{const e=Hr(t);if(yr(t,"a")&&!n&&!(null==r?void 0:r.includes("href"))){const i=t.getAttribute("href");m=!!(e&&i&&Kr(i))&&(l?un(i):i)}ge(Sr(t),"ph-no-capture")&&(y=!0),f.push(function(t,e,i,n,s=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};Tr.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?T_(1024,Yr(t)):T_(1024,Cr(t)));const l=Sr(t);e||(null==n?void 0:n.includes("class"))||0>=l.length||(o.classes=l.filter(function(t){return""!==t})),Qs(t.attributes,function(i){var r;if((!Ur(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==n?void 0:n.includes(i.name))&&!e&&Kr(i.value)&&(!Ee(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=i.value;"class"===i.name&&(t=wr(t).join(" ")),o["attr__"+i.name]=T_(1024,"href"===i.name&&s?un(t):t)}});let a=1,u=1,h=t;for(;h=E_(h);)a++,h.tagName===t.tagName&&u++;return o.nth_child=a,o.nth_of_type=u,o}(t,n,s,r,l)),Qs(function(t){if(!Hr(t))return{};const e={};return Qs(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){const i=t.name.replace("data-ph-capture-attribute-",""),n=t.value;i&&n&&Kr(n)&&(e[i]=n)}}),e}(t),(t,e)=>{({}).hasOwnProperty.call(p,e)||(p[e]=t)})}),y)return{props:{},explicitNoCapture:y};if(v>0&&(e=h[v],f.splice(0,v)),s||(f[0].$el_text=yr(e,"a")||yr(e,"button")?Yr(e):Cr(e)),m){var _,b;f[0].attr__href=m;const e=null===(_=lr(m))||void 0===_?void 0:_.host,i=null==t||null===(b=t.location)||void 0===b?void 0:b.host;e&&i&&e!==i&&(g=m)}return{props:Js((k=i.type,{$event_type:k,$ce_version:1}),o?{}:{$elements:f},{$elements_chain:(w=f,Se(w)?function(t){return t.map(t=>{var e,i;let n="";if(t.tag_name&&(n+=t.tag_name),t.attr_class){t.attr_class.sort();for(const e of t.attr_class)n+=`.${e.replace(/"/g,"")}`}const s=ue(ue(ue(ue({},t.text?{text:t.text}:{}),{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(i=t.nth_of_type)&&void 0!==i?i:0},t.href?{href:t.href}:{}),t.attr_id?{attr_id:t.attr_id}:{}),t.attributes),r={};return Ks(s).sort(([t],[e])=>function(t,e){return e>t?-1:t>e?1:0}(t,e)).forEach(([t,e])=>r[to(t.toString())]=to(e.toString())),n+=":",n+=Ks(r).map(([t,e])=>`${t}="${e}"`).join(""),n}).join(";")}(function(t){return t.map(t=>{var e,i;const n={text:null===(e=t.$el_text)||void 0===e?void 0:e.slice(0,400),tag_name:t.tag_name,href:null===(i=t.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:eo(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Ks(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,e])=>n.attributes[t]=e),n})}(w)):"")},(null===(a=f[0])||void 0===a?void 0:a.$el_text)?{$el_text:null===(u=f[0])||void 0===u?void 0:u.$el_text}:{},g&&"click"===i.type?{$external_click_url:g}:{},p),target:e};var w,k}var M_=class{uo(){this.ho=void 0,clearTimeout(this.co),this.co=void 0}do(t){var e;if(!Hr(t))return!0;const i=null!==(e=this.vo().css_selector_ignorelist)&&void 0!==e?e:Rr,n=new Set;let s=t;for(;s;){if(n.size>=1e3||n.has(s))return!0;n.add(s);const t=s,e=Sr(t);if(ge(e,"ph-no-capture")||ge(e,"ph-sensitive")||Ur(t)||i.some(e=>Er(t,e)))return!0;const r=s.parentNode;s=br(r)?r.host:r&&mr(r)?r:null}return!1}fo(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.uo();if("pointerdown"===t.type){this.uo();const i=$r(t);var e;return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&i&&mr(i)&&(this.ho={target:i,excluded:this.do(i),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(e=this.po)||void 0===e?void 0:e.distinctId}))}const i=this.ho;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.uo():"pointerup"===t.type&&(i.released=!0,this.co=setTimeout(()=>this.uo(),0)))}mo(t){var e;const i=this.ho;this.uo();const s=$r(t);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(e=this.po)||void 0===e?void 0:e.distinctId)&&t.pointerId===i.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-i.x)&&5>=Math.abs(t.clientY-i.y)&&s&&(yr(s,"html")||yr(s,"body"))){var r;if(i.excluded)return null;const t=null!==(r=this.vo().css_selector_ignorelist)&&void 0!==r?r:Rr;return[s,null==n?void 0:n.documentElement,null==n?void 0:n.body].some(e=>{if(!e)return!1;const i=Sr(e);return ge(i,"ph-no-capture")||ge(i,"ph-sensitive")||!Hr(e)||Ur(e)||t.some(t=>Er(e,t))})?null:i.target}}constructor(t){this.yo=t,this.name="autocapture",this.bo=!1,this._o=null,this.wo=!1,this.ko=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.So=!1,this.yo.refresh(this.Mr),this.rageclicks=new x_(this.Mr.rageclick),this.xo=null}setup(t){this.Co(),this.po=t;const e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.So?e.dispose():(this.$o=e,this.startIfEnabled())}dispose(){var t;this.So||(this.So=!0,this.po=void 0,null===(t=this.$o)||void 0===t||t.dispose(),this.$o=void 0,this.To())}vo(){return this.yo.refresh(this.Mr),this.Mr}Co(){var t,e;return this.vo(),this.Mr.url_allowlist=null===(t=this.Mr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Mr.url_ignorelist=null===(e=this.Mr.url_ignorelist)||void 0===e?void 0:e.map(t=>new RegExp(t)),this.Mr}Io(){if(!this.isBrowserSupported())return void $_.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!n)return;const e=this.Mo=e=>{e=e||(null==t?void 0:t.event);try{if("blur"===e.type)return void this.uo();if(0===e.type.indexOf("pointer"))return void this.fo(e);const t="click"===e.type?this.mo(e):void 0;if(Me(t))return;this.Eo(e,"$autocapture",t)}catch(t){$_.error("Failed to capture event",t)}};if(nr(t,"blur",e),nr(n,"submit",e,{capture:!0}),nr(n,"change",e,{capture:!0}),nr(n,"click",e,{capture:!0}),Qs(["pointerdown","pointermove","pointerup","pointercancel"],t=>{nr(n,t,e,{capture:!0})}),this.vo().capture_copied_text){const e=this.Po=e=>{e=e||(null==t?void 0:t.event);try{this.Eo(e,C_)}catch(t){$_.error("Failed to capture clipboard event",t)}};nr(n,"copy",e,{capture:!0}),nr(n,"cut",e,{capture:!0}),nr(n,"paste",e,{capture:!0})}}To(){this.uo(),this.Mo&&(null==t||t.removeEventListener("blur",this.Mo),Qs(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==n||n.removeEventListener(t,this.Mo,!0)}),null==n||n.removeEventListener("submit",this.Mo,!0),null==n||n.removeEventListener("change",this.Mo,!0),null==n||n.removeEventListener("click",this.Mo,!0),this.Mo=void 0),this.Po&&(null==n||n.removeEventListener("copy",this.Po,!0),null==n||n.removeEventListener("cut",this.Po,!0),null==n||n.removeEventListener("paste",this.Po,!0),this.Po=void 0),this.bo=!1}startIfEnabled(){this.isEnabled||this.uo(),!this.So&&this.po&&this.isEnabled&&!this.bo&&(this.Io(),this.bo=!0)}onRemoteConfig(t){if(this.So)return;if(this.wo=!0,!t.ok)return void this.startIfEnabled();const e=t.config;e.elementsChainAsString&&(this.ko=e.elementsChainAsString);const i=e.autocapture_opt_out;var n;Ae(i)&&(null===(n=this.po)||void 0===n||n.kv.set("$autocapture_disabled_server_side",i),this._o=i),this.startIfEnabled()}setElementSelectors(t){this.xo=t}getElementSelectors(t,e){var i;const s=[];return null===(i=this.xo)||void 0===i||i.forEach(i=>{const r=null==n?void 0:n.querySelectorAll(i);null==r||r.forEach(n=>{t!==n&&e!==n||ge(s,i)||s.push(i)})}),s}get isEnabled(){var t,e;if(this.So)return!1;const i=null===(t=this.po)||void 0===t?void 0:t.kv.get(x),n=this._o,s=this.vo();if(!s.remoteRequestsDisabled&&!this.wo)return!1;const r=s.remoteRequestsDisabled&&!this.wo;if(Me(n)&&!Ae(i)&&!r)return!1;const o=null!==(e=this._o)&&void 0!==e?e:!!i;return!!s.enabled&&!o}Eo(e,i="$autocapture",n){if(!this.isEnabled)return void this.uo();let s=n||$r(e);_r(s)&&(s=s.parentNode||null);const r=this.Co();var o;"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&r.rageclick&&(null===(o=this.rageclicks)||void 0===o?void 0:o.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&qr(s,r.rageclick)&&this.Eo(e,"$rageclick",n);const l=i===C_,a=l?ue(ue({},r),{},{dom_event_allowlist:void 0}):r;if(s&&function(e,i,n,s,r,o){var l;if(!t||Br(e))return!1;if((null==n?void 0:n.url_allowlist)&&!kr(n.url_allowlist,o))return!1;if((null==n?void 0:n.url_ignorelist)&&kr(n.url_ignorelist,o))return!1;if(null==n?void 0:n.dom_event_allowlist){const t=n.dom_event_allowlist;if(t&&!t.some(t=>i.type===t))return!1}const{parentIsUsefulElement:a,targetElementList:u}=jr(e,s);if(!function(t,e){const i=null==e?void 0:e.element_allowlist;if(Te(i))return!0;for(const e of t)if(i.some(t=>e.tagName.toLowerCase()===t))return!0;return!1}(u,n))return!1;if(!Ir(u,null==n?void 0:n.css_selector_allowlist))return!1;if(Ir(u,null!==(l=null==n?void 0:n.css_selector_ignorelist)&&void 0!==l?l:Rr))return!1;try{const n=t.getComputedStyle(e);if(n&&"pointer"===n.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}const h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(r||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(i.type)>=0;default:return a?(r||["click"]).indexOf(i.type)>=0:(r||["click"]).indexOf(i.type)>=0&&(Tr.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,a,l,l?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var u;const{props:n,explicitNoCapture:o,target:l}=I_(s,{e:e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.ko,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(o)return!1;const a=this.getElementSelectors(s,l);if(a&&a.length>0&&(n.$element_selectors=a),i===C_){const i=e.type||"clipboard";if("paste"!==i){var h,c;const e=null==t||null===(h=t.getSelection())||void 0===h?void 0:h.toString(),i=xr(e);if(!i)return!1;n.$selected_content=i,n.$clipboard_text_length=null!==(c=null==e?void 0:e.length)&&void 0!==c?c:0}n.$copy_type=i}return null===(u=this.po)||void 0===u||u.capture(i,n).catch(t=>$_.error("Failed to capture event",t)),!0}}isBrowserSupported(){return xe(null==n?void 0:n.querySelectorAll)}};const R_={};function P_(t,e){const i=$r(t);return i?ue({node:i,originalEvent:t,timestamp:Date.now()},e):null}function O_(t,e){return Math.abs(t)<Math.abs(e)?0>e?"up":"down":0>t?"left":"right"}function A_(t){return"swipe"===t.type?"$dead_swipe":"$dead_click"}const F_="canvas,video,audio,embed,object";function D_(t,e){return Pe(t)&&t>=e}function L_(t,e=1e3){return t>=0&&e>t?t:void 0}function N_(t,e,i=1e3){return Pe(e)?L_(t-e,i):void 0}var q_=class{cr(t){var e,i,n,s,r,o,l,a;const u=this.dr((null==t?void 0:t.__onCapture)||this.hr.bind(this));return{element_attribute_ignorelist:null!==(e=null==t?void 0:t.element_attribute_ignorelist)&&void 0!==e?e:u.element_attribute_ignorelist,scroll_threshold_ms:null!==(i=null==t?void 0:t.scroll_threshold_ms)&&void 0!==i?i:u.scroll_threshold_ms,selection_change_threshold_ms:null!==(n=null==t?void 0:t.selection_change_threshold_ms)&&void 0!==n?n:u.selection_change_threshold_ms,mutation_threshold_ms:null!==(s=null==t?void 0:t.mutation_threshold_ms)&&void 0!==s?s:u.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(r=null==t?void 0:t.capture_clicks_with_modifier_keys)&&void 0!==r?r:u.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==t?void 0:t.capture_dead_swipes)&&void 0!==o?o:u.capture_dead_swipes,swipe_threshold_px:null!==(l=null==t?void 0:t.swipe_threshold_px)&&void 0!==l?l:u.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(a=null==t?void 0:t.max_dead_swipes_per_page_load)&&void 0!==a?a:u.max_dead_swipes_per_page_load,css_selector_ignorelist:null==t?void 0:t.css_selector_ignorelist,__onCapture:u.__onCapture}}constructor(t,e){this.instance=t,this.vr=!1,this.pr=[],this.mr=0,this.dr=t=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,capture_clicks_with_modifier_keys:!1,capture_dead_swipes:!0,swipe_threshold_px:30,max_dead_swipes_per_page_load:10,__onCapture:t}),this.gr=()=>{clearTimeout(this.yr),this.yr=void 0,this.br=void 0},this.wr=t=>{if(this.gr(),0===t.button){const e={path:t.composedPath(),trusted:t.isTrusted,selectionChanged:!1,selectionInitiallyRelated:!1},i=null==n?void 0:n.getSelection();e.selectionInitiallyRelated="Range"===(null==i?void 0:i.type)&&this.kr(i,e),this.br=e}},this._r=t=>{Me(t.relatedTarget)&&this.gr()},this.Sr=t=>{const e=this.br,i=t;if(!e||0!==i.button||t.isTrusted!==e.trusted)return;const n=t.composedPath();for(const t of e.path)if(mr(t)&&-1!==n.indexOf(t)){e.clickTarget=t;break}e.clickDetail=i.detail,this.yr=d.setTimeout(this.gr,0)},this.Cr=t=>{const e=t,i=P_(e,{type:"click"}),n=this.br;i&&n&&0===e.button&&e.detail>0&&e.detail===n.clickDetail&&t.isTrusted===n.trusted&&i.node===n.clickTarget&&(i.selectionChangedDuringGesture=n.selectionChanged&&this.Mr.selection_change_threshold_ms>0,this.gr()),Me(i)||this.Ir(i)||this.Tr(i),this.Rr()},this.$r=()=>{const t=Date.now();this.Er=t,t%50==0&&this.pr.forEach(e=>{Te(e.scrollDelayMs)&&(e.scrollDelayMs=t-e.timestamp)})},this.Ar=t=>{var e,i;const s=null==n?void 0:n.getSelection(),r=this.vr;this.vr="Range"===(null==s?void 0:s.type);const o=null==s?void 0:s.focusNode,l=o&&(mr(o)?o:o.parentElement),a=null==n?void 0:n.activeElement;let u=a;for(;null==u||null===(e=u.shadowRoot)||void 0===e?void 0:e.activeElement;)u=u.shadowRoot.activeElement;const h=Nr($r(t))||Nr(null!=l?l:null)||Nr(null!==(i=u)&&void 0!==i?i:null),c="Caret"===(null==s?void 0:s.type)&&u&&!u.shadowRoot&&o&&o!==a&&o.contains(null!=a?a:null);if(!(r||this.vr||h||c))return;const d=Date.now();this.Or=d;const v=this.br;if(v&&(r||this.vr||h)){const e=$r(t);let i;if(Nr(e))i=e;else if("Caret"===(null==s?void 0:s.type)){var f;Nr(null!==(f=u)&&void 0!==f?f:null)||c?i=u:h&&(i=l)}const n=i?this.Lr(i,v):s&&(o||s.anchorNode)?this.kr(s,v):r&&!this.vr&&v.selectionInitiallyRelated;v.selectionChanged=v.selectionChanged||n}this.pr.forEach(t=>{const e=d-t.timestamp;0>e||!Te(t.selectionChangedDelayMs)&&e>=t.selectionChangedDelayMs||(t.selectionChangedDelayMs=e)})},this.an=()=>{"hidden"===(null==n?void 0:n.visibilityState)&&this.gr();const t=Date.now();this.Pr=t,this.Dr("visibilityChangedDelayMs",t)},this.Fr=()=>{const t=Date.now();this.Nr=t,this.Dr("focusChangedDelayMs",t)},this.qr=t=>{const e=t.touches,i=1===(null==e?void 0:e.length)?e[0]:void 0;this.jr=i?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this.Br=()=>{this.jr=void 0},this.Hr=t=>{var e;const i=this.jr;if(this.jr=void 0,Te(i)||this.mr>=this.Mr.max_dead_swipes_per_page_load)return;const s=t,r=null===(e=s.changedTouches)||void 0===e?void 0:e[0];if(!r)return;const o=r.clientX-i.x,l=r.clientY-i.y,a=o*o+l*l,u=this.Mr.swipe_threshold_px;if(u*u>a)return;if([this.Er,this.zr,this.Or].some(t=>Pe(t)&&t>=i.timestamp))return;var h,c;if(this.Ur()&&(null!==(h=null==n||null===(c=n.elementsFromPoint)||void 0===c?void 0:c.call(n,i.x,i.y))&&void 0!==h?h:[]).some(t=>{var e;return null===(e=t.matches)||void 0===e?void 0:e.call(t,F_)}))return;const d=P_(s,{type:"swipe",swipeDirection:O_(o,l),swipeDistancePx:Math.round(Math.sqrt(a))});Me(d)||this.Ir(d)||this.Tr(d),this.Rr()},this.Mr=this.cr(e),this._onCapture=this.Mr.__onCapture}start(t){this.Wr(),this.Vr(),this.Zr(),this.Gr(),this.Qr(),this.Jr(t),this.Mr.capture_dead_swipes&&this.Kr()}Jr(e){if(!this.Xr){const i=function(e){return function(e,i){const n=R_[e];if(n)return n;let s=i[e];if((t=>xe(t)&&-1!==t.toString().indexOf("[native code]"))(s)&&!(null==t?void 0:t.Zone))return R_[e]=s.bind(i);const r=i.document;if(r&&xe(r.createElement)){let t,n=!1;try{t=r.createElement("iframe"),t.hidden=!0,r.head.appendChild(t);const a=t.contentWindow;var o,l;a&&a[e]&&(s=a[e],"MutationObserver"===e&&function(t){return ge(t,"AppleWebKit")&&!ge(t,"Chrome")}(null!==(o=null===(l=i.navigator)||void 0===l?void 0:l.userAgent)&&void 0!==o?o:"")&&(t.classList.add("rr-block","ph-no-capture"),n=!0))}catch(t){Vs.warn(`Could not create sandbox iframe for ${e} check, bailing to assignableWindow.${e}: `,t)}finally{!n&&(null==t?void 0:t.parentNode)&&t.parentNode.removeChild(t)}}return s&&xe(s)?R_[e]=s.bind(i):s}("MutationObserver",e)}(d);this.Xr=new i(t=>{this.Yr(t)}),this.Xr.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var t;null===(t=this.Xr)||void 0===t||t.disconnect(),this.Xr=void 0,d.removeEventListener("click",this.Cr,{capture:!0}),d.removeEventListener("mousedown",this.wr,{capture:!0}),d.removeEventListener("mouseup",this.Sr,{capture:!0}),d.removeEventListener("mouseout",this._r,{capture:!0}),d.removeEventListener("dragstart",this.gr,{capture:!0}),d.removeEventListener("pointercancel",this.gr,{capture:!0}),d.removeEventListener("blur",this.gr),this.gr(),d.removeEventListener("scroll",this.$r,{capture:!0}),null==n||n.removeEventListener("selectionchange",this.Ar),d.removeEventListener("touchstart",this.qr,{capture:!0}),d.removeEventListener("touchend",this.Hr,{capture:!0}),d.removeEventListener("touchcancel",this.Br,{capture:!0}),null==n||n.removeEventListener("visibilitychange",this.an),d.removeEventListener("blur",this.Fr),d.removeEventListener("focus",this.Fr),this.jr=void 0}Yr(t){this.zr=Date.now()}Wr(){nr(d,"click",this.Cr,{capture:!0}),nr(d,"mousedown",this.wr,{capture:!0}),nr(d,"mouseup",this.Sr,{capture:!0}),nr(d,"mouseout",this._r,{capture:!0}),nr(d,"dragstart",this.gr,{capture:!0}),nr(d,"pointercancel",this.gr,{capture:!0}),nr(d,"blur",this.gr)}Tr(t){t.selectionChangedDelayMs=N_(t.timestamp,this.Or,this.Mr.selection_change_threshold_ms),t.visibilityChangedDelayMs=N_(t.timestamp,this.Pr),t.focusChangedDelayMs=N_(t.timestamp,this.Nr),this.pr.push(t)}Rr(){this.pr.length&&Te(this.eo)&&(this.eo=d.setTimeout(()=>{this.no()},1e3))}Vr(){nr(d,"scroll",this.$r,{capture:!0})}Zr(){var t;this.vr="Range"===(null==n||null===(t=n.getSelection())||void 0===t?void 0:t.type),nr(n,"selectionchange",this.Ar)}Lr(t,e){const i=e.path[0];for(;t;){if(-1!==e.path.indexOf(t)||mr(i)&&i.contains(t))return!0;t=t.getRootNode().host}return!1}kr(t,e){const i=e.path[0],n=t.rangeCount>0?t.getRangeAt(0):void 0;if(n&&mr(i)&&n.startContainer.getRootNode()===i.getRootNode()){var s;if(!n.collapsed)return n.intersectsNode(i);const t=mr(n.startContainer)&&null!==(s=n.startContainer.childNodes[n.startOffset])&&void 0!==s?s:n.startContainer;return this.Lr(t,e)}return this.Lr(t.focusNode,e)||this.Lr(t.anchorNode,e)}Gr(){nr(n,"visibilitychange",this.an)}Qr(){nr(d,"blur",this.Fr),nr(d,"focus",this.Fr)}Dr(t,e){this.pr.forEach(i=>{const n=L_(e-i.timestamp);Pe(n)&&(Te(i[t])||i[t]>n)&&(i[t]=n)})}Kr(){nr(d,"touchstart",this.qr,{capture:!0,passive:!0}),nr(d,"touchend",this.Hr,{capture:!0,passive:!0}),nr(d,"touchcancel",this.Br,{capture:!0,passive:!0})}Ur(){const t=Te(this.io)||Pe(this.zr)&&this.zr>this.io;return(Te(this.ro)||t)&&(this.io=Date.now(),this.ro=!!(null==n?void 0:n.querySelector(F_))),!!this.ro}Ir(t){return!t||("swipe"===t.type?this.oo(t):this.so(t))}oo(e){return!(!gr(e.node)&&!this.pr.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!yr(e.node,"html")&&mr(e.node)&&function(e,i){var n;if(!t||Br(e))return!1;const s=Ae(i)?Fr:null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:Fr,{targetElementList:r}=jr(e,!1);return!Ir(r,s)}(e.node,{css_selector_ignorelist:this.Mr.css_selector_ignorelist}))}so(e){return!(this.Mr.capture_clicks_with_modifier_keys||(i=e.originalEvent,!(i.ctrlKey||i.metaKey||i.altKey||i.shiftKey)))||!!this.oo(e)||function(e){if(!t||Br(e))return!1;const{targetElementList:i}=jr(e,!1);return i.some(t=>yr(t,"a"))}(e.node);var i}no(){if(!this.pr.length)return;clearTimeout(this.eo),this.eo=void 0;const t=this.pr;this.pr=[];for(const i of t){var e;i.mutationDelayMs=null!==(e=i.mutationDelayMs)&&void 0!==e?e:this.zr&&this.zr>=i.timestamp?this.zr-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const t=D_(i.scrollDelayMs,this.Mr.scroll_threshold_ms),n=D_(i.selectionChangedDelayMs,this.Mr.selection_change_threshold_ms),s=D_(i.mutationDelayMs,this.Mr.mutation_threshold_ms),r=D_(i.absoluteDelayMs,1.1*this.Mr.mutation_threshold_ms),o=Pe(i.scrollDelayMs)&&this.Mr.scroll_threshold_ms>i.scrollDelayMs,l=Pe(i.mutationDelayMs)&&this.Mr.mutation_threshold_ms>i.mutationDelayMs,a=i.selectionChangedDuringGesture||Pe(i.selectionChangedDelayMs)&&this.Mr.selection_change_threshold_ms>i.selectionChangedDelayMs,u=Pe(i.visibilityChangedDelayMs),h=Pe(i.focusChangedDelayMs);if(!(o||l||a||u||h))if(t||s||r||n){const e=A_(i);if("$dead_swipe"===e){if(this.mr>=this.Mr.max_dead_swipes_per_page_load)continue;this.mr++}this._onCapture(i,{[`${e}_last_mutation_timestamp`]:this.zr,[`${e}_event_timestamp`]:i.timestamp,[`${e}_scroll_timeout`]:t,[`${e}_mutation_timeout`]:s,[`${e}_absolute_timeout`]:r,[`${e}_selection_changed_timeout`]:n,[`${e}_visibility_changed_timeout`]:!1})}else this.Mr.mutation_threshold_ms>i.absoluteDelayMs&&this.pr.push(i)}this.Rr()}hr(t,e){const i=A_(t);this.instance.capture(i,ue(ue(ue({},e),I_(t.node,{e:t.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Mr.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:t.scrollDelayMs,[`${i}_mutation_delay_ms`]:t.mutationDelayMs,[`${i}_absolute_delay_ms`]:t.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:t.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:t.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:t.focusChangedDelayMs,$dead_swipe_direction:t.swipeDirection,$dead_swipe_distance_px:t.swipeDistancePx}),{timestamp:new Date(t.timestamp)})}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initDeadClicksAutocapture=(t,e)=>new q_(t,e);const B_=Gs("[ExternalScriptsLoader]"),j_=t=>{const e=null==n?void 0:n.querySelectorAll("script");if(e)for(let i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},H_=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return B_.warn(`${e} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const s=j_(e);if(s){if(s.__posthog_loading_callback_fired)return i();const t=s.__posthog_loading_error;return t?i(t):(s.addEventListener("load",t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)}),void s.addEventListener("error",t=>{s.__posthog_loading_error=t,i(t)}))}const r=()=>{if(!n)return i("document not found");if(j_(e))return H_(t,e,i);let s=n.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)n.head.appendChild(s);else{const t=n.querySelectorAll("body > script");var r;t.length>0?null===(r=t[0].parentNode)||void 0===r||r.insertBefore(s,t[0]):n.body.appendChild(s)}};(null==n?void 0:n.body)?r():null==n||n.addEventListener("DOMContentLoaded",r)},U_={},z_=(t,e)=>{let i=`/static/${e}.js?v=${t.version}`;if("toolbar"===e){const t=3e5;i=`${i}&t=${Math.floor(Date.now()/t)*t}`}return t.requestRouter.endpointFor("assets",i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"===e){const e=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void H_(t,e,i)}const n=t.config.strict_script_versioning;if(n){const s=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=U_[s];if("fallback"===n&&r){if(j_(r))return void H_(t,r,i);delete U_[s]}return void H_(t,s,"fallback"===n?(n,r)=>{if(n)if("string"==typeof n)i(n);else{var o;const n=z_(t,e);U_[s]=n;const r=j_(s);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),H_(t,n,i)}else i(void 0,r)}:i)}H_(t,z_(t,e),i)},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{const n=t.requestRouter.endpointFor("api",e);H_(t,n,i)};var W_=class{constructor(t){this._instance=t}get Mr(){return this._instance.config}get consent(){return this.Ro()?0:this.Ao}isOptedOut(){return"always"===this.Mr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Mr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Mr.opt_out_capturing_by_default}optInOut(t){this.Fo.At(this.Oo,t?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Fo.Lt(this.Oo,this.Mr.cross_subdomain_cookie)}get Oo(){const{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get Ao(){const t=this.Fo.Ot(this.Oo);return ze(t)?1:ge(We,t)?0:-1}get Fo(){const t=this.Mr.opt_out_capturing_persistence_type,e="localStorage"===t?Ll:Fl,i=e.Et()?e:Ql;if(!this.Do||this.Do!==i){this.Do=i;const e="localStorage"===t?Fl:Ll;e.Ot(this.Oo)&&(this.Do.Ot(this.Oo)||this.optInOut(ze(e.Ot(this.Oo))),e.Lt(this.Oo,this.Mr.cross_subdomain_cookie))}return this.Do}Ro(){return!!this.Mr.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(t=>ze(t))}};const V_=Gs("[Dead Clicks]"),G_=()=>!0,Z_=t=>{var e;const i=!!(null===(e=t.instance.persistence)||void 0===e?void 0:e.get_property(R)),n=t.instance.config.capture_dead_clicks;return Ae(n)?n:!!Ce(n)||i};var Q_=class{get lazyLoadedDeadClicksAutocapture(){return this.Lo}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[R]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.No(()=>{this.qo()}):this.stop()}No(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this.instance,"dead-clicks-autocapture",e=>{e?V_.error("failed to load script",e):t()})}qo(){var t;if(n){if(!this.Lo&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=Ce(this.instance.config.capture_dead_clicks)?ue({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Lo=d.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Lo.start(n),V_.info("starting...")}}else V_.error("`document` not found. Cannot start.")}stop(){this.Lo&&(this.Lo.stop(),this.Lo=void 0,V_.info("stopping..."))}};const J_=Gs("[SegmentIntegration]");function K_(t,e,i=!0){const n=t.config.segment;if(!n)return e();const{analytics:s,filterProperties:r}=(t=>xe(t.register))(o=n)?{analytics:o}:o;var o;!function(t,e,i,n){const s=e=>{const s=()=>e.anonymousId()||Ml();t.config.get_device_id=s,n&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property($t,Jt)),i(n?void 0:e.anonymousId()||void 0)},r=e.user();"then"in r&&xe(r.then)?r.then(s):s(r)}(t,s,i=>{s.register(((t,e,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||J_.warn("This browser does not have Promise support, and can not use the segment integration");const n=(n,s)=>{if(!s)return n;const r=!!e&&n.event.anonymousId===e&&!n.event.userId;r||n.event.userId||n.event.anonymousId===t.get_distinct_id()||(J_.info("No userId set, resetting PostHog"),t.reset()),r||(e=void 0),n.event.userId&&n.event.userId!==t.get_distinct_id()&&(J_.info("UserId set, identifying with PostHog"),t.identify(n.event.userId));let o=t.calculateEventProperties(s,n.event.properties);if(!Re(i)){const t=n.event.properties||{},e={};for(const i of Object.keys(o))we.call(t,i)||(e[i]=o[i]);const s=((t,e)=>{const i=Se(t)?t:[t];let n=ue({},e);for(const t of i)try{if(n=t(n),Re(n))return null}catch(t){return J_.error("Error in Segment filterProperties:",t),null}return n})(i,e);if(Re(s))return n;o=s}return n.event.properties=Object.assign({},o,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return n(t,t.event.event)},page(t){return n(t,te)},identify(t){return n(t,ie)},screen(t){return n(t,"$screen")}}})(t,i,{filterProperties:r})).then(()=>{e()},t=>{J_.error("Failed to register the Segment integration",t),e()})},i)}const Y_="posthog-js";function X_(t,{organization:e,projectId:i,prefix:n,severityAllowList:s=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var l,a,u,h,c;if("*"!==s&&!s.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const d=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,t.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const v=(null===(l=o.exception)||void 0===l?void 0:l.values)||[],f=v.map(t=>ue(ue({},t),{},{stacktrace:t.stacktrace?ue(ue({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>ue(ue({},t),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:(null===(a=v[0])||void 0===a?void 0:a.value)||o.message,$exception_type:null===(u=v[0])||void 0===u?void 0:u.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(h=v[0])||void 0===h?void 0:h.value)||o.message,$sentry_exception_type:null===(c=v[0])||void 0===c?void 0:c.type,$sentry_tags:o.tags};var g;return e&&i&&(p.$sentry_url=(n||"https://sentry.io/organizations/")+e+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(g=t.exceptions)||void 0===g||g.sendExceptionEvent(p)),o}}var tb=class{constructor(t,e,i,n,s,r){this.name=Y_,this.setupOnce=function(o){o(X_(t,{organization:e,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:null==r||r}))}}},eb=class{constructor(t){this.jo=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Vs.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Bo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ho()}Ho(){var t;this.zo=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.jo)}destroy(){var t;null===(t=this.zo)||void 0===t||t.call(this),this.zo=void 0}doPageView(e,i){var n;const s=this.Uo(e,i);return this.Bo={pathname:null!==(n=null==t?void 0:t.location.pathname)&&void 0!==n?n:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.Uo(t,null===(e=this.Bo)||void 0===e?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.Bo)||void 0===t?void 0:t.pageViewId}}Uo(t,e){const i=this.Bo;if(!i)return{$pageview_id:e};let n={$pageview_id:e,$prev_pageview_id:i.pageViewId};const s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:t,lastScrollY:e,maxScrollY:i,maxContentHeight:r,lastContentY:o,maxContentY:l}=s;if(!(Te(t)||Te(e)||Te(i)||Te(r)||Te(o)||Te(l))){t=Math.ceil(t),e=Math.ceil(e),i=Math.ceil(i),r=Math.ceil(r),o=Math.ceil(o),l=Math.ceil(l);const s=t>1?Ze(e/t,0,1,Vs):1,a=t>1?Ze(i/t,0,1,Vs):1,u=r>1?Ze(o/r,0,1,Vs):1,h=r>1?Ze(l/r,0,1,Vs):1;n=Js(n,{$prev_pageview_last_scroll:e,$prev_pageview_last_scroll_percentage:s,$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:a,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:u,$prev_pageview_max_content:l,$prev_pageview_max_content_percentage:h})}}return i.pathname&&(n.$prev_pageview_pathname=i.pathname),i.timestamp&&(n.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),n}};const ib=["flags","surveys"],nb={[v]:{exposure:"hidden"},[m]:{exposure:"hidden"},[y]:{exposure:"hidden"},[S]:{exposure:"hidden"},[b]:{exposure:"hidden"},[k]:{exposure:"hidden"},[x]:{exposure:"event"},[C]:{exposure:"hidden"},[O]:{exposure:"hidden"},[T]:{exposure:"event"},[E]:{exposure:"hidden"},[I]:{exposure:"event"},[M]:{exposure:"event"},[R]:{exposure:"event"},[P]:{exposure:"hidden"},[A]:{exposure:"event"},[F]:{exposure:"hidden"},[D]:{exposure:"hidden"},[H]:{exposure:"hidden"},[U]:{exposure:"event"},[L]:{exposure:"event",shouldSkipFromEventProperties:t=>Me(t)},[z]:{exposure:"event"},[W]:{exposure:"event"},[V]:{exposure:"event"},[J]:{exposure:"event"},[K]:{exposure:"hidden"},[Y]:{exposure:"hidden",storageGroup:"flags"},[X]:{exposure:"hidden",storageGroup:"flags"},[tt]:{exposure:"hidden"},[et]:{exposure:"hidden",storageGroup:"flags"},[it]:{exposure:"hidden",storageGroup:"flags"},[nt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[st]:{exposure:"hidden",storageGroup:"flags"},[rt]:{exposure:"hidden"},[ot]:{exposure:"hidden"},[lt]:{exposure:"hidden"},[at]:{exposure:"hidden"},[ht]:{exposure:"hidden",storageGroup:"surveys"},[ct]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[dt]:{exposure:"event"},[vt]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[pt]:{exposure:"hidden"},[gt]:{exposure:"hidden"},[mt]:{exposure:"hidden"},[yt]:{exposure:"event"},[_t]:{exposure:"event"},[bt]:{exposure:"event"},[wt]:{exposure:"event"},[kt]:{exposure:"hidden"},[St]:{exposure:"hidden"},[ut]:{exposure:"event"},[xt]:{exposure:"hidden"},[Ct]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[$t]:{exposure:"hidden"},[Tt]:{exposure:"hidden"},[Et]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[Pt]:{exposure:"hidden"},[N]:{exposure:"event"},[q]:{exposure:"event"},[B]:{exposure:"event"},[j]:{exposure:"event"},[Ft]:{exposure:"event"},[Dt]:{exposure:"event"},[Lt]:{exposure:"event"},[Nt]:{exposure:"event"},[qt]:{exposure:"event"},[Bt]:{exposure:"event"},[jt]:{exposure:"event"},[Ht]:{exposure:"event"},[Ut]:{exposure:"event"},[zt]:{exposure:"event"},[Gt]:{exposure:"event"}},sb=[[G,{exposure:"hidden"}],[Z,{exposure:"hidden"}],[Q,{exposure:"hidden"}]],rb=t=>{const e=nb[t];if(e)return e;for(const[e,i]of sb)if(0===t.indexOf(e))return i},ob={flags:Ct,surveys:ct},lb=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ab=t=>`${t}_cookie_identity_change_pending`,ub=t=>{let e="",i=0;for(const n of t){const t=encodeURIComponent(JSON.stringify(n).slice(1,-1)).length;if(i+t>1e3)break;e+=n,i+=t}return e},hb="main",cb=[Y,X,et,it,nt,Ct,st,lt],db=t=>-1!==cb.indexOf(t),vb=[b,k],fb=t=>-1!==vb.indexOf(t),pb=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},gb=t=>{if(!t)return{};const e=JSON.parse(t);return Ce(e)?e:{}},mb=(t,e)=>{Qs(t,(i,n)=>{const s=rb(n);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,n)||delete t[n]})};var yb=class{constructor(e,i,n=!0){if(this.Wo={},this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=new Map,this.Xo=!1,this.Yo=!1,this.tl=!1,this.el=new Set,this.il=new Set,this.Mr=e,this.nl=n,this.props={},this.sl=void 0,this.rl=(t=>{let e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(e),this.Fo=this.ol(e),this.Zo=this.ll(e),this.load(),this.al(),e.debug&&Vs.info("Persistence loaded",e.persistence,ue({},this.props)),this.update_config(e,e,i),this.save(),t){const e=()=>this.flush();nr(t,"beforeunload",e,{capture:!1}),nr(t,"pagehide",e,{capture:!1}),this.ul=e=>{if(this.Vo&&(!e.storageArea||e.storageArea===(null==t?void 0:t.localStorage))&&e.key)if(e.key!==this.rl){if(this.Zo){const t=ib.find(t=>e.key===this.hl(t));t&&this.cl(e.key,t)}}else this.cl(e.key,hb)},nr(t,"storage",this.ul)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,e])=>{const i=this.Ko.get(t);if(!db(t)||!0===i)return;if(!0===e)return void this.dl(t,!0);const n=new Set(i||[]);e.forEach(t=>n.add(t)),n.size&&this.dl(t,n)})}onCrossTabFeatureFlagChange(t){return this.il.add(t),()=>this.il.delete(t)}destroy(){this.ul&&t&&(t.removeEventListener("storage",this.ul),this.ul=void 0),this.il.clear()}cl(t,e,i=!0){if(this.pi)return!1;let n,s;try{if(s=Ll.Ot(t),Me(s)){const t=this.vl(e);return t.storageValue=null,e!==hb&&(t.persisted=!1),!1}n=gb(s)}catch(t){return!1}const r=e===hb?n:Ll.Dt(this.rl);if(r&&this.fl(r))return!1;const o=this.pl(n,e,i);return e===hb&&this.Zo&&!pb(this.gl().main,n)||this.ml(n,e,!0,s),o}fl(t){const e=this.props[f],i=t[f];return!Te(e)&&!Te(i)&&e!==i}ml(t,e,i,n){const s=this.vl(e);s.storageValue=n,e!==hb&&(s.persisted=i);try{s.fingerprint=this.yl(t,e)}catch(t){s.fingerprint=void 0}}pl(t,e,i){let n=!1;return cb.forEach(i=>{var s;const r=null===(s=rb(i))||void 0===s?void 0:s.storageGroup;if(e===hb&&this.Zo&&r||e!==hb&&r!==e)return;const o=i in t,l=this.bl(i,o?t[i]:void 0),a=this.Ko.has(i)?i in this.props:o;a===i in this.props&&pb(l,this.props[i])||(a?this._l(i,l,!1):this.wl(i,!1),n=!0)}),n&&i&&this.il.forEach(t=>t()),n}kl(){if(!this.Vo)return!1;try{this.tl=!1;const t=Ll.Ot(this.rl),e=this.vl(hb);let i,n=!1,s=!1;if(t!==e.storageValue)if(Me(t))e.storageValue=null;else{if(i=gb(t),this.tl=!this.Yo&&this.fl(i),this.tl)return!1;s=this.pl(i,hb,!1),!this.Zo||pb(this.gl().main,i)?this.ml(i,hb,!0,t):e.storageValue=t,n=!0}return this.Zo&&ib.forEach(t=>{const e=Ll.Ot(this.hl(t)),r=this.vl(t),o=i||{},l=n&&cb.some(e=>{var i;return(null===(i=rb(e))||void 0===i?void 0:i.storageGroup)===t&&e in o});if(e===r.storageValue&&!l)return;if(Me(e))return r.storageValue=null,r.persisted=!1,void(l&&(s=this.pl(o,t,!1)||s));const a=gb(e);s=this.pl(a,t,!1)||s,this.ml(a,t,!0,e)}),s}catch(t){return!1}}dl(t,e){this.Ko.set(t,e);const i=rb(t);(null==i?void 0:i.volatile)||(this.vl((this.Zo?null==i?void 0:i.storageGroup:void 0)||hb).fingerprint=void 0,this.Sl(t))}xl(){cb.forEach(t=>this.Ko.set(t,!0))}al(){if(this.Vo)try{const t=Ll.Ot(this.rl),e=gb(t);this.vl(hb).storageValue=t,cb.forEach(t=>{var i;const n=this.Zo?null===(i=rb(t))||void 0===i?void 0:i.storageGroup:void 0,s=n?Ll.Ot(this.hl(n)):null;if(n){const t=this.vl(n);t.storageValue=s,t.persisted=!Me(s)}const r=n&&!Me(s)?gb(s):e;t in this.props?this.Cl(t,r[t],this.props[t]):t in r&&this.dl(t,!0)})}catch(t){}}bl(t,e){const i=this.Ko.get(t);if(!i)return e;if(!0===i)return this.props[t];if("$active_feature_flags"===t){const n=new Set(Se(e)?e:[]),s=new Set(Se(this.props[t])?this.props[t]:[]);return i.forEach(t=>s.has(t)?n.add(t):n.delete(t)),Array.from(n)}const n=Ce(e)?ue({},e):{},s=Ce(this.props[t])?this.props[t]:{};return i.forEach(t=>{t in s?n[t]=s[t]:delete n[t]}),n}Cl(t,e,i){if(!db(t))return;const n=this.Ko.get(t);if(!0===n)return;let s=e;if(this.Vo)try{var r;const e=this.Zo?null===(r=rb(t))||void 0===r?void 0:r.storageGroup:void 0,i=e?this.hl(e):this.rl;s=gb(Ll.Ot(i))[t]}catch(t){}const o=new Set(n||[]);if("$active_feature_flags"===t){if(!Te(e)&&!Se(e)||!Te(s)&&!Se(s)||!Se(i))return void this.dl(t,!0);const n=new Set(e||[]),r=new Set(s||[]),l=new Set(i);new Set([...n,...l]).forEach(t=>{n.has(t)!==l.has(t)&&o.add(t)}),o.forEach(t=>{r.has(t)===l.has(t)&&o.delete(t)})}else{if(!Ce(i))return void(pb(s,i)?this.Ko.delete(t):this.dl(t,!0));{if(!Te(e)&&!Ce(e)||Te(e)&&$e(i)&&Te(s))return void this.dl(t,!0);const n=Ce(e)?e:{},r=Ce(s)?s:{};new Set([...Object.keys(n),...Object.keys(i)]).forEach(t=>{t in n==t in i&&pb(n[t],i[t])||o.add(t)}),o.forEach(t=>{t in r==t in i&&pb(r[t],i[t])&&o.delete(t)})}}o.size?this.dl(t,o):this.Ko.delete(t)}$l(){var t;const e=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Pe(e)&&e>0?e:0}Tl(t){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase())if(t)try{const e=Ul(t,this.Mr.cookie_persisted_properties||[]),i=Wl(e,this.Mr.cookie_persisted_properties||[]),n=JSON.stringify(e)+"|"+JSON.stringify(i),s=Fl.Ot(this.rl)||void 0;s&&Gl(this.rl,s)===n&&(this.Il=n,this.Ml=s)}catch(t){}else try{const t=Fl.Ot(this.rl)||void 0;this.Il=t?Gl(this.rl,t):void 0,this.Ml=t}catch(t){}}syncCookieProperties(){return this.El(this.Mr)}El(t,e=!1){if(this.pi&&!e||this.Jo||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let i;try{i=Fl.Ot(this.rl)||void 0}catch(t){}if(!i||i===this.Ml)return!1;const n=Gl(this.rl,i);let s;try{s=Hl(JSON.parse(i))}catch(t){return!1}if((Fl.Ot(this.rl)||void 0)!==i)return!1;this.Il=n,this.Ml=i;const r=Vl(this.rl,i),o=[...ql,...r.properties],l={};if(Object.keys(s).forEach(t=>{const e=s[t];(Te(e)||Me(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e)&&(l[t]=!0,delete s[t])}),$e(s))return!1;const a="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,u=this.props,h=u[f],c=u[$t],d=Js({},u);[...ql,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in s)&&!l[t]&&(a||"distinct_id"!==t&&"$user_state"!==t)){const e=d[t];(r.isValid||-1===ql.indexOf(t)||!1!==e&&0!==e)&&delete d[t]}}),this.props=Js(d,s),cb.forEach(t=>{const e=t in this.props;t in u===e&&pb(u[t],this.props[t])||(e?this.Cl(t,u[t],this.props[t]):this.dl(t,!0))}),!a||"$user_state"in s||"$user_state"in this.props||this._l($t,Qt);const v=this.props[f],p=this.props[$t];return!a||v===h&&p===c||(this.Yo=!0,this.Qo=!0,Kl.At(ab(this.rl),!0),this.wl(lt),this.wl(X),this.wl(Y),this.wl(et),this.wl(it),this.wl(nt),this.wl(Ct),this.wl(xt),this.wl(kt),"anonymous"!==p||"identified"!==c&&"anonymous"!==s.$user_state&&(Te(h)||v===h)||(mb(this.props,s),this.wl(at)),"identified"===p?this.props.$user_id=v:delete this.props.$user_id,this.wl(m)),!0}consumeCookieIdentityChange(){const t=ab(this.rl),e=this.Qo||!!Kl.Ot(t);return this.Qo=!1,e&&Kl.Lt(t),e}Pl(t=!1){return!(this.Jo||this.pi&&!t||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.Jo=!0,0))}Rl(){this.Jo&&(Te(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[hb],this.Fl(!0))}Ol(t=!0){if(this.Jo)try{t?this.Rl():Te(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}isDisabled(){return!!this.pi}ol(e){-1===lb.indexOf(e.persistence.toLowerCase())&&(Vs.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const i=((e=[],i=!1)=>{const n=[...ql,...e];return ue(ue({},Ll),{},{Dt(t){try{let s,r={};try{s=Fl.Ot(t)||void 0,r=s?Hl(JSON.parse(s)):{}}catch(t){}const o=JSON.parse(Ll.Ot(t)||"{}");let l;if(i){const i=Vl(t,s),a=[...ql,...i.properties],u={};Object.keys(r).forEach(t=>{const e=r[t];Me(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e||(u[t]=e)});const h="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var e;const t=o[f],s=null!==(e=o.$user_state)&&void 0!==e?e:Qt;n.forEach(t=>{if(-1!==a.indexOf(t)&&!(t in r)&&(h||"distinct_id"!==t&&"$user_state"!==t)){const e=o[t];(i.isValid||-1===ql.indexOf(t)||!1!==e&&0!==e)&&delete o[t]}}),!h||"$user_state"in r||"$user_state"in o||(o[$t]=Qt),!h||("distinct_id"in u?u[f]:o[f])===t&&("$user_state"in u?u[$t]:o[$t])===s||(Nl.forEach(t=>delete o[t]),"identified"===u.$user_state&&"distinct_id"in u?o.$user_id=u[f]:delete o.$user_id,"identified"!==u.$user_state&&(delete o[ut],delete o[at]),delete o.__alias)}l=Js(o,u)}else l=Js(r,o);return Ll.At(t,l),l}catch(t){}return null},At(t,n,s,r,o,l){const a=Ll.At(t,n,void 0,void 0,l);try{const u=Ul(n,e);if(Object.keys(u).length){if(i){const i=Bl(t),h=Wl(u,e);if(Fl.At(i,h,s,r,o,l),Fl.Ot(i)!==JSON.stringify(h)){Fl.Lt(i,r);const e=Ul(n);return Fl.At(t,e,s,r,o,l),a}}Fl.At(t,u,s,r,o,l)}}catch(t){Ll.Pt(t)}return a},Lt(e,i){try{null==t||t.localStorage.removeItem(e),Fl.Lt(e,i),Fl.Lt(Bl(e),i)}catch(t){Ll.Pt(t)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let n,s=!1,r=!1;const o=e.persistence.toLowerCase();return"localstorage"===o&&Ll.Et()?(n=Ll,r=!0):"localstorage+cookie"===o&&i.Et()?(n=i,r=!0,s=!0):"sessionstorage"===o&&Kl.Et()?n=Kl:"memory"===o?n=Ql:"cookie"===o&&Fl.Et()?(n=Fl,s=!0):i.Et()?(n=i,r=!0,s=!0):Fl.Et()?(n=Fl,s=!0):n=Ql,this.Vo=r,this.Go=s,n}hl(t){return`${this.rl}__${t}`}ll(t){return this.Vo&&!!t.split_storage}properties(){const t={};return Qs(this.props,(e,i)=>{const n=rb(i);if(!n||"event"===n.exposure){var s;if(null==n||null===(s=n.shouldSkipFromEventProperties)||void 0===s?void 0:s.call(n,e))return;t[i]=e}}),t}load(t=!1){if(this.pi&&!t)return;const e=this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase(),i=e?Ll.Dt(this.rl):null;let n={};if(e)try{n=Hl(Fl.Dt(this.rl)),Qs(n,(t,e)=>{(Te(t)||Me(t)||""===t)&&delete n[e]})}catch(t){}const s=this.Fo.Dt(this.rl);if(s&&(this.props=Js({},s)),this.Zo&&this.Dl(),e&&s){var r,o;const t=null==i?void 0:i[f],e=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Qt,l=s[f],a=null!==(o=s.$user_state)&&void 0!==o?o:Qt;if(l!==t||a!==e){this.Qo=!0,Kl.At(ab(this.rl),!0);const i=Js({},this.props);Nl.forEach(t=>delete i[t]),"anonymous"!==a||"identified"!==e&&"anonymous"!==n.$user_state&&(Te(t)||l===t)||(mb(i,n),delete i[at]),this.props=i;const s=new Set;Nl.forEach(t=>{var e;const i=null===(e=rb(t))||void 0===e?void 0:e.storageGroup;i&&s.add(i)}),s.forEach(t=>{const e={};Qs(this.props,(i,n)=>{var s;(null===(s=rb(n))||void 0===s?void 0:s.storageGroup)===t&&(e[n]=i)}),$e(e)?(Ll.Lt(this.hl(t)),this.Wo[t]={}):Ll.At(this.hl(t),e)&&(this.Wo[t]={persisted:!0,fingerprint:this.yl(e,t)})})}}Kl.Ot(ab(this.rl))&&(this.Qo=!0)}Dl(){for(const t of ib){const e=Ll.Dt(this.hl(t));if(e&&!$e(e)){const i=this.vl(t);i.persisted=!0,this.Ll(t)||(i.fingerprint=this.yl(e,t)),this.Nl(t,e)||Js(this.props,e)}}}Ll(t){return Object.keys(this.props).some(e=>{var i;return(null===(i=rb(e))||void 0===i?void 0:i.storageGroup)===t})}Nl(t,e){const i=ob[t];if(!i)return!1;const n=e[i],s=this.props[i];return Pe(n)&&Pe(s)&&s>n}refreshKey(t){var e;if(this.pi)return;if(this.el.has(t))return;const i=this.Zo?null===(e=rb(t))||void 0===e?void 0:e.storageGroup:void 0,n=i?Ll.Dt(this.hl(i)):this.Fo.Dt(this.rl);if(n&&t in n)this._l(t,n[t],!1);else{if(i){const e=this.Fo.Dt(this.rl);if(e&&t in e)return void this._l(t,e[t],!1)}this.wl(t,!1)}}save(){if(this.pi)return;const t=this.$l();t>0?Te(this.Al)&&(this.Al=setTimeout(()=>{this.Al=void 0,this.Fl()},t)):this.Fl()}flush(){Te(this.Al)||(clearTimeout(this.Al),this.Al=void 0,this.Fl())}Fl(t=!1){if(this.pi||this.Jo&&!t)return;t||(this.syncCookieProperties(),this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||vb.forEach(t=>this.refreshKey(t)));const e=!t&&!this.Xo;e||(this.tl=!1);const i=!!e&&this.kl();if(this.tl)return void(this.Mr.debug&&Vs.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Zo)return this.ql(),void(i&&this.il.forEach(t=>t()));const n=this.jl(this.Fo,this.rl,this.props,hb);"written"===n&&this.Tl(this.props),"failed"!==n&&(this.Ko.clear(),this.Yo=!1,this.el.clear()),i&&this.il.forEach(t=>t())}ql(){const{main:t,groups:e}=this.gl(),i=this.jl(this.Fo,this.rl,t,hb);"written"===i&&this.Tl(t),"failed"!==i&&(this.Yo=!1,this.el.clear(),cb.forEach(t=>{var e;(null===(e=rb(t))||void 0===e?void 0:e.storageGroup)||this.Ko.delete(t)}));for(const t of ib){var n;const i=e[t];if($e(i)&&!(null===(n=this.Wo[t])||void 0===n?void 0:n.persisted)){cb.forEach(e=>{var i;(null===(i=rb(e))||void 0===i?void 0:i.storageGroup)===t&&this.Ko.delete(e)});continue}const s=this.jl(Ll,this.hl(t),i,t);"failed"!==s&&cb.forEach(e=>{const i=rb(e);(null==i?void 0:i.storageGroup)!==t||"written"!==s&&i.volatile||this.Ko.delete(e)})}}gl(){const t={},e={flags:{},surveys:{}};return Qs(this.props,(i,n)=>{var s;const r=null===(s=rb(n))||void 0===s?void 0:s.storageGroup;r?e[r][n]=i:t[n]=i}),{main:t,groups:e}}yl(t,e){if(e===hb)return JSON.stringify(t)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;const i={};return Qs(t,(t,e)=>{var n;i[e]=(null===(n=rb(e))||void 0===n?void 0:n.volatile)?"__volatile__":t}),JSON.stringify(i)}jl(t,e,i,n){const s=this.vl(n);if(n!==hb&&!s.dirty&&!Te(s.fingerprint))return"skipped";let r;try{if(r=this.yl(i,n),r===s.fingerprint)return s.dirty=!1,"skipped"}catch(t){r=void 0}return t.At(e,i,this.Bl,this.Hl,this.zl,this.Mr.debug)?(s.dirty=!1,n!==hb&&(s.persisted=!0),Te(r)||(s.fingerprint=r),this.Vo&&(s.storageValue=Ll.Ot(e)),"written"):(this.Mr.debug&&Vs.warn(`failed to persist storage entry "${e}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.xl(),Te(this.Al)||(clearTimeout(this.Al),this.Al=void 0),this.Fo.Lt(this.rl,!1),this.Fo.Lt(this.rl,!0),!t&&this.nl)for(const t of ib)Ll.Lt(this.hl(t));t?delete this.Wo[hb]:this.Wo={},this.Il=void 0,this.Ml=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(Ce(t)){this.syncCookieProperties(),Te(e)&&(e="None"),this.Bl=Te(i)?this.Ul:i;let n=!1;if(Qs(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this._l(i,t),n=!0)}),n)return this.save(),!0}return!1}register(t,e){if(Ce(t)){this.syncCookieProperties(),this.Bl=Te(e)?this.Ul:e;let i=!1;if(Qs(t,(e,n)=>{t.hasOwnProperty(n)&&(this.props[n]!==e||Ce(e)||Se(e))&&(this._l(n,e),i=!0)}),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();const e="string"==typeof t?[t]:t;let i=!1;for(const t of e)t in this.props&&(this.wl(t),i=!0);i&&this.save()}update_campaign_params(){const t=null==n?void 0:n.URL;if(t===this.sl)return;const e=Ia(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),i=!$e(Xs(e));return i&&this.register(e),this.sl=t,i?e:void 0}update_search_keyword(){this.register(function(){const t=null==n?void 0:n.referrer;return t?Ra(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:Fa(),$referring_domain:(null==n?void 0:n.referrer)&&(null===(t=lr(n.referrer))||void 0===t?void 0:t.host)||Aa},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Da(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[Rt]:this.Go?{r:ub(t.r),u:t.u?ub(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Qs([Mt,It],e=>{const i=this.props[e];i&&Qs(i,function(e,i){t["$initial_"+ye(i)]=e})});const e=this.props[Rt];if(e){const i=function(t,e=!1){const i=La(t,e),n={};return Qs(i,function(t,e){n[`$initial_${ye(e)}`]=t}),n}(e,this.Mr.disable_capture_url_hashes);Js(t,i)}return t}safe_merge(t){return Qs(this.props,function(e,i){i in t||(t[i]=e)}),t}update_config(t,e,i){const n=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;const i=[...t].sort(),n=[...e].sort();return i.every((t,e)=>t===n[e])})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),r=n||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,l=t.disable_persistence||!!i,a=!!this.pi&&!l;l||this.El(e,a),this.Mr=t,!l&&(n||s||o)&&(this.Il=void 0,this.Ml=void 0,this.El(ue(ue({},t),{},{cookie_persisted_properties:e.cookie_persisted_properties}),a));const u=r||o?this.ol(t):this.Fo;this.Wl();const h=this.ll(t),c=r||h!==this.Zo,d=!l&&(c||t.cross_subdomain_cookie!==this.Hl||t.secure_cookie!==this.zl)&&this.Pl(a);this.Xo=c;try{if(this.Ul=this.Bl=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),c){const t=this.props;this.clear(),this.Fo=u,this.Zo=h,this.props=t,this.save()}else o&&(this.Fo=u,l||(delete this.Wo[hb],this.Fl()))}finally{this.Xo=!1,d&&this.Ol()}}Wl(){const t=this.props[Rt];if(!this.Go||!Ce(t)||"string"!=typeof t.r)return;const e=ub(t.r),i="string"==typeof t.u?ub(t.u):t.u;e===t.r&&i===t.u||this._l(Rt,ue(ue({},t),{},{r:e,u:i}))}set_disabled(t){this.pi=t,this.pi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Hl&&(this.Hl=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.zl&&(this.zl=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){const i=this.props.__timers||{};i[t]=e,this._l(S,i),this.save()}remove_event_timer(t){const e=this.props.__timers||{},i=e[t];return Te(i)||(delete e[t],this._l(S,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this._l(t,e),this.save()}_l(t,e,i=!0){var n;const s=this.props[t];this.props[t]=e,i&&("distinct_id"!==t&&"$user_state"!==t||s===e||(this.Yo=!0),fb(t)&&!pb(s,e)&&this.el.add(t),this.Cl(t,s,e),(null===(n=rb(t))||void 0===n?void 0:n.volatile)||this.Sl(t))}wl(t,e=!0){delete this.props[t],e&&(db(t)&&this.dl(t,!0),fb(t)&&this.el.add(t),this.Sl(t))}Sl(t){var e;const i=null===(e=rb(t))||void 0===e?void 0:e.storageGroup;i&&(this.vl(i).dirty=!0)}vl(t){return this.Wo[t]||(this.Wo[t]={})}};const _b={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},bb={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},wb=Gs("[RateLimiter]");var kb=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach(t=>{wb.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void wb.warn(`could not rate limit - continuing. Error: "${null==t?void 0:t.message}"`,{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t=!1){var e,i,n;const{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,o=(new Date).getTime(),l=null!==(e=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_property("$capture_rate_limit"))&&void 0!==e?e:{tokens:s,last:o};l.tokens+=(o-l.last)/1e3*r,l.last=o,l.tokens>s&&(l.tokens=s);const a=1>l.tokens;if(a||t||(l.tokens=Math.max(0,l.tokens-1)),a&&!t){const t=(Pe(l.dropped)?l.dropped:0)+1;l.dropped=t,!this.lastEventRateLimited&&this.Vl(t)&&(l.dropped=0)}return this.lastEventRateLimited=a,null===(n=this.instance.persistence)||void 0===n||n.set_property("$capture_rate_limit",l),{isRateLimited:a,remainingTokens:l.tokens}}Gl(t){const e=this.instance.config.property_denylist;return!Se(e)||!e.includes(t)}Zl(){var t;if(this.Gl("$current_url")&&this.Gl("$pathname")&&(null==s?void 0:s.pathname))return`${null!==(t=s.origin)&&void 0!==t?t:""}${s.pathname}`}Vl(t){var e,i;const{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,r=this.Zl(),o=this.Gl("$session_id")?null===(e=(i=this.instance).get_session_id)||void 0===e?void 0:e.call(i):void 0,l=[`${t} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${l}. Config is set to ${s} events per second and ${n} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(t){const e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}};const Sb=Gs("[RemoteConfig]");var xb=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=d._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Ql(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.loadExternalDependency)?null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Jl(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:t})}load(){try{if(this.remoteConfig)return Sb.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance.Xl())return void Sb.warn("Remote config is disabled. Falling back to local config.");this.Ql(t=>{if(!t)return Sb.info("No config found after loading remote JS config. Falling back to JSON."),void this.Jl(t=>{this.Kl(t.json,t)});this.Kl(t)})}catch(t){Sb.error("Error loading remote config",t),this.Kl()}}Kl(t,e){!t&&e&&(0===e.statusCode?e.error||Sb.warn("Failed to fetch remote config from PostHog."):Sb.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(t?{ok:!0,config:t}:{ok:!1})}catch(t){Sb.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null===(i=this._instance.featureFlags)||void 0===i||i.ensureFlagsLoaded()}catch(t){Sb.error("Error loading feature flags",t)}}};const Cb=!!o||!!r,$b=new WeakMap,Tb="text/plain";let Eb=0,Ib=!1;const Mb=(t,e)=>{const[i,n]=t.split("#"),[s,r]=i.split("?");if(!r)return t;const o=r.split("&").filter(t=>t.split("=")[0]!==e).join("&");return`${s}${o?`?${o}`:""}${n?`#${n}`:""}`},Rb=(t,e,i=!0)=>{var n;const[s,r]=t.split("?"),o=ue({},e),l=null!==(n=null==r?void 0:r.split("&").map(t=>{var e;const[n,s]=t.split("="),r=i&&null!==(e=o[n])&&void 0!==e?e:s;return delete o[n],`${n}=${r}`}))&&void 0!==n?n:[],a=ar(o);return a&&l.push(a),l.length>0?`${s}?${l.join("&")}`:s},Pb=t=>{if(t.Yl)return t.Yl;const{data:e,compression:i}=t;if(!e)return;if(i===hp.GZipJS){const t=bl(wl(or(e)),{mtime:0});return{contentType:Tb,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(i===hp.Base64){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(or(e)),i=(t=>"data="+encodeURIComponent("string"==typeof t?t:or(t)))(t);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const n=or(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}},Ob=t=>{const e=()=>"sendBeacon"===t.transport?{url:Rb(t.url,{compression:hp.Base64}),encodedBody:Pb(ue(ue({},t),{},{compression:hp.Base64,Yl:void 0}))}:{url:Mb(t.url,"compression"),encodedBody:Pb(ue(ue({},t),{},{compression:void 0,Yl:void 0}))};let i;try{i=Pb(t)}catch(i){if(us(t.compression,ur(t.url,"compression")))return Vs.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return i&&us(t.compression,ur(t.url,"compression"))&&!((n=i.body)instanceof ArrayBuffer?as(new Uint8Array(n)):ArrayBuffer.isView(n)&&as(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(Ib=!0,e()):{url:t.url,encodedBody:i};var n},Ab=t=>{try{return Ob(t)}catch(i){var e;return Vs.error(i),void(null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))}},Fb=function(){var t=re(function*(t){const e=yield gs(or(t.data),Yl.DEBUG,{rethrow:!0});if(!e)return t;const i=yield e.arrayBuffer();return ue(ue({},t),{},{Yl:{contentType:Tb,body:i,estimatedSize:i.byteLength}})});return function(e){return t.apply(this,arguments)}}(),Db=/Failed to fetch|NetworkError|Load failed/i,Lb=t=>"TypeError"===(null==t?void 0:t.name)&&Db.test((null==t?void 0:t.message)||""),Nb=t=>{try{const e=function(t,e=Date.now()){if("string"!=typeof t||!t)return;const i=t.trim(),n=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(n)){const t=1e3*Math.min(Number(n),300);return t>0?t:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(n))return;const s=/^\w{3} \w{3} /.test(n)?n+" GMT":n,r=Date.parse(s)-e;return Number.isFinite(r)&&r>0?Math.min(r,sn):void 0}(t());return Te(e)?void 0:Math.min(e,3e4)}catch(t){return}},qb=t=>{const e=Ab(t);if(!e)return;const i=new o;$b.set(i,!0);const{url:n,encodedBody:s}=e;i.open(t.method||"GET",n,!0);const{contentType:r,body:l}=null!=s?s:{};Qs(t.headers,function(t,e){i.setRequestHeader(e,t)}),r&&i.setRequestHeader("Content-Type",r),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e;const n={statusCode:i.status,text:i.responseText};if(200===i.status)try{n.json=JSON.parse(i.responseText)}catch(t){}null===(e=t.callback)||void 0===e||e.call(t,n,Nb(()=>i.getResponseHeader("Retry-After")))}},i.send(l)},Bb=t=>{const e=Ab(t);if(!e)return;const{url:i,encodedBody:n}=e,{contentType:s,body:o,estimatedSize:a}=null!=n?n:{},u=new Headers;Qs(t.headers,function(t,e){u.append(e,t)}),s&&u.append("Content-Type",s);let h=null,c=!1;if(l){const e=new l;h={signal:e.signal,timeout:setTimeout(()=>{var i;c=!0,e.abort(an("AbortError","PostHog request timed out"+((i=t.timeout)?` after ${i}ms`:"")))},t.timeout)}}const d=e=>{var i;c&&"AbortError"===(null==e?void 0:e.name)||Lb(e)?Vs.warn(e):Vs.error(e),null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e})};let v=0;const f=()=>{Eb-=v,v=0,h&&clearTimeout(h.timeout)};try{const e=ue({method:(null==t?void 0:t.method)||"GET",headers:u,body:o,signal:null==h?void 0:h.signal},t.fetchOptions),n=null!=a?a:Te(o)?0:void 0;e.keepalive="POST"===e.method&&!t.ta&&!1!==e.keepalive&&e.body===o&&!Te(n)&&n>=0&&52428.8>Eb+n,e.keepalive&&(v=n,Eb+=v),r(i,e).then(e=>e.text().then(i=>{var n;const s={statusCode:e.status,text:i};if(200===e.status)try{s.json=JSON.parse(i)}catch(t){Vs.error(t)}f(),null===(n=t.callback)||void 0===n||n.call(t,s,Nb(()=>e.headers.get("Retry-After")))})).catch(t=>{f(),d(t)}).finally(f)}catch(t){f(),d(t)}},jb=t=>{try{var e;const{url:n,encodedBody:s}=Ob(t),{contentType:o,body:l,estimatedSize:a}=null!=s?s:{};if(!l)return;const u=l instanceof Blob?l:new Blob([l],{type:o});if(i.sendBeacon(n,u))return;const h=Se(t.data)?t.data:null===(e=t.data)||void 0===e?void 0:e.batch;if(Se(h)&&h.length>1&&(null!=a?a:0)>16384){const e=Math.ceil(h.length/2),i=e=>Se(t.data)?e:ue(ue({},t.data),{},{batch:e});return jb(ue(ue({},t),{},{data:i(h.slice(0,e))})),void jb(ue(ue({},t),{},{data:i(h.slice(e))}))}Vs.warn(`Beacon of ~${null!=a?a:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?Bb(ue(ue({},t),{},{ta:!0})):qb(t)}catch(t){Vs.warn("Beacon send failed",t)}},Hb=(t,e,i,n)=>{const s="query"===n?"POST"===e?"sent_at":"_":void 0;return Rb(i===hp.GZipJS?Mb(t,"compression"):t,ue(ue({},s?{[s]:Date.now().toString()}:{}),i===hp.GZipJS?{}:{compression:i}))},Ub=(()=>{const t=[];return r&&t.push({transport:"fetch",method:Bb}),o&&t.push({transport:"XHR",method:qb}),(null==i?void 0:i.sendBeacon)&&t.push({transport:"sendBeacon",method:jb}),t})();let zb=!Cb&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla"));function Wb(t,e,i){var n,s,r;i&&(e=ue(ue({},e),{},{callback:t=>i(t)})),t.__loaded?zb?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null===(s=e.callback)||void 0===s||s.call(e,{statusCode:429})):(e.transport=e.transport||t.config.api_transport,e.headers=ue(ue({},t.config.request_headers),e.headers),e.compression="best-available"===e.compression?null!==(n=t.compression)&&void 0!==n?n:e.compressionFallback:e.compression,(Te(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((t,e)=>{var i,n,s;const r=ue(ue({},t),{},{callback:null!=e?e:e=>{var i;return null===(i=t.callback)||void 0===i?void 0:i.call(t,e)}});r.timeout=r.timeout||6e4;const o=null!==(i=r.transport)&&void 0!==i?i:"fetch";"sendBeacon"===o&&Te(r.compression)&&r.data&&(r.compression=hp.Base64),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(t=>{var e,i;const n=(Se(t)?t:[t]).map(t=>ue(ue({},t),t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})),s=n[0];return{api_key:null!==(e=null==s||null===(i=s.properties)||void 0===i?void 0:i.token)&&void 0!==e?e:null==s?void 0:s.token,batch:n,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((t,e=(new Date).toISOString())=>Se(t)?t.map(t=>ue(ue({},t),{},{sent_at:e})):ue(ue({},t),{},{sent_at:e}))(r.data))),r.url=Hb(r.url,r.method,r.compression,r.timestampMode);const l=Ub.filter(t=>!r.disableTransport||!t.transport||!r.disableTransport.includes(t.transport)),u=null!==(n=null===(s=function(t,e){for(let i=0;t.length>i;i++)if(e(t[i]))return t[i]}(l,t=>t.transport===o))||void 0===s?void 0:s.method)&&void 0!==n?n:l[0].method;if(!u)throw new Error("No available transport method");const h=t=>{try{u(t)}catch(t){var e;Lb(t)?Vs.warn(t):Vs.error(t),null===(e=r.callback)||void 0===e||e.call(r,{statusCode:0,error:t})}};"sendBeacon"!==o&&r.data&&r.compression===hp.GZipJS&&a&&"undefined"!=typeof Promise&&!Ib?Fb(r).then(t=>{h(t)}).catch(e=>{if(hs(e))return Ib=!0,void h(ue(ue({},r),{},{compression:void 0,url:Hb(t.url,t.method,void 0,t.timestampMode)}));cs(e)&&(Ib=!0),h(r)}):u(r)})(e,(n,s)=>{var r,o,l;t.rateLimiter.checkForLimiting(n),400>n.statusCode||null===(r=(o=t.config).on_request_error)||void 0===r||r.call(o,n),i?i(n,s):null===(l=e.callback)||void 0===l||l.call(e,n)})):e.fireCallbackOnDrop&&(null===(r=e.callback)||void 0===r||r.call(e,{statusCode:0}))}var Vb=class{constructor(t,e){this.ea=!0,this.ia=[],this.na=Ze((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,Vs.createLogger("flush interval"),3e3),this.sa=t}enqueue(t){this.ia.push(t),this.ra||this.oa()}unload(){this.la();const t=this.ia.length>0?this.aa():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.ua(t,"sendBeacon")})}enable(){this.ea=!1,this.oa()}oa(){this.ea||(this.ra=setTimeout(()=>{if(this.la(),this.ia.length>0){const t=this.aa();for(const e in t)this.ua(t[e])}},this.na))}ua(t,e){try{this.sa(t,e)}catch(t){Vs.error(t)}}la(){clearTimeout(this.ra),this.ra=void 0}aa(){const t={};return Qs(this.ia,e=>{var i;const n=e,s=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");Te(t[s])&&(t[s]=ue(ue({},n),{},{data:[]})),null===(i=t[s].data)||void 0===i||i.push(n.data)}),this.ia=[],t}};const Gb=["retriesPerformedSoFar"];var Zb=class{constructor(t){this._instance=t,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}resume(){if(!Te(t)&&"onLine"in t.navigator){if(this.da=t.navigator.onLine,this.va)return;this.va=()=>{this.da=!0,this.fa()},this.pa=()=>{this.da=!1},nr(t,"online",this.va),nr(t,"offline",this.pa)}}get length(){return this.ia.length}retriableRequest(t,e){let{retriesPerformedSoFar:i}=t,n=ys(t,Gb);Oe(i)&&(n.url=Rb(n.url,{retry_count:i})),Wb(this._instance,e?ue(ue({},n),{},{transport:e}):n,(t,e)=>{var s;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=i?i:0))return void this.Ls(ue({retriesPerformedSoFar:i},n),e);0===t.statusCode&&Vs.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${null!=i?i:0} retries.`)}null===(s=n.callback)||void 0===s||s.call(n,t)})}Ls(t,e){const i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;const n=Math.max(function(t){const e=3e3*Math.pow(2,t),i=e/2,n=Math.min(18e5,e),s=(Math.random()-.5)*(n-i);return Math.ceil(n+s)}(i),null!=e?e:0),s=Date.now()+n;this.ia.push({retryAt:s,requestOptions:t});let r=`Enqueued failed request for retry in ${n}`;navigator.onLine||(r+=" (Browser is offline)"),Vs.warn(r),this.ha||(this.ha=!0,this.ga())}ga(){if(this.ma&&clearTimeout(this.ma),0===this.ia.length)return this.ha=!1,void(this.ma=void 0);this.ma=setTimeout(()=>{this.da&&this.ia.length>0&&this.fa(),this.ga()},this.ca)}fa(){const t=Date.now(),e=[],i=this.ia.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.ia=e,i.length>0)for(const{requestOptions:t}of i)this.retriableRequest(t)}unload(){this.ma&&(clearTimeout(this.ma),this.ma=void 0),this.ha=!1,Te(t)||(this.va&&(t.removeEventListener("online",this.va),this.va=void 0),this.pa&&(t.removeEventListener("offline",this.pa),this.pa=void 0));for(const{requestOptions:t}of this.ia)try{this._instance._send_request(ue(ue({},t),{},{transport:"sendBeacon"}))}catch(t){Vs.error(t)}this.ia=[]}},Qb=class{constructor(t){this._instance=t,this.ya=()=>{var t,e,i,n;this.ba||(this.ba={});const s=this.scrollElement(),r=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,l=r+((null==s?void 0:s.clientHeight)||0),a=(null==s?void 0:s.scrollHeight)||0;this.ba.lastScrollY=Math.ceil(r),this.ba.maxScrollY=Math.max(r,null!==(t=this.ba.maxScrollY)&&void 0!==t?t:0),this.ba.maxScrollHeight=Math.max(o,null!==(e=this.ba.maxScrollHeight)&&void 0!==e?e:0),this.ba.lastContentY=l,this.ba.maxContentY=Math.max(l,null!==(i=this.ba.maxContentY)&&void 0!==i?i:0),this.ba.maxContentHeight=Math.max(a,null!==(n=this.ba.maxContentHeight)&&void 0!==n?n:0)}}get _a(){return this._instance.config.scroll_root_selector}getContext(){return this.ba}resetContext(){const t=this.ba;return this.ba=void 0,setTimeout(this.ya,0),t}startMeasuringScrollPosition(){nr(t,"scroll",this.ya,{capture:!0}),nr(t,"scrollend",this.ya,{capture:!0}),nr(t,"resize",this.ya)}scrollElement(){if(this._a){const i=Se(this._a)?this._a:[this._a];for(const n of i){var e;const i=null==t||null===(e=t.document)||void 0===e?void 0:e.querySelector(n);if(i)return i}return}var i;return null==t||null===(i=t.document)||void 0===i?void 0:i.documentElement}wa(e){var i,n;const s="y"===e?"scrollTop":"scrollLeft";if(this._a){const t=this.scrollElement();return t&&t[s]||0}return t?"y"===e?t.scrollY||t.pageYOffset||(null===(i=t.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:t.scrollX||t.pageXOffset||(null===(n=t.document)||void 0===n||null===(n=n.documentElement)||void 0===n?void 0:n.scrollLeft)||0:0}scrollY(){return this.wa("y")}scrollX(){return this.wa("x")}};const Jb=t=>Da(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);var Kb=class{constructor(t,e,i,n){this.je=t=>{const e=this.ka();if(e&&e.sessionId===t)return;const i={sessionId:t,props:this.Sa(this._instance)};this.xa.register({[Tt]:i})},this._instance=t,this.Ca=e,this.xa=i,this.Sa=n||Jb,this.Ca.onSessionId(this.je)}ka(){return this.xa.props[Tt]}getSetOnceProps(){var t;const e=null===(t=this.ka())||void 0===t?void 0:t.props;return e?"r"in e?La(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){const t={};return Qs(Xs(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t[`$session_entry_${ye(i)}`]=e}),t}},Yb=class{on(t,e){return this.$a[t]||(this.$a[t]=[]),this.$a[t].push(e),()=>{this.$a[t]=this.$a[t].filter(t=>t!==e)}}emit(t,e){for(const i of this.$a[t]||[])i(e);for(const i of this.$a["*"]||[])i(t,e)}constructor(){this.$a={}}};const Xb=Gs("[SessionId]"),tw=864e5;var ew=class{on(t,e){return this.Ta.on(t,e)}constructor(t,e,i){var n;if(this.Ia=null,this.Ma=null,this.Ea=[],this.Pa=void 0,this.Ra=!1,this.Ta=new Yb,this.Aa=(t,e)=>!(!Oe(t)||!Oe(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=t.config,this.xa=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=e||Ml,this.Da=i||Ml;const s=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Ze(this.Mr.session_idle_timeout_seconds||1800,60,36e3,Xb.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.La(),this.Na="ph_"+s+"_window_id",this.qa="ph_"+s+"_primary_window_exists",this.ja()){const t=Kl.Dt(this.Na),e=Kl.Dt(this.qa);t&&!e?this.Be=t:Kl.Lt(this.Na),Kl.At(this.qa,!0)}(null===(n=this.Mr.bootstrap)||void 0===n?void 0:n.sessionID)&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Ba()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Te(this.Ea)&&(this.Ea=[]),this.Ea.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.Ea=this.Ea.filter(e=>e!==t)}}ja(){return"memory"!==this.Mr.persistence&&!this.xa.pi&&Kl.Et()}Ha(t){t!==this.Be&&(this.Be=t,this.ja()&&Kl.At(this.Na,t))}za(){return this.Be?this.Be:this.ja()?Kl.Dt(this.Na):null}Ua(t){const e=this.Ia;return!Me(e)&&!Me(t)&&5e3>Math.abs(t-e)}Wa(t,e,i){const n=e!==this._sessionActivityTimestamp,s=!(t!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Xt=t,s&&!n||s&&this.Ua(e)||(this.Ia=e,this.xa.register({[H]:[e,t,i]}))}Va(){var t;const e=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Oe(e)&&e>0}Ga(){this.Va()?this.xa.refreshKey(H):(this.xa.flush(),this.xa.load())}Za(){var t;if(Me(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ia)return;this.Ga();const[,e,i]=this.Qa();e===this.Xt&&i===this._sessionStartTimestamp&&(this.Ia=this._sessionActivityTimestamp,this.xa.register({[H]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.xa.flush())}Ja(){const[t]=this.Qa(),e=Oe(t)?t:0,i=Oe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Ka(t){return this.Ga(),this.Aa(t,this.Ja())}Qa(){const t=this.xa.props[H];return Se(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Xa),this.Xa=void 0,this.Wa(null,null,null)}setBootstrapSessionId(t,e=!1){const i=((t,e=(new Date).getTime())=>{try{const i=(t=>{const e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void Xb.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void Xb.error("Invalid sessionID in bootstrap",t)}})(t);return!Te(i)&&(e?this.Fa={sessionId:t,sessionStartTimestamp:i}:this.Wa(t,(new Date).getTime(),i),!0)}destroy(){this.Ra=!0,this.Za(),clearTimeout(this.Xa),this.Xa=void 0,this.Pa&&t&&(t.removeEventListener(Xt,this.Pa,{capture:!1}),this.Pa=void 0),this.Ea=[]}Ba(){this.Pa=()=>{this.Za(),this.ja()&&Kl.Lt(this.qa)},nr(t,Xt,this.Pa,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,e=null,i=!1){if("always"===this.Mr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const n=e||(new Date).getTime(),s=this.Xt;if(i)this.Ma=n;else if(Me(this.Ma)||this.Ma>n||n-this.Ma>=1e3){var r,o;null===(r=(o=this.xa).syncCookieProperties)||void 0===r||r.call(o),this.Ma=n}let[,l,a]=this.Qa();const u=!Te(s)&&l!==s,h=this.Ja();let c=this.za();const d=this.Fa,v=!!d&&(d.sessionStartTimestamp>n+6e4||n-d.sessionStartTimestamp>tw),f=d?v:Oe(a)&&Math.abs(n-a)>tw;let p=!1,g=u;const m=!l||!!d,y=l;let _=!m&&!t&&this.Aa(n,h);if(_&&(_=this.Ka(n),_||Xb.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,a]=this.Qa()),m||_||f){g=!1;const t=d&&!v;l=t?d.sessionId:this.Oa(),c=this.Da(),Xb.info("new session ID assigned",{sessionId:l,windowId:c,bootstrapped:!!t,changeReason:{noSessionId:m,activityTimeout:_,sessionPastMaximumLength:f}}),a=t?d.sessionStartTimestamp:n,this.Fa=void 0,p=!0}else c||(c=this.Da(),p=!0),g=g||l!==y,g&&(Xb.info("adopted cross-tab session id",{sessionId:l,windowId:c}),p=!0);const b=Oe(h)&&t&&!f?h:n,w=Oe(a)?a:(new Date).getTime();this.Ha(c),this.Wa(l,b,w),t||this.La();const k={noSessionId:m,activityTimeout:_,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.Ea.forEach(t=>t(l,c,k)),{sessionId:l,windowId:c,sessionStartTimestamp:w,changeReason:p?k:void 0,lastActivityTimestamp:h}}La(){this.Ra||(clearTimeout(this.Xa),this.Xa=setTimeout(()=>{if(!this.Ra)if(this.Ka((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.Ta.emit("forcedIdleReset",{idleSessionId:t})}else this.La()},1.1*this.sessionTimeoutMs))}};const iw=function(t,e){if(!t)return!1;const i=t.userAgent;if(i&&Ge(i,e))return!0;try{const i=null==t?void 0:t.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(t=>Ge(null==t?void 0:t.brand,e)))return!0}catch(t){}return!!t.webdriver};function nw(){return nw=re(function*(){const t=null==i?void 0:i.userAgentData;if(null==t?void 0:t.getHighEntropyValues)try{const e=yield t.getHighEntropyValues(["model"]),i=null==e?void 0:e.model;return Ee(i)&&i.length>0?i:void 0}catch(t){return void Vs.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}),nw.apply(this,arguments)}const sw="custom",rw="i.posthog.com",ow=/^\/static\//,lw=["/s/","/e/","/i/"];var aw=class{constructor(t){this.Ya={},this.instance=t}get apiHost(){const t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){const t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t;let e=null===(t=this.instance.config.ui_host)||void 0===t?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace(`.${rw}`,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Ya[this.apiHost]||(this.Ya[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":sw),this.Ya[this.apiHost]}tu(t){if(!ow.test(t))return;const e=this.instance.config.asset_host;return"string"==typeof e&&e.trim().replace(/\/$/,"")||void 0}eu(t){const e=lr(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}iu(t,e,i){if("ui"===t)return i;let n=i;const s=this.instance.config.rewriteRequestPath;if(s){var r;const t=(null===(r=lr(i))||void 0===r?void 0:r.href)||i;n=s(new URL(t)).toString()}if(s&&"api"===t&&lw.some(t=>0===e.indexOf(t))){const t=this.eu(n);if(t){const e=this.apiHost;let i=this.nu;(null==i?void 0:i.apiHost)===e&&i.rewriteRequestPath===s||(i={apiHost:e,rewriteRequestPath:s,urls:new Set},this.nu=i),i.urls.add(t)}}return n}isIngestionEndpoint(t){const e=this.nu,i=this.eu(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e=""){if(e&&(e="/"===e[0]?e:`/${e}`),"ui"===t)return this.iu(t,e,this.uiHost+e);if("flags"===t)return this.iu(t,e,this.flagsApiHost+e);if("assets"===t){const i=this.tu(e);if(i)return this.iu(t,e,`${i}${e}`)}if(this.region===sw)return this.iu(t,e,this.apiHost+e);const i=rw+e;switch(t){case"assets":return this.iu(t,e,`https://${this.region}-assets.${i}`);case"api":return this.iu(t,e,`https://${this.region}.${i}`)}}};const uw=Gs("[PostHog ExternalIntegrations]"),hw={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var cw=class{constructor(t){this._instance=t}No(t,e){var i,n;null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,t,t=>{if(t)return uw.error("failed to load script",t);e()})}startIfEnabledOrStop(){var t;for(const[s,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var e,i,n;r&&!(null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[s])&&this.No(hw[s],()=>{var t;null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[s])||void 0===t||t.start(this._instance)}),!r&&(null===(i=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())}}},dw=class{constructor(t,e){this.$=t,this.po=e,this.su=new Map,this.So=!1}add(t){var e=this;return re(function*(){if(e.So)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.su.has(t.name))throw new Error(`Browser extension "${t.name}" is already registered`);e.su.set(t.name,t);try{const i=t.setup(e.po);i&&(yield i)}catch(i){const n=e.su.get(t.name)===t;n&&e.su.delete(t.name),e.$.error(`Failed to set up browser extension "${t.name}"`,i),n&&e.ru(t)}})()}getExtension(t){return this.su.get(t)}dispose(){if(this.So)return;this.So=!0;const t=Array.from(this.su.values()).reverse();this.su.clear();for(const e of t)this.ru(e)}ru(t){try{var e;const i=null===(e=t.dispose)||void 0===e?void 0:e.call(t);i&&xe(i.then)&&i.then(void 0,e=>{this.$.error(`Failed to dispose browser extension "${t.name}"`,e)})}catch(e){this.$.error(`Failed to dispose browser extension "${t.name}"`,e)}}},vw=class{constructor(t){this._instance=t}initialize(){}get(t){const e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);const i={};for(const n of t){const t=null==e?void 0:e.get_property(n);Te(t)||(i[n]=t)}return i}set(t,e){var i;null===(i=this._instance.persistence)||void 0===i||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null===(e=this._instance.persistence)||void 0===e||e.unregister(t)}};const fw="extensionsRemoteConfig";var pw=class{constructor(t){this.instance=t,this.So=!1,this.$=Vs,this.ou=t.lu,this.kv=new vw(t),this.onEvent=t=>kp(this.instance.on("eventCaptured",e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.$.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.So)return kp(()=>{});const e=e=>{try{t(e)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},i=this.instance.au.on(fw,e);return this.ou&&e(this.ou),kp(i)},this.uu=new dw(Vs.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){const t=this.instance.get_property(p);return"string"==typeof t?t:void 0}get library(){return{name:Yl.LIB_NAME,version:Yl.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,n;const s=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(n=null==s?void 0:s.sessionStartTimestamp)&&void 0!==n?n:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.uu.add(t)}getExtension(t){return this.uu.getExtension(t)}capture(t,e,i){var n=this;return re(function*(){i?n.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):n.instance.capture(t,e)})()}registerDynamicEventProperties(t){return kp(this.instance.hu(t))}handleRemoteConfig(t){this.So||(this.ou=t,this.instance.au.emit(fw,t))}sendRequest(t){var e=this;return re(function*(t,i={}){var n;const s=e.instance.requestRouter.endpointFor(null!==(n=i.target)&&void 0!==n?n:"api",t),r={method:i.method,url:i.query?Rb(s,i.query):s,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?ce.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(e.instance._send_request(r),{statusCode:202}):new Promise(t=>{r.callback=t,e.instance._send_request(r)})}).apply(this,arguments)}dispose(){this.So||(this.So=!0,this.uu.dispose())}};const gw={};let mw=0;const yw=()=>{},_w='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',bw="Surveys module not available",ww="sanitize_properties is deprecated. Use before_send instead",kw="Invalid value for property_denylist config: ",Sw=/^[A-Za-z0-9_-]{1,400}$/,xw=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Cw=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,$w=["token","distinct_id",At],Tw="posthog",Ew=t=>{const e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},Iw=e=>{var i;return ue({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ir(null==n?void 0:n.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:yw,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&Ee(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null===(i=t.location)||void 0===i?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Vs.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Kt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:yw},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Or,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Ew(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(e))},Mw=[["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"]],Rw=t=>{const e={};for(const[i,n]of Mw)Te(t[i])||(e[n]=t[i]);const i=Js({},e,t),n=t.__preview_external_dependency_versioned_paths;return Te(n)||(Te(t.strict_script_versioning)&&(i.strict_script_versioning=!!n),Ee(n)&&Te(t.asset_host)&&(i.asset_host=n)),Se(t.property_blacklist)&&(Te(t.property_denylist)?i.property_denylist=t.property_blacklist:Se(t.property_denylist)?i.property_denylist=[...t.property_blacklist,...t.property_denylist]:Vs.error(kw+t.property_denylist)),i};var Pw=class{constructor(){this.__forceAllowLocalhost=!1}get cu(){return this.__forceAllowLocalhost}set cu(t){Vs.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Ow=class e{du(t){if(!t)return;const e=this.su.indexOf(t);-1!==e&&this.su.splice(e,1)}vu(t,e){var i;return this.du(t),this.su.push(e),null===(i=e.initialize)||void 0===i||i.call(e),e}fu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}pu(){if(this.gu)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.fu())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.mu)return;let e,i,n;t?(e=`persistence is set to '${this.config.persistence}'`,i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",n="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(e="persistence is disabled (disable_persistence is true)",i="on every page load",n="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.gu=!0,console.warn("[PostHog.js]",`${e} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${n}`)}yu(){if(this.fu()||"$posthog_cookieless"!==this.get_distinct_id())return;const t=this.persistence;if(!t)return;this.bu()||t.load(!0);const e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){const e=this.config.get_device_id(Ml());this.register({distinct_id:e,$device_id:e}),t.set_property($t,Qt)}this._u()}get decideEndpointWasHit(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.wu=!1,this.ku=!1,this.webPerformance=new Pw,this.Su=!1,this.version=Yl.LIB_VERSION,this.xu=new Set,this.Cu="",this.au=new Yb,this.su=[],this.$u=[],this.mu=!1,this.gu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Iw(),this.SentryIntegration=tb,this.sentryIntegration=t=>function(t,e){const i=X_(t,e);return{name:Y_,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tu=!1,this.Iu=null,this.Mu=null,this.Eu=null,this.scrollManager=new Qb(this),this.pageViewManager=new eb(this),this.rateLimiter=new kb(this),this.requestRouter=new aw(this),this.consent=new W_(this),this.externalIntegrations=new cw(this);const i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,e,i)=>{const n=Ee(t)?{[t]:e}:t;this.setPersonProperties(n),null==i||i({})},set_once:(t,e,i)=>{const n=Ee(t)?{[t]:e}:t;this.setPersonProperties(void 0,n),null==i||i({})}},this.on("eventCaptured",t=>Vs.info(`send "${null==t?void 0:t.event}"`,t))}init(t,i,n){if(n&&n!==Tw){var s;const r=null!==(s=gw[n])&&void 0!==s?s:new e;return r._init(t,i,n),gw[n]=r,gw[Tw][n]=r,r}return this._init(t,i,n)}_init(e,i={},n){var s,r,o;const l=Ee(e)?e.trim():"";if(!l)return Vs.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var a;if(this.__loaded)return l!==(null===(a=this.config)||void 0===a?void 0:a.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('${l}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Iw(i.defaults),i.debug=this.Pu(i.debug),this.Ru=i,this.Au=[],i.person_profiles?this.Mu=i.person_profiles:i.process_person&&(this.Mu=i.process_person);const u=Iw(i.defaults),h=Rw(i),c=Js({},u,h,{name:n,token:l});Ce(u.rageclick)&&Ce(h.rageclick)&&(c.rageclick=Js({},u.rageclick,h.rageclick)),Ce(u.session_recording)&&Ce(h.session_recording)&&(c.session_recording=Js({},u.session_recording,h.session_recording)),this.set_config(c),this.config.on_xhr_error&&Vs.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:hp.GZipJS;const d=this.bu();if(this.persistence=new yb(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new yb(ue(ue({},this.config),{},{persistence:"sessionStorage"}),d,!1),this.Cu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&Kl.Et()){const t=Kl.Dt(this.Cu);Se(t)&&t.forEach(t=>{Ee(t)&&this.xu.add(t)})}else Kl.Lt(this.Cu);const v=ue({},this.persistence.props),f=ue({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Fu=new Vb((t,e)=>this.Ou(t,e),this.config.request_queue_config),this.Du=new Zb(this),this.__request_queue=[];const p=this.fu();p||(this.sessionManager=new ew(this),this.sessionPropsManager=new Kb(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,e,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this.Lu()})),this.Nu(),this.config.__preview_deferred_init_extensions?(Vs.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.qu(p)},0)):(Vs.info("Initializing extensions synchronously"),this.qu(p)),Yl.DEBUG=Yl.DEBUG||this.config.debug,Yl.DEBUG&&Vs.info("Starting in debug mode",{this:this,config:i,thisC:ue({},this.config),p:v,s:f}),this.config.identity_distinct_id&&!(null===(s=i.bootstrap)||void 0===s?void 0:s.distinctID)&&(i.bootstrap=ue(ue({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const m=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this.mu=!!m&&!Ie(m),null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID){const t=i.bootstrap.distinctID,e=this.get_distinct_id(),n=this.persistence.get_property($t);if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"anonymous"===n)this.identify(t);else if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"identified"===n)Vs.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const e=this.config.get_device_id(Ml()),n=i.bootstrap.isIdentifiedID?e:t;this.persistence.set_property($t,i.bootstrap.isIdentifiedID?Jt:Qt),this.register({distinct_id:t,$device_id:n})}}if(p)this.register_once({distinct_id:Ot,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(Ml());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property($t,Qt)}return nr(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),nr(t,"pageshow",()=>{var t;this.wu=!1,this.ku||null===(t=this.Du)||void 0===t||t.resume()}),i.segment?K_(this,()=>this.ju()):this.ju(),xe(this.config._onCapture)&&this.config._onCapture!==yw&&(Vs.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Vs.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 nw.apply(this,arguments)}().then(t=>{t&&this.register({[g]:t})}).catch(yw),this}Bu(t){const e=t;return Ee(e.name)&&xe(e.setup)}Hu(t,e){this.Bu(t)?e.push(()=>{this.zu().add(t).catch(()=>{var e;return null===(e=t.dispose)||void 0===e?void 0:e.call(t)}).catch(e=>{Vs.error(`Failed to dispose browser extension "${t.name}"`,e)})}):this.su.push(t)}Nu(){var t,i,n;const s=null!==(t=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:null===(n=e.__defaultExtensionClasses)||void 0===n?void 0:n.featureFlags;var r,o,l;s&&(this.featureFlags&&this.featureFlags instanceof s||(null===(r=this.Uu)||void 0===r||r.call(this),this.Uu=void 0,this.featureFlags=new s(this)),xe(this.featureFlags.onReloading)&&xe(this.featureFlags.setup)?this.Uu||(this.Uu=this.featureFlags.onReloading(()=>{this.au.emit("featureFlagsReloading",!0)}),this.zu().add(this.featureFlags)):null===(o=(l=this.featureFlags).initialize)||void 0===o||o.call(l))}qu(t){const i=performance.now(),n=ue(ue({},e.__defaultExtensionClasses),this.config.__extensionClasses),s=[];var r,o,l,a,u,h,c;n.exceptions&&this.su.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new n.exceptions(this)),n.historyAutocapture&&this.su.push(this.historyAutocapture=new n.historyAutocapture(this)),n.tracingHeaders&&this.su.push(this.tracingHeaders=new n.tracingHeaders(this)),n.siteApps&&this.su.push(this.siteApps=new n.siteApps(this)),n.sessionRecording&&!t&&this.su.push(this.sessionRecording=new n.sessionRecording(this)),this.config.disable_scroll_properties||s.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),n.autocapture&&this.Hu(this.autocapture=new n.autocapture(this),s),n.surveys&&this.Hu(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new n.surveys(this),s),n.logs&&this.Hu(this.logs=null!==(l=this.logs)&&void 0!==l?l:new n.logs(this),s),n.metrics&&this.su.push(this.metrics=null!==(a=this.metrics)&&void 0!==a?a:new n.metrics(this)),n.conversations&&this.su.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new n.conversations(this)),n.productTours&&this.su.push(this.productTours=new n.productTours(this)),n.heatmaps&&this.su.push(this.heatmaps=new n.heatmaps(this)),n.webVitalsAutocapture&&this.su.push(this.webVitalsAutocapture=new n.webVitalsAutocapture(this)),n.exceptionObserver&&this.su.push(this.exceptionObserver=new n.exceptionObserver(this)),n.deadClicksAutocapture&&this.su.push(this.deadClicksAutocapture=new n.deadClicksAutocapture(this,Z_)),n.toolbar&&this.su.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new n.toolbar(this)),n.experiments&&this.su.push(this.experiments=null!==(c=this.experiments)&&void 0!==c?c:new n.experiments(this)),this.su.forEach(t=>{t.initialize&&s.push(()=>{var e;null===(e=t.initialize)||void 0===e||e.call(t)})}),s.push(()=>{if(this.Wu){const t=this.Wu;this.Wu=void 0,this.su.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}}),this.Vu(s,i)}Vu(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout(()=>{this.Vu(t,e)},0);const i=t.shift();if(i)try{i()}catch(t){Vs.error("Error initializing extension:",t)}}const i=Math.round(performance.now()-e);this.register_for_session({[Ft]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Dt]:i}),this.config.__preview_deferred_init_extensions&&Vs.info(`PostHog extensions initialized (${i}ms)`)}Kl(t){var e;if(!n||!n.body)return Vs.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Kl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Wu=t),this.lu=t,this.compression=void 0,t.ok){var i;const e=t.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=ge(e.supportedCompression,hp.GZipJS)?hp.GZipJS:ge(e.supportedCompression,hp.Base64)?hp.Base64:void 0),(null===(i=e.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=e.analytics.endpoint)}this.set_config({person_profiles:this.Mu?this.Mu:Kt}),null===(e=this.Gu)||void 0===e||e.handleRemoteConfig(t),this.su.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}ju(){try{this.config.loaded(this)}catch(t){Vs.critical("`loaded` function failed",t)}if(this.Zu(),this.config.internal_or_test_user_hostname&&(null==s?void 0:s.hostname)){const t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.fu())&&this.Qu()},1),this.Ju=new xb(this),this.Ju.load()}Zu(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.Fu)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Zs(this.__request_queue,t=>this.Ou(t)),this.__request_queue=[],this.Zu()}_handle_unload(){var t,e,i,n,s,r;this.wu=!0,null===(t=this.surveys)||void 0===t||null===(e=t.handlePageUnload)||void 0===e||e.call(t),null===(i=this.metrics)||void 0===i||i.flush("sendBeacon"),this.config.request_batching?(this.Ku()&&this.capture(ee),null===(n=this.logs)||void 0===n||n.flushLogs("sendBeacon"),null===(s=this.Fu)||void 0===s||s.unload(),null===(r=this.Du)||void 0===r||r.unload()):this.Ku()&&this.capture(ee,null,{transport:"sendBeacon"})}_send_request(t){Wb(this,t)}Ou(t,e){this.Du?this.Du.retriableRequest(t,e):this._send_request(e?ue(ue({},t),{},{transport:e}):t)}_execute_array(t){mw++;try{let e;const i=[],n=[],s=[];Zs(t,t=>{if(t)if(e=t[0],Se(e))s.push(t);else if(xe(t))try{t.call(this)}catch(e){Vs.error("Error executing queued PostHog call",t,e)}else Se(t)&&"alias"===e?i.push(t):Se(t)&&-1!==e.indexOf("capture")&&xe(this[e])?s.push(t):n.push(t)});const r=function(t,e){Zs(t,function(t){try{if(Se(t[0])){let i=e;Qs(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){Vs.error("Error executing queued PostHog call",t,e)}})};r(i,this),r(n,this),r(s,this)}finally{mw--}}push(t){if(mw>0&&Se(t)&&Ee(t[0])){const i=e.prototype[t[0]];return void(xe(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}get Xu(){return{property:_,persistenceKey:b,cookieName:"_fbc",pattern:xw,register:(t,e)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[b]:{value:t,delivered:e}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(b)}}}get Yu(){return{property:w,persistenceKey:k,cookieName:"_fbp",pattern:Cw,register:(t,e)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[k]:{value:t,delivered:e}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(k)}}}th(t){var e;const i=null===(e=this.persistence)||void 0===e?void 0:e.get_property(t.persistenceKey);return Ee(i)&&t.pattern.test(i)?{value:i,delivered:!1}:Ce(i)&&Ee(i.value)&&t.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}eh(t,e,i){return e===(null==i?void 0:i.value)?{value:e,pending:!i.delivered}:(t.register(e,!1),{value:e,pending:!0})}ih(t){if(!this.config.save_campaign_params||this.fu())return;const e=xl(t.cookieName);return Ee(e)&&t.pattern.test(e)?e:void 0}nh(t,e,i,n){if(!this.persistence)return;const s=this.Xu;this.persistence.refreshKey(s.persistenceKey);const r=this.th(s);if(n)return void s.unregister();if(i)return Ee(e)&&xw.test(e)?this.eh(s,e,r):void s.unregister();const o=Ee(t)&&Sw.test(t)?t:void 0,l=this.ih(s);return l&&((t,e,i)=>{const n=t.split(".");if(e)return n[3]===e;if(!i)return!0;const s=i.value.split(".");return n[3]===s[3]||Number(n[2])>Number(s[2])})(l,o,r)?this.eh(s,l,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this.eh(s,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}sh(t,e,i){if(!this.persistence)return;const n=this.Yu;this.persistence.refreshKey(n.persistenceKey);const s=this.th(n);if(i)return void n.unregister();if(e)return Ee(t)&&Cw.test(t)?this.eh(n,t,s):void n.unregister();const r=this.ih(n);return r?this.eh(n,r,s):s?{value:s.value,pending:!s.delivered}:void 0}rh(t,e){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const i=this.th(t);(null==i?void 0:i.value)!==e||i.delivered||t.register(e,!0)}capture(t,e,i){var n,s;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu))return void Vs.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Te(t)||!Ee(t))return void Vs.error("No event name provided to posthog.capture");this.yu();const r=!this.config.opt_out_useragent_filter&&this._is_bot();if(r&&!this.config.__preview_capture_bot_pageviews)return;const o=(null==i?void 0:i.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==o?void 0:o.isRateLimited)return void Vs.critical("This capture call is ignored due to client rate limiting.");let l;(null==e?void 0:e.$current_url)&&!Ee(null==e?void 0:e.$current_url)&&(Vs.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||(null==i?void 0:i.oh)||Vs.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&&(l=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 a=new Date,u=(null==i?void 0:i.timestamp)||a,h=ln(null==i?void 0:i.uuid,Ml);let c={uuid:h,event:t,properties:this.calculateEventProperties(t,e||{},u,h)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&r&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),o&&(c.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens);const d="$feature_flag_called"===t&&!1===c.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!d&&(c.$set=null==i?void 0:i.$set);const v=Ce(null==e?void 0:e.$set)?e.$set:void 0,f=Se(null==e?void 0:e.$unset)?e.$unset:[],p=(null==i?void 0:i.$unset)||[],g=t=>{var e;const n=!!(null==i?void 0:i.$set)&&t in i.$set;return{hasProvided:n||!!v&&t in v,provided:n?null==i||null===(e=i.$set)||void 0===e?void 0:e[t]:null==v?void 0:v[t],unset:-1!==f.indexOf(t)||-1!==p.indexOf(t)}},m=g(_),y=g(w),b=[{channel:this.Xu,hasProvided:m.hasProvided,update:this.nh(null==l?void 0:l.fbclid,m.provided,m.hasProvided,m.unset)},{channel:this.Yu,hasProvided:y.hasProvided,update:this.sh(y.provided,y.hasProvided,y.unset)}];for(const{channel:t,hasProvided:e,update:i}of b)i&&!0===c.properties.$process_person_profile&&i.pending&&!e&&!d&&(c.$set=ue({[t.property]:i.value},c.$set));const k=null==i?void 0:i.$unset;k&&(c.$unset=k);const S=d?void 0:this.ah(null==i?void 0:i.$set_once,t!==ne,t===ie);if(S&&(c.$set_once=S),(null==i?void 0:i._noTruncate)||(x=this.config.properties_string_max_length,c=function(t,e){const i=new Set;return function t(n,s){if(n!==Object(n))return e?e(n):n;if(i.has(n))return;let r;if(i.add(n),Se(n))r=[],Zs(n,e=>{r.push(t(e))});else{const e={};Qs(Be(n)?tr(n):n,(n,s)=>{i.has(n)||(e[s]=t(n,s))}),r=e}return r}(t)}(c,t=>Ee(t)?t.slice(0,x):t)),c.timestamp=u,Te(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=a),d&&(c.properties=((t,e=[])=>{const i={},n=e=>{void 0!==t[e]&&(i[e]=t[e])};return os.forEach(n),e.forEach(n),i})(c.properties,$w)),t===_p.DISMISSED||t===_p.SENT){const i=null==e?void 0:e[bp.SURVEY_ID],n=null==e?void 0:e[bp.SURVEY_ITERATION];Mp({id:i,current_iteration:n}),c.$set=ue(ue({},c.$set),{},{[ra({id:i,current_iteration:n},t===_p.SENT?"responded":"dismissed")]:!0})}else t===_p.SHOWN&&(c.$set=ue(ue({},c.$set),{},{[bp.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var x;if(t===_b.SHOWN){const t=null==e?void 0:e[bb.TOUR_TYPE];t&&(c.$set=ue(ue({},c.$set),{},{[`${bb.TOUR_LAST_SEEN_DATE}/${t}`]:(new Date).toISOString()}))}const C=ue(ue({},c.properties.$set),c.$set);if($e(C)||this.setPersonPropertiesForFlags(C),!Re(this.config.before_send)){const t=this.Os(c);if(!t)return;c=t,c.uuid=ln(c.uuid,Ml)}const T=b.filter(({channel:t,update:e})=>{var i,n,s;const r=null!==(i=null===(n=c.$set)||void 0===n?void 0:n[t.property])&&void 0!==i?i:Ce(null===(s=c.properties)||void 0===s?void 0:s.$set)?c.properties.$set[t.property]:void 0;return(null==e?void 0:e.pending)&&r===e.value});this.au.emit("eventCaptured",c);const E=null!==(n=null==i?void 0:i._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),I="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(E),M=ue(ue(ue({method:"POST",url:E,data:c,compression:"best-available",timestampMode:I?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},I&&(null===(s=c.properties)||void 0===s?void 0:s.$session_id)?{batchGroup:c.properties.$session_id+(c.properties.$window_id?`-${c.properties.$window_id}`:"")}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),T.length?{fireCallbackOnDrop:!0,callback:t=>{if(t.statusCode>=200&&300>t.statusCode)for(const{channel:t,update:e}of T)this.rh(t,e.value)}}:{});if(!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)||T.length){var R;let t;!M.transport&&!M.callback&&$e(null!==(R=this.config.request_headers)&&void 0!==R?R:{})&&this.wu&&(t="sendBeacon"),this.Ou(M,t)}else this.Fu.enqueue(M);return c}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null===(e=this.Gu)||void 0===e?void 0:e.getExtension(t)}zu(){var t;return null!==(t=this.Gu)&&void 0!==t?t:this.Gu=new pw(this)}hu(t){this.$u.push(t);let e=!0;return()=>{if(!e)return;e=!1;const i=this.$u.indexOf(t);-1!==i&&this.$u.splice(i,1)}}uh(t=!0){var e,i,n;return!!(null===(e=this.persistence)||void 0===e?void 0:e.consumeCookieIdentityChange())&&(this.Eu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(n=this.sessionPersistence)||void 0===n||n.clear(),this.xu.clear(),this.hh()),null===(i=this.featureFlags)||void 0===i||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,r,o,l){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.uh();const a=l?void 0:this.persistence.remove_event_timer(e);let h=ue({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.fu()&&(h[At]=!0),"$snapshot"===e){const t=ue(ue({},this.persistence.properties()),this.sessionPersistence.properties());return h.distinct_id=t.distinct_id,(!Ee(h.distinct_id)&&!Pe(h.distinct_id)||Ie(h.distinct_id))&&Vs.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}const c=function(e,i,n,r=!1){var o,l,a,h;if(!u)return{};const c=e?[...Ca,...i||[]]:[],[d,v]=Zi(u),[f,p]=function(t){for(let e=0;Yi.length>e;e++){const[i,n,s]=Yi[e],r=t.match(i);if(r){const e=s&&t.match(s)||r;return[n,(null==e?void 0:e[1])||""]}}return["",""]}(u),g=function(){const t="u">typeof navigator?navigator:void 0;return(null==t?void 0:t.brave)?{brave:!0}:{}}(),m={};Te(n)||(m.detectGoogleSearchApp=n);const y={},_=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,b=null===(l=navigator)||void 0===l?void 0:l.maxTouchPoints,w=null==t||null===(a=t.screen)||void 0===a?void 0:a.width,k=null==t||null===(h=t.screen)||void 0===h?void 0:h.height,S=null==t?void 0:t.devicePixelRatio;Te(_)||(y.userAgentDataPlatform=_),Te(b)||(y.maxTouchPoints=b),Te(w)||(y.screenWidth=w),Te(k)||(y.screenHeight=k),Te(S)||(y.devicePixelRatio=S);const x=Js(Xs({$os:d,$os_version:v,$browser:zi(u,navigator.vendor,g,m),$webview_app:f,$webview_app_version:p,$device:Qi(u),$device_type:Ji(u,y),$timezone:Na(),$timezone_offset:qa()}),{$current_url:hr(r?un(null==s?void 0:s.href):null==s?void 0:s.href,c,Ta),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:Vi(u,navigator.vendor,g,m),$browser_language:Pa(),$browser_language_prefix:Oa(),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:zs.LIB_NAME,$lib_version:zs.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return zs.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=zs.SDK_DIST_CHANNEL),x}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:t,windowId:e}=this.sessionManager.checkAndGetSessionAndWindowId(l,r.getTime(),!0);h.$session_id=t,h.$window_id=e}this.sessionPropsManager&&Js(h,this.sessionPropsManager.getSessionProps());try{var d;this.sessionRecording&&Js(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null===(d=this.Du)||void 0===d?void 0:d.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}let v;if(this.requestRouter.region===sw&&(h.$lib_custom_api_host=this.config.api_host),v="$pageview"!==e||l?"$pageleave"!==e||l?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),h=Js(h,v),"$pageview"===e&&n&&(h.title=n.title),!Te(a)){const t=r.getTime()-a;h.$duration=parseFloat((t/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");const f=this.persistence.properties(),p=this.sessionPersistence.properties(),g=h.$groups,m=f.$groups;Ce(g)&&!$e(g)&&(h.$groups=ue(ue({},Ce(m)?m:{}),g)),Qs(["$referrer","$referring_domain"],t=>{t in f&&delete p[t]});const y={};if(this.$u.length>0)for(const t of this.$u.slice())try{Js(y,t())}catch(t){Vs.error("Failed to produce browser extension event properties",t)}h=Js({},c,f,p,ue(ue({},y),h)),h.$is_identified=this._isIdentified(),Se(this.config.property_denylist)?Qs(this.config.property_denylist,function(t){delete h[t]}):Vs.error(kw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const _=this.config.sanitize_properties;_&&(Vs.error(ww),h=_(h,e));const b=this.dh();return h.$process_person_profile=b,b&&!l&&this.fh("_calculate_event_properties"),h}ah(t,e=!0,i=!1){var n;if(!this.persistence||!this.dh())return t;if(this.Su&&!i)return t;const s=this.persistence.get_initial_props(),r=null===(n=this.sessionPropsManager)||void 0===n?void 0:n.getSetOnceProps();let o=Js({},s,r||{},t||{});const l=this.config.sanitize_properties;return l&&(Vs.error(ww),o=l(o,"$set_once")),e&&(this.Su=!0),$e(o)?void 0:o}register(t,e){var i;null===(i=this.persistence)||void 0===i||i.register(t,e)}register_once(t,e,i){var n;null===(n=this.persistence)||void 0===n||n.register_once(t,e,i)}register_for_session(t){var e,i;null===(e=this.persistence)||void 0===e||e.syncCookieProperties(),this.uh(),null===(i=this.sessionPersistence)||void 0===i||i.register(t),Object.keys(t).forEach(t=>this.xu.add(t)),this.hh()}unregister(t){var e;null===(e=this.persistence)||void 0===e||e.unregister(t)}unregister_for_session(t){var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t),this.xu.delete(t),this.hh()}ph(t,e){this.register({[t]:e})}Lu(){this.xu.forEach(t=>{var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t)}),this.xu.clear(),this.hh()}hh(){var t;if(!this.Cu)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.pi)||!Kl.Et())return void Kl.Lt(this.Cu);const e=[];this.xu.forEach(t=>e.push(t)),e.length>0?Kl.At(this.Cu,e):Kl.Lt(this.Cu)}getFeatureFlag(t,e){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,n;return null!==(i=null===(n=this.featureFlags)||void 0===n?void 0:n.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null===(t=this.featureFlags)||void 0===t||t.reloadFeatureFlags()}updateFlags(t,e,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e=!1,i){var n;return null===(n=this.featureFlags)||void 0===n?void 0:n.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.au.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:bw}),()=>{})}onSessionId(t){var e,i;return null!==(e=null===(i=this.sessionManager)||void 0===i?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e=!1){this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:bw})}getActiveMatchingSurveys(t,e=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:bw})}renderSurvey(t,e){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(t,e)}displaySurvey(t,e=Pp){var i;null===(i=this.surveys)||void 0===i||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null===(e=this.surveys)||void 0===e||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null===(i=this.surveys)||void 0===i?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:bw}}canRenderSurveyAsync(t,e=!1){var i,n;return null!==(i=null===(n=this.surveys)||void 0===n?void 0:n.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:bw})}gh(t){return!t||Ie(t)?(Vs.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Vs.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Vs.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return Vs.uninitializedWarning("posthog.identify");if(Pe(t)&&(t=t.toString(),Vs.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.gh(t))return;if(!this.fh("posthog.identify"))return;this.yu();const n=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,r=this.uh(!1),o=this.persistence.Pl();let l=!1;try{const n=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:n},""),t!==n&&t!==this.get_property("__alias")&&(this.unregister(m),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Qt,u=t!==n,h=!u&&o;if(u&&o){var a;const s=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:n};this.persistence.set_property($t,Jt),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$identify",s,{$set:e||{},$set_once:i||{}})&&(this.Eu=ma(t,e,i)),null===(a=this.featureFlags)||void 0===a||a.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:n)}else if(h){this.persistence.set_property($t,Jt);const n=e||{},s=i||{};this.setPersonPropertiesForFlags({$set:n,$set_once:s},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$set",{$set:n,$set_once:s})&&(this.Eu=ma(t,e,i))}else(e||i)&&this.setPersonProperties(e,i);u||s||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(kt)):h&&(e||i)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Ol(l)}}setPersonProperties(t,e){if(!t&&!e)return;if(!this.fh("posthog.setPersonProperties"))return;const i=ma(this.get_distinct_id(),t,e);this.Eu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}})&&(this.Eu=i)):Vs.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var e;const i=(Se(t)?t:[t]).filter(t=>Ee(t)&&t.length>0);0!==i.length&&this.fh("posthog.unsetPersonProperties")&&(null===(e=this.featureFlags)||void 0===e||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Eu=null)}group(t,e,i){var n;if(!t||!e)return void Vs.error("posthog.group requires a group type and group key");null===(n=this.persistence)||void 0===n||n.syncCookieProperties(),this.uh();const s=this.getGroups(),r=s[t]!==e;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ue(ue({},s),{},{[t]:e})}),(r||i)&&this.dh()){const n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(ne,n)}i&&this.setGroupPropertiesForFlags({[t]:i}),r&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e=!0){var i;null===(i=this.featureFlags)||void 0===i||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t=!0){var e;null===(e=this.featureFlags)||void 0===e||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e=!0){var i;this.fh("posthog.setGroupPropertiesForFlags")&&(null===(i=this.featureFlags)||void 0===i||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null===(e=this.featureFlags)||void 0===e||e.resetGroupPropertiesForFlags(t)}reset(t){const e=Ae(t)?t:null==t?void 0:t.resetDeviceID,i=Ae(t)||null==t?void 0:t.bootstrap;this.mh(e,!1,i)}mh(t,e=!1,i){var n,s,r,o,l,a;if(Vs.info("reset"),!this.__loaded)return Vs.uninitializedWarning("posthog.reset");const u=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(n=this.Ru)||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.Xl());const h=this.get_property(p),c=this.get_property(g),d=this.get_property(F);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();this.consent.reset(),e||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const f=null===(l=this.persistence)||void 0===l||null===(a=l.Pl)||void 0===a?void 0:a.call(l);let m=!1;try{var y,_,b,w,k,S,x,C,T,E,I,M,R;if(null===(y=this.persistence)||void 0===y||y.clear(),null===(_=this.sessionPersistence)||void 0===_||_.clear(),this.xu.clear(),this.hh(),Te(d)||null===(E=this.persistence)||void 0===E||E.register({$session_recording_remote_config:d}),null===(b=this.surveys)||void 0===b||b.reset(),null===(w=this.featureFlags)||void 0===w||w.reset(),null===(k=this.conversations)||void 0===k||k.reset(),null===(S=this.logs)||void 0===S||S.reset(),null===(x=this.metrics)||void 0===x||x.reset(),null===(C=this.persistence)||void 0===C||C.set_property("$user_state","anonymous"),null===(T=this.sessionManager)||void 0===T||T.resetSessionId(),this.Eu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Ot,$device_id:null},"");else{const e=this.config.get_device_id(Ml());this.register_once({distinct_id:e,$device_id:t?e:h},""),t||Te(c)||this.register({[g]:c})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(i.distinctID&&!this.fu()&&(null===(R=this.persistence)||void 0===R||R.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(I=this.featureFlags)||void 0===I||I.initialize(),!Re(u)&&!(null===(M=this.sessionManager)||void 0===M?void 0:M.setBootstrapSessionId(u,!0))){const t=ue({},i);delete t.sessionID,this.config.bootstrap=t}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,m=!0}finally{var P,O;f&&(null===(P=this.persistence)||void 0===P||null===(O=P.Ol)||void 0===O||O.call(P,m))}this.reloadFeatureFlags()}shutdown(t){var e=this;return re(function*(){var t,i,n,s,r,o,l,a;if(e.__loaded){e.ku=!0,e.zu().dispose(),null===(t=e.sessionRecording)||void 0===t||t.dispose(),null===(i=e.logs)||void 0===i||i.flushLogs("sendBeacon"),null===(n=e.metrics)||void 0===n||n.flush("sendBeacon"),null===(s=e.metrics)||void 0===s||s.dispose(),null===(r=e.Fu)||void 0===r||r.unload(),null===(o=e.Du)||void 0===o||o.unload();try{var u;null===(u=e.featureFlags)||void 0===u||u.destroy()}catch(t){Vs.error("Error while destroying feature flags",t)}null===(l=e.persistence)||void 0===l||l.destroy(),null===(a=e.sessionPersistence)||void 0===a||a.destroy()}else Vs.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,e){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null===(i=this.conversations)||void 0===i||i.yh()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(t=this.conversations)||void 0===t||t.bh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null===(e=this.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:e,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let n=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${e}`);if((null==t?void 0:t.withTimestamp)&&i){var s;const e=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return n;n+=`?t=${Math.max(Math.floor(((new Date).getTime()-i)/1e3)-e,0)}`}return n}alias(t,e){return t===this.get_property("$people_distinct_id")?(Vs.critical("Attempting to create alias for existing People user - aborting."),-2):this.fh("posthog.alias")?(Te(e)&&(e=this.get_distinct_id()),t!==e?(this.ph(m,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Vs.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const e=ue({},this.config);if(Ce(t)){var i,n,s,r,o,l,a,u,h,c,d,v,f,p;Js(this.config,Rw(t));const m=this.bu();null===(i=this.persistence)||void 0===i||i.update_config(this.config,e,m),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new yb(ue(ue({},this.config),{},{persistence:"sessionStorage"}),m,!1);const y=this.Pu(this.config.debug);var g;Ae(y)&&(this.config.debug=y),Ae(this.config.debug)&&(this.config.debug?(Yl.DEBUG=!0,Ll.Et()&&Ll.At("ph_debug",!0),Vs.info("set_config",{config:t,oldConfig:e,newConfig:ue({},this.config)})):(Yl.DEBUG=!1,Ll.Et()&&Ll.Lt("ph_debug"))),null===(n=this.featureFlags)||void 0===n||null===(s=n.updateConfig)||void 0===s||s.call(n,this.config,this.Xl()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(l=this.metrics)||void 0===l||l.onConfigChange(),null===(a=this.sessionRecording)||void 0===a||a.startIfEnabledOrStop(),null===(u=this.tracingHeaders)||void 0===u||u.startIfEnabledOrStop(),null===(h=this.autocapture)||void 0===h||h.startIfEnabled(),null===(c=this.heatmaps)||void 0===c||c.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(g=this.historyAutocapture)||void 0===g||g.startIfEnabledOrStop()),null===(d=this.exceptionObserver)||void 0===d||d.startIfEnabledOrStop(),null===(v=this.deadClicksAutocapture)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.surveys)||void 0===f||f.loadIfEnabled(),this._u(),null===(p=this.externalIntegrations)||void 0===p||p.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&K_(this,yw,!1)}}_overrideSDKInfo(t,e){Yl.LIB_NAME=t,Yl.LIB_VERSION=e}startSessionRecording(t){const e=!0===t,i={sampling:e||!!(null==t?void 0:t.sampling),linked_flag:e||!!(null==t?void 0:t.linked_flag),url_trigger:e||!!(null==t?void 0:t.url_trigger),event_trigger:e||!!(null==t?void 0:t.event_trigger)};var n,s,r,o,l;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===(l=this.sessionRecording)||void 0===l||l.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(null===(t=this.sessionRecording)||void 0===t?void 0:t.started)}captureException(t,e){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(ue(ue({},i),e))}catch(t){return}}addExceptionStep(t,e){var i;null===(i=this.exceptions)||void 0===i||i.addExceptionStep(t,e)}captureLog(t){var e;null===(e=this.logs)||void 0===e||e.captureLog(t)}get logger(){var t,i;return null!==(t=null===(i=this.logs)||void 0===i?void 0:i.logger)&&void 0!==t?t:e._h}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null===(i=this.toolbar)||void 0===i?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null===(e=this.persistence)||void 0===e?void 0:e.props[t]}getSessionProperty(t){var e;return null===(e=this.sessionPersistence)||void 0===e?void 0:e.props[t]}toString(){var t;let e=null!==(t=this.config.name)&&void 0!==t?t:Tw;return e!==Tw&&(e="posthog."+e),e}_isIdentified(){var t,e;return"identified"===(null===(t=this.persistence)||void 0===t?void 0:t.get_property("$user_state"))||"identified"===(null===(e=this.sessionPersistence)||void 0===e?void 0:e.get_property("$user_state"))}dh(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&$e(this.getGroups())&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.__alias)&&!(null===(e=this.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.$epp))}Ku(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.dh()||this.fh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.fh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}fh(t){return"never"===this.config.person_profiles?(Vs.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ph(Pt,!0),!0)}bu(){if("always"===this.config.cookieless_mode)return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_u(){var t,e;const i=this.bu();var n,s,r;return this.is_capturing()||null===(n=this.logs)||void 0===n||n.wh(),(null===(t=this.persistence)||void 0===t?void 0:t.pi)!==i&&(null===(s=this.persistence)||void 0===s||s.set_disabled(i)),(null===(e=this.sessionPersistence)||void 0===e?void 0:e.pi)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),i&&(this.xu.clear(),this.hh()),i}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){if(this.fu()){var n,s,r,o,l,a;null===(n=this.sessionRecording)||void 0===n||n.dispose({discardBufferedEvents:!0}),this.mh(!0,!0),null===(s=this.sessionManager)||void 0===s||s.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new ew(this),this.pageViewManager=new eb(this),this.persistence&&(this.sessionPropsManager=new Kb(this,this.sessionManager,this.persistence));const t=null!==(o=null===(l=this.config.__extensionClasses)||void 0===l?void 0:l.sessionRecording)&&void 0!==o?o:null===(a=e.__defaultExtensionClasses)||void 0===a?void 0:a.sessionRecording;var u,h;t&&(this.sessionRecording=this.vu(this.sessionRecording,new t(this)),this.lu&&(null===(u=this.sessionRecording)||void 0===u||null===(h=u.onRemoteConfig)||void 0===h||h.call(u,this.lu)))}var c,d;this.consent.optInOut(!0),this._u(),this.Zu(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(c=this.surveys)||void 0===c||c.loadIfEnabled()),(Te(null==t?void 0:t.captureEventName)||(null==t?void 0:t.captureEventName))&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Qu()}else Vs.warn(_w)}opt_out_capturing(){if("always"===this.config.cookieless_mode)return void Vs.warn(_w);const t="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;var e,i;null==t||t.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.mh(!0,!0),this.consent.optInOut(!1),this._u(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Ot,$device_id:null}),this.du(t),this.sessionRecording=void 0,null===(e=this.sessionManager)||void 0===e||e.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Qu(),this.Zu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._u()}_is_bot(){return i?iw(i,this.config.custom_blocked_useragents):void 0}Qu(){n&&("visible"===n.visibilityState?this.Tu||(this.Tu=!0,this.capture(te,{title:n.title},{send_instantly:!0}),this.Iu&&(n.removeEventListener(Yt,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),nr(n,Yt,this.Iu)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Xl(){const t=this.Ru||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Vs.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,e,i,n,s){const r=e in t&&!Re(t[e]),o=i in t&&!Re(t[i]);return r?t[e]:!!o&&(s&&s.warn(`Config field '${i}' is deprecated. Please use '${e}' instead. The old field will be removed in a future major version.`),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,Vs)}Os(t){var e;if(Re(this.config.before_send))return t;const i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(Le),n=Se(this.config.before_send)?this.config.before_send:[this.config.before_send];let s=t;for(const e of n)try{if(s=e(s),Re(s)){const e=`Event '${t.event}' was rejected in beforeSend function`;return De(t.event)?Vs.warn(`${e}. This can cause unexpected behavior.`):Vs.info(e),null}s.properties&&!$e(s.properties)||Vs.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(e){return Vs.error(`Error in beforeSend function for event '${t.event}':`,e),null}for(const e of i)if(s.properties&&Re(s.properties[e]))return Vs.warn(`Event '${t.event}' had its '${e}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return s}getPageViewId(){var t;return null===(t=this.pageViewManager.Bo)||void 0===t?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Pu(t){const e=Ae(t)&&!t,i=Ll.Et()&&"true"===Ll.Ot("ph_debug");return!e&&(!!i||t)}};Ow.__defaultExtensionClasses={},Ow._h=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(let i=0;e.length>i;i++)t.prototype[e[i]]=Ys(t.prototype[e[i]])}(Ow,["identify"]);var Aw=class{constructor(t){this._instance=t}refresh(t){const e=this._instance.config,i=Ce(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.Xl(),t.url_allowlist=null==i?void 0:i.url_allowlist,t.url_ignorelist=null==i?void 0:i.url_ignorelist,t.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,t.element_allowlist=null==i?void 0:i.element_allowlist,t.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,t.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,t.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,t.capture_copied_text=null==i?void 0:i.capture_copied_text}};const Fw=Gs("[ExceptionAutocapture]"),Dw=Gs("[TracingHeaders]"),Lw=Gs("[Web Vitals]"),Nw=9e5,qw=["CLS","FCP","INP","LCP"],Bw=["INP","LCP"],jw=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Hw=Gs("[SessionRecording]"),Uw=Gs("[Heatmaps]");function zw(t){return Ce(t)&&"clientX"in t&&"clientY"in t&&Pe(t.clientX)&&Pe(t.clientY)}const Ww=Gs("[Product Tours]"),Vw=t=>{var e;return!t.config.disable_product_tours&&!!(null===(e=t.persistence)||void 0===e?void 0:e.get_property(P))},Gw=["$set_once","$set"],Zw=Gs("[SiteApps]"),Qw="Error while initializing PostHog app with config id ",Jw=(t,e)=>(null==t?void 0:t.then)?t.then(e):e(t),Kw="SDK is not enabled or survey functionality is not yet loaded",Yw="Disabled. Not loading surveys.";var Xw=class{constructor(t,e){this.yo=t,this.kh=e,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Sh=!1,this.xh=[],this.Ch=null,this.$h=null,this.So=!1,this.Th=new Set,this.onRemoteConfig=t=>{if(this.So)return;if(this.Mr.disableSurveys)return;if(!t.ok)return Sp.warn("Remote config unavailable. Not loading surveys.");const e=t.config.surveys;if(Re(e))return Sp.warn("Flags not loaded yet. Not loading surveys.");this.Ih=Ae(e)?e:e.length>0,Sp.info(`flags response received, isSurveysEnabled: ${this.Ih}`),this.loadIfEnabled()}}setup(t){if(!this.So)return this.Mh=t,Jw(t.kv.initialize(),()=>{if(this.Mh!==t||this.So)return;this.Mh=void 0,this.po=t;const e=t.onRemoteConfig(this.onRemoteConfig);this.So?e.dispose():(this.$o=e,this.loadIfEnabled())})}dispose(){var t,e,i,n;this.So||(this.So=!0,this.Mh=void 0,this.po=void 0,null===(t=this.$o)||void 0===t||t.dispose(),this.$o=void 0,null===(e=this._surveyEventReceiver)||void 0===e||e.dispose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(n=i.dispose)||void 0===n||n.call(i),this._surveyManager=null,this.xh=[],this.Ch=null,this.Th.forEach(t=>clearTimeout(t)),this.Th.clear())}get Mr(){return this.yo.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null===(t=this._surveyEventReceiver)||void 0===t||t.reset(),localStorage.removeItem("lastSeenSurveyDate");const 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(t=>localStorage.removeItem(t))}catch(t){}}loadIfEnabled(){if(this.So||!this.po)return;const t=this.Mr;if(this._surveyManager)return;if(this.Sh)return void Sp.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Sp.info(Yw);if(t.cookielessMode&&this.yo.isOptedOut())return void Sp.info("Not loading surveys in cookieless mode without consent.");const e=this.yo.getExtensions();if(!e)return void Sp.error("PostHog Extensions not found.");if(Te(this.Ih)&&!t.advancedEnableSurveys)return;const i=this.Ih||t.advancedEnableSurveys;this.Sh=!0;try{const t=e.generateSurveys;if(t)return this.Eh(t,i),void(this.Sh=!1);const n=e.loadExternalDependency;if(!n)return this.Ph(Zt),void(this.Sh=!1);n(t=>{try{if(this.So)return;const e=this.yo.getExtensions();t||!(null==e?void 0:e.generateSurveys)?this.Ph("Could not load surveys script",t):this.Eh(e.generateSurveys,i)}finally{this.Sh=!1}})}catch(t){throw this.Sh=!1,this.Ph("Error initializing surveys",t),t}}Eh(t,e){this.So||(this._surveyManager=t(e),this._surveyEventReceiver=this.yo.createEventReceiver(),Sp.info("Surveys loaded successfully"),this.Rh({isLoaded:!0}))}Ph(t,e){Sp.error(t,e),this.Rh({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.xh.push(t),this._surveyManager&&this.Rh({isLoaded:!0}),()=>{this.xh=this.xh.filter(e=>e!==t)}}getSurveys(t,e=!1){var i;const n=null!==(i=this.po)&&void 0!==i?i:this.kh;if(!n||this.So)return;if(this.Mr.disableSurveys)return Sp.info(Yw),t([]);const s=n.kv.get(ht);if(s&&!e)return t(s,{isLoaded:!0}),void(this.Ah()&&this.getSurveys(()=>{},!0));if(this.Ch)return void this.Ch.then(({surveys:e,context:i})=>{this.So||t(e,i)}).catch(t=>Sp.error("Error in survey callback",t));const r=this.Fh("/api/surveys/",{method:"GET",query:{token:n.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(t=>{try{return this.Oh(n,t)}catch(t){return Sp.error("Error processing surveys response",t),this.Oh(n,{statusCode:0,error:t})}},t=>this.Oh(n,{statusCode:0,error:t}));this.Ch=r;const o=()=>{this.Ch===r&&(this.Ch=null)};r.then(e=>{o(),this.So||t(e.surveys,e.context)},o).catch(t=>Sp.error("Error in survey callback",t))}Fh(t,e){const i=this.po;return i?i.sendRequest(t,e):new Promise(t=>t({statusCode:0,error:new Error(Kw)}))}Oh(t,e){if(this.So)return{surveys:[],context:{isLoaded:!1,error:Kw}};const i=e.statusCode;if(200!==i||!e.json){const t=`Surveys API could not be loaded, status: ${i}`;return 0!==i?Sp.error(t):e.error||Sp.warn(t),this.$h=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.$h=null;const n=e.json.surveys||[],s=n.filter(t=>$p(t)&&(ca(t)||Tp(t)));var r;return s.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(s)),t.kv.set({[ht]:n,[ct]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}Ah(){return this.Dh()&&!this.Ch&&!this.Lh()}Dh(){var t,e;const i=null===(t=null!==(e=this.po)&&void 0!==e?e:this.kh)||void 0===t?void 0:t.kv.get(ct);return Pe(i)&&Date.now()-i>3e5}Lh(){return Pe(this.$h)&&3e5>Date.now()-this.$h}markSurveyAsSeen(t,e){var i;const n={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};Mp(n);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Rh(t){for(const e of this.xh)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Sp.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e=!1){if(!Re(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Sp.warn("init was not called")}Nh(t){let e=null;return this.getSurveys(i=>{var n;e=null!==(n=i.find(e=>e.id===t))&&void 0!==n?n:null}),e}qh(t){if(Re(this._surveyManager))return{eligible:!1,reason:Kw};const e="string"==typeof t?this.Nh(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}jh(t){if(!this.yo.isCapturing())return{eligible:!1,reason:xp};if(Re(this._surveyManager))return{eligible:!1,reason:Kw};const e="string"==typeof t?this.Nh(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Re(this._surveyManager))return Sp.warn("init was not called"),{visible:!1,disabledReason:Kw};const e=this.jh(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Re(this._surveyManager)?(Sp.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Kw})):new Promise(i=>{this.getSurveys(e=>{var n;const s=null!==(n=e.find(e=>e.id===t))&&void 0!==n?n:null;if(s){const t=this.jh(s);i({visible:t.eligible,disabledReason:t.reason})}else i({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,i){var s;if(!this.yo.isCapturing())return;if(Re(this._surveyManager))return void Sp.warn("init was not called");const r="string"==typeof t?this.Nh(t):t;if(!(null==r?void 0:r.id))return void Sp.warn("Survey not found");if(!Rp.includes(r.type))return void Sp.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const o=null==n?void 0:n.querySelector(e);if(o){if(null===(s=r.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds){Sp.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var e,n;this.Th.delete(t),!this.So&&this.yo.isCapturing()&&(Sp.info(`Rendering survey ${r.id} with delay of ${null===(e=r.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds} seconds`),null===(n=this._surveyManager)||void 0===n||n.renderSurvey(r,o,i),Sp.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Th.add(t)}this._surveyManager.renderSurvey(r,o,i)}else Sp.warn("Survey element not found")}displaySurvey(t,e){var i;if(!this.yo.isCapturing())return;if(Re(this._surveyManager))return void Sp.warn("init was not called");const n=this.Nh(t);if(!n)return void Sp.warn("Survey not found");let s=n;if((null===(i=n.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)&&e.ignoreDelay&&(s=ue(ue({},n),{},{appearance:ue(ue({},n.appearance),{},{surveyPopupDelaySeconds:0})})),e.displayType!==wp.Popover&&e.initialResponses&&Sp.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){const t=this.qh(n);if(!t.eligible)return void Sp.warn("Survey is not eligible to be displayed: ",t.reason)}e.displayType!==wp.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}cancelPendingSurvey(t){Re(this._surveyManager)?Sp.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t,e;null===(t=this._surveyManager)||void 0===t||null===(e=t.handlePageUnload)||void 0===e||e.call(t)}};function tk(t,e,i){if(Re(t))return!1;switch(i){case"exact":return t===e;case"contains":{const i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(t)}case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}var ek=class{constructor(t){this._instance=t,this.Bh=new Set,this.Hh=new Set,this.zh=new Yb,this.Uh=(t,e)=>this.Wh(t,e)&&this.Vh(t,e)&&this.Gh(t,e)&&this.Zh(t,e),this.Wh=(t,e)=>!(null==e?void 0:e.event)||(null==t?void 0:t.event)===(null==e?void 0:e.event)}init(){var t,e;Te(null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook)||(this.Qh=null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook((t,e)=>{this.on(t,e)}))}dispose(){var t;null===(t=this.Qh)||void 0===t||t.call(this),this.Qh=void 0,this.zh=new Yb}register(t){var e,i;if(!Te(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)&&(t.forEach(t=>{var e;this.Bh.add(t),null===(e=t.steps)||void 0===e||e.forEach(t=>{this.Hh.add((null==t?void 0:t.event)||"")})}),null===(i=this._instance)||void 0===i?void 0:i.autocapture)){const t=new Set;this.Bh.forEach(e=>{var i;null===(i=e.steps)||void 0===i||i.forEach(e=>{(null==e?void 0:e.selector)&&t.add(e.selector)})}),this._instance.autocapture.setElementSelectors(t)}}replace(t){this.Bh.clear(),this.Hh.clear(),this.register(t)}on(t,e){null!=e&&0!=t.length&&(this.Hh.has(t)||this.Hh.has(e.event))&&this.Bh.forEach(t=>{this.Jh(e,t)&&this.zh.emit("actionCaptured",t.name)})}Kh(t){this.onAction("actionCaptured",e=>t(e))}Jh(t,e){if(null==(null==e?void 0:e.steps))return!1;for(const i of e.steps)if(this.Uh(t,i))return!0;return!1}onAction(t,e){return this.zh.on(t,e)}Vh(t,e){if(null==e?void 0:e.url){var i;const n=null==t||null===(i=t.properties)||void 0===i?void 0:i.$current_url;if(!n||"string"!=typeof n)return!1;if(!tk(n,e.url,e.url_matching||"contains"))return!1}return!0}Gh(t,e){return!!this.Xh(t,e)&&!!this.Yh(t,e)&&!!this.tc(t,e)}Xh(t,e){var i;if(!(null==e?void 0:e.href))return!0;const n=this.ec(t);if(n.length>0)return n.some(t=>tk(t.href,e.href,e.href_matching||"exact"));const s=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!s&&tk(function(t){const e=t.match(/(?::|")href="(.*?)"/);return e?e[1]:""}(s),e.href,e.href_matching||"exact")}Yh(t,e){var i;if(!(null==e?void 0:e.text))return!0;const n=this.ec(t);if(n.length>0)return n.some(t=>tk(t.text,e.text,e.text_matching||"exact")||tk(t.$el_text,e.text,e.text_matching||"exact"));const s=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!s&&(r=function(t){const e=[],i=/(?::|")text="(.*?)"/g;let n;for(;!Re(n=i.exec(t));)e.includes(n[1])||e.push(n[1]);return e}(s),o=e.text,l=e.text_matching||"exact",r.some(t=>tk(t,o,l)));var r,o,l}tc(t,e){var i,n;if(!(null==e?void 0:e.selector))return!0;const s=null==t||null===(i=t.properties)||void 0===i?void 0:i.$element_selectors;if(null==s?void 0:s.includes(e.selector))return!0;const r=(null==t||null===(n=t.properties)||void 0===n?void 0:n.$elements_chain)||"";if(e.selector_regex&&r)try{return new RegExp(e.selector_regex).test(r)}catch(t){return!1}return!1}ec(t){var e;return null==(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}Zh(t,e){return!(null==e?void 0:e.properties)||0===e.properties.length||ga(e.properties.reduce((t,e)=>{const i=Se(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t},{}),null==t?void 0:t.properties)}},ik=class{constructor(t){var e,i;this.nc=[],this._instance=t,this.sc=new Map,this.rc=new Map,this.oc=new Map,this.lc=null===(e=this._instance)||void 0===e||null===(i=e.onSessionId)||void 0===i?void 0:i.call(e,t=>this.ac(t))}uc(t){return!1}hc(){return null}cc(t){}dc(){}vc(t,e){return!!t&&ga(t.propertyFilters,null==e?void 0:e.properties)}fc(t,e){const i=new Map;return t.forEach(t=>{var n;null===(n=t.conditions)||void 0===n||null===(n=n[e])||void 0===n||null===(n=n.values)||void 0===n||n.forEach(e=>{if(null==e?void 0:e.name){const n=i.get(e.name)||[];n.push(t.id),i.set(e.name,n)}})}),i}gc(t,e,i){const n=(i===cp.Activation?this.sc:this.rc).get(t);let s=[];return this.mc(t=>{s=t.filter(t=>null==n?void 0:n.includes(t.id))}),s.filter(n=>{var s;const r=null===(s=n.conditions)||void 0===s||null===(s=s[i])||void 0===s||null===(s=s.values)||void 0===s?void 0:s.find(e=>e.name===t);return this.vc(r,e)})}register(t){this.yc(t,!1)}replace(t){this.yc(t,!0)}yc(t,e){var i;Te(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)||(this.bc(t,e),this._c(t,e))}_c(t,e){const i=t.filter(t=>{var e;return null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length});var n;if(e&&this.oc.clear(),0===i.length)return void(e&&(null===(n=this.wc)||void 0===n||n.replace([])));this.wc||(this.wc=new ek(this._instance),this.wc.init(),this.wc.Kh(t=>this.onAction(t)));const s=[];i.forEach(t=>{var e;null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||e.values.forEach(e=>{if(s.push(e),e.name){var i;const n=null!==(i=this.oc.get(e.name))&&void 0!==i?i:[];n.includes(t.id)||n.push(t.id),this.oc.set(e.name,n)}})}),e?this.wc.replace(s):this.wc.register(s)}kc(t,e){e.forEach((e,i)=>{var n;const s=null!==(n=t.get(i))&&void 0!==n?n:[];e.forEach(t=>{s.includes(t)||s.push(t)}),t.set(i,s)})}bc(t,e){var i,n;const s=t.filter(t=>{var e,i;return(null===(e=t.conditions)||void 0===e?void 0:e.events)&&(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),r=t.filter(t=>{var e,i;return(null===(e=t.conditions)||void 0===e?void 0:e.cancelEvents)&&(null===(i=t.conditions)||void 0===i||null===(i=i.cancelEvents)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),o=this.fc(t,cp.Activation),l=this.fc(t,cp.Cancellation);e?(this.sc=o,this.rc=l):(this.kc(this.sc,o),this.kc(this.rc,l)),(0!==s.length||0!==r.length)&&(null!==(i=this.Qh)&&void 0!==i||(this.Qh=null===(n=this._instance)||void 0===n?void 0:n._addCaptureHook((t,e)=>{this.onEvent(t,e)})))}onEvent(t,e){var i,n;const s=this.Sc(),r=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$survey_id)||(null==e||null===(n=e.properties)||void 0===n?void 0:n.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const e=this.xc(t,r);if("consume"===e)return s.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.Cc([r]);if("persist"===e)return s.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.$c(r),void this.Tc([r])}if(this.rc.has(t)){const i=this.gc(t,e,cp.Cancellation);i.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:i.map(t=>t.id)}),this.Cc(i.map(t=>t.id)),i.forEach(t=>this.Ic(t.id)))}if(!this.sc.has(t))return;s.info("event name matched",{event:t,eventPayload:e,items:this.sc.get(t)});const o=this.gc(t,e,cp.Activation);this.Mc(o.map(t=>t.id))}onAction(t){this.oc.has(t)&&this.Mc(this.oc.get(t)||[])}Mc(t){var e,i;if(0===t.length)return;const n=!!(null===(e=this._instance)||void 0===e||null===(i=e.get_session_id)||void 0===i?void 0:i.call(e)),s=[];for(const e of t)n&&this.uc(e)?this.$c(e)&&this.Ec(e):s.push(e);s.length>0&&(this.nc=[...new Set([...this.nc,...s])]),this.Sc().info("updating activated items",{activatedItems:this.getActivatedIds()})}$c(t){this.nc=this.nc.filter(e=>e!==t);const e=this.Pc();return!e.includes(t)&&(this.Rc([...e,t]),this.Ac(),!0)}Cc(t){const e=new Set(t);this.nc=this.nc.filter(t=>!e.has(t));const i=this.Fc(),n=i.filter(t=>!e.has(t));n.length!==i.length&&(this.Rc(n),0===n.length&&this.Oc()),this.Tc(t)}Dc(){var t;const e=this.hc();if(!e)return{};const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[e];return i&&"object"==typeof i?i:{}}Ec(t){if(!this.hc())return;const e=this.Dc();this.cc(ue(ue({},e),{},{[t]:Date.now()}))}Tc(t){if(!this.hc())return;const e=this.Dc(),i={};let n=!1;for(const[s,r]of Object.entries(e))t.includes(s)?n=!0:i[s]=r;n&&($e(i)?this.dc():this.cc(i))}Lc(){this.hc()&&this.dc()}getActivationTimestamp(t){if(!this.Pc().includes(t))return;const e=this.Dc()[t];return Pe(e)?e:void 0}Fc(){var t;const e=this.Nc();return(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[e])||[]}Pc(){var t,e,i;const n=this.Fc();if(0===n.length)return[];const s=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[this.qc()],r=null===(e=this._instance)||void 0===e||null===(i=e.get_session_id)||void 0===i?void 0:i.call(e);return r&&s===r?n:[]}Ac(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(e=t.get_session_id)||void 0===e?void 0:e.call(t);i&&this.jc(i)}Oc(){this.Bc()}ac(t){var e;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[this.qc()];if(i&&i!==t){const t=this.Fc(),e=this.Dc();t.length>0&&(this.Rc([]),t.filter(t=>Pe(e[t])).forEach(t=>this.Ic(t))),this.Oc(),this.Lc()}}getActivatedIds(){return[...new Set([...this.Pc(),...this.nc])].filter(t=>!this.Hc(t))}dispose(){var t,e,i;null===(t=this.lc)||void 0===t||t.call(this),this.lc=void 0,null===(e=this.Qh)||void 0===e||e.call(this),this.Qh=void 0,null===(i=this.wc)||void 0===i||i.dispose(),this.wc=void 0}reset(){this.nc=[],this.Fc().length>0&&this.Rc([]),this.Oc(),this.Lc()}getEventToItemsMap(){return this.sc}zc(){return this.wc}},nk=class extends ik{constructor(t){super(t)}Nc(){return dt}qc(){return vt}hc(){return ft}cc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_timestamps:t})}dc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_timestamps")}uc(t){var e;let i;this.mc(e=>{i=e.find(e=>e.id===t)});const n=null==i||null===(e=i.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds;return Pe(n)&&n>0}Uc(){return _p.SHOWN}mc(t){var e;null===(e=this._instance)||void 0===e||e.getSurveys(t)}Ic(t){var e;null===(e=this._instance)||void 0===e||e.cancelPendingSurvey(t)}Sc(){return Sp}Rc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated:t})}jc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_session:t})}Bc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_session")}Hc(){return!1}xc(t,e){let i;return this.mc(t=>{i=t.find(t=>t.id===e)}),!i||da(i)?t===_p.SHOWN?"consume":"ignore":t===_p.SHOWN?"persist":t===_p.DISMISSED||t===_p.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},sk=class{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);const e={};for(const i of t){const t=this._instance.get_property(i);Te(t)||(e[i]=t)}return e}set(t,e){this._instance.register("string"==typeof t?{[t]:e}:t)}remove(t){"string"!=typeof t?t.forEach(t=>this._instance.unregister(t)):this._instance.unregister(t)}},rk=class{constructor(t){this._instance=t}get(){const t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const t=null==d?void 0:d.__PosthogExtensions__;if(!t)return;const{generateSurveys:e,loadExternalDependency:i}=t;return{generateSurveys:e?t=>e(this._instance,t):void 0,loadExternalDependency:i?t=>i(this._instance,"surveys",t):void 0}}createEventReceiver(){return new nk(this._instance)}};const ok=(null==t?void 0:t.location)?cr(t.location.hash,"__posthog")||cr(location.hash,"state"):null,lk="_postHogToolbarParams",ak=Gs("[Toolbar]"),uk=Gs("[FeatureFlags]");var hk=class{constructor(t,e=!1){this.Wc=!1,this.update(t,e)}update(t,e){this.Vc=((t,e)=>{var i,n,s,r,o,l,a;return{bootstrap:{featureFlags:null!==(i=null===(n=t.bootstrap)||void 0===n?void 0:n.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(s=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:void 0},remoteRequestsDisabled:e,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=t.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:Te(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(l=null!==(a=t.evaluation_contexts)&&void 0!==a?a:t.evaluation_environments)&&void 0!==l?l:[],flagKeys:Se(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.Wc||(uk.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Wc=!0),Te(t.flag_keys)||Se(t.flag_keys)||uk.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Vc}};const ck=Gs("[FeatureFlags]"),dk=Gs("[FeatureFlags]",{debugEnabled:!0}),vk="\" failed. Feature flags didn't load in time.",fk=["click","keydown","wheel","touchstart","pointerdown"],pk="connection_error",gk=t=>{const e={};for(let i=0;t.length>i;i++)e[t[i]]=!0;return e},mk=t=>{const e={};for(const[i,n]of Ks(t||{}))n&&(e[i]=n);return e},yk="Refusing to render web experiment since the viewer is a likely bot",_k={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>va(e,t),not_regex:(t,e)=>!va(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},bk=Gs("[Conversations]"),wk="Conversations not available yet.";function kk(t,e){var n,s,r,o,l,a,u;const h=null!==(n=null==t?void 0:t.flushIntervalMs)&&void 0!==n?n:3e3,c=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,d=(null==e?void 0:e.consoleCapture)?void 0:null!==(r=null==t?void 0:t.maxLogsPerInterval)&&void 0!==r?r:1e3,v=Te(d)?Math.max(c,2048):Math.max(c,d),f=ue(ue({},function(){let t="",e="";try{const n=null==i?void 0:i.userAgent;n&&([t,e]=Zi(n))}catch(t){}return function(t,e){const i=function(t){if(t)return{}.hasOwnProperty.call(Ts,t)?Ts[t]:t}(t);return ue(ue({},i?{"os.name":i}:{}),e?{"os.version":e}:{})}(t,e)}()),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(l=null==f?void 0:f["service.name"])&&void 0!==l?l:null==t?void 0:t.serviceName)&&void 0!==o?o:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(a=null==f?void 0:f["service.version"])&&void 0!==a?a:null==t?void 0:t.serviceVersion,environment:null!==(u=null==f?void 0:f["deployment.environment"])&&void 0!==u?u:null==t?void 0:t.environment,resourceAttributes:f,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:h,maxBufferSize:c,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const Sk=["debug","log","warn","error","info"],xk="console",Ck="__posthogHandledLogsRequestError",$k=(t,e)=>{const i=t instanceof Error?t:new Error(e);return i[Ck]=!0,i},Tk=t=>!!t&&"object"==typeof t&&!0===t[Ck],Ek=Gs("[NetworkMetrics]"),Ik=()=>{var e;return(null==t||null===(e=t.performance)||void 0===e?void 0:e.now)?t.performance.now():Date.now()},Mk=t=>t?`${Math.floor(t/100)}xx`:"missing",Rk=(t,e)=>{var i;const n=String(e);return{method:String(t).toUpperCase(),url:(null===(i=lr(n))||void 0===i?void 0:i.href)||n}},Pk=(t,e,i,n,s)=>{try{var r,o,l;const u=s();if(!u)return;const h=i||void 0,c=Ik()-n,d=lr(e.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;const v={url:(null==d?void 0:d.href)||e.url,method:e.method},f=xe(u.name)?u.name(v):Ee(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=ue({method:v.method,host:null!==(r=null==d?void 0:d.hostname)&&void 0!==r?r:"",path:d?(a=d.pathname,a.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/")):"",status_class:Mk(h)},null===(o=u.attributes)||void 0===o?void 0:o.call(u,v,{status:h,durationMs:c}));null===(l=t.metrics)||void 0===l||l.histogram(f,c,{unit:"ms",attributes:p})}catch(t){Ek.error("Failed to record network metric",t)}var a},Ok=()=>{},Ak=(e,i)=>xe(null==t?void 0:t.fetch)?wv(t,"fetch",t=>function(...n){const s=Ik(),r=t.apply(this,n);if(!i())return r;try{var o,l,a;const[t,u]=n,h=Rk(null!==(o=null!==(l=null==u?void 0:u.method)&&void 0!==l?l:null==t?void 0:t.method)&&void 0!==o?o:"GET",null!==(a=null==t?void 0:t.url)&&void 0!==a?a:t);return r.then(t=>(Pk(e,h,null==t?void 0:t.status,s,i),t),t=>{throw Pk(e,h,void 0,s,i),t})}catch(t){return Ek.error("Failed to observe fetch",t),r}}):Ok,Fk=(e,i)=>{var n;const s=null==t||null===(n=t.XMLHttpRequest)||void 0===n?void 0:n.prototype;if(!s)return Ok;const r=new WeakMap,o=wv(s,"open",t=>function(...e){try{(()=>$b.has(this))()||r.set(this,Rk(e[0],e[1]))}catch(t){Ek.error("Failed to observe XHR open",t)}return t.apply(this,e)}),l=wv(s,"send",t=>function(...n){let s;try{const t=r.get(this);if(t&&i()){const n=Ik();s=()=>{this.removeEventListener("loadend",s),Pk(e,t,this.status,n,i)},nr(this,"loadend",s)}}catch(t){Ek.error("Failed to observe XHR send",t)}try{return t.apply(this,n)}catch(t){throw s&&this.removeEventListener("loadend",s),t}});return()=>{o(),l()}},Dk={featureFlags:class{constructor(t){this.name="featureFlags",this.Gc=!1,this.featureFlagEventHandlers=[],this.$=ck,this.Zc={},this.Qc={},this.Jc=[],this.Kc=!1,this.Xc=!1,this.Yc=0,this.td=!1,this.ed=!1,this.nd=!1,this.sd=!1,this.rd=0,this.od=!1,this.sn=()=>{const t=this.ld();this.rd=0,t&&this.reloadFeatureFlags()},this.ad=()=>{var t,e;const i=this.ud,s=null!==(t=this.hd)&&void 0!==t?t:i;Te(i)||Te(s)||this.Mr.remoteRequestsDisabled||!n||"hidden"===n.visibilityState||Date.now()-(null!==(e=this.dd)&&void 0!==e?e:0)<s||(this.hd=this.od||!this.Mr.idleRefreshBackoff?i:Math.min(2*s,36e5),this.od=!1,this.reloadFeatureFlags(),this.vd())},this.fd=()=>{this.od&&this.hd===this.ud||this.pd()},this.an=()=>{"visible"===(null==n?void 0:n.visibilityState)&&this.pd()},"get"in t?this.yo=t:(this._instance=t,this.gd=new hk(t.config,t.Xl()),this.yo=this.gd)}updateConfig(t,e){var i;null===(i=this.gd)||void 0===i||i.update(t,e),this.po&&this.md()}setup(t){return this.Mh=t,this.$=t.logger.createLogger("[FeatureFlags]"),Jw(t.kv.initialize(),()=>{this.Mh===t&&(this.Mh=void 0,this.po=t,this.yd(t))})}yd(e){var i;if(this.po===e)return t&&nr(t,"online",this.sn),this.md(),this.bd=e.registerDynamicEventProperties(()=>this._d()?this.Zc:this.Qc),this.wd=null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.kd(),this.Sd(),this.xd()}),this.Sd(),this.initialize()}pd(){this.od=!0,this.hd=this.ud,this.ad()}md(){const t=this.Mr.refreshIntervalMs,e=!this.Mr.remoteRequestsDisabled&&n&&!Te(t)&&t>0?t:void 0;this.Mr.idleRefreshBackoff||(this.hd=e),e!==this.ud&&(this.Cd(),Te(e)||(this.ud=e,this.hd=e,this.vd(),(null==n?void 0:n.addEventListener)&&(nr(n,Yt,this.an),Zs(fk,t=>{nr(n,t,this.fd,{capture:!0})}))))}vd(){Te(this.ud)||(Te(this.$d)||clearInterval(this.$d),this.dd=Date.now(),this.$d=setInterval(this.ad,this.ud))}Cd(){var t;Te(this.$d)||(clearInterval(this.$d),this.$d=void 0,null==n||null===(t=n.removeEventListener)||void 0===t||t.call(n,"visibilitychange",this.an),Zs(fk,t=>{var e;null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,t,this.fd,{capture:!0})})),this.ud=void 0,this.hd=void 0,this.od=!1,this.dd=void 0}destroy(){this.Td()}dispose(){this.Td()}Td(){var e,i;this.Cd(),this.Yc++,this.ed=!1,this.Mh=void 0,this.po&&(this.Id(),null===(e=this.bd)||void 0===e||e.dispose(),this.bd=void 0,null===(i=this.wd)||void 0===i||i.call(this),this.wd=void 0,this.Jc=[],null==t||t.removeEventListener("online",this.sn),this.po=void 0)}get Mr(){return this.yo.get()}Md(t){var e;return this.Ed&&t in this.Ed?this.Ed[t]:null===(e=this.po)||void 0===e?void 0:e.kv.get(t)}kd(){return!!this.Ed&&(this.Ed=void 0,!0)}Pd(){var t;return!Te(null===(t=this.po)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.kd()}At(t){this.Rd(()=>{var e;return null===(e=this.po)||void 0===e?void 0:e.kv.set(t)})}Ad(t,e,i){var n;if(!(null===(n=this._instance)||void 0===n?void 0:n.persistence)||!t.$enabled_feature_flags)return;const s=this.Md("$enabled_feature_flags")||{},r=t.$enabled_feature_flags||{},o=e.flags||e.featureFlags,l=e.flags?Object.entries(e.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],a=!!e.errorsWhileComputingFlags&&!!e.flags,u=a?l:i&&!Se(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(r)])),h=this.Md("$feature_flag_payloads")||{},c=t.$feature_flag_payloads||{},d=a||i?u:Array.from(new Set([...Object.keys(h),...Object.keys(c)])),v=!a&&!i,f=!!v||u,p=!!v||d,g={[X]:f,[Y]:f,[it]:p};t.$feature_flag_details&&(g[et]=f);for(const e of[nt,Ct,st])Te(t[e])||(g[e]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(g)}Lt(t){this.Rd(()=>{var e;return null===(e=this.po)||void 0===e?void 0:e.kv.remove(t)})}Rd(t){try{t()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}Sd(){const t={};for(const e of[X,it,nt,rt]){const i=this.Md(e);Te(i)||(t[e]=i)}this.Zc=t;const e=ue({},t),i=this.Md(Y);if(i)for(const[t,n]of Object.entries(i))e[`$feature/${t}`]=n;this.Qc=e}_d(){const t=this.Mr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.Md(Ct);return"number"!=typeof e||Date.now()-e>t}Fd(){return!!this._d()&&(this.sd||this.Xc||(this.sd=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Od(){const t=this.Mr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),e}):[]}Dd(){const t=this.Mr.flagKeys;if(!Te(t))return t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),e})}initialize(){var t,e;const i=this.Mr,n=null!==(t=null===(e=i.bootstrap)||void 0===e?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(n).length){var s,r;const t=null!==(s=null===(r=i.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:{},e=Object.keys(n).filter(t=>!Te(n[t])).reduce((t,e)=>(t[e]=n[e],t),{}),o=Object.keys(t).filter(t=>e[t]).reduce((e,i)=>(e[i]=t[i],e),{});return this.Ld({featureFlags:e,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,e,i){var n,s;const r=(null==i?void 0:i.merge)&&null!==(n=this.Md("$enabled_feature_flags"))&&void 0!==n?n:{},o=(null==i?void 0:i.merge)&&null!==(s=this.Md("$feature_flag_payloads"))&&void 0!==s?s:{},l=ue(ue({},r),t),a=ue(ue({},o),e),u={};for(const[t,e]of Object.entries(l))u[t]={key:t,enabled:ss(e),variant:rs(e),reason:void 0,metadata:Te(null==a?void 0:a[t])?void 0:{id:0,version:void 0,description:void 0,payload:a[t]}};this.Ld({flags:u})}get hasLoadedFlags(){return this.Kc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.Md(et),e=this.Md(rt),i=this.Md(ot);if(!i&&!e)return t||{};const n=Js({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(const t of s){var r;const s=n[t],l=null==e?void 0:e[t],a=Te(l)?null!==(r=null==s?void 0:s.enabled)&&void 0!==r&&r:!!l,u=Te(l)?null==s?void 0:s.variant:"string"==typeof l?l:void 0,h=null==i?void 0:i[t],c=ue(ue({},s),{},{enabled:a,variant:a?null!=u?u:null==s?void 0:s.variant:void 0});var o;a!==(null==s?void 0:s.enabled)&&(c.original_enabled=null==s?void 0:s.enabled),u!==(null==s?void 0:s.variant)&&(c.original_variant=null==s?void 0:s.variant),h&&(c.metadata=ue(ue({},null==s?void 0:s.metadata),{},{payload:h,original_payload:null==s||null===(o=s.metadata)||void 0===o?void 0:o.payload})),n[t]=c}return this.Gc||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:n}),this.Gc=!0),n}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(i=>{const n=t[i];return{key:i,enabled:ss(n),variant:rs(n),payload:ns(e[i])}})}getFlagVariants(){const t=this.Md(Y),e=this.Md(rt);if(!e)return t||{};const i=Js({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.Gc||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Gc=!0),i}getFlagPayloads(){const t=this.Md(it),e=this.Md(ot);if(!e)return t||{};const i=Js({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.Gc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Gc=!0),i}reloadFeatureFlags(){this.td||this.Mr.featureFlagsDisabled||this.ld()||(this.Xc&&(this.ed=!0),this.Nd||(this.Jc.slice().forEach(t=>{try{t()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.Nd=setTimeout(()=>{this.qd()},5)))}Id(){clearTimeout(this.Nd),this.Nd=void 0}onReloading(t){return this.Jc.push(t),()=>{this.Jc=this.Jc.filter(e=>e!==t)}}ensureFlagsLoaded(){this.Kc||this.Xc||this.Nd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.td=t}resetFlagCallReported(){this.Lt(kt)}qd(t){this.Id();const e=this.po;if(!e||this.Mr.remoteRequestsDisabled||this.ld())return;if(this.Xc)return void(this.ed=!0);const i={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:ue(ue(ue({},e.initialPersonProperties),this.Md("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Md(at),timezone:Na()};Te(e.deviceId)||(i.$device_id=e.deviceId),((null==t?void 0:t.disableFlags)||this.Mr.featureFlagsDisabled)&&(i.disable_flags=!0);const n=this.Od();n.length&&(i.evaluation_contexts=n);const s=this.Dd();Te(s)||(i.flag_keys=s);const r=this.Mr.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),l=this.Yc;this.Xc=!0;const a=()=>{this.ed&&(this.ed=!1,this.qd())},u=t=>{var e,n;const s=null!==(e=t.json)&&void 0!==e?e:{},o=200!==t.statusCode;if(this.Xc=!1,l!==this.Yc)return void a();if(this.jd(t.statusCode),o||this.ed||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.ed)return;this.nd=!o;const u=[];t.error?u.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?pk:"unknown_error"):200!==t.statusCode&&u.push(`api_error_${t.statusCode}`),s.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");const h=!!(null===(n=s.quotaLimited)||void 0===n?void 0:n.includes("feature_flags"));h&&u.push("quota_limited"),this.At({[xt]:u}),h?this.$.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):i.disable_flags||this.Ld(s,o,{partialResponse:r}),a()},h=t=>{this.Xc=!1,l===this.Yc?(this.At({[xt]:[pk]}),this.$.error("Feature flag request failed",t),this.Pd()&&this.xd(!0),a()):a()};try{e.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(u).catch(h)}catch(t){h(t)}}ld(){return dr(this.rd,3)}jd(t){this.rd=vr(t,this.rd,3,()=>this.$.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,e={}){var i;if(e.fresh&&!this.nd)return;if(!(this.Kc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+t+vk);if(this.Fd())return;const n=this.getFeatureFlagResult(t,e);return null!==(i=null==n?void 0:n.variant)&&void 0!==i?i:null==n?void 0:n.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e={}){if(e.fresh&&!this.nd)return;if(!(this.Kc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+t+vk);if(this.Fd())return;const i=this.getFlagVariants(),n=t in i,s=i[t],r=this.getFlagPayloads()[t],o=String(s),l=this.Md("$feature_flag_request_id")||void 0,a=this.Md("$feature_flag_evaluated_at")||void 0;let u,h=this.Md("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var c;const t=null===(c=this.po)||void 0===c?void 0:c.session.sessionId,e=this.Md(St);t&&t!==e&&(h={},u=t)}if(e.send_event||!("send_event"in e))if(t in h&&h[t].includes(o))u&&this.At({[kt]:h,[St]:u});else{var d,v,f,p,g,m,y,_,b,w,k,S;Se(h[t])?h[t].push(o):h[t]=[o],this.At(ue({[kt]:h},u?{[St]:u}:{}));const e=this.getFeatureFlagDetails(t),i=[...null!==(d=this.Md("$feature_flag_errors"))&&void 0!==d?d:[]];Te(s)&&i.push("flag_missing");const n={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:a,$feature_flag_bootstrapped_response:null!==(v=null===(f=this.Mr.bootstrap)||void 0===f||null===(f=f.featureFlags)||void 0===f?void 0:f[t])&&void 0!==v?v:null,$feature_flag_bootstrapped_payload:null!==(p=null===(g=this.Mr.bootstrap)||void 0===g||null===(g=g.featureFlagPayloads)||void 0===g?void 0:g[t])&&void 0!==p?p:null,$used_bootstrap_value:!this.nd};Te(null==e||null===(m=e.metadata)||void 0===m?void 0:m.has_experiment)||(n.$feature_flag_has_experiment=e.metadata.has_experiment),Te(null==e||null===(y=e.metadata)||void 0===y?void 0:y.version)||(n.$feature_flag_version=e.metadata.version);const c=null!==(_=null==e||null===(b=e.reason)||void 0===b?void 0:b.description)&&void 0!==_?_:null==e||null===(w=e.reason)||void 0===w?void 0:w.code;var x;c&&(n.$feature_flag_reason=c),(null==e||null===(k=e.metadata)||void 0===k?void 0:k.id)&&(n.$feature_flag_id=e.metadata.id),Te(null==e?void 0:e.original_variant)&&Te(null==e?void 0:e.original_enabled)||(n.$feature_flag_original_response=Te(e.original_variant)?e.original_enabled:e.original_variant),(null==e||null===(S=e.metadata)||void 0===S?void 0:S.original_payload)&&(n.$feature_flag_original_payload=null==e||null===(x=e.metadata)||void 0===x?void 0:x.original_payload),i.length&&(n.$feature_flag_error=i.join(",")),this.Bd(n)}else u&&this.At({[kt]:h,[St]:u});return n?{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:ns(r)}:void 0}Bd(t){try{var e;null===(e=this.po)||void 0===e||e.capture("$feature_flag_called",t).catch(t=>{this.$.error("Failed to capture feature flag call",t)})}catch(t){this.$.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,e){this.Hd(t,e)}Hd(t,e){var i=this;return re(function*(){const n=i.po;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.Od();r.length&&(s.evaluation_contexts=r);const o=i.Dd();let l;Te(o)||(s.flag_keys=o);try{var a;const e=null===(a=(yield n.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:i.Mr.compression,sentAt:"body",timeoutMs:i.Mr.requestTimeoutMs})).json)||void 0===a?void 0:a.featureFlagPayloads;l=(null==e?void 0:e[t])||void 0}catch(t){return void i.$.error("Remote config feature flag request failed",t)}try{e(l)}catch(t){i.$.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.nd)return e.defaultValue;if(!(this.Kc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+vk),e.defaultValue;const i=this.getFeatureFlag(t,e);return Te(i)?e.defaultValue:!!i}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e,i){this.Ld(t,e,i)}Ld(t,e,i){if(!this.po)return;this.Kc=!0;const n=((t,e={},i={},n={},s,r=ck)=>{const o=((t,e)=>{const i=t.flags;if(i){const e=Object.fromEntries(Object.keys(i).map(t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]})),n=Object.fromEntries(Object.keys(i).filter(t=>i[t].enabled).filter(t=>{var e;return!Te(null===(e=i[t].metadata)||void 0===e?void 0:e.payload)}).map(t=>{var e;return[t,null===(e=i[t].metadata)||void 0===e?void 0:e.payload]}));return ue(ue({},t),{},{featureFlags:e,featureFlagPayloads:n})}return t.featureFlags&&e.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t,r),l=o.flags,a=o.featureFlags,u=o.featureFlagPayloads;if(!a)return;const h=t.requestId,c=t.evaluatedAt;if(Se(a)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const t={};if(a)for(let e=0;a.length>e;e++)t[a[e]]=!0;return{[X]:a,[Y]:t,[st]:!1}}let d=a,v=u,f=l;if(null==s?void 0:s.partialResponse){const t=Object.keys(d),s=v||{};d=ue(ue({},e),d),v=ue(ue({},i),s),t.forEach(t=>{t in s||null==v||delete v[t]}),f=ue(ue({},n),f)}else if(t.errorsWhileComputingFlags)if(l){const t=new Set(Object.keys(l).filter(t=>{var e;return!(null===(e=l[t])||void 0===e?void 0:e.failed)}));d=ue(ue({},e),Object.fromEntries(Object.entries(d).filter(([e])=>t.has(e))));const s=Object.fromEntries(Object.entries(v||{}).filter(([e])=>t.has(e)));v=ue(ue({},i),s),t.forEach(t=>{t in s||null==v||delete v[t]}),f=ue(ue({},n),Object.fromEntries(Object.entries(f||{}).filter(([e])=>t.has(e))))}else d=ue(ue({},e),d),v=ue(ue({},i),v),f=ue(ue({},n),f);return ue(ue({[X]:Object.keys(mk(d)),[Y]:d||{},[it]:v||{},[et]:f||{},[st]:!0===t.minimalFlagCalledEvents},h?{[nt]:h}:{}),c?{[Ct]:c}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.$);if(n)if(!1===(null==i?void 0:i.persist)){const t=!Te(this.po.kv.get(Y));this.Ed=n,t||this.At(n)}else this.kd(),this.Ad(n,t,!!(null==i?void 0:i.partialResponse)),this.At(n);else e&&this.Pd();e||(this.sd=!1),this.xd(e)}override(t,e=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.zd(t)}zd(t){if(this.po){if(!1===t)return this.Lt([rt,ot]),this.xd(),void dk.info("All overrides cleared");if(Se(t))return this.At({[rt]:gk(t)}),this.xd(),void dk.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e;const i=t;this.Gc=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);const n={},s=i.flags,r=i.payloads;return s&&(n[rt]=Se(s)?gk(s):s),r&&(n[ot]=r),Object.keys(n).length&&this.At(n),!1===s&&!1===r?this.Lt([rt,ot]):!1===s?this.Lt(rt):!1===r&&this.Lt(ot),this.xd(),!1===s?dk.info("Flag overrides cleared"):s&&dk.info("Flag overrides set",{flags:s}),void(!1===r?dk.info("Payload overrides cleared"):r&&dk.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.At({[rt]:t}),this.xd(),void dk.info("Flag overrides set",{flags:t});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Kc){const{flags:e,flagVariants:i}=this.Ud();try{t(e,i)}catch(t){this.$.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var n;const s=(this.Md("$early_access_features")||[]).find(e=>e.flagKey===t),r={[`$feature_enrollment/${t}`]:e},o={$feature_flag:t,$feature_enrollment:e,$set:r};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i);const l=ue(ue({},this.getFlagVariants()),{},{[t]:e});null===(n=this._instance)||void 0===n||null===(n=n.persistence)||void 0===n||n.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.At({[X]:Object.keys(mk(l)),[Y]:l,[lt]:ue(ue({},this.Md("$stored_person_properties")||{}),r)}),this.xd();try{var a;null===(a=this.po)||void 0===a||a.capture("$feature_enrollment_update",o).catch(t=>{this.$.error("Failed to capture early access feature enrollment",t)})}catch(t){this.$.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,e=!1,i){const n=this.Md(tt);!n||e?this.Wd(t,i):t(n)}Wd(t,e){var i=this;return re(function*(){const n=i.po;if(!n)return;const s=e?`&${e.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${s}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,i.At({[tt]:r})}catch(t){return void i.$.error("Early access feature request failed",t)}try{t(r)}catch(t){i.$.error("Early access feature callback failed",t)}})()}Ud(){const t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(t=>e[t]),flagVariants:Object.keys(e).filter(t=>e[t]).reduce((t,i)=>(t[i]=e[i],t),{})}}xd(t){this.Sd();const{flags:e,flagVariants:i}=this.Ud();this.featureFlagEventHandlers.forEach(n=>{try{n(e,i,{errorsLoading:t})}catch(t){this.$.error("Error while running feature flags callback",t)}})}setPersonPropertiesForFlags(t,e=!0){this.Vd(t,e)}Vd(t,e=!0){const i=this.Md("$stored_person_properties")||{},n=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),s=null==t?void 0:t.$set_once,r={};if(s)for(const t in s)({}).hasOwnProperty.call(s,t)&&(t in i||(r[t]=s[t]));this.At({[lt]:ue(ue(ue({},i),r),n)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const i=ue({},this.Md("$stored_person_properties")||{});t.forEach(t=>{delete i[t]}),this.At({[lt]:i}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(lt),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const i=this.Md("$stored_group_properties")||{},n=ue({},i);for(const e of Object.keys(t))n[e]=ue(ue({},i[e]),t[e]);this.At({[at]:n}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.Md("$stored_group_properties")||{};this.At({[at]:ue(ue({},e),{},{[t]:{}})})}else this.Lt(at)}reset(){this.Yc++,this.ed=!1,this.Zc={},this.Qc={},this.Ed=void 0,this.Kc=!1,this.td=!1,this.nd=!1,this.$anon_distinct_id=void 0,this.Id(),this.Gc=!1,this.rd=0}}},Lk={sessionRecording:class{get Mr(){return this._instance.config}get xa(){return this._instance.persistence}get started(){var t;return!!(null===(t=this.Gd)||void 0===t?void 0:t.isStarted)}get status(){var t,e;return"awaiting_config"===this.Zd||"missing_config"===this.Zd?this.Zd:null!==(t=null===(e=this.Gd)||void 0===e?void 0:e.status)&&void 0!==t?t:this.Zd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.Zd=fo,this.Qd=void 0,this.Jd=!1,this.Ke=(()=>{var e,i;if(!(null==n?void 0:n.visibilityState)||"visible"===n.visibilityState)return!0;const s=null==t||null===(e=t.performance)||void 0===e||null===(i=e.getEntriesByType)||void 0===i?void 0:i.call(e,"visibility-state");return!(null==s?void 0:s.length)||s.some(t=>"visible"===t.name)})(),this.an=()=>{var t,e;"visible"===(null==n?void 0:n.visibilityState)&&(this.Ke=!0,null===(t=this.Gd)||void 0===t||null===(e=t.setDocumentWasEverVisible)||void 0===e||e.call(t,!0))},!this._instance.sessionManager)throw Hw.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Mr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==n?void 0:n.addEventListener)&&nr(n,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.Jd=!0,null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,"visibilitychange",this.an),t?this.Kd(!0):this.stopRecording()}get Xd(){var e;const i=!!(null===(e=this._instance.get_property("$session_recording_remote_config"))||void 0===e?void 0:e.enabled),n=!this.Mr.disable_session_recording,s=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&n&&!s}startIfEnabledOrStop(t){var e;if(this.Jd)return;if(this.Xd&&(null===(e=this.Gd)||void 0===e?void 0:e.isStarted))return;const i=!Te(Object.assign)&&!Te(Array.from);this.Xd&&i?(this.Yd(t),Hw.info("starting")):(this.Zd=fo,this.stopRecording())}Yd(t){var e,i;if(this.Xd)if("awaiting_config"!==this.Zd&&"missing_config"!==this.Zd&&(this.Zd=_o),(null==d||null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.rrweb)||void 0===e?void 0:e.record)&&(null===(i=d.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this.tv(t);else{var n,s;const e=this._instance.sessionManager;null===(n=d.__PosthogExtensions__)||void 0===n||null===(s=n.loadExternalDependency)||void 0===s||s.call(n,this._instance,this.ev,i=>{if(!this.Jd&&this.Xd&&this._instance.sessionManager===e)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Hw.error("could not load recorder",i)):void this.tv(t);this.Zd="disabled"})}}stopRecording(){var t,e;null===(t=this.Qd)||void 0===t||t.call(this),this.Qd=void 0,null===(e=this.Gd)||void 0===e||e.stop()}Kd(t=!1){var e,i;null===(e=this.Qd)||void 0===e||e.call(this),this.Qd=void 0,null===(i=this.Gd)||void 0===i||i.discard({discardProducerEvents:t})}iv(){var t,e;null===(t=this.xa)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this.xa)||void 0===e||e.unregister("$replay_sample_rate")}nv(t,e){if(Re(t))return null;const i=Pe(t)?t:parseFloat(t);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(Hw.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):i;var n}sv(t){if(this.xa){var e,i;const n=this.xa,s=()=>{var e;const i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.nv(null===(e=this.Mr.session_recording)||void 0===e?void 0:e.sampleRate,"session_recording.sampleRate"),r=this.nv(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:r;Re(o)&&this.iv();const l=null==i?void 0:i.minimumDurationMilliseconds;n.register({[F]:ue(ue({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:ue({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:Te(l)?null:l,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};s(),null===(e=this.Qd)||void 0===e||e.call(this),this.Qd=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.onSessionId(s)}}onRemoteConfig(t){const e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?!1===e.sessionRecording?(this.sv(e),void this.Kd()):(this.sv(e),void this.startIfEnabledOrStop()):("awaiting_config"===this.Zd&&(this.Zd="missing_config",Hw.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var i;(null===(i=this.Gd)||void 0===i?void 0:i.log)?this.Gd.log(t,e):Hw.warn("log called before recorder was ready")}get ev(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(F);return(null==i||null===(e=i.scriptConfig)||void 0===e?void 0:e.script)||"lazy-recorder"}rv(){const t=this._instance.get_property(F);if(!t)return!1;let e;try{e="object"==typeof t?t:JSON.parse(t)}catch(t){return Hw.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!Re(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}tv(t){var e,i,n;if(!this.Jd&&this.Xd&&this._instance.sessionManager){if(!(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))return Hw.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Lt]:!0});var s;if(this.Gd||(this.Gd=null===(s=d.__PosthogExtensions__)||void 0===s?void 0:s.initSessionRecording(this._instance,this.Ke),this.Gd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.rv()){if("missing_config"===this.Zd||"awaiting_config"===this.Zd)return;return this.Zd="awaiting_config",Hw.info("persisted remote config is stale, requesting fresh config before starting"),void new xb(this._instance).load()}this.Zd=_o,null===(i=(n=this.Gd).setDocumentWasEverVisible)||void 0===i||i.call(n,this.Ke),this.Gd.start(t)}else this.Zd=fo}onRRwebEmit(t){var e,i;null===(e=this.Gd)||void 0===e||null===(i=e.onRRwebEmit)||void 0===i||i.call(e,t)}overrideLinkedFlag(){var t,e;this.Gd||null===(e=this.xa)||void 0===e||e.register({$replay_override_linked_flag:!0}),null===(t=this.Gd)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Gd||null===(e=this.xa)||void 0===e||e.register({$replay_override_sampling:!0}),null===(t=this.Gd)||void 0===t||t.overrideSampling()}overrideTrigger(t){var e,i;this.Gd||null===(i=this.xa)||void 0===i||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(e=this.Gd)||void 0===e||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null===(t=this.Gd)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!!(null===(i=this.Gd)||void 0===i?void 0:i.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;null===(t=this.Gd)||void 0===t||null===(e=t.flushBeforeIdentityReset)||void 0===e||e.call(t)}}},Nk={autocapture:class extends M_{constructor(t){super(new Aw(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.ov=this.lv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.av();return!!(t.path||t.search||this.uv(t))}startIfEnabled(){this.isEnabled&&(Vs.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.ov=this.lv(),this.startIfEnabled()}stop(){this.hv&&this.hv(),this.hv=void 0,this.dv&&this.dv(),this.dv=void 0,Vs.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.vv("pushState"),this.vv("replaceState"),this.fv(),this.uv()&&this.pv())}vv(e){var i;if(!t||(null===(i=t.history[e])||void 0===i?void 0:i.__posthog_wrapped__))return;const n=this;wv(t.history,e,t=>function(i,s,r){t.call(this,i,s,r),n.gv(e)})}lv(){const e=null==t?void 0:t.location;if(null==e?void 0:e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}av(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:Ce(t)?t:{}}uv(t=this.av()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}mv(t){const e=this.av(),i=this.ov;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.uv(e)&&t.hash!==i.hash))}gv(t){try{const e=this.lv();if(!e)return;this.mv(e)&&this._instance.capture(te,{navigation_type:t}),this.ov=e}catch(e){Vs.error(`Error capturing ${t} pageview`,e)}}fv(){if(this.hv)return;const e=()=>{this.gv("popstate")};nr(t,"popstate",e),this.hv=()=>{t&&t.removeEventListener("popstate",e)}}pv(){if(this.dv)return;const e=()=>{this.gv("hashchange")};nr(t,"hashchange",e),this.dv=()=>{t&&t.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(t){var e;this.yv=!1,this.bo=!1,this.bv=null,this.instance=t,this.yv=!!(null===(e=this.instance.persistence)||void 0===e?void 0:e.props[C]),this.rageclicks=new x_(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return Ce(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Mr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Re(this.Mr.capture_heatmaps)?Re(this.Mr.enable_heatmaps)?this.yv:this.Mr.enable_heatmaps:!1!==this.Mr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.bo)return;Uw.info("starting..."),this._v(),this.an()}else{var t;clearInterval(null!==(t=this.bv)&&void 0!==t?t:void 0),this.wv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("heatmaps"in e))return;const i=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[C]:i}),this.yv=i,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Sv(t){zw(t.originalEvent)&&this.Cr(t.originalEvent,"deadclick")}an(){this.bv&&clearInterval(this.bv),this.bv="visible"===(null==n?void 0:n.visibilityState)?setInterval(this.fa.bind(this),this.flushIntervalMilliseconds):null}_v(){t&&n&&(this.xv=this.fa.bind(this),nr(t,Xt,this.xv),this.Cv=e=>this.Cr(e||(null==t?void 0:t.event)),nr(n,"click",this.Cv,{capture:!0}),this.$v=e=>this.Tv(e||(null==t?void 0:t.event)),nr(n,"mousemove",this.$v,{capture:!0}),this.Iv=new Q_(this.instance,G_,this.Sv.bind(this)),this.Iv.startIfEnabledOrStop(),this.Mv=this.an.bind(this),nr(n,Yt,this.Mv),this.bo=!0)}wv(){var e;t&&n&&(this.xv&&t.removeEventListener(Xt,this.xv),this.Cv&&n.removeEventListener("click",this.Cv,{capture:!0}),this.$v&&n.removeEventListener("mousemove",this.$v,{capture:!0}),this.Mv&&n.removeEventListener(Yt,this.Mv),clearTimeout(this.Ev),null===(e=this.Iv)||void 0===e||e.stop(),this.bo=!1)}Pv(e,i){const n=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(e,i,n){let s=e;for(;s&&mr(s)&&!yr(s,"body");){if(s===n)return!1;let e;try{var r,o,l;e=null===(r=null!==(o=null===(l=s.ownerDocument)||void 0===l?void 0:l.defaultView)&&void 0!==o?o:t)||void 0===r?void 0:r.getComputedStyle(s).position}catch(t){return!1}if(ge(i,e))return!0;s=Mr(s)}return!1}($r(e),["fixed","sticky"],r);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:n),target_fixed:o,type:i}}Cr(t,e="click"){var i;if(gr(t.target)||!zw(t))return;const n=this.Pv(t,e);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&qr($r(t),this.instance.config.rageclick)&&this.Zs(ue(ue({},n),{},{type:"rageclick"})),this.Zs(n)}Tv(t){!gr(t.target)&&zw(t)&&(clearTimeout(this.Ev),this.Ev=setTimeout(()=>{this.Zs(this.Pv(t,"mousemove"))},500))}Zs(e){if(!t)return;const i=this.Mr.disable_capture_url_hashes?un(t.location.href):t.location.href,n=this.Mr.custom_personal_data_properties,s=this.Mr.mask_personal_data_properties?[...Ca,...n||[]]:[],r=hr(i,s,Ta);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}fa(){this.Rt&&!$e(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Q_,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.yv=!1,this.bo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Rv=()=>{clearTimeout(this.Av),this.Av=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",ue({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,e)=>ue(ue({},t),{},{[`$web_vitals_${e.name}_event`]:ue({},e),[`$web_vitals_${e.name}_value`]:e.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Fv=t=>{var e;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Re(null==t?void 0:t.name)||Re(null==t?void 0:t.value))return void Lw.error("Invalid metric received",t);const i="string"==typeof t.navigationURL?t.navigationURL:void 0,n=this.Ov(i);if(Te(n))return;const s=Pe(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${n}`;if(this.Dv&&t.value>=this.Dv)return void Lw.error("Ignoring metric with value >= "+this.Dv,t);this.Rt.navigationKey!==s&&(this.Rv(),this.Av=setTimeout(this.Rv,this.flushToCaptureTimeoutMs)),Te(this.Rt.navigationKey)&&(this.Rt.navigationKey=s,this.Rt.url=n),this.Rt.firstMetricTimestamp=Te(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const r=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0),o=ue(ue(ue({},t),i?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete o.entries,Ce(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const e={};for(const i of jw){const n="url"===i&&"string"==typeof t.attribution[i]?this.Ov(t.attribution[i]):t.attribution[i];Te(n)||(e[i]=n)}o.attribution=e}else delete o.attribution;Te(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.Rv()},this.Lv=()=>{if(this.bo)return;let t,e,i,n,s=!1;const r=d.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,l=(null==o?void 0:o[this.Nv])||("web-vitals"===this.Nv&&Te(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!Te(l)){const r=l.withoutAttribution,o=this.attributionMetrics;s=!Te(r),t=o.indexOf("LCP")>-1?l.onLCP:(null==r?void 0:r.onLCP)||l.onLCP,e=o.indexOf("CLS")>-1?l.onCLS:(null==r?void 0:r.onCLS)||l.onCLS,i=o.indexOf("FCP")>-1?l.onFCP:(null==r?void 0:r.onFCP)||l.onFCP,n=o.indexOf("INP")>-1?l.onINP:(null==r?void 0:r.onINP)||l.onINP}if(!(t&&e&&i&&n))return void Lw.error("web vitals callbacks not loaded - not starting");const a={reportSoftNavs:this.useSoftNavs},u=s&&this.attributionMetrics.indexOf("INP")>-1?ue(ue({},a),{},{includeProcessedEventEntries:!1}):a;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Fv.bind(this),a),this.allowedMetrics.indexOf("CLS")>-1&&e(this.Fv.bind(this),a),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Fv.bind(this),a),this.allowedMetrics.indexOf("INP")>-1&&n(this.Fv.bind(this),u),this.bo=!0},this.yv=!!(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[M]),this.startIfEnabled()}get qv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const i=Ce(this.qv)?null===(t=this.qv)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return Re(i)?(null===(e=this._instance.persistence)||void 0===e?void 0:e.props.$web_vitals_allowed_metrics)||qw:i}get flushToCaptureTimeoutMs(){return(Ce(this.qv)?this.qv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=Ce(this.qv)?this.qv.web_vitals_attribution:void 0;return Ae(t)?t?qw:[]:Se(t)?t:Bw}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=Ce(this.qv)?this.qv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Dv(){const t=Ce(this.qv)&&Pe(this.qv.__web_vitals_max_value)?this.qv.__web_vitals_max_value:Nw;return t>0&&6e4>=t?Nw:t}get isEnabled(){const t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Lw.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=Ce(this.qv)?this.qv.web_vitals:Ae(this.qv)?this.qv:void 0;return Ae(e)?e:this.yv}startIfEnabled(){this.isEnabled&&!this.bo&&(Lw.info("enabled, starting..."),this.No(this.Lv))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const i=Ce(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Ce(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[M]:i}),this._instance.persistence.register({[A]:n})),this.yv=i,this.startIfEnabled()}get Nv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}No(t){var e;const i=d.__PosthogExtensions__,n=this.Nv,s=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==s?void 0:s[n])||"web-vitals"===n&&Te(s)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?t():null==i||null===(e=i.loadExternalDependency)||void 0===e||e.call(i,this._instance,n,e=>{e?Lw.error("failed to load script",e):t()})}Ov(e){const i=e||(null==t?void 0:t.location.href);if(!i)return void Lw.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?[...Ca,...s||[]]:[];return hr(n,r,Ta)}}},qk={exceptionObserver:class{constructor(e){var i;this.Lv=()=>{var e;if(!t||!this.isEnabled||!(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions))return;const i=d.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=d.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=d.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.jv&&this.Mr.capture_unhandled_errors&&(this.jv=i(this.captureException.bind(this))),!this.Bv&&this.Mr.capture_unhandled_rejections&&(this.Bv=n(this.captureException.bind(this))),!this.Hv&&this.Mr.capture_console_errors&&(this.Hv=s(this.captureException.bind(this)))}catch(t){Fw.error("failed to start",t),this.zv()}},this._instance=e,this.Uv=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[T]),this.wt=new Qe(ue(ue({},function(t={}){var e,i,n,s;return{refillRate:null!==(e=null!==(i=t.exceptionRateLimiterRefillRate)&&void 0!==i?i:t.__exceptionRateLimiterRefillRate)&&void 0!==e?e:1,bucketSize:null!==(n=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==n?n:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:Fw})),this.Mr=this.Wv(),this.startIfEnabledOrStop()}Wv(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ce(t)?e=ue(ue({},e),t):(Te(t)?this.Uv:t)&&(e=ue(ue({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Fw.info("enabled"),this.zv(),this.No(this.Lv)):this.zv()}No(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"exception-autocapture",e=>{if(e)return Fw.error("failed to load script",e);t()})}zv(){var t,e,i;null===(t=this.jv)||void 0===t||t.call(this),this.jv=void 0,null===(e=this.Bv)||void 0===e||e.call(this),this.Bv=void 0,null===(i=this.Hv)||void 0===i||i.call(this),this.Hv=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.Uv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[T]:this.Uv}),this.Mr=this.Wv(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.Wv()}captureException(t){try{var e,i,n;const s=null!==(e=null==t||null===(i=t.$exception_list)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.type)&&void 0!==e?e:"Exception";if(this.wt.consumeRateLimit(s))return void Fw.info("Skipping exception capture because of client rate limiting.",{exception:s});null===(n=this._instance.exceptions)||void 0===n||n.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var e,i;this.Vv=[],this.Gv=wm(),this._instance=t,this.Vv=null!==(e=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==e?e:[],this.Zv=ts(this.Qv()),this.Jv=new es(this.Zv)}onConfigChange(){this.Zv=ts(this.Qv()),this.Jv.setConfig(this.Zv)}onRemoteConfig(t){var e,i,n;if(!t.ok)return;const s=t.config;if(!("errorTracking"in s))return;const r=null!==(e=null===(i=s.errorTracking)||void 0===i?void 0:i.suppressionRules)&&void 0!==e?e:[],o=null===(n=s.errorTracking)||void 0===n?void 0:n.captureExtensionExceptions;this.Vv=r,this._instance.persistence&&this._instance.persistence.register({[E]:this.Vv,[I]:o})}get Kv(){var t;const e=!!this._instance.get_property(I),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.Gv.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.Zv.enabled)try{if(!Ee(t)||0===t.trim().length)return void gm.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:i,droppedKeys:n}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};const e=[];return{sanitizedProperties:Object.keys(t).reduce((i,n)=>Yn.has(n)?(e.push(n),i):(i[n]=t[n],i),{}),droppedKeys:e}}(this.Xv(e));n.length>0&&gm.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Jv.add(ue({[Jn]:t,[Kn]:(new Date).toISOString()},i))}catch(t){gm.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.Yv(e)){if(this.tf(e))return this.ef("Exception dropped: matched a suppression rule"),void gm.info("Skipping exception capture because a suppression rule matched");if(!this.Kv&&this.if(e))return this.ef("Exception dropped: thrown by a browser extension"),void gm.info("Skipping exception capture because it was thrown by an extension");if(!this.Kv&&this.nf(e))return this.ef("Exception dropped: thrown by an injected browser script"),void gm.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.sf(e))return this.ef("Exception dropped: thrown by the PostHog SDK"),void gm.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this.Zv.enabled&&Re(t.$exception_steps)?this.rf(t):t,n=function(){const t=globalThis._posthogReleaseId;return"string"==typeof t&&t.length>0?t:void 0}();n&&(i.$release_id=n);try{const t=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",oh:!0});return t&&this.Jv.clear(),t}catch(t){return pm(t)||gm.error("Failed to capture exception event. Dropping this exception.",t),void this.Jv.clear()}}catch(t){return void(pm(t)||gm.error("Failed to process exception event. Ignoring this exception.",t))}}rf(t){try{const e=this.Jv.getAttachable();return 0===e.length?t:ue(ue({},t),{},{$exception_steps:e})}catch(e){return gm.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}ef(t){this.Zv.enabled&&this.Jv.add({[Jn]:t,[Kn]:(new Date).toISOString()})}Xv(t){return Ce(t)?ue({},t):{}}Qv(){var t,e;return null!==(t=null===(e=this._instance.config.error_tracking)||void 0===e?void 0:e.exception_steps)&&void 0!==t?t:{}}tf(t){if(0===t.length)return!1;try{const e=t.reduce((t,{type:e,value:i})=>(Ee(e)&&e.length>0&&t.$exception_types.push(e),Ee(i)&&i.length>0&&t.$exception_values.push(i),t),{$exception_types:[],$exception_values:[]});return this.Vv.some(t=>{const i=t.values.map(t=>{const i=pa[t.operator],n=e[t.key];if(!i||!n)return!1;const s=Se(t.value)?t.value:[t.value];return s.length>0&&i(s,n)});return"OR"===t.type?i.some(Boolean):i.every(Boolean)})}catch(t){return gm.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}if(t){const e=t.flatMap(t=>{var e,i;return null!==(e=null===(i=t.stacktrace)||void 0===i?void 0:i.frames)&&void 0!==e?e:[]}),i=e.filter(({filename:t})=>!!t&&_m.some(e=>t.startsWith(e)));return 0!==i.length&&(!i.every(({filename:t})=>!!t&&t.startsWith(mm))||t.some(({type:t,value:e})=>"NoResponse"===t||Ee(e)&&ym.some(({value:t,exact:i})=>i?e===t:e.includes(t)))&&!e.some(({in_app:t,filename:e})=>t&&!(null==e?void 0:e.startsWith(mm))))}nf(t){return t.some(({value:t})=>Ee(t)&&bm.some(e=>t.includes(e)))}sf(t){if(t.length>0){var e,i,n,s;const r=null!==(e=null===(i=t[0].stacktrace)||void 0===i?void 0:i.frames)&&void 0!==e?e:[],o=r[r.length-1];return null!==(n=null==o||null===(s=o.filename)||void 0===s?void 0:s.includes("posthog.com/static"))&&void 0!==n&&n}return!1}Yv(t){return!Re(t)&&Se(t)}}},Bk=ue({productTours:class{get xa(){return this._instance.persistence}constructor(t){this.lf=null,this.af=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if("productTours"in e){var i,n;if(this.xa&&this.xa.register({[P]:!!e.productTours}),!Vw(this._instance))return!this.lf&&Re(null===(i=this.xa)||void 0===i?void 0:i.props.ph_product_tours)||Ww.info("product tours disabled; stopping and clearing cached tours"),null===(n=this.lf)||void 0===n||n.stop(),this.lf=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.lf&&Vw(this._instance)&&this.No(()=>this.uf())}No(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"product-tours",e=>{e?Ww.error("Could not load product tours script",e):t()})}uf(){var t;!this.lf&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.lf=d.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(Se(this.af)&&!e)return void t(this.af,{isLoaded:!0});const i=this.xa;if(i){const n=i.props[pt];if(Se(n)&&!e)return this.af=n,void t(n,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:e=>{if(!Vw(this._instance))return void t([],{isLoaded:!0});const n=e.statusCode;if(200!==n||!e.json){const i=`Product Tours API could not be loaded, status: ${n}`;return 0===n?e.error||Ww.warn(i):Ww.error(i),void t([],{isLoaded:!1,error:i})}const s=Se(e.json.product_tours)?e.json.product_tours:[];this.af=s,i&&i.register({[pt]:s}),t(s,{isLoaded:!0})}})}getActiveProductTours(t){Re(this.lf)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.lf.getActiveProductTours(t)}showProductTour(t){var e;null===(e=this.lf)||void 0===e||e.showTourById(t)}previewTour(t){this.lf?this.lf.previewTour(t):this.No(()=>{var e;this.uf(),null===(e=this.lf)||void 0===e||e.previewTour(t)})}dismissProductTour(){var t;null===(t=this.lf)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.lf)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.lf)||void 0===t||t.previousStep()}clearCache(){var t;this.af=null,null===(t=this.xa)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var e;null===(e=this.lf)||void 0===e||e.resetTour(t)}resetAllTours(){var t;null===(t=this.lf)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var e;null===(e=this.lf)||void 0===e||e.cancelPendingTour(t)}}},Dk),jk={siteApps:class{constructor(t){this._instance=t,this.hf=0,this.cf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}df(t,e){if(!e)return;const i=this.globalsForEvent(e);this.cf.push(i),this.cf.length>1e3&&(this.cf=this.cf.slice(10))}get siteAppLoaders(){var t;return null===(t=d._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.df.bind(this));this.vf=()=>{t(),this.cf=[],this.vf=void 0}}}globalsForEvent(t){var e,i,n,s,r,o,l;if(!t)throw new Error("Event payload is required");const a={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(const[t,e]of Object.entries(h))a[t]={id:u[t],type:t,properties:e};const{$set_once:c,$set:d}=t;return{event:ue(ue({},ys(t,Gw)),{},{properties:ue(ue(ue({},t.properties),d?{$set:ue(ue({},null!==(e=null===(i=t.properties)||void 0===i?void 0:i.$set)&&void 0!==e?e:{}),d)}:{}),c?{$set_once:ue(ue({},null!==(n=null===(s=t.properties)||void 0===s?void 0:s.$set_once)&&void 0!==n?n:{}),c)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(l=t.properties)||void 0===l?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:a}}ff(t){var e;const i=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase();if("style"===i&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(t)||(Zw.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===i&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(t)||(Zw.error("prepare_external_dependency_script returned null"),null)}return t}pf(){var t,e,i,s,r,o,l,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const u=null==n?void 0:n.defaultView,h=null==u||null===(t=u.Node)||void 0===t?void 0:t.prototype;if(!u||!h)return()=>{};if(this.hf++,this.gf)return this.mf();const c=[],d=this,v=new WeakSet,f=(t,e,i)=>{if(!(null==t?void 0:t[e]))return;const n=t[e];t[e]=i(n),c.push(()=>{t[e]=n})},p=t=>{if(v.has(t))return t;const e=d.ff(t);return e&&v.add(e),e},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!Me(t));return f(h,"appendChild",t=>function(e){const i=p(e);return i?t.call(this,i):e}),f(h,"insertBefore",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):e}),f(h,"replaceChild",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):i}),[null===(e=u.Element)||void 0===e?void 0:e.prototype,null===(i=u.Document)||void 0===i?void 0:i.prototype,null===(s=u.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(t=>{f(t,"append",t=>function(...e){return t.apply(this,g(e))}),f(t,"prepend",t=>function(...e){return t.apply(this,g(e))})}),[null===(r=u.Element)||void 0===r?void 0:r.prototype,null===(o=u.CharacterData)||void 0===o?void 0:o.prototype,null===(l=u.DocumentType)||void 0===l?void 0:l.prototype].forEach(t=>{f(t,"before",t=>function(...e){return t.apply(this,g(e))}),f(t,"after",t=>function(...e){return t.apply(this,g(e))}),f(t,"replaceWith",t=>function(...e){const i=g(e);return e.length&&!i.length?void 0:t.apply(this,i)})}),f(null===(a=u.Element)||void 0===a?void 0:a.prototype,"insertAdjacentElement",t=>function(e,i){const n=p(i);return n?t.call(this,e,n):null}),this.gf=()=>{c.forEach(t=>t()),this.gf=void 0},this.mf()}mf(){let t=!1;return()=>{var e;t||(t=!0,this.hf--,0===this.hf&&(null===(e=this.gf)||void 0===e||e.call(this)))}}yf(t,e=!0){const i=this.pf();try{const n=t(i);return e&&i(),n}catch(t){throw i(),t}}setupSiteApp(t){const e=this.apps[t.id],i=()=>{var i;!e.errored&&this.cf.length&&(Zw.info(`Processing ${this.cf.length} events for site app with id ${t.id}`),this.cf.forEach(t=>this.yf(()=>{var i;return null===(i=e.processEvent)||void 0===i?void 0:i.call(e,t)})),e.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null===(i=this.vf)||void 0===i||i.call(this))};let n=!1;const s=s=>{e.errored=!s,e.loaded=!0,Zw.info(`Site app with id ${t.id} ${s?"loaded":"errored"}`),n&&i()};try{const{processEvent:i}=this.yf(e=>t.init({posthog:this._instance,callback(t){e(),s(t)}}),!1);i&&(e.processEvent=i),n=!0}catch(e){Zw.error(Qw+t.id,e),s(!1)}if(n&&e.loaded)try{i()}catch(i){Zw.error(`Error while processing buffered events PostHog app with config id ${t.id}`,i),e.errored=!0}}bf(){const t=this.siteAppLoaders||[];for(const e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(const e of t)this.setupSiteApp(e)}_f(t){if(0===Object.keys(this.apps).length)return;const e=this.globalsForEvent(t);for(const i of Object.values(this.apps))try{this.yf(()=>{var t;return null===(t=i.processEvent)||void 0===t?void 0:t.call(i,e)})}catch(e){Zw.error(`Error while processing event ${t.event} for site app ${i.id}`,e)}}onRemoteConfig(t){var e,i,n;if(null===(e=this.siteAppLoaders)||void 0===e?void 0:e.length)return this.isEnabled?(this.bf(),void this._instance.on("eventCaptured",t=>this._f(t))):void Zw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this.vf)||void 0===i||i.call(this),!t.ok)return;const s=t.config;if(null===(n=s.siteApps)||void 0===n?void 0:n.length)if(this.isEnabled)for(const{id:t,url:e}of s.siteApps){var r,o;d[`__$$ph_site_app_${t}`]=this._instance,null===(r=d.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,e,e=>{if(e)return Zw.error(Qw+t,e)})}else Zw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Hk={tracingHeaders:class{constructor(t){this._instance=t,this.wf=void 0,this.kf=void 0,this.Sf=void 0,this.Lv=()=>{const t=this.xf();var e,i;t?(Te(this.wf)&&(this.wf=null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Te(this.kf)&&(this.kf=null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.zv()}}initialize(){this.startIfEnabledOrStop()}No(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.tracingHeadersPatchFns)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"tracing-headers",e=>{if(e)return Dw.error("failed to load script",e);t()})}Cf(){var t,e;return null!==(t=null!==(e=this._instance.config.tracing_headers)&&void 0!==e?e:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}xf(){const t=this.Cf();return Se(t)?(Se(this.Sf)?this.Sf.splice(0,this.Sf.length,...t):this.Sf=[...t],t.length>0?this.Sf:void 0):(Se(this.Sf)&&this.Sf.splice(0),this.Sf=t||void 0,this.Sf)}zv(){var t,e;null===(t=this.wf)||void 0===t||t.call(this),null===(e=this.kf)||void 0===e||e.call(this),this.wf=void 0,this.kf=void 0}startIfEnabledOrStop(){this.xf()?this.No(this.Lv):this.zv()}}},Uk=ue({surveys:class extends Xw{constructor(t){var e;super(new rk(t),(e=t,{get projectToken(){return e.config.token},kv:new sk(e)})),this._instance=t}Fh(t,e){const i=e.query?Rb(t,e.query):t;return new Promise(t=>{var n;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor(null!==(n=e.target)&&void 0!==n?n:"api",i),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:t})})}}},Dk),zk={toolbar:class{constructor(t){this.instance=t}$f(t){d.ph_toolbar_state=t}Tf(){var t;return null!==(t=d.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,i=void 0,s=void 0){var r,o;if(sr(this.instance.config))return!1;if(!t||!n)return!1;e=null!==(r=e)&&void 0!==r?r:t.location,s=null!==(o=s)&&void 0!==o?o:t.history;try{if(!i){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}i=null==t?void 0:t.localStorage}const n=ok||cr(e.hash,"__posthog")||cr(e.hash,"state");let r;const o=n?hn(()=>JSON.parse(atob(decodeURIComponent(n))))||hn(()=>JSON.parse(decodeURIComponent(n))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):(r=JSON.parse(i.getItem(lk)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}If(t){const e=d.ph_load_toolbar||d.ph_load_editor;!Re(e)&&xe(e)?e(t,this.instance):ak.warn("No toolbar load function found")}loadToolbar(e){const i=!!(null==n?void 0:n.getElementById("__POSTHOG_TOOLBAR__"));if(!t||i)return!1;const s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=ue(ue({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(lk,JSON.stringify(ue(ue({},r),{},{source:void 0}))),2===this.Tf())this.If(r);else if(0===this.Tf()){var o,l;this.$f(1),null===(o=d.__PosthogExtensions__)||void 0===o||null===(l=o.loadExternalDependency)||void 0===l||l.call(o,this.instance,"toolbar",t=>{if(t)return ak.error("[Toolbar] Failed to load",t),void this.$f(0);this.$f(2),this.If(r)}),nr(t,"turbolinks:load",()=>{this.$f(0),this.loadToolbar(r)})}return!0}Mf(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,i=void 0){return this.maybeLoadToolbar(t,e,i)}}},Wk=ue({experiments:class e{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.Ef("retrieved web experiments from the server"),this.Pf=new Map,t.forEach(t=>{if(t.feature_flag_key){var i;this.Pf&&(e.Ef("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=this.Pf)||void 0===i||i.set(t.feature_flag_key,t));const n=this._instance.getFeatureFlag(t.feature_flag_key);Ee(n)&&t.variants[n]&&this.Rf(t.name,n,t.variants[n].transforms)}else if(t.variants)for(const i in t.variants){const n=t.variants[i];e.Af(n,this._instance)&&this.Rf(t.name,i,n.transforms)}})},t)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.Ef(yk);else if(!this.Mr.disable_web_experiments){if(Re(this.Pf))return this.Pf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Ef("applying feature flags",t),t.forEach(t=>{var e;if(this.Pf&&(null===(e=this.Pf)||void 0===e?void 0:e.has(t))){var i;const e=this._instance.getFeatureFlag(t),n=null===(i=this.Pf)||void 0===i?void 0:i.get(t);e&&(null==n?void 0:n.variants[e])&&this.Rf(n.name,e,n.variants[e].transforms)}})}}previewWebExperiment(){const t=e.getWindowLocation();if(null==t?void 0:t.search){const i=ur(null==t?void 0:t.search,"__experiment_id"),n=ur(null==t?void 0:t.search,"__experiment_variant");i&&n&&(e.Ef(`previewing web experiments ${i} && ${n}`),this.getWebExperiments(t=>{this.Ff(parseInt(i),n,t)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Mr.disable_web_experiments&&!i)return t([]);const n=this._instance.get_property("$web_experiments");if(n&&!e)return t(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Mr.token}`),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Ff(t,i,n){const s=n.filter(e=>e.id===t);s&&s.length>0&&(e.Ef(`Previewing web experiment [${s[0].name}] with variant [${i}]`),this.Rf(s[0].name,i,s[0].variants[i].transforms))}static Af(t,i){return!Re(t.conditions)&&e.Of(t,i)&&e.Df(t)}static Of(t,i){var n;if(Re(t.conditions)||Re(null===(n=t.conditions)||void 0===n?void 0:n.url))return!0;const s=e.getWindowLocation();if(s){var r,o,l;const e=fr(i,s.href);return!(null===(r=t.conditions)||void 0===r?void 0:r.url)||_k[null!==(o=null===(l=t.conditions)||void 0===l?void 0:l.urlMatchType)&&void 0!==o?o:"icontains"](t.conditions.url,e)}return!1}static getWindowLocation(){return null==t?void 0:t.location}static Df(t){var e;if(Re(t.conditions)||Re(null===(e=t.conditions)||void 0===e?void 0:e.utm))return!0;const i=Ia();if(i.utm_source){var n,s,r,o,l,a,u,h;const e=!(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)||(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)==i.utm_campaign,c=!(null===(r=t.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=t.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==i.utm_source,d=!(null===(l=t.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)||(null===(a=t.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)==i.utm_medium,v=!(null===(u=t.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)||(null===(h=t.conditions)||void 0===h||null===(h=h.utm)||void 0===h?void 0:h.utm_term)==i.utm_term;return e&&d&&v&&c}return!1}static Ef(t,...e){Vs.info(`[WebExperiments] ${t}`,e)}Rf(t,i,n){this._is_bot()?e.Ef(yk):"control"!==i?n.forEach(n=>{if(n.selector){var s;e.Ef(`applying transform of variant ${i} for experiment ${t} `,n);const r=null===(s=document)||void 0===s?void 0:s.querySelectorAll(n.selector);null==r||r.forEach(t=>{const e=t;n.html&&(e.innerHTML=n.html),n.css&&e.setAttribute("style",n.css)})}}):e.Ef("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?iw(i,this.Mr.custom_blocked_useragents):void 0}}},Dk),Vk={conversations:class{constructor(t){this._instance=t,this.Lf=void 0,this._conversationsManager=null,this.Nf=!1,this.ne=null,this.qf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return;if(this.jf=t.ok,!t.ok)return;const e=t.config.conversations;Re(e)||(Ae(e)?this.Lf=e:(this.Lf=e.enabled,this.ne=e),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.Lf=void 0,this.ne=null,this.jf=void 0,this.qf=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this.Nf)return;if(this._instance.config.disable_conversations)return;if(sr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==d?void 0:d.__PosthogExtensions__;if(t&&!Te(this.Lf)&&this.Lf)if(this.ne&&this.ne.token){this.Nf=!0;try{const e=t.initConversations;if(e)return this.Bf(e),void(this.Nf=!1);const i=t.loadExternalDependency;if(!i)return void this.Hf(Zt);i(this._instance,"conversations",e=>{e||!t.initConversations?this.Hf("Could not load conversations script",e):this.Bf(t.initConversations),this.Nf=!1})}catch(t){this.Hf("Error initializing conversations",t),this.Nf=!1}}else bk.error("Conversations enabled but missing token in remote config.")}Bf(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.qf=!1,bk.info("Conversations loaded successfully")}catch(t){this.Hf("Error completing conversations initialization",t)}else bk.error("Cannot complete initialization: remote config is null")}Hf(t,e){bk.error(t,e),this._conversationsManager=null,this.Nf=!1,this.qf=!0}show(){this._conversationsManager?this._conversationsManager.show():bk.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Lf&&!Me(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":sr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.jf?"remote_config_failed":Te(this.Lf)?this.jf?"disabled_in_project":"remote_config_pending":this.Lf?Re(this.ne)||!this.ne.token?"missing_token":(null==d?void 0:d.__PosthogExtensions__)?this.Nf?"initializing":this.qf?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,e,i){var n=this;return re(function*(){return n._conversationsManager?n._conversationsManager.sendMessage(t,e,i):(bk.warn(wk),null)})()}getMessages(t,e){var i=this;return re(function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(bk.warn(wk),null)})()}markAsRead(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(bk.warn(wk),null)})()}getTickets(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(bk.warn(wk),null)})()}requestRestoreLink(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(bk.warn(wk),null)})()}restoreFromToken(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(bk.warn(wk),null)})()}restoreFromUrlToken(){var t=this;return re(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(bk.warn(wk),null)})()}getCurrentTicketId(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}yh(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}bh(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}}},Gk={logs:class{constructor(e){var i;this._instance=e,this.name=Op,this.zf=!1,this.Uf=!1,this.Wf=!1,this.$=Gs("[logs]"),this.Vf=ue(ue({},this.$),{},{error:(...t)=>{t.some(Tk)||this.$.error(...t)}}),this.ia=[],this.Gf=[],this.rd=0,this.So=!1,this.Zf=[],this.Qf=[],this.Jf=!1,this.Kf=!1,this.Xf=()=>{var t,e;this.So||(this.rd=0,null===(t=this.Yf)||void 0===t||t.onReconnect(),null===(e=this.tp)||void 0===e||e.onReconnect())},this._instance&&(null===(i=this._instance.config.logs)||void 0===i?void 0:i.captureConsoleLogs)&&(this.zf=!0),t&&nr(t,"online",this.Xf)}ep(t,e,i,n){var s;const r=kk(null===(s=this._instance)||void 0===s||null===(s=s.config)||void 0===s?void 0:s.logs,i);return[new Ls(this.np(t,e),r,this.Vf,()=>this.sp(),t=>t(),void 0,n),r]}rp(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs;var i;return this.Yf&&this.op===e||(null===(i=this.Yf)||void 0===i||i.reset(),this.op=e,[this.Yf,this.lp]=this.ep(()=>this.ia,t=>{this.ia=t})),this.Yf}ap(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs;var i;return this.tp&&this.up===e||(null===(i=this.tp)||void 0===i||i.reset(),this.up=e,[this.tp,this.hp]=this.ep(()=>this.Gf,t=>{this.Gf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},xk)),this.tp}setup(t){var e;if(this.So)return;this.po=t,(null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.logs)||void 0===e?void 0:e.captureConsoleLogs)&&(this.zf=!0),(this.zf||this.cp()&&this.dp())&&this.vp();let i=!1;const n=t.onRemoteConfig(t=>{var e;i=t.ok&&!0===(null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs),this.onRemoteConfig(t)});this.So?n.dispose():(this.$o=n,i||this.loadIfEnabled())}dispose(){var e,i,n,s;this.So||(this.So=!0,this.fp(),null===(e=this.$o)||void 0===e||e.dispose(),this.$o=void 0,this.po=void 0,this.Wf=!1,null==t||t.removeEventListener("online",this.Xf),null===(i=this.pp)||void 0===i||i.call(this),this.pp=void 0,null===(n=this.Yf)||void 0===n||n.reset(),null===(s=this.tp)||void 0===s||s.reset())}onRemoteConfig(t){var e,i;if(this.So)return;const n=t.ok?null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs:void 0;Re(n)?this.gp():(null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$logs_capture_enabled_server_side:!!n}),n?(this.zf=!0,this.Uf||this.vp(),this.loadIfEnabled()):this.gp())}reset(){var t,e,i,n;this.fp(),null===(t=this.Yf)||void 0===t||t.clearQueue(),this.ia=[],null===(e=this.Yf)||void 0===e||e.reset(),null===(i=this.tp)||void 0===i||i.clearQueue(),this.Gf=[],null===(n=this.tp)||void 0===n||n.reset(),this.rd=0}captureLog(t){this.So||this.rp().captureLog(t)}captureConsoleLog(t){this.So||this.ap().captureLog(t)}captureBufferedConsoleLog(t,e,i){this.So||this.ap().captureLog(t,{context:e,occurredAtMs:i})}dp(){var t;return!!(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t[O])}cp(){var t,e,i;return!(null===(t=this._instance)||void 0===t||null===(e=t.Xl)||void 0===e?void 0:e.call(t))||!!(null===(i=d._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[this._instance.config.token])||void 0===i?void 0:i.config)}wh(){var t;this.fp(),null===(t=this.tp)||void 0===t||t.clearQueue(),this.Gf=[]}gp(){this.zf||this.fp()}vp(){var t;if(this.Jf||!(null==d?void 0:d.console))return;const e=kk(null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs).maxBufferSize;let i=!0;this.Qf.push(()=>{i=!1});for(const t of Sk){let n;try{n=im(d.console[t])}catch(t){continue}n&&this.Qf.push(wv(d.console,t,s=>{const r=(...n)=>{try{i&&this.mp(t,n,e)}catch(t){}return s.apply(d.console,n)};return r.__rrweb_original__=n,r}))}this.Jf=!0,this.yp=setTimeout(()=>{this.fp()},3e4)}mp(t,e,i){var n;if(this.Jf&&!this.Kf&&0!==e.length)if(null===(n=this._instance)||void 0===n?void 0:n.is_capturing()){if(i>this.Zf.length){this.Kf=!0;try{this.Zf.push({level:t,args:e,occurredAtMs:Date.now(),context:this.sp()})}finally{this.Kf=!1}}}else this.fp()}fp(){if(this.Zf=[],this.Jf){this.Jf=!1,this.yp&&(clearTimeout(this.yp),this.yp=void 0);for(const t of this.Qf)t();this.Qf=[]}}bp(){const t=this.Zf;return this.fp(),t}get logger(){return this._p||(this._p={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this._p}flushLogs(t){t?this.wp(t):(this.Yf&&this.Yf.flush().catch(t=>this.kp(t)),this.tp&&this.tp.flush().catch(t=>this.kp(t)))}kp(t){Tk(t)||this.$.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.So||!this.zf||this.Uf||this.Wf)return;const t=null==d?void 0:d.__PosthogExtensions__;if(!t)return this.$.error("PostHog Extensions not found."),void this.fp();const e=t.loadExternalDependency;if(!e)return this.$.error(Zt),void this.fp();this.Wf=!0;try{e(this._instance,"logs",e=>{if(this.Wf=!1,this.So||!this.zf)return;const i=t.logs;if(e||!(null==i?void 0:i.initializeLogs))this.$.error("Could not load logs script",e),this.fp();else{var n;const t=this.bp();var s,r;this.pp=i.initializeLogs(null!==(n=this.po)&&void 0!==n?n:this._instance),this.Uf=!0,t.length>0&&(null===(s=i.replayConsoleBuffer)||void 0===s||s.call(i,null!==(r=this.po)&&void 0!==r?r:this._instance,t))}})}catch(t){throw this.Wf=!1,t}}np(t,e){const i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===he.LogsQueue?t():void 0,setPersistedProperty(t,i){var n;t===he.LogsQueue&&e(null!==(n=i)&&void 0!==n?n:[])},js:t=>this.js(t),getLibraryId:()=>Yl.LIB_NAME,getLibraryVersion:()=>Yl.LIB_VERSION}}js(t){return new Promise(e=>{if(dr(this.rd,3))return void e({kind:"fatal",error:$k(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const n=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),n({kind:"retry-later",error:$k(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Sp(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{const e=t.statusCode;if(this.xp(e),e>=200&&300>e)n({kind:"ok"});else if(413===e)n({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)n({kind:"fatal",error:new Error(`logs request failed with status ${e}`)});else{var i;0===e?(t.error||this.$.warn("Logs request failed before receiving an HTTP response"),n({kind:"retry-later",error:$k(t.error,"logs request failed before receiving an HTTP response")})):n({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`logs request failed with status ${e}`)})}}})})}xp(t){(0!==t||this._instance.__loaded)&&(this.rd=vr(t,this.rd,3,()=>this.$.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}wp(t){this.ia.length>0&&this.Cp(t,this.ia,this.lp,Yl.LIB_NAME,t=>{this.ia=t}),this.Gf.length>0&&this.Cp(t,this.Gf,this.hp,xk,t=>{this.Gf=t})}Cp(t,e,i,n,s){if(0===e.length)return;const r=e.map(t=>t.record);s([]);const o=Os(r,Ps(i,Yl.LIB_NAME,Yl.LIB_VERSION),n,Yl.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Sp(),data:o,compression:"best-available",batchKey:"logs",transport:t})}Sp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}sp(){var t;const e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:t,windowId:i,sessionStartTimestamp:n,lastActivityTimestamp:s}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=t,e.windowId=i,Re(n)||(e.sessionStartTimestamp=n),Re(s)||(e.lastActivityTimestamp=s)}if((null==d||null===(t=d.location)||void 0===t?void 0:t.href)&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?un(d.location.href):d.location.href),this._instance.featureFlags){const t=this._instance.featureFlags.getFlags();t&&t.length>0&&(e.activeFeatureFlags=t)}return e}}},Zk={metrics:class{constructor(t){this._instance=t,this.$=Gs("[metrics]"),this.So=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.So)return;const e=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);e&&!this.$p?this.$p=(t=>{let e=!0;const i=()=>e?(t=>{var e;const i=null===(e=t.config.metrics)||void 0===e?void 0:e.network;return!0===i?{}:i||void 0})(t):void 0,n=Ak(t,i),s=Fk(t,i);return()=>{e=!1,n(),s()}})(this._instance):!e&&this.$p&&(this.$p(),this.$p=void 0)}rp(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;var i;return this.Yf&&this.op===e||(null===(i=this.Yf)||void 0===i||i.reset(),this.op=e,this.Yf=new js(this.np(),function(t){var e,i,n,s,r;const o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(e=null==o?void 0:o["service.name"])&&void 0!==e?e:null==t?void 0:t.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==t?void 0:t.serviceVersion,environment:null!==(n=null==o?void 0:o["deployment.environment"])&&void 0!==n?n:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(r=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(e),this.$)),this.Yf}count(t,e=1,i){this.rp().count(t,e,i)}gauge(t,e,i){this.rp().gauge(t,e,i)}histogram(t,e,i){this.rp().histogram(t,e,i)}flush(t){if(!this.Yf)return Promise.resolve();if(t){const e=this.Yf.drainWindow();return e&&this.Ys(e,t),Promise.resolve()}return this.Yf.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.Yf)||void 0===t||t.reset()}dispose(){var t,e;this.So=!0,null===(t=this.$p)||void 0===t||t.call(this),this.$p=void 0,null===(e=this.Yf)||void 0===e||e.reset()}np(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ys:t=>e.Ys(t),getLibraryId:()=>Yl.LIB_NAME,getLibraryVersion:()=>Yl.LIB_VERSION}}Ys(t,e){return new Promise(i=>{let n=!1;const s=t=>{n||(n=!0,clearTimeout(r),i(t))},r=setTimeout(()=>s({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(ue(ue({method:"POST",url:this.Tp(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e}),{},{fireCallbackOnDrop:!0,callback(t){const e=t.statusCode;if(e>=200&&300>e)s({kind:"ok"});else if(413===e)s({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)s({kind:"fatal",error:new Error(`metrics request failed with status ${e}`)});else{var i;s({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`metrics request failed with status ${e}`)})}}}))})}Tp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};Ow.__defaultExtensionClasses=ue({},ue(ue(ue(ue(ue(ue(ue(ue(ue(ue(ue(ue(ue({},Dk),Lk),Nk),qk),Bk),jk),Uk),Hk),zk),Wk),Vk),Gk),Zk));const Qk=function(){Yl.SDK_DIST_CHANNEL="npm";const e=gw[Tw]=new Ow;return function(){function e(){e.done||(e.done=!0,zb=!1,Qs(gw,function(t){t._dom_loaded()}))}(null==n?void 0:n.addEventListener)?"complete"===n.readyState?e():nr(n,"DOMContentLoaded",e,{capture:!1}):t&&Vs.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();var Jk=Qk;exports.Compression=hp,exports.DEFAULT_PRODUCT_TOUR_APPEARANCE={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},exports.DisplaySurveyType=wp,exports.PostHog=Ow,exports.ProductTourEventName=_b,exports.ProductTourEventProperties=bb,exports.SurveyEventName=_p,exports.SurveyEventProperties=bp,exports.SurveyEventType=cp,exports.SurveyPosition=vp,exports.SurveyQuestionBranchingType=mp,exports.SurveyQuestionType=gp,exports.SurveySchedule=yp,exports.SurveyTabPosition=fp,exports.SurveyType=pp,exports.SurveyWidgetType=dp,exports.default=Jk,exports.posthog=Qk,exports.severityLevels=["fatal","error","warning","log","info","debug"];
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="u">typeof window?window:void 0,e="u">typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,n=null==e?void 0:e.document,s=null==e?void 0:e.location,r=null==e?void 0:e.fetch,o=(null==e?void 0:e.XMLHttpRequest)&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,l=null==e?void 0:e.AbortController,a=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent;function h(){return!(!t||!1===t.navigator.onLine)}const c="undefined"!=typeof globalThis?globalThis:t;c&&"undefined"==typeof self&&(c.self=c),c&&"undefined"==typeof File&&(c.File=function(){});const d=null!=t?t:{},v="$people_distinct_id",f="distinct_id",p="$device_id",g="$device_model",m="__alias",y="__cmpns",_="$fbc",b="$fbc_persistence",w="$fbp",k="$fbp_persistence",S="__timers",x="$autocapture_disabled_server_side",C="$heatmaps_enabled_server_side",T="$exception_capture_enabled_server_side",E="$error_tracking_suppression_rules",I="$error_tracking_capture_extension_exceptions",M="$web_vitals_enabled_server_side",R="$dead_clicks_enabled_server_side",P="$product_tours_enabled_server_side",O="$logs_capture_enabled_server_side",A="$web_vitals_allowed_metrics",F="$session_recording_remote_config",D="$session_recording_enabled_server_side",L="$replay_sample_rate",N="$replay_override_sampling",q="$replay_override_linked_flag",B="$replay_override_url_trigger",j="$replay_override_event_trigger",H="$sesid",U="$session_is_sampled",z="$session_past_minimum_duration",W="$session_recording_url_trigger_activated_session",V="$session_recording_event_trigger_activated_session",G="$posthog_sr_group_event_trigger_",Z="$posthog_sr_group_url_trigger_",Q="$posthog_sr_group_sampling_",J="$debug_first_full_snapshot_timestamp",K="$sess_rec_flush_size",Y="$enabled_feature_flags",X="$active_feature_flags",tt="$early_access_features",et="$feature_flag_details",it="$feature_flag_payloads",nt="$feature_flag_request_id",st="$minimal_flag_called_events",rt="$override_feature_flags",ot="$override_feature_flag_payloads",lt="$stored_person_properties",at="$stored_group_properties",ut="$groups",ht="$surveys",ct="$surveys_loaded_at",dt="$surveys_activated",vt="$surveys_activated_session",ft="$surveys_activated_timestamps",pt="ph_product_tours",gt="$product_tours_activated",mt="$product_tours_activated_session",yt="$conversations_widget_session_id",_t="$conversations_ticket_id",bt="$conversations_widget_state",wt="$conversations_user_traits",kt="$flag_call_reported",St="$flag_call_reported_session_id",xt="$feature_flag_errors",Ct="$feature_flag_evaluated_at",$t="$user_state",Tt="$client_session_props",Et="$capture_rate_limit",It="$initial_campaign_params",Mt="$initial_referrer_info",Rt="$initial_person_info",Pt="$epp",Ot="$posthog_cookieless",At="$cookieless_mode",Ft="$sdk_debug_extensions_init_method",Dt="$sdk_debug_extensions_init_time_ms",Lt="$sdk_debug_recording_script_not_loaded",Nt="$sdk_debug_replay_event_trigger_status",qt="$sdk_debug_replay_linked_flag_trigger_status",Bt="$sdk_debug_replay_matched_recording_trigger_groups",jt="$sdk_debug_replay_pending_trigger_conditions",Ht="$sdk_debug_replay_remote_trigger_matching_config",Ut="$sdk_debug_replay_trigger_groups_count",zt="$sdk_debug_replay_url_trigger_status",Wt="$sdk_debug_rrweb_attached",Vt="$sdk_debug_rrweb_start_attempted",Gt="$session_recording_start_reason",Zt="PostHog loadExternalDependency extension not found.",Qt="anonymous",Jt="identified",Kt="identified_only",Yt="visibilitychange",Xt="beforeunload",te="$pageview",ee="$pageleave",ie="$identify",ne="$groupidentify";function se(t,e,i,n,s,r,o){try{var l=t[r](o),a=l.value}catch(t){return void i(t)}l.done?e(a):Promise.resolve(a).then(n,s)}function re(t){return function(){var e=this,i=arguments;return new Promise(function(n,s){var r=t.apply(e,i);function o(t){se(r,n,s,o,l,"next",t)}function l(t){se(r,n,s,o,l,"throw",t)}o(void 0)})}}function oe(t){return oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},oe(t)}function le(t,e,i){return(e=function(t){var e=function(t){if("object"!=oe(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=oe(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==oe(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ae(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function ue(t){for(var e=1;arguments.length>e;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ae(Object(i),!0).forEach(function(e){le(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ae(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}var he=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),ce=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const de="min_length",ve="max_length",fe=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],pe=["token"];function ge(t,e){return-1!==t.indexOf(e)}const me=function(t){return t.trim()},ye=function(t){return t.replace(/^\$/,"")};function _e(t){var e;const i=[];return null!==(e=JSON.stringify(t,function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(e))return"[Circular]";i.push(e)}return e}}))&&void 0!==e?e:"null"}const be=Object.prototype,we=be.hasOwnProperty,ke=be.toString,Se=Array.isArray||function(t){return"[object Array]"===ke.call(t)},xe=t=>"function"==typeof t,Ce=t=>t===Object(t)&&!Se(t),$e=t=>{if(Ce(t)){for(const e in t)if(we.call(t,e))return!1;return!0}return!1},Te=t=>void 0===t,Ee=t=>"[object String]"==ke.call(t),Ie=t=>Ee(t)&&0===t.trim().length,Me=t=>null===t,Re=t=>Te(t)||Me(t),Pe=t=>"[object Number]"==ke.call(t)&&t==t,Oe=t=>Pe(t)&&t>0,Ae=t=>"[object Boolean]"===ke.call(t),Fe=t=>t instanceof FormData,De=t=>ge(fe,t),Le=t=>ge(pe,t);function Ne(t){return null===t||"object"!=typeof t}function qe(t,e){return{}.toString.call(t)===`[object ${e}]`}function Be(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return He(t,Error)}}function je(t){return"u">typeof Event&&He(t,Event)}function He(t,e){try{return t instanceof e}catch(t){return!1}}const Ue=[!0,"true",1,"1","yes"],ze=t=>ge(Ue,t),We=[!1,"false",0,"0","no"],Ve=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Ge=function(t,e=[]){if(!t)return!1;const i=t.toLowerCase();return Ve.concat(e).some(t=>{const e=t.toLowerCase();return-1!==i.indexOf(e)})};function Ze(t,e,i,n,s){return e>i&&(n.warn("min cannot be greater than max."),e=i),Pe(t)?t>i?(n.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(n.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(n.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Ze(null!=s?s:i,e,i,n))}var Qe=class{constructor(t){this.C={},this.I=t.I,this.R=Ze(t.bucketSize,0,100,t.$),this.A=Ze(t.refillRate,0,this.R,t.$),this.O=Ze(t.refillInterval,0,864e5,t.$)}F(t,e){const i=Math.floor((e-t.lastAccess)/this.O);i>0&&(t.tokens=Math.min(t.tokens+i*this.A,this.R),t.lastAccess=t.lastAccess+i*this.O)}consumeRateLimit(t){var e;const i=Date.now(),n=String(t);let s=this.C[n];return s?this.F(s,i):(s={tokens:this.R,lastAccess:i},this.C[n]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null===(e=this.I)||void 0===e||e.call(this,t)),0===s.tokens)}stop(){this.C={}}};const Je="Mobile",Ke="Android",Ye="Tablet",Xe="Android Tablet",ti="iPad",ei="Apple Watch",ii="Safari",ni="BlackBerry",si="Samsung Internet",ri="Chrome",oi="Chrome iOS",li="Internet Explorer",ai="Internet Explorer Mobile",ui="Opera",hi="Microsoft Edge",ci="Firefox",di="Firefox iOS",vi="Nintendo",fi="PlayStation",pi="Xbox",gi="Android Mobile",mi="Mobile Safari",yi="Windows",_i="Windows Phone",bi="Nokia",wi="Ouya",ki="Generic "+Je.toLowerCase(),Si="Generic "+Ye.toLowerCase(),xi="Konqueror",Ci="Oculus Browser",$i="Vivaldi",Ti="Yandex",Ei="Whale",Ii="DuckDuckGo",Mi="Pale Moon",Ri="Waterfox",Pi="Brave",Oi="Claude",Ai="Codex",Fi="ChatGPT",Di="Google Search App",Li=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ni=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),qi=new RegExp(pi,"i"),Bi=new RegExp("PlayStation \\w+","i"),ji=new RegExp("Nintendo \\w+","i"),Hi=new RegExp("BlackBerry|PlayBook|BB10","i"),Ui={"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"},zi=function(t,e,i,n){e=e||"";const s=function(t){return(null==t?void 0:t.brave)?Pi:null}(i);return s||((null==n?void 0:n.detectGoogleSearchApp)&&ge(t,"GSA/")?Di:ge(t," OPR/")&&ge(t,"Mini")?"Opera Mini":ge(t," OPR/")?ui:Hi.test(t)?ni:ge(t,"IEMobile")||ge(t,"WPDesktop")?ai:ge(t,"OculusBrowser")?Ci:ge(t,"SamsungBrowser")?si:ge(t,"Edge")||ge(t,"Edg/")?hi:ge(t,"Vivaldi/")?$i:ge(t,"YaBrowser/")?Ti:ge(t,"Whale/")?Ei:ge(t,"DuckDuckGo/")||ge(t,"Ddg/")?Ii:ge(t,"Claude/")?Oi:ge(t,"Codex/")?Ai:ge(t,"ChatGPT/")?Fi:ge(t,"FBIOS")?"Facebook Mobile":ge(t,"UCWEB")||ge(t,"UCBrowser")?"UC Browser":ge(t,"CriOS")?oi:ge(t,"CrMo")||ge(t,ri)?ri:ge(t,Ke)&&ge(t,ii)?gi:ge(t,"FxiOS")?di:ge(t.toLowerCase(),xi.toLowerCase())?xi:ge(t,"Brave/")?Pi:((t,e)=>e&&ge(e,"Apple")||function(t){return ge(t,ii)&&!ge(t,ri)&&!ge(t,Ke)}(t))(t,e)?ge(t,Je)?mi:ii:ge(t,"PaleMoon/")?Mi:ge(t,"Waterfox/")?Ri:ge(t,ci)?ci:ge(t,"MSIE")||ge(t,"Trident/")?li:ge(t,"Gecko")?ci:"")},Wi={[ai]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[hi]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[ri]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[oi]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[ii]:[Li],[mi]:[Li],[ui]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ci]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[di]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[xi]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ni]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Li],[gi]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[si]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Ci]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[$i]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ti]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Ei]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Pi]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Oi]:[Ni],[Ai]:[Ni],[Fi]:[Ni],[Ii]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Mi]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Ri]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Di]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[li]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Vi=function(t,e,i,n){const s=zi(t,e,i,n),r=Wi[s];if(Te(r))return null;for(let e=0;r.length>e;e++){const i=t.match(r[e]);if(i)return parseFloat(i[i.length-2])}return null},Gi=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[pi,t&&t[1]||""]],[new RegExp(vi,"i"),[vi,""]],[new RegExp(fi,"i"),[fi,""]],[Hi,[ni,""]],[new RegExp(yi,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[_i,""];if(new RegExp(Je).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){let t=Ui[i[1]]||"";return/arm/i.test(e)&&(t="RT"),[yi,t]}return[yi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let e="";return t&&t.length>=3&&(e=Te(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Ke,[t[2],t[3],t[4]||"0"].join(".")]:[Ke,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Zi=function(t){for(let e=0;Gi.length>e;e++){const[i,n]=Gi[e],s=i.exec(t),r=s&&(xe(n)?n(s,t):n);if(r)return r}return["",""]},Qi=function(t){return ji.test(t)?vi:Bi.test(t)?fi:qi.test(t)?pi:new RegExp(wi,"i").test(t)?wi:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?_i:/iPad/.test(t)?ti:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ei:Hi.test(t)?ni:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(bi,"i").test(t)?bi:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Je).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Ke:Xe:new RegExp("(pda|Mobile)","i").test(t)?ki:new RegExp(Ye,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?Si:""},Ji=function(t,e){var i;const n=Qi(t);return n===ti||n===Xe||"Kobo"===n||"Kindle Fire"===n||n===Si?Ye:n===vi||n===pi||n===fi||n===wi?"Console":n===ei?"Wearable":n?Je:"Android"===(null==e?void 0:e.userAgentDataPlatform)&&(null!==(i=null==e?void 0:e.maxTouchPoints)&&void 0!==i?i:0)>0?600>Math.min(null!==(s=null==e?void 0:e.screenWidth)&&void 0!==s?s:0,null!==(r=null==e?void 0:e.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==e?void 0:e.devicePixelRatio)&&void 0!==o?o:1)?Je:Ye:"Desktop";var s,r,o},Ki=/\bFBAV\/(\d+(?:\.\d+)*)/i,Yi=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Ki],[/\bFBAN\/EMA\b/i,"Facebook Lite",Ki],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Ki],[/\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"]],Xi="[Truncated]",tn="[Unserializable]";function en(t){let e="";for(let i=0;t.length>i;i++){const n=t.charCodeAt(i);if(55296>n||n>56319)e+=56320>n||n>57343?t[i]:"�";else{const n=t.charCodeAt(i+1);56320>n||n>57343?e+="�":(e+=t[i]+t[i+1],i++)}}return e}function nn(t,e){if(!e)return t;let i=[];try{i=Object.keys(e)}catch(t){i=[]}for(const n of i){let i;try{i=e[n]}catch(t){i=tn}Object.defineProperty(t,n,{value:i,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;const sn=3e5;var rn=class{record(t){if("too-large"===t.kind)return;if("retry-later"!==t.kind)return void this.reset();if(!t.retryAfterMs)return;const e=this.isOpen(),i=Date.now(),n=Math.min(t.retryAfterMs,sn);if(!e)return this.ts=i,void(this.es=i+n);this.es=Math.max(this.es,Math.min(i+n,this.ts+sn))}remainingMs(){const t=Date.now();if(this.ts-5e3>t)return this.reset(),0;const e=Math.min(sn,Math.max(0,this.es-t));return 0===e&&this.reset(),e}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const on=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ln(t,e){return"string"==typeof(i=t)&&on.test(i)?t:e();var i}function an(t,e){const i=new Error(e);try{Object.defineProperty(i,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return i}function un(t){return t?t.split("#")[0]:t}function hn(t){try{return t()}catch(t){return}}function cn(t,e){const i=setTimeout(t,e);return null!=i&&i.unref&&(null==i||i.unref()),i}function dn(t,e,i){return vn.apply(this,arguments)}function vn(){return(vn=re(function*(t,e,i){let n;try{return yield Promise.race([t,new Promise((t,s)=>{n=cn(()=>{try{null==i||i(),t()}catch(t){s(t)}},e)})])}finally{clearTimeout(n)}})).apply(this,arguments)}let fn,pn,gn;function mn(t){const e=globalThis._posthogChunkIds;if(!e)return;const i=Object.keys(e);return gn&&i.length===pn||(pn=i.length,gn=i.reduce((i,n)=>{fn||(fn={});const s=fn[n];if(s)i[s[0]]=s[1];else{const s=t(n);for(let t=s.length-1;t>=0;t--){const r=s[t],o=null==r?void 0:r.filename,l=e[n];if(o&&l){i[o]=l,fn[n]=[o,l];break}}}return i},{})),gn}var yn=class{constructor(t,e,i=[]){this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e={}){const i=e&&e.mechanism||{handled:!0,type:"generic"},n=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),r=this.parseStacktrace(n,s);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(t){var e=this;return re(function*(){for(const i of t)i.stacktrace&&i.stacktrace.frames&&Se(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t})()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null===(e=t.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){let i,n;return null!=t.cause&&(i=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(n=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),ue(ue({},t),{},{cause:i,stack:n})}applyChunkIds(t,e){return t.map(t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t))}applyCoercers(t,e){for(const i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return re(function*(){let i=t;for(const t of e.modifiers)i=yield t(i);return i})()}convertToExceptionList(t,e){var i,n,s;const r={type:t.type,value:t.value,mechanism:{type:null!==(i=e.type)&&void 0!==i?i:"generic",handled:null===(n=e.handled)||void 0===n||n,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(r.stacktrace={type:"raw",frames:t.stack});const o=[r];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,ue(ue({},e),{},{handled:!0}))),o}buildParsingContext(t){var e;return{chunkIdMap:mn(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,i=0){const n=(i,n)=>{if(4>=n){const s=this.buildCoercingContext(t,e,n);return this.applyCoercers(i,s)}};return ue(ue({},e),{},{syntheticException:0==i?e.syntheticException:void 0,mechanism:t,apply:t=>n(t,i),next:t=>n(t,i+1)})}};const _n=/^([a-z][a-z0-9.+-]+):/i,bn=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function wn(t){if(!t||"<anonymous>"===t)return!1;const e=_n.exec(t);return!e||bn.includes(e[1].toLowerCase())}function kn(t,e,i,n,s){const r={platform:t,filename:e,function:"<anonymous>"===i?"?":i,in_app:wn(e)};return Te(n)||(r.lineno=n),Te(s)||(r.colno=s),r}const Sn=(t,e)=>{const i=-1!==t.indexOf("safari-extension"),n=-1!==t.indexOf("safari-web-extension");return i||n?[-1!==t.indexOf("@")?t.split("@")[0]:"?",i?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},xn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Cn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,$n=/\((\S*)(?::(\d+))(?::(\d+))\)/,Tn=(t,e)=>{const i=xn.exec(t);if(i){const[,t,n,s]=i;return kn(e,t,"?",+n,+s)}const n=Cn.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){const t=$n.exec(n[2]);t&&(n[2]=t[1],n[3]=t[2],n[4]=t[3])}const[t,i]=Sn(n[1]||"?",n[2]);return kn(e,i,t,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},En=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,In=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Mn=(t,e)=>{const i=En.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const t=In.exec(i[3]);t&&(i[1]=i[1]||"eval",i[3]=t[1],i[4]=t[2],i[5]="")}let t=i[3],n=i[1]||"?";return[n,t]=Sn(n,t),kn(e,t,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Rn=/\(error: (.*)\)/;function Pn(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function On(t){for(let e=1;10>=e;e++){const i=t.length-2*e;if(0>i)break;let n=!0;for(let s=0;e>s;s++)if(!Pn(t[i+s],t[i+e+s])){n=!1;break}if(n){for(let n=0;e>n;n++)t[i+n]=t[i+e+n];return t.length=i+e,{start:i,length:e}}}}function An(t,e){const i=e.start+e.length,n=Dn(t,e);n&&t.splice(i+n===t.length?i:e.start,n)}function Fn(t,e){let i=e.start;for(;i>0&&Pn(t[i-1],t[i-1+e.length]);)i--;return e.start-i}function Dn(t,e){const i=e.start+e.length;let n=i;for(;t.length>n&&Pn(t[n],t[n-e.length]);)n++;return n-i}function Ln(t,e){const i=e[0];let n=t.length-(i?Fn(t,i):0);for(const i of e)n-=Dn(t,i);return n}function Nn(t,e,i){for(let n=0;t.length>n;n++){const s=t[(e+n)%t.length],r=t[(i+n)%t.length];if(s!==r)return r>s}return!1}var qn=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){const i=Ee(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){const e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${e}: ${t.message}`:e}isDOMException(t){return qe(t,"DOMException")}isDOMError(t){return qe(t,"DOMError")}},Bn=class{match(t){return Be(t)}coerce(t,e){var i;const n=this.getStack(t),s=void 0===n;return{type:this.getType(t),value:this.getMessage(t,e),stack:null!=n?n:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,cause:t.cause?e.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,e){const i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}},jn=class{match(t){return!!qe(t,"ErrorEvent")&&(null!=t.error||this.lr(t))}coerce(t,e){var i;if(null!=t.error)return e.apply(t.error);const n=e.apply(t.message);return ue(ue({},n),{},{stack:null!==(i=this.ur(t))&&void 0!==i?i:n.stack,synthetic:!0})}lr(t){return Ee(t.message)&&t.message.length>0}ur(t){var e,i;const n=t,s=null!==(e=n.lineno)&&void 0!==e?e:0,r=null!==(i=n.colno)&&void 0!==i?i:0;if(Ee(n.filename)&&0!==n.filename.length&&0!==s)return`Error\n at ${n.filename}:${s}:${r}`}};const Hn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Un=class{match(t){return"string"==typeof t}coerce(t,e){var i;const[n,s]=this.getInfos(t);return{type:null!=n?n:"Error",value:null!=s?s:t,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}getInfos(t){let e="Error",i=t;const n=t.match(Hn);return n&&(e=n[1],i=n[2]),[e,i]}};const zn=["fatal","error","warning","log","info","debug"];function Wn(t,e=40){const i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(let t=i.length;t>0;t--){const n=i.slice(0,t).join(", ");if(e>=n.length)return t===i.length?n:n.length>e?`${n.slice(0,e)}...`:n}return""}var Vn=class{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,n;const s=this.getErrorPropertyFromObject(t);return s?e.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(i=this.getStack(t))&&void 0!==i?i:null===(n=e.syntheticException)||void 0===n?void 0:n.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(je(t))return t.constructor.name;const e="name"in t?t.name:void 0;return Ee(e)&&!Ie(e)?e:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){let e=`'${t.name}' captured as exception`;return"message"in t&&"string"==typeof t.message&&(e+=` with message: '${t.message}'`),e}if("message"in t&&"string"==typeof t.message)return t.message;const e=this.getObjectClassName(t);return`${e&&"Object"!==e?`'${e}'`:"Object"} captured as exception with keys: ${Wn(t)}`}isSeverityLevel(t){return Ee(t)&&!Ie(t)&&zn.indexOf(t)>=0}getStack(t){try{return Ee(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:Ee(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(const e in t)if({}.hasOwnProperty.call(t,e)){const i=t[e];if(Be(i))return i}}getObjectClassName(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}},Gn=class{match(t){return je(t)}coerce(t,e){var i;const n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${Wn(t)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Zn=class{match(t){return Ne(t)}coerce(t,e){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Qn=class{match(t){return qe(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!je(t))return!1;try{const e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i;const n=this.getUnhandledRejectionReason(t);return Ne(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}:e.apply(n)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}};const Jn="$message",Kn="$timestamp",Yn=new Set([Jn,Kn]),Xn={enabled:!0,max_bytes:32768};function ts(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Xn.enabled,max_bytes:is(t.max_bytes,Xn.max_bytes)}:ue({},Xn)}var es=class{constructor(t){this.ns=[],this.ss=0,this.Mr=ts(t)}setConfig(t){this.Mr=ts(t),this.rs()}add(t){const e=function(t){let e;try{e=_e(t)}catch(t){return}try{const t=JSON.parse(e);if(!Ce(t))return;const i=t,n=i[Jn],s=i[Kn];if(!Ee(n)||0===n.trim().length)return;if(!Ee(s)&&!Pe(s))return;return{step:i,json:e}}catch(t){return}}(t);if(!e)return;const i=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;const e=encodeURIComponent(t);let i=0;for(let t=0;e.length>t;t++)"%"===e[t]?(i+=1,t+=2):i+=1;return i}(e.json);i>this.Mr.max_bytes||(this.ns.push({step:e.step,bytes:i}),this.ss+=i,this.rs())}getAttachable(){return this.ns.map(t=>t.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Mr.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function is(t,e){if(!Pe(t)||1/0===t||-1/0===t)return e;const i=Math.floor(t);return 0>i?e:i}const ns=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function ss(t){return"string"==typeof t||t}function rs(t){return"string"==typeof t?t:void 0}const os=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],ls="NativeGzipValidationError",as=t=>t.length>=2&&31===t[0]&&139===t[1],us=(t,e)=>t===ce.GZipJS||e===ce.GZipJS||"gzip"===e,hs=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),cs=t=>{if(!t||"object"!=typeof t)return!1;const e="name"in t?String(t.name):"";return hs(t)||e===ls};let ds;const vs=t=>{throw an(ls,`Native gzip produced invalid output: ${t}`)},fs=(ps=re(function*(t,e){18>t.size&&vs("too-short");const i=new Uint8Array(yield t.slice(0,10).arrayBuffer());as(i)&&8===i[2]||vs("invalid-header");const n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{const e=(()=>{if(ds)return ds;ds=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)e=1&e?3988292384^e>>>1:e>>>1;ds[t]=e>>>0}return ds})();let i=4294967295;for(let n=0;t.length>n;n++)i=e[255&(i^t[n])]^i>>>8;return(4294967295^i)>>>0})(e)&&vs("invalid-crc");const s=e.length>>>0;n.getUint32(4,!0)!==s&&vs("invalid-size")}),function(t,e){return ps.apply(this,arguments)});var ps;function gs(t){return ms.apply(this,arguments)}function ms(){return ms=re(function*(t,e=!0,i){try{const e=(new TextEncoder).encode(t),i=new globalThis.CompressionStream("gzip"),s=i.writable.getWriter(),r=s.write(e).then(()=>s.close()).catch((n=re(function*(t){try{yield s.abort(t)}catch(t){}throw t}),function(t){return n.apply(this,arguments)})),o=new Response(i.readable).blob(),[l]=yield Promise.all([o,r]);return yield fs(l,e),l}catch(t){if(null==i?void 0:i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}var n}),ms.apply(this,arguments)}function ys(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;r.length>n;n++)e.includes(i=r[n])||{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}const _s={}.propertyIsEnumerable;function bs(t,e){try{return Ss(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function ws(t,e,i,n){if(0>=i.remainingNodes)return{stringValue:Xi};if(i.remainingNodes--,Ae(t))return{boolValue:t};if("bigint"==typeof t)return function(t,e){const i=t.toString(),n=BigInt("9223372036854775808");return t>=n||-n>t?(null==e||e.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}(t,e);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const i=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==e||e.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:en(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(i.ancestors.has(t))return{stringValue:"[Circular]"};if(n>=20)return{stringValue:Xi};if(t instanceof Date){const e=t.getTime(),i=Number.isFinite(e)?t.toISOString():String(t);return{stringValue:"string"==typeof i?en(i):String(i)}}i.ancestors.add(t);try{try{const s=t.toJSON;if("function"==typeof s)return ws(s.call(t),e,i,n+1)}catch(t){}return Se(t)?{arrayValue:{values:ks(t,e,i,n+1)}}:{kvlistValue:{values:Ss(t,e,i,n+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:en(String(t))}}function ks(t,e,i,n){const s=[],r=Math.min(t.length,1e3);let o=0;for(;r>o&&i.remainingNodes>0;o++)try{const r=o in t?t[o]:void 0;if(Re(r))continue;s.push(ws(r,e,i,n))}catch(t){s.push({stringValue:tn})}return t.length>o&&s.push({stringValue:Xi}),s}function Ss(t,e,i,n){const s=[];for(const r in t)if(_s.call(t,r)){if(!r){null==e||e.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=i.remainingNodes){null==e||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=t[r];if(Me(o)||Te(o))continue;s.push({key:en(r),value:ws(o,e,i,n)})}catch(t){s.push({key:en(r),value:{stringValue:tn}})}}return s}function xs(t,e,i){return ue(ue(ue(ue({},nn({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":e,"telemetry.sdk.version":i})}const Cs=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function $s(t,e){const i=nn({},t),n={};for(const t of Cs)({}).hasOwnProperty.call(i,t)&&(n[t]=i[t],delete i[t]);return[...bs(i,e),...bs(n,e)]}const Ts={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 Es={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}},Is=Es.info;function Ms(t){try{return en(String(t))}catch(t){return tn}}function Rs(t,e,i,n){const s=t.level||"info",{text:r,number:o}=Es[s]||Is,l=function(t=Date.now()){return String(t)+"000000"}(Pe(n)?n:void 0),a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),Re(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),Re(e.lastActivityTimestamp)||(a.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(a["url.full"]=e.currentUrl),e.screenName&&(a["screen.name"]=e.screenName),e.appState&&(a["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(a.feature_flags=e.activeFeatureFlags);const u=ue({},a),h=t.attributes;if(h){let t=[];try{t=Object.keys(h)}catch(e){t=[]}for(const e of t){let t;try{t=h[e]}catch(e){t=tn}Object.defineProperty(u,e,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const c={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:r,body:{stringValue:Ms(t.body)},attributes:bs(u,i)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),Te(t.trace_flags)||(c.flags=t.trace_flags),c}function Ps(t,e,i){return xs(t,e,i)}function Os(t,e,i,n){return{resourceLogs:[{resource:{attributes:$s(e)},scopeLogs:[{scope:{name:i,version:n},logRecords:t}]}]}}var As=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.hs}arm(t){this.clear(),this.us=Date.now()+t,this.hs=cn(()=>{this.hs=void 0,this.ls()},t)}armNoEarlierThan(t){this.hs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function Fs(){return.75+.5*Math.random()}function Ds(t,e,i,n){const s=Math.min(Math.max(0,e-1),6),r=t*Math.pow(2,s);return Math.round((void 0===n?r:Math.min(r,Math.max(n,t)))*i)}var Ls=class{constructor(t,e,i,n,s,r=()=>Promise.resolve(),o){var l;this._instance=t,this.Mr=e,this.$=i,this.cs=n,this.ds=s,this.vs=r,this.fs=o,this.ps=new As(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new rn,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=e.maxBufferSize,this.Is=Math.max(null!==(l=e.maxQueueSize)&&void 0!==l?l:e.maxBufferSize,e.maxBufferSize),this.Ms=e.flushIntervalMs,this.Es=e.maxBatchRecordsPerPost,this.Ps=e.rateCapWindowMs,this.Rs=e.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(he.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(t,e){var i;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==t?void 0:t.body))return;const n=this.Os(t);if(null===n)return;if(!n.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const s={record:Rs(n,null!==(i=null==e?void 0:e.context)&&void 0!==i?i:this.cs(),this.$,null==e?void 0:e.occurredAtMs)};this.ds(()=>this.Ls(s))}Os(t){const e=this.Mr.beforeSend;if(!e)return t;const i=Se(e)?e:[e];let n=t;for(const t of i)try{const e=t(n);if(!e)return this.$.info("Log was rejected in beforeSend function"),null;n=e}catch(t){return this.$.error("Error in beforeSend function for log:",t),null}return n}Ds(){if(void 0===this.Rs)return!0;const t=Date.now(),e=t-this.xs;return this.Ps>e&&e>=0||(this.xs=t,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var t=this;return re(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null})),t.ys})()}Ns(){var t=this;return re(function*(){var e;t.ps.clear();let i=null!==(e=t._instance.getPersistedProperty(he.LogsQueue))&&void 0!==e?e:[];if(0===i.length)return;const n=i.length;let s=0;for(;i.length>0&&n>s;){var r,o;const e=t._s;t.bs=0;const n=Math.min(i.length,t.Es),l=i.slice(0,n),a=Os(l.map(t=>t.record),t.qs(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.js(a);if(t._s!==e)return;if("too-large"===u.kind&&l.length>1)t.Es=Math.max(1,Math.floor(l.length/2)),t.$.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${t.Es}`);else{if(t.ws.record(u),t.ps.pending&&t.ps.arm(Math.max(t.Ms,t.ws.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.Mr.maxBatchRecordsPerPost>t.Es&&(t.Es=Math.min(t.Mr.maxBatchRecordsPerPost,t.Es+1)),yield t.Bs(l.length),i=null!==(o=t._instance.getPersistedProperty(he.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===u.kind)throw u.error}}})()}Bs(t){var e=this;return re(function*(){var i;const n=Math.max(0,t-e.bs),s=null!==(i=e._instance.getPersistedProperty(he.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(he.LogsQueue,s.slice(n)),yield e.vs()})()}qs(){return Ps(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var e;if(this._instance.optedOut)return;const i=null!==(e=this._instance.getPersistedProperty(he.LogsQueue))&&void 0!==e?e:[];this.Is>i.length||(i.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(he.LogsQueue,i),this.Ts>i.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(Ds(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const t=this._instance.getPersistedProperty(he.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return re(function*(){e.ps.clear();const i=e.flush().catch(()=>{});void 0!==t?yield dn(i,t):yield i})()}flushWithTimeout(t){var e=this;return re(function*(){const i=e.flush();yield dn(i,t,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},t=>{this.ks++,this.Ss=Fs(),this.$.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const Ns=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function qs(t){return String(t)+"000000"}function Bs(t,e,i,n){let s="";return n&&(s=Object.keys(n).sort().map(t=>`${JSON.stringify(t)}:${JSON.stringify(n[t])}`).join(",")),`${t}\0${e}\0${null!=i?i:""}\0${s}`}var js=class{constructor(t,e,i){this._instance=t,this.Mr=e,this.$=i,this.zs=new Map,this.ps=new As(()=>this.flush().catch(t=>{this.$.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new rn,this.ks=0,this.Ss=1,this.Gs=0}count(t,e=1,i){this.Zs({name:t,type:"count",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(t,e,i){this.Zs({name:t,type:"gauge",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(t,e,i){this.Zs({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var t=this;const e=this.ys,i=function(){var i=re(function*(){e&&(yield e.catch(()=>{})),yield t.Qs()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this.ys===i&&(this.ys=null)});return this.ys=i,i}drainWindow(){if(0===this.zs.size)return null;const t=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const e=this.Os(t);if(null===e)return;if(!e.name||"string"!=typeof e.name)return void this.$.warn("Dropping metric with empty name");if("number"!=typeof e.value||!Number.isFinite(e.value))return void this.$.warn(`Dropping metric '${e.name}': value must be a finite number`);if("count"===e.type&&0>e.value)return void this.$.warn(`Dropping count '${e.name}': counters are monotonic, value must be >= 0`);let i,n;try{i=e.attributes?ue({},e.attributes):void 0,n=Bs(e.type,e.name,e.unit,i)}catch(t){return void this.$.warn(`Dropping metric '${e.name}': attributes could not be serialized`,t)}let s=this.zs.get(n);if(!s){if(!this.Ks())return;s={name:e.name,type:e.type,unit:e.unit,attributes:i,windowStartMs:Date.now()},this.zs.set(n,s)}const r=this.Ws.get(e.name);void 0===r?this.Ws.set(e.name,e.type):r===e.type||this.Vs.has(e.name)||(this.Vs.add(e.name),this.$.warn(`Metric name '${e.name}' is already used as a ${r}; recording it as a ${e.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(s,e.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(t,e){switch(t.type){case"count":var i;t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case"gauge":t.last=e;break;case"histogram":{t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(Ns.length+1).fill(0)});const i=t.hist;i.count+=1,i.sum+=e,i.min=Math.min(i.min,e),i.max=Math.max(i.max,e),i.bucketCounts[function(t,e){for(let i=0;e.length>i;i++)if(e[i]>=t)return i;return e.length}(e,Ns)]+=1;break}}}Os(t){const e=this.Mr.beforeSend;if(!e)return t;const i=Se(e)?e:[e];let n=t;for(const t of i)try{const e=t(n);if(!e)return this.$.info("Metric was rejected in beforeSend function"),null;n=e}catch(t){return this.$.error("Error in beforeSend function for metric:",t),null}return n}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(Ds(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var t=this;return re(function*(){if(t.ps.clear(),0===t.zs.size)return;const e=t.zs;t.zs=new Map,t.Us=!1,t.Ws=new Map,t.Vs=new Set;const i=t.Gs,n=yield t._instance.Ys(t.Js(e));if(i===t.Gs)switch(t.ws.record(n),"retry-later"===n.kind?(t.ks++,t.Ss=Fs()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.Hs()),n.kind){case"ok":return;case"retry-later":return t.lo(e),void t.ps.armNoEarlierThan(t.Hs());case"too-large":return void t.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.$.error("Failed to send metrics batch:",n.error)}})()}Js(t){return e=this.ao(t),i=function(t,e,i){return xs(t,e,i)}(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:$s(i)},scopeMetrics:[{scope:{name:n,version:s},metrics:e}]}]};var e,i,n,s}ao(t){const e=qs(Date.now()),i=new Map;for(const o of t.values()){var n;const t=Bs(o.type,o.name,o.unit,void 0);let l=i.get(t);l||(l=ue({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},i.set(t,l));const a=bs(null!==(n=o.attributes)&&void 0!==n?n:{},this.$),u=qs(o.windowStartMs);if("count"===o.type){var s;const t={attributes:a,startTimeUnixNano:u,timeUnixNano:e,asDouble:null!==(s=o.total)&&void 0!==s?s:0};l.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t={attributes:a,timeUnixNano:e,asDouble:null!==(r=o.last)&&void 0!==r?r:0};l.gauge.dataPoints.push(t)}else o.hist&&l.histogram.dataPoints.push({attributes:a,startTimeUnixNano:u,timeUnixNano:e,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Ns})}return Array.from(i.values())}lo(t){for(const[n,s]of t){const t=this.zs.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,s.windowStartMs),t.type){case"count":var e,i;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(i=s.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(s.hist)if(t.hist){t.hist.count+=s.hist.count,t.hist.sum+=s.hist.sum,t.hist.min=Math.min(t.hist.min,s.hist.min),t.hist.max=Math.max(t.hist.max,s.hist.max);for(let e=0;t.hist.bucketCounts.length>e;e++)t.hist.bucketCounts[e]+=s.hist.bucketCounts[e]}else t.hist=s.hist}else this.Ks()&&this.zs.set(n,s)}}};function Hs(t,e){if(!t)return;const i=t.find(t=>t.type===e);return null==i?void 0:i.value}const Us="0.8.3",zs={DEBUG:!1,LIB_VERSION:Us,LIB_NAME:"browser-common",JS_SDK_VERSION:Us},Ws=(e,{debugEnabled:i}={})=>{const n={N(n,...s){t&&(zs.DEBUG||t.POSTHOG_DEBUG||i)&&!Te(t.console)&&t.console&&("__rrweb_original__"in t.console[n]?t.console[n].__rrweb_original__:t.console[n])(e,...s)},debug(...t){n.N("debug",...t)},info(...t){n.N("log",...t)},warn(...t){n.N("warn",...t)},error(...t){n.N("error",...t)},critical(...t){console.error(e,...t)},uninitializedWarning(t){n.error(`You must initialize PostHog before calling ${t}`)},createLogger:(t,i)=>Ws(`${e} ${t}`,i)};return n},Vs=Ws("[PostHog.js]"),Gs=Vs.createLogger;function Zs(t,e){Se(t)&&t.forEach(e)}function Qs(t,e){if(!Re(t))if(Se(t))t.forEach(e);else if(Fe(t))t.forEach((t,i)=>e(t,i));else for(const i in t)we.call(t,i)&&e(t[i],i)}const Js=function(t,...e){for(const i of e)for(const e in i)void 0!==i[e]&&(t[e]=i[e]);return t};function Ks(t){const e=Object.keys(t);let i=e.length;const n=new Array(i);for(;i--;)n[i]=[e[i],t[e[i]]];return n}const Ys=function(t){return function(...e){try{return t.apply(this,e)}catch(t){Vs.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Vs.critical(t)}}},Xs=function(t){const e={};return Qs(t,function(t,i){(Ee(t)&&t.length>0||Pe(t))&&(e[i]=t)}),e};function tr(t){const e=ue({},t);for(const i of["name","message","stack","cause","errors"])try{i in t&&(e[i]=t[i])}catch(t){}return e}const er=["herokuapp.com","vercel.app","netlify.app"];function ir(t){const e=null==t?void 0:t.hostname;if(!Ee(e))return!1;const i=e.split(".").slice(-2).join(".");for(const t of er)if(i===t)return!1;return!0}function nr(t,e,i,n){const{capture:s=!1,passive:r=!0}=null!=n?n:{};null==t||t.addEventListener(e,i,{capture:s,passive:r})}function sr(t){return"ph_toolbar_internal"===t.name}const rr=["localhost","127.0.0.1"],or=(t,e)=>{try{let i;return JSON.stringify(t,(t,e)=>{var n;return Be(e)?(null!==(n=i)&&void 0!==n||(i=new WeakMap),i.has(e)||i.set(e,tr(e)),i.get(e)):"bigint"==typeof e?e.toString():e},e)}catch(e){return _e(t)}},lr=t=>{const e=null==n?void 0:n.createElement("a");return Te(e)?null:(e.href=t,e)},ar=function(t,e="&"){let i,n;const s=[];return Qs(t,function(t,e){Te(t)||Te(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),n=encodeURIComponent(e),s[s.length]=n+"="+i)}),s.join(e)},ur=function(t,e){const i=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let n;for(let t=0;i.length>t;t++){const s=i[t].split("=");if(s[0]===e){n=s;break}}if(!Se(n)||2>n.length)return"";{let t=n[1];try{t=decodeURIComponent(t)}catch(e){Vs.error("Skipping decoding for malformed query param: "+t)}return t.replace(/\+/g," ")}},hr=function(t,e,i){if(!t||!e||!e.length)return t;const n=t.split("#"),s=n[1],r=(n[0]||"").split("?"),o=r[1],l=r[0],a=(o||"").split("&"),u=[];for(let t=0;a.length>t;t++){const n=a[t].split("=");Se(n)&&(e.includes(n[0])?u.push(n[0]+"="+i):u.push(a[t]))}let h=l;return null!=o&&(h+="?"+u.join("&")),null!=s&&(h+="#"+s),h},cr=function(t,e){const i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},dr=(t,e)=>t>=e&&h(),vr=(t,e,i,n)=>{if(0===t){if(h()){const t=e+1;return t===i&&n(),t}return e}return 0};function fr(t,e){var i;const n=null==t||null===(i=t.config)||void 0===i?void 0:i.get_current_url;if(!xe(n))return e;try{const t=n(e);return Ee(t)&&t?t:e}catch(t){return Vs.error("Error in get_current_url, falling back to window.location.href",t),e}}function pr(e){var i;const n=null==t||null===(i=t.location)||void 0===i?void 0:i.href;return Te(n)?void 0:fr(e,n)}function gr(t){var e;return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!!(null===(e=t.closest)||void 0===e?void 0:e.call(t,".toolbar-global-fade-container")))}function mr(t){return!!t&&1===t.nodeType}function yr(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function _r(t){return!!t&&3===t.nodeType}function br(t){return!!t&&11===t.nodeType&&mr(t.host)}function wr(t){return t?me(t).split(/\s+/):[]}function kr(t,e){const i=pr(e);return!!(i&&t&&t.some(t=>i.match(t)))}function Sr(t){let e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return wr(e)}function xr(t){return Re(t)?null:me(t).split(/(\s+)/).filter(t=>Kr(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Cr(t){let e="";return Hr(t)&&!Ur(t)&&t.childNodes&&t.childNodes.length&&Qs(t.childNodes,function(t){var i;_r(t)&&t.textContent&&(e+=null!==(i=xr(t.textContent))&&void 0!==i?i:"")}),me(e)}function $r(t){var e;return Te(t.target)?t.srcElement||null:(null===(e=t.target)||void 0===e?void 0:e.shadowRoot)?t.composedPath()[0]||null:t.target||null}const Tr=["a","button","form","input","select","textarea","label"];function Er(t,e){const i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!i&&i.call(t,e)}catch(t){return!1}}function Ir(t,e){if(Te(e))return!0;for(const i of t)if(e.some(t=>Er(i,t)))return!0;return!1}function Mr(t){const e=t.parentNode;return!(!e||!mr(e))&&e}const Rr=[".ph-no-autocapture","[data-ph-no-autocapture]"],Pr=["next","previous","prev",">","<"],Or=[...Pr,"+","-","−","–"],Ar=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Fr=[".ph-no-deadclick",".ph-no-capture"],Dr=[".ph-no-rageclick",".ph-no-capture"],Lr=["","text","search","email","password","url","tel","number"];function Nr(t){return!(!t||!mr(t))&&(!!yr(t,"textarea")||(yr(t,"input")?ge(Lr,(t.getAttribute("type")||"").toLowerCase()):function(t){var e;if(t.isContentEditable)return!0;const i=null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"contenteditable");return"true"===i||""===i}(t)))}function qr(e,i){if(!t||Br(e))return!1;let n,s,r;var o,l;if(Ae(i)?(n=!!i&&Dr,s=void 0,r=!1):(n=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Dr,s=null==i?void 0:i.content_ignorelist,r=null!==(l=null==i?void 0:i.ignore_text_selection)&&void 0!==l&&l),!1===n)return!1;if(r&&Nr(e))return!1;const{targetElementList:a}=jr(e,!1);return!function(t,e){if(!1===t||Te(t))return!1;let i;if(!0===t)i=Pr;else{if(!Se(t))return!1;if(t.length>10)return Vs.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map(t=>t.toLowerCase())}return e.some(({safeText:t,ariaLabel:e})=>i.some(i=>Ar(t,i)||Ar(e,i)))}(s,a.map(t=>{var e;return{safeText:Cr(t).toLowerCase(),ariaLabel:(null===(e=t.getAttribute("aria-label"))||void 0===e?void 0:e.toLowerCase().trim())||""}}))&&!Ir(a,n)}const Br=t=>!t||yr(t,"html")||!mr(t),jr=(e,i)=>{if(!t||Br(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const s=[e];let r=e;for(;r.parentNode&&!yr(r,"body");){if(br(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}const e=Mr(r);if(!e)break;if(i||Tr.indexOf(e.tagName.toLowerCase())>-1)n=!0;else try{const i=t.getComputedStyle(e);i&&"pointer"===i.getPropertyValue("cursor")&&(n=!0)}catch(t){}s.push(e),r=e}return{parentIsUsefulElement:n,targetElementList:s}};function Hr(t){const e=new Set;let i=0;for(let n=t;n.parentNode&&!yr(n,"body");n=n.parentNode){if(i++>=1e3||e.has(n))return!1;e.add(n);const t=Sr(n);if(ge(t,"ph-sensitive")||ge(t,"ph-no-capture"))return!1}if(ge(Sr(t),"ph-include"))return!0;const n=t.type||"";if(Ee(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}const s=t.name||t.id||"";return!Ee(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Ur(t){return!!(yr(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||yr(t,"select")||yr(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const zr=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}))$"),Wr=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Vr=[16,15,14,13],Gr=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Zr=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Qr=/[0-9A-Za-z_]/;function Jr(t){let e=0,i=!1;for(let n=t.length-1;n>=0;n--){let s=t.charCodeAt(n)-48;i&&(s*=2,s>9&&(s-=9)),e+=s,i=!i}return e%10==0}function Kr(t,e=!0){if(Re(t))return!1;if(Ee(t)){if(t=me(t),e?zr.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(Wr.lastIndex=0;e=Wr.exec(t);){const t=e[2];if(!t)continue;const i=t.replace(/[- ]/g,"");for(let t=0;i.length>t;t++)for(const e of Vr){const n=t+e;if(i.length>=n){const e=i.slice(t,n);if(zr.test(e)&&Jr(e))return!0}}}return!1}(t))return!1;if(e?Gr.test(t):function(t){let e;for(Zr.lastIndex=0;e=Zr.exec(t);){const t=e[1],i=e[3];if(!(t&&i&&Qr.test(t)&&Qr.test(i)))return!0}return!1}(t))return!1}return!0}function Yr(t){let e=Cr(t);return e=`${e} ${Xr(t)}`.trim(),Kr(e)?e:""}function Xr(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Qs(t.childNodes,function(t){var i;if(t&&"span"===(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=Cr(t);e=`${e} ${i}`.trim(),t.childNodes&&t.childNodes.length&&(e=`${e} ${Xr(t)}`.trim())}catch(t){Vs.error("[AutoCapture]",t)}}),e}function to(t){return t.replace(/"|\\"/g,'\\"')}function eo(t){const e=t.attr__class;if(e)return Se(e)?e:wr(e)}const io=1e6;function no(t){var e;return Math.min(io,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:io)}const so={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:io,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"],streamNetworkBody:!1},ro=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],oo=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],lo=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],ao=t=>{Re(t)||Qs(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return ro.includes(e)||lo.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},uo=["/s/","/e/","/i/"];function ho(t,e,i,n){if(Re(t))return t;let s=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return Ee(s)&&(s=parseInt(s)),s>i?`[SessionRecording] ${n} body too large to record (${s} bytes)`:t}function co(t,e){if(Re(t))return t;let i=t;return Kr(i,!1)||(i="[SessionRecording] "+e+" body redacted"),Qs(oo,t=>{(null==i?void 0:i.length)&&-1!==(null==i?void 0:i.indexOf(t))&&(i="[SessionRecording] "+e+" body redacted as might contain: "+t)}),i}const vo=new WeakSet,fo="disabled",po="sampled",go="active",mo="buffering",yo="paused",_o="lazy_loading",bo="rrweb_error",wo="trigger_activated",ko="trigger_pending",So="trigger_disabled";function xo(t,e,i,n,s,r){return 0===e?So:(null==t?void 0:t.get_property(i?n+i:s))===r?wo:ko}function Co(t,e,i){return e.some(e=>{var n;return"regex"===e.matching&&(null!==(n=null==i?void 0:i.get(e.url))&&void 0!==n?n:new RegExp(e.url)).test(t)})}function $o(t){return t.includes("trigger_activated")?wo:t.includes("trigger_pending")?ko:So}function To(t){const e=new Set(t);switch(e.delete(So),e.size){case 0:return So;case 1:return Array.from(e)[0];default:return ko}}var Eo=class{constructor(t){this.q=t}triggerStatus(t){return $o(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return $o(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},Io=class{constructor(t){this.q=t}triggerStatus(t){return To(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return To(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},Mo=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return wo}stop(){}};const Ro=t=>"sessionRecording"in t;var Po=class{constructor(t,e){this._instance=t,this.j=[],this.B=[],this.H=new Map,this.U=new Map,this.W="",this.urlBlocked=!1,this.V=e}onConfig(t){var e,i;this.j=(Ro(t)?Ce(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.B=(Ro(t)?Ce(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.Z()}Z(){this.H.clear(),this.U.clear();for(const t of this.j)if("regex"===t.matching&&!this.H.has(t.url))try{this.H.set(t.url,new RegExp(t.url))}catch(e){Vs.error("Invalid URL trigger regex pattern:",t.url,e)}for(const t of this.B)if("regex"===t.matching&&!this.U.has(t.url))try{this.U.set(t.url,new RegExp(t.url))}catch(e){Vs.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}G(t){return xo(this._instance,this.j.length,this.V,Z,W,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[zt]:e}),e}triggerStatusNoSideEffects(t){return this.G(t)}isCurrentUrlBlocked(){const t=pr(this._instance);if(!t)return!1;try{return Co(t,this.B,this.U)}catch(t){return!0}}checkUrlBlocklist(t,e){const i=pr(this._instance);if(!i)return;if(i===this.W)return;this.W=i;const n=this.urlBlocked,s=Co(i,this.B,this.U);n&&s||(s&&!n?t():!s&&n&&e())}checkUrlTriggerConditions(t,e,i,n){const s=pr(this._instance);if(!s)return;if(s===this.W)return;this.W=s;const r=this.urlBlocked,o=Co(s,this.B,this.U);o&&!r?t():!o&&r&&e();const l=this.G(n)===wo,a=Co(s,this.j,this.H);!l&&a&&i("url",s)}stop(){this.W=""}},Oo=class{constructor(t){this._instance=t,this.linkedFlag=null,this.linkedFlagSeen=!1,this.J=()=>{}}triggerStatus(){const t=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[qt]:t}),t}triggerStatusNoSideEffects(){let t=ko;return Re(this.linkedFlag)&&(t=So),this.linkedFlagSeen&&(t=wo),t}onConfig(t,e){var i;if(this.linkedFlag=(Ro(t)?Ce(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!Re(this.linkedFlag)&&!this.linkedFlagSeen){const t=Ee(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=Ee(this.linkedFlag)?null:this.linkedFlag.variant;this.J=this._instance.onFeatureFlags((n,s)=>{let r=!1;if(Ce(s)&&t in s){const e=s[t];r=Ae(e)?!0===e:i?e===i:!!e}const o=r&&!this.linkedFlagSeen;this.linkedFlagSeen=r,o&&e(t,i)})}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.J()}},Ao=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(Ro(t)?Ce(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}X(t){return xo(this._instance,this.K.length,this.V,G,V,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Nt]:e}),e}triggerStatusNoSideEffects(t){return this.X(t)}checkEventTriggerConditions(t,e,i){if(0===this.K.length)return;const n=this.X(i)===wo,s=this.K.includes(t);!n&&s&&e("event",t)}stop(){}},Fo=class{constructor(t,e,i){if(this._instance=t,this.group=e,this.Y=new Po(t,e.id),this.tt=new Ao(t,e.id),this.et=new Oo(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){const t=(e.conditions.events||[]).map(t=>t.name),n={urlTriggers:e.conditions.urls||[],eventTriggers:t,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.Y.onConfig(n),this.tt.onConfig(n),this.et.onConfig(n,i);const s=[this.tt,this.Y,this.et];this.nt="any"===e.conditions.matchType?new Eo(s):new Io(s)}else this.nt=new Mo}triggerStatus(t){return this.nt.triggerStatus(t)}triggerStatusNoSideEffects(t){return this.nt.triggerStatusNoSideEffects(t)}getPendingTriggerConditions(t){return"trigger_pending"!==this.triggerStatusNoSideEffects(t)?[]:[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===ko).map(({label:t})=>t)}checkEventTriggerConditions(t,e,i){this.tt.checkEventTriggerConditions(t,e,i)}checkUrlTriggerConditions(t,e,i,n){this.Y.checkUrlTriggerConditions(t,e,i,n)}activateTrigger(t,e){var i;const n="url"===t?Z+this.group.id:G+this.group.id;null===(i=this._instance.persistence)||void 0===i||i.register({[n]:e})}stop(){this.Y.stop(),this.tt.stop(),this.et.stop()}};function Do(t){if(t.rrwebError)return bo;if(!t.receivedFlags)return mo;if(!t.isRecordingEnabled)return fo;if(t.urlTriggerMatching.urlBlocked)return yo;const e=!0===t.isSampled,i=new Eo([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?po:"trigger_activated"===i?go:"trigger_pending"===i?mo:!1===t.isSampled?fo:go}function Lo(t){if(t.rrwebError)return bo;if(!t.receivedFlags)return mo;if(!t.isRecordingEnabled)return fo;if(t.urlTriggerMatching.urlBlocked)return yo;const e=new Io([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),i=e!==So,n=Ae(t.isSampled);return i&&"trigger_pending"===e?mo:i&&"trigger_disabled"===e||n&&!t.isSampled?fo:!0===t.isSampled?po:go}function No(){const t=[];return function(e,i){if(Ce(i)||Se(i)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(i)?"[Circular]":(t.push(i),i)}return i}}function qo(t){const e=JSON.stringify(t,No());return e?new Blob([e]).size:0}function Bo(t){if(Me(t))return 4;if(Te(t))return 0;switch(typeof t){case"string":return t.length+2;case"number":return String(t).length;case"boolean":return t?4:5;case"object":{if(Se(t)){let e=2;for(let i=0;t.length>i;i++){i>0&&(e+=1);const n=t[i];e+=Te(n)||Me(n)?4:Bo(n)}return e}const e=t;let i=2,n=!0;for(const t in e){if(!{}.hasOwnProperty.call(e,t))continue;const s=e[t];Te(s)||(n||(i+=1),n=!1,i+=t.length+3+Bo(s))}return i}default:return 0}}function jo(t,e=6606028.8){if(t.size>=e&&t.data.length>1){const e=Math.floor(t.data.length/2),i=t.sizes.slice(0,e),n=t.sizes.slice(e);return[jo({size:i.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),jo({size:n.reduce((t,e)=>t+e,0),data:t.data.slice(e),sizes:n,sessionId:t.sessionId,windowId:t.windowId})].flatMap(t=>t)}return[t]}var Ho=Uint8Array,Uo=Uint16Array,zo=Uint32Array,Wo=new Ho([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Vo=new Ho([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Go=new Ho([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Zo=function(t,e){for(var i=new Uo(31),n=0;31>n;++n)i[n]=e+=1<<t[n-1];var s=new zo(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]},Qo=Zo(Wo,2),Jo=Qo[1];Qo[0][28]=258,Jo[258]=28;for(var Ko=Zo(Vo,0)[1],Yo=new Uo(32768),Xo=0;32768>Xo;++Xo){var tl=(43690&Xo)>>>1|(21845&Xo)<<1;Yo[Xo]=((65280&(tl=(61680&(tl=(52428&tl)>>>2|(13107&tl)<<2))>>>4|(3855&tl)<<4))>>>8|(255&tl)<<8)>>>1}var el=function(t,e,i){for(var n=t.length,s=0,r=new Uo(e);n>s;++s)++r[t[s]-1];var o,l=new Uo(e);for(s=0;e>s;++s)l[s]=l[s-1]+r[s-1]<<1;if(i){o=new Uo(1<<e);var a=15-e;for(s=0;n>s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],c=l[t[s]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)o[Yo[c]>>>a]=u}else for(o=new Uo(n),s=0;n>s;++s)o[s]=Yo[l[t[s]-1]++]>>>15-t[s];return o},il=new Ho(288);for(Xo=0;144>Xo;++Xo)il[Xo]=8;for(Xo=144;256>Xo;++Xo)il[Xo]=9;for(Xo=256;280>Xo;++Xo)il[Xo]=7;for(Xo=280;288>Xo;++Xo)il[Xo]=8;var nl=new Ho(32);for(Xo=0;32>Xo;++Xo)nl[Xo]=5;var sl=el(il,9,0),rl=el(nl,5,0),ol=function(t){return(t/8|0)+(7&t&&1)},ll=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var n=new(t instanceof Uo?Uo:t instanceof zo?zo:Ho)(i-e);return n.set(t.subarray(e,i)),n},al=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8},ul=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8,t[n+2]|=i>>>16},hl=function(t,e){for(var i=[],n=0;t.length>n;++n)t[n]&&i.push({s:n,f:t[n]});var s=i.length,r=i.slice();if(!s)return[new Ho(0),0];if(1==s){var o=new Ho(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(t,e){return t.f-e.f}),i.push({s:-1,f:25001});var l=i[0],a=i[1],u=0,h=1,c=2;for(i[0]={s:-1,f:l.f+a.f,l:l,r:a};h!=s-1;)l=i[i[c].f>i[u].f?u++:c++],a=i[u!=h&&i[c].f>i[u].f?u++:c++],i[h++]={s:-1,f:l.f+a.f,l:l,r:a};var d=r[0].s;for(n=1;s>n;++n)r[n].s>d&&(d=r[n].s);var v=new Uo(d+1),f=cl(i[h-1],v,0);if(f>e){n=0;var p=0,g=f-e,m=1<<g;for(r.sort(function(t,e){return v[e.s]-v[t.s]||t.f-e.f});s>n;++n){var y=r[n].s;if(e>=v[y])break;p+=m-(1<<f-v[y]),v[y]=e}for(p>>>=g;p>0;){var _=r[n].s;e>v[_]?p-=1<<e-v[_]++-1:++n}for(;n>=0&&p;--n){var b=r[n].s;v[b]==e&&(--v[b],++p)}f=e}return[new Ho(v),f]},cl=function(t,e,i){return-1==t.s?Math.max(cl(t.l,e,i+1),cl(t.r,e,i+1)):e[t.s]=i},dl=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Uo(++e),n=0,s=t[0],r=1,o=function(t){i[n++]=t},l=1;e>=l;++l)if(t[l]==s&&l!=e)++r;else{if(!s&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(s),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(s);r=1,s=t[l]}return[i.subarray(0,n),e]},vl=function(t,e){for(var i=0,n=0;e.length>n;++n)i+=t[n]*e[n];return i},fl=function(t,e,i){var n=i.length,s=ol(e+2);t[s]=255&n,t[s+1]=n>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var r=0;n>r;++r)t[s+r+4]=i[r];return 8*(s+4+n)},pl=function(t,e,i,n,s,r,o,l,a,u,h){al(e,h++,i),++s[256];for(var c=hl(s,15),d=c[0],v=c[1],f=hl(r,15),p=f[0],g=f[1],m=dl(d),y=m[0],_=m[1],b=dl(p),w=b[0],k=b[1],S=new Uo(19),x=0;y.length>x;++x)S[31&y[x]]++;for(x=0;w.length>x;++x)S[31&w[x]]++;for(var C=hl(S,7),T=C[0],E=C[1],I=19;I>4&&!T[Go[I-1]];--I);var M,R,P,O,A=u+5<<3,F=vl(s,il)+vl(r,nl)+o,D=vl(s,d)+vl(r,p)+o+14+3*I+vl(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(F>=A&&D>=A)return fl(e,h,t.subarray(a,a+u));if(al(e,h,1+(F>D)),h+=2,F>D){M=el(d,v,0),R=d,P=el(p,g,0),O=p;var L=el(T,E,0);for(al(e,h,_-257),al(e,h+5,k-1),al(e,h+10,I-4),h+=14,x=0;I>x;++x)al(e,h+3*x,T[Go[x]]);h+=3*I;for(var N=[y,w],q=0;2>q;++q){var B=N[q];for(x=0;B.length>x;++x)al(e,h,L[j=31&B[x]]),h+=T[j],j>15&&(al(e,h,B[x]>>>5&127),h+=B[x]>>>12)}}else M=sl,R=il,P=rl,O=nl;for(x=0;l>x;++x)if(n[x]>255){var j;ul(e,h,M[257+(j=n[x]>>>18&31)]),h+=R[j+257],j>7&&(al(e,h,n[x]>>>23&31),h+=Wo[j]);var H=31&n[x];ul(e,h,P[H]),h+=O[H],H>3&&(ul(e,h,n[x]>>>5&8191),h+=Vo[H])}else ul(e,h,M[n[x]]),h+=R[n[x]];return ul(e,h,M[256]),h+R[256]},gl=new zo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ml=new Ho(0),yl=function(){for(var t=new zo(256),e=0;256>e;++e){for(var i=e,n=9;--n;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),_l=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function bl(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,n=0;e.length>n;++n)i=yl[255&i^e[n]]^i>>>8;t=i},d(){return 4294967295^t}}}(),n=t.length;i.p(t);var s,r,o,l,a,u=(s=t,r=e,o=function(t){return 10+(t.filename&&t.filename.length+1||0)}(e),l=8,function(t,e,i,n,s,r){var o=t.length,l=new Ho(n+o+5*(1+Math.floor(o/7e3))+s),a=l.subarray(n,l.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var c=h+65535;o>c?u=fl(a,u,t.subarray(h,c)):(a[h]=r,u=fl(a,u,t.subarray(h,o)))}else{for(var d=gl[e-1],v=d>>>13,f=8191&d,p=(1<<i)-1,g=new Uo(32768),m=new Uo(p+1),y=Math.ceil(i/3),_=2*y,b=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<_)&p},w=new zo(25e3),k=new Uo(288),S=new Uo(32),x=0,C=0,T=(h=0,0),E=0,I=0;o>h;++h){var M=b(h),R=32767&h,P=m[M];if(g[R]=P,m[M]=R,h>=E){var O=o-h;if((x>7e3||T>24576)&&O>423){u=pl(t,a,0,w,k,S,C,T,I,h-I,u),T=x=C=0,I=h;for(var A=0;286>A;++A)k[A]=0;for(A=0;30>A;++A)S[A]=0}var F=2,D=0,L=f,N=R-P&32767;if(O>2&&M==b(h-N))for(var q=Math.min(v,O)-1,B=Math.min(32767,h),j=Math.min(258,O);B>=N&&--L&&R!=P;){if(t[h+F]==t[h+F-N]){for(var H=0;j>H&&t[h+H]==t[h+H-N];++H);if(H>F){if(F=H,D=N,H>q)break;var U=Math.min(N,H-2),z=0;for(A=0;U>A;++A){var W=h-N+A+32768&32767,V=W-g[W]+32768&32767;V>z&&(z=V,P=W)}}}N+=(R=P)-(P=g[R])+32768&32767}if(D){w[T++]=268435456|Jo[F]<<18|Ko[D];var G=31&Jo[F],Z=31&Ko[D];C+=Wo[G]+Vo[Z],++k[257+G],++S[Z],E=h+F,++x}else w[T++]=t[h],++k[t[h]]}}u=pl(t,a,r,w,k,S,C,T,I,h-I,u),r||(u=fl(a,u,ml))}return ll(l,0,n+ol(u)+s)}(s,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+r.mem,o,l,!a)),h=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&_l(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var n=0;i.length>=n;++n)t[n+10]=i.charCodeAt(n)}}(u,e),_l(u,h-8,i.d()),_l(u,h-4,n),u}function wl(t,e){var i=t.length;if(!e&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new Ho(t.length+(t.length>>>1)),s=0,r=function(t){n[s++]=t},o=0;i>o;++o){if(s+5>n.length){var l=new Ho(s+8+(i-o<<1));l.set(n),n=l}var a=t.charCodeAt(o);128>a||e?r(a):2048>a?(r(192|a>>>6),r(128|63&a)):a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&t.charCodeAt(++o))>>>18),r(128|a>>>12&63),r(128|a>>>6&63),r(128|63&a)):(r(224|a>>>12),r(128|a>>>6&63),r(128|63&a))}return ll(n,0,s)}function kl(t,e){var i="";if(!e&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var n=0;t.length>n;){var s=t[n++];128>s||e?i+=String.fromCharCode(s):224>s?i+=String.fromCharCode((31&s)<<6|63&t[n++]):240>s?i+=String.fromCharCode((15&s)<<12|(63&t[n++])<<6|63&t[n++]):(s=((15&s)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,i+=String.fromCharCode(55296|s>>10,56320|1023&s))}return i}var Sl=class{constructor(t,e={}){var i,n,s,r;this._rrweb=t,this.it=e,this.rt={},this.ot=Date.now(),this.st=-1/0,this.ut=()=>{const t=Date.now(),e=t-this.ot;e>0?(this.ct=Math.min(this.dt,this.ct+e/1e3*this.ht),this.ot=t):this.ot=t},this.ft=t=>{if(!this.rt[t]){var e,i;this.rt[t]=!0;const n=this.vt(t);null===(e=(i=this.it).onBlockedNode)||void 0===e||e.call(i,t,n)}},this.yt=t=>{const e=this.vt(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){const t=e.closest("svg");if(t)return[this._rrweb.mirror.getId(t),t]}return[t,e]},this.vt=t=>this._rrweb.mirror.getNode(t),this.bt=t=>{var e,i,n,s,r,o,l,a;return(null!==(e=null===(i=t.removes)||void 0===i?void 0:i.length)&&void 0!==e?e:0)+(null!==(n=null===(s=t.attributes)||void 0===s?void 0:s.length)&&void 0!==n?n:0)+(null!==(r=null===(o=t.texts)||void 0===o?void 0:o.length)&&void 0!==r?r:0)+(null!==(l=null===(a=t.adds)||void 0===a?void 0:a.length)&&void 0!==l?l:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;const e=t.data,i=this.bt(e);if(e.attributes){const t=e.attributes.length;e.attributes=e.attributes.filter(t=>{const[e]=this.yt(t.id);return!this.wt.consumeRateLimit(e)&&t});const i=t-e.attributes.length;var n,s;i>0&&(null===(n=(s=this.it).onDroppedAttributeMutations)||void 0===n||n.call(s,i))}const r=this.bt(e);if(0===r&&i!==r)return;if(this.kt)return t;this.ut();const o=Bo(t);var l,a;return o>this.ct?(null===(l=(a=this.it).onDroppedOversizedMutation)||void 0===l||l.call(a,o),void this._t()):(this.ct-=o,t)},this._t=()=>{if(this.St)return;const t=Math.max(0,this.xt-(Date.now()-this.st));this.St=setTimeout(()=>{var t,e;this.St=void 0,this.st=Date.now(),null===(t=(e=this.it).requestFullSnapshot)||void 0===t||t.call(e)},t)},this.wt=new Qe({bucketSize:null!==(i=this.it.bucketSize)&&void 0!==i?i:100,refillRate:null!==(n=this.it.refillRate)&&void 0!==n?n:10,refillInterval:1e3,I:this.ft,$:Vs}),this.dt=null!==(s=this.it.bytesBucketSize)&&void 0!==s?s:0,this.ht=null!==(r=this.it.bytesRefillRate)&&void 0!==r?r:25600,this.kt=!Number.isFinite(this.dt)||0>=this.dt,this.ct=this.dt;const o=this.it.resyncIntervalMs;this.xt=Pe(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this.rt={},this.St&&(clearTimeout(this.St),this.St=void 0),this.st=Date.now()}stop(){this.wt.stop(),this.reset(),this.ct=this.dt,this.ot=Date.now(),this.st=-1/0}};const xl=t=>{if(n){try{const e=t+"=",i=n.cookie.split(";").filter(t=>t.length);for(let t=0;i.length>t;t++){let n=i[t];for(;" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Pe(t)&&isFinite(t)&&Math.floor(t)===t});var Cl=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,i,n,s){if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(n)||!Number.isInteger(s)||0>e||0>i||0>n||0>s||e>0xffffffffffff||i>4095||n>1073741823||s>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/256,r[5]=e,r[6]=112|i>>>8,r[7]=i,r[8]=128|n>>>24,r[9]=n>>>16,r[10]=n>>>8,r[11]=n,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new t(r)}toString(){let t="";for(let e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(let e=0;16>e;e++){const i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}},$l=class{generate(){const t=this.generateOrAbort();if(!Te(t))return t;{this.Ct=0;const t=this.generateOrAbort();if(Te(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return Pe(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Ct)this.Ct=t,this.Mt();else{if(this.Ct>=t+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return Cl.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new El}};let Tl=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!Te(t.crypto)&&crypto.getRandomValues&&(Tl=t=>crypto.getRandomValues(t));var El=class{nextUint32(){return this.Rt.length>this.$t||(Tl(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let Il;const Ml=()=>Rl().toString(),Rl=()=>(Il||(Il=new $l)).generate();let Pl="";const Ol=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Al=null;const Fl={Et(){if(!Me(Al))return Al;if(Al=!1,n)try{const t=`__ph_cookie_support_${Ml()}`;Fl.At(t,"xyz"),Al='"xyz"'===xl(t),Fl.Lt(t)}catch(t){Al=!1}return Al},Pt(t){Vs.error("cookieStore error: "+t)},Ot:xl,Dt(t){let e;try{e=JSON.parse(Fl.Ot(t))||{}}catch(t){}return e},At(t,e,i,s,r){if(!n)return!1;try{let o="",l="";const a=function(t,e){if(e){let e=function(t,e=n){if(Pl)return Pl;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";const i=t.split(".");let s=Math.min(i.length,8);const r="dmn_chk_"+Ml();for(;!Pl&&s--;){const t=i.slice(s).join("."),n=r+"=1;domain=."+t+";path=/";e.cookie=n+";max-age=3",e.cookie.includes(r)&&(e.cookie=n+";max-age=0",Pl=t)}return Pl}(t);if(!e){const i=(t=>{const e=t.match(Ol);return e?e[0]:""})(t);i!==e&&Vs.info("Warning: cookie subdomain discovery mismatch",i,e),e=i}return e?"; domain=."+e:""}return""}(n.location.hostname,s);if(i){const t=new Date;t.setTime(t.getTime()+864e5*i),o="; expires="+t.toUTCString()}r&&(l="; secure");const u=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+a+l;return u.length>3686.4&&Vs.warn("cookieStore warning: large cookie, len="+u.length),n.cookie=u,!0}catch(t){return!1}},Lt(t,e){if(null==n?void 0:n.cookie)try{Fl.At(t,"",-1,e)}catch(t){return}}};let Dl=null;const Ll={Et(){if(!Me(Dl))return Dl;let e=!0;if(Te(t))e=!1;else try{const t="__mplssupport__";Ll.At(t,"xyz"),'"xyz"'!==Ll.Ot(t)&&(e=!1),Ll.Lt(t)}catch(t){e=!1}return e||Vs.error("localStorage unsupported; falling back to cookie store"),Dl=e,e},Pt(t){Vs.error("localStorage error: "+t)},Ot(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Ll.Pt(t)}return null},Dt(t){try{return JSON.parse(Ll.Ot(t))||{}}catch(t){}return null},At(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Ll.Pt(t)}return!1},Lt(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Ll.Pt(t)}}},Nl=[lt,X,Y,et,it,nt,Ct,xt,kt],ql=[p,f,H,U,Pt,Rt,b,$t],Bl=t=>t+"_cpm",jl=["__proto__","constructor","prototype"],Hl=t=>{if(!Ce(t))return{};const e={};return Object.keys(t).forEach(i=>{-1===jl.indexOf(i)&&(e[i]=t[i])}),e},Ul=(t,e=[])=>{const i={};return[...ql,...e].forEach(e=>{const n=t[e];Te(n)||Me(n)||""===n||(i[e]=n)}),i},zl=t=>{let e=5381,i=2166136261;for(let n=0;t.length>n;n++){const s=t.charCodeAt(n);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},Wl=(t,e)=>({p:e,f:zl(JSON.stringify(t))}),Vl=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const i=Fl.Dt(Bl(t)),n=(null==i?void 0:i.f)===zl(e)&&Se(i.p);return{properties:n?i.p:[],isValid:n}}catch(t){return{properties:[],isValid:!1}}},Gl=(t,e)=>e+"|"+(Fl.Ot(Bl(t))||""),Zl={},Ql={Et:()=>!0,Pt(t){Vs.error("memoryStorage error: "+t)},Ot:t=>t in Zl?Zl[t]:null,Dt:t=>t in Zl?Zl[t]:null,At:(t,e)=>(Zl[t]=e,!0),Lt(t){delete Zl[t]}};let Jl=null;const Kl={Et(){if(!Me(Jl))return Jl;if(Jl=!0,Te(t))Jl=!1;else try{const t="__support__";Kl.At(t,"xyz"),'"xyz"'!==Kl.Ot(t)&&(Jl=!1),Kl.Lt(t)}catch(t){Jl=!1}return Jl},Pt(t){Vs.error("sessionStorage error: ",t)},Ot(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Kl.Pt(t)}return null},Dt(t){try{return JSON.parse(Kl.Ot(t))||null}catch(t){}return null},At(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Kl.Pt(t)}return!1},Lt(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Kl.Pt(t)}}};zs.DEBUG=!1,zs.LIB_VERSION="1.433.3",zs.LIB_NAME="web";var Yl=zs,Xl=class{constructor(t){if(!t.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.Ft=t.get_property.bind(t),this.Nt=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.Nt(K,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){const e=this.Ft(K);return Ce(i=e)&&Ee(i.sessionId)&&Pe(i.size)&&e.sessionId===t?e.size:0;var i}};function ta(t,e){return function(t){let e=0;for(let i=0;t.length>i;i++)e=(e<<5)-e+t.charCodeAt(i),e|=0;return Math.abs(e)}(t)%100<Ze(100*e,0,100,Vs)}function ea(t){return`$survey_response_${t}`}function ia(t,e){if(!e)return null;const i=t[ea(e)];return Se(i)?[...i]:i}function na(t={},e,i){const n={};return e.questions.forEach(e=>{if(Te(e.originalQuestionIndex))return;const i=0===(s=e.originalQuestionIndex)?"$survey_response":`$survey_response_${s}`;var s;const r=ia(t,e.id);Te(r)||(n[i]=r)}),ue(ue({$survey_questions:e.questions.map(e=>{var n,s;return{id:e.id,question:null!==(n=null==i?void 0:i[null!==(s=e.id)&&void 0!==s?s:""])&&void 0!==n?n:e.question,response:ia(t,e.id)}})},t),n)}function sa(t={}){return Object.values(t).some(t=>!Re(t))}function ra(t,e){let i=`$survey_${e}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(i=`$survey_${e}/${t.id}/${t.current_iteration}`),i}function oa(t){return"string"==typeof t&&t.trim()?t.trim():null}function la(t){return t.toLowerCase()}function aa(t,e,i){if(!t||!e)return null;const n=la(e),s=Object.keys(t).find(t=>la(t)===n);if(s)return null==i||i.debug(`Found exact translation match: ${s}`),s;if(n.includes("-")){const s=n.split("-")[0],r=Object.keys(t).find(t=>la(t)===s);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${e})`),r}return null}const ua=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function ha(t,e,i){var n;const s=aa(t.translations,e,i),r=ue({},t);let o=!1;if(s){var l;const e=null===(l=t.translations)||void 0===l?void 0:l[s];if(e)if(null==i||i.info(`Applying survey-level translation for language: ${s}`),Te(e.name)||(r.name=e.name,o=!0),r.appearance){const t=ue({},r.appearance);for(const i of ua){const n=e[i];Te(n)||(t[i]=n,o=!0)}r.appearance=t}else(function(t){return ua.some(e=>!Te(t[e]))})(e)&&(o=!0)}const a=t.questions.map(t=>function(t,e,i){var n;const s=aa(t.translations,e,i);if(!s)return{question:t,matchedKey:null,hasChanges:!1};const r=null===(n=t.translations)||void 0===n?void 0:n[s];if(!r)return{question:t,matchedKey:null,hasChanges:!1};const o=ue({},t);let l=!1;return Te(r.question)||(o.question=r.question,l=!0),Te(r.description)||(o.description=r.description,l=!0),Te(r.buttonText)||(o.buttonText=r.buttonText,l=!0),"link"in o&&!Te(r.link)&&(o.link=r.link,l=!0),"lowerBoundLabel"in o&&!Te(r.lowerBoundLabel)&&(o.lowerBoundLabel=r.lowerBoundLabel,l=!0),"upperBoundLabel"in o&&!Te(r.upperBoundLabel)&&(o.upperBoundLabel=r.upperBoundLabel,l=!0),"choices"in o&&function(t){return Se(t.choices)}(r)&&(o.choices=r.choices,l=!0),{question:l?o:t,matchedKey:l?s:null,hasChanges:l}}(t,e,i)),u=a.map(t=>t.question),h=a.some(t=>t.hasChanges);let c=null;return s||(c=(null===(n=a.find(t=>t.matchedKey))||void 0===n?void 0:n.matchedKey)||null),h&&(r.questions=u,o=!0,null==i||i.info(`Applied question-level translations for language: ${e}`)),{survey:r,matchedKey:o?s||c:null}}function ca(t){var e;return!!(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)}function da(t){var e;return ca(t)&&!!(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e?void 0:e.repeatedActivation)||"always"===t.schedule}const va=(t,e)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},fa=t=>t.toLowerCase(),pa={exact:(t,e)=>e.some(e=>t.some(t=>e===t)),is_not:(t,e)=>e.every(e=>t.every(t=>e!==t)),regex:(t,e)=>e.some(e=>t.some(t=>va(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!va(e,t))),icontains:(t,e)=>e.map(fa).some(e=>t.map(fa).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(fa).every(e=>t.map(fa).every(t=>!e.includes(t))),gt:(t,e)=>e.some(e=>{const i=parseFloat(e);return!isNaN(i)&&t.some(t=>i>parseFloat(t))}),lt:(t,e)=>e.some(e=>{const i=parseFloat(e);return!isNaN(i)&&t.some(t=>i<parseFloat(t))})};function ga(t,e){return!t||Object.entries(t).every(([t,i])=>{const n=null==e?void 0:e[t];if(null==n)return!1;const s=pa[i.operator];return!!s&&s(i.values,[String(n)])})}function ma(t,e,i){return or({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}const ya=new Set(["is_not","not_icontains","not_regex"]);function _a(t,e,i){return!t||0===t.length||t.every(t=>{const n="person"===t.type?i:e,s=null==n?void 0:n[t.key],r=t.operator||"exact";if(Te(s)||Me(s))return ya.has(r);const o=pa[r];return!!o&&!Te(t.value)&&!Me(t.value)&&o(Se(t.value)?t.value.map(String):[String(t.value)],Se(s)?s.map(String):[String(s)])})}const ba=Gs("[SessionRecording]");function wa(t,e){return e?t:"!"+t}function ka(t,e){return t===e||t!=="!"+e&&null}var Sa=class{constructor(t,e,i,n,s,r,o){this._instance=t,this.Y=e,this.tt=i,this.et=n,this.qt=s,this.jt=r,this.Bt=o,this.Ht=null,this.zt=Lo}onRemoteConfig(t){this.Ht=Pe(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ut=new Eo([this.tt,this.Y]),this.zt=Do):(this.Ut=new Io([this.tt,this.Y]),this.zt=Lo),this._instance.register_for_session({[Ht]:t.triggerMatchType}),this.Y.onConfig(t),this.tt.onConfig(t),this.et.onConfig(t,(t,e)=>{this.qt("linked_flag_matched",{flag:t,variant:e}),this.Bt()})}getStatus(t){return this.zt({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){const e=this._instance.get_property("$session_recording_remote_config"),i=null==e?void 0:e.minimumDurationMilliseconds;return Pe(i)?i:null}checkUrlTriggers(t,e,i,n){this.Y.checkUrlTriggerConditions(e,i,n,t)}setupEventTriggerListeners(t,e,i){if(0!==this.tt.K.length&&Re(this.Wt))return this.Wt=t(t=>{try{this.tt.checkEventTriggerConditions(t.event,i,e)}catch(t){ba.error("Could not activate event trigger",t)}}),this.Wt}makeSamplingDecisions(t){var e;const i=this.Ht;var n,s;if(!Pe(i))return null===(n=this._instance.persistence)||void 0===n||n.unregister("$session_is_sampled"),void(null===(s=this._instance.persistence)||void 0===s||s.unregister("$replay_sample_rate"));const r=this._instance.get_property(U),o=this._instance.get_property(L),l=ka(r,t),a=Pe(o)&&o!==i,u=Te(o)&&r===t,h=a||u||!Ae(l),c=h?ta(t,i):l;h&&(c?this.qt("sampled"):ba.warn(`Sample rate (${i}) has determined that this sessionId (${t}) will not be sent to the server.`)),null===(e=this._instance.persistence)||void 0===e||e.register({$session_is_sampled:wa(t,c),$replay_sample_rate:Me(o)&&r===t?null:i})}ensureSamplingDecision(t){if(!Pe(this.Ht))return;const e=this._instance.get_property(U);Ae(ka(e,t))||this.makeSamplingDecisions(t)}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,i,n,s;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_recording_event_trigger_activated_session"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_recording_url_trigger_activated_session"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_is_sampled"),null===(n=this._instance.persistence)||void 0===n||n.unregister("$replay_sample_rate"),null===(s=this._instance.persistence)||void 0===s||s.unregister("$session_past_minimum_duration")}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null===(e=this.Ut)||void 0===e?void 0:e.triggerStatus(t))===ko}getPendingTriggerConditions(t){return[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===ko).map(({label:t})=>t)}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.tt.stop(),this.Y.stop(),this.et.stop()}},xa=class{constructor(t,e,i,n,s){this._instance=t,this.Y=e,this.qt=i,this.Vt=n,this.Bt=s,this.Zt=[],this.Gt=new Map,this.Qt=!1}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Jt(t.triggerGroups),this._instance.register_for_session({[Ht]:"v2_trigger_groups",[Ut]:t.triggerGroups.length}),this.Y.onConfig(t)):ba.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return bo;if(!t.receivedFlags)return mo;if(!t.isRecordingEnabled)return fo;if(t.urlTriggerMatching.urlBlocked)return yo;const e=t.triggerGroupMatchers,i=t.triggerGroupSamplingResults;if(0===e.length)return fo;let n=!1,s=!1;for(const r of e){const e=r.triggerStatus(t.sessionId);if("trigger_activated"===e){const t=r.group.id,e=i.get(t);Te(e)?Vs.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(s=!0)}else"trigger_pending"===e&&(n=!0)}return s?po:n?mo:fo}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Zt,triggerGroupSamplingResults:this.Gt,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){let e=null;for(const i of this.Zt)if("trigger_activated"===i.triggerStatus(t)){const t=i.group.minDurationMs;Pe(t)&&(Me(e)||e>t)&&(e=t)}return e}checkUrlTriggers(t,e,i,n){this.Y.checkUrlBlocklist(e,i);for(const n of this.Zt)n.checkUrlTriggerConditions(e,i,e=>{this.Kt(n,void 0)&&(n.activateTrigger(e,t),this.updateActiveTriggers(t),this.Bt(e))},t)}setupEventTriggerListeners(t,e,i){return this.Wt=t(t=>{var i;if(this.Qt)return ba.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(i=this.Wt)||void 0===i||i.call(this),void(this.Wt=void 0);try{for(const i of this.Zt)i.checkEventTriggerConditions(t.event,n=>{if(!this.Kt(i,t.properties))return;const s=(i.group.conditions.events||[]).filter(e=>e.name===t.event),r=this._instance.get_property(lt);s.some(e=>!e.properties||0===e.properties.length||_a(e.properties,t.properties,r))&&(i.activateTrigger(n,e),this.updateActiveTriggers(e),this.Bt(n))},e)}catch(t){ba.error("Could not activate event trigger for trigger groups",t)}}),this.Wt}makeSamplingDecisions(t){for(const i of this.Zt){var e;const n=i.group,s=n.id,r=n.sampleRate,o=Q+s,l=this._instance.get_property(o);let a=null,u=!1,h=!1,c=!1;if(Ce(l)){const e=l.sessionId,i=l.sampleRate,n=l.sampled;u="string"==typeof e&&e!==t,h=Pe(i)&&i!==r,a=e===t&&Pe(i)&&i===r&&Ae(n)?n:null}else a=l===t||null,u="string"==typeof l&&l!==t,c=l===t;const d=u||h||c||!Ae(a),v=d?ta(t+s,r):a;d&&this.Vt("triggerGroupSamplingDecisionMade",{group_id:s,group_name:n.name,sampleRate:r,isSampled:v}),this.Gt.set(s,v),null===(e=this._instance.persistence)||void 0===e||e.register({[o]:{sessionId:t,sampleRate:r,sampled:v}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Qt=!0}clearConditionalRecordingPersistence(){var t,e,i;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$replay_sample_rate"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_past_minimum_duration");for(const t of this.Zt){var n,s,r;const e=t.group.id;null===(n=this._instance.persistence)||void 0===n||n.unregister("$posthog_sr_group_event_trigger_"+e),null===(s=this._instance.persistence)||void 0===s||s.unregister("$posthog_sr_group_url_trigger_"+e),null===(r=this._instance.persistence)||void 0===r||r.unregister("$posthog_sr_group_sampling_"+e)}}updateActiveTriggers(t){const e=[];for(const i of this.Zt){const n=i.group,s=n.id,r="trigger_activated"===i.triggerStatus(t),o=!0===this.Gt.get(s);r&&e.push({id:s,name:n.name,matched:!0,sampled:o})}this._instance.register_for_session({[Bt]:e})}hasPendingTriggers(t){for(const e of this.Zt)if("trigger_pending"===e.triggerStatus(t))return!0;return!1}getPendingTriggerConditions(t){return this.Zt.flatMap(e=>"trigger_pending"!==e.triggerStatusNoSideEffects(t)?[]:e.getPendingTriggerConditions(t).map(t=>`trigger group "${e.group.name}": ${t}`))}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear(),this.Y.stop()}Kt(t,e){const i=t.group.conditions.properties;return!i||0===i.length||_a(i,e,this._instance.get_property(lt))}Jt(t){this.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear();for(const e of t){const t=new Fo(this._instance,e,(t,i)=>{this.qt("linked_flag_matched",{flag:t,variant:i,group_id:e.id,group_name:e.name}),this.Bt()});this.Zt.push(t)}}};const Ca=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],$a=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ca],Ta="<masked>",Ea=["li_fat_id"];function Ia(t,e,i){if(!n)return{};const s=e?[...Ca,...i||[]]:[],r=Ma(hr(n.URL,s,Ta),t),o=function(){const t={};return Qs(Ea,function(e){const i=xl(e);t[e]=i||null}),t}();return Js(o,r)}function Ma(t,e){const i=$a.concat(e||[]),n={};return Qs(i,function(e){const i=ur(t,e);n[e]=i||null}),n}function Ra(t){const e=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!Me(e)){s.$search_engine=e;const t=n?ur(n.referrer,i):"";t.length&&(s.ph_keyword=t)}return s}function Pa(){return navigator.language||navigator.userLanguage}function Oa(){const t=Pa();return"string"==typeof t?t.split("-")[0]:void 0}const Aa="$direct";function Fa(){return(null==n?void 0:n.referrer)||Aa}function Da(t,e,i=!1){const n=t?[...Ca,...e||[]]:[],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:Fa().substring(0,1e3),u:o?hr(o,n,Ta):void 0}}function La(t,e=!1){var i;const{r:n,u:s}=t,r=e?un(s):s,o={$referrer:n,$referring_domain:null==n?void 0:n==Aa?Aa:null===(i=lr(n))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const t=lr(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const e=Ma(r);Js(o,e)}if(n){const t=Ra(n);Js(o,t)}return o}function Na(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function qa(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const Ba=1e5,ja=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Ha=[],Ua=()=>!1,za="@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(" "),Wa="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Va="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(" "),Ga="Accommodation AdministrativeArea Country Place State".split(" "),Za={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:Wa,publisher:Va},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Ha},Offer:{seller:Va},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:Va,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Va,areaServed:Ga,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Ha}},Qa=[["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(" "),Za.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Za.Event],[Va,Za.Organization],[Ga,Za.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Za.Product]];function Ja(t,e){return we.call(t,e)?t[e]:void 0}function Ka(t){const e=typeof t;return Me(t)||"string"===e||"number"===e||"boolean"===e}function Ya(t,e){return e&&function(t){return Ee(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function Xa(t,e){return Se(t)&&t.every(Ka)?t.map(t=>Ya(t,e)).filter(t=>!Te(t)):Ka(t)?Ya(t,e):void 0}function tu(t,e){if("string"!=typeof t)return;const i=t.trim(),n=i.indexOf("#"),s=0>n?i:i.slice(n+1);if(!(!s||0>n&&(/^[a-z][a-z\d+.-]*:/i.test(i)||i.includes("/")||i.includes("?"))))try{return e(s)?s:void 0}catch(t){return}}function eu(t){if(we.call(Za,t))return Za[t];for(const[e,i]of Qa)if(e.includes(t))return i}function iu(t,e,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0})}function nu(t,e,i,n){if(Se(t)){const s=t.map(t=>nu(t,e,i,n)).filter(t=>!Te(t));return s.length?s:void 0}return su(t,e,i,n)||void 0}function su(t,e,i,n){if(!Ce(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(i))return null;const s=Ja(t,"@type"),r=function(t){const e=new Set,i="string"==typeof t?[t]:Se(t)?t:[],n=[];for(const t of i){if("string"!=typeof t)continue;const i=t.replace(/^https?:\/\/schema\.org\//,"");if(100>=i.length&&ja.test(i)&&!e.has(i)&&(e.add(i),n.push(i),20===n.length))break}return n}(s),o=r.filter(t=>!!eu(t)&&(!n||!n.length||n.includes(t))),l={};for(const n of za){const o="@type"===n?r.length?"string"==typeof s?r[0]:r:void 0:"@id"===n?tu(Ja(t,n),e):Xa(Ja(t,n),i.maskUrl);Te(o)||iu(l,n,o)}for(const n of o){const s=eu(n);for(const n of Object.keys(s)){const r=Ja(t,n),o=s[n];if(!0===o){const t=Xa(r,i.maskUrl);Te(t)||iu(l,n,t)}else{const t=nu(r,e,i,o);Te(t)||iu(l,n,t)}}}const a=nu(Ja(t,"@graph"),e,i);return Te(a)||iu(l,"@graph",a),Object.keys(l).length?l:null}function ru(t,e,i){if(!Ce(t))return null;const n=Ja(t,"@context");if("string"!=typeof n||!/^https?:\/\/schema\.org\/?$/.test(n))return null;const s=su(t,e,i);return s?ue({"@context":"https://schema.org"},s):null}function ou(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function lu(t,e,i){if("string"==typeof e?t.classList.contains(e):e&&Array.from(t.classList).some(t=>(e.lastIndex=0,e.test(t))))return!0;try{return!!i&&t.matches(i)}catch(t){return!1}}function au(t,e,i){for(let n=t;n;){if(lu(n,e,i))return!0;const t=n.parentNode;n=n.parentElement||(t&&t.nodeType===t.DOCUMENT_FRAGMENT_NODE?t.host:null)}return!1}function uu(t){return ou(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(ou)}function hu(t){return Te(t)?void 0:Math.round(t)}function cu(t){return Ce(t)?t.network_timing:t}const du=Gs("[SessionRecording]"),vu=[1,2,3,4,5,6,7,12],fu=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function pu(){var t;return null==d||null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function gu(){var t;return null===(t=pu())||void 0===t?void 0:t.record}function mu(t){try{return JSON.stringify(t)}catch(e){return JSON.stringify(t,No())}}function yu(t){return kl(bl(wl(mu(t))),!0)}function _u(t){return bu.apply(this,arguments)}function bu(){return(bu=re(function*(t){const e=yield gs(mu(t),Yl.DEBUG,{rethrow:!0});return kl(new Uint8Array(yield e.arrayBuffer()),!0)})).apply(this,arguments)}let wu,ku;const Su="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let xu=!1;function Cu(t){var e;return Se(t)&&0===t.length?(wu=null!==(e=wu)&&void 0!==e?e:yu([]),wu):yu(t)}function $u(t){return Tu.apply(this,arguments)}function Tu(){return(Tu=re(function*(t){var e;return Se(t)&&0===t.length?wu||(ku=null!==(e=ku)&&void 0!==e?e:_u([]).then(t=>(wu=t,t)).catch(t=>{throw wu=void 0,ku=void 0,t}),ku):_u(t)})).apply(this,arguments)}function Eu(t){return Su&&!xu&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function Iu(t){return{event:t,size:Bo(t)}}function Mu(t,e){return ue(ue({},t),{},{data:e,cv:"2024-10"})}function Ru(t,e){return ue(ue({},t),{},{cv:"2024-10",data:ue(ue({},t.data),e)})}function Pu(t){try{if(2===t.type)return Iu(Mu(t,yu(t.data)));if(3===t.type&&0===t.data.source)return Iu(Ru(t,{texts:Cu(t.data.texts),attributes:Cu(t.data.attributes),removes:Cu(t.data.removes),adds:Cu(t.data.adds)}));if(3===t.type&&8===t.data.source)return Iu(Ru(t,{adds:t.data.adds?yu(t.data.adds):void 0,removes:t.data.removes?yu(t.data.removes):void 0}))}catch(t){du.error("could not compress event - will use uncompressed event",t)}return{event:t,size:qo(t)}}function Ou(){return Ou=re(function*(t){try{if(2===t.type)return Iu(Mu(t,yield _u(t.data)));if(3===t.type&&0===t.data.source){const[e,i,n,s]=yield Promise.all([$u(t.data.texts),$u(t.data.attributes),$u(t.data.removes),$u(t.data.adds)]);return Iu(Ru(t,{texts:e,attributes:i,removes:n,adds:s}))}if(3===t.type&&8===t.data.source){const[e,i]=yield Promise.all([t.data.adds?_u(t.data.adds):void 0,t.data.removes?_u(t.data.removes):void 0]);return Iu(Ru(t,{adds:e,removes:i}))}}catch(e){return cs(e)&&(xu=!0),du.error("could not compress event asynchronously - trying synchronous compression",e),Pu(t)}return{event:t,size:qo(t)}}),Ou.apply(this,arguments)}function Au(t,e){return 5===t.type&&t.data.tag===e}function Fu(t){return Au(t,"sessionIdle")}function Du(t){return Au(t,"$session_ending")}function Lu(t){return Au(t,"$session_starting")}var Nu=class{get sessionId(){return this.Xt}get Yt(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get te(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get ee(){return ka(this._instance.get_property(U),this.sessionId)}get Ht(){var t;const e=null===(t=this.ne)||void 0===t?void 0:t.sampleRate;return Pe(e)?e:null}get ie(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t,e){this._instance=t,this.oe="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.se=void 0,this.ae=!1,this.le=Date.now(),this.ue=!1,this.ce=[],this.de="unknown",this.he=0,this.fe=0,this.ve=0,this.pe=0,this.me=!1,this.ge=!1,this.ye=!1,this.be=!1,this.we=!1,this.ke=!1,this._e=!1,this.Se=!1,this.xe=!1,this.Ce=!1,this.Me=!1,this.Ie=!1,this.Te=[],this.Re=void 0,this.$e=void 0,this.Ee=!1,this.Ae=[],this.Oe=0,this.Le=0,this.Pe=!1,this.De=void 0,this.Wt=void 0,this.Fe=void 0,this.Ne=void 0,this.qe=void 0,this.je=(t,e,i)=>{var n,s,r,o;if(!i)return;if(t===this.Xt&&e===this.Be)return;const l=!i.noSessionId&&(i.activityTimeout||i.sessionPastMaximumLength),a=this.Xt,u=this.Be;var h;if(l&&this.Vt("$session_ending",{currentSessionId:a,currentWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le,flushed_size:null===(h=this.He)||void 0===h?void 0:h.currentTrackedSize(a)}),null===(n=this._instance.persistence)||void 0===n||n.unregister("$debug_first_full_snapshot_timestamp"),this._e=!1,null===(s=pu())||void 0===s||null===(r=s.resetMaxDepthState)||void 0===r||r.call(s),this.Vt("$session_id_change",{sessionId:t,windowId:e,changeReason:i}),this.ze(),!(!1===this.de&&this.isStarted||this.Xt===t&&this.Be===e)){const e=this.Xt!==t&&!1!==this.de;this.de="unknown",this.Ue(e)}l&&this.Vt("$session_starting",{previousSessionId:a,previousWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le}),null===(o=this.re)||void 0===o||o.makeSamplingDecisions(t)},this.We=!1,this.Ve=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[z])===this.Xt},this.Ze=()=>{var t,e;if(0===this.Rt.data.length)return null;const i=null===(t=this.Rt.data[0])||void 0===t?void 0:t.timestamp,n=null===(e=this.Rt.data[this.Rt.data.length-1])||void 0===e?void 0:e.timestamp;return Pe(i)&&Pe(n)?n-i:null},this.Ge=()=>{var t,e;const i=this.ie;if(!Pe(i))return!1;if(null===(t=null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.strictMinimumDuration)||void 0===t||!t){const t=this.Qe;return Pe(t)&&t>=0&&i>t}if(this.Ve())return!1;const n=this.Ze();return!!Me(n)||i>n||(null===(s=this._instance.persistence)||void 0===s||s.register({$session_past_minimum_duration:this.Xt}),!1);var s},this.Je=()=>{"buffering"!==this.status?(this.me&&this.ge&&this.Ke&&!this.ye&&this.Xe(void 0),this.Ye(),this.tn(!0)):this.en()},this.nn=()=>{this.Je()},this.rn=()=>{this.Vt("browser offline",{})},this.sn=()=>{this.Vt("browser online",{})},this.an=()=>{(null==n?void 0:n.visibilityState)&&("visible"===n.visibilityState&&(this.Ke=!0),this.Vt("window "+n.visibilityState,{}))},this.Ke=null==e||e;const{sessionId:i,windowId:s,sessionStartTimestamp:r}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=i,this.Be=s,this._sessionStartTimestamp=r,this.et=new Oo(this._instance),this.Y=new Po(this._instance),this.tt=new Ao(this._instance),this.Rt=this.en(),this.ln="ph_replay_pending_buffer_"+JSON.stringify([this._instance.config.persistence_name||this._instance.config.token,this._instance.config.token]),this.Yt.sessionTimeoutMs>this.te||du.warn(`session_idle_threshold_ms (${this.te}) is greater than the session timeout (${this.Yt.sessionTimeoutMs}). Session will never be detected as idle`),this.He=new Xl(this._instance)}setDocumentWasEverVisible(t){t&&(this.Ke=!0)}get un(){var t,e,i,n,s,r,o,l,a;const u=null===(t=this.ne)||void 0===t?void 0:t.masking,h={maskAllInputs:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.maskAllInputs,maskTextSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.maskTextSelector,blockSelector:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.blockSelector,maskAllElementAttributes:null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.maskAllElementAttributes},c=null!==(r=null==h?void 0:h.maskAllInputs)&&void 0!==r?r:null==u?void 0:u.maskAllInputs,d=null!==(o=null==h?void 0:h.maskTextSelector)&&void 0!==o?o:null==u?void 0:u.maskTextSelector,v=null!==(l=null==h?void 0:h.blockSelector)&&void 0!==l?l:null==u?void 0:u.blockSelector,f=null!==(a=null==h?void 0:h.maskAllElementAttributes)&&void 0!==a?a:null==u?void 0:u.maskAllElementAttributes;return Te(c)&&Te(d)&&Te(v)&&Te(f)?void 0:{maskAllInputs:null==c||c,maskTextSelector:d,blockSelector:v,maskAllElementAttributes:f}}cn(){var t;if(this.xe)return;const e=null===(t=this.ne)||void 0===t?void 0:t.masking;if(Re(e))return;const i=this._instance.config.session_recording,n=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(t=>{const n=null==i?void 0:i[t],s=e[t];return!Te(n)&&n!==s});0!==n.length&&(this.xe=!0,du.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+n.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==i?void 0:i.maskAllInputs,maskTextSelector:null==i?void 0:i.maskTextSelector,blockSelector:null==i?void 0:i.blockSelector,maskAllElementAttributes:null==i?void 0:i.maskAllElementAttributes},project:e}))}get dn(){var t;return Ze(null===(t=this._instance.config.session_recording.canvasCapture)||void 0===t?void 0:t.resolutionScale,.1,1,Gs("canvas recording resolution scale"),1)}get hn(){var t,e,i,n,s,r,o;const l=this._instance.config.session_recording.captureCanvas,a=null===(t=this.ne)||void 0===t?void 0:t.canvasRecording,u=null!==(e=null!==(i=null==l?void 0:l.recordCanvas)&&void 0!==i?i:null==a?void 0:a.enabled)&&void 0!==e&&e,h=null!==(n=null!==(s=null==l?void 0:l.canvasFps)&&void 0!==s?s:null==a?void 0:a.fps)&&void 0!==n?n:4;let c=null!==(r=null!==(o=null==l?void 0:l.canvasQuality)&&void 0!==o?o:null==a?void 0:a.quality)&&void 0!==r?r:.4;if("string"==typeof c){const t=parseFloat(c);c=isNaN(t)?.4:t}return{enabled:u,fps:Ze(h,0,12,Gs("canvas recording fps"),4),quality:Ze(c,0,1,Gs("canvas recording quality"),.4)}}get fn(){var t;const e=!!(null===(t=this.ne)||void 0===t?void 0:t.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return null!=i?i:e}get vn(){var t,e,i;const n=null===(t=this.ne)||void 0===t?void 0:t.networkPayloadCapture,s={recordHeaders:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.recordBody},r=(null==s?void 0:s.recordHeaders)||(null==n?void 0:n.recordHeaders),o=(null==s?void 0:s.recordBody)||(null==n?void 0:n.recordBody),l=cu(this._instance.config.capture_performance),a=cu(null==n?void 0:n.capturePerformance),u=!!(Ae(l)?l:a);return r||o||u?{recordHeaders:r,recordBody:o,recordPerformance:u}:void 0}pn(){var t,e;const i=[],n=null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;n&&this.fn&&i.push(n());const r=null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordNetworkPlugin;if(this.vn&&xe(r))if(!rr.includes(s.hostname)||this._forceAllowLocalhostNetworkCapture){const t=xe(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(r(((t,e,i)=>{const n={payloadSizeLimitBytes:so.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...so.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...so.payloadHostDenyList]},s=!1!==t.session_recording.recordHeaders&&e.recordHeaders,r=!1!==t.session_recording.recordBody&&e.recordBody,o=!1!==t.capture_performance&&e.recordPerformance,l=(t=>{const e=no(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=ho(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=ho(t.responseBody,t.responseHeaders,e,"Response")),t)})(n),a=e=>{return l(((t,e,i)=>{var n;if(null==i?void 0:i(t.name))return;const s=lr(t.name);let r=0===e.indexOf("http")?null===(n=lr(e))||void 0===n?void 0:n.pathname:e;"/"===r&&(r="");const o=null==s?void 0:s.pathname.replace(r||"","");return s&&o&&uo.some(t=>0===o.indexOf(t))?void 0:t})((ao((n=e).requestHeaders),ao(n.responseHeaders),n),t.api_host,i));var n},u=xe(t.session_recording.maskNetworkRequestFn);return u&&xe(t.session_recording.maskCapturedNetworkRequestFn)&&Vs.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),u&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{const i=t.session_recording.maskNetworkRequestFn({url:e.name});return!i&&e.isInitial?i:ue(ue({},e),{},{name:null==i?void 0:i.url})}),n.maskRequestFn=xe(t.session_recording.maskCapturedNetworkRequestFn)?e=>{var i,n;const s=a(e);if(!s)return;const r=s.isInitial?{name:"",entryType:s.entryType,startTime:s.startTime,duration:s.duration,endTime:s.endTime,timeOrigin:s.timeOrigin,timestamp:s.timestamp,isInitial:!0}:void 0,o=null===(i=(n=t.session_recording).maskCapturedNetworkRequestFn)||void 0===i?void 0:i.call(n,s);return Re(o)&&r?(vo.add(r),r):null!=o?o:void 0}:t=>function(t){if(!Te(t))return t.requestBody=co(t.requestBody,"Request"),t.responseBody=co(t.responseBody,"Response"),t}(a(t)),ue(ue(ue({},so),n),{},{recordHeaders:s,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.vn,t)))}else du.info("NetworkCapture not started because we are on localhost.");return i}mn(t){return this._instance.config.disable_capture_url_hashes?un(t):t}gn(t,e=!1){const i=e?un(t):this.mn(t),n=this._instance.config.mask_personal_data_properties?[...Ca,...this._instance.config.custom_personal_data_properties||[]]:[];return this.yn(hr(i,n,Ta))}yn(t){const e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var i;const n=e.maskCapturedNetworkRequestFn({name:t});return null!==(i=null==n?void 0:n.name)&&void 0!==i?i:null==n?void 0:n.url}if(e.maskNetworkRequestFn){const i=e.maskNetworkRequestFn({url:t});return null==i?void 0:i.url}return t}bn(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.ce.length?this.ce.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):du.warn("could not emit queued rrweb event.",e,t),!1}}Vt(t,e){return this.bn(fu(()=>gu().addCustomEvent(t,e)))}wn(){var t;return this.ae&&!0===(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)&&!this.Y.urlBlocked&&!0!==this.de}kn(t){if(!this.wn())return!1;try{const e=gu();return!!e&&(e.addCustomEvent("$json_ld",t),this.wn())}catch(t){return!1}}_n(t=!1){Promise.resolve().then(()=>{var e;return null===(e=this.Sn)||void 0===e?void 0:e.scan(t)})}xn(){try{if(this._instance.config.capture_pageview||!t)return;const e=new URL(t.location.href),i=this.gn(e.origin+e.pathname+e.search);this.Cn!==i&&(this.Cn=i,this.Vt("$url_changed",{href:i}))}catch(t){}}Mn(){if(this.ce.length){const t=[...this.ce];this.ce=[],t.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this.bn(t)})}}jt(){return this.bn(fu(()=>gu().takeFullSnapshot()))}get In(){var t,e,i;if((null===(t=this.re)||void 0===t?void 0:t.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var n;const t=null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.trigger_pending_buffer_interval_millis;return Pe(t)&&Number.isFinite(t)&&t>=1e3&&36e5>=t?t:6e4}return null!==(e=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.full_snapshot_interval_millis)&&void 0!==e?e:3e5}Tn(){if(this.Rn&&clearInterval(this.Rn),!0===this.de)return;const t=this.In;t&&(this.Rn=setInterval(()=>{this.jt()},t))}Bt(t){"event"===t&&this.$n(),!this.Y.urlBlocked&&["sampled","active"].includes(this.status)&&this.Tn()}En(){var t;this.Y.urlBlocked||(this.Y.urlBlocked=!0,null===(t=this.Sn)||void 0===t||t.scan(),clearInterval(this.Rn),du.info("recording paused due to URL blocker"),this.Vt("recording paused",{reason:"url blocker"}))}An(){var t;this.Y.urlBlocked&&(null===(t=this.Sn)||void 0===t||t.scan(),this.Y.urlBlocked=!1,this.jt(),this._n(),this.Tn(),this.Vt("recording resumed",{reason:"left blocked url"}),du.info("recording resumed"))}On(t,e){var i;if("event"===t&&this.$n(),!this.ue&&(null===(i=this.re)||void 0===i?void 0:i.hasPendingTriggers(this.sessionId))){this.ue=!0;try{var n,s;const i="url"===t?W:V;null===(n=this._instance.persistence)||void 0===n||n.register({[i]:this.sessionId}),null===(s=this.re)||void 0===s||s.updateActiveTriggers(this.sessionId),this.Bt(),this.tn(),this.qt(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.ue=!1}}}get isStarted(){return!!this.se}get ne(){const t=this._instance.get_property(F);if(!t)return;let e;try{e=Ce(t)?t:JSON.parse(t)}catch(t){return void du.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.We){var i;const n=null!==(i=e.cache_timestamp)&&void 0!==i?i:Date.now();if(Date.now()-n>36e5)return void du.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t})}return e}Ln(t,e,i){this._instance.get_property(t)&&(e(),i())}start(e){var i,s;const r=this.ne;if(!r)return void du.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const t=!1!==this.de&&!this.be;this.Xe(t?"no_interaction_since_recording_started":void 0),this.be=!1,this.ge=t,this.ye=!1}this.Pe&&(this.Pn(),this.en());const{sessionId:o,windowId:l,sessionStartTimestamp:a}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=o,this.Be=l,this._sessionStartTimestamp=a,this.Dn(),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),(null==r?void 0:r.endpoint)&&(this.oe=null==r?void 0:r.endpoint),this.re=2===(null==r?void 0:r.version)&&(null==r?void 0:r.triggerGroups)&&r.triggerGroups.length>0?new xa(this._instance,this.Y,this.qt.bind(this),this.Vt.bind(this),this.Bt.bind(this)):new Sa(this._instance,this.Y,this.tt,this.et,this.qt.bind(this),this.jt.bind(this),this.Bt.bind(this)),this.re.onRemoteConfig(r),null===(s=this.Wt)||void 0===s||s.call(this),this.Wt=this.re.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(t,e)=>this.On(t,e)),this.Ln(N,()=>{this.overrideSampling()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(N)}),this.Ln(q,()=>{this.overrideLinkedFlag()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(q)}),this.Ln(j,()=>{this.overrideTrigger("event")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(j)}),this.Ln(B,()=>{this.overrideTrigger("url")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(B)}),this.re.makeSamplingDecisions(this.sessionId),this.Fn(),this.we||(nr(t,"beforeunload",this.Je),nr(t,"pagehide",this.nn),nr(t,"offline",this.rn),nr(t,"online",this.sn),nr(n,"visibilitychange",this.an),!this.Fe&&xe(this.Yt.onSessionId)&&(this.Fe=this.Yt.onSessionId(this.je)),!this.Ne&&xe(this.Yt.on)?this.Ne=this.Yt.on("forcedIdleReset",()=>{this.ze(),this.de="unknown",this.stop(),this.qe=this.Yt.onSessionId((t,e,i)=>{var n;null===(n=this.qe)||void 0===n||n.call(this),this.qe=void 0,this.je(t,e,i)})}):xe(this.Yt.on)||du.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Re(this.De)&&(this.De=this._instance.on("eventCaptured",t=>{try{if("$pageview"===t.event){const e=(null==t?void 0:t.properties.$current_url)?this.gn(t.properties.$current_url):"";if(!e)return;this.Vt("$pageview",{href:e})}}catch(t){du.error("Could not add $pageview to rrweb session",t)}})),"active"===this.status&&this.qt(e||"recording_initialized"))}Nn(){var e,i,s,r,o,l;null==t||t.removeEventListener("beforeunload",this.Je),null==t||t.removeEventListener("pagehide",this.nn),null==t||t.removeEventListener("offline",this.rn),null==t||t.removeEventListener("online",this.sn),null==n||n.removeEventListener("visibilitychange",this.an),clearInterval(this.Rn),this.qn(),null===(e=this.De)||void 0===e||e.call(this),this.De=void 0,null===(i=this.Wt)||void 0===i||i.call(this),this.Wt=void 0,null===(s=this.Fe)||void 0===s||s.call(this),this.Fe=void 0,null===(r=this.Ne)||void 0===r||r.call(this),this.Ne=void 0,null===(o=this.qe)||void 0===o||o.call(this),this.qe=void 0,null===(l=this.re)||void 0===l||l.stop(),this.jn(),this.Pn()}Pn(){this.Le+=1,this.Ae=[],this.Oe=0,this.Bn=void 0,this.Pe=!1}jn(){var t,e;null===(t=this.Hn)||void 0===t||t.stop(),this.ce=[],null===(e=this.Sn)||void 0===e||e.stop(),this.Sn=void 0,this.ae=!1;try{var i;null===(i=this.se)||void 0===i||i.call(this)}catch(t){du.warn("could not stop rrweb",t)}this.se=void 0}zn(){if(!this.Bn||0===this.Oe)return!1;if(this.Pe)return!0;this.Pe=!0,this.Un=void 0;const t=this.Le;return this.qn(),this.jn(),this.Bn.catch(()=>{}).then(()=>{t===this.Le&&(this.Pe=!1,this.tn(),this.en(),this.Wn(),this.Nn(),du.info("stopped"))}).catch(()=>{this.Pe=!1,this.Wn(),this.Nn(),du.info("stopped")}),!0}stop(){if(this.jn(),this.We)this.Ye();else if(this.zn())return;this.tn(),this.en(),this.Wn(),this.Nn(),du.info("stopped")}Wn(){this.Xe(void 0,{preserveLogDedup:this.We}),this.ge=!1}flushBeforeIdentityReset(){(this.isStarted||this.Pe)&&(this.Ye(),this.tn())}Ue(t){this.We=!0,this.le=Date.now();try{var e,i;this.stop(),this.Vn=void 0,this.Zn=void 0,this.fe=0,this.ve=0,this.pe=0,null===(e=pu())||void 0===e||null===(i=e.resetSnapshotCostState)||void 0===i||i.call(e),this.start("session_id_changed")}finally{this.We=!1}this.Xe(t?"no_interaction_since_session_rotated":void 0),this.ge=!1}Xe(t,{preserveLogDedup:e=!1}={}){if(this.me=!Te(t),this.Un=t,Te(t))return void(e||(this.Gn=void 0));if(this.We)return;const i=`${this.sessionId}:${t}`;i!==this.Gn&&(this.Gn=i,du.info(`holding buffer: ${t}. nothing is uploaded until the user interacts with the page`))}$n(){this.isStarted||(this.be=!0),this.me&&(this.Xe(void 0),this.ge=!1,this.ye&&(this.ye=!1,this.jt()),this.Qn())}discard({discardProducerEvents:t=!1}={}){this.me=!0,t&&(this.en(),this.jn()),this.en(),this.Nn(),this.en(),this.Wn(),du.info("discarded")}Jn(t,e,i,n,s){const r={$snapshot_bytes:i,$snapshot_data:e,$session_id:n,$window_id:s};"disabled"!==this.status?(this.Kn(t,n),this.Xn(r)):this.en()}Yn(){try{this.ti()}catch(t){this.Se||(this.Se=!0,du.error("could not track full snapshot cost",t))}}ti(){var t,e;const i=null===(t=pu())||void 0===t||null===(e=t.getLastSnapshotCost)||void 0===e?void 0:e.call(t);i&&i!==this.Zn&&(this.Zn=i,this.Vn&&this.Vn.durationMs>=i.durationMs||(this.Vn=i),500>i.durationMs||du.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}))}Kn(t,e){2!==t.type?3===t.type&&(Te(this.Re)||this.Re===e||this.$e===e||(this.$e=e,du.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.jt())):this.Re=e}ei(t){t.counted&&t.generation===this.Le&&(this.Oe=Math.max(0,this.Oe-1)),t.counted=!1,this.Ae=this.Ae.filter(e=>e!==t)}ni(t,e,i){t.processed||t.generation!==this.Le||(t.processed=!0,this.Jn(t.event,e,i,t.targetSessionId,t.targetWindowId))}ii(t){try{let e=t.event,i=qo(t.event);if(t.compressionEnabled)try{({event:e,size:i}=Pu(t.event))}catch(t){du.error("could not process queued compression event - will use uncompressed event",t)}try{this.ni(t,e,i)}catch(t){du.error("could not capture queued compression event",t)}}finally{this.ei(t)}}Ye(){[...this.Ae].forEach(t=>{this.ii(t)})}ri(t,e,i,n){var s=this;const r={event:t,compressionEnabled:e,targetSessionId:i,targetWindowId:n,generation:this.Le,processed:!1,counted:!0};this.Ae.push(r),this.Oe+=1;const o=(l=re(function*(){try{if(r.processed)return;let i,n;try{const s=e?Eu(t)?yield function(t){return Ou.apply(this,arguments)}(t):Pu(t):{event:t,size:qo(t)};i=s.event,n=s.size}catch(e){du.error("could not process queued compression event - will use uncompressed event",e),i=t,n=qo(t)}s.ni(r,i,n)}finally{s.ei(r)}}),function(){return l.apply(this,arguments)});var l;this.Bn=this.Bn?this.Bn.catch(()=>{}).then(o):o()}onRRwebEmit(e){var i,n,s,r,o,l,a,u,h,c,d,v,f;if(!this._instance.sessionManager)return;if(this.Mn(),!e||!Ce(e))return;if(4===e.type){const t=this.gn(e.data.href);if(this.Cn=t,!t)return;e.data.href=t}else this.xn();if(null===(i=this.re)||void 0===i||i.checkUrlTriggers(this.sessionId,()=>this.En(),()=>this.An(),(t,e)=>this.On(t,e)),this.Y.urlBlocked&&!function(t){return 5===t.type&&"recording paused"===t.data.tag}(e))return;2===e.type&&((null===(c=pu())||void 0===c||null===(d=c.wasMaxDepthReached)||void 0===d?void 0:d.call(c))&&(this._e=!0),this.Yn(),Promise.resolve().then(()=>this.Yn()),this.Tn(),null===(v=this.Hn)||void 0===v||v.reset(),null===(f=this._instance.persistence)||void 0===f||f.register_once({$debug_first_full_snapshot_timestamp:e.timestamp},void 0));const p=2===e.type&&(null===(n=this.re)||void 0===n?void 0:n.hasPendingTriggers(this.sessionId));p&&this.oi();const g=this.Hn?this.Hn.throttleMutations(e):e;if(!g)return void(!0===this.de&&this.he++);const m=function(t){const e=t;if(e&&Ce(e)&&6===e.type&&Ce(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));const i=[];for(let t=0;e.data.payload.payload.length>t;t++)i.push(e.data.payload.payload[t]&&e.data.payload.payload[t].length>2e3?e.data.payload.payload[t].slice(0,2e3)+"...[truncated]":e.data.payload.payload[t]);return e.data.payload.payload=i,t}return t}(g),y=function(t){return Du(t)?t.data.payload:null}(m),_=function(t){return Lu(t)?t.data.payload:null}(m),b=function(t){return Fu(t)?t.data.payload:null}(m);y||_?(null==y?void 0:y.lastActivityTimestamp)&&(m.timestamp=y.lastActivityTimestamp):(null==b?void 0:b.sessionId)||this.si(m),2===e.type&&(this.Te.push([this.Xt,e.timestamp]),this.Te.length>6&&(this.Te=this.Te.slice(-6)));const w=null!==(s=null!==(r=null!==(o=null==y?void 0:y.currentSessionId)&&void 0!==o?o:null==_?void 0:_.nextSessionId)&&void 0!==r?r:null==b?void 0:b.sessionId)&&void 0!==s?s:this.Xt,k=null!==(l=null!==(a=null!==(u=null==y?void 0:y.currentWindowId)&&void 0!==u?u:null==_?void 0:_.nextWindowId)&&void 0!==a?a:null==b?void 0:b.windowId)&&void 0!==l?l:this.Be;if(!0===this.de&&!function(t){return Fu(t)||Du(t)||Lu(t)}(m))return void(function(t){return 2===t.type||4===t.type||3===t.type&&9!==t.data.source}(m)&&this.he++);2===m.type&&(this.he=0),b&&(m.timestamp=b.lastActivityTimestamp+b.threshold);const S=this.ae;this.ae=!0,p?this._n(!0):S||this._n();const x=null===(h=this._instance.config.session_recording.compress_events)||void 0===h||h;if(5===m.type&&"$json_ld"===m.data.tag){let e;try{e=t?this.gn(t.location.href):void 0}catch(t){}m.data.href=e}if(this.Oe>0||x&&Eu(m))return void this.ri(m,x,w,k);const{event:C,size:T}=x?Pu(m):{event:m,size:qo(m)};this.Jn(m,C,T,w,k)}get status(){return this.re?this.re.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.ee,rrwebError:this.we,urlTriggerMatching:this.Y,eventTriggerMatching:this.tt,linkedFlagMatching:this.et,remoteConfig:this.ne}):fo}log(t,e="log"){var i;null===(i=this._instance.sessionRecording)||void 0===i||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.et.linkedFlagSeen=!0,this.jt(),this.$n(),this.qt("linked_flag_overridden")}overrideSampling(){var t;null===(t=this._instance.persistence)||void 0===t||t.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this.jt(),this.$n(),this.qt("sampling_overridden")}overrideTrigger(t){this.On(t),this.$n()}ai(){try{var e;const i=null==t||null===(e=t.location)||void 0===e?void 0:e.href;if(!i)return;const n=this.gn(i);if(!n)return;return new URL(n).hostname||void 0}catch(t){return}}qn(){this.li&&(clearTimeout(this.li),this.li=void 0)}Qn(){this.li||(this.li=setTimeout(()=>{this.tn()},2e3))}ui(){return this.Re!==this.Rt.sessionId&&0!==this.Rt.data.length&&this.Rt.data.every(t=>5===(null==t?void 0:t.type)&&!Du(t)&&!Lu(t))}ci(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}di(t){if("buffering"!==t)return Te(this.hi)||this._instance.register_for_session({[jt]:[]}),void(this.hi=void 0);const e=this.ci();if(0===e.length)return Te(this.hi)||this._instance.register_for_session({[jt]:[]}),void(this.hi=void 0);const i=e.join(", "),n=`${this.sessionId}:${i}`;n!==this.hi&&(this.hi=n,this._instance.register_for_session({[jt]:e}),du.info(`buffering: ${i}`))}fi(){var t;return"memory"!==this._instance.config.persistence&&!0!==(null===(t=this._instance.persistence)||void 0===t?void 0:t.pi)&&Kl.Et()}mi(){0!==this.Rt.data.length&&this.Rt.size!==this.gi&&943718.4>=this.Rt.size&&this.fi()&&(this.gi=this.Rt.size,Kl.At(this.ln,this.Rt))}Dn(){if(this.Ee||!this.fi())return;this.Ee=!0;const t=Kl.Dt(this.ln);Kl.Lt(this.ln),Ce(t)&&Se(t.data)&&0!==t.data.length&&Se(t.sizes)&&t.sizes.length===t.data.length&&Pe(t.size)&&t.sessionId===this.Xt&&t.windowId===this.Be&&(this.Rt.data.length>0||(this.Rt=t))}tn(t=!1){var e;if(this.qn(),this.me)return this.Rt;if(this.ui())return this.Rt.size>943718.4?this.en():(t&&this.mi(),this.Rt);const i=this.Rt;null===(e=this.re)||void 0===e||e.ensureSamplingDecision(this.sessionId);const n=this.Ge(),s=this.status;if(this.di(s),"buffering"===s||"paused"===s||"disabled"===s||n)return!t||"active"!==s&&"sampled"!==s||this.mi(),this.Qn(),this.Rt;if(this.Rt!==i)return this.Rt;if(i.data.length>0){var r;const t=this.ai();jo(i).forEach(e=>{try{var i;null===(i=this.He)||void 0===i||i.trackSize(e.sessionId,e.size),this.yi({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:Yl.LIB_NAME,$lib_version:Yl.LIB_VERSION,$snapshot_host:t})}catch(t){du.warn("could not capture snapshot chunk - skipping it",t)}}),Te(this.gi)||(Kl.Lt(this.ln),this.gi=void 0),null===(r=this.re)||void 0===r||r.onFlushComplete()}return this.en()}Xn(t){var e;const i=2+((null===(e=this.Rt)||void 0===e?void 0:e.data.length)||0),n=t.$session_id,s=this.Rt.sessionId!==n;if(s||!0!==this.de&&!this.me&&this.Rt.size+t.$snapshot_bytes+i>943718.4){const e=this.Xt;if(this.Rt=this.tn(),this.Xt!==e)return;s&&this.Rt.data.length>0&&(this.Rt=this.en()),this.Rt.sessionId=n,this.Rt.windowId=t.$window_id}this.me&&(this.ye||this.Rt.size+t.$snapshot_bytes+i>943718.4)?this.ye||(this.ye=!0,this.Rt=this.en()):(this.Rt.size+=t.$snapshot_bytes,this.Rt.data.push(t.$snapshot_data),this.Rt.sizes.push(t.$snapshot_bytes),!0===this.de||this.me||this.Qn())}yi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.oe),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get Qe(){var t,e;const i=null===(t=this.Rt)||void 0===t?void 0:t.data[(null===(e=this.Rt)||void 0===e?void 0:e.data.length)-1];return i?i.timestamp-this._sessionStartTimestamp:null}oi(){if(!this.Rt||0===this.Rt.data.length)return this.en();let t=-1;for(let e=this.Rt.data.length-1;e>=0;e--)if(4===this.Rt.data[e].type){t=e;break}return 0>t?this.en():(this.Rt.data=this.Rt.data.slice(t),this.Rt.sizes=this.Rt.sizes.slice(t),this.Rt.size=this.Rt.sizes.reduce((t,e)=>t+e,0),this.Rt)}en(){return this.Rt={size:0,data:[],sizes:[],sessionId:this.Xt,windowId:this.Be},this.Rt}qt(t,e){this._instance.register_for_session({[Gt]:t}),du.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Vt("$recording_started",ue({reason:t},e))}bi(t){var e;return 3===t.type&&-1!==vu.indexOf(null===(e=t.data)||void 0===e?void 0:e.source)}si(t){const e=this.bi(t);e||!0===this.de||t.timestamp-this.le>this.te&&(this.de=!0,clearInterval(this.Rn),this.Vt("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.le,threshold:this.te,bufferLength:this.Rt.data.length,bufferSize:this.Rt.size,sessionId:this.Xt,windowId:this.Be}),this.tn());const{windowId:i,sessionId:n}=this.Yt.checkAndGetSessionAndWindowId(!e,t.timestamp);let s=!1;if(e&&(this.le=t.timestamp,this.de)){const e="unknown"===this.de;this.de=!1,e||(this.Vt("sessionNoLongerIdle",{reason:"user activity",type:t.type}),s=!0)}const r=this.Xt!==n,o=this.Be!==i;if(this.Be=i,this.Xt=n,r||o){const t=r&&!1!==this.de;t&&(this.de="unknown"),this.Ue(t)}else if(e&&this.$n(),s){var l;const t=["sampled","active"].includes(this.status)||(null===(l=this.re)||void 0===l?void 0:l.hasPendingTriggers(this.sessionId));this.he>0&&t&&this.jt(),this._n(),this.Tn()}}ze(){var t;null===(t=this.re)||void 0===t||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e,i,n,s,r,o,l,a,u,h,c;const d=null===(t=pu())||void 0===t||null===(e=t.getDeferredStylesheetStats)||void 0===e?void 0:e.call(t);return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this.Un,$sdk_debug_replay_internal_buffer_length:this.Rt.data.length,$sdk_debug_replay_internal_buffer_size:this.Rt.size,$sdk_debug_current_session_duration:this.Qe,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(i=this.He)||void 0===i?void 0:i.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Te,$snapshot_max_depth_exceeded:this._e,$sdk_debug_replay_slowest_full_snapshot_ms:hu(null===(n=this.Vn)||void 0===n?void 0:n.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:hu(null===(s=this.Vn)||void 0===s?void 0:s.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null===(r=this.Vn)||void 0===r?void 0:r.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null===(o=this.Vn)||void 0===o?void 0:o.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null===(l=this.Vn)||void 0===l?void 0:l.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==d?void 0:d.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==d?void 0:d.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==d?void 0:d.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:hu(null==d?void 0:d.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:hu(null==d?void 0:d.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:hu(null===(a=pu())||void 0===a||null===(u=a.getMutationCost)||void 0===u||null===(u=u.call(a))||void 0===u?void 0:u.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null===(h=pu())||void 0===h||null===(c=h.getDiscardedDurationSamples)||void 0===c?void 0:c.call(h),$sdk_debug_replay_throttled_mutations_dropped:this.fe,$sdk_debug_replay_oversized_mutations_dropped:this.ve,$sdk_debug_replay_oversized_mutation_bytes_dropped:this.pe,$sdk_debug_replay_rrweb_error:this.we,[Wt]:!!this.se,[Vt]:this.ke}}Fn(){var e;if(this.se)return;this.ke=!0;const i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},s=this._instance.config.session_recording;for(const[t,e]of Object.entries(s||{}))if(t in i)if("maskInputOptions"===t)i.maskInputOptions=ue({password:!0},e);else if("sampling"===t){const t=null!=e?e:{},n={};Te(t.mousemove)||(n.mousemove=t.mousemove),Te(t.mouseInteraction)||(n.mouseInteraction=t.mouseInteraction),i.sampling=n}else i[t]=e;var r,o,l,a;!0===(null==s?void 0:s.captureJsonLd)&&!0!==i.slimDOMOptions&&"all"!==i.slimDOMOptions&&(i.slimDOMOptions=ue(ue({},i.slimDOMOptions),{},{script:!0})),this.hn&&this.hn.enabled&&(i.recordCanvas=!0,i.sampling=ue(ue({},i.sampling),{},{canvas:this.hn.fps}),i.dataURLOptions={type:"image/webp",quality:this.hn.quality},i.canvasResolutionScale=this.dn,i.canvasMasking={configured:()=>{var t;return xe(null===(t=this._instance.config.session_recording)||void 0===t||null===(t=t.canvasCapture)||void 0===t?void 0:t.maskRegionsFn)},regionsFn:t=>{var e;const i=null===(e=this._instance.config.session_recording)||void 0===e||null===(e=e.canvasCapture)||void 0===e?void 0:e.maskRegionsFn;if(xe(i))try{var n;return null!==(n=i(t))&&void 0!==n?n:null}catch(t){return this.Me||(this.Me=!0,du.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.un&&(i.maskAllInputs=null===(r=this.un.maskAllInputs)||void 0===r||r,i.maskTextSelector=null!==(o=this.un.maskTextSelector)&&void 0!==o?o:void 0,i.blockSelector=null!==(l=this.un.blockSelector)&&void 0!==l?l:void 0,i.maskAllElementAttributes=null!==(a=this.un.maskAllElementAttributes)&&void 0!==a&&a),i.maskAllElementAttributes&&i.maskAttributeFn&&(i.maskAttributeFn=void 0,this.Ce||(this.Ce=!0,du.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.cn();const u=gu();if(!u)return void du.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this.Hn=null!==(e=this.Hn)&&void 0!==e?e:new Sl(u,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,e)=>{const i=`Too many mutations on node '${t}'. Rate limiting. This could be due to SVG animations or something similar`;du.info(i,{node:e}),this.log("[SessionRecording] "+i,"warn")},onDroppedAttributeMutations:t=>this.fe+=t,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this.In,onDroppedOversizedMutation:t=>{0===this.ve&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this.ve+=1,this.pe+=t},requestFullSnapshot:()=>this.jt()});const h=this.pn();if(this.se=u(ue({emit:t=>{this.onRRwebEmit(t)},plugins:h,errorHandler:(t,e)=>"rrweb"===e&&(this.Ie||(this.Ie=!0,du.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},i)),!this.se)return this.we=!0,void du.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.we=!1,!0===(null==s?void 0:s.captureJsonLd)&&n&&(null==t?void 0:t.MutationObserver)&&!this.Sn&&(this.Sn=function(t,e,i){const n=new WeakMap,s=i.getCaptureState||(()=>!0);let r=Ba;const o=function(t,e){const i=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?Ua:i=>{const n=t.getElementById(i);return!!n&&"SCRIPT"!==n.nodeName&&(!e.isRecordedElement||e.isRecordedElement(n))&&!au(n,e.blockClass,e.blockSelector)}}(t,i),l=e=>{try{const l=s();if(!r||!1===l||!e.isConnected||e.ownerDocument!==t||function(t,e){return au(t,e.blockClass,e.blockSelector)||au(t,e.maskTextClass,e.maskTextSelector)}(e,i))return;const a=function(t,e=Ua,i){if(!t||t.length>Ba)return null;try{const n=JSON.parse(t),s={maskUrl:i,remainingNodes:2048,exceeded:!1},r=Se(n)?n.map(t=>ru(t,e,s)):ru(n,e,s);if(s.exceeded||Me(r)||Se(r)&&(!r.length||r.some(Me)))return null;const o=JSON.stringify(r);return o.length>2e4?null:[r,o]}catch(t){return null}}(e.text,o,i.maskUrl);if(!a)return void n.delete(e);const[u,h]=a;if(Me(l))return void n.set(e,h);if(n.get(e)!==h){if(h.length>r)return void(r=0);i.emit(u)&&(n.set(e,h),r-=h.length)}}catch(t){return}};try{const i=new e(t=>{try{if(!r||!1===s())return;const e=t=>{for(const e of uu(t))l(e)};for(const i of t)if("childList"===i.type)ou(i.target)&&l(i.target),i.addedNodes.forEach(e);else if("characterData"===i.type){const t=i.target.parentNode;t&&ou(t)&&l(t)}else"attributes"===i.type&&ou(i.target)&&l(i.target)}catch(t){return}});return i.observe(t,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(e=!1){r&&!1!==s()&&uu(t.documentElement).forEach(t=>{e&&n.delete(t),l(t)})},stop(){return i.disconnect()}}}catch(t){return{scan(){},stop(){}}}}(n,t.MutationObserver,{maskUrl:t=>this.gn(t),attributeFilter:i.attributeFilter,blockClass:i.blockClass,blockSelector:i.blockSelector,isRecordedElement:t=>u.mirror.getId(t)>0,maskAllElementAttributes:i.maskAllElementAttributes,maskAttributeFn:i.maskAttributeFn,maskTextClass:i.maskTextClass,maskTextSelector:i.maskTextSelector,getCaptureState:()=>{var t;return!0!==(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)||this.Y.urlBlocked||this.Y.isCurrentUrlBlocked()?null:this.wn()},emit:t=>this.kn(t)}),this.Y.isCurrentUrlBlocked()&&this.Sn.scan()),this.le=Date.now(),this.de=Ae(this.de)?this.de:"unknown",this.tryAddCustomEvent("$remote_config_received",this.ne),this.Vt("$session_options",{sessionRecordingOptions:i,activePlugins:h.map(t=>null==t?void 0:t.name)}),this.Vt("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(t,e){return this.Vt(t,e)}};const qu=["type"];var Bu=function(t){return t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t}({}),ju=function(t){return t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t}({}),Hu=function(t){return t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t}({}),Uu=function(t){return t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t}({}),zu=function(t){return t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t}({}),Wu=function(t){return t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t}({}),Vu=function(t){return t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t}({});function Gu(t,e){return-1!==t.indexOf(e)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var Zu={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Qu={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Ju={};function Ku(t){if(Ju[t])return Ju[t];const e=function(t){var e,i;const n=null===(e=globalThis)||void 0===e||null===(e=e.Zone)||void 0===e||null===(i=e.__symbol__)||void 0===i?void 0:i.call(e,t);return n&&globalThis[n]?globalThis[n]:void 0}(t)||globalThis[t],i=e.prototype,n=t in Zu?Zu[t]:void 0,s=Boolean(n&&n.every(t=>{var e;return Boolean(null===(e=Object.getOwnPropertyDescriptor(i,t))||void 0===e||null===(e=e.get)||void 0===e?void 0:e.toString().includes("[native code]"))})),r=t in Qu?Qu[t]:void 0,o=Boolean(r&&r.every(t=>{var e;return"function"==typeof i[t]&&(null===(e=i[t])||void 0===e?void 0:e.toString().includes("[native code]"))}));if(s&&o)return Ju[t]=e.prototype,e.prototype;const l=document.createElement("iframe");l.style.display="none";let a=!1;try{document.body.appendChild(l);const n=l.contentWindow;if(!n)return e.prototype;const s=n[t].prototype;return s?(function(t){return Gu(t,"AppleWebKit")&&!Gu(t,"Chrome")}(navigator.userAgent)&&(l.classList.add("rr-block","ph-no-capture"),l.setAttribute("__rrwebUntaintedPrototype",t),a=!0),Ju[t]=s):i}catch(t){return i}finally{!a&&l.parentNode&&document.body.removeChild(l)}}var Yu=Object.create(null);function Xu(t,e,i){var n;const s=Yu[t],r=s[i];if(r)return r.call(e);const o=Ku(t),l=null===(n=Object.getOwnPropertyDescriptor(o,i))||void 0===n?void 0:n.get;return l?(s[i]=l,l.call(e)):e[i]}Yu.Node=Object.create(null),Yu.ShadowRoot=Object.create(null),Yu.MutationObserver=Object.create(null),Yu.Element=Object.create(null);var th,eh={};function ih(t,e,i){const n=`${t}.${String(i)}`;if(eh[n])return eh[n].bind(e);const s=Ku(t)[i];return"function"!=typeof s?e[i]:(eh[n]=s,s.bind(e))}function nh(){return Ku("MutationObserver").constructor}function sh(t,e,i){try{if(!(e in t))return()=>{};const n=t[e],s={next:n},r=i(function(...t){return s.next.apply(this,t)});return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:n},__rrweb_layer__:{enumerable:!1,value:s}})),t[e]=r,()=>{if(t[e]===r)return void(t[e]=s.next);const i=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let n=t[e],o=i(n);for(;o;){if(o.next===r)return void(o.next=s.next);n=o.next,o=i(n)}}}catch(t){return()=>{}}}var rh={childNodes:t=>Xu("Node",t,"childNodes"),parentNode:t=>Xu("Node",t,"parentNode"),parentElement:t=>Xu("Node",t,"parentElement"),textContent:t=>Xu("Node",t,"textContent"),isConnected(t){if(void 0===th){var e;const t=null===(e=Object.getOwnPropertyDescriptor(Ku("Node"),"isConnected"))||void 0===e?void 0:e.get;th=(null==t?void 0:t.toString().includes("[native code]"))?t:null}return null==th?void 0:th.call(t)},contains:(t,e)=>ih("Node",t,"contains")(e),getRootNode:t=>ih("Node",t,"getRootNode")(),host:t=>t&&"host"in t?Xu("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?Xu("Element",t,"shadowRoot"):null,querySelector:(t,e)=>ih("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>ih("Element",t,"querySelectorAll")(e),mutationObserver:nh,patch:sh};function oh(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var lh=0;function ah(){lh+=1}function uh(){return lh}function hh(t,e){return(e!==lh||t>6e4)&&!0}var ch=0,dh=0,vh=0,fh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},ph=null,gh=null,mh=[],yh=0,_h=0,bh={slowestBatchMs:0},wh={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function kh(t){(ch+=1)>1||(fh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},mh=[],yh=0,gh=(t=>t&&t>0?t:null)(t),dh=oh(),vh=lh)}function Sh(){return 0===ch?ph||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(ch-=1)>0?fh:(fh.durationMs=oh()-dh,fh.deferredStylesheetCount=yh,wh.deferredCount+=yh,gh=null,hh(fh.durationMs,vh)?fh:ph=fh)}function xh(t,e,i){let n=t.length;if(i>=32)return n;for(let s=0;t.length>s;s++){const r=t[s];try{const t=r.cssRules;if(t&&t.length)n+=xh(t,e,i+1);else if(e&&r.styleSheet){const t=r.styleSheet;if(!e.has(t)){e.add(t);const s=t.rules||t.cssRules;s&&(n+=xh(s,e,i+1))}}}catch(t){}}return n}function Ch(t){if(0===ch)return;const e=xh(t,null,0);fh.cssRuleCount+=e,_h>0&&(fh.nonDeferrableCssRuleCount+=e)}function $h(t){_h+=1;try{return t()}finally{_h-=1}}function Th(t){ch>0&&(fh.stylesheetMs+=t)}function Eh(t){if(0===ch||null===gh)return!1;const e=fh.cssRuleCount-fh.nonDeferrableCssRuleCount;return e>=gh||e+function(t){try{const e=t&&(t.rules||t.cssRules);if(!e)return 0;const i=new WeakSet;return i.add(t),xh(e,i,0)}catch(t){return 0}}(t)>gh}function Ih(){const t=mh;return mh=[],t}function Mh(){wh.failedCount+=1}function Rh(t){t>0&&(wh.abandonedCount+=t)}function Ph(t){return Ph="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ph(t)}function Oh(t,e,i){return(e=function(t){var e=function(t){if("object"!=Ph(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Ph(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ph(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ah(t){return t.nodeType===t.ELEMENT_NODE}function Fh(t){const e=t&&"host"in t&&"mode"in t&&rh.host(t)||null;return Boolean(e&&"shadowRoot"in e&&rh.shadowRoot(e)===t)}function Dh(t){return"[object ShadowRoot]"==={}.toString.call(t)}function Lh(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}function Nh(t){const{cssText:e}=t;if(3>e.split('"').length)return e;const i=["@import",`url(${JSON.stringify(t.href)})`];return""===t.layerName?i.push("layer"):t.layerName&&i.push(`layer(${t.layerName})`),t.supportsText&&i.push(`supports(${t.supportsText})`),t.media.length&&i.push(t.media.mediaText),i.join(" ")+";"}var qh=0;function Bh(t){const e=0===qh,i=e?oh():0;qh+=1;try{const e=t.rules||t.cssRules;if(!e)return null;Ch(e);let i=t.href;return!i&&t.ownerNode&&(i=t.ownerNode.baseURI),Lh(Array.from(e,t=>jh(t,i)).join(""))}catch(t){return null}finally{qh-=1,e&&Th(oh()-i)}}function jh(t,e){if(Uh(t)){let e;try{e=Bh(t.styleSheet)||Nh(t)}catch(i){e=t.cssText}try{var i;if(e&&(null===(i=t.styleSheet)||void 0===i?void 0:i.href))return rc(e,t.styleSheet.href)}catch(t){}return e}{let i=t.cssText;return zh(t)&&t.selectorText.includes(":")&&(i=Hh(i)),e?rc(i,e):i}}function Hh(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function Uh(t){return"styleSheet"in t}function zh(t){return"selectorText"in t}var Wh=/^-?[A-Za-z_][\w-]*$/,Vh=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Gh(t){const e=[];let i=!1,n=null;const s=new Map;function r(t){const s=e.pop();if("group"===s.kind){if(null===t){for(;e.length>0&&"group"===e[e.length-1].kind;)e.pop();return void r(null)}const i=e[e.length-1];return i.parts.push(t),void(i.index+=1)}if(!s.importRule)return i=!0,void(n=t);o(e[e.length-1],s.importRule,t)}function o(t,e,i){try{let s;try{s=i||Nh(e)}catch(t){s=e.cssText}try{var n;s&&(null===(n=e.styleSheet)||void 0===n?void 0:n.href)&&(s=rc(s,e.styleSheet.href))}catch(t){}s&&t.parts.push(s),t.index+=1}catch(t){r(null)}}function l(t){const i=t.rules[t.index];if("sheet"===t.kind&&Uh(i)){const n=s.get(i);return null===n?(t.parts.push(i.cssText),void(t.index+=1)):n?void e.push({kind:"sheet",sheet:n.sheet,rules:n.rules,sheetHref:n.sheetHref,index:0,parts:[],importRule:i}):void o(t,i,null)}if(function(t,i){try{const n=function(t){const e=t;if(!e.cssRules||0===e.cssRules.length)return null;if(e.media&&"string"==typeof e.media.mediaText)return`@media ${e.media.mediaText} {`;if(zh(t)){if("number"==typeof e.type&&1!==e.type)return null;const i=e.style?e.style.cssText:"";return`${t.selectorText} {${i?" "+i:""}`}if("containerName"in e)return"string"!=typeof e.containerQuery||e.containerName&&!Wh.test(e.containerName)?null:`@container ${e.containerName?`${e.containerName} `:""}${e.containerQuery} {`;if("string"==typeof e.conditionText){let n="";try{var i;n=(null===(i=t.constructor)||void 0===i?void 0:i.name)||""}catch(t){return null}return""===n||"Object"===n||"CSSSupportsRule"===n?`@supports ${e.conditionText} {`:null}return"string"==typeof e.name?"keyText"in e.cssRules[0]?Wh.test(e.name)?`@keyframes ${e.name} {`:null:""===e.name?"@layer {":Vh.test(e.name)?`@layer ${e.name} {`:null:null}(t);if(null===n)return!1;const s=i.sheetHref;return e.push({kind:"group",rules:Array.from(t.cssRules),sheetHref:s,index:0,parts:[],prelude:s?rc(n,s):n,fixColons:"sheet"===i.kind&&zh(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(i,t))return;let n=i.cssText;"sheet"===t.kind&&zh(i)&&i.selectorText.includes(":")&&(n=Hh(n)),t.parts.push(t.sheetHref?rc(n,t.sheetHref):n),t.index+=1}return function(t){try{const i=t.rules||t.cssRules;if(!i)return!1;Ch(i);let n=t.href;!n&&t.ownerNode&&(n=t.ownerNode.baseURI);const r=Array.from(i);return e.push({kind:"sheet",sheet:t,rules:r,sheetHref:n,index:0,parts:[],importRule:null}),function(t,e){const i=[{sheet:e,rules:t,index:0}];for(;i.length>0;){const t=i[i.length-1];if(t.index>=t.rules.length){i.pop();continue}const e=t.rules[t.index];if(t.index+=1,!Uh(e)||s.has(e))continue;let n=null;try{n=e.styleSheet}catch(t){s.set(e,null);continue}if(n&&!i.some(t=>t.sheet===n))try{const t=n.rules||n.cssRules;if(!t)continue;Ch(t);let r=n.href;!r&&n.ownerNode&&(r=n.ownerNode.baseURI);const o=Array.from(t);s.set(e,{sheet:n,rules:o,sheetHref:r}),i.push({sheet:n,rules:o,index:0})}catch(t){}}}(r,t),!0}catch(t){return!1}}(t)||(i=!0),{advance(t){if(i)return!0;const s=oh();let o=t>0?t:1;try{for(;!i&&o>0;){const t=e[e.length-1];if(t.index>=t.rules.length){let e=null;try{if("group"===t.kind){const i=t.prelude+t.parts.join("")+"}";e=t.fixColons?Hh(i):i}else e=Lh(t.parts.join(""))}catch(t){}r(e);continue}o-=1;try{l(t)}catch(t){r(null)}}}catch(t){i=!0,n=null}finally{Th(oh()-s)}return i},text:()=>i?n:null,remainingRules(){if(i)return 0;let t=0;for(const i of e)t+=i.rules.length-i.index;return t}}}var Zh=class{constructor(){Oh(this,"idNodeMap",new Map),Oh(this,"nodeMetaMap",new WeakMap)}getId(t){var e,i;return t&&null!==(e=null===(i=this.getMeta(t))||void 0===i?void 0:i.id)&&void 0!==e?e:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const e=this.getId(t);if(this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach(t=>this.removeNodeFromMap(t)),Ah(t)){const e=rh.shadowRoot(t);e&&this.removeNodeFromMap(e),"IFRAME"===t.nodeName&&t.contentDocument&&this.removeNodeFromMap(t.contentDocument)}}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){this.idNodeMap.set(e.id,t),this.nodeMetaMap.set(t,e)}replace(t,e){const i=this.getNode(t);if(i){const t=this.nodeMetaMap.get(i);t&&this.nodeMetaMap.set(e,t)}this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Qh({element:t,maskInputOptions:e,tagName:i,type:n,value:s,maskInputFn:r}){let o=s||"";const l=n&&Jh(n);return(e[i.toLowerCase()]||l&&e[l])&&(o=r?r(o,t):"*".repeat(o.length)),o}function Jh(t){return t.toLowerCase()}var Kh=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 Yh({element:t,name:e,value:i,maskAllElementAttributes:n,maskAttributeFn:s,isGenerated:r=!1}){return i?n?r&&Kh.has(Jh(e))?i:"*".repeat(i.length):s?s(e,i,t):i:i}var Xh="__rrweb_original__";function tc(t){try{const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?Jh(e):null}catch(t){return null}}var ec=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ic=/^(?:[a-z+]+:)?\/\//i,nc=/^www\..*/i,sc=/^(data:)([^,]*),(.*)/i;function rc(t,e){return(t||"").replace(ec,(t,i,n,s,r,o)=>{const l=n||r||o,a=i||s||"";if(!l)return t;if(ic.test(l)||nc.test(l))return`url(${a}${l}${a})`;if(sc.test(l))return`url(${a}${l}${a})`;if("/"===l[0])return`url(${a}${function(t){let e="";return e=t.indexOf("//")>-1?t.split("/").slice(0,3).join("/"):t.split("/")[0],e=e.split("?")[0],e}(e)+l}${a})`;const u=e.split("/"),h=l.split("/");u.pop();for(const t of h)"."!==t&&(".."===t?u.pop():u.push(t));return`url(${a}${u.join("/")}${a})`})}var oc,lc,ac=new Map,uc=1,hc=new RegExp("[^a-z0-9-_:]");function cc(){return uc++}var dc=/^[^ \t\n\r\u000c]+/,vc=/^[, \t\n\r\u000c]+/,fc=new WeakMap;function pc(t,e){return e&&""!==e.trim()?gc(t,e):e}function gc(t,e){let i=fc.get(t);if(i||(i=t.createElement("a"),fc.set(t,i)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return i.setAttribute("href",e),i.href}function mc(t,e){return(null==e?void 0:e.maxBase64ImageLength)?function(t,e){return e&&t.length>e?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":t}(t,e.maxBase64ImageLength):t}function yc(t,e,i,n,s,r){if(!n)return n;if("src"===i||"href"===i&&("use"!==e||"#"!==n[0])){if("link"===e&&s){var o;const t=null===(o=s.sheet)||void 0===o?void 0:o.href;if(t)return t}const i=pc(t,n);if(i.startsWith("data:")){if("img"===e&&s){let t=i;return((null==r?void 0:r.type)||void 0!==(null==r?void 0:r.quality))&&(t=function(t,e,i,n){if(1e5>e.length)return e;if(!t.complete||0===t.naturalWidth)return e;if(t.naturalWidth>4096||t.naturalHeight>4096)return e;const s=ac.get(e);if(s&&s.type===i&&s.quality===n)return s.result;try{const s=document.createElement("canvas");s.width=t.naturalWidth,s.height=t.naturalHeight;const r=s.getContext("2d");if(!r)return e;r.drawImage(t,0,0);const o=s.toDataURL(i||"image/webp",null!=n?n:.4),l=e.length>o.length?o:e;if(ac.size>=10){const t=ac.keys().next().value;void 0!==t&&ac.delete(t)}return ac.set(e,{type:i,quality:n,result:l}),l}catch(t){return e}}(s,i,r.type,r.quality)),mc(t,r)}if("image"===e)return mc(i,r)}return i}if("xlink:href"===i&&"#"!==n[0]){const i=pc(t,n);return"image"===e&&i.startsWith("data:")?mc(i,r):i}return"background"!==i||"table"!==e&&"td"!==e&&"th"!==e?"srcset"===i?function(t,e){if(""===e.trim())return e;let i=0;function n(t){let n;const s=t.exec(e.substring(i));return s?(n=s[0],i+=n.length,n):""}const s=[];for(;n(vc),e.length>i;){let r=n(dc);if(","===r.slice(-1))r=pc(t,r.substring(0,r.length-1)),s.push(r);else{let n="";r=pc(t,r);let o=!1;for(;;){const t=e.charAt(i);if(""===t){s.push((r+n).trim());break}if(o)")"===t&&(o=!1);else{if(","===t){i+=1,s.push((r+n).trim());break}"("===t&&(o=!0)}n+=t,i+=1}}}return s.join(", ")}(t,n):"style"===i?rc(n,gc(t)):"object"===e&&"data"===i?pc(t,n):n:pc(t,n)}function _c(t,e,i){return("video"===t||"audio"===t)&&"autoplay"===Jh(e)}function bc(t,e,i){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!i&&bc(rh.parentNode(t),e,i);for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!i&&bc(rh.parentNode(t),e,i)}function wc(t,e,i,n){let s;if(Ah(t)){if(s=t,!rh.childNodes(s).length)return!1}else{if(null===rh.parentElement(t))return!1;s=rh.parentElement(t)}try{if("string"==typeof e){if(n){if(s.closest(`.${e}`))return!0}else if(s.classList.contains(e))return!0}else if(bc(s,e,n))return!0;if(i)if(n){if(s.closest(i))return!0}else if(s.matches(i))return!0}catch(t){}return!1}function kc(t,e,i){const n=t.removeEventListener;"function"==typeof n&&n.call(t,e,i)}var Sc=new Map;function xc(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function Cc(t){return null==t?"":t.toLowerCase()}var $c=!1,Tc=!1;function Ec(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,maskTextClass:o,maskTextSelector:l,skipChild:a=!1,inlineStylesheet:u=!0,maskInputOptions:h={},maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v=!1,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g={},inlineImages:m=!1,recordCanvas:y=!1,canvasMaskingConfigured:_,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k=5e3,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:T=()=>!1,newlyAddedElement:E=!1,depth:I=0,maxDepth:M=50}=e;let{needsMask:R}=e,{preserveWhiteSpace:P=!0}=e;if(I>=M)return Tc=!0,$c||($c=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${M}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;R||(R=wc(t,o,l,void 0===R)),ch>0&&(fh.nodeCount+=1);const O=function(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:o,inlineStylesheet:l,maskInputOptions:a={},maskTextFn:u,maskInputFn:h,maskAllElementAttributes:c=!1,maskAttributeFn:d,dataURLOptions:v={},inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y=!1}=e,_=function(t,e){if(!e.hasNode(t))return;const i=e.getId(t);return 1===i?void 0:i}(i,n);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:Vu.Document,childNodes:[],compatMode:t.compatMode}:{type:Vu.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:Vu.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:_};case t.ELEMENT_NODE:return function(t,e){const{doc:i,blockClass:n,blockSelector:s,inlineStylesheet:r,maskInputOptions:o={},maskInputFn:l,maskAllElementAttributes:a=!1,maskAttributeFn:u,dataURLOptions:h={},inlineImages:c,recordCanvas:d,canvasMaskingConfigured:v,keepIframeSrcFn:f,newlyAddedElement:p=!1,rootId:g}=e,m=function(t,e,i){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(i)return t.matches(i)}catch(t){}return!1}(t,n,s),y=function(t){if(t instanceof HTMLFormElement)return"form";const e=Jh(t.tagName);return hc.test(e)?"div":e}(t),_=new Set;let b={};const w=t.attributes.length;for(let e=0;w>e;e++){const n=t.attributes[e];_c(y,n.name)||(b[n.name]=yc(i,y,Jh(n.name),n.value,t,h))}if("link"===y&&r&&!m){let e=t.sheet;if(!e){const n=function(t){return t.href}(t);n&&(e=xc(i,n),!e&&n.includes(".css"))&&(e=xc(i,window.location.origin+"/"+n.replace(window.location.href,"")))}let n=null;e&&(Eh(e)?ch>0&&(mh.push(t),yh+=1):n=Bh(e)),n&&(delete b.rel,delete b.href,b._cssText=n)}if("style"===y&&t.sheet&&!(t.innerText||rh.textContent(t)||"").trim().length){const e=$h(()=>Bh(t.sheet));e&&(b._cssText=e)}if("input"===y||"textarea"===y||"select"===y){const e=t.value,i=t.checked;"radio"!==b.type&&"checkbox"!==b.type&&"submit"!==b.type&&"button"!==b.type&&e?b.value=Qh({element:t,type:tc(t),tagName:y,value:e,maskInputOptions:o,maskInputFn:l}):i&&(b.checked=i)}if("option"===y&&(t.selected&&!o.select?b.selected=!0:delete b.selected),"dialog"===y&&t.open){try{b.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){b.rr_open_mode="modal",b.ph_rr_could_not_detect_modal=!0}_.add("rr_open_mode")}if("canvas"===y&&d&&!(null==v?void 0:v()))if("2d"===t.__context)(function(t){const e=t.getContext("2d");if(!e)return!0;for(let i=0;t.width>i;i+=50)for(let n=0;t.height>n;n+=50){const s=e.getImageData;if(new Uint32Array((Xh in s?s[Xh]:s).call(e,i,n,Math.min(50,t.width-i),Math.min(50,t.height-n)).data.buffer).some(t=>0!==t))return!1}return!0})(t)||(b.rr_dataURL=t.toDataURL(h.type,h.quality));else if(!("__context"in t)){const e=t.toDataURL(h.type,h.quality),n=i.createElement("canvas");n.width=t.width,n.height=t.height,e!==n.toDataURL(h.type,h.quality)&&(b.rr_dataURL=e)}let k,S=!1;if("img"===y&&c){oc||(oc=i.createElement("canvas"),lc=oc.getContext("2d"));const e=t,n=e.currentSrc||e.getAttribute("src")||"<unknown-src>",s=e.crossOrigin,r=(e,i)=>S?Yh({element:t,name:e,value:i,maskAllElementAttributes:a,maskAttributeFn:u}):i,o=()=>{kc(e,"load",o);try{oc.width=e.naturalWidth,oc.height=e.naturalHeight,lc.drawImage(e,0,0);const t=oc.toDataURL(h.type,h.quality);b.rr_dataURL=r("rr_dataURL",t)}catch(t){if("anonymous"!==e.crossOrigin)return e.crossOrigin="anonymous",void(e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o));console.warn(`Cannot inline img src=${n}! Error: ${t}`)}"anonymous"===e.crossOrigin&&(s?b.crossOrigin=r("crossOrigin",s):e.removeAttribute("crossorigin"))};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if("audio"===y||"video"===y){const e=b;e.rr_mediaState=t.paused?"paused":"played",_.add("rr_mediaState"),e.rr_mediaCurrentTime=t.currentTime,e.rr_mediaPlaybackRate=t.playbackRate,e.rr_mediaMuted=t.muted,e.rr_mediaLoop=t.loop,e.rr_mediaVolume=t.volume}if(p||(t.scrollLeft&&(b.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(b.rr_scrollTop=t.scrollTop)),m){var x,C,T;const{width:e,height:n,left:s,top:r}=t.getBoundingClientRect(),o=null===(x=i.defaultView)||void 0===x?void 0:x.getComputedStyle(t);b={class:b.class,rr_width:`${e}px`,rr_height:`${n}px`,rr_left:`${Math.floor(s+((null===(C=i.defaultView)||void 0===C?void 0:C.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(T=i.defaultView)||void 0===T?void 0:T.scrollY)||0))}px`},_.add("rr_width"),_.add("rr_height"),_.add("rr_left"),_.add("rr_top"),o&&(b.rr_position=o.position||"static",_.add("rr_position"),o.transform&&"none"!==o.transform&&(b.rr_transform=o.transform,_.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(b.rr_display=o.display,_.add("rr_display")))}if("iframe"!==y||f(b.src)||(t.contentDocument||(b.rr_src=b.src),delete b.src),a||u)for(const[e,i]of Object.entries(b))"string"!=typeof i&&null!==i||(b[e]=Yh({element:t,name:e,value:i,maskAllElementAttributes:a,maskAttributeFn:u,isGenerated:_.has(e)}));S=!0;try{customElements.get(y)&&(k=!0)}catch(t){}return{type:Vu.Element,tagName:y,attributes:b,childNodes:[],isSVG:(E=t,Boolean("svg"===E.tagName||E.ownerSVGElement)||void 0),needBlock:m,rootId:g,isCustom:k};var E}(t,{doc:i,blockClass:s,blockSelector:r,inlineStylesheet:l,maskInputOptions:a,maskInputFn:h,maskAllElementAttributes:c,maskAttributeFn:d,dataURLOptions:v,inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y,rootId:_});case t.TEXT_NODE:return function(t,e){const{needsMask:i,maskTextFn:n,rootId:s}=e,r=rh.parentNode(t),o=r&&r.tagName;let l=rh.textContent(t);const a="STYLE"===o||void 0,u="SCRIPT"===o||void 0;if(a&&l){try{var h;if(t.nextSibling||t.previousSibling);else if(Eh(r.sheet));else if(null===(h=r.sheet)||void 0===h?void 0:h.cssRules){const t=Bh(r.sheet);t&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(t)&&(l=t)}}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}l=rc(l,gc(e.doc))}return u&&(l="SCRIPT_PLACEHOLDER"),!a&&!u&&l&&i&&(l=n?n(l,rh.parentElement(t)):l.replace(/[\S]/g,"*")),{type:Vu.Text,textContent:l||"",isStyle:a,rootId:s}}(t,{doc:i,needsMask:o,maskTextFn:u,rootId:_});case t.CDATA_SECTION_NODE:return{type:Vu.CDATA,textContent:"",rootId:_};case t.COMMENT_NODE:return{type:Vu.Comment,textContent:rh.textContent(t)||"",rootId:_};default:return!1}}(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:_,keepIframeSrcFn:T,newlyAddedElement:E});if(!O)return console.warn(t,"not serialized"),null;let A;A=n.hasNode(t)?n.getId(t):function(t,e){if(e.comment&&t.type===Vu.Comment)return!0;if(t.type===Vu.Element){if(e.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel&&"script"===t.attributes.as||"modulepreload"===t.attributes.rel)||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&"js"===function(t){var e;let i;try{i=new URL(t,window.location.href)}catch(t){return null}const n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(e=null==n?void 0:n[1])&&void 0!==e?e:null}(t.attributes.href)))return!0;if(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(Cc(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Cc(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Cc(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&Cc(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Cc(t.attributes.property).match(/^(og|twitter|fb):/)||Cc(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===Cc(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(Cc(t.attributes.name)))return!0;if(e.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(e.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(Cc(t.attributes.name))||Cc(t.attributes.property).match(/^article:/)||Cc(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(Cc(t.attributes.name)))return!0}}return!1}(O,p)||!P&&O.type===Vu.Text&&!O.isStyle&&!O.textContent.replace(/^\s+|\s+$/gm,"").length?-2:cc();const F=Object.assign(O,{id:A});if(n.add(t,F),-2===A)return null;b&&b(t);let D=!a;if(F.type===Vu.Element){D=D&&!F.needBlock,delete F.needBlock;const e=rh.shadowRoot(t);e&&Dh(e)&&(F.isShadowHost=!0)}if((F.type===Vu.Document||F.type===Vu.Element)&&D){p.headWhitespace&&F.type===Vu.Element&&"head"===F.tagName&&(P=!1);const e={doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:l,skipChild:a,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:_,preserveWhiteSpace:P,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I+1,maxDepth:M};if(F.type===Vu.Element&&"textarea"===F.tagName&&void 0!==F.attributes.value);else for(const i of Array.from(rh.childNodes(t))){const t=Ec(i,e);t&&F.childNodes.push(t)}let E=null;if(Ah(t)&&(E=rh.shadowRoot(t)))for(const t of Array.from(rh.childNodes(E))){const i=Ec(t,e);i&&(Dh(E)&&(i.isShadow=!0),F.childNodes.push(i))}}const L=rh.parentNode(t);if(L&&Fh(L)&&Dh(L)&&(F.isShadow=!0),F.type===Vu.Element&&"iframe"===F.tagName){const e=function(t,e,i){const n=()=>{},s=t.contentWindow;if(!s)return n;let r;try{r=s.document.readyState}catch(t){return n}const o=()=>e();if("complete"!==r){let n=!1,s=null;const r=()=>{n||(n=!0,null!==s&&(clearTimeout(s),s=null),kc(t,"load",l),t.addEventListener("load",o),e())},l=()=>r();return s=setTimeout(r,i),t.addEventListener("load",l),()=>{null!==s&&(clearTimeout(s),s=null),n?kc(t,"load",o):(n=!0,kc(t,"load",l))}}const l="about:blank";let a;try{a=s.location.href}catch(t){return n}if(a!==l||t.src===l||""===t.src){const i=setTimeout(e,0);return t.addEventListener("load",o),()=>{clearTimeout(i),kc(t,"load",o)}}return t.addEventListener("load",o),()=>{kc(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&w){const i=Ec(e,{doc:e,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:_,preserveWhiteSpace:P,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I+1,maxDepth:M});i&&w(t,i)}},k);null==S||S(t,e)}return F.type===Vu.Element&&"link"===F.tagName&&"stylesheet"===F.attributes.rel&&function(e,a,S){if(Sc.has(e))return;let E;try{E=e.sheet}catch(t){return}if(E)return;const O=new AbortController;let A=!1;const F=()=>{if(!A){A=!0;try{(()=>{if(x){const e=Ec(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:_,preserveWhiteSpace:P,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I,maxDepth:M});e&&x(t,e)}})()}finally{Sc.delete(e),O.abort()}}},D=setTimeout(F,S);O.signal.addEventListener("abort",()=>clearTimeout(D),{once:!0}),e.addEventListener("load",F,{signal:O.signal,once:!0}),Sc.set(e,O)}(t,0,C),F}function Ic(t){return!0===t||"all"===t?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===t,headMetaDescKeywords:"all"===t,headTitleMutations:"all"===t}:!1===t?{}:t}var Mc=class t{constructor(...t){Oh(this,"parentElement",null),Oh(this,"parentNode",null),Oh(this,"ownerDocument",void 0),Oh(this,"firstChild",null),Oh(this,"lastChild",null),Oh(this,"previousSibling",null),Oh(this,"nextSibling",null),Oh(this,"ELEMENT_NODE",1),Oh(this,"TEXT_NODE",3),Oh(this,"nodeType",void 0),Oh(this,"nodeName",void 0),Oh(this,"RRNodeType",void 0)}get childNodes(){const t=[];let e=this.firstChild;for(;e;)t.push(e),e=e.nextSibling;return t}contains(e){if(!(e instanceof t))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,e){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function Rc(t,e,i=document){const n={capture:!0,passive:!0};return i.addEventListener(t,e,n),()=>Pc(i,t,e,n)}function Pc(t,e,i,n){Oc(()=>{const s=t.removeEventListener;"function"==typeof s&&(void 0!==n?s.call(t,e,i,n):s.call(t,e,i))})}function Oc(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function Ac(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var Fc="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.",Dc={map:{},getId(){return console.warn(Fc),-1},getNode(){return console.warn(Fc),null},removeNodeFromMap(){console.warn(Fc)},has(){return console.warn(Fc),!1},reset(){console.warn(Fc)}};function Lc(t,e,i={}){let n=null,s=0;return function(...r){const o=Date.now();s||!1!==i.leading||(s=o);const l=e-(o-s),a=this;0>=l||l>e?(n&&(clearTimeout(n),n=null),s=o,t.apply(a,r)):n||!1===i.trailing||(n=setTimeout(()=>{s=!1===i.leading?0:Date.now(),n=null,t.apply(a,r)},l))}}function Nc(t,e,i,n,s=window){const r=s.Object.getOwnPropertyDescriptor(t,e);return s.Object.defineProperty(t,e,n?i:{set(t){if(setTimeout(()=>{try{i.set.call(this,t)}catch(t){}},0),r&&r.set){if(r.get)try{r.get.call(this)}catch(t){return}r.set.call(this,t)}}}),()=>Nc(t,e,r||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Dc=new Proxy(Dc,{get(t,e,i){return"map"===e&&console.warn(Fc),Reflect.get(t,e,i)}}));var qc=Date.now;function Bc(t){var e,i,n,s;const r=t.document;return{left:r.scrollingElement?r.scrollingElement.scrollLeft:void 0!==t.pageXOffset?t.pageXOffset:r.documentElement.scrollLeft||(null==r?void 0:r.body)&&(null===(e=rh.parentElement(r.body))||void 0===e?void 0:e.scrollLeft)||(null==r||null===(i=r.body)||void 0===i?void 0:i.scrollLeft)||0,top:r.scrollingElement?r.scrollingElement.scrollTop:void 0!==t.pageYOffset?t.pageYOffset:(null==r?void 0:r.documentElement.scrollTop)||(null==r?void 0:r.body)&&(null===(n=rh.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 jc(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Hc(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Uc(t){return t?t.nodeType===t.ELEMENT_NODE?t:rh.parentElement(t):null}function zc(t,e,i,n){if(!t)return!1;const s=Uc(t);if(!s)return!1;try{if("string"==typeof e){if(s.classList.contains(e))return!0;if(n&&null!==s.closest("."+e))return!0}else if(bc(s,e,n))return!0}catch(t){}if(i){if(s.matches(i))return!0;if(n&&null!==s.closest(i))return!0}return!1}function Wc(t,e,i){return!("TITLE"!==t.tagName||!i.headTitleMutations)||-2===e.getId(t)}function Vc(t,e){if(Fh(t))return!1;const i=e.getId(t);if(!e.has(i))return!0;const n=rh.parentNode(t);return(!n||n.nodeType!==t.DOCUMENT_NODE)&&(!n||Vc(n,e))}function Gc(t){return Boolean(t.changedTouches)}function Zc(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Qc(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Jc(t){return!!t&&(t instanceof Mc&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(rh.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(qc=()=>(new Date).getTime());var Kc=class{constructor(){Oh(this,"id",1),Oh(this,"styleIDMap",new WeakMap),Oh(this,"idStyleMap",new Map)}getId(t){var e;return null!==(e=this.styleIDMap.get(t))&&void 0!==e?e:-1}has(t){return this.styleIDMap.has(t)}add(t,e){if(this.has(t))return this.getId(t);let i;return i=void 0===e?this.id++:e,this.styleIDMap.set(t,i),this.idStyleMap.set(i,t),i}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Yc(t){var e;let i=null;return"getRootNode"in t&&(null===(e=rh.getRootNode(t))||void 0===e?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&rh.host(rh.getRootNode(t))&&(i=rh.host(rh.getRootNode(t))),i}function Xc(t){const e=t.ownerDocument;if(!e)return!1;if(rh.contains(e,t))return!0;const i=rh.isConnected(t);return"boolean"==typeof i?i:function(t){const e=t.ownerDocument;if(!e)return!1;const i=function(t){let e,i=t;for(;e=Yc(i);)i=e;return i}(t);return rh.contains(e,i)}(t)}function td(t){return"__ln"in t}var ed,id=class{constructor(){Oh(this,"length",0),Oh(this,"head",null),Oh(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let e=this.head;for(let i=0;t>i;i++)e=(null==e?void 0:e.next)||null;return e}addNode(t){const e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&td(t.previousSibling)){const i=t.previousSibling.__ln.next;e.next=i,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,i&&(i.previous=e)}else if(t.nextSibling&&td(t.nextSibling)&&t.nextSibling.__ln.previous){const i=t.nextSibling.__ln.previous;e.previous=i,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,i&&(i.next=e)}else this.head&&(this.head.previous=e),e.next=this.head,this.head=e;null===e.next&&(this.tail=e),this.length++}removeNode(t){const e=t.__ln;this.head&&(e.previous?(e.previous.next=e.next,e.next?e.next.previous=e.previous:this.tail=e.previous):(this.head=e.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},nd=(t,e)=>`${t}@${e}`,sd=class{constructor(){Oh(this,"frozen",!1),Oh(this,"locked",!1),Oh(this,"texts",[]),Oh(this,"attributes",[]),Oh(this,"attributeMap",new WeakMap),Oh(this,"generatedAttributes",new WeakMap),Oh(this,"removes",[]),Oh(this,"mapRemoves",new Set),Oh(this,"movedMap",{}),Oh(this,"addedSet",new Set),Oh(this,"movedSet",new Set),Oh(this,"droppedSet",new Set),Oh(this,"removesSubTreeCache",new Set),Oh(this,"mutationCb",void 0),Oh(this,"blockClass",void 0),Oh(this,"blockSelector",void 0),Oh(this,"maskTextClass",void 0),Oh(this,"maskTextSelector",void 0),Oh(this,"inlineStylesheet",void 0),Oh(this,"maskInputOptions",void 0),Oh(this,"maskTextFn",void 0),Oh(this,"maskInputFn",void 0),Oh(this,"maskAllElementAttributes",void 0),Oh(this,"maskAttributeFn",void 0),Oh(this,"keepIframeSrcFn",void 0),Oh(this,"recordCanvas",void 0),Oh(this,"canvasMaskingConfigured",void 0),Oh(this,"inlineImages",void 0),Oh(this,"slimDOMOptions",void 0),Oh(this,"dataURLOptions",void 0),Oh(this,"doc",void 0),Oh(this,"mirror",void 0),Oh(this,"iframeManager",void 0),Oh(this,"stylesheetManager",void 0),Oh(this,"shadowDomManager",void 0),Oh(this,"canvasManager",void 0),Oh(this,"processedNodeManager",void 0),Oh(this,"unattachedDoc",void 0),Oh(this,"canvasManagerReleased",!1),Oh(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),Oh(this,"emit",()=>{if(this.frozen||this.locked)return;const t=oh(),e=uh();try{this.processBufferedMutations()}finally{i=oh()-t,n=e,ch>0||hh(i,null!=n?n:lh)||i>bh.slowestBatchMs&&(bh.slowestBatchMs=i)}var i,n}),Oh(this,"processBufferedMutations",()=>{const t=[],e=new Set,i=new id,n=t=>{let e=t,i=-2;for(;-2===i;)e=e&&e.nextSibling,i=e&&this.mirror.getId(e);return i};let s;const r=r=>{var o;const l=rh.parentNode(r);if(!l||!Xc(r)||"TEXTAREA"===l.tagName)return;if(this.isBlockedAtEmission(l))return;const a=Fh(l)?this.mirror.getId(Yc(r)):this.mirror.getId(l),u=n(r);if(-1===a||-1===u)return i.addNode(r);null!==(o=s)&&void 0!==o||(s={doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:t=>{Zc(t,this.mirror)&&this.iframeManager.addIframe(t),Qc(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Jc(t)&&!zc(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(rh.shadowRoot(t),this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onIframeListenerRegistered:(t,e)=>{this.iframeManager.registerLoadListenerDisposer(t,e)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}});const h=Ec(r,s);h&&(t.push({parentId:a,nextId:u,node:h}),e.add(h.id))};for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t);for(const t of this.movedSet)od(this.removesSubTreeCache,t)&&!this.movedSet.has(rh.parentNode(t))||r(t);for(const t of this.addedSet)ld(this.droppedSet,t)||od(this.removesSubTreeCache,t)?ld(this.movedSet,t)?r(t):this.droppedSet.add(t):r(t);let o=null;for(;i.length;){let t=null;if(o){const e=this.mirror.getId(rh.parentNode(o.value)),i=n(o.value);-1!==e&&-1!==i&&(t=o)}if(!t){let e=i.tail;for(;e;){const i=e;if(e=e.previous,i){const e=this.mirror.getId(rh.parentNode(i.value));if(-1===n(i.value))continue;if(-1!==e){t=i;break}{const e=rh.parentNode(i.value);if(e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=rh.host(e);if(-1!==this.mirror.getId(n)){t=i;break}}}}}}if(!t){for(;i.head;)i.removeNode(i.head.value);break}o=t.previous,i.removeNode(t.value),r(t.value)}const l={texts:this.texts.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const e=t.node,i=rh.parentNode(e);return i&&"TEXTAREA"===i.tagName&&this.genTextAreaValueMutation(i),{id:this.mirror.getId(e),value:t.value}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),attributes:this.attributes.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const{attributes:e}=t;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof e.style){const i=JSON.stringify(t.styleDiff),n=JSON.stringify(t._unchangedStyles);e.style.length>i.length&&(i+n).split("var(").length===e.style.split("var(").length&&(e.style=t.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(const[n,s]of Object.entries(e))if("string"==typeof s||null===s){var i;e[n]=Yh({element:t.node,name:n,value:s,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(i=this.generatedAttributes.get(t.node))||void 0===i?void 0:i.has(n)})}return{id:this.mirror.getId(t.node),attributes:e}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),removes:this.removes,adds:t};this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.generatedAttributes=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},(l.texts.length||l.attributes.length||l.removes.length||l.adds.length)&&this.mutationCb(l)}),Oh(this,"bufferBelongsToIframe",t=>this.doc===t.contentDocument),Oh(this,"genTextAreaValueMutation",t=>{let e=this.attributeMap.get(t);e||(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(e),this.attributeMap.set(t,e));const i=Array.from(rh.childNodes(t),t=>rh.textContent(t)||"").join("");e.attributes.value=Qh({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:tc(t),value:i,maskInputFn:this.maskInputFn})}),Oh(this,"processMutation",t=>{if(!Wc(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const e=rh.textContent(t.target);zc(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:wc(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,Uc(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break}case"attributes":{var e;const n=t.target,s=Jh(n.tagName),r=t.attributeName,o=null!==(e=t.attributeNamespace)&&void 0!==e?e:null;let l=function(t,e,i){if(!i)return e;const n=t.getAttributeNodeNS(i,e);if(n)return n.name;if("http://www.w3.org/1999/xlink"===i)return`xlink:${e}`;if("http://www.w3.org/XML/1998/namespace"===i)return`xml:${e}`;if("http://www.w3.org/2000/xmlns/"===i)return"xmlns"===e?e:`xmlns:${e}`;const s=t.lookupPrefix(i);return s?`${s}:${e}`:e}(n,r,o),a=o?n.getAttributeNS(o,r):t.target.getAttribute(r);if("value"===l){const t=n,e=tc(t);a=Qh({element:t,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:a,maskInputFn:this.maskInputFn})}if(zc(t.target,this.blockClass,this.blockSelector,!1)||a===t.oldValue)return;let u=this.attributeMap.get(t.target);const h="iframe"===s&&"src"===l;if(h&&!this.keepIframeSrcFn(a)&&n.contentDocument)return;if("type"===l&&"input"===s&&"password"===(t.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!_c(s,l)){var i;u||(u={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(u),this.attributeMap.set(t.target,u));const e=yc(this.doc,s,Jh(l),a,n,this.dataURLOptions);if(h&&!this.keepIframeSrcFn(a)&&(l="rr_src"),u.attributes[l]=e,null===(i=this.generatedAttributes.get(t.target))||void 0===i||i.delete(l),"style"===l){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const e=this.unattachedDoc.createElement("span"),i=n.style;t.oldValue&&(e.style.cssText=t.oldValue);for(const t of Array.from(i)){const n=i.getPropertyValue(t),s=i.getPropertyPriority(t);n!==e.style.getPropertyValue(t)||s!==e.style.getPropertyPriority(t)?u.styleDiff[t]=""===s?n:[n,s]:u._unchangedStyles[t]=[n,s]}for(const t of Array.from(e.style))""===i.getPropertyValue(t)&&(u.styleDiff[t]=!1)}else if("open"===l&&"dialog"===s){u.attributes.rr_open_mode=n.matches("dialog:modal")?"modal":"non-modal";let e=this.generatedAttributes.get(t.target);e||(e=new Set,this.generatedAttributes.set(t.target,e)),e.add("rr_open_mode")}}break}case"childList":if(zc(t.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===t.target.tagName)return void this.genTextAreaValueMutation(t.target);t.addedNodes.forEach(e=>this.genAdds(e,t.target)),t.removedNodes.forEach(e=>{const i=this.mirror.getId(e),n=Fh(t.target)?this.mirror.getId(rh.host(t.target)):this.mirror.getId(t.target);zc(t.target,this.blockClass,this.blockSelector,!1)||Wc(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(rd(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===i||Vc(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[nd(i,n)]?rd(this.movedSet,e):(this.removes.push({parentId:n,id:i,isShadow:!(!Fh(t.target)||!Dh(t.target))||void 0}),function(t,e){const i=[t];for(;i.length;){const t=i.pop();e.has(t)||(e.add(t),rh.childNodes(t).forEach(t=>i.push(t)))}}(e,this.removesSubTreeCache))),this.mapRemoves.add(e))})}}),Oh(this,"genAdds",(t,e)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)){if(this.addedSet.has(t))return this.addedSet.delete(t),void this.addedSet.add(t);if(!this.movedSet.has(t)){if(this.mirror.hasNode(t)){if(Wc(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let i=null;e&&this.mirror.hasNode(e)&&(i=this.mirror.getId(e)),i&&-1!==i&&(this.movedMap[nd(this.mirror.getId(t),i)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!zc(t,this.blockClass,this.blockSelector,!1)){if(t.nodeType===t.TEXT_NODE)return;const e=rh.childNodes(t);for(let t=0,i=e.length;i>t;t++){const i=e[t];i&&this.genAdds(i)}if(Jc(t)){const e=rh.childNodes(rh.shadowRoot(t));for(let i=0,n=e.length;n>i;i++){const n=e[i];n&&(this.processedNodeManager.add(n,this),this.genAdds(n,t))}}}}}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAllElementAttributes","maskAttributeFn","keepIframeSrcFn","recordCanvas","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(e=>{this[e]=t[e]}),this.canvasManager.acquire()}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t)}isBlockedAtEmission(t){const e=this.blockClass,i=e&&"string"!=typeof e&&(e.global||e.sticky)?new RegExp(e):null;for(;t;){if(i&&(i.lastIndex=0),zc(t,i||e,this.blockSelector,!0))return!0;const n="getRootNode"in t?rh.getRootNode(t):null;t=(null==n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?rh.host(n):null}return!1}};function rd(t,e){const i=[e];for(;i.length;){const e=i.pop();if(t.delete(e),e.nodeType===e.TEXT_NODE)continue;const n=rh.childNodes(e);for(let t=0,e=n.length;e>t;t++){const e=n[t];e&&i.push(e)}}}function od(t,e,i){return 0!==t.size&&function(t,e){const i=rh.parentNode(e);return!!i&&t.has(i)}(t,e)}function ld(t,e){if(0===t.size)return!1;let i=rh.parentNode(e);for(;i;){if(t.has(i))return!0;i=rh.parentNode(i)}return!1}function ad(t){ed=t}function ud(){ed=void 0}var hd=(t,e="rrweb")=>ed?(...i)=>{try{return t(...i)}catch(t){if(ed&&!0===ed(t,e))return;throw t}}:t,cd=[];function dd(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch(t){}return t&&t.target}function vd(t,e){const i=new sd;let n;i.init(t);try{n=new(nh())(hd(i.processMutations.bind(i)));const s={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return t.attributeFilter&&t.attributeFilter.length>0&&(s.attributeFilter=t.attributeFilter),n.observe(e,s),cd.push(i),{observer:n,buffer:i}}catch(t){try{null==n||n.disconnect(),i.destroy(),i.reset()}catch(t){}throw t}}function fd({scrollCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){const o=new Map,l=r=>{const l=dd(r);if(!l||zc(l,n,s,!0))return;const a=i.getId(l);let u,h;if(l===e&&e.defaultView){const t=Bc(e.defaultView);u=t.left,h=t.top}else u=l.scrollLeft,h=l.scrollTop;const c=`${u},${h}`;o.get(a)!==c&&(o.set(a,c),t({id:a,x:u,y:h}))},a=[Rc("scroll",hd(Lc(hd(t=>l(t)),r.scroll||100)),e)];return"onscrollend"in e&&a.push(Rc("scrollend",hd(l),e)),()=>a.forEach(t=>t())}function pd(t,e){for(let i=cd.length-1;i>=0;i--){const n=cd[i];if(!n)continue;let s=n.bufferBelongsToIframe(t);!s&&e&&e.has(n.bufferDoc())&&(s=!0),s&&(n.reset(),cd.splice(i,1))}}var gd=["INPUT","TEXTAREA","SELECT"],md=new WeakMap;function yd(t){return function t(e,i){if(kd("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||kd("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||kd("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||kd("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);return i.unshift(n),t(e.parentRule,i)}if(e.parentStyleSheet){const t=Array.from(e.parentStyleSheet.cssRules).indexOf(e);i.unshift(t)}return i}(t,[])}function _d(t,e,i){let n,s;return t?(t.ownerNode?n=e.getId(t.ownerNode):s=i.getId(t),{styleId:s,id:n}):{}}function bd({mirror:t,stylesheetManager:e},i){var n,s;let r=null;r=t.getId("#document"===i.nodeName?i:rh.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,l=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==r&&-1!==r&&o&&l?(Object.defineProperty(i,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var t;return null===(t=l.get)||void 0===t?void 0:t.call(this)},set(t){let i;try{var n;i=null===(n=l.set)||void 0===n?void 0:n.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==r&&-1!==r)try{e.adoptStyleSheets(t,r)}catch(t){}return i}}),hd(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function wd(t,e={}){const i=t.doc.defaultView;if(!i)return()=>{};let n,s;!function(t,e){const{mutationCb:i,mousemoveCb:n,mouseInteractionCb:s,scrollCb:r,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:u,styleDeclarationCb:h,canvasMutationCb:c,fontCb:d,selectionCb:v,customElementCb:f}=t;t.mutationCb=(...t)=>{e.mutation&&e.mutation(...t),i(...t)},t.mousemoveCb=(...t)=>{e.mousemove&&e.mousemove(...t),n(...t)},t.mouseInteractionCb=(...t)=>{e.mouseInteraction&&e.mouseInteraction(...t),s(...t)},t.scrollCb=(...t)=>{e.scroll&&e.scroll(...t),r(...t)},t.viewportResizeCb=(...t)=>{e.viewportResize&&e.viewportResize(...t),o(...t)},t.inputCb=(...t)=>{e.input&&e.input(...t),l(...t)},t.mediaInteractionCb=(...t)=>{e.mediaInteaction&&e.mediaInteaction(...t),a(...t)},t.styleSheetRuleCb=(...t)=>{e.styleSheetRule&&e.styleSheetRule(...t),u(...t)},t.styleDeclarationCb=(...t)=>{e.styleDeclaration&&e.styleDeclaration(...t),h(...t)},t.canvasMutationCb=(...t)=>{e.canvasMutation&&e.canvasMutation(...t),c(...t)},t.fontCb=(...t)=>{e.font&&e.font(...t),d(...t)},t.selectionCb=(...t)=>{e.selection&&e.selection(...t),v(...t)},t.customElementCb=(...t)=>{e.customElement&&e.customElement(...t),f(...t)}}(t,e);const r=[],o=hd(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=cd.indexOf(s);-1!==t&&cd.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==n||n.disconnect()}finally{Ac(r)}});try{if(t.recordDOM){const e=vd(t,t.doc);n=e.observer,s=e.buffer}if(r.push(function({mousemoveCb:t,sampling:e,doc:i,mirror:n}){if(!1===e.mousemove)return()=>{};const s="number"==typeof e.mousemove?e.mousemove:50,r="number"==typeof e.mousemoveCallback?e.mousemoveCallback:500;let o,l=[];const a=Lc(hd(e=>{const i=Date.now()-o;t(l.map(t=>(t.timeOffset-=i,t)),e),l=[],o=null}),r),u=hd(Lc(hd(t=>{const e=dd(t),{clientX:i,clientY:s}=Gc(t)?t.changedTouches[0]:t;o||(o=qc()),l.push({x:i,y:s,id:n.getId(e),timeOffset:qc()-o}),a("undefined"!=typeof DragEvent&&t instanceof DragEvent?ju.Drag:t instanceof MouseEvent?ju.MouseMove:ju.TouchMove)}),s,{trailing:!1})),h=[Rc("mousemove",u,i),Rc("touchmove",u,i),Rc("drag",u,i)];return hd(()=>{h.forEach(t=>t())})}(t)),r.push(function({mouseInteractionCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){if(!1===r.mouseInteraction)return()=>{};const o=!0===r.mouseInteraction||void 0===r.mouseInteraction?{}:r.mouseInteraction,l=[];let a=null;return Object.keys(Hu).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t]).forEach(r=>{let o=Jh(r);const u=(e=>r=>{const o=dd(r);if(zc(o,n,s,!0))return;let l=null,u=e;if("pointerType"in r){switch(r.pointerType){case"mouse":l=Uu.Mouse;break;case"touch":l=Uu.Touch;break;case"pen":l=Uu.Pen}l===Uu.Touch&&(Hu[e]===Hu.MouseDown?u="TouchStart":Hu[e]===Hu.MouseUp&&(u="TouchEnd"))}else Gc(r)&&(l=Uu.Touch);null!==l?(a=l,(u.startsWith("Touch")&&l===Uu.Touch||u.startsWith("Mouse")&&l===Uu.Mouse)&&(l=null)):Hu[e]===Hu.Click&&(l=a,a=null);const h=Gc(r)?r.changedTouches[0]:r;if(!h)return;const c=i.getId(o),{clientX:d,clientY:v}=h;hd(t)(ue({type:Hu[u],id:c,x:d,y:v},null!==l&&{pointerType:l}))})(r);if(window.PointerEvent)switch(Hu[r]){case Hu.MouseDown:case Hu.MouseUp:o=o.replace("mouse","pointer");break;case Hu.TouchStart:case Hu.TouchEnd:return}l.push(Rc(o,u,e))}),hd(()=>{l.forEach(t=>t())})}(t)),r.push(fd(t)),r.push(function({viewportResizeCb:t},{win:e}){let i=-1,n=-1;return Rc("resize",hd(Lc(hd(()=>{const e=jc(),s=Hc();i===e&&n===s||(t({width:Number(s),height:Number(e)}),i=e,n=s)}),200)),e)}(t,{win:i})),r.push(function({inputCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,ignoreClass:r,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:u,userTriggeredOnInput:h}){function c(t){let i=dd(t);const u=t.isTrusted,c=e.defaultView;if(i&&c&&!(i instanceof c.HTMLElement))return;const v=i&&i.tagName;if(i&&"OPTION"===v&&(i=rh.parentElement(i)),!i||!v||0>gd.indexOf(v)||zc(i,n,s,!0))return;if(i.classList.contains(r)||o&&i.matches(o))return;let f=i.value,p=!1;const g=tc(i)||"";"radio"===g||"checkbox"===g?p=i.checked:(l[v.toLowerCase()]||l[g])&&(f=Qh({element:i,maskInputOptions:l,tagName:v,type:g,value:f,maskInputFn:a})),d(i,h?{text:f,isChecked:p,userTriggered:u}:{text:f,isChecked:p});const m=i.name;"radio"===g&&m&&p&&e.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach(t=>{if(t!==i){const e=t.value;d(t,h?{text:e,isChecked:!p,userTriggered:!1}:{text:e,isChecked:!p})}})}function d(e,n){const s=md.get(e);if(!s||s.text!==n.text||s.isChecked!==n.isChecked){md.set(e,n);const s=i.getId(e);hd(t)(ue(ue({},n),{},{id:s}))}}const v=("last"===u.input?["change"]:["input","change"]).map(t=>Rc(t,hd(c),e)),f=e.defaultView;if(!f)return()=>{v.forEach(t=>t())};const p=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value");return p&&p.set&&v.push(...[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]].map(t=>Nc(t[0],t[1],{set(){hd(c)({target:this,isTrusted:!1})}},!1,f))),hd(()=>{Ac(v)})}(t)),r.push(function({mediaInteractionCb:t,blockClass:e,blockSelector:i,mirror:n,sampling:s,doc:r}){const o=hd(r=>Lc(hd(s=>{const o=dd(s);if(!o||zc(o,e,i,!0))return;const{currentTime:l,volume:a,muted:u,playbackRate:h,loop:c}=o;t({type:r,id:n.getId(o),currentTime:l,volume:a,muted:u,playbackRate:h,loop:c})}),s.media||500)),l=[Rc("play",o(Wu.Play),r),Rc("pause",o(Wu.Pause),r),Rc("seeked",o(Wu.Seeked),r),Rc("volumechange",o(Wu.VolumeChange),r),Rc("ratechange",o(Wu.RateChange),r)];return hd(()=>{l.forEach(t=>t())})}(t)),t.recordDOM){const e=function(t){const e=new Map,i=new Set;let n=!0;const s=t=>{if(n)try{t()}catch(t){}},r=t=>{var i;const n=e.get(t);if(n){for(;null===(i=n[0])||void 0===i?void 0:i.ready;){const t=n.shift();(null==t?void 0:t.emit)&&s(t.emit)}0===n.length&&e.delete(t)}};return{queueMutation(t,i){if(!t)return void s(i);const n=e.get(t);n?(n.push({emit:i,ready:!0}),r(t)):s(i)},queuePendingMutation(o,l,a){if(!n)return()=>{};let u=e.get(o);u||(u=[],e.set(o,u));const h={emit:l,ready:!1};u.push(h);let c,d=!1,v=!1;const f=()=>{d||v||(d=!0,void 0!==c&&i.delete(c),h.ready=!0,h.emit=void 0,r(o))};try{c=t.setTimeout(f,5e3),d||v?t.clearTimeout(c):i.add(c)}catch(t){f()}return e=>{!v&&n&&(v=!0,void 0!==c&&(t.clearTimeout(c),i.delete(c)),d?e&&s(a):(h.ready=!0,e||(h.emit=void 0),r(o)))}},reset(){n=!1,i.forEach(e=>t.clearTimeout(e)),i.clear(),e.clear()}}}(i);r.push(e.reset),r.push(function({styleSheetRuleCb:t,mirror:e,stylesheetManager:i},{win:n,mutationQueue:s}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const r=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:hd((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=_d(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,adds:[{rule:l,index:a}]})),a},"host")}),n.CSSStyleSheet.prototype.addRule=function(t,e,i=this.cssRules.length){return n.CSSStyleSheet.prototype.insertRule.apply(this,[`${t} { ${e} }`,i])};const o=n.CSSStyleSheet.prototype.deleteRule;let l,a;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:hd((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=_d(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,removes:[{index:l}]})),a},"host")}),n.CSSStyleSheet.prototype.removeRule=function(t){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},n.CSSStyleSheet.prototype.replace&&(l=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(l,{apply:hd((n,r,o)=>{const[l]=o,a=n.apply(r,o);try{const n=null==a?void 0:a.then;if(r.ownerNode||!a||"function"!=typeof n)return a;i.onCssomSheetMutation(r);const{id:o,styleId:u}=_d(r,e,i.styleMirror);if(!(o&&-1!==o||u&&-1!==u))return a;const h=s.queuePendingMutation(r,()=>t({id:o,styleId:u,replace:l}),()=>{const e=Bh(r);null!==e&&t({id:o,styleId:u,replace:e})});try{n.call(a,()=>h(!0),()=>h(!1))}catch(t){h(!1)}}catch(t){}return a},"host")})),n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:hd((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=_d(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,replaceSync:l})),a},"host")}));const u={};Sd("CSSGroupingRule")?u.CSSGroupingRule=n.CSSGroupingRule:(Sd("CSSMediaRule")&&(u.CSSMediaRule=n.CSSMediaRule),Sd("CSSConditionRule")&&(u.CSSConditionRule=n.CSSConditionRule),Sd("CSSSupportsRule")&&(u.CSSSupportsRule=n.CSSSupportsRule));const h={};return Object.entries(u).forEach(([n,r])=>{h[n]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(h[n].insertRule,{apply:hd((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:h}=_d(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||h&&-1!==h)){const e=[...yd(r),a];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:h,adds:[{rule:l,index:e}]}))}return a},"host")}),r.prototype.deleteRule=new Proxy(h[n].deleteRule,{apply:hd((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:h}=_d(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||h&&-1!==h)){const e=[...yd(r),l];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:h,removes:[{index:e}]}))}return a},"host")})}),hd(()=>{n.CSSStyleSheet.prototype.insertRule=r,n.CSSStyleSheet.prototype.deleteRule=o,l&&(n.CSSStyleSheet.prototype.replace=l),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(u).forEach(([t,e])=>{e.prototype.insertRule=h[t].insertRule,e.prototype.deleteRule=h[t].deleteRule})})}(t,{win:i,mutationQueue:e})),r.push(bd(t,t.doc)),r.push(function({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:i,stylesheetManager:n},{win:s,mutationQueue:r}){const o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:hd((s,o,l)=>{var a;const[u,h,c]=l,d=s.apply(o,l);if(i.has(u))return d;const v=null===(a=o.parentRule)||void 0===a?void 0:a.parentStyleSheet;n.onCssomSheetMutation(v);const{id:f,styleId:p}=_d(v,e,n.styleMirror);if(f&&-1!==f||p&&-1!==p){const e=yd(o.parentRule);r.queueMutation(v,()=>t({id:f,styleId:p,set:{property:u,value:h,priority:c},index:e}))}return d},"host")});const l=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:hd((s,o,l)=>{var a;const[u]=l,h=s.apply(o,l);if(i.has(u))return h;const c=null===(a=o.parentRule)||void 0===a?void 0:a.parentStyleSheet;n.onCssomSheetMutation(c);const{id:d,styleId:v}=_d(c,e,n.styleMirror);if(d&&-1!==d||v&&-1!==v){const e=yd(o.parentRule);r.queueMutation(c,()=>t({id:d,styleId:v,remove:{property:u},index:e}))}return h},"host")}),hd(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=l})}(t,{win:i,mutationQueue:e})),t.collectFonts&&r.push(function({fontCb:t,doc:e}){const i=e.defaultView;if(!i)return()=>{};const n=[],s=new WeakMap,r=i.FontFace;i.FontFace=function(t,e,i){const n=new r(t,e,i);return s.set(n,{family:t,buffer:"string"!=typeof e,descriptors:i,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),n};const o=sh(e.fonts,"add",function(e){return function(i){return setTimeout(hd(()=>{const e=s.get(i);e&&(t(e),s.delete(i))}),0),e.apply(this,[i])}});return n.push(()=>{i.FontFace=r}),n.push(o),hd(()=>{n.forEach(t=>t())})}(t))}r.push(function(t){const{doc:e,mirror:i,blockClass:n,blockSelector:s,selectionCb:r}=t;let o=!0;const l=hd(()=>{const t=e.getSelection();if(!t||o&&(null==t?void 0:t.isCollapsed))return;o=t.isCollapsed||!1;const l=[],a=t.rangeCount||0;for(let e=0;a>e;e++){const{startContainer:r,startOffset:o,endContainer:a,endOffset:u}=t.getRangeAt(e);zc(r,n,s,!0)||zc(a,n,s,!0)||l.push({start:i.getId(r),startOffset:o,end:i.getId(a),endOffset:u})}r({ranges:l})});return l(),Rc("selectionchange",l)}(t)),r.push(function({doc:t,customElementCb:e}){const i=t.defaultView;return i&&i.customElements?sh(i.customElements,"define",function(t){return function(i,n,s){try{e({define:{name:i}})}catch(t){console.warn(`Custom element callback failed for ${i}`)}return t.apply(this,[i,n,s])}}):()=>{}}(t));for(const e of t.plugins)r.push(e.observer(e.callback,i,e.options))}catch(t){try{o()}catch(t){}throw t}return o}function kd(t){return void 0!==window[t]}function Sd(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var xd=class{constructor(t){Oh(this,"generateIdFn",void 0),Oh(this,"iframeRemoteIdToLocalIdMap",new WeakMap),Oh(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=t}getId(t,e,i,n){if(0>e)return e;const s=i||this.getRemoteIdToLocalIdMap(t),r=n||this.getLocalIdToRemoteIdMap(t);let o=s.get(e);return void 0===o&&(o=this.generateIdFn(),s.set(e,o),r.set(o,e)),o}getIds(t,e){const i=this.getRemoteIdToLocalIdMap(t),n=this.getLocalIdToRemoteIdMap(t);return e.map(e=>this.getId(t,e,i,n))}getRemoteId(t,e,i){var n;return"number"!=typeof e||0>e?e:null!==(n=(i||this.getLocalIdToRemoteIdMap(t)).get(e))&&void 0!==n?n:-1}getRemoteIds(t,e){const i=this.getLocalIdToRemoteIdMap(t);return e.map(e=>this.getRemoteId(t,e,i))}reset(t){if(!t)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(t),this.iframeLocalIdToRemoteIdMap.delete(t)}getRemoteIdToLocalIdMap(t){let e=this.iframeRemoteIdToLocalIdMap.get(t);return e||(e=new Map,this.iframeRemoteIdToLocalIdMap.set(t,e)),e}getLocalIdToRemoteIdMap(t){let e=this.iframeLocalIdToRemoteIdMap.get(t);return e||(e=new Map,this.iframeLocalIdToRemoteIdMap.set(t,e)),e}},Cd=class{constructor(t){Oh(this,"iframes",new WeakMap),Oh(this,"crossOriginIframeMap",new WeakMap),Oh(this,"crossOriginIframeMirror",new xd(cc)),Oh(this,"crossOriginIframeStyleMirror",void 0),Oh(this,"crossOriginIframeRootIdMap",new WeakMap),Oh(this,"mirror",void 0),Oh(this,"mutationCb",void 0),Oh(this,"wrappedEmit",void 0),Oh(this,"loadListener",void 0),Oh(this,"pageHideListener",void 0),Oh(this,"stylesheetManager",void 0),Oh(this,"recordCrossOriginIframes",void 0),Oh(this,"messageHandler",void 0),Oh(this,"nestedIframeListeners",new Map),Oh(this,"attachedWindows",new WeakMap),Oh(this,"attachedDocuments",new WeakMap),Oh(this,"attachedIframes",new Map),Oh(this,"loadListenerDisposers",new WeakMap),Oh(this,"iframeElementsById",new Map),Oh(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new xd(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}registerLoadListenerDisposer(t,e){let i=this.loadListenerDisposers.get(t);i||(i=new Set,this.loadListenerDisposers.set(t,i)),i.add(e);const n=this.mirror.getId(t);-1!==n&&this.iframeElementsById.set(n,t)}getIframeElementById(t){var e,i,n;return null!==(e=null!==(i=null===(n=this.attachedIframes.get(t))||void 0===n?void 0:n.element)&&void 0!==i?i:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){const e=this.loadListenerDisposers.get(t);e&&(e.forEach(t=>Oc(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{Pc(t,"pagehide",e)}),this.pageHideHandlers.delete(t))}addLoadListener(t){this.loadListener=t}addPageHideListener(t){this.pageHideListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,e){const i=this.mirror.getId(t);return this.attachedIframes.set(i,{element:t,content:e}),i}attachIframe(t,e){var i;const n=this.trackIframeContent(t,e);if(t.contentDocument){let e=this.attachedDocuments.get(t);e||(e=new Set,this.attachedDocuments.set(t,e)),e.add(t.contentDocument)}this.mutationCb({adds:[{parentId:n,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const s=t.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){const e=this.handleMessage.bind(this);Oc(()=>{s.addEventListener("message",e),this.nestedIframeListeners.set(s,e);let i=this.attachedWindows.get(t);i||(i=new Set,this.attachedWindows.set(t,i)),i.add(s)})}Oc(()=>{const e=t.contentWindow;if(!e)return;let i=this.pageHideHandlers.get(t);if(i)for(const t of i)if(t.win===e)return;const n=()=>{var e;null===(e=this.pageHideListener)||void 0===e||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument)};e.addEventListener("pagehide",n),i||(i=new Set,this.pageHideHandlers.set(t,i)),i.add({win:e,handler:n})}),null===(i=this.loadListener)||void 0===i||i.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const e=t;if("rrweb"!==e.data.type||e.origin!==e.data.origin)return;if(!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const n=this.transformCrossOriginEvent(i,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}transformCrossOriginEvent(t,e){switch(e.type){case Bu.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t);const i=e.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(e.data.node,i),this.trackIframeContent(t,e.data.node),{timestamp:e.timestamp,type:Bu.IncrementalSnapshot,data:{source:ju.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Bu.Meta:case Bu.Load:case Bu.DomContentLoaded:return!1;case Bu.Plugin:return e;case Bu.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case Bu.IncrementalSnapshot:switch(e.data.source){case ju.Mutation:return e.data.adds.forEach(e=>{this.replaceIds(e,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(e.node,t);const i=this.crossOriginIframeRootIdMap.get(t);i&&this.patchRootIdOnNode(e.node,i)}),e.data.removes.forEach(e=>{this.replaceIds(e,t,["parentId","id"])}),e.data.attributes.forEach(e=>{this.replaceIds(e,t,["id"])}),e.data.texts.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case ju.Drag:case ju.TouchMove:case ju.MouseMove:return e.data.positions.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case ju.ViewportResize:return!1;case ju.MediaInteraction:case ju.MouseInteraction:case ju.Scroll:case ju.CanvasMutation:case ju.Input:return this.replaceIds(e.data,t,["id"]),e;case ju.StyleSheetRule:case ju.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case ju.Font:return e;case ju.Selection:return e.data.ranges.forEach(e=>{this.replaceIds(e,t,["start","end"])}),e;case ju.AdoptedStyleSheet:var i;return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),null===(i=e.data.styles)||void 0===i||i.forEach(e=>{this.replaceStyleIds(e,t,["styleId"])}),e}}return!1}replace(t,e,i,n){for(const s of n)(Array.isArray(e[s])||"number"==typeof e[s])&&(e[s]=Array.isArray(e[s])?t.getIds(i,e[s]):t.getId(i,e[s]));return e}replaceIds(t,e,i){return this.replace(this.crossOriginIframeMirror,t,e,i)}replaceStyleIds(t,e,i){return this.replace(this.crossOriginIframeStyleMirror,t,e,i)}replaceIdOnNode(t,e){this.replaceIds(t,e,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(t=>{this.replaceIdOnNode(t,e)})}patchRootIdOnNode(t,e){t.type===Vu.Document||t.rootId||(t.rootId=e),"childNodes"in t&&t.childNodes.forEach(t=>{this.patchRootIdOnNode(t,e)})}removeIframeById(t){const e=this.attachedIframes.get(t),i=(null==e?void 0:e.element)||this.iframeElementsById.get(t)||this.mirror.getNode(t);if(this.iframeElementsById.delete(t),i){const t=i.contentWindow,e=this.attachedWindows.get(i);e&&(e.forEach(t=>{const e=this.nestedIframeListeners.get(t);e&&(Pc(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(i)),t&&this.nestedIframeListeners.has(t)&&(Pc(t,"message",this.nestedIframeListeners.get(t)),this.nestedIframeListeners.delete(t)),t&&this.crossOriginIframeMap.delete(t),this.iframes.delete(i),this.disposeLoadListeners(i),this.removePageHideListener(i);const n=this.attachedDocuments.get(i);n&&(n.forEach(t=>{Oc(()=>this.mirror.removeNodeFromMap(t))}),Oc(()=>pd(i,n)),this.attachedDocuments.delete(i))}e&&this.attachedIframes.delete(t)}cleanupDetachedIframes(){if(0===this.attachedIframes.size)return;const t=[];this.attachedIframes.forEach((e,i)=>{this.mirror.has(i)||t.push(i)}),t.forEach(t=>this.removeIframeById(t))}reattachIframes(){this.attachedIframes.forEach(({content:t},e)=>{this.mirror.has(e)?this.mutationCb({adds:[{parentId:e,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(e)})}destroy(){this.recordCrossOriginIframes&&Pc(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{Pc(e,"message",t)}),this.nestedIframeListeners.clear();const t=new Set;this.iframeElementsById.forEach(e=>t.add(e)),this.attachedIframes.forEach(({element:e})=>t.add(e)),t.forEach(t=>{this.disposeLoadListeners(t),this.removePageHideListener(t)}),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}},$d=class{constructor(t){Oh(this,"shadowDoms",new WeakSet),Oh(this,"mutationCb",void 0),Oh(this,"scrollCb",void 0),Oh(this,"bypassOptions",void 0),Oh(this,"mirror",void 0),Oh(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,e){var i,n;if(!Dh(t))return;if(this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=null!==(i=null===(n=rh.host(t))||void 0===n?void 0:n.ownerDocument)&&void 0!==i?i:e,{observer:r,buffer:o}=vd(ue(ue({},this.bypassOptions),{},{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push({doc:s,handler(){r.disconnect(),o.destroy(),o.releaseCanvasManager();const t=cd.indexOf(o);-1!==t&&cd.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:fd(ue(ue({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))}),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(rh.host(t))),this.restoreHandlers.push({doc:s,handler:bd({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)})},0)}observeAttachShadow(t){t.contentWindow&&t.contentDocument&&this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,e){const i=this;this.restoreHandlers.push({doc:e,handler:sh(t.prototype,"attachShadow",function(t){return function(n){const s=t.call(this,n),r=rh.shadowRoot(this);return r&&Xc(this)&&i.addShadowRoot(r,e),s}})})}reset(){this.restoreHandlers.forEach(({handler:t})=>{try{t()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){const e=[];for(const i of this.restoreHandlers)if(i.doc===t)try{i.handler()}catch(t){}else e.push(i);this.restoreHandlers=e}},Td="skip-frame";function Ed(t){if("object"!=typeof t||null===t)return!1;const{x:e,y:i,width:n,height:s}=t;return Number.isFinite(e)&&Number.isFinite(i)&&Number.isFinite(n)&&Number.isFinite(s)&&n>=0&&s>=0}for(var Id="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Md="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Rd=0;64>Rd;Rd++)Md[Id.charCodeAt(Rd)]=Rd;var Pd=function(t){var e,i=new Uint8Array(t),n=i.length,s="";for(e=0;n>e;e+=3)s+=Id[i[e]>>2],s+=Id[(3&i[e])<<4|i[e+1]>>4],s+=Id[(15&i[e+1])<<2|i[e+2]>>6],s+=Id[63&i[e+2]];return n%3==2?s=s.substring(0,s.length-1)+"=":n%3==1&&(s=s.substring(0,s.length-2)+"=="),s},Od=new Map,Ad=(t,e,i)=>{if(!t||!Ld(t,e)&&"object"!=typeof t)return;const n=function(t,e){let i=Od.get(t);return i||(i=new Map,Od.set(t,i)),i.has(e)||i.set(e,[]),i.get(e)}(i,t.constructor.name);let s=n.indexOf(t);return-1===s&&(s=n.length,n.push(t)),s};function Fd(t,e,i,n){if(t instanceof Array)return t.map(t=>Fd(t,e,i,n));if(null===t)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer)return{rr_type:t.constructor.name,base64:Pd(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Fd(t.buffer,e,i,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const e=t.constructor.name,{src:i}=t;return{rr_type:e,src:i}}return t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL(n.type,n.quality)}:t instanceof ImageData?{rr_type:t.constructor.name,args:[Fd(t.data,e,i,n),t.width,t.height]}:Ld(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:Ad(t,e,i)}:t}var Dd=(t,e,i,n)=>t.map(t=>Fd(t,e,i,n)),Ld=(t,e)=>{const i=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(t=>"function"==typeof e[t]);return Boolean(i.find(i=>t instanceof e[i]))},Nd=["webgl","webgl2"];function qd(t){return"nodeType"in t}function Bd(t,e,i,n){const s=[];try{if(n){const n=function(t,e,i){const n=t.GPUCanvasContext;if((null==n?void 0:n.prototype)&&"function"==typeof n.prototype.configure)return sh(n.prototype,"configure",function(n){return function(s){const r=function(t){const{canvas:e}=t;return e&&"object"==typeof e?e:null}(this);if(!r||qd(r)&&zc(r,e,i,!0))return n.call(this,s);qd(r)&&!("__context"in r)&&(r.__context="webgpu");const o=function(t){const e=t.GPUTextureUsage;return e?e.COPY_SRC|e.RENDER_ATTACHMENT:null}(t);return n.call(this,null!==o&&s?ue(ue({},s),{},{usage:"number"==typeof s.usage?s.usage|o:o}):s)}})}(t,e,i);n&&s.push(n)}const r=sh(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(s,...r){const o=function(t){return"experimental-webgl"===t?"webgl":t}(s);if(!zc(this,e,i,!0)&&("__context"in this||(this.__context=o),n&&Nd.includes(o)))if(r[0]&&"object"==typeof r[0]){const t=r[0];t.preserveDrawingBuffer||(t.preserveDrawingBuffer=!0)}else r.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[s,...r])}});s.push(r)}catch(t){console.warn("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(t=>t())}}function jd(t,e,i,n,s,r,o){const l=[],a=Object.getOwnPropertyNames(t);for(const u of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))try{if("function"!=typeof t[u])continue;const a=sh(t,u,function(t){return function(...l){const a=t.apply(this,l);if(Ad(a,r,this),this.canvas&&"tagName"in this.canvas&&!zc(this.canvas,n,s,!0)){const t=Dd(l,r,this,o);i(this.canvas,{type:e,property:u,args:t})}return a}});l.push(a)}catch(r){const o=Nc(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!zc(this.canvas,n,s,!0)&&i(this.canvas,{type:e,property:u,args:[t],setter:!0})}});l.push(o)}return l}var Hd='(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',Ud="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Hd],{type:"text/javascript;charset=utf-8"});function zd(t){let e;try{if(e=Ud&&(self.URL||self.webkitURL).createObjectURL(Ud),!e)throw"";const i=new Worker(e,{name:null==t?void 0:t.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),i}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Hd),{name:null==t?void 0:t.name})}}var Wd,Vd,Gd,Zd=class{onFullSnapshot(){var t;null===(t=this.resetFrameDedup)||void 0===t||t.call(this)}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(t){Oh(this,"pendingCanvasMutations",new Map),Oh(this,"rafStamps",{latestId:0,invokeId:null}),Oh(this,"mirror",void 0),Oh(this,"mutationCb",void 0),Oh(this,"resetObservers",void 0),Oh(this,"frozen",!1),Oh(this,"locked",!1),Oh(this,"rafIdTimestamp",null),Oh(this,"rafIdFlush",null),Oh(this,"refCount",0),Oh(this,"torndown",!1),Oh(this,"resetFrameDedup",null),Oh(this,"processMutation",(t,e)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(t)||this.pendingCanvasMutations.set(t,[]),this.pendingCanvasMutations.get(t).push(e)});const{sampling:e="all",win:i,blockClass:n,blockSelector:s,recordCanvas:r,dataURLOptions:o,resolutionScale:l,canvasMasking:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,r&&"all"===e&&this.initCanvasMutationObserver(i,n,s,o),r&&"number"==typeof e&&this.initCanvasFPSObserver(e,i,n,s,{dataURLOptions:o,resolutionScale:l,canvasMasking:a})}initCanvasFPSObserver(t,e,i,n,s){var r=this;if(!("OffscreenCanvas"in e))return;const o="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,l=Bd(e,i,n,!0),a=new Map;let u;try{u=new zd}catch(t){return}let h=!1;u.onerror=()=>{var t;h=!0,cancelAnimationFrame(d),null===(t=u.terminate)||void 0===t||t.call(u),this.resetFrameDedup=null},this.resetFrameDedup=()=>{u.postMessage({resetFrameDedup:!0})},u.onmessage=t=>{const{id:e}=t.data;if(a.set(e,!1),!("base64"in t.data))return;const{base64:i,type:n,displayWidth:s,displayHeight:r}=t.data;this.mutationCb({id:e,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})};const c=1e3/t;let d,v=0;const f=t=>{var l;h||(v&&c>t-v||(v=t,(()=>{const t=[],s=e=>{try{e.querySelectorAll("canvas").forEach(e=>{zc(e,i,n,!0)||t.push(e)}),e.querySelectorAll("*").forEach(t=>{t.shadowRoot&&s(t.shadowRoot)})}catch(t){}};return s(e.document),t})().forEach((l=re(function*(t){const e=r.mirror.getId(t);if(!a.get(e)&&0!==t.width&&0!==t.height){a.set(e,!0);try{if(["webgl","webgl2"].includes(t.__context)){var i,n;const s=t.getContext(t.__context);if(null==s||null===(i=s.isContextLost)||void 0===i?void 0:i.call(s))return void a.set(e,!1);!1===(null==s||null===(n=s.getContextAttributes())||void 0===n?void 0:n.preserveDrawingBuffer)&&s.clear(s.COLOR_BUFFER_BIT)}const r=t.clientWidth||t.width,l=t.clientHeight||t.height,h=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(l*o)),d=function(t,e,i,n,s,r){if(!t||"function"!=typeof t.regionsFn)return;let o;try{o=t.regionsFn(e)}catch(t){return Td}if(void 0===o)return;if(!Array.isArray(o)||!o.every(Ed))return Td;const l=i/s,a=n/r;return o.filter(t=>t.width>0&&t.height>0).map(t=>{const e=Math.floor(t.x*l),i=Math.floor(t.y*a);return{x:e,y:i,width:Math.ceil((t.x+t.width)*l)-e,height:Math.ceil((t.y+t.height)*a)-i}})}(s.canvasMasking,t,h,c,r,l);if("skip-frame"===d)return void a.set(e,!1);const v=yield createImageBitmap(t,1>o?{resizeWidth:h,resizeHeight:c,resizeQuality:"medium"}:{resizeWidth:h,resizeHeight:c});u.postMessage({id:e,bitmap:v,width:h,height:c,displayWidth:r,displayHeight:l,dataURLOptions:s.dataURLOptions,maskRegions:d},[v])}catch(t){a.set(e,!1)}}}),function(t){return l.apply(this,arguments)}))),d=requestAnimationFrame(f))};d=requestAnimationFrame(f),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(d),null===(t=u.terminate)||void 0===t||t.call(u),this.resetFrameDedup=null}}initCanvasMutationObserver(t,e,i,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=Bd(t,e,i,!1),r=function(t,e,i,n,s){const r=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const l of o)try{if("function"!=typeof e.CanvasRenderingContext2D.prototype[l])continue;const o=sh(e.CanvasRenderingContext2D.prototype,l,function(r){return function(...o){return zc(this.canvas,i,n,!0)||setTimeout(()=>{const i=Dd(o,e,this,s);t(this.canvas,{type:zu["2D"],property:l,args:i})},0),r.apply(this,o)}});r.push(o)}catch(s){const o=Nc(e.CanvasRenderingContext2D.prototype,l,{set(e){zc(this.canvas,i,n,!0)||t(this.canvas,{type:zu["2D"],property:l,args:[e],setter:!0})}});r.push(o)}return()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,i,n),o=function(t,e,i,n,s){const r=[];return void 0!==e.WebGLRenderingContext&&r.push(...jd(e.WebGLRenderingContext.prototype,zu.WebGL,t,i,n,e,s)),void 0!==e.WebGL2RenderingContext&&r.push(...jd(e.WebGL2RenderingContext.prototype,zu.WebGL2,t,i,n,e,s)),()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,i,n);this.resetObservers=()=>{s(),r(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,e)=>{const i=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,i)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,e){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(t);if(!i||-1===e)return;const n=i.map(t=>ys(t,qu)),{type:s}=i[0];this.mutationCb({id:e,type:s,commands:n}),this.pendingCanvasMutations.delete(t)}},Qd=class{constructor(t){var e;Oh(this,"trackedLinkElements",new WeakSet),Oh(this,"pendingDeferredSheets",new Set),Oh(this,"mutationCb",void 0),Oh(this,"adoptedStyleSheetCb",void 0),Oh(this,"maskAllElementAttributes",void 0),Oh(this,"maskAttributeFn",void 0),Oh(this,"styleMirror",new Kc),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(e=t.maskAllElementAttributes)&&void 0!==e&&e,this.maskAttributeFn=t.maskAttributeFn}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}beginDeferredLinkInlining(t,e){if(-1===e||!t.isConnected)return null;let i=null,n=null;try{n=t.sheet,n&&(i=Gh(n))}catch(t){}if(!i||!n)return Mh(),null;const s=i;let r=!1;const o={sheet:n,invalidate(){r=!0}};this.pendingDeferredSheets.add(o);let l=!1;return{advance:i=>{if(l)return!0;const a=oh(),u=uh();let h=!0;try{if(r)return l=!0,Mh(),!0;if(!s.advance(i))return h=!1,!1;l=!0;const o=s.text();if(!t.isConnected)return!0;let a=null;try{a=t.sheet}catch(t){}return a!==n?(Mh(),!0):o?(this.emitCssTextMutation(t,e,o),!0):(Mh(),!0)}finally{h&&this.pendingDeferredSheets.delete(o),hh(c=oh()-a,null!=(d=u)?d:lh)||(wh.totalMs+=c,c>wh.slowestSliceMs&&(wh.slowestSliceMs=c))}var c,d},remainingRules:()=>s.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(t){if(t&&0!==this.pendingDeferredSheets.size)for(const e of this.pendingDeferredSheets)e.sheet===t&&(this.pendingDeferredSheets.delete(e),e.invalidate())}inlineDeferredLinkElement(t,e){var i;null===(i=this.beginDeferredLinkInlining(t,e))||void 0===i||i.advance(1/0)}emitCssTextMutation(t,e,i){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e,attributes:{_cssText:Yh({element:t,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){if(0===t.length)return;const i={id:e,styleIds:[]},n=[];for(const e of t){let t;if(this.styleMirror.has(e))t=this.styleMirror.getId(e);else{const i=this.styleMirror.add(e);t=i;const s=oh();try{$h(()=>{try{const t=e.rules||e.cssRules;t&&Ch(t)}catch(t){}n.push({styleId:i,rules:Array.from(e.rules||CSSRule,(t,i)=>({rule:jh(t,e.href),index:i}))})})}finally{Th(oh()-s)}}i.styleIds.push(t)}n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),Sc.forEach(t=>t.abort()),Sc.clear()}trackStylesheetInLinkElement(t){}},Jd=class{constructor(){Oh(this,"nodeMap",new WeakMap),Oh(this,"active",!1)}inOtherBuffer(t,e){const i=this.nodeMap.get(t);return i&&Array.from(i).some(t=>t!==e)}add(t,e){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(e))}destroy(){}},Kd=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var Yd;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(Yd=t.contentWindow)||void 0===Yd?void 0:Yd.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var Xd=new Zh,tv=new Set([ju.Mutation,ju.MediaInteraction,ju.StyleSheetRule,ju.CanvasMutation,ju.Font,ju.Log,ju.StyleDeclaration,ju.AdoptedStyleSheet]);function ev(t){const e=window;if("function"==typeof e.requestIdleCallback){const i=e.requestIdleCallback(t,{timeout:2e3});return{cancel(){var t;return null===(t=e.cancelIdleCallback)||void 0===t?void 0:t.call(e,i)}}}const i=setTimeout(t,250);return{cancel:()=>clearTimeout(i)}}function iv(t={}){let e;const{emit:i,checkoutEveryNms:n,checkoutEveryNth:s,blockClass:r="rr-block",blockSelector:o=null,ignoreClass:l="rr-ignore",ignoreSelector:a=null,maskTextClass:u="rr-mask",maskTextSelector:h=null,inlineStylesheet:c=!0,inlineStylesheetBudgetRules:d,maskAllInputs:v,maskInputOptions:f,slimDOMOptions:p,maskInputFn:g,maskTextFn:m,maskAllElementAttributes:y=!1,maskAttributeFn:_,hooks:b,packFn:w,sampling:k={},dataURLOptions:S={},canvasResolutionScale:x,canvasMasking:C,mousemoveWait:T,recordDOM:E=!0,recordCanvas:I=!1,recordCrossOriginIframes:M=!1,recordAfter:R=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:P=!1,collectFonts:O=!1,inlineImages:A=!1,plugins:F,keepIframeSrcFn:D=()=>!1,ignoreCSSAttributes:L=new Set([]),attributeFilter:N,errorHandler:q}=t;ad(q);const B=ue({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},S),j=!M||window.parent===window;let H=!1;if(!j)try{window.parent.document&&(H=!1)}catch(t){H=!0}if(j&&!i)throw new Error("emit function is required");if(!j&&!H)return()=>{};void 0!==T&&void 0===k.mousemove&&(k.mousemove=T),Xd.reset();const U=!0===v?{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},z=Ic(void 0!==p&&p);let W;!function(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();let V=0;const G=new Map;let Z,Q;const J=t=>{for(const e of F||[])e.eventProcessor&&(t=e.eventProcessor(t));return w&&!H&&(t=w(t)),t};Wd=(t,e)=>{var r;const o=t;if(o.timestamp=qc(),!(null===(r=cd[0])||void 0===r?void 0:r.isFrozen())||o.type===Bu.FullSnapshot||o.type===Bu.IncrementalSnapshot&&tv.has(o.data.source)||cd.forEach(t=>t.unfreeze()),j)null==i||i(J(o),e);else if(H){const t={type:"rrweb",event:J(o),origin:window.location.origin,isCheckout:e};window.parent.postMessage(t,"*")}if(o.type===Bu.FullSnapshot)W=o,V=0;else if(o.type===Bu.IncrementalSnapshot){if(o.data.source===ju.Mutation&&o.data.isAttachIframe)return;V++,(s&&V>=s||n&&o.timestamp-W.timestamp>n)&&Vd(!0)}};const K=t=>{if(t.removes&&t.removes.length>0){const e=t.adds.length>0?new Set(t.adds.map(t=>t.node.id)):null,i=new Set;if(t.adds.length>0)for(const e of t.adds){const t=Xd.getNode(e.node.id);t&&"IFRAME"===t.nodeName&&i.add(t)}t.removes.forEach(({id:t})=>{if(e&&e.has(t))return;const n=et.getIframeElementById(t);n&&i.has(n)?et.forgetIframeId(t):(null==Z||Z(t),et.removeIframeById(t))}),null==Q||Q(),et.cleanupDetachedIframes()}Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.Mutation},t)})},Y=t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.Scroll},t)}),X=t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.CanvasMutation},t)}),tt=new Qd({mutationCb:K,adoptedStyleSheetCb:t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.AdoptedStyleSheet},t)}),maskAllElementAttributes:y,maskAttributeFn:_}),et=new Cd({mirror:Xd,mutationCb:K,stylesheetManager:tt,recordCrossOriginIframes:M,wrappedEmit:Wd});for(const t of F||[])t.getMirror&&t.getMirror({nodeMirror:Xd,crossOriginIframeMirror:et.crossOriginIframeMirror,crossOriginIframeStyleMirror:et.crossOriginIframeStyleMirror});const it=new Jd,nt=null==C?void 0:C.configured;Gd=new Zd({recordCanvas:I,mutationCb:X,win:window,blockClass:r,blockSelector:o,mirror:Xd,sampling:k.canvas,dataURLOptions:B,resolutionScale:x,canvasMasking:C});const st=new $d({mutationCb:K,scrollCb:Y,bypassOptions:{blockClass:r,blockSelector:o,maskTextClass:u,maskTextSelector:h,inlineStylesheet:c,maskInputOptions:U,dataURLOptions:B,maskTextFn:m,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:_,recordCanvas:I,canvasMaskingConfigured:nt,inlineImages:A,sampling:k,slimDOMOptions:z,iframeManager:et,stylesheetManager:tt,canvasManager:Gd,keepIframeSrcFn:D,processedNodeManager:it,attributeFilter:N},mirror:Xd});Vd=(t=!1)=>{if(E){kh(d);try{Wd({type:Bu.Meta,data:{href:window.location.href,width:Hc(),height:jc()}},t),null==e||e.cancel(),e=void 0,tt.reset(),st.init(),cd.forEach(t=>t.lock());let i=null,n=[];try{i=function(t,e){const{mirror:i=new Zh,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:u=!1,canvasMaskingConfigured:h,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f=!1,maskAttributeFn:p,slimDOM:g=!1,dataURLOptions:m,preserveWhiteSpace:y,onSerialize:_,onIframeLoad:b,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C=()=>!1,maxDepth:T,inlineStylesheetBudgetRules:E}=e||{},I=!0===c?{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===c?{password:!0}:c,M=Ic(g);kh(E);try{return Ec(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:I,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f,maskAttributeFn:p,slimDOMOptions:M,dataURLOptions:m,inlineImages:a,recordCanvas:u,canvasMaskingConfigured:h,preserveWhiteSpace:y,onSerialize:_,onIframeLoad:b,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C,newlyAddedElement:!1,maxDepth:T})}finally{Sh()}}(document,{mirror:Xd,blockClass:r,blockSelector:o,maskTextClass:u,maskTextSelector:h,inlineStylesheet:c,maskAllInputs:U,inlineStylesheetBudgetRules:d,maskTextFn:m,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:_,slimDOM:z,dataURLOptions:B,recordCanvas:I,canvasMaskingConfigured:nt,inlineImages:A,onSerialize(t){Zc(t,Xd)&&et.addIframe(t),Qc(t,Xd)&&tt.trackLinkElement(t),Jc(t)&&st.addShadowRoot(rh.shadowRoot(t),document)},onIframeLoad(t,e){et.attachIframe(t,e),st.observeAttachShadow(t)},onIframeListenerRegistered(t,e){et.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){tt.attachLinkElement(t,e)},keepIframeSrcFn:D})}finally{n=Ih()}if(!i)return console.warn("Failed to snapshot the document");if(Wd({type:Bu.FullSnapshot,data:{node:i,initialOffset:Bc(window)}},t),cd.forEach(t=>t.unlock()),Gd.onFullSnapshot(),n.length){const t=function(t,e,i){let n=!1,s=null,r=0,o=null;const l=()=>null!==o||t.length>r,a=()=>{const i=t[r];t[r]=null,r+=1,i&&Oc(()=>{o=e.beginDeferredLinkInlining(i,Xd.getId(i))})},u=()=>{if(!o)return;const t=o;let e=!0;Oc(()=>{e=t.advance(200)}),e&&(o=null)},h=()=>{o||a(),u()},c=t=>{if(s=null,n)return;let e=0;do{try{h()}catch(t){null==o||o.discard(),o=null,Rh(1)}e+=1}while(!n&&l()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));n||(l()?s=ev(c):i())};return s=ev(c),{cancel(){n=!0,null==o||o.discard(),o=null,null==s||s.cancel(),s=null},flush(){if(n)return;n=!0,null==s||s.cancel(),s=null;let e=0,h=0;for(;l()&&50>e;){o||a();const t=o;if(t)if(Math.floor(t.remainingRules()/200)+1>50-e)t.discard(),o=null,h+=1;else{try{u()}catch(t){null==o||o.discard(),o=null,h+=1}e+=1}}if(l()||h>0){let e=h+(null!==o?1:0);for(let i=r;t.length>i;i++)null!==t[i]&&(e+=1);Rh(e),null==o||o.discard(),o=null}i()}}}(n,tt,()=>{e===t&&(e=void 0)});e=t}M&&et.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&tt.adoptStyleSheets(document.adoptedStyleSheets,Xd.getId(document))}finally{Sh()}}};try{const t=[];t.push(Rc("pagehide",()=>{try{null==e||e.flush()}catch(t){}e=void 0},window));for(const e of["visibilitychange","freeze","resume"])t.push(Rc(e,ah,document));Z=e=>{const i=G.get(e);i&&(i.forEach(e=>{Oc(e);const i=t.indexOf(e);-1!==i&&t.splice(i,1)}),G.delete(e))},Q=()=>{for(const[t]of G){const e=Xd.getNode(t);if(e)try{e.contentDocument&&e.contentDocument.defaultView||null==Z||Z(t)}catch(e){null==Z||Z(t)}else null==Z||Z(t)}};const i=t=>{var e;return hd(wd)({mutationCb:K,mousemoveCb:(t,e)=>Wd({type:Bu.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.MouseInteraction},t)}),scrollCb:Y,viewportResizeCb:t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.ViewportResize},t)}),inputCb:t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.Input},t)}),mediaInteractionCb:t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.MediaInteraction},t)}),styleSheetRuleCb:t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.StyleSheetRule},t)}),styleDeclarationCb:t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.StyleDeclaration},t)}),canvasMutationCb:X,fontCb:t=>Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.Font},t)}),selectionCb(t){Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.Selection},t)})},customElementCb(t){Wd({type:Bu.IncrementalSnapshot,data:ue({source:ju.CustomElement},t)})},blockClass:r,ignoreClass:l,ignoreSelector:a,maskTextClass:u,maskTextSelector:h,maskInputOptions:U,inlineStylesheet:c,sampling:k,recordDOM:E,recordCanvas:I,canvasMaskingConfigured:nt,inlineImages:A,userTriggeredOnInput:P,collectFonts:O,doc:t,maskInputFn:g,maskTextFn:m,maskAllElementAttributes:y,maskAttributeFn:_,keepIframeSrcFn:D,blockSelector:o,slimDOMOptions:z,dataURLOptions:B,mirror:Xd,iframeManager:et,stylesheetManager:tt,shadowDomManager:st,processedNodeManager:it,canvasManager:Gd,ignoreCSSAttributes:L,attributeFilter:N,plugins:(null==F||null===(e=F.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({observer:t.observer,options:t.options,callback:e=>Wd({type:Bu.Plugin,data:{plugin:t.name,payload:e}})})))||[]},b)};et.addLoadListener(e=>{try{const n=Xd.getId(e),s=i(e.contentDocument);if("function"==typeof s&&(t.push(s),-1!==n)){let t=G.get(n);t||(t=new Set,G.set(n,t)),t.add(s)}}catch(t){console.warn(t)}}),et.addPageHideListener(t=>{const e=Xd.getId(t);null==Z||Z(e),pd(t)});let n=-1;const s=t=>Wd({type:Bu.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),d=()=>{var t,e,i,r;const o=document,l=null!==(t=null!==(e=null!==(i=null!==(r=o.fullscreenElement)&&void 0!==r?r:o.webkitFullscreenElement)&&void 0!==i?i:o.mozFullScreenElement)&&void 0!==e?e:o.msFullscreenElement)&&void 0!==t?t:null,a=l?Xd.getId(l):-1;a!==n&&(-1!==n&&s({id:n,enter:!1}),n=a,-1!==a&&s({id:a,enter:!0}))},v=()=>{Vd();const e=i(document);"function"==typeof e&&t.push(e),t.push(Rc("fullscreenchange",d)),t.push(Rc("webkitfullscreenchange",d)),t.push(Rc("mozfullscreenchange",d)),t.push(Rc("MSFullscreenChange",d)),Kd=!0};return["interactive","complete"].includes(document.readyState)?v():(t.push(Rc("DOMContentLoaded",()=>{Wd({type:Bu.DomContentLoaded,data:{}}),"DOMContentLoaded"===R&&v()})),t.push(Rc("load",()=>{Wd({type:Bu.Load,data:{}}),"load"===R&&v()},window))),()=>{try{null==e||e.flush()}catch(t){}e=void 0,Ac(t),it.destroy(),et.removeLoadListener(),et.destroy(),G.clear(),st.reset(),Xd.reset(),Kd=!1,ud()}}catch(t){console.warn(t)}}iv.addCustomEvent=(t,e)=>{if(!Kd)throw new Error("please add custom event after start recording");Wd({type:Bu.Custom,data:{tag:t,payload:e}})},iv.freezePage=()=>{cd.forEach(t=>t.freeze())},iv.takeFullSnapshot=t=>{if(!Kd)throw new Error("please take full snapshot after start recording");Vd(t)},iv.mirror=Xd,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var nv=Object.create(null);function sv(t){return sv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sv(t)}function rv(t,e,i){return(e=function(t){var e=function(t){if("object"!=sv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=sv(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==sv(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}nv.Node=Object.create(null),nv.ShadowRoot=Object.create(null),nv.MutationObserver=Object.create(null),nv.Element=Object.create(null);var ov=class{constructor(t){rv(this,"fileName",void 0),rv(this,"functionName",void 0),rv(this,"lineNumber",void 0),rv(this,"columnNumber",void 0),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){const t=this.lineNumber||"",e=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${t}:${e})`:`${this.fileName}:${t}:${e}`}},lv=/(^|@)\S+:\d+/,av=/^\s*at .*(\S+:\d+|\(native\))/m,uv=/^(eval@)?(\[native code])?$/,hv={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(av)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):[]:[]},extractLocation(t){if(-1===t.indexOf(":"))return[t];const e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));if(!e)throw new Error(`Cannot parse given url: ${t}`);return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE(t){return t.stack.split("\n").filter(function(t){return!!t.match(av)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let e=t.replace(/^\s+/,"").replace(/\(eval code/g,"(");const i=e.match(/ (\((.+):(\d+):(\d+)\)$)/);e=i?e.replace(i[0],""):e;const n=e.split(/\s+/).slice(1),s=this.extractLocation(i?i[1]:n.pop());return new ov({functionName:n.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(s[0])>-1?void 0:s[0],lineNumber:s[1],columnNumber:s[2]})},this)},parseFFOrSafari(t){return t.stack.split("\n").filter(function(t){return!t.match(uv)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new ov({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(e),n=i&&i[1]?i[1]:void 0,s=this.extractLocation(t.replace(e,""));return new ov({functionName:n,fileName:s[0],lineNumber:s[1],columnNumber:s[2]})}},this)},parseOpera(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9(t){const e=/Line (\d+).*script (?:in )?(\S+)/i,i=t.message.split("\n"),n=[];for(let t=2,s=i.length;s>t;t+=2){const s=e.exec(i[t]);s&&n.push(new ov({fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera10(t){const e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=t.stacktrace.split("\n"),n=[];for(let t=0,s=i.length;s>t;t+=2){const s=e.exec(i[t]);s&&n.push(new ov({functionName:s[3]||void 0,fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera11(t){return t.stack.split("\n").filter(function(t){return!!t.match(lv)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),i=this.extractLocation(e.pop());return new ov({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function cv(t){if(!t||!t.outerHTML)return"";let e="";for(;t.parentElement;){let i=t.localName;if(!i)break;i=i.toLowerCase();const n=t.parentElement,s=[];if(n.children&&n.children.length>0)for(let t=0;n.children.length>t;t++){const e=n.children[t];e.localName&&e.localName.toLowerCase&&e.localName.toLowerCase()===i&&s.push(e)}s.length>1&&(i+=`:eq(${s.indexOf(t)})`),e=i+(e?">"+e:""),t=n}return e}function dv(t){return Array.isArray(t)}function vv(t){return"object"==typeof t&&null!==t&&!dv(t)}function fv(t,e){if(0===e)return!0;const i=Object.keys(t);for(const n of i)if(vv(t[n])&&fv(t[n],e-1))return!0;return!1}function pv(t,e){const i={numOfKeysLimit:50,depthOfLimit:4};Object.assign(i,e);const n=[],s=[];return JSON.stringify(t,function(t,e){if(n.length>0){const i=n.indexOf(this);~i?n.splice(i+1):n.push(this),~i?s.splice(i,1/0,t):s.push(t),~n.indexOf(e)&&(e=n[0]===e?"[Circular ~]":"[Circular ~."+s.slice(0,n.indexOf(e)).join(".")+"]")}else n.push(e);if(null===e)return e;if(void 0===e)return"undefined";if(vv(r=e)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||vv(r)&&fv(r,i.depthOfLimit))return function(t){let e=t.toString();return i.stringLengthLimit&&e.length>i.stringLengthLimit&&(e=`${e.slice(0,i.stringLengthLimit)}...`),e}(e);var r;if("bigint"==typeof e)return e.toString()+"n";if(e instanceof Event){const t={};for(const i in e){const n=e[i];t[i]=dv(n)?cv(n.length?n[0]:null):n}return t}return e instanceof Node?e instanceof HTMLElement?e?e.outerHTML:"":e.nodeName:e instanceof Error?e.stack?e.stack+"\nEnd of stack for Error object":e.name+": "+e.message:e})}var gv={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 mv(t,e,i){const n=i?Object.assign({},gv,i):gv,s=n.logger;if(!s)return()=>{};let r;r="string"==typeof s?e[s]:s;let o=0,l=!1,a=!0;const u=[];if(n.level.includes("error")){const i=e=>{const i=e.message;t({level:"error",trace:hv.parse(e.error).map(t=>t.toString()),payload:[pv(i,n.stringifyOptions)]})};e.addEventListener("error",i),u.push(()=>{e.removeEventListener("error",i)});const s=e=>{let i,s;e.reason instanceof Error?(i=e.reason,s=[pv(`Uncaught (in promise) ${i.name}: ${i.message}`,n.stringifyOptions)]):(i=new Error,s=[pv("Uncaught (in promise)",n.stringifyOptions),pv(e.reason,n.stringifyOptions)]),t({level:"error",trace:hv.parse(i).map(t=>t.toString()),payload:s})};e.addEventListener("unhandledrejection",s),u.push(()=>{e.removeEventListener("unhandledrejection",s)})}for(const t of n.level)u.push(h(r,t));return()=>{a=!1,u.forEach(t=>t())};function h(e,i){return e[i]?function(s,r){try{if(!(r in s))return()=>{};const u=s[r],h={next:u},c=(s=>(...r)=>{if(s.apply(e,r),a&&!("assert"===i&&r[0]||l)){l=!0;try{const e=hv.parse(new Error).map(t=>t.toString()).splice(1),s=("assert"===i?r.slice(1):r).map(t=>pv(t,n.stringifyOptions));o++,n.lengthThreshold>o?t({level:i,trace:e,payload:s}):o===n.lengthThreshold&&t({level:"warn",trace:[],payload:[pv("The number of log records reached the threshold.")]})}catch(t){s.apply(e,["rrweb logger error:",t,...r])}finally{l=!1}}})(function(...t){return h.next.apply(this,t)});return"function"==typeof c&&(c.prototype=c.prototype||{},Object.defineProperties(c,{__rrweb_original__:{enumerable:!1,value:u},__rrweb_layer__:{enumerable:!1,value:h}})),s[r]=c,()=>{if(s[r]===c)return void(s[r]=h.next);const t=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let e=s[r],i=t(e);for(;i;){if(i.next===c)return void(i.next=h.next);e=i.next,i=t(e)}}}catch(t){return()=>{}}}(e,i):()=>{}}}var yv=t=>({name:"rrweb/console@1",observer:mv,options:t});const _v=()=>{},bv=t=>{var e;if(xe(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function wv(t,e,i){try{if(!(e in t))return _v;const n={next:t[e]},s=i(function(...t){return n.next.apply(this,t)});return xe(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:n}})),t[e]=s,()=>{if(t[e]===s)return void(t[e]=n.next);let i=t[e],r=bv(i);for(;r;){if(r.next===s)return void(r.next=n.next);i=r.next,r=bv(i)}}}catch(t){return _v}}function kv(t,e){var i;const n=function(t){try{return"string"==typeof t?new URL(t).hostname:"url"in t?new URL(t.url).hostname:t.hostname}catch(t){return null}}(t),s={hostname:n,isHostDenied:!1};if(!(null===(i=e.payloadHostDenyList)||void 0===i?void 0:i.length)||!(null==n?void 0:n.trim().length))return s;for(const t of e.payloadHostDenyList)if(n.endsWith(t))return{hostname:n,isHostDenied:!0};return s}const Sv=Gs("[Recorder]"),xv=t=>"navigation"===t.entryType,Cv=t=>"resource"===t.entryType;function $v(t,e){return!!e&&(Ae(e)||e[t])}function Tv(t){if("undefined"==typeof Request)return!1;if(t instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(t)}catch(t){return!1}}const Ev=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function Iv({type:t,recordBody:e,headers:i,url:n}){function s(t){const e=Object.keys(i).find(t=>"content-type"===t.toLowerCase()),n=e&&i[e];return t.some(t=>null==n?void 0:n.toLowerCase().includes(t))}if(!e)return!1;if(function t(e){try{return"string"==typeof e?e.startsWith("blob:"):e instanceof URL?"blob:"===e.protocol:!!Tv(e)&&t(e.url)}catch(t){return!1}}(n))return!1;if(s(Ev))return!1;if(Ae(e))return!0;if(Se(e))return s(e);const r=e[t];return Ae(r)?r:s(r)}function Mv(t,e,i,n,s){return Rv.apply(this,arguments)}function Rv(){return Rv=re(function*(t,e,i,n,s,r=0){if(r>10)return Sv.warn("Failed to get performance entry for request",{url:i,initiatorType:e}),null;const o=function(t,e){for(let i=t.length-1;i>=0;i-=1)if(e(t[i]))return t[i]}(t.performance.getEntriesByName(i),t=>Cv(t)&&t.initiatorType===e&&(Te(n)||t.startTime>=n)&&(Te(s)||s>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*r)),Mv(t,e,i,n,s,r+1))}),Rv.apply(this,arguments)}function Pv({body:t,options:e,url:i}){if(Re(t))return null;const{hostname:n,isHostDenied:s}=kv(i,e);if(s)return n+" is in deny list";if(Ee(t))return t;if((t=>"u">typeof Document&&t instanceof Document)(t))return t.textContent;if(Fe(t))return ar(t);if(Ce(t))try{return JSON.stringify(t)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}const Ov=t=>!Me(t)&&("navigation"===t.entryType||"resource"===t.entryType);function Av({entry:t,method:e,status:i,networkRequest:n,isInitial:s,start:r,end:o,url:l,initiatorType:a}){r=t?t.startTime:r,o=t?t.responseEnd:o;const u=Math.floor(Date.now()-performance.now()),h=Math.floor(u+(r||0)),c=[ue(ue({},t?t.toJSON():{name:l}),{},{startTime:Te(r)?void 0:Math.round(r),endTime:Te(o)?void 0:Math.round(o),timeOrigin:u,timestamp:h,method:e,initiatorType:a||(t?t.initiatorType:void 0),status:i,requestHeaders:n.requestHeaders,requestBody:n.requestBody,responseHeaders:n.responseHeaders,responseBody:n.responseBody,isInitial:s})];if(Ov(t))for(const e of t.serverTiming||[])c.push({timeOrigin:u,timestamp:h,startTime:Math.round(t.startTime),name:e.name,duration:e.duration,entryType:"serverTiming"});return c}const Fv=["video/","audio/"];function Dv(t){return Ce(t)&&xe(t.getReader)&&xe(t.tee)}const Lv="[SessionReplay] Timeout while trying to read body",Nv="[SessionReplay] Failed to read body";function qv(t){return`${Nv}: ${t}`}function Bv(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function jv(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const i=setTimeout(()=>e(Lv),500);try{t.clone().text().then(t=>e(t),t=>e(qv(t))).finally(()=>clearTimeout(i))}catch(t){clearTimeout(i),e(Nv)}})}(t);const i=no(e);return function(t,e){try{var i,n;const s=null===(i=t.headers)||void 0===i||null===(n=i.get)||void 0===n?void 0:n.call(i,"content-length");if(!s)return!1;const r=parseInt(s,10);return Number.isFinite(r)&&r>e}catch(t){return!1}}(t,i)?Promise.resolve(Bv(i)):function(t,e){return new Promise(i=>{let n,s=!1;function r(){try{null==n||n.cancel().catch(()=>{})}catch(t){}}function o(t){s||(s=!0,clearTimeout(l),r(),i(t))}const l=setTimeout(()=>o(Lv),500);let a;try{a=t.clone()}catch(t){return void o(Nv)}const u=a.body;if(!Dv(u)||"undefined"==typeof TextDecoder){try{a.text().then(t=>o(t),t=>o(qv(t)))}catch(t){o(Nv)}return}try{n=u.getReader()}catch(t){return void o(Nv)}const h=[];let c=0;!function t(){n.read().then(({done:i,value:n})=>{if(s)r();else if(i)o((new TextDecoder).decode(function(t,e){const i=new Uint8Array(e);let n=0;for(const e of t)i.set(e,n),n+=e.byteLength;return i}(h,c)));else{if(n){if(c+n.byteLength>e)return void o(Bv(e));c+=n.byteLength,h.push(n)}t()}},t=>o(qv(t)))}()})}(t,i)}function Hv(){return Hv=re(function*({r:t,options:e,url:i}){const{hostname:n,isHostDenied:s}=kv(i,e);return s?Promise.resolve(n+" is in deny list"):jv(t,e)}),Hv.apply(this,arguments)}function Uv(){return Uv=re(function*({r:t,options:e,url:i}){const n=function({r:t,options:e,url:i}){var n;if("chunked"===t.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";const s=null===(n=t.headers.get("Content-Type"))||void 0===n?void 0:n.toLowerCase(),r=Fv.some(t=>null==s?void 0:s.startsWith(t));if(s&&r)return`Content-Type ${s} is not supported`;const{hostname:o,isHostDenied:l}=kv(i,e);return l?o+" is in deny list":null}({r:t,options:e,url:i});return Me(n)?jv(t,e):Promise.resolve(n)}),Uv.apply(this,arguments)}let zv=null;function Wv(t,e,i){if(!("performance"in e))return()=>{};if(zv)return Sv.warn("Network observer already initialised, doing nothing"),()=>{};const n=i?Object.assign({},so,i):so;let s=!0;const r=e=>{if(!s)return;const i=[];let r=!1;e.requests.forEach(t=>{const e="serverTiming"===t.entryType;if(e&&r)return;const s=n.maskRequestFn(t);e||(r=!s||(t=>!!t&&vo.has(t))(s)),s&&i.push(s)}),i.length>0&&t(ue(ue({},e),{},{requests:i}))},o=function(t,e,i){i.recordInitialRequests&&t({requests:e.performance.getEntries().filter(t=>xv(t)||Cv(t)&&i.initiatorTypes.includes(t.initiatorType)).flatMap(t=>Av({entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0});const n=new e.PerformanceObserver(e=>{t({requests:e.getEntries().filter(t=>xv(t)||Cv(t)&&i.initiatorTypes.includes(t.initiatorType)&&(t=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>Av({entry:t,method:void 0,status:void 0,networkRequest:{}}))})}),s=PerformanceObserver.supportedEntryTypes.filter(t=>i.performanceEntryTypeToObserve.includes(t));return n.observe({entryTypes:s}),()=>{n.disconnect()}}(r,e,n);let l=()=>{},a=()=>{};return(n.recordHeaders||n.recordBody)&&(l=function(t,e,i){if(!i.initiatorTypes.includes("xmlhttprequest"))return()=>{};const n=$v("request",i.recordHeaders),s=$v("response",i.recordHeaders),r=wv(e.XMLHttpRequest.prototype,"open",r=>function(o,l,a=!0,u,h){const c=this;try{const r=new Request(l),a={};let u,h;const d={},v=c.setRequestHeader.bind(c);c.setRequestHeader=(t,e)=>(d[t]=e,v(t,e)),n&&(a.requestHeaders=d);const f=c.send.bind(c);c.send=t=>(Iv({type:"request",headers:d,url:l,recordBody:i.recordBody})&&(a.requestBody=Pv({body:t,options:i,url:l})),u=e.performance.now(),f(t));const p=()=>{c.removeEventListener("readystatechange",g),c.removeEventListener("error",p),c.removeEventListener("abort",p),c.removeEventListener("timeout",p)},g=()=>{if(c.readyState!==c.DONE)return;p(),h=e.performance.now();const n={};c.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(t=>{const e=t.split(": "),i=e.shift(),s=e.join(": ");i&&(n[i]=s)}),s&&(a.responseHeaders=n),Iv({type:"response",headers:n,url:l,recordBody:i.recordBody})&&(a.responseBody=Pv({body:c.response,options:i,url:l})),Mv(e,"xmlhttprequest",r.url,u,h).then(e=>{t({requests:Av({entry:e,method:o,status:null==c?void 0:c.status,networkRequest:a,start:u,end:h,url:l.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};c.addEventListener("readystatechange",g),c.addEventListener("error",p),c.addEventListener("abort",p),c.addEventListener("timeout",p)}catch(t){Sv.error("Failed to instrument XHR for network capture",t)}r.call(c,o,l.toString(),a,u,h)});return()=>{r()}}(r,e,n),a=function(t,e,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=$v("request",i.recordHeaders),s=$v("response",i.recordHeaders),r=wv(e,"fetch",r=>function(){var o=re(function*(o,l){let a,u;try{a=new Request(o,l)}catch(t){return Sv.error("Failed to instrument fetch for network capture",t),r(o,l)}const h={};let c,d;try{try{const t={};a.headers.forEach((e,i)=>{t[i]=e}),n&&(h.requestHeaders=t),!Dv(null==l?void 0:l.body)&&Iv({type:"request",headers:t,url:o,recordBody:i.recordBody})&&(h.requestBody=yield function(t){return Hv.apply(this,arguments)}({r:a,options:i,url:o}))}catch(t){Sv.error("Failed to record fetch request for network capture",t)}c=e.performance.now(),u=Tv(o)?yield r(a):yield r(o,l),d=e.performance.now();try{const t={};u.headers.forEach((e,i)=>{t[i]=e}),s&&(h.responseHeaders=t),Iv({type:"response",headers:t,url:o,recordBody:i.recordBody})&&(h.responseBody=yield function(t){return Uv.apply(this,arguments)}({r:u,options:i,url:o}))}catch(t){Sv.error("Failed to record fetch response for network capture",t)}return u}finally{Mv(e,"fetch",a.url,c,d).then(e=>{t({requests:Av({entry:e,method:a.method,status:null==u?void 0:u.status,networkRequest:h,start:c,end:d,url:a.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(t,e){return o.apply(this,arguments)}}());return()=>{r()}}(r,e,n)),zv=()=>{s=!1,o(),l(),a(),zv=null},zv}const Vv=t=>({name:"rrweb/network@1",observer:Wv,options:t});var Gv,Zv,Qv,Jv,Kv,Yv,Xv,tf,ef,nf,sf,rf,of,lf,af;d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:yv,getRecordNetworkPlugin:Vv},d.__PosthogExtensions__.rrweb={record:iv,version:"v2",wasMaxDepthReached:()=>Tc,resetMaxDepthState(){Tc=!1,$c=!1},getLastSnapshotCost:()=>ph,getMutationCost:()=>ue({},bh),resetSnapshotCostState(){ch=0,dh=0,vh=0,lh=0,fh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},ph=null,gh=null,mh=[],yh=0,_h=0,bh={slowestBatchMs:0},wh={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},d.rrweb={record:iv,version:"v2"},d.rrwebConsoleRecord={getRecordConsolePlugin:yv},d.getRecordNetworkPlugin=Vv,d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initSessionRecording=(t,e)=>new Nu(t,e);var uf,hf,cf,df,vf={},ff=[],pf=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,gf=Array.isArray;function mf(t,e){for(var i in e)t[i]=e[i];return t}function yf(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function _f(t,e,i){var n,s,r,o={};for(r in e)"key"==r?n=e[r]:"ref"==r?s=e[r]:o[r]=e[r];if(arguments.length>2&&(o.children=arguments.length>3?Gv.call(arguments,2):i),"function"==typeof t&&null!=t.defaultProps)for(r in t.defaultProps)void 0===o[r]&&(o[r]=t.defaultProps[r]);return bf(t,o,n,s,null)}function bf(t,e,i,n,s){var r={type:t,props:e,key:i,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==s?++Qv:s,__i:-1,__u:0};return null==s&&null!=Zv.vnode&&Zv.vnode(r),r}function wf(t){return t.children}function kf(t,e){this.props=t,this.context=e}function Sf(t,e){if(null==e)return t.__?Sf(t.__,t.__i+1):null;for(var i;t.__k.length>e;e++)if(null!=(i=t.__k[e])&&null!=i.__e)return i.__e;return"function"==typeof t.type?Sf(t):null}function xf(t){if(t.__P&&t.__d){var e=t.__v,i=e.__e,n=[],s=[],r=mf({},e);r.__v=e.__v+1,Zv.vnode&&Zv.vnode(r),Af(t.__P,r,e,t.__n,t.__P.namespaceURI,32&e.__u?[i]:null,n,null==i?Sf(e):i,!!(32&e.__u),s),r.__v=e.__v,r.__.__k[r.__i]=r,Df(n,r,s),e.__e=e.__=null,r.__e!=i&&Cf(r)}}function Cf(t){if(null!=(t=t.__)&&null!=t.__c)return t.__e=t.__c.base=null,t.__k.some(function(e){if(null!=e&&null!=e.__e)return t.__e=t.__c.base=e.__e}),Cf(t)}function $f(t){(!t.__d&&(t.__d=!0)&&Jv.push(t)&&!Tf.__r++||Kv!=Zv.debounceRendering)&&((Kv=Zv.debounceRendering)||Yv)(Tf)}function Tf(){try{for(var t,e=1;Jv.length;)Jv.length>e&&Jv.sort(Xv),t=Jv.shift(),e=Jv.length,xf(t)}finally{Jv.length=Tf.__r=0}}function Ef(t,e,i,n,s,r,o,l,a,u,h){var c,d,v,f,p,g,m,y=n&&n.__k||ff,_=e.length;for(a=function(t,e,i,n,s){var r,o,l,a,u,h=i.length,c=h,d=0;for(t.__k=new Array(s),r=0;s>r;r++)null!=(o=e[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=t.__k[r]=bf(null,o,null,null,null):gf(o)?o=t.__k[r]=bf(wf,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=t.__k[r]=bf(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):t.__k[r]=o,a=r+d,o.__=t,o.__b=t.__b+1,l=null,-1!=(u=o.__i=Mf(o,i,a,c))&&(c--,(l=i[u])&&(l.__u|=2)),null==l||null==l.__v?(-1==u&&(s>h?d--:h>s&&d++),"function"!=typeof o.type&&(o.__u|=4)):u!=a&&(u==a-1?d--:u==a+1?d++:(u>a?d--:d++,o.__u|=4))):t.__k[r]=null;if(c)for(r=0;h>r;r++)null!=(l=i[r])&&!(2&l.__u)&&(l.__e==n&&(n=Sf(l)),qf(l,l));return n}(i,e,y,a,_),c=0;_>c;c++)null!=(v=i.__k[c])&&(d=-1!=v.__i&&y[v.__i]||vf,v.__i=c,g=Af(t,v,d,s,r,o,l,a,u,h),f=v.__e,v.ref&&d.ref!=v.ref&&(d.ref&&Nf(d.ref,null,v),h.push(v.ref,v.__c||f,v)),null==p&&null!=f&&(p=f),(m=!!(4&v.__u))||d.__k===v.__k?(a=If(v,a,t,m),m&&d.__e&&(d.__e=null)):"function"==typeof v.type&&void 0!==g?a=g:f&&(a=f.nextSibling),v.__u&=-7);return i.__e=p,a}function If(t,e,i,n){var s,r;if("function"==typeof t.type){for(s=t.__k,r=0;s&&s.length>r;r++)s[r]&&(s[r].__=t,e=If(s[r],e,i,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=Sf(t)),i.insertBefore(t.__e,e||null)),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function Mf(t,e,i,n){var s,r,o,l=t.key,a=t.type,u=e[i],h=null!=u&&!(2&u.__u);if(null===u&&null==l||h&&l==u.key&&a==u.type)return i;if(n>(h?1:0))for(s=i-1,r=i+1;s>=0||e.length>r;)if(null!=(u=e[o=0>s?r++:s--])&&!(2&u.__u)&&l==u.key&&a==u.type)return o;return-1}function Rf(t,e,i){"-"==e[0]?t.setProperty(e,null==i?"":i):t[e]=null==i?"":"number"!=typeof i||pf.test(e)?i:i+"px"}function Pf(t,e,i,n,s){var r,o;t:if("style"==e)if("string"==typeof i)t.style.cssText=i;else{if("string"==typeof n&&(t.style.cssText=n=""),n)for(e in n)i&&e in i||Rf(t.style,e,"");if(i)for(e in i)n&&i[e]==n[e]||Rf(t.style,e,i[e])}else if("o"==e[0]&&"n"==e[1])r=e!=(e=e.replace(sf,"$1")),o=e.toLowerCase(),e=o in t||"onFocusOut"==e||"onFocusIn"==e?o.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=i,i?n?i[nf]=n[nf]:(i[nf]=rf,t.addEventListener(e,r?lf:of,r)):t.removeEventListener(e,r?lf:of,r);else{if("http://www.w3.org/2000/svg"==s)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==i?"":i;break t}catch(t){}"function"==typeof i||(null==i||!1===i&&"-"!=e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==i?"":i))}}function Of(t){return function(e){if(this.l){var i=this.l[e.type+t];if(null==e[ef])e[ef]=rf++;else if(i[nf]>e[ef])return;return i(Zv.event?Zv.event(e):e)}}}function Af(t,e,i,n,s,r,o,l,a,u){var h,c,d,v,f,p,g,m,y,_,$,b,w,k,S,x,C=e.type;if(void 0!==e.constructor)return null;128&i.__u&&(a=!!(32&i.__u),r=[l=e.__e=i.__e]),(h=Zv.__b)&&h(e);t:if("function"==typeof C){c=o.length;try{if(y=e.props,_=C.prototype&&C.prototype.render,$=(h=C.contextType)&&n[h.__c],b=h?$?$.props.value:h.__:n,i.__c?m=(d=e.__c=i.__c).__=d.__E:(_?e.__c=d=new C(y,b):(e.__c=d=new kf(y,b),d.constructor=C,d.render=Bf),$&&$.sub(d),d.state||(d.state={}),d.__n=n,v=d.__d=!0,d.__h=[],d._sb=[]),_&&null==d.__s&&(d.__s=d.state),_&&null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=mf({},d.__s)),mf(d.__s,C.getDerivedStateFromProps(y,d.__s))),f=d.props,p=d.state,d.__v=e,v)_&&null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),_&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(_&&null==C.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,b),e.__v==i.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,b)){e.__v!=i.__v&&(d.props=y,d.state=d.__s,d.__d=!1),e.__e=i.__e,e.__k=i.__k,e.__k.some(function(t){t&&(t.__=e)}),ff.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break t}null!=d.componentWillUpdate&&d.componentWillUpdate(y,d.__s,b),_&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(f,p,g)})}if(d.context=b,d.props=y,d.__P=t,d.__e=!1,w=Zv.__r,k=0,_)d.state=d.__s,d.__d=!1,w&&w(e),h=d.render(d.props,d.state,d.context),ff.push.apply(d.__h,d._sb),d._sb=[];else do{d.__d=!1,w&&w(e),h=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&25>++k);d.state=d.__s,null!=d.getChildContext&&(n=mf(mf({},n),d.getChildContext())),_&&!v&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(f,p)),S=null!=h&&h.type===wf&&null==h.key?Lf(h.props.children):h,l=Ef(t,gf(S)?S:[S],e,i,n,s,r,o,l,a,u),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),m&&(d.__E=d.__=null)}catch(t){if(o.length=c,e.__v=null,a||null!=r)if(t.then){for(e.__u|=a?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;null!=r&&(r[r.indexOf(l)]=null),e.__e=l}else{if(null!=r)for(x=r.length;x--;)yf(r[x]);Ff(e)}else e.__e=i.__e,!e.__k&&i.__k&&(e.__k=i.__k),t.then||Ff(e);Zv.__e(t,e,i)}}else null==r&&e.__v==i.__v?(e.__k=i.__k,e.__e=i.__e):l=e.__e=function(t,e,i,n,s,r,o,l,a){var u,h,c,d,v,f,p,g=i.props||vf,m=e.props,y=e.type;if("svg"==y?s="http://www.w3.org/2000/svg":"math"==y?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=r)for(u=0;r.length>u;u++)if((v=r[u])&&"setAttribute"in v==!!y&&(y?v.localName==y:3==v.nodeType)){t=v,r[u]=null;break}if(null==t){if(null==y)return document.createTextNode(m);t=document.createElementNS(s,y,m.is&&m),l&&(Zv.__m&&Zv.__m(e,r),l=!1),r=null}if(null==y)g===m||l&&t.data==m||(t.data=m);else{if(r="textarea"==y&&null!=m.defaultValue?null:r&&Gv.call(t.childNodes),!l&&null!=r)for(g={},u=0;t.attributes.length>u;u++)g[(v=t.attributes[u]).name]=v.value;for(u in g)v=g[u],"dangerouslySetInnerHTML"==u?c=v:"children"==u||u in m||"value"==u&&"defaultValue"in m||"checked"==u&&"defaultChecked"in m||Pf(t,u,null,v,s);for(u in m)v=m[u],"children"==u?d=v:"dangerouslySetInnerHTML"==u?h=v:"value"==u?f=v:"checked"==u?p=v:l&&"function"!=typeof v||g[u]===v||Pf(t,u,v,g[u],s);if(h)l||c&&(h.__html==c.__html||h.__html==t.innerHTML)||(t.innerHTML=h.__html),e.__k=[];else if(c&&(t.innerHTML=""),Ef("template"==e.type?t.content:t,gf(d)?d:[d],e,i,n,"foreignObject"==y?"http://www.w3.org/1999/xhtml":s,r,o,r?r[0]:i.__k&&Sf(i,0),l,a),null!=r)for(u=r.length;u--;)yf(r[u]);l&&"textarea"!=y||(u="value","progress"==y&&null==f?t.removeAttribute("value"):null!=f&&(f!==t[u]||"progress"==y&&!f||"option"==y&&f!=g[u])&&Pf(t,u,f,g[u],s),u="checked",null!=p&&p!=t[u]&&Pf(t,u,p,g[u],s))}return t}(i.__e,e,i,n,s,r,o,a,u);return(h=Zv.diffed)&&h(e),128&e.__u?void 0:l}function Ff(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(Ff))}function Df(t,e,i){for(var n=0;i.length>n;n++)Nf(i[n],i[++n],i[++n]);Zv.__c&&Zv.__c(e,t),t.some(function(e){try{t=e.__h,e.__h=[],t.some(function(t){t.call(e)})}catch(t){Zv.__e(t,e.__v)}})}function Lf(t){return"object"!=typeof t||null==t||t.__b>0?t:gf(t)?t.map(Lf):void 0!==t.constructor?null:mf({},t)}function Nf(t,e,i){try{if("function"==typeof t){var n="function"==typeof t.__u;n&&t.__u(),n&&null==e||(t.__u=t(e))}else t.current=e}catch(t){Zv.__e(t,i)}}function qf(t,e,i){var n,s;if(Zv.unmount&&Zv.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Nf(n,null,e)),null!=(n=t.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(t){Zv.__e(t,e)}n.base=n.__P=n.__n=null}if(n=t.__k)for(s=0;n.length>s;s++)n[s]&&qf(n[s],e,i||"function"!=typeof t.type);i||yf(t.__e),t.__c=t.__=t.__e=void 0}function Bf(t,e,i){return this.constructor(t,i)}function jf(t,e,i){var n,s,r,o;e==document&&(e=document.documentElement),Zv.__&&Zv.__(t,e),s=(n="function"==typeof i)?null:i&&i.__k||e.__k,r=[],o=[],Af(e,t=(!n&&i||e).__k=_f(wf,null,[t]),s||vf,vf,e.namespaceURI,!n&&i?[i]:s?null:e.firstChild?Gv.call(e.childNodes):null,r,!n&&i?i:s?s.__e:e.firstChild,n,o),Df(r,t,o),t.props.children=null}Gv=ff.slice,Zv={__e(t,e,i,n){for(var s,r,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((r=s.constructor)&&null!=r.getDerivedStateFromError&&(s.setState(r.getDerivedStateFromError(t)),o=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(t,n||{}),o=s.__d),o)return s.__E=s}catch(e){t=e}throw t}},Qv=0,kf.prototype.setState=function(t,e){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=mf({},this.state);"function"==typeof t&&(t=t(mf({},i),this.props)),t&&mf(i,t),null!=t&&this.__v&&(e&&this._sb.push(e),$f(this))},kf.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),$f(this))},kf.prototype.render=wf,Jv=[],Yv="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Xv=function(t,e){return t.__v.__b-e.__v.__b},Tf.__r=0,tf=Math.random().toString(8),ef="__d"+tf,nf="__a"+tf,sf=/(PointerCapture)$|Capture$/i,rf=0,of=Of(!1),lf=Of(!0),af=0;var Hf=0,Uf=[],zf=Zv,Wf=zf.__b,Vf=zf.__r,Gf=zf.diffed,Zf=zf.__c,Qf=zf.unmount,Jf=zf.__;function Kf(t,e){zf.__h&&zf.__h(hf,t,Hf||e),Hf=0;var i=hf.__H||(hf.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function Yf(t){return Hf=1,function(t,e){var i=Kf(uf++,2);if(i.t=t,!i.__c&&(i.__=[up(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=hf,!hf.__f)){var n=function(t,e,n){if(!i.__c.__H)return!0;var r=!1,o=i.__c.props!==t;if(i.__c.__H.__.some(function(t){if(t.__N){r=!0;var e=t.__[0];t.__=t.__N,t.__N=void 0,e!==t.__[0]&&(o=!0)}}),s){var l=s.call(this,t,e,n);return r?l||o:l}return!r||o};hf.__f=!0;var s=hf.shouldComponentUpdate,r=hf.componentWillUpdate;hf.componentWillUpdate=function(t,e,i){if(this.__e){var o=s;s=void 0,n(t,e,i),s=o}r&&r.call(this,t,e,i)},hf.shouldComponentUpdate=n}return i.__N||i.__}(up,t)}function Xf(t,e){var i=Kf(uf++,3);!zf.__s&&ap(i.__H,e)&&(i.__=t,i.u=e,hf.__H.__h.push(i))}function tp(t){return Hf=5,ep(function(){return{current:t}},[])}function ep(t,e){var i=Kf(uf++,7);return ap(i.__H,e)&&(i.__=t(),i.__H=e,i.__h=t),i.__}function ip(t){var e=hf.context[t.__c],i=Kf(uf++,9);return i.c=t,e?(null==i.__&&(i.__=!0,e.sub(hf)),e.props.value):t.__}function np(){for(var t;t=Uf.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(op),e.__h.some(lp),e.__h=[]}catch(i){e.__h=[],zf.__e(i,t.__v)}}}zf.__b=function(t){hf=null,Wf&&Wf(t)},zf.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Jf&&Jf(t,e)},zf.__r=function(t){Vf&&Vf(t),uf=0;var e=(hf=t.__c).__H;e&&(cf===hf?(e.__h=[],hf.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.length&&np(),uf=0)),cf=hf},zf.diffed=function(t){Gf&&Gf(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==Uf.push(e)&&df===zf.requestAnimationFrame||((df=zf.requestAnimationFrame)||rp)(np)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),cf=hf=null},zf.__c=function(t,e){e.some(function(t){try{t.__h.some(op),t.__h=t.__h.filter(function(t){return!t.__||lp(t)})}catch(i){e.some(function(t){t.__h&&(t.__h=[])}),e=[],zf.__e(i,t.__v)}}),Zf&&Zf(t,e)},zf.unmount=function(t){Qf&&Qf(t);var e,i=t.__c;i&&i.__H&&(i.__H.__.some(function(t){try{op(t)}catch(t){e=t}}),i.__H=void 0,e&&zf.__e(e,i.__v))};var sp="function"==typeof requestAnimationFrame;function rp(t){var e,i=function(){clearTimeout(n),sp&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(i,35);sp&&(e=requestAnimationFrame(i))}function op(t){var e=hf,i=t.__c;"function"==typeof i&&(t.__c=void 0,i()),hf=e}function lp(t){var e=hf;t.__c=t.__(),hf=e}function ap(t,e){return!t||t.length!==e.length||e.some(function(e,i){return e!==t[i]})}function up(t,e){return"function"==typeof e?e(t):e}const hp={GZipJS:"gzip-js",Base64:"base64"},cp={Activation:"events",Cancellation:"cancelEvents"},dp={Button:"button",Tab:"tab",Selector:"selector"},vp={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},fp={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},pp={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},gp={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},mp={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},yp={Once:"once",Recurring:"recurring",Always:"always"},_p={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},bp={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},wp={Popover:"popover",Inline:"inline"};function kp(t){let e=!0;return{dispose(){if(e){e=!1;const i=t();i&&xe(i.then)&&i.then(void 0,()=>{})}}}}const Sp=Gs("[Surveys]"),xp="PostHog is not capturing, so a survey response cannot be recorded";function Cp(t){return xe(t.is_capturing)?t.is_capturing():!t.has_opted_out_capturing()}function $p(t){return!(!t.start_date||t.end_date)}function Tp(t){var e;return!!(null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)}const Ep=(t,e)=>`${t}${function(t){return t.current_iteration&&t.current_iteration>0?`${t.id}_${t.current_iteration}`:t.id}(e)}`,Ip=t=>Ep("seenSurvey_",t),Mp=t=>{try{const e=Ip(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){Sp.error("Failed to persist survey seen state",t)}},Rp=[pp.Popover,pp.Widget,pp.API],Pp={ignoreConditions:!1,ignoreDelay:!1,displayType:wp.Popover},Op="logs",Ap=Gs("[Stylesheet Loader]"),Fp=t,Dp=n,Lp="#020617",Np={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:vp.Right,widgetType:dp.Tab,widgetLabel:"Feedback",widgetColor:"black",zIndex:String(2147483645),disabledButtonOpacity:"0.6",maxWidth:"300px",textSubtleColor:"#939393",boxPadding:"20px 24px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"10px",shuffleQuestions:!1,surveyPopupDelaySeconds:void 0,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:Lp,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},qp=[vp.Center,vp.Left,vp.Right];function Bp(t){if(t.startsWith("#")){let e=t.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(e)&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),/^[0-9A-Fa-f]{6}$/.test(e)?`rgb(${parseInt(e.slice(0,2),16)},${parseInt(e.slice(2,4),16)},${parseInt(e.slice(4,6),16)})`:"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function jp(t=Np.backgroundColor){let e;"#"===t[0]&&(e=Bp(t)),t.startsWith("rgb")&&(e=t);const i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[t.toLowerCase()];if(i&&(e=Bp(i)),!e)return Lp;const n=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(n){const t=parseInt(n[1]),e=parseInt(n[2]),i=parseInt(n[3]);return Math.sqrt(t*t*.299+e*e*.587+i*i*.114)>127.5?Lp:"white"}return Lp}const Hp=(t,e,i)=>{const n=lg(t),s=Dp.querySelector(`.${n}`);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};const r=Dp.createElement("div");((t,e,i)=>{const n=ue(ue({},Np),i),s=t.style,r=!qp.includes(n.position)||e===pp.Widget&&(null==i?void 0:i.widgetType)===dp.Tab;s.setProperty("--ph-survey-font-family",function(t){if("inherit"===t)return"inherit";const e='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return t?`${t}, ${e}`:`-apple-system, ${e}`}(n.fontFamily)),s.setProperty("--ph-survey-box-padding",n.boxPadding),s.setProperty("--ph-survey-max-width",n.maxWidth),s.setProperty("--ph-survey-z-index",n.zIndex),s.setProperty("--ph-survey-border-color",n.borderColor),r?(s.setProperty("--ph-survey-border-radius",n.borderRadius),s.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(s.setProperty("--ph-survey-border-bottom","none"),s.setProperty("--ph-survey-border-radius",`${n.borderRadius} ${n.borderRadius} 0 0`)),s.setProperty("--ph-survey-background-color",n.backgroundColor),s.setProperty("--ph-survey-box-shadow",n.boxShadow),s.setProperty("--ph-survey-disabled-button-opacity",n.disabledButtonOpacity),s.setProperty("--ph-survey-submit-button-color",n.submitButtonColor),s.setProperty("--ph-survey-submit-button-text-color",(null==i?void 0:i.submitButtonTextColor)||jp(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",jp(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||jp(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",jp(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 l=o||n.inputBackground;o||"white"!==n.backgroundColor||(l="#f8f8f8"),s.setProperty("--ph-survey-input-background",l);const a=(null==i?void 0:i.inputTextColor)||jp(l);s.setProperty("--ph-survey-input-text-color",a),s.setProperty("--ph-survey-rating-text-color",a),s.setProperty("--ph-survey-scrollbar-thumb-color",n.scrollbarThumbColor),s.setProperty("--ph-survey-scrollbar-track-color",n.scrollbarTrackColor),s.setProperty("--ph-survey-outline-color",n.outlineColor)})(r,t.type,t.appearance),r.className=n;const o=r.attachShadow({mode:"open"}),l=function(t){const e=((t,e,i)=>{let n=t.createElement("style");n.innerText=e;const s=(t=>{var e;return xe(t)?t:null==t||null===(e=t.config)||void 0===e?void 0:e.prepare_external_dependency_stylesheet})(i);return s&&(n=s(n)),n||(Ap.error("prepare_external_dependency_stylesheet returned null"),null)})(Dp,':host{--ph-survey-font-family:-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--ph-survey-box-padding:20px 24px;--ph-survey-max-width:300px;--ph-survey-z-index:calc(2147480000 + 3645);--ph-survey-border-color:#dcdcdc;--ph-survey-border-bottom:1.5px solid var(--ph-survey-border-color);--ph-survey-border-radius:10px;--ph-survey-background-color:#eeeded;--ph-survey-box-shadow:0 4px 12px #00000026;--ph-survey-submit-button-color:black;--ph-survey-submit-button-text-color:white;--ph-survey-rating-bg-color:white;--ph-survey-rating-text-color:#020617;--ph-survey-rating-active-bg-color:black;--ph-survey-rating-active-text-color:white;--ph-survey-text-primary-color:#020617;--ph-survey-text-subtle-color:#939393;--ph-widget-color:#e0a045;--ph-widget-text-color:white;--ph-survey-scrollbar-thumb-color:var(--ph-survey-border-color);--ph-survey-scrollbar-track-color:var(--ph-survey-background-color);--ph-survey-outline-color:#3b82f6cc;--ph-survey-input-background:white;--ph-survey-input-text-color:#020617;--ph-survey-disabled-button-opacity:.6}.ph-survey{min-width:300px;width:var(--ph-survey-max-width);max-width:85%;z-index:var(--ph-survey-z-index);height:fit-content;margin:0;position:fixed;bottom:0}.ph-survey h3,.ph-survey p{margin:0}.ph-survey *{box-sizing:border-box;font-family:var(--ph-survey-font-family);color:var(--ph-survey-text-primary-color)}.ph-survey textarea,.ph-survey input[type=text],.ph-survey .multiple-choice-options label{color:var(--ph-survey-input-text-color);background:var(--ph-survey-input-background);border:1.5px solid var(--ph-survey-border-color);border-radius:4px;padding:10px;transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey textarea,.ph-survey input[type=text]{transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input{margin:0}.ph-survey textarea:focus,.ph-survey textarea:focus-visible,.ph-survey input[type=text]:focus,.ph-survey input[type=text]:focus-visible,.ph-survey .form-submit:focus,.ph-survey .form-submit:focus-visible,.ph-survey input[type=checkbox]:focus,.ph-survey input[type=radio]:focus,.ph-survey input[type=checkbox]:focus-visible,.ph-survey input[type=radio]:focus-visible{outline:1.5px solid var(--ph-survey-outline-color);border-color:var(--ph-survey-rating-active-bg-color);outline-offset:2px}.ph-survey textarea:focus:not(:focus-visible),.ph-survey input[type=text]:focus:not(:focus-visible),.ph-survey button:focus:not(:focus-visible),.ph-survey input[type=checkbox]:focus:not(:focus-visible),.ph-survey input[type=radio]:focus:not(:focus-visible){outline:none}.ph-survey textarea:hover:not(:focus),.ph-survey input[type=text]:hover:not(:focus){border-color:var(--ph-survey-rating-active-bg-color)}@media (max-width:768px){.ph-survey textarea,.ph-survey input[type=text]{font-size:1rem}}.ph-survey .multiple-choice-options label,.ph-survey .rating-options-number,.ph-survey .form-cancel,.ph-survey input[type=checkbox],.ph-survey input[type=radio]{border:1.5px solid var(--ph-survey-border-color)}.ph-survey label,.ph-survey input[type=checkbox],.ph-survey input[type=radio],.ph-survey .ratings-emoji,.ph-survey .ratings-number,.ph-survey .footer-branding,.ph-survey .form-cancel,.ph-survey .form-submit{transition:all .2s ease-out}@media (prefers-reduced-motion:no-preference){.ph-survey button:active,.ph-survey input[type=checkbox]:active,.ph-survey input[type=radio]:active,.ph-survey label:active{transition-duration:.1s}}.ph-survey-widget-tab{background:var(--ph-widget-color);color:var(--ph-widget-text-color);text-align:center;cursor:pointer;z-index:var(--ph-survey-z-index);border:none;border-radius:3px 3px 0 0;padding:10px 12px;transition:padding .2s ease-out;position:fixed}.ph-survey-widget-tab:hover:not(.widget-tab-top){padding-bottom:16px}.ph-survey-widget-tab.widget-tab-top{border-radius:0 0 3px 3px}.ph-survey-widget-tab.widget-tab-top:hover{padding-top:16px}@keyframes ph-survey-fade-in{0%{opacity:0}to{opacity:1}}.survey-box{flex-direction:column;gap:16px;display:flex}.bottom-section{flex-direction:column;gap:8px;display:flex}.thank-you-message-header~.bottom-section,.intro-screen-header~.bottom-section{padding-top:16px}.question-container,.thank-you-message,.intro-screen{flex-direction:column;gap:8px;display:flex}.survey-question{font-size:14px;font-weight:500}.survey-question-description{opacity:.8;padding-top:4px;font-size:13px}.survey-question-description,.thank-you-message-body,.intro-screen-body{word-wrap:break-word;overflow-wrap:break-word}:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) img,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) video,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) iframe,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) embed,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) object,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) svg{max-width:100%;height:auto}.question-textarea-wrapper{flex-direction:column;display:flex}.survey-form{animation:.3s ease-out forwards ph-survey-fade-in}.survey-form,.thank-you-message,.intro-screen{text-align:left;width:100%;z-index:var(--ph-survey-z-index);border:1.5px solid var(--ph-survey-border-color);border-bottom:var(--ph-survey-border-bottom);background:var(--ph-survey-background-color);border-radius:var(--ph-survey-border-radius);box-shadow:var(--ph-survey-box-shadow);padding:var(--ph-survey-box-padding);margin:0;position:relative}.survey-form textarea,.survey-form input[type=text]{min-width:100%}.survey-form textarea:focus,.survey-form textarea:focus-visible{box-shadow:0 4px 12px #00000014}.survey-form textarea:focus:not(:focus-visible){box-shadow:none}.survey-box .question-header--empty~.multiple-choice-options,.survey-box .question-header--empty~textarea{margin-top:0}.multiple-choice-options{border:none;flex-direction:column;gap:8px;margin:0;padding:1px 0;font-size:14px;display:flex}.multiple-choice-options label,.multiple-choice-options .response-choice{color:inherit;align-items:center;gap:8px;display:flex}.multiple-choice-options label{cursor:pointer;font-size:13px}.multiple-choice-options label:hover:not(:has(input:checked)){border-color:var(--ph-survey-text-subtle-color);box-shadow:0 2px 8px #00000014}.multiple-choice-options label:has(input:checked){border-color:var(--ph-survey-rating-active-bg-color);box-shadow:0 1px 4px #0000000d}.multiple-choice-options label.choice-option-open{flex-wrap:wrap}.multiple-choice-options label span{color:inherit}.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ph-survey-input-background);cursor:pointer;z-index:1;border-radius:3px;flex-shrink:0;width:1rem;height:1rem;transition:all .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out;position:relative}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):focus{transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):hover{border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):active{transform:scale(.95)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked{background:var(--ph-survey-rating-active-bg-color);border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked:hover{transform:scale(1.05)}.multiple-choice-options input[type=checkbox]:checked:after{border:solid var(--ph-survey-rating-active-text-color);border-width:0 2px 2px 0;width:4px;height:8px;animation:.2s ease-out .1s forwards ph-survey-checkmark-reveal;left:4px;transform:rotate(45deg)scale(0)}.multiple-choice-options input[type=radio]:checked:after{background:var(--ph-survey-rating-active-text-color);border-radius:50%;width:6px;height:6px;animation:.15s ease-out 50ms forwards ph-survey-radio-reveal;top:5px;left:5px;transform:scale(0)}.multiple-choice-options input[type=checkbox]:checked:after,.multiple-choice-options input[type=radio]:checked:after{content:"";box-sizing:content-box;position:absolute}.multiple-choice-options input[type=radio]{border-radius:50%}.multiple-choice-options input[type=radio]:checked{border:none}:is(.multiple-choice-options input[type=checkbox]:checked,.multiple-choice-options input[type=radio]:checked)~*{font-weight:700}.multiple-choice-options .choice-option-open input[type=text]::placeholder{color:var(--ph-survey-text-subtle-color);font-weight:400}.rating-options-emoji{justify-content:space-between;display:flex}.rating-options-emoji-2{justify-content:space-around}.ratings-emoji{opacity:.5;background-color:#0000;border:none;padding:0;font-size:16px}.ratings-emoji:hover{cursor:pointer;opacity:1;transform:scale(1.15)}.ratings-emoji.rating-active{opacity:1}.ratings-emoji svg{fill:var(--ph-survey-text-primary-color);transition:fill .2s ease-out}.rating-options-number{border-radius:6px;grid-auto-columns:1fr;grid-auto-flow:column;display:grid;overflow:hidden}.rating-options-number .ratings-number{border-right:1px solid var(--ph-survey-border-color);text-align:center;cursor:pointer;color:var(--ph-survey-rating-text-color);border-top:none;border-bottom:none;border-left:none;font-weight:700}.rating-options-number .ratings-number:last-of-type{border-right:0}.rating-options-number .ratings-number.rating-active{background:var(--ph-survey-rating-active-bg-color);color:var(--ph-survey-rating-active-text-color)}.ratings-number{background-color:var(--ph-survey-rating-bg-color);border:none;padding:8px 0}.ratings-number .rating-active{background-color:var(--ph-survey-rating-active-bg-color)}.ratings-number{cursor:pointer}@media (hover:hover) and (pointer:fine){.ratings-number:hover:not(.rating-active){background-color:color-mix(in srgb, var(--ph-survey-rating-active-bg-color) 14%, var(--ph-survey-rating-bg-color))}}.rating-text{opacity:.7;flex-direction:row;justify-content:space-between;font-size:11px;display:flex}.form-buttons{flex-direction:row;gap:8px;width:100%;display:flex}.form-buttons-with-back>.form-submit{flex:auto;min-width:0}.form-submit{text-align:center;cursor:pointer;user-select:none;background:var(--ph-survey-submit-button-color);color:var(--ph-survey-submit-button-text-color);border:none;border-radius:6px;min-width:100%;padding:12px;font-weight:700;box-shadow:0 2px #0000000b}.form-submit:not([disabled]):hover{transform:scale(1.02);box-shadow:0 4px 8px #0000001a}.form-submit:not([disabled]):active{transform:scale(.98);box-shadow:0 1px 2px #0000000d}.form-submit[disabled]{opacity:var(--ph-survey-disabled-button-opacity);cursor:not-allowed}.form-back{text-align:center;cursor:pointer;user-select:none;color:var(--ph-survey-text-primary-color);border:1.5px solid var(--ph-survey-border-color);background:0 0;border-radius:6px;flex:none;padding:12px 16px;font-weight:600}.form-back:hover{transform:scale(1.02)}.form-back:active{transform:scale(.98)}.validation-hint{opacity:.7;margin-top:4px;font-size:12px}.form-cancel{cursor:pointer;background:#fff;border-radius:100%;padding:12px;line-height:0;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.form-cancel:hover{opacity:.7;transform:translate(50%,-50%)scale(1.1)}.footer-branding{opacity:.6;justify-content:center;align-items:center;gap:4px;font-size:11px;font-weight:500;text-decoration:none;display:flex}.footer-branding:hover{opacity:1}.footer-branding a{text-decoration:none}.thank-you-message{text-align:center}.thank-you-message-header{margin:10px 0 0}.thank-you-message-body{opacity:.8;font-size:14px}.intro-screen{text-align:center;animation:.3s ease-out forwards ph-survey-fade-in}.intro-screen-header{margin:10px 0 0}.intro-screen-body{opacity:.8;font-size:14px}.limit-height{scrollbar-width:thin;scrollbar-color:var(--ph-survey-scrollbar-thumb-color) var(--ph-survey-scrollbar-track-color);max-height:256px;overflow:hidden auto}.limit-height::-webkit-scrollbar{width:8px}.limit-height::-webkit-scrollbar-track{background:var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb{background-color:var(--ph-survey-scrollbar-thumb-color);border:2px solid var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb:hover{background-color:var(--ph-survey-text-subtle-color)}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.ph-survey *{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@keyframes ph-survey-checkmark-reveal{0%{opacity:0;transform:rotate(45deg)scale(0)}50%{opacity:1;transform:rotate(45deg)scale(1.2)}to{opacity:1;transform:rotate(45deg)scale(1)}}@keyframes ph-survey-radio-reveal{0%{opacity:0;transform:scale(0)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}',t);return null==e||e.setAttribute("data-ph-survey-style","true"),e}(e);if(l){const t=o.querySelector("style");t&&o.removeChild(t),o.appendChild(l)}return(i||Dp.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},Up=({responses:t,survey:e,surveySubmissionId:i,posthog:n,isSurveyCompleted:s,properties:r,surveyLanguage:o,questionSnapshots:l})=>{var a;n?Cp(n)&&(Mp(e),n.capture(_p.SENT,ue(ue(ue(ue({[bp.SURVEY_NAME]:e.name,[bp.SURVEY_ID]:e.id,[bp.SURVEY_ITERATION]:e.current_iteration,[bp.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,[bp.SURVEY_SUBMISSION_ID]:i,[bp.SURVEY_COMPLETED]:s},o&&{[bp.SURVEY_LANGUAGE]:o}),{},{sessionRecordingUrl:null===(a=n.get_session_replay_url)||void 0===a?void 0:a.call(n)},na(t,e,l)),r),{},{$set:{[ra(e,"responded")]:!0}})),s&&(Fp.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:e.id}})),og(e),n.reloadFeatureFlags())):Sp.error("[survey sent] event not captured, PostHog instance not found.")},zp=(t,e,i)=>{var n;return ue(ue({[bp.SURVEY_NAME]:t.name,[bp.SURVEY_ID]:t.id,[bp.SURVEY_ITERATION]:t.current_iteration,[bp.SURVEY_ITERATION_START_DATE]:t.current_iteration_start_date,[bp.SURVEY_PARTIALLY_COMPLETED]:sa(null==e?void 0:e.responses)},(null==e?void 0:e.surveyLanguage)&&{[bp.SURVEY_LANGUAGE]:e.surveyLanguage}),{},{sessionRecordingUrl:null===(n=i.get_session_replay_url)||void 0===n?void 0:n.call(i),[bp.SURVEY_SUBMISSION_ID]:null==e?void 0:e.surveySubmissionId},na(null==e?void 0:e.responses,t,null==e?void 0:e.questionSnapshots))},Wp=(t,e,i,n)=>{if(!e)return void Sp.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const s=sg(t),r=s?s.surveyLanguage:n;e.capture(_p.DISMISSED,ue(ue(ue({},zp(t,s,e)),r&&{[bp.SURVEY_LANGUAGE]:r}),{},{$set:{[ra(t,"dismissed")]:!0}})),og(t),Mp(t),Fp.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:t.id}}))},Vp=(t,e)=>{if(!e)return void Sp.error("[survey abandoned] event not captured, PostHog instance not found.");const i=(t=>Ep("abandonedSurvey_",t))(t);try{if("true"===localStorage.getItem(i))return}catch(t){return}const n=sg(t);if(n){try{localStorage.setItem(i,"true")}catch(t){}e.capture(_p.ABANDONED,zp(t,n,e),{transport:"sendBeacon"})}},Gp=t=>t.map(t=>({sort:Math.floor(10*Math.random()),value:t})).sort((t,e)=>t.sort-e.sort).map(t=>t.value),Zp=(t,e)=>t.length===e.length&&t.every((t,i)=>t===e[i])?e.reverse():e,Qp=t=>{const e=t.map(t=>t.id);return e.every(t=>!!t)?e:void 0},Jp=(t,e)=>{return(t=>t.questions.some(t=>{var e;return!!(null===(e=t.branching)||void 0===e?void 0:e.type)}))(t)?t.questions:e?null!==(i=((t,e)=>{if(!e||e.length!==t.questions.length)return null;const i=new Map(t.questions.map(t=>[t.id,t])),n=[];for(const t of e){const e=i.get(t);if(!e)return null;n.push(e)}return n})(t,e.questionOrder))&&void 0!==i?i:t.questions:t.appearance&&t.appearance.shuffleQuestions&&!t.enable_partial_responses?Zp(t.questions,Gp(t.questions)):t.questions;var i},Kp=t=>da(t)||rg(t),Yp=function(t){function e(t){var i,n;return this.getChildContext||(i=new Set,(n={})[e.__c]=this,this.getChildContext=function(){return n},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(t){this.props.value!=t.value&&i.forEach(function(t){t.__e=!0,$f(t)})},this.sub=function(t){i.add(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){i&&i.delete(t),e&&e.call(t)}}),t.children}return e.__c="__cC"+af++,e.__=t,e.Provider=e.__l=(e.Consumer=function(t,e){return t.children(e)}).contextType=e,e}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),Xp=()=>ip(Yp),tg=({component:t,children:e,renderAsHtml:i,style:n})=>function(t,e,i){var n,s,r,o,l=mf({},t.props);for(r in t.type&&t.type.defaultProps&&(o=t.type.defaultProps),e)"key"==r?n=e[r]:"ref"==r?s=e[r]:l[r]=void 0===e[r]&&null!=o?o[r]:e[r];return arguments.length>2&&(l.children=arguments.length>3?Gv.call(arguments,2):i),bf(t.type,l,n||t.key,s||t.ref,null)}(t,i?{dangerouslySetInnerHTML:{__html:e},style:n}:{children:e,style:n});function eg(t,e){var i,n;if(!(null===(i=t.conditions)||void 0===i?void 0:i.url))return!0;const s=pr(e);if(!s)return!1;const r=[t.conditions.url],o=function(t){return null!=t?t:"icontains"}(null===(n=t.conditions)||void 0===n?void 0:n.urlMatchType);return pa[o](r,[s])}const ig=t=>Ep("inProgressSurvey_",t),ng=(t,e)=>{try{localStorage.setItem(ig(t),JSON.stringify(e))}catch(t){Sp.error("Error setting in-progress survey state in localStorage",t)}},sg=t=>{try{const e=localStorage.getItem(ig(t));if(e)return JSON.parse(e)}catch(t){Sp.error("Error getting in-progress survey state from localStorage",t)}return null},rg=t=>{const e=sg(t);return!Re(null==e?void 0:e.surveySubmissionId)},og=t=>{try{localStorage.removeItem(ig(t))}catch(t){Sp.error("Error clearing in-progress survey state from localStorage",t)}};function lg(t,e=!1){const i=`PostHogSurvey-${t.id}`;return e?`.${i}`:i}function ag(t,e=vp.Right,i){if(t===pp.ExternalSurvey)return{};switch(e){case vp.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case vp.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case vp.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case vp.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case vp.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case vp.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case vp.Left:return{left:"30px"};case vp.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:t===pp.Widget&&i===dp.Tab?"60px":"30px"}}}var ug=0;function hg(t,e,i,n,s,r){e||(e={});var o,l,a=e;if("ref"in a)for(l in a={},e)"ref"==l?o=e[l]:a[l]=e[l];var u={type:t,props:a,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ug,__i:-1,__u:0,__source:s,__self:r};if("function"==typeof t&&(o=t.defaultProps))for(l in o)void 0===a[l]&&(a[l]=o[l]);return Zv.vnode&&Zv.vnode(u),u}const cg=hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:hg("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"})}),dg=hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:hg("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"})}),vg=hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:hg("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"})}),fg=hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:hg("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"})}),pg=hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:hg("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"})}),gg=hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:hg("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"})}),mg=hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:hg("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"})}),yg=({fill:t="currentColor"}={})=>hg("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:t,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[hg("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),hg("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:t})]}),_g=hg("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[hg("g",{"clip-path":"url(#clip0_2415_6911)",children:[hg("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:hg("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),hg("g",{mask:"url(#mask0_2415_6911)",children:[hg("path",{d:"M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z",fill:"#1D4AFF"}),hg("path",{d:"M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z",fill:"#F9BD2B"}),hg("path",{d:"M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z",fill:"currentColor"}),hg("path",{d:"M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z",fill:"#1D4AFF"}),hg("path",{d:"M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z",fill:"#F54E00"}),hg("path",{d:"M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z",fill:"currentColor"})]})]}),hg("defs",{children:hg("clipPath",{id:"clip0_2415_6911",children:hg("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function bg({urlParams:t}){const e=t?Object.entries(t).map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"):"";return hg("a",{href:"https://posthog.com/surveys"+(e?`?${e}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",_g]})}function wg({text:e,submitDisabled:i,appearance:n,onSubmit:s,link:r,onPreviewSubmit:o,skipSubmitButton:l,canGoBack:a,onBack:u}){const{isPreviewMode:h}=ip(Yp),c=!!a&&!!u,d=!l&&hg("button",{className:"form-submit",disabled:i,"aria-label":"Submit survey",type:"button",onClick(){r&&(null==t||t.open(r)),h?null==o||o():s()},children:e});return hg("div",{className:"bottom-section",children:[c?hg("div",{className:"form-buttons form-buttons-with-back",children:[hg("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:u,children:n.backButtonText||"Back"}),d]}):d,!n.whiteLabel&&hg(bg,{urlParams:{utm_source:"survey-footer"}})]})}function kg({question:t,forceDisableHtml:e,htmlFor:i}){return hg("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[hg(t.type===gp.Open?"label":"h3",{className:"survey-question",htmlFor:i,children:t.question}),t.description&&tg({component:_f("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!e&&"text"!==t.descriptionContentType})]})}function Sg({onClick:t}){const{isPreviewMode:e}=ip(Yp);return hg("button",{className:"form-cancel",onClick:t,disabled:e,"aria-label":"Close survey",type:"button",children:yg({fill:"black"})})}const xg=t;function Cg({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onClose:r}){const{isPopup:o}=ip(Yp);return Xf(()=>{const t=t=>{"Enter"!==t.key&&"Escape"!==t.key||(t.preventDefault(),r())};return nr(xg,"keydown",t),()=>{xg.removeEventListener("keydown",t)}},[r]),hg("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&hg(Sg,{onClick:()=>r()}),hg("h3",{className:"thank-you-message-header",children:t}),e&&tg({component:_f("p",{className:"thank-you-message-body"}),children:e,renderAsHtml:!n&&"text"!==i}),o&&hg(wg,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>r()})]})}function $g({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onStart:r}){const{isPopup:o,onPreviewSubmit:l,onPopupSurveyDismissed:a}=ip(Yp);return hg("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&hg(Sg,{onClick:()=>a()}),t&&hg("h3",{className:"intro-screen-header",children:t}),e&&tg({component:_f("p",{className:"intro-screen-body"}),children:e,renderAsHtml:!n&&"text"!==i}),hg(wg,{text:s.introScreenButtonText||"Get started",submitDisabled:!1,appearance:s,onSubmit:r,onPreviewSubmit:()=>l(null)})]})}const Tg=t=>Se(t)&&t.every(t=>Ee(t));function Eg({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,displayQuestionIndex:r,initialValue:o,canGoBack:l,onBack:a}){const{isPreviewMode:u}=Xp(),h=tp(null),[c,d]=Yf(()=>Ee(o)?o:""),v=null==i?void 0:i.disableAutofocus;Xf(()=>{v||setTimeout(()=>{var t;u||null===(t=h.current)||void 0===t||t.focus()},100)},[u,v]);const f=`surveyQuestion${r}`,p=ep(()=>function(t,e,i){const n=t.trim();if(!i&&""===n)return"This field is required";if(""===n)return!1;if(e&&e.length>0)for(const t of e)switch(t.type){case de:var s;if(void 0!==t.value&&t.value>n.length)return null!==(s=t.errorMessage)&&void 0!==s?s:`Please enter at least ${t.value} characters`;break;case ve:var r;if(void 0!==t.value&&n.length>t.value)return null!==(r=t.errorMessage)&&void 0!==r?r:`Please enter no more than ${t.value} characters`}return!1}(c,t.validation,t.optional),[c,t.validation,t.optional]),g=Hs(t.validation,de),m=Hs(t.validation,ve),y=ep(()=>function(t,e){const i=1===t?void 0:t;return i&&e?`Enter ${i}-${e} characters`:i?`Enter at least ${i} ${1===i?"character":"characters"}`:e?`Maximum ${e} ${1===e?"character":"characters"}`:void 0}(g,m),[g,m]),_=()=>{p||n(c.trim())},b=()=>{p||s(c.trim())};return hg(wf,{children:[hg("div",{className:"question-container",children:[hg(kg,{question:t,forceDisableHtml:e,htmlFor:f}),hg("textarea",{ref:h,id:f,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:g,maxLength:m,onInput(t){d(t.currentTarget.value),t.stopPropagation()},onKeyDown(t){t.stopPropagation(),"Enter"!==t.key||!t.metaKey&&!t.ctrlKey||p||(t.preventDefault(),u?b():_())},value:c}),y&&hg("div",{className:"validation-hint",children:y})]}),hg(wg,{text:t.buttonText||"Submit",submitDisabled:!!p,appearance:i,onSubmit:_,onPreviewSubmit:b,canGoBack:l,onBack:a})]})}function Ig({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,canGoBack:r,onBack:o}){return hg(wf,{children:[hg("div",{className:"question-container",children:hg(kg,{question:t,forceDisableHtml:e})}),hg(wg,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:()=>n("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:r,onBack:o})]})}function Mg({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:l,onBack:a}){var u;const h=t.scale,c=10===t.scale?0:1,[d,v]=Yf(()=>Pe(o)?o:Se(o)&&o.length>0&&Pe(parseInt(o[0]))?parseInt(o[0]):Ee(o)&&Pe(parseInt(o))?parseInt(o):null),f="emoji"===t.display&&2===t.scale,{isPreviewMode:p}=Xp(),g=t=>p?r(t):s(t);return hg(wf,{children:[hg("div",{className:"question-container",children:[hg(kg,{question:t,forceDisableHtml:e}),hg("div",{className:"rating-section",children:[hg("div",{className:"rating-options",children:["emoji"===t.display&&hg("div",{className:"rating-options-emoji"+(f?" rating-options-emoji-2":""),children:null===(u=Dg[t.scale])||void 0===u?void 0:u.map((e,n)=>hg("button",{"aria-label":`Rate ${n+1}`,className:`ratings-emoji question-${i}-rating-${n} ${n+1===d?"rating-active":""}`,value:n+1,type:"button",onClick(){const e=n+1;v(e),t.skipSubmitButton&&g(e)},children:e},n))}),"number"===t.display&&hg("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${h-c+1}, minmax(0, 1fr))`},children:Lg(t.scale).map((e,s)=>hg(Rg,{displayQuestionIndex:i,active:d===e,appearance:n,num:e,setActiveNumber(e){v(e),t.skipSubmitButton&&g(e)}},s))})]}),!f&&hg("div",{className:"rating-text",children:[hg("div",{children:t.lowerBoundLabel}),hg("div",{children:t.upperBoundLabel})]})]})]}),hg(wg,{text:t.buttonText||(null==n?void 0:n.submitButtonText)||"Submit",submitDisabled:Me(d)&&!t.optional,appearance:n,onSubmit:()=>s(d),onPreviewSubmit:()=>r(d),skipSubmitButton:t.skipSubmitButton,canGoBack:l,onBack:a})]})}function Rg({num:t,active:e,displayQuestionIndex:i,setActiveNumber:n}){return hg("button",{"aria-label":`Rate ${t}`,className:`ratings-number question-${i}-rating-${t} ${e?"rating-active":""}`,type:"button",onClick(){n(t)},children:t})}function Pg({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:l,onBack:a}){const u=tp(null),h=ep(()=>(t=>{if(!t.shuffleOptions)return t.choices;const e=t.choices;let i="";t.hasOpenChoice&&(i=e.pop());const n=Zp(e,Gp(e));return t.hasOpenChoice&&(t.choices.push(i),n.push(i)),n})(t),[t]),[c,d]=Yf(()=>((t,e)=>Ee(t)||Tg(t)?t:e===gp.SingleChoice?null:[])(o,t.type)),[v,f]=Yf(()=>((t,e)=>{if(Ee(t)&&!e.includes(t))return{isSelected:!0,inputValue:t};if(Tg(t)){const i=t.find(t=>!e.includes(t));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,h)),{isPreviewMode:p}=Xp(),g=t.type===gp.SingleChoice,m=t.type===gp.MultipleChoice,y=t.skipSubmitButton&&g&&!t.hasOpenChoice,_=(t,e)=>{if(e){const t=!v.isSelected;return f(e=>ue(ue({},e),{},{isSelected:t,inputValue:t?e.inputValue:""})),g&&d(""),void(t&&setTimeout(()=>{var t;return null===(t=u.current)||void 0===t?void 0:t.focus()},75))}if(g)return d(t),f(t=>ue(ue({},t),{},{isSelected:!1,inputValue:""})),void(y&&(s(t),p&&r(t)));m&&Se(c)&&(c.includes(t)?d(c.filter(e=>e!==t)):d([...c,t]))},b=t=>{t.stopPropagation();const e=t.currentTarget.value;f(t=>ue(ue({},t),{},{inputValue:e})),g&&d(e)},w=t=>{t.stopPropagation(),"Enter"!==t.key||k()||(t.preventDefault(),S()),"Escape"===t.key&&(t.preventDefault(),f(t=>ue(ue({},t),{},{isSelected:!1,inputValue:""})),g&&d(null))},k=()=>!(t.optional||!Me(c)&&(!Se(c)||v.isSelected||0!==c.length)&&(!v.isSelected||""!==v.inputValue.trim())),S=()=>{v.isSelected&&m?Se(c)&&(p?r([...c,v.inputValue]):s([...c,v.inputValue])):p?r(c):s(c)};return hg(wf,{children:[hg("div",{className:"question-container",children:[hg(kg,{question:t,forceDisableHtml:e}),hg("fieldset",{className:"multiple-choice-options limit-height",children:[hg("legend",{className:"sr-only",children:m?" Select all that apply":" Select one"}),h.map((e,n)=>{const s=!!t.hasOpenChoice&&n===t.choices.length-1,r=`surveyQuestion${i}Choice${n}`,o=`${r}Open`,l=s?v.isSelected:g?c===e:Se(c)&&c.includes(e);return hg("label",{className:s?"choice-option-open":"",children:[hg("div",{className:"response-choice",children:[hg("input",{type:g?"radio":"checkbox",name:r,checked:l,onChange:()=>_(e,s),id:r,"aria-controls":o}),hg("span",{children:s?`${e}:`:e})]}),s&&hg("input",{type:"text",ref:u,id:o,name:`question${i}Open`,value:v.inputValue,onKeyDown:w,onInput:b,onClick(t){v.isSelected||_(e,!0),t.stopPropagation()},"aria-label":`${e} - please specify`})]},n)})]})]}),hg(wg,{text:t.buttonText||"Submit",submitDisabled:k(),appearance:n,onSubmit:S,onPreviewSubmit:S,skipSubmitButton:y,canGoBack:l,onBack:a})]})}const Og=[1,2,3,4,5],Ag=[1,2,3,4,5,6,7],Fg=[0,1,2,3,4,5,6,7,8,9,10],Dg={2:[gg,mg],3:[vg,dg,cg],5:[fg,vg,dg,cg,pg]};function Lg(t){switch(t){case 5:default:return Og;case 7:return Ag;case 10:return Fg}}const Ng=Gs("[Surveys]");function qg(t,e,i){var n;const s=t.questions[e],r=e+1;if(!(null===(n=s.branching)||void 0===n?void 0:n.type))return e===t.questions.length-1?mp.End:r;if(s.branching.type===mp.End)return mp.End;if(s.branching.type===mp.SpecificQuestion){if(Number.isInteger(s.branching.index))return s.branching.index}else if(s.branching.type===mp.ResponseBased){if(s.type===gp.SingleChoice){var o;let t=s.choices.indexOf(`${i}`);if(-1===t&&s.hasOpenChoice&&(t=s.choices.length-1),null===(o=s.branching)||void 0===o||null===(o=o.responseValues)||void 0===o?void 0:o.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===mp.End?mp.End:r}}else if(s.type===gp.Rating){var l;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const t=function(t,e){if(2===e){if(1>t||t>2)throw new Error("The response must be in range 1-2");return 1===t?"positive":"negative"}if(3===e){if(1>t||t>3)throw new Error("The response must be in range 1-3");return 1===t?"negative":2===t?"neutral":"positive"}if(5===e){if(1>t||t>5)throw new Error("The response must be in range 1-5");return t>2?3===t?"neutral":"positive":"negative"}if(7===e){if(1>t||t>7)throw new Error("The response must be in range 1-7");return t>3?4===t?"neutral":"positive":"negative"}if(10===e){if(0>t||t>10)throw new Error("The response must be in range 0-10");return t>6?t>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(i,s.scale);if(null===(l=s.branching)||void 0===l||null===(l=l.responseValues)||void 0===l?void 0:l.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===mp.End?mp.End:r}}return r}return Ng.warn("Falling back to next question index due to unexpected branching type"),r}const Bg=Gs("[SurveyTranslations]");function jg(t,e){const i=function(t){return function({overrideLanguage:t,storedPersonProperties:e,locale:i},n){const s=oa(t);if(s)return null==n||n.info(`Using override display language: ${s}`),s;const r=function(t){return t&&"object"==typeof t&&"language"in t?oa(t.language):null}(e);if(r)return null==n||n.info(`Using person property language: ${r}`),r;const o=oa(i);return o?(null==n||n.info(`Using detected locale: ${o}`),o):(null==n||n.info("No user language detected"),null)}({overrideLanguage:t.config.override_display_language,storedPersonProperties:xe(t.get_property)?t.get_property(lt):void 0,locale:Pa()},Bg)}(e);if(!i)return Bg.info("No user language detected"),{survey:t,language:null};const n=ha(t,i,Bg);return{survey:n.survey,language:n.matchedKey}}const Hg=t,Ug=n,zg="ph:show_survey_widget",Wg="PHWidgetSurveyClickListener";function Vg(t,e){try{const i=t.getBoundingClientRect(),n=Hg.innerHeight,s=Hg.innerWidth;let r=i.left+i.width/2-e/2;r+e>s-20&&(r=s-e-20),20>r&&(r=20);const o=n-i.bottom,l=250>o&&i.top>o;return{position:"fixed",top:l?"auto":`${i.bottom+12}px`,left:`${r}px`,right:"auto",bottom:l?n-i.top+12+"px":"auto",zIndex:Np.zIndex}}catch(t){return Sp.warn("Failed to calculate trigger position:",t),null}}var Gg=class{constructor(t){this.wi=new Map,this.ki=new Map,this.Si=new Map,this.xi=new Map,this.Ci=new Set,this.Mi=null,this.Ii=!1,this.Ti=null,this.Ri=null,this.$i=null,this.Ei=!1,this.handlePageUnload=()=>{const t=this._posthog.get_property(ht);if(t)for(const e of t)rg(e)&&Vp(e,this._posthog)},this.handlePopoverSurvey=(t,e,{resumeDelayFromActivation:i=!1}={})=>{var n,s,r,o,l,a;if(!Cp(this._posthog))return;const{survey:u,language:h}=this.Ai(t);this.Mi=h,this.$i=null,this.Oi=e;const c=this.Li(u,e);this.Pi(c.id);const{properties:d,initialResponses:v}=null!=e?e:{},f=!(!v||0>=Object.keys(v).length)&&this.Di(c,v,d,h);if(f&&!(null===(n=c.appearance)||void 0===n?void 0:n.displayThankYouMessage))return;this.Fi(c);let p={};if((null===(s=c.appearance)||void 0===s?void 0:s.position)===vp.NextToTrigger&&(null===(r=c.appearance)||void 0===r?void 0:r.widgetSelector)){const t=Ug.querySelector(c.appearance.widgetSelector);var g;t&&(p=Vg(t,parseInt((null===(g=c.appearance)||void 0===g?void 0:g.maxWidth)||Np.maxWidth))||{})}const m=(null===(o=c.appearance)||void 0===o?void 0:o.surveyPopupDelaySeconds)||0,{shadow:y}=Hp(c,this._posthog);this.xi.set(y,y.host);const _={posthog:this._posthog,survey:c,removeSurveyFromFocus:this.Ni,properties:d,style:p,isSurveyCompleted:f,skipShownEvent:null==e?void 0:e.skipShownEvent,surveyLanguage:h};if(this.$i=_,0>=m)return this.Ii=!0,jf(hg(Yg,ue({},_)),y);const b=()=>{this.Ii=!0;const{survey:i,language:n}=this.Ai(t);this.Mi=n;const s=this.Li(i,e),r=ue(ue({},_),{},{survey:s,surveyLanguage:n});this.$i=r,jf(hg(Yg,ue(ue({},r),{},{survey:ue(ue({},s),{},{appearance:ue(ue({},s.appearance),{},{surveyPopupDelaySeconds:0})})})),y)},w=()=>{if(!Cp(this._posthog)||!this.qi(c))return Sp.info(`Survey ${c.id} no longer eligible when its display delay elapsed; not displaying`),this.Ni(c);b()},k=i?null===(l=this._posthog.surveys)||void 0===l||null===(l=l._surveyEventReceiver)||void 0===l||null===(a=l.getActivationTimestamp)||void 0===a?void 0:a.call(l,c.id):void 0,S=Pe(k)?Math.max(0,Date.now()-k):0,x=Math.max(0,1e3*m-S);if(0>=x)return w();const C=Hg.setTimeout(()=>{this.wi.delete(c.id),w()},x);this.wi.set(c.id,C)},this.ji=t=>{var e;const{survey:i,language:n}=this.Ai(t),{shadow:s,isNewlyCreated:r}=Hp(i,this._posthog);this.xi.set(s,s.host),(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===dp.Tab&&this.Si.set(t.id,t),r&&jf(hg(tm,{posthog:this._posthog,survey:i,surveyLanguage:n},t.id),s)},this.Bi=t=>{const e=this.ki.get(t);e&&(e.element.removeEventListener("click",e.listener),e.element.removeAttribute(Wg),this.ki.delete(t),Sp.info(`Removed click listener for survey ${t}`))},this.Hi=t=>{this.zi(t)||(this.Ui(t),this.Bi(t.id))},this.Wi=t=>{this.zi(t)||(this.Ui(t),this.Si.delete(t.id))},this.zi=t=>{try{var e;const i=Ug.querySelector(lg(t,!0));return!!(null==i||null===(e=i.shadowRoot)||void 0===e?void 0:e.querySelector(".ph-survey"))}catch(t){return!1}},this.Vi=(t,e)=>{const i=Ug.querySelector(e),n=this.ki.get(t.id);if(i){if(this.ji(t),n){if(i===n.element)return;Sp.info(`Selector element changed for survey ${t.id}. Re-attaching listener.`),this.Bi(t.id)}if(!i.hasAttribute(Wg)){const e=e=>{var i,n;e.stopPropagation();const s=(null===(i=t.appearance)||void 0===i?void 0:i.position)===vp.NextToTrigger?Vg(e.currentTarget,parseInt((null===(n=t.appearance)||void 0===n?void 0:n.maxWidth)||Np.maxWidth)):{};Hg.dispatchEvent(new CustomEvent(zg,{detail:{surveyId:t.id,position:s}}))};nr(i,"click",e),i.setAttribute(Wg,"true"),this.ki.set(t.id,{element:i,listener:e,survey:t}),Sp.info(`Attached click listener for feedback button survey ${t.id}`)}}else n&&this.Hi(t)},this.renderPopover=t=>{if(!Cp(this._posthog))return;const{survey:e,language:i}=this.Ai(t),{shadow:n}=Hp(e,this._posthog);this.xi.set(n,n.host),jf(hg(Yg,{posthog:this._posthog,survey:e,removeSurveyFromFocus:this.Ni,surveyLanguage:i}),n)},this.renderSurvey=(t,e,i)=>{var n;if(!Cp(this._posthog))return;const{survey:s,language:r}=this.Ai(t);let o=!1;(null===(n=this._posthog.config)||void 0===n||null===(n=n.surveys)||void 0===n?void 0:n.prefillFromUrl)&&(o=this.Zi(s,r,i)),jf(hg(Yg,{posthog:this._posthog,survey:s,removeSurveyFromFocus:this.Ni,isPopup:!1,properties:i,isSurveyCompleted:o,surveyLanguage:r}),e)},this.getActiveMatchingSurveys=(t,e=!1)=>{var i;null===(i=this._posthog)||void 0===i||null===(i=i.surveys)||void 0===i||i.getSurveys(e=>{t(e.filter(t=>this.qi(t)))},e)},this.callSurveysAndEvaluateDisplayLogic=(t=!1)=>{this.getActiveMatchingSurveys(t=>{const e=Cp(this._posthog),i=t.filter(t=>e&&(t.type===pp.Popover||t.type===pp.Widget)),n=new Set(i.map(t=>t.id));for(const t of Array.from(this.wi.keys()))n.has(t)||this.cancelSurvey(t);const s=this.Gi(i),r=new Set,o=new Set;s.forEach(t=>{if(t.type===pp.Widget){var e,i,n,s;if((null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===dp.Tab)return o.add(t.id),void this.ji(t);(null===(i=t.appearance)||void 0===i?void 0:i.widgetType)===dp.Selector&&(null===(n=t.appearance)||void 0===n?void 0:n.widgetSelector)&&(r.add(t.id),this.Vi(t,null===(s=t.appearance)||void 0===s?void 0:s.widgetSelector))}Me(this.Qi)&&t.type===pp.Popover&&this.handlePopoverSurvey(t,void 0,{resumeDelayFromActivation:!0})}),this.ki.forEach(({survey:t})=>{r.has(t.id)||this.Hi(t)}),this.Si.forEach((t,e)=>{o.has(e)||this.Wi(t)})},t)},this.Fi=t=>{Me(this.Qi)||Sp.error(`Survey ${this.Qi} already in focus. Cannot add survey ${t.id}.`),this.Qi=t.id},this.Ni=t=>{this.Qi!==t.id&&Sp.error(`Survey ${t.id} is not in focus. Cannot remove survey ${t.id}.`),this.Pi(t.id),this.Qi=null,this.Mi=null,this.Ii=!1,this.$i=null,this.Oi=void 0,this.Ui(t)},this._posthog=t,this.Qi=null,this.Ti=()=>this.Ji(),nr(Hg,"languagechange",this.Ti),this.Ri=t.onFeatureFlags(()=>this.Ji())}Ji(){if(Me(this.Qi))return;const t=this._posthog.get_property(ht),e=null==t?void 0:t.find(t=>t.id===this.Qi);if(!e)return;const{survey:i,language:n}=this.Ai(e);if(n===this.Mi)return;if(this.Mi=n,!this.Ii)return;const s=this.Li(i,this.Oi),{shadow:r}=Hp(s,this._posthog);jf(hg(Yg,ue(ue({},this.$i),{},{posthog:this._posthog,survey:s,removeSurveyFromFocus:this.Ni,surveyLanguage:n})),r)}get Ki(){var t,e,i;return null!==(t=null===(e=(i=this._posthog).getExtension)||void 0===e?void 0:e.call(i,"featureFlags"))&&void 0!==t?t:this._posthog.featureFlags}Li(t,e){return(null==e?void 0:e.position)||(null==e?void 0:e.selector)?ue(ue({},t),{},{appearance:ue(ue(ue({},t.appearance),e.position&&{position:e.position}),e.selector&&{widgetSelector:e.selector})}):t}Pi(t){const e=this.wi.get(t);e&&(clearTimeout(e),this.wi.delete(t))}cancelSurvey(t){this.wi.has(t)&&(Sp.info(`Cancelled pending survey ${t}`),this.Pi(t),this.Qi===t&&(this.Qi=null,this.Mi=null,this.Ii=!1,this.$i=null,this.Oi=void 0))}setAutomaticDisplayDispose(t){this.Xi=t}dispose(){var t;null===(t=this.Xi)||void 0===t||t.call(this),this.Xi=void 0,this.Ti&&(Hg.removeEventListener("languagechange",this.Ti),this.Ti=null),this.Ri&&(this.Ri(),this.Ri=null),this.wi.forEach((t,e)=>this.Pi(e)),this.ki.forEach((t,e)=>this.Bi(e)),this.xi.forEach((t,e)=>{jf(null,e),null==t||t.remove()}),this.xi.clear(),this.Si.clear(),this.Qi=null}Gi(t){return t.sort((t,e)=>{var i,n;const s=rg(t),r=rg(e);if(s&&!r)return-1;if(!s&&r)return 1;const o=t.schedule===yp.Always,l=e.schedule===yp.Always;return o&&!l?1:!o&&l?-1:((null===(i=t.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)-((null===(n=e.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)})}Ai(t){return jg(t,this._posthog)}Zi(t,e,i){if(this.Ci.has(t.id))return!1;const{params:n}=function(){const t={};let e=!1;const i=Hg.location.search.replace(/^\?/,"");if(!i)return{params:t,autoSubmit:e};const n=i.split("&");for(const i of n){const[n,s]=i.split("=");if(!n||Te(s))continue;const r=decodeURIComponent(n),o=decodeURIComponent(s);if("auto_submit"===r&&"true"===o){e=!0;continue}const l=r.match(/^q(\d+)$/);if(l){const e=parseInt(l[1],10);t[e]||(t[e]=[]),t[e].push(o)}}return{params:t,autoSubmit:e}}();if(0===Object.keys(n).length)return!1;Sp.info("[Survey Prefill] Detected URL prefill parameters");const s=this.Yi(t,n,e);return!!s&&(this.tr(t,s,i,e),this.Ci.add(t.id),s.isSurveyCompleted)}tr(t,e,i,n){const{responses:s,submissionId:r,isSurveyCompleted:o,skippedResponses:l}=e;(Object.keys(l).length>0&&t.enable_partial_responses||o)&&Up({responses:o?s:l,survey:t,surveySubmissionId:r,posthog:this._posthog,isSurveyCompleted:o,properties:i,surveyLanguage:n})}Di(t,e,i,n){const s={};for(const[t,i]of Object.entries(e))s[parseInt(t)]=Se(i)?i.map(String):[String(i)];Sp.info("[Survey] Processing initial responses");const r=this.Yi(t,s,n);return!!r&&(this.tr(t,r,i,n),r.isSurveyCompleted)}Yi(t,e,i){try{const n=function(t,e){const i={};return t.questions.forEach((t,n)=>{if(!e[n]||!t.id)return;const s=e[n],r=ea(t.id);try{switch(t.type){case gp.SingleChoice:{if(!t.choices||0===t.choices.length)return void Vs.warn(`[Survey Prefill] Question ${n} has no choices`);const e=parseInt(s[0],10);if(isNaN(e)||0>e||e>=t.choices.length)return void Vs.warn(`[Survey Prefill] Invalid choice index for q${n}: ${s[0]}`);i[r]=t.choices[e];break}case gp.MultipleChoice:{if(!t.choices||0===t.choices.length)return void Vs.warn(`[Survey Prefill] Question ${n} has no choices`);const e=s.map(t=>parseInt(t,10)).filter(e=>!isNaN(e)&&e>=0&&t.choices.length>e);if(0===e.length)return void Vs.warn(`[Survey Prefill] No valid choices for q${n}`);const o=[...new Set(e.map(e=>t.choices[e]))];e.length>o.length&&Vs.warn(`[Survey Prefill] Removed duplicate choices for q${n}`),i[r]=o;break}case gp.Rating:{const e=parseInt(s[0],10),o=t.scale||10;if(isNaN(e)||0>e||e>o)return void Vs.warn(`[Survey Prefill] Invalid rating for q${n}: ${s[0]} (scale: 0-${o})`);i[r]=e;break}default:Vs.info(`[Survey Prefill] Question type ${t.type} does not support prefill`)}}catch(t){Vs.error(`[Survey Prefill] Error converting q${n}:`,t)}}),i}(t,e);if(0===Object.keys(n).length)return Sp.warn("[Survey Prefill] No valid responses after conversion"),null;const s=Ml(),{startQuestionIndex:r,skippedResponses:o,skippedIndices:l}=function(t,e,i){let n=0;const s={},r=[],o=t.questions.length+1;let l=0;for(;t.questions.length>n&&o>l&&(l++,e.includes(n));){const e=t.questions[n];if(!e||!("skipSubmitButton"in e)||!e.skipSubmitButton)break;if(e.id){const t=ea(e.id);Te(i[t])||(s[t]=i[t])}r.push(n);const o=qg(t,n,e.id?i[ea(e.id)]:null);if(o===mp.End)return{startQuestionIndex:t.questions.length,skippedResponses:s,skippedIndices:r};n=o}return{startQuestionIndex:n,skippedResponses:s,skippedIndices:r}}(t,Object.keys(e).map(t=>parseInt(t,10)),n),a=r>=t.questions.length;return ng(t,{surveySubmissionId:s,responses:n,lastQuestionIndex:r,questionOrder:Qp(t.questions),visitedIndices:l,surveyLanguage:i}),Sp.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:n,submissionId:s,startQuestionIndex:r,isSurveyCompleted:a,skippedResponses:o}}catch(t){return Sp.error("[Survey Prefill] Error handling prefill:",t),null}}er(t,e=void 0){if(!t)return!0;const i=this.Ki,n=!!(null==i?void 0:i.isFeatureEnabled(t,{send_event:!t.startsWith("survey-targeting-")}));let s=!0;e&&(s=(null==i?void 0:i.getFeatureFlag(t,{send_event:!1}))===e||"any"===e);const r=n&&s;return r||this.nr(t),r}nr(t){var e;!this.Ei&&(null===(e=this._posthog.config)||void 0===e?void 0:e.advanced_disable_feature_flags)&&(this.Ei=!0,Sp.warn(`Survey feature flag "${t}" evaluated to false because advanced_disable_feature_flags is set. PostHog creates an internal targeting flag for almost every survey, so no survey can display while flags are disabled. To keep surveys working, replace advanced_disable_feature_flags with advanced_only_evaluate_survey_feature_flags, which evaluates survey flags only.`))}ir(e){return!e.conditions||eg(e,this._posthog)&&function(e){var n,s;return function(e,n){var s,r,o;if(!e||0===e.length)return!0;if(!u)return!1;const l=Ji(u,{userAgentDataPlatform:null==i||null===(s=i.userAgentData)||void 0===s?void 0:s.platform,maxTouchPoints:null==i?void 0:i.maxTouchPoints,screenWidth:null==t||null===(r=t.screen)||void 0===r?void 0:r.width,screenHeight:null==t||null===(o=t.screen)||void 0===o?void 0:o.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio});return pa[null!=n?n:"icontains"](e,[l])}(null===(n=e.conditions)||void 0===n?void 0:n.deviceTypes,null===(s=e.conditions)||void 0===s?void 0:s.deviceTypesMatchType)}(e)&&function(t){var e;return!(null===(e=t.conditions)||void 0===e?void 0:e.selector)||!!(null==Dp?void 0:Dp.querySelector(t.conditions.selector))}(e)}rr(t){var e;return Kp(t)?{satisfied:!0}:t.internal_targeting_flag_key&&function(t){var e;return"recurring"===t.schedule||(null!==(e=t.current_iteration)&&void 0!==e?e:0)>0}(t)&&!(null===(e=this.Ki)||void 0===e?void 0:e.hasLoadedFlags)?(this.nr(t.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this.er(t.internal_targeting_flag_key)}}checkSurveyEligibility(t){var e,i;const n={eligible:!0,reason:void 0};if(!$p(t))return n.eligible=!1,n.reason=`Survey is not running. It was completed on ${t.end_date}`,n;if(!Rp.includes(t.type))return n.eligible=!1,n.reason=`Surveys of type ${t.type} are never eligible to be shown in the app`,n;const s=null===(e=t.conditions)||void 0===e?void 0:e.linkedFlagVariant;if(!this.er(t.linked_flag_key,s))return n.eligible=!1,n.reason=s?`Survey linked feature flag is not enabled for variant ${s}`:"Survey linked feature flag is not enabled",n;if(!this.er(t.targeting_flag_key))return n.eligible=!1,n.reason="Survey targeting feature flag is not enabled",n;const r=this.rr(t);var o;return r.satisfied?function(t,e){if(!t||!e)return!0;const i="string"==typeof e?new Date(e):e,n=Math.abs((new Date).getTime()-i.getTime());return Math.ceil(n/864e5)>t}(null===(i=t.conditions)||void 0===i?void 0:i.seenSurveyWaitPeriodInDays,Ll.Ot("lastSeenSurveyDate"))?(t=>!!Ll.Ot(Ip(t))&&!Kp(t))(t)?(n.eligible=!1,n.reason="Survey has already been seen and it can't be activated again",n):n:(n.eligible=!1,n.reason="Survey wait period has not passed",n):(n.eligible=!1,n.reason=null!==(o=r.reason)&&void 0!==o?o:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",n)}checkSurveyCaptureEligibility(){return Cp(this._posthog)?{eligible:!0}:{eligible:!1,reason:xp}}checkSurveyDisplayEligibility(t){const e=this.checkSurveyCaptureEligibility();return e.eligible?this.checkSurveyEligibility(t):e}checkSurveyRenderability(t){const e=this.checkSurveyDisplayEligibility(t);return e.eligible&&!this.sr(t)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:e}sr(t){var e;if(!ca(t)&&!Tp(t))return!0;const i=null===(e=this._posthog.surveys)||void 0===e||null===(e=e._surveyEventReceiver)||void 0===e?void 0:e.getSurveys();return!!(null==i?void 0:i.includes(t.id))}ar(t){var e;return!(null===(e=t.feature_flag_keys)||void 0===e?void 0:e.length)||t.feature_flag_keys.every(({key:t,value:e})=>!t||!e||this.er(e))}qi(t){return this.checkSurveyEligibility(t).eligible&&this.ir(t)&&this.sr(t)&&this.ar(t)}Ui(t){try{const e=Ug.querySelector(lg(t,!0));(null==e?void 0:e.shadowRoot)&&(jf(null,e.shadowRoot),this.xi.delete(e.shadowRoot)),null==e||e.remove()}catch(e){Sp.warn(`Failed to remove survey ${t.id} from DOM:`,e)}}getTestAPI(){return{addSurveyToFocus:this.Fi,removeSurveyFromFocus:this.Ni,surveyInFocus:this.Qi,surveyTimeouts:this.wi,handleWidget:this.ji,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this.Vi,sortSurveysByAppearanceDelay:this.Gi,checkFlags:this.ar.bind(this),isSurveyFeatureFlagEnabled:this.er.bind(this),onLanguageChange:this.Ji.bind(this),currentLanguage:this.Mi,surveyIsRendered:this.Ii}}};function Zg(t,e){if(!Ug||!Hg)return;const i=new Gg(t);if(t.config.disable_surveys_automatic_display)return Sp.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===e)return Sp.info("There are no surveys to load or Surveys is disabled in the project settings."),i;let n;i.callSurveysAndEvaluateDisplayLogic(!0);const s=()=>{Te(n)&&(n=setInterval(()=>{i.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},r=()=>{Te(n)||(clearInterval(n),n=void 0)};s();const o=()=>{Ug.hidden?r():(i.callSurveysAndEvaluateDisplayLogic(!1),s())};return nr(Ug,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{r(),Ug.removeEventListener("visibilitychange",o)}),i}function Qg({survey:t,removeSurveyFromFocus:e=()=>{},setSurveyVisible:i,isPreviewMode:n=!1,posthog:s}){Xf(()=>{var r;if(n||!(null===(r=t.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var n;const r=t.type===pp.Widget,o=eg(t,s),l=(null===(n=t.appearance)||void 0===n?void 0:n.widgetType)===dp.Tab&&r;if(!o)return Sp.info(`Hiding survey ${t.id} because URL does not match`),i(!1),e(t);l&&(Sp.info(`Showing survey ${t.id} because it is a feedback button tab and URL matches`),i(!0))};nr(Hg,"popstate",o),nr(Hg,"hashchange",o);const l=Hg.history.pushState,a=Hg.history.replaceState;return Hg.history.pushState=function(...t){l.apply(this,t),o()},Hg.history.replaceState=function(...t){a.apply(this,t),o()},()=>{Hg.removeEventListener("popstate",o),Hg.removeEventListener("hashchange",o),Hg.history.pushState=l,Hg.history.replaceState=a}},[n,t,e,i,s])}const Jg=200;function Kg(t=fp.Right){switch(t){case fp.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case fp.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case fp.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function Yg({survey:t,forceDisableHtml:e,posthog:i,style:n={},previewPageIndex:s,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:l=()=>{},onPreviewBack:a=()=>{},onPopupSurveyDismissed:u=()=>{},onCloseConfirmationMessage:h=()=>{},properties:c,isSurveyCompleted:d,skipShownEvent:v,surveyLanguage:f}){var p,g,m,y,_,b,w,k,S,x,C,T;const E=tp(null),I=Number.isInteger(s),{isPopupVisible:M,isSurveySent:R,hidePopupWithAnimation:P}=function(t,e,i,n,s,r,o,l,a){const[u,h]=Yf(n||0===i||t.type===pp.ExternalSurvey),[c,d]=Yf(!1),v=tp(!1),f=()=>{const e=()=>{r&&s(t),h(!1)};if(v.current)return;const i=null==o?void 0:o.current;i?(v.current=!0,i.style.transition=`opacity ${Jg}ms ease-out`,i.style.opacity="0",setTimeout(()=>{v.current=!1,e()},250)):e()},p=e=>{e.detail.surveyId===t.id&&f()};return Xf(()=>{if(!e)return void Sp.error("usePopupVisibility hook called without a PostHog instance.");if(n)return;let s;const r=e=>{var i,n;if(e.detail.surveyId===t.id){if(!(null===(i=t.appearance)||void 0===i?void 0:i.displayThankYouMessage))return f();d(!0),(null===(n=t.appearance)||void 0===n?void 0:n.autoDisappear)&&(s&&clearTimeout(s),s=setTimeout(f,5e3))}},o=()=>{if(eg(t,e)){var i;h(!0),Hg.dispatchEvent(new Event("PHSurveyShown")),l||e.capture(_p.SHOWN,ue(ue({[bp.SURVEY_NAME]:t.name,[bp.SURVEY_ID]:t.id,[bp.SURVEY_ITERATION]:t.current_iteration,[bp.SURVEY_ITERATION_START_DATE]:t.current_iteration_start_date},a&&{[bp.SURVEY_LANGUAGE]:a}),{},{sessionRecordingUrl:null===(i=e.get_session_replay_url)||void 0===i?void 0:i.call(e)}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}};nr(Hg,"PHSurveyClosed",p),nr(Hg,"PHSurveySent",r);const u=i>0?setTimeout(o,i):void 0;return Te(u)&&o(),()=>{Te(u)||clearTimeout(u),Te(s)||clearTimeout(s),Hg.removeEventListener("PHSurveyClosed",p),Hg.removeEventListener("PHSurveySent",r)}},[]),Qg({survey:t,removeSurveyFromFocus:s,setSurveyVisible:h,isPreviewMode:n,posthog:e}),{isPopupVisible:u,isSurveySent:c,setIsPopupVisible:h,hidePopupWithAnimation:f}}(t,i,(null===(p=t.appearance)||void 0===p?void 0:p.surveyPopupDelaySeconds)?1e3*t.appearance.surveyPopupDelaySeconds:0,I,r,o,E,v,f),O=R||s===t.questions.length||!0===d,[A,F]=Yf(!1),D=ep(()=>!!sg(t),[t]),L=!(!(null===(g=t.appearance)||void 0===g?void 0:g.introScreenHeader)&&!(null===(m=t.appearance)||void 0===m?void 0:m.introScreenDescription)),N=I?-1===s:!!(null===(y=t.appearance)||void 0===y?void 0:y.displayIntroScreen)&&L&&!A&&!D,q=ep(()=>{const e=sg(t),n=(null==e?void 0:e.surveySubmissionId)||Ml();return{isPreviewMode:I,previewPageIndex:s,onPopupSurveyDismissed(){f?Wp(t,i,I,f):Wp(t,i,I),u()},isPopup:o||!1,surveySubmissionId:n,onPreviewSubmit:l,onPreviewBack:a,posthog:i,properties:c,surveyLanguage:f}},[I,s,o,i,t,u,l,a,c,f]);return M?hg(Yp.Provider,{value:q,children:hg("div",{className:"ph-survey",style:ue(ue({},ag(t.type,null===(_=t.appearance)||void 0===_?void 0:_.position,null===(b=t.appearance)||void 0===b?void 0:b.widgetType)),n),ref:E,children:O?hg(Cg,{header:(null===(w=t.appearance)||void 0===w?void 0:w.thankYouMessageHeader)||"Thank you!",description:(null===(k=t.appearance)||void 0===k?void 0:k.thankYouMessageDescription)||"",forceDisableHtml:!!e,contentType:null===(S=t.appearance)||void 0===S?void 0:S.thankYouMessageDescriptionContentType,appearance:t.appearance||Np,onClose(){P(),h()}}):N?hg($g,{header:(null===(x=t.appearance)||void 0===x?void 0:x.introScreenHeader)||"",description:(null===(C=t.appearance)||void 0===C?void 0:C.introScreenDescription)||"",forceDisableHtml:!!e,contentType:null===(T=t.appearance)||void 0===T?void 0:T.introScreenDescriptionContentType,appearance:t.appearance||Np,onStart:()=>F(!0)}):hg(Xg,{survey:t,forceDisableHtml:!!e,posthog:i})})}):null}function Xg({survey:t,forceDisableHtml:e,posthog:i}){var n,s;const r=ep(()=>{const e=sg(t);if(!e)return null;const i=Pe(e.lastQuestionIndex);return!i||i&&e.lastQuestionIndex>=0&&t.questions.length>e.lastQuestionIndex?e:(og(t),null)},[t]),[o,l]=Yf(()=>((null==r?void 0:r.responses)&&Sp.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[a,u]=Yf(!1),{previewPageIndex:h,onPopupSurveyDismissed:c,isPopup:d,onPreviewSubmit:v,onPreviewBack:f,surveySubmissionId:p,isPreviewMode:g,properties:m,surveyLanguage:y}=ip(Yp),[_,b]=Yf(()=>{const e=null==r?void 0:r.lastQuestionIndex,i=Pe(e)&&e>=0&&t.questions.length>e?e:0;return Pe(h)&&h>=0?h:i}),[w,k]=Yf(()=>{var e;return(null!==(e=null==r?void 0:r.visitedIndices)&&void 0!==e?e:[]).filter(e=>e>=0&&t.questions.length>e)}),[S,x]=Yf(()=>{var e;const i=sg(t);return null!==(e=null==i?void 0:i.questionSnapshots)&&void 0!==e?e:{}}),C=ep(()=>Qp(Jp(t,r)),[t.id,r]),T=ep(()=>{if(!C||new Set(C).size!==C.length)return Jp(t,r);const e=new Map(t.questions.map(t=>[t.id,t])),i=C.map(t=>e.get(t)).filter(t=>!!t);return i.length===C.length?i:t.questions},[C,t.questions,t,r]);Xf(()=>{!g||Te(h)||0>h||b(h)},[h,g]);const E=!!(null===(n=t.appearance)||void 0===n?void 0:n.allowGoBack)&&(g?(null!=h?h:0)>0:w.length>0),I=T.at(_);return I?hg("form",{className:"survey-form",name:"surveyForm",children:[d&&!0!==(null===(s=t.appearance)||void 0===s?void 0:s.hideCancelButton)&&hg(Sg,{onClick(){c()}}),hg("div",{className:"survey-box","data-question-index":_,children:[a&&hg("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),em({question:I,forceDisableHtml:e,displayQuestionIndex:_,appearance:t.appearance||Np,onSubmit:e=>(({res:e,displayQuestionIndex:n,questionId:s})=>{if(!i)return void Sp.error("onNextButtonClick called without a PostHog instance.");if(!Cp(i))return void u(!0);if(u(!1),!s)return void Sp.error("onNextButtonClick called without a questionId.");const r=ea(s),a=ue(ue({},o),{},{[r]:e});l(a);const h=T[n],c=(null==h?void 0:h.id)?ue(ue({},S),{},{[h.id]:h.question}):S;x(c);const d=qg(t,n,e),v=d===mp.End,f=[...w,n];if(v||(k(f),b(d),ng(t,{surveySubmissionId:p,responses:a,lastQuestionIndex:d,questionOrder:Qp(T),visitedIndices:f,surveyLanguage:y,questionSnapshots:c})),t.enable_partial_responses||v){const e=new Set(f.map(t=>{var e;return null===(e=T[t])||void 0===e?void 0:e.id}).filter(t=>!!t).map(t=>ea(t))),n=Object.fromEntries(Object.entries(a).filter(([t])=>e.has(t)));Up({responses:n,survey:t,surveySubmissionId:p,isSurveyCompleted:v,posthog:i,properties:m,surveyLanguage:y,questionSnapshots:c})}})({res:e,displayQuestionIndex:_,questionId:I.id}),onPreviewSubmit:v,initialValue:I.id?o[ea(I.id)]:void 0,canGoBack:E,onBack(){if(g)return void f();if(0===w.length)return;const e=w[w.length-1],i=w.slice(0,-1);k(i),b(e),ng(t,{surveySubmissionId:p,responses:o,lastQuestionIndex:e,questionOrder:Qp(T),visitedIndices:i,surveyLanguage:y,questionSnapshots:S})}})]})]}):null}function tm({survey:t,forceDisableHtml:e,posthog:i,readOnly:n,surveyLanguage:s}){var r,o,l,a,u,h,c;const[d,v]=Yf(!0),[f,p]=Yf(!1),[g,m]=Yf({}),y=tp(void 0),_=()=>{(f||!i||n||Cp(i))&&p(!f)};if(Xf(()=>{var e;if(!i)return void Sp.error("FeedbackWidget called without a PostHog instance.");if(n)return;"tab"===(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)&&m({top:"50%",bottom:"auto"});const s=e=>{var i;const n=e;(null===(i=n.detail)||void 0===i?void 0:i.surveyId)===t.id&&(Sp.info(`Received show event for feedback button survey ${t.id}`),m(n.detail.position||{}),_())};return nr(Hg,zg,s),()=>{Te(y.current)||(clearTimeout(y.current),y.current=void 0),Hg.removeEventListener(zg,s)}},[i,n,t.id,null===(r=t.appearance)||void 0===r?void 0:r.widgetType,null===(o=t.appearance)||void 0===o?void 0:o.widgetSelector,null===(l=t.appearance)||void 0===l?void 0:l.borderColor]),Qg({survey:t,setSurveyVisible:v,posthog:i}),!d)return null;const b=()=>{t.schedule!==yp.Always&&v(!1),Te(y.current)||clearTimeout(y.current),y.current=setTimeout(()=>{y.current=void 0,p(!1)},200)};return hg(wf,{children:["tab"===(null===(a=t.appearance)||void 0===a?void 0:a.widgetType)&&hg("button",{className:"ph-survey-widget-tab "+((null===(u=t.appearance)||void 0===u?void 0:u.tabPosition)===fp.Top?"widget-tab-top":""),onClick:_,disabled:n,style:Kg(null===(h=t.appearance)||void 0===h?void 0:h.tabPosition),children:(null===(c=t.appearance)||void 0===c?void 0:c.widgetLabel)||""}),f&&hg(Yg,{posthog:i,survey:t,forceDisableHtml:e,style:g,onPopupSurveyDismissed:b,onCloseConfirmationMessage:b,surveyLanguage:s})]})}const em=({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:l,onBack:a})=>{const u={forceDisableHtml:e,appearance:n,onPreviewSubmit(t){r(t)},onSubmit(t){s(t)},initialValue:o,displayQuestionIndex:i,canGoBack:l,onBack:a};switch(t.type){case gp.Open:return _f(Eg,ue(ue({},u),{},{question:t,key:t.id}));case gp.Link:return _f(Ig,ue(ue({},u),{},{question:t,key:t.id}));case gp.Rating:return _f(Mg,ue(ue({},u),{},{question:t,key:t.id}));case gp.SingleChoice:case gp.MultipleChoice:return _f(Pg,ue(ue({},u),{},{question:t,key:t.id}));default:return Sp.error(`Unsupported question type: ${t.type}`),null}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.generateSurveys=Zg,d.extendPostHogWithSurveys=Zg;const im=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},nm=1e4,sm=(t,e,i)=>i.remaining>0?e.length>i.remaining?(t.push(e.slice(0,i.remaining)),i.remaining=0,i.truncated=!0,!1):(t.push(e),i.remaining-=e.length,!0):(i.truncated=!0,!1),rm=(t,e,i)=>{const n=JSON.stringify(t);if(i.remaining>=n.length)return sm(e,n,i);if(i.truncated=!0,2>i.remaining)return!1;let s=0,r=Math.min(t.length,i.remaining-2);for(;r>s;){const e=Math.ceil((s+r)/2);JSON.stringify(t.slice(0,e)).length>i.remaining?r=e-1:s=e}return sm(e,JSON.stringify(t.slice(0,s)),i)},om=t=>void 0!==t&&"function"!=typeof t&&"symbol"!=typeof t&&"bigint"!=typeof t,lm=(t,e,i)=>{if(!i.truncated){if(i.keysRemaining-=1,i.sizeRemaining-=String(e).length+t.length,0>=i.keysRemaining||0>=i.sizeRemaining)return i.truncated=!0,void(i.result.attributes_truncated=!0);i.result[t]=e}},am=(t,e,i)=>{if(!i.truncated)if(Ce(t)){if(i.seen.has(t))return void lm(e||"circular","[Circular]",i);i.seen.add(t);try{for(const n in t)try{if(!{}.hasOwnProperty.call(t,n))continue;if(am(t[n],e?`${e}.${n}`:n,i),i.truncated)return}catch(t){continue}}catch(t){}}else lm(e,t,i)},um=(t,e,i,n,s=!1,r)=>{if(!om(t))return!s||sm(e,"null",i);if(Me(t)||(t=>{try{return Pe(t)||Ae(t)}catch(t){return!1}})(t))return sm(e,JSON.stringify(t),i);if("string"==typeof t)return rm(t,e,i);if(!Ce(t)&&!Se(t))return sm(e,JSON.stringify(t),i);if(n.has(t))return rm("[Circular]",e,i);n.add(t);try{const r=t.toJSON;if(xe(r))return um(r.call(t),e,i,n,s)}catch(t){}try{const n={}.toString.call(t);if("[object String]"===n)return rm(String(t.valueOf()),e,i);if("[object Number]"===n||"[object Boolean]"===n)return sm(e,JSON.stringify(t.valueOf()),i)}catch(t){}if(t instanceof Error){const o={};try{for(const e in t)({}).hasOwnProperty.call(t,e)&&(o[e]=t[e])}catch(t){}try{o.name=t.name}catch(t){}try{o.message=t.message}catch(t){}try{o.stack=t.stack}catch(t){}return um(o,e,i,n,s,r)}if(Se(t)){if(!sm(e,"[",i))return!1;for(let s=0;t.length>s;s++){if(s>0&&!sm(e,",",i))return!1;let r;try{r=t[s]}catch(t){r=void 0}if(!um(r,e,i,n,!0))return!1}return sm(e,"]",i)}if(!sm(e,"{",i))return!1;let o=!0;try{for(const s in t){if(!{}.hasOwnProperty.call(t,s))continue;if(0>=i.remaining)return i.truncated=!0,!1;let l;try{l=t[s]}catch(t){continue}if(r)try{am(l,s,r)}catch(t){}if(!om(l))continue;const a=`${o?"":","}${JSON.stringify(s)}:`;if(a.length>=i.remaining)return i.truncated=!0,!1;const u=e.length,h=i.remaining,c=i.truncated;if(!sm(e,a,i))return!1;const d=e.length,v=um(l,e,i,n,!1),f=i.truncated;if(e.length!==d){if(o=!1,!v)return!1}else if(e.length=u,i.remaining=h,i.truncated=v?c:f,!v)return!1}}catch(t){}return sm(e,"}",i)},hm=(t,e)=>{const i=[],n={remaining:e,truncated:!1},s=Ce(t[0])?{result:{},keysRemaining:50,sizeRemaining:nm,truncated:!1,seen:new WeakSet([t[0]])}:void 0;for(let e=0;t.length>e&&(0>=e||sm(i," ",n))&&um(t[e],i,n,new WeakSet,!1,0===e?s:void 0);e++);return{body:i.join("")+(n.truncated?"...":""),truncated:n.truncated,attributes:(null==s?void 0:s.result)||{}}},cm={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},dm=t=>"canCapture"in t,vm=t=>dm(t)?t.canCapture?t.getExtension(Op):void 0:t.is_capturing()?t.logs:void 0,fm=(t,e,i)=>{if(dm(t))return void e.captureConsoleLog(i);const n=(t=>{const e=/^1\.(\d+)\.(\d+)$/.exec(t);if(!e)return;const i=Number(e[1]),n=Number(e[2]);return 392>i||i>419?void 0:410===i?n>4?n>10?void 0:"de":"le":418===i?n>3?n>10?n>14?n>17?void 0:"vi":"ci":"ui":"he":419===i?n>2?void 0:"vi":410>i?"le":"he"})(t.version),s=n?e[n]:void 0;xe(s)&&s.call(e,i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.logs={initializeLogs(t){let e=t;const i=[],n={host:d.location.host};let s=!1;for(const t of Object.keys(cm)){const r=i=>(...r)=>{let o=!1;try{const i=e;if(r.length>0&&!s&&i){const e=vm(i);if(e){s=!0,o=!0;const{body:l,truncated:a,attributes:u}=hm(r,nm),h=ue(ue({},n),a?{body_truncated:"true"}:{}),c={level:cm[t],body:l,attributes:ue(ue({"log.source":`console.${t}`},h),u)};fm(i,e,c)}}}catch(t){}finally{o&&(s=!1),i.apply(d.console,r)}},o=d.console[t];i.push(wv(d.console,t,t=>{const e=r(t);return e.__rrweb_original__=im(o),e}))}return()=>{e=void 0,i.forEach(t=>t())}},replayConsoleBuffer(t,e){const i=vm(t);if(i)for(const t of e)try{var n;const{body:e,truncated:s,attributes:r}=hm(t.args,nm);null===(n=i.captureBufferedConsoleLog)||void 0===n||n.call(i,{level:cm[t.level],body:e,attributes:ue(ue({"log.source":`console.${t.level}`,host:d.location.host},s?{body_truncated:"true"}:{}),r)},t.context,t.occurredAtMs)}catch(t){}}};const pm=t=>Be(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),gm=Gs("[Error tracking]"),mm="webkit-masked-url:",ym=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],_m=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",mm],bm=["__firefox__","__gCrWeb"];function wm(){return new yn([new qn,new Qn,new jn,new Bn,new Gn,new Vn,new Un,new Zn],function(t,...e){return(i,n=0)=>{const s=[],r=i.split("\n"),o=Math.min(r.length,n+1e3),l=[];for(let i=n;o>i;i++){const n=r[i];if(n.length>1024)continue;const o=Rn.test(n)?n.replace(Rn,"$1"):n;if(!o.match(/\S*Error: /)){for(const i of e){const e=i(o,t);if(e){s.push(e);const t=On(s);if(t){for(let e=l.length-1;e>=0;e--){const i=l[e];if(t.start>=i.start+i.length)break;l.pop()}l.push(t)}break}}if(Ln(s,l)>=50)break}}const a=[...l].sort((t,e)=>e.start-t.start),u=a[a.length-1];if(u){const t=Fn(s,u);s.splice(u.start-t,t);for(const e of a)e.start-=t}for(const t of a)An(s,t);return l.some(t=>0===t.start&&s.length===t.length)&&function(t){const e=t.map(t=>`${t.function}|${t.filename}|${t.lineno}|${t.colno}|${t.module}`);let i=0;for(let t=1;e.length>t;t++)Nn(e,t,i)&&(i=t);t.push(...t.splice(0,i))}(s),function(t){if(!t.length)return[];const e=Array.from(t);return e.reverse(),e.slice(0,50).map(t=>{return ue(ue({},t),{},{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||"?"});var i})}(s)}}("web:javascript",Tn,Mn))}const km=Gs("[ExceptionAutocapture]"),Sm=wm(),xm=(t,e)=>{try{return t()}catch(t){return e}},Cm=(t,e)=>xm(()=>t(e()),void 0),$m=t=>xm(()=>xe(t)&&xe(t.call),!1),Tm=(t,e)=>xm(()=>{t[e].__POSTHOG_INSTRUMENTED__=!0},void 0),Em=(t,e,i)=>{xm(()=>{var i;null===(i=t[e])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),xm(()=>{t[e]=i},void 0)},Im=e=>{const i=t;i||km.info("window not available, cannot wrap onerror");const n=xm(()=>i.onerror,void 0);return i.onerror=function(...t){var i;return Cm(e,()=>Sm.buildFromUnknown((([t,e,i,n,s])=>{if(null!=s)return s;if(Ee(t)&&Ee(e)&&e.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:t,filename:e,lineno:i,colno:n})}catch(e){return t}return t})(t),{mechanism:{handled:!1}})),!!$m(n)&&null!==(i=n(...t))&&void 0!==i&&i},Tm(i,"onerror"),()=>Em(i,"onerror",n)},Mm=(e,i=!1)=>{const n=t;n||km.info("window not available, cannot wrap onUnhandledRejection");const s=xm(()=>n.onunhandledrejection,void 0);return n.onunhandledrejection=function(t){var n;return Cm(e,()=>Sm.buildFromUnknown(t,{mechanism:{handled:!1}})),$m(s)?null!==(n=s(t))&&void 0!==n&&n:i},Tm(n,"onunhandledrejection"),()=>Em(n,"onunhandledrejection",s)},Rm={wrapOnError:Im,wrapUnhandledRejection:Mm,wrapConsoleError(t){const e=console;e||km.info("console not available, cannot wrap console.error");const i=xm(()=>e.error,void 0);return e.error=function(...e){xm(()=>e.length>1&&Ee(e[0])&&(/^\[PostHog\.js\](?: |$)/.test(e[0])||"rrweb logger error:"===e[0]),!1)||Cm(t,()=>{let t;t=1==e.length?e[0]:e.join(" ");const i=e.find(t=>t instanceof Error);return Sm.buildFromUnknown(i||t,{mechanism:{handled:!0,type:"onconsole"},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),$m(i)&&i(...e)},Tm(e,"error"),()=>Em(e,"error",i)}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.errorWrappingFunctions=Rm,d.posthogErrorWrappingFunctions=Rm;const Pm=(t,e)=>{if(!xe(null==t?void 0:t.capture))return;const i=null==e?void 0:e.autocaptureExceptions,n=!Me(i)&&"object"==typeof i&&Se(i.errors_to_ignore)?i.errors_to_ignore.reduce((t,e)=>{try{t.push(new RegExp(e))}catch(t){km.error("Ignoring invalid legacy exception exclusion rule",e,t)}return t},[]):[],s=e=>{try{var i;null===(i=t.capture)||void 0===i||i.call(t,"$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(t){km.error("Failed to capture exception for a legacy client",t)}};Im(t=>{n.some(e=>t.$exception_list.some(t=>e.test(t.value||"")))||s(t)}),Mm(s,!0)};d.extendPostHogWithExceptionAutoCapture=Pm,d.extendPostHogWithExceptionAutocapture=Pm;const Om="X-POSTHOG-SESSION-ID",Am="X-POSTHOG-WINDOW-ID",Fm="X-POSTHOG-DISTINCT-ID",Dm=[Om,Am,Fm],Lm=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],Nm=(t,e)=>({}.hasOwnProperty.call(t,e)),qm=t=>"object"==typeof t&&!Me(t)||xe(t),Bm=t=>"undefined"!=typeof Request&&(t instanceof Request||"[object Request]"==={}.toString.call(t)),jm=e=>{try{var i;return Bm(e)?e.url:new URL(e instanceof URL?e.toString():String(e),null==t||null===(i=t.location)||void 0===i?void 0:i.href).toString()}catch(t){return}},Hm=(t,e,i,n,s)=>{let r;try{r=new URL(n).hostname}catch(t){return!1}if(!t)return!1;if(Se(t)&&!t.includes(r))return!1;let o=!1;if(i){const{sessionId:t,windowId:e}=i.checkAndGetSessionAndWindowId(!0);s.set(Om,t),s.set(Am,e),o=!0}const l=(t=>xe(t)?t():t)(e);return l&&"$posthog_cookieless"!==l&&(s.set(Fm,l),o=!0),o};d.__PosthogExtensions__=d.__PosthogExtensions__||{};const Um={_patchFetch:(e,i,n)=>wv(t,"fetch",t=>function(s,r){const o=arguments.length>1?[s,r]:[s];let l=o;try{const t=jm(s);if(t)if(Bm(s)){const t=new Request(s,r);Hm(e,i,n,t.url,t.headers),l=[t]}else{const o=new Headers(qm(r)?r.headers:void 0);if(Hm(e,i,n,t,o)){const t=((t,e)=>{if(Te(t)||Me(t))return{headers:e};if(!qm(t))return;const i=t;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){const t=Object.create(i);return Object.defineProperty(t,"headers",{configurable:!0,enumerable:!0,value:e,writable:!0}),t}return new Proxy({headers:e},{get:(t,e)=>Nm(t,e)?Reflect.get(t,e):Reflect.get(i,e,i),has:(t,e)=>Nm(t,e)||e in i,ownKeys(t){const e=new Set(Reflect.ownKeys(t));return Reflect.ownKeys(i).forEach(t=>e.add(t)),Lm.forEach(t=>{t in i&&e.add(t)}),Array.from(e)},getOwnPropertyDescriptor(t,e){const n=Reflect.getOwnPropertyDescriptor(t,e);if(n)return n;if("string"==typeof e&&Lm.includes(e)&&e in i)return{configurable:!0,enumerable:!0,get(){return Reflect.get(i,e,i)}};const s=Reflect.getOwnPropertyDescriptor(i,e);return s?ue(ue({},s),{},{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(i)})})(r,o);t&&(l=[s,t])}}}catch(t){l=o}return t.apply(this,l)}),_patchXHR:(e,i,n)=>wv(t.XMLHttpRequest.prototype,"open",t=>function(s,r,o=!0,l,a){const u=this,h=new Headers,c=jm(r);c&&Hm(e,i,n,c,h);const d=t.call(u,s,r,o,l,a);return Dm.forEach(t=>{const e=h.get(t);if(e)try{u.setRequestHeader(t,e)}catch(t){}}),d})};d.__PosthogExtensions__.tracingHeadersPatchFns=Um,d.postHogTracingHeadersPatchFns=Um,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(t){const e=this.length;let i=Math.trunc(t)||0;return 0>i&&(i+=e),0>i||i>=e?void 0:this[i]},writable:!0,enumerable:!1,configurable:!0}),"function"!=typeof[].findLast&&Object.defineProperty(Array.prototype,"findLast",{value(t,e){for(let i=this.length-1;i>=0;i--){const n=this[i];if(t.call(e,n,i,this))return n}},writable:!0,enumerable:!1,configurable:!0});var zm=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(t){var e;if(t.hadRecentInput)return;const i=this.i[0],n=this.i.at(-1);this.o&&i&&n&&1e3>t.startTime-n.startTime&&5e3>t.startTime-i.startTime?(this.o+=t.value,this.i.push(t)):(this.o=t.value,this.i=[t]),null===(e=this.t)||void 0===e||e.call(this,t)}};const Wm=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Vm=t=>{if("loading"===document.readyState)return"loading";const e=Wm();if(e){if(e.domInteractive>t)return"loading";if(0===e.domContentLoadedEventStart||e.domContentLoadedEventStart>t)return"dom-interactive";if(0===e.domComplete||e.domComplete>t)return"dom-content-loaded"}return"complete"},Gm=t=>{const e=t.nodeName;return 1===t.nodeType?e.toLowerCase():e.toUpperCase().replace(/^#/,"")},Zm=t=>{let e="";try{for(;9!==(null==t?void 0:t.nodeType);){var i;const n=t,s=n.id?"#"+n.id:[Gm(n),...Array.from(null!==(i=n.classList)&&void 0!==i?i:[]).sort()].join(".");if(e.length+s.length>99)return e||s;if(e=e?s+">"+e:s,n.id)break;t=n.parentNode}}catch(t){}return e},Qm=new WeakMap;function Jm(t,e){let i=Qm.get(e);return i||(i=new WeakMap,Qm.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}let Km=-1;const Ym=()=>Km,Xm=t=>{addEventListener("pageshow",e=>{e.persisted&&(Km=e.timeStamp,t(e))},!0)},ty=(t,e,i,n)=>{let s,r;return o=>{var l;e.value>=0&&(o||n)&&(r=e.value-(null!==(l=s)&&void 0!==l?l:0),(r||void 0===s)&&(s=e.value,e.delta=r,e.rating=((t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good")(e.value,i),t(e)))}},ey=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},iy=()=>{var t,e;return null!==(t=null===(e=Wm())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let ny=-1;const sy=new Set,ry=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,oy=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of sy)t();isFinite(ny)||(ny="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",oy,!0))}},ly=(t=!1)=>{if(t&&(ny=1/0),0>ny){var e;const t=iy(),i=document.prerendering||null===(e=globalThis.performance.getEntriesByType("visibility-state").find(e=>"hidden"===e.name&&e.startTime>=t))||void 0===e?void 0:e.startTime;ny=null!=i?i:ry(),addEventListener("visibilitychange",oy,!0),addEventListener("prerenderingchange",oy,!0),Xm(()=>{setTimeout(()=>{ny=ry()})})}return{get firstHiddenTime(){return ny},onHidden(t){sy.add(t)}}},ay=(t,e=-1,i,n=0,s,r,o)=>{const l=Wm(),a=(null==l?void 0:l.navigationId)||0;let u="navigate";return i?u=i:0>Ym()?l&&(document.prerendering||iy()>0?u="prerender":document.wasDiscarded?u="restore":l.type&&(u=l.type.replace(/_/g,"-"))):u="back-forward-cache",{name:t,value:e,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:u,navigationId:n||a,navigationInteractionId:s,navigationURL:r||(null==l?void 0:l.name),navigationStartTime:o||0}},uy=(t,e,i={})=>{try{const n=t.filter(t=>PerformanceObserver.supportedEntryTypes.includes(t));if(n.length>0){const t=new PerformanceObserver(t=>{queueMicrotask(()=>{const i=t.getEntries();n.length>1&&i.sort((t,e)=>t.startTime+t.duration-(e.startTime+e.duration)),e(i)})});for(const e of n)t.observe(ue({type:e,buffered:!0},i));return t}}catch(t){}},hy=t=>{var e,i;return(null===(e=globalThis.PerformanceObserver)||void 0===e||null===(e=e.supportedEntryTypes)||void 0===e?void 0:e.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&t&&t.reportSoftNavs},cy=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},dy=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var vy=class{constructor(){this.u=void 0}};const fy=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},py=[1800,3e3],gy=(t,e={})=>{const i=hy(e);fy(()=>{const n=Jm(e,vy),s=ly();let r,o=ay("FCP");const l=uy(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(l.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-iy(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});l&&(r=ty(t,o,py,e.reportAllChanges),Xm(i=>{o=ay("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Ym()),r=ty(t,o,py,e.reportAllChanges),ey(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&uy(["soft-navigation"],i=>{i.forEach(i=>{n.u&&i.navigationId&&cy(n.u,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=ay("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=ty(t,o,py,e.reportAllChanges),r(!0)})},e)})},my=[.1,.25],yy=t=>t.find(t=>{var e;return 1===(null===(e=t.node)||void 0===e?void 0:e.nodeType)})||t[0],_y=(t,e={})=>{const i=Jm(e=Object.assign({},e),zm),n=new WeakMap;i.t=t=>{var i;if(null==t||null===(i=t.sources)||void 0===i?void 0:i.length){const i=yy(t.sources),o=null==i?void 0:i.node;if(o){var s,r;const t=null!==(s=null===(r=e.generateTarget)||void 0===r?void 0:r.call(e,o))&&void 0!==s?s:Zm(o);n.set(i,t)}}},((t,e={})=>{const i=ly();gy(dy(()=>{let n,s=ay("CLS",0);const r=Jm(e,zm),o=(i,o,l,a,u)=>{s=ay("CLS",0,i,o,l,a,u),r.o=0,n=ty(t,s,my,e.reportAllChanges)},l=(t=!1)=>{r.o>s.value&&(s.value=r.o,s.entries=r.i),n(t)},a=t=>{l(!0),o("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},u=t=>{for(const e of t)"soft-navigation"!==e.entryType?r.l(e):a(e);l()},h=["layout-shift"];hy(e)&&h.push("soft-navigation");const c=uy(h,u);c&&(n=ty(t,s,my,e.reportAllChanges),i.onHidden(()=>{u(c.takeRecords()),n(!0)}),Xm(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Ym()),ey(n)}),setTimeout(n))}))})(e=>{t((t=>{let e={};if(t.entries.length){var i;const s=t.entries.reduce((t,e)=>t.value>e.value?t:e);if(null==s||null===(i=s.sources)||void 0===i?void 0:i.length){const t=yy(s.sources);t&&(e={largestShiftTarget:n.get(t),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:t,largestShiftEntry:s,loadState:Vm(s.startTime)})}}return Object.assign(t,{attribution:e})})(e))},e)},by=(t,e={})=>{const i=Jm(e=Object.assign({},e),vy);hy(e)&&(i.u=new Map),gy(e=>{t((t=>{let e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:Vm(Ym())};if("soft-navigation"!==t.navigationType){if(t.entries.length){const i=Wm(),n=t.entries.at(-1);if(i){const s=Math.max(0,i.responseStart-(i.activationStart||0));e={timeToFirstByte:s,firstByteToFCP:t.value-s,loadState:Vm(t.entries[0].startTime),navigationEntry:i,fcpEntry:n}}}}else{var n;const s=null===(n=i.u)||void 0===n?void 0:n.get(t.navigationId);s&&(e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:"complete",navigationEntry:s})}return Object.assign(t,{attribution:e})})(e))},e)};let wy=0,ky=1/0,Sy=0;const xy=t=>{for(const e of t)e.interactionId&&(ky=Math.min(ky,e.interactionId),Sy=Math.max(Sy,e.interactionId),wy=Sy?(Sy-ky)/7+1:0)};let Cy;const $y=()=>{var t;return Cy?wy:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var Ty=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return $y()-this.h}D(){this.h=$y(),this.v.length=0,this.p.clear()}S(t){const e=this.T(),i=Math.min(this.v.length-1,Math.floor(e/50));return!e||-1!==i||"soft-navigation"!==t&&"back-forward-cache"!==t?this.v[i]:{k:8,id:-1,entries:[]}}l(t){var e;if(null===(e=this.m)||void 0===e||e.call(this,t),!t.interactionId)return;const i=this.v.at(-1);let n=this.p.get(t.interactionId);if(n||10>this.v.length||t.duration>i.k){var s;if(n?t.duration>n.k?(n.entries=[t],n.k=t.duration):t.duration===n.k&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],k:t.duration},this.p.set(n.id,n),this.v.push(n)),this.v.sort((t,e)=>e.k-t.k),this.v.length>10){const t=this.v.splice(10);for(const e of t)this.p.delete(e.id)}null===(s=this.M)||void 0===s||s.call(this,n)}}};const Ey=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=dy(t);let r=-1;const o=()=>{n(r),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:e})}},Iy=[200,500],My=(t,e={})=>{const i=Jm(e=Object.assign({},e),Ty);let n=[],s=[],r=0;const o=new WeakMap,l=new WeakMap;let a=!1;const u=()=>{a||(Ey(h),a=!0)},h=()=>{const t=new Set(i.v.map(t=>o.get(t.entries[0]))),e=s.length-10;s=s.filter((i,n)=>n>=e||t.has(i));const l=new Set;for(const t of s){const e=c(t.startTime,t.processingEnd);for(const t of e)l.add(t)}n=n.filter(t=>t.startTime>r||l.has(t)),a=!1};i.m=t=>{const i=t.startTime+t.duration;let n;r=Math.max(r,t.processingEnd);for(let r=s.length-1;r>=0;r--){const o=s[r];if(8>=Math.abs(i-o.renderTime)){n=o,n.startTime=Math.min(t.startTime,n.startTime),n.processingStart=Math.min(t.processingStart,n.processingStart),n.processingEnd=Math.max(t.processingEnd,n.processingEnd),e.includeProcessedEventEntries&&n.entries.push(t);break}}n||(n={startTime:t.startTime,processingStart:t.processingStart,processingEnd:t.processingEnd,renderTime:i,entries:e.includeProcessedEventEntries?[t]:[]},s.push(n)),t.interactionId&&o.set(t,n),u()},i.M=t=>{if(!l.get(t)){var i;const o=null===(i=t.entries.find(t=>t.target))||void 0===i?void 0:i.target;if(o){var n,s;const i=null!==(n=null===(s=e.generateTarget)||void 0===s?void 0:s.call(e,o))&&void 0!==n?n:Zm(o);l.set(t,i)}else{var r;const e=null===(r=t.entries.find(t=>t.targetSelector))||void 0===r?void 0:r.targetSelector;e&&l.set(t,e)}}};const c=(t,e)=>{const i=[];for(const s of n)if(s.startTime+s.duration>=t){if(s.startTime>e)break;i.push(s)}return i};uy(["long-animation-frame"],t=>{n=n.concat(t),u()},e),((t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=ly();fy(()=>{var n;"interactionCount"in performance||Cy||(Cy=uy(["event"],xy,{durationThreshold:0}));let s,r=ay("INP");const o=Jm(e,Ty),l=(i,n,l,a,u)=>{o.D(),r=ay("INP",-1,i,n,l,a,u),s=ty(t,r,Iy,e.reportAllChanges)},a=()=>{const t=o.S(r.navigationType);t&&t.k!==r.value&&(r.value=t.k,r.entries=t.entries,s())},u=t=>{a(),s(!0),l("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},h=(t,e=!1)=>{Ey(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.l(e):u(e);a(),e&&s(!0)})},c=["event","first-input"];hy(e)&&c.push("soft-navigation");const d=uy(c,h,ue(ue({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=ty(t,r,Iy,e.reportAllChanges),d&&(i.onHidden(()=>{h(d.takeRecords(),!0)}),Xm(()=>{l("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Ym())}))})})(e=>{t((t=>{if(0===t.entries.length){const e={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:t.value,loadState:Vm(t.navigationStartTime||0)};return Object.assign(t,{attribution:e})}const e=t.entries[0],n=o.get(e),s=Math.max(n.processingStart,e.startTime),r=Math.max(e.startTime+e.duration,s),a=Math.min(n.processingEnd,r),u=n.entries.sort((t,e)=>t.processingStart-e.processingStart),h=c(e.startTime,a),d=i.p.get(e.interactionId),v={interactionTarget:l.get(d),interactionType:e.name.startsWith("key")?"keyboard":"pointer",interactionTime:e.startTime,nextPaintTime:r,processedEventEntries:u,longAnimationFrameEntries:h,inputDelay:s-e.startTime,processingDuration:a-s,presentationDelay:r-a,loadState:Vm(e.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(t=>{var e;const i=t.interactionTime,n=t.nextPaintTime;if(!(null===(e=t.longAnimationFrameEntries)||void 0===e?void 0:e.length)||!i||!n)return;const s=t.inputDelay,r=t.processingDuration;let o,l,a=0,u=0,h=0,c=0;for(const e of t.longAnimationFrameEntries){u=u+e.startTime+e.duration-e.styleAndLayoutStart;for(const t of e.scripts){const e=t.startTime+t.duration;if(i>e)continue;const n=e-Math.max(i,t.startTime),h=t.duration?n/t.duration*t.forcedStyleAndLayoutDuration:0;a+=n-h,u+=h,n>c&&(l=i+s>t.startTime?"input-delay":i+s+r>t.startTime?"processing-duration":"presentation-delay",o=t,c=n)}}const d=t.longAnimationFrameEntries.at(-1),v=d?d.startTime+d.duration:0;v>=i+s+r&&(h=n-v),o&&l&&(t.longestScript={entry:o,subpart:l,intersectingDuration:c}),t.totalScriptDuration=a,t.totalStyleAndLayoutDuration=u,t.totalPaintDuration=h,t.totalUnattributedDuration=n-i-a-u-h})(v),Object.assign(t,{attribution:v})})(e))},e)};var Ry=class{constructor(){this.m=void 0,this.u=void 0}l(t){var e;null===(e=this.m)||void 0===e||e.call(this,t)}};const $=[2500,4e3];let Py=50;const Oy=[];uy(["resource"],t=>{for(const e of t)Oy.push(e),Oy.length>Py&&Oy.shift()});const Ay=(t,e={})=>{null!=(e=Object.assign({},e)).resourceBufferSize&&(Py=e.resourceBufferSize);const i=Jm(e,Ry),n=new WeakMap;hy(e)&&(i.u=new Map),i.m=t=>{const i=t.element;if(i){var s,r;const o=null!==(s=null===(r=e.generateTarget)||void 0===r?void 0:r.call(e,i))&&void 0!==s?s:Zm(i);n.set(t,o)}else t.id&&n.set(t,`#${t.id}`)},((t,e={})=>{let i=!1;const n=hy(e);fy(()=>{let s,r=ly(),o=ay("LCP");const l=Jm(e,Ry),a=(n,l,a,u,h)=>{o=ay("LCP",-1,n,l,a,u,h),s=ty(t,o,$,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=ly(!0))},u=t=>{var e;l.u&&t.navigationId&&cy(l.u,t),i||s(!0),a("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime);const n=null===(e=t.getLargestInteractionContentfulPaint)||void 0===e?void 0:e.call(t);n&&h([n])},h=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],a=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-iy(),0),l.l(e),n=[e];else if("interaction-contentful-paint"===e.entryType){var i;const s=e;if(!o.navigationId)continue;if("interactionId"in s&&s.interactionId!=o.navigationInteractionId)continue;a=(null===(i=s.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,t=Math.max(a-e.startTime,0),s.largestContentfulPaint&&(l.l(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>a&&(o.value=t,o.entries=n,s())}},c=["largest-contentful-paint"];n&&c.push("interaction-contentful-paint","soft-navigation");const d=uy(c,h);if(d){s=ty(t,o,$,e.reportAllChanges);const r=["keydown","click","visibilitychange"],l=t=>{if(t.isTrusted&&!i){const t=o.id;Ey(()=>{if(!i){if(!n){d.disconnect();for(const t of r)removeEventListener(t,l,{capture:!0})}t===o.id&&(i=!0,s(!0))}})}};for(const t of r)addEventListener(t,l,{capture:!0});Xm(n=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Ym()),s=ty(t,o,$,e.reportAllChanges),ey(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})})(e=>{t((t=>{let e={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:t.value};if(t.entries.length){var s,r,o;const l=t.entries.at(-1),a=l.url&&(Oy.findLast(t=>t.name===l.url)||performance.getEntriesByType("resource").findLast(t=>t.name===l.url));let u;e.target=n.get(l),e.lcpEntry=l,l.url&&(e.url=l.url),a&&(e.lcpResourceEntry=a);let h=0,c=0;if("soft-navigation"!==t.navigationType?(u=Wm(),h=null!==(s=null==u?void 0:u.activationStart)&&void 0!==s?s:0,c=null!==(r=null==u?void 0:u.responseStart)&&void 0!==r?r:0):(h=t.navigationStartTime||0,u=null===(o=i.u)||void 0===o?void 0:o.get(t.navigationId)),u){const i=Math.max(0,c-h),n=Math.max(i,a?(a.requestStart||a.startTime)-h:0),s=Math.min(t.value,Math.max(n,a?a.responseEnd-h:0));e=ue(ue({},e),{},{timeToFirstByte:i,resourceLoadDelay:n-i,resourceLoadDuration:s-n,elementRenderDelay:t.value-s,navigationEntry:u})}}return Object.assign(t,{attribution:e})})(e))},e)};let Fy=-1;const Dy=()=>Fy,Ly=t=>{addEventListener("pageshow",e=>{e.persisted&&(Fy=e.timeStamp,t(e))},!0)},Ny=(t,e,i,n)=>{let s,r;return o=>{var l;e.value>=0&&(o||n)&&(r=e.value-(null!==(l=s)&&void 0!==l?l:0),(r||void 0===s)&&(s=e.value,e.delta=r,e.rating=((t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good")(e.value,i),t(e)))}},qy=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},By=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},jy=()=>{var t,e;return null!==(t=null===(e=By())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let Hy=-1;const Uy=new Set,zy=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Wy=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of Uy)t();isFinite(Hy)||(Hy="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",Wy,!0))}},Vy=(t=!1)=>{if(t&&(Hy=1/0),0>Hy){var e;const t=jy(),i=document.prerendering||null===(e=globalThis.performance.getEntriesByType("visibility-state").find(e=>"hidden"===e.name&&e.startTime>=t))||void 0===e?void 0:e.startTime;Hy=null!=i?i:zy(),addEventListener("visibilitychange",Wy,!0),addEventListener("prerenderingchange",Wy,!0),Ly(()=>{setTimeout(()=>{Hy=zy()})})}return{get firstHiddenTime(){return Hy},onHidden(t){Uy.add(t)}}},Gy=(t,e=-1,i,n=0,s,r,o)=>{const l=By(),a=(null==l?void 0:l.navigationId)||0;let u="navigate";return i?u=i:0>Dy()?l&&(document.prerendering||jy()>0?u="prerender":document.wasDiscarded?u="restore":l.type&&(u=l.type.replace(/_/g,"-"))):u="back-forward-cache",{name:t,value:e,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:u,navigationId:n||a,navigationInteractionId:s,navigationURL:r||(null==l?void 0:l.name),navigationStartTime:o||0}},Zy=new WeakMap;function Qy(t,e){let i=Zy.get(e);return i||(i=new WeakMap,Zy.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}var Jy=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(t){var e;if(t.hadRecentInput)return;const i=this.o[0],n=this.o.at(-1);this.i&&i&&n&&1e3>t.startTime-n.startTime&&5e3>t.startTime-i.startTime?(this.i+=t.value,this.o.push(t)):(this.i=t.value,this.o=[t]),null===(e=this.t)||void 0===e||e.call(this,t)}};const Ky=(t,e,i={})=>{try{const n=t.filter(t=>PerformanceObserver.supportedEntryTypes.includes(t));if(n.length>0){const t=new PerformanceObserver(t=>{queueMicrotask(()=>{const i=t.getEntries();n.length>1&&i.sort((t,e)=>t.startTime+t.duration-(e.startTime+e.duration)),e(i)})});for(const e of n)t.observe(ue({type:e,buffered:!0},i));return t}}catch(t){}},Yy=t=>{var e,i;return(null===(e=globalThis.PerformanceObserver)||void 0===e||null===(e=e.supportedEntryTypes)||void 0===e?void 0:e.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&t&&t.reportSoftNavs},Xy=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},t_=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var e_=class{constructor(){this.l=void 0}};const i_=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},n_=[1800,3e3],s_=(t,e={})=>{const i=Yy(e);i_(()=>{const n=Qy(e,e_),s=Vy();let r,o=Gy("FCP");const l=Ky(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(l.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-jy(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});l&&(r=Ny(t,o,n_,e.reportAllChanges),Ly(i=>{o=Gy("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Dy()),r=Ny(t,o,n_,e.reportAllChanges),qy(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Ky(["soft-navigation"],i=>{i.forEach(i=>{n.l&&i.navigationId&&Xy(n.l,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Gy("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Ny(t,o,n_,e.reportAllChanges),r(!0)})},e)})},r_=[.1,.25],o_=(t,e={})=>{const i=Vy();s_(t_(()=>{let n,s=Gy("CLS",0);const r=Qy(e,Jy),o=(i,o,l,a,u)=>{s=Gy("CLS",0,i,o,l,a,u),r.i=0,n=Ny(t,s,r_,e.reportAllChanges)},l=(t=!1)=>{r.i>s.value&&(s.value=r.i,s.entries=r.o),n(t)},a=t=>{l(!0),o("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},u=t=>{for(const e of t)"soft-navigation"!==e.entryType?r.h(e):a(e);l()},h=["layout-shift"];Yy(e)&&h.push("soft-navigation");const c=Ky(h,u);c&&(n=Ny(t,s,r_,e.reportAllChanges),i.onHidden(()=>{u(c.takeRecords()),n(!0)}),Ly(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Dy()),qy(n)}),setTimeout(n))}))};let l_=0,a_=1/0,u_=0;const h_=t=>{for(const e of t)e.interactionId&&(a_=Math.min(a_,e.interactionId),u_=Math.max(u_,e.interactionId),l_=u_?(u_-a_)/7+1:0)};let c_;const d_=()=>{var t;return c_?l_:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var v_=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return d_()-this.u}M(){this.u=d_(),this.v.length=0,this.m.clear()}L(t){const e=this._(),i=Math.min(this.v.length-1,Math.floor(e/50));return!e||-1!==i||"soft-navigation"!==t&&"back-forward-cache"!==t?this.v[i]:{P:8,id:-1,entries:[]}}h(t){var e;if(null===(e=this.p)||void 0===e||e.call(this,t),!t.interactionId)return;const i=this.v.at(-1);let n=this.m.get(t.interactionId);if(n||10>this.v.length||t.duration>i.P){var s;if(n?t.duration>n.P?(n.entries=[t],n.P=t.duration):t.duration===n.P&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],P:t.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((t,e)=>e.P-t.P),this.v.length>10){const t=this.v.splice(10);for(const e of t)this.m.delete(e.id)}null===(s=this.T)||void 0===s||s.call(this,n)}}};const f_=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=t_(t);let r=-1;const o=()=>{n(r),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:e})}},p_=[200,500],g_=(t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Vy();i_(()=>{var n;"interactionCount"in performance||c_||(c_=Ky(["event"],h_,{durationThreshold:0}));let s,r=Gy("INP");const o=Qy(e,v_),l=(i,n,l,a,u)=>{o.M(),r=Gy("INP",-1,i,n,l,a,u),s=Ny(t,r,p_,e.reportAllChanges)},a=()=>{const t=o.L(r.navigationType);t&&t.P!==r.value&&(r.value=t.P,r.entries=t.entries,s())},u=t=>{a(),s(!0),l("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},h=(t,e=!1)=>{f_(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.h(e):u(e);a(),e&&s(!0)})},c=["event","first-input"];Yy(e)&&c.push("soft-navigation");const d=Ky(c,h,ue(ue({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=Ny(t,r,p_,e.reportAllChanges),d&&(i.onHidden(()=>{h(d.takeRecords(),!0)}),Ly(()=>{l("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Dy())}))})};var m_=class{constructor(){this.p=void 0,this.l=void 0}h(t){var e;null===(e=this.p)||void 0===e||e.call(this,t)}};const y_=[2500,4e3],__=(t,e={})=>{let i=!1;const n=Yy(e);i_(()=>{let s,r=Vy(),o=Gy("LCP");const l=Qy(e,m_),a=(n,l,a,u,h)=>{o=Gy("LCP",-1,n,l,a,u,h),s=Ny(t,o,y_,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=Vy(!0))},u=t=>{var e;l.l&&t.navigationId&&Xy(l.l,t),i||s(!0),a("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime);const n=null===(e=t.getLargestInteractionContentfulPaint)||void 0===e?void 0:e.call(t);n&&h([n])},h=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],a=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-jy(),0),l.h(e),n=[e];else if("interaction-contentful-paint"===e.entryType){var i;const s=e;if(!o.navigationId)continue;if("interactionId"in s&&s.interactionId!=o.navigationInteractionId)continue;a=(null===(i=s.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,t=Math.max(a-e.startTime,0),s.largestContentfulPaint&&(l.h(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>a&&(o.value=t,o.entries=n,s())}},c=["largest-contentful-paint"];n&&c.push("interaction-contentful-paint","soft-navigation");const d=Ky(c,h);if(d){s=Ny(t,o,y_,e.reportAllChanges);const r=["keydown","click","visibilitychange"],l=t=>{if(t.isTrusted&&!i){const t=o.id;f_(()=>{if(!i){if(!n){d.disconnect();for(const t of r)removeEventListener(t,l,{capture:!0})}t===o.id&&(i=!0,s(!0))}})}};for(const t of r)addEventListener(t,l,{capture:!0});Ly(n=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Dy()),s=Ny(t,o,y_,e.reportAllChanges),qy(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})},b_={onLCP:Ay,onCLS:_y,onFCP:by,onINP:My,withoutAttribution:{onLCP:__,onCLS:o_,onFCP:s_,onINP:g_}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=b_,d.__PosthogExtensions__.postHogWebVitalsCallbacks=b_,d.postHogWebVitalsCallbacks=b_;const w_={onLCP:__,onCLS:o_,onFCP:s_,onINP:g_};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=w_,d.__PosthogExtensions__.postHogWebVitalsCallbacks=w_,d.postHogWebVitalsCallbacks=w_,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>w_;const k_={onLCP:Ay,onCLS:_y,onFCP:by,onINP:My,withoutAttribution:{onLCP:__,onCLS:o_,onFCP:s_,onINP:g_}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=k_,d.__PosthogExtensions__.postHogWebVitalsCallbacks=k_,d.postHogWebVitalsCallbacks=k_;const S_={onLCP:__,onCLS:o_,onFCP:s_,onINP:g_};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=S_,d.__PosthogExtensions__.postHogWebVitalsCallbacks=S_,d.postHogWebVitalsCallbacks=S_,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>S_;var x_=class{constructor(t){this.disabled=!1===t;const e=Ce(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;const n=this.clicks[this.clicks.length-1];if(n&&Math.abs(t-n.x)+Math.abs(e-n.y)<this.thresholdPx&&this.timeoutMs>i-n.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}};const C_="$copy_autocapture",$_=Gs("[AutoCapture]");function T_(t,e){return e.length>t?e.slice(0,t)+"...":e}function E_(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do{e=e.previousSibling}while(e&&!mr(e));return e}function I_(e,{e:i,maskAllElementAttributes:n,maskAllText:s,elementAttributeIgnoreList:r,elementsChainAsString:o,disableCaptureUrlHashes:l}){var a,u;if(!mr(e))return{props:{}};const h=[e],c=new Set([e]);let d=e;for(;d.parentNode&&!yr(d,"body")&&1e3>h.length;){if(br(d.parentNode)){const t=d.parentNode.host;if(c.has(t))break;c.add(t),h.push(t),d=t;continue}if(!mr(d.parentNode))break;if(c.has(d.parentNode))break;c.add(d.parentNode),h.push(d.parentNode),d=d.parentNode}const v="click"===i.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?h.findIndex(t=>yr(t,"button")||yr(t,"a")):-1;v>0&&(s=s||h.slice(0,v+1).some(t=>!Hr(t)||Ur(t)));const f=[],p={};let g,m=!1,y=!1;if(Qs(h,t=>{const e=Hr(t);if(yr(t,"a")&&!n&&!(null==r?void 0:r.includes("href"))){const i=t.getAttribute("href");m=!!(e&&i&&Kr(i))&&(l?un(i):i)}ge(Sr(t),"ph-no-capture")&&(y=!0),f.push(function(t,e,i,n,s=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};Tr.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?T_(1024,Yr(t)):T_(1024,Cr(t)));const l=Sr(t);e||(null==n?void 0:n.includes("class"))||0>=l.length||(o.classes=l.filter(function(t){return""!==t})),Qs(t.attributes,function(i){var r;if((!Ur(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==n?void 0:n.includes(i.name))&&!e&&Kr(i.value)&&(!Ee(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=i.value;"class"===i.name&&(t=wr(t).join(" ")),o["attr__"+i.name]=T_(1024,"href"===i.name&&s?un(t):t)}});let a=1,u=1,h=t;for(;h=E_(h);)a++,h.tagName===t.tagName&&u++;return o.nth_child=a,o.nth_of_type=u,o}(t,n,s,r,l)),Qs(function(t){if(!Hr(t))return{};const e={};return Qs(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){const i=t.name.replace("data-ph-capture-attribute-",""),n=t.value;i&&n&&Kr(n)&&(e[i]=n)}}),e}(t),(t,e)=>{({}).hasOwnProperty.call(p,e)||(p[e]=t)})}),y)return{props:{},explicitNoCapture:y};if(v>0&&(e=h[v],f.splice(0,v)),s||(f[0].$el_text=yr(e,"a")||yr(e,"button")?Yr(e):Cr(e)),m){var _,b;f[0].attr__href=m;const e=null===(_=lr(m))||void 0===_?void 0:_.host,i=null==t||null===(b=t.location)||void 0===b?void 0:b.host;e&&i&&e!==i&&(g=m)}return{props:Js((k=i.type,{$event_type:k,$ce_version:1}),o?{}:{$elements:f},{$elements_chain:(w=f,Se(w)?function(t){return t.map(t=>{var e,i;let n="";if(t.tag_name&&(n+=t.tag_name),t.attr_class){t.attr_class.sort();for(const e of t.attr_class)n+=`.${e.replace(/"/g,"")}`}const s=ue(ue(ue(ue({},t.text?{text:t.text}:{}),{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(i=t.nth_of_type)&&void 0!==i?i:0},t.href?{href:t.href}:{}),t.attr_id?{attr_id:t.attr_id}:{}),t.attributes),r={};return Ks(s).sort(([t],[e])=>function(t,e){return e>t?-1:t>e?1:0}(t,e)).forEach(([t,e])=>r[to(t.toString())]=to(e.toString())),n+=":",n+=Ks(r).map(([t,e])=>`${t}="${e}"`).join(""),n}).join(";")}(function(t){return t.map(t=>{var e,i;const n={text:null===(e=t.$el_text)||void 0===e?void 0:e.slice(0,400),tag_name:t.tag_name,href:null===(i=t.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:eo(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Ks(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,e])=>n.attributes[t]=e),n})}(w)):"")},(null===(a=f[0])||void 0===a?void 0:a.$el_text)?{$el_text:null===(u=f[0])||void 0===u?void 0:u.$el_text}:{},g&&"click"===i.type?{$external_click_url:g}:{},p),target:e};var w,k}var M_=class{uo(){this.ho=void 0,clearTimeout(this.co),this.co=void 0}do(t){var e;if(!Hr(t))return!0;const i=null!==(e=this.vo().css_selector_ignorelist)&&void 0!==e?e:Rr,n=new Set;let s=t;for(;s;){if(n.size>=1e3||n.has(s))return!0;n.add(s);const t=s,e=Sr(t);if(ge(e,"ph-no-capture")||ge(e,"ph-sensitive")||Ur(t)||i.some(e=>Er(t,e)))return!0;const r=s.parentNode;s=br(r)?r.host:r&&mr(r)?r:null}return!1}fo(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.uo();if("pointerdown"===t.type){this.uo();const i=$r(t);var e;return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&i&&mr(i)&&(this.ho={target:i,excluded:this.do(i),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(e=this.po)||void 0===e?void 0:e.distinctId}))}const i=this.ho;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.uo():"pointerup"===t.type&&(i.released=!0,this.co=setTimeout(()=>this.uo(),0)))}mo(t){var e;const i=this.ho;this.uo();const s=$r(t);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(e=this.po)||void 0===e?void 0:e.distinctId)&&t.pointerId===i.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-i.x)&&5>=Math.abs(t.clientY-i.y)&&s&&(yr(s,"html")||yr(s,"body"))){var r;if(i.excluded)return null;const t=null!==(r=this.vo().css_selector_ignorelist)&&void 0!==r?r:Rr;return[s,null==n?void 0:n.documentElement,null==n?void 0:n.body].some(e=>{if(!e)return!1;const i=Sr(e);return ge(i,"ph-no-capture")||ge(i,"ph-sensitive")||!Hr(e)||Ur(e)||t.some(t=>Er(e,t))})?null:i.target}}constructor(t){this.yo=t,this.name="autocapture",this.bo=!1,this._o=null,this.wo=!1,this.ko=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.So=!1,this.yo.refresh(this.Mr),this.rageclicks=new x_(this.Mr.rageclick),this.xo=null}setup(t){this.Co(),this.po=t;const e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.So?e.dispose():(this.$o=e,this.startIfEnabled())}dispose(){var t;this.So||(this.So=!0,this.po=void 0,null===(t=this.$o)||void 0===t||t.dispose(),this.$o=void 0,this.To())}vo(){return this.yo.refresh(this.Mr),this.Mr}Co(){var t,e;return this.vo(),this.Mr.url_allowlist=null===(t=this.Mr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Mr.url_ignorelist=null===(e=this.Mr.url_ignorelist)||void 0===e?void 0:e.map(t=>new RegExp(t)),this.Mr}Io(){if(!this.isBrowserSupported())return void $_.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!n)return;const e=this.Mo=e=>{e=e||(null==t?void 0:t.event);try{if("blur"===e.type)return void this.uo();if(0===e.type.indexOf("pointer"))return void this.fo(e);const t="click"===e.type?this.mo(e):void 0;if(Me(t))return;this.Eo(e,"$autocapture",t)}catch(t){$_.error("Failed to capture event",t)}};if(nr(t,"blur",e),nr(n,"submit",e,{capture:!0}),nr(n,"change",e,{capture:!0}),nr(n,"click",e,{capture:!0}),Qs(["pointerdown","pointermove","pointerup","pointercancel"],t=>{nr(n,t,e,{capture:!0})}),this.vo().capture_copied_text){const e=this.Po=e=>{e=e||(null==t?void 0:t.event);try{this.Eo(e,C_)}catch(t){$_.error("Failed to capture clipboard event",t)}};nr(n,"copy",e,{capture:!0}),nr(n,"cut",e,{capture:!0}),nr(n,"paste",e,{capture:!0})}}To(){this.uo(),this.Mo&&(null==t||t.removeEventListener("blur",this.Mo),Qs(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==n||n.removeEventListener(t,this.Mo,!0)}),null==n||n.removeEventListener("submit",this.Mo,!0),null==n||n.removeEventListener("change",this.Mo,!0),null==n||n.removeEventListener("click",this.Mo,!0),this.Mo=void 0),this.Po&&(null==n||n.removeEventListener("copy",this.Po,!0),null==n||n.removeEventListener("cut",this.Po,!0),null==n||n.removeEventListener("paste",this.Po,!0),this.Po=void 0),this.bo=!1}startIfEnabled(){this.isEnabled||this.uo(),!this.So&&this.po&&this.isEnabled&&!this.bo&&(this.Io(),this.bo=!0)}onRemoteConfig(t){if(this.So)return;if(this.wo=!0,!t.ok)return void this.startIfEnabled();const e=t.config;e.elementsChainAsString&&(this.ko=e.elementsChainAsString);const i=e.autocapture_opt_out;var n;Ae(i)&&(null===(n=this.po)||void 0===n||n.kv.set("$autocapture_disabled_server_side",i),this._o=i),this.startIfEnabled()}setElementSelectors(t){this.xo=t}getElementSelectors(t,e){var i;const s=[];return null===(i=this.xo)||void 0===i||i.forEach(i=>{const r=null==n?void 0:n.querySelectorAll(i);null==r||r.forEach(n=>{t!==n&&e!==n||ge(s,i)||s.push(i)})}),s}get isEnabled(){var t,e;if(this.So)return!1;const i=null===(t=this.po)||void 0===t?void 0:t.kv.get(x),n=this._o,s=this.vo();if(!s.remoteRequestsDisabled&&!this.wo)return!1;const r=s.remoteRequestsDisabled&&!this.wo;if(Me(n)&&!Ae(i)&&!r)return!1;const o=null!==(e=this._o)&&void 0!==e?e:!!i;return!!s.enabled&&!o}Eo(e,i="$autocapture",n){if(!this.isEnabled)return void this.uo();let s=n||$r(e);_r(s)&&(s=s.parentNode||null);const r=this.Co();var o;"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&r.rageclick&&(null===(o=this.rageclicks)||void 0===o?void 0:o.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&qr(s,r.rageclick)&&this.Eo(e,"$rageclick",n);const l=i===C_,a=l?ue(ue({},r),{},{dom_event_allowlist:void 0}):r;if(s&&function(e,i,n,s,r,o){var l;if(!t||Br(e))return!1;if((null==n?void 0:n.url_allowlist)&&!kr(n.url_allowlist,o))return!1;if((null==n?void 0:n.url_ignorelist)&&kr(n.url_ignorelist,o))return!1;if(null==n?void 0:n.dom_event_allowlist){const t=n.dom_event_allowlist;if(t&&!t.some(t=>i.type===t))return!1}const{parentIsUsefulElement:a,targetElementList:u}=jr(e,s);if(!function(t,e){const i=null==e?void 0:e.element_allowlist;if(Te(i))return!0;for(const e of t)if(i.some(t=>e.tagName.toLowerCase()===t))return!0;return!1}(u,n))return!1;if(!Ir(u,null==n?void 0:n.css_selector_allowlist))return!1;if(Ir(u,null!==(l=null==n?void 0:n.css_selector_ignorelist)&&void 0!==l?l:Rr))return!1;try{const n=t.getComputedStyle(e);if(n&&"pointer"===n.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}const h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(r||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(i.type)>=0;default:return a?(r||["click"]).indexOf(i.type)>=0:(r||["click"]).indexOf(i.type)>=0&&(Tr.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,a,l,l?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var u;const{props:n,explicitNoCapture:o,target:l}=I_(s,{e:e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.ko,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(o)return!1;const a=this.getElementSelectors(s,l);if(a&&a.length>0&&(n.$element_selectors=a),i===C_){const i=e.type||"clipboard";if("paste"!==i){var h,c;const e=null==t||null===(h=t.getSelection())||void 0===h?void 0:h.toString(),i=xr(e);if(!i)return!1;n.$selected_content=i,n.$clipboard_text_length=null!==(c=null==e?void 0:e.length)&&void 0!==c?c:0}n.$copy_type=i}return null===(u=this.po)||void 0===u||u.capture(i,n).catch(t=>$_.error("Failed to capture event",t)),!0}}isBrowserSupported(){return xe(null==n?void 0:n.querySelectorAll)}};const R_={};function P_(t,e){const i=$r(t);return i?ue({node:i,originalEvent:t,timestamp:Date.now()},e):null}function O_(t,e){return Math.abs(t)<Math.abs(e)?0>e?"up":"down":0>t?"left":"right"}function A_(t){return"swipe"===t.type?"$dead_swipe":"$dead_click"}const F_="canvas,video,audio,embed,object";function D_(t,e){return Pe(t)&&t>=e}function L_(t,e=1e3){return t>=0&&e>t?t:void 0}function N_(t,e,i=1e3){return Pe(e)?L_(t-e,i):void 0}var q_=class{cr(t){var e,i,n,s,r,o,l,a;const u=this.dr((null==t?void 0:t.__onCapture)||this.hr.bind(this));return{element_attribute_ignorelist:null!==(e=null==t?void 0:t.element_attribute_ignorelist)&&void 0!==e?e:u.element_attribute_ignorelist,scroll_threshold_ms:null!==(i=null==t?void 0:t.scroll_threshold_ms)&&void 0!==i?i:u.scroll_threshold_ms,selection_change_threshold_ms:null!==(n=null==t?void 0:t.selection_change_threshold_ms)&&void 0!==n?n:u.selection_change_threshold_ms,mutation_threshold_ms:null!==(s=null==t?void 0:t.mutation_threshold_ms)&&void 0!==s?s:u.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(r=null==t?void 0:t.capture_clicks_with_modifier_keys)&&void 0!==r?r:u.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==t?void 0:t.capture_dead_swipes)&&void 0!==o?o:u.capture_dead_swipes,swipe_threshold_px:null!==(l=null==t?void 0:t.swipe_threshold_px)&&void 0!==l?l:u.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(a=null==t?void 0:t.max_dead_swipes_per_page_load)&&void 0!==a?a:u.max_dead_swipes_per_page_load,css_selector_ignorelist:null==t?void 0:t.css_selector_ignorelist,__onCapture:u.__onCapture}}constructor(t,e){this.instance=t,this.vr=!1,this.pr=[],this.mr=0,this.dr=t=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,capture_clicks_with_modifier_keys:!1,capture_dead_swipes:!0,swipe_threshold_px:30,max_dead_swipes_per_page_load:10,__onCapture:t}),this.gr=()=>{clearTimeout(this.yr),this.yr=void 0,this.br=void 0},this.wr=t=>{if(this.gr(),0===t.button){const e={path:t.composedPath(),trusted:t.isTrusted,selectionChanged:!1,selectionInitiallyRelated:!1},i=null==n?void 0:n.getSelection();e.selectionInitiallyRelated="Range"===(null==i?void 0:i.type)&&this.kr(i,e),this.br=e}},this._r=t=>{Me(t.relatedTarget)&&this.gr()},this.Sr=t=>{const e=this.br,i=t;if(!e||0!==i.button||t.isTrusted!==e.trusted)return;const n=t.composedPath();for(const t of e.path)if(mr(t)&&-1!==n.indexOf(t)){e.clickTarget=t;break}e.clickDetail=i.detail,this.yr=d.setTimeout(this.gr,0)},this.Cr=t=>{const e=t,i=P_(e,{type:"click"}),n=this.br;i&&n&&0===e.button&&e.detail>0&&e.detail===n.clickDetail&&t.isTrusted===n.trusted&&i.node===n.clickTarget&&(i.selectionChangedDuringGesture=n.selectionChanged&&this.Mr.selection_change_threshold_ms>0,this.gr()),Me(i)||this.Ir(i)||this.Tr(i),this.Rr()},this.$r=()=>{const t=Date.now();this.Er=t,t%50==0&&this.pr.forEach(e=>{Te(e.scrollDelayMs)&&(e.scrollDelayMs=t-e.timestamp)})},this.Ar=t=>{var e,i;const s=null==n?void 0:n.getSelection(),r=this.vr;this.vr="Range"===(null==s?void 0:s.type);const o=null==s?void 0:s.focusNode,l=o&&(mr(o)?o:o.parentElement),a=null==n?void 0:n.activeElement;let u=a;for(;null==u||null===(e=u.shadowRoot)||void 0===e?void 0:e.activeElement;)u=u.shadowRoot.activeElement;const h=Nr($r(t))||Nr(null!=l?l:null)||Nr(null!==(i=u)&&void 0!==i?i:null),c="Caret"===(null==s?void 0:s.type)&&u&&!u.shadowRoot&&o&&o!==a&&o.contains(null!=a?a:null);if(!(r||this.vr||h||c))return;const d=Date.now();this.Or=d;const v=this.br;if(v&&(r||this.vr||h)){const e=$r(t);let i;if(Nr(e))i=e;else if("Caret"===(null==s?void 0:s.type)){var f;Nr(null!==(f=u)&&void 0!==f?f:null)||c?i=u:h&&(i=l)}const n=i?this.Lr(i,v):s&&(o||s.anchorNode)?this.kr(s,v):r&&!this.vr&&v.selectionInitiallyRelated;v.selectionChanged=v.selectionChanged||n}this.pr.forEach(t=>{const e=d-t.timestamp;0>e||!Te(t.selectionChangedDelayMs)&&e>=t.selectionChangedDelayMs||(t.selectionChangedDelayMs=e)})},this.an=()=>{"hidden"===(null==n?void 0:n.visibilityState)&&this.gr();const t=Date.now();this.Pr=t,this.Dr("visibilityChangedDelayMs",t)},this.Fr=()=>{const t=Date.now();this.Nr=t,this.Dr("focusChangedDelayMs",t)},this.qr=t=>{const e=t.touches,i=1===(null==e?void 0:e.length)?e[0]:void 0;this.jr=i?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this.Br=()=>{this.jr=void 0},this.Hr=t=>{var e;const i=this.jr;if(this.jr=void 0,Te(i)||this.mr>=this.Mr.max_dead_swipes_per_page_load)return;const s=t,r=null===(e=s.changedTouches)||void 0===e?void 0:e[0];if(!r)return;const o=r.clientX-i.x,l=r.clientY-i.y,a=o*o+l*l,u=this.Mr.swipe_threshold_px;if(u*u>a)return;if([this.Er,this.zr,this.Or].some(t=>Pe(t)&&t>=i.timestamp))return;var h,c;if(this.Ur()&&(null!==(h=null==n||null===(c=n.elementsFromPoint)||void 0===c?void 0:c.call(n,i.x,i.y))&&void 0!==h?h:[]).some(t=>{var e;return null===(e=t.matches)||void 0===e?void 0:e.call(t,F_)}))return;const d=P_(s,{type:"swipe",swipeDirection:O_(o,l),swipeDistancePx:Math.round(Math.sqrt(a))});Me(d)||this.Ir(d)||this.Tr(d),this.Rr()},this.Mr=this.cr(e),this._onCapture=this.Mr.__onCapture}start(t){this.Wr(),this.Vr(),this.Zr(),this.Gr(),this.Qr(),this.Jr(t),this.Mr.capture_dead_swipes&&this.Kr()}Jr(e){if(!this.Xr){const i=function(e){return function(e,i){const n=R_[e];if(n)return n;let s=i[e];if((t=>xe(t)&&-1!==t.toString().indexOf("[native code]"))(s)&&!(null==t?void 0:t.Zone))return R_[e]=s.bind(i);const r=i.document;if(r&&xe(r.createElement)){let t,n=!1;try{t=r.createElement("iframe"),t.hidden=!0,r.head.appendChild(t);const a=t.contentWindow;var o,l;a&&a[e]&&(s=a[e],"MutationObserver"===e&&function(t){return ge(t,"AppleWebKit")&&!ge(t,"Chrome")}(null!==(o=null===(l=i.navigator)||void 0===l?void 0:l.userAgent)&&void 0!==o?o:"")&&(t.classList.add("rr-block","ph-no-capture"),n=!0))}catch(t){Vs.warn(`Could not create sandbox iframe for ${e} check, bailing to assignableWindow.${e}: `,t)}finally{!n&&(null==t?void 0:t.parentNode)&&t.parentNode.removeChild(t)}}return s&&xe(s)?R_[e]=s.bind(i):s}("MutationObserver",e)}(d);this.Xr=new i(t=>{this.Yr(t)}),this.Xr.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var t;null===(t=this.Xr)||void 0===t||t.disconnect(),this.Xr=void 0,d.removeEventListener("click",this.Cr,{capture:!0}),d.removeEventListener("mousedown",this.wr,{capture:!0}),d.removeEventListener("mouseup",this.Sr,{capture:!0}),d.removeEventListener("mouseout",this._r,{capture:!0}),d.removeEventListener("dragstart",this.gr,{capture:!0}),d.removeEventListener("pointercancel",this.gr,{capture:!0}),d.removeEventListener("blur",this.gr),this.gr(),d.removeEventListener("scroll",this.$r,{capture:!0}),null==n||n.removeEventListener("selectionchange",this.Ar),d.removeEventListener("touchstart",this.qr,{capture:!0}),d.removeEventListener("touchend",this.Hr,{capture:!0}),d.removeEventListener("touchcancel",this.Br,{capture:!0}),null==n||n.removeEventListener("visibilitychange",this.an),d.removeEventListener("blur",this.Fr),d.removeEventListener("focus",this.Fr),this.jr=void 0}Yr(t){this.zr=Date.now()}Wr(){nr(d,"click",this.Cr,{capture:!0}),nr(d,"mousedown",this.wr,{capture:!0}),nr(d,"mouseup",this.Sr,{capture:!0}),nr(d,"mouseout",this._r,{capture:!0}),nr(d,"dragstart",this.gr,{capture:!0}),nr(d,"pointercancel",this.gr,{capture:!0}),nr(d,"blur",this.gr)}Tr(t){t.selectionChangedDelayMs=N_(t.timestamp,this.Or,this.Mr.selection_change_threshold_ms),t.visibilityChangedDelayMs=N_(t.timestamp,this.Pr),t.focusChangedDelayMs=N_(t.timestamp,this.Nr),this.pr.push(t)}Rr(){this.pr.length&&Te(this.eo)&&(this.eo=d.setTimeout(()=>{this.no()},1e3))}Vr(){nr(d,"scroll",this.$r,{capture:!0})}Zr(){var t;this.vr="Range"===(null==n||null===(t=n.getSelection())||void 0===t?void 0:t.type),nr(n,"selectionchange",this.Ar)}Lr(t,e){const i=e.path[0];for(;t;){if(-1!==e.path.indexOf(t)||mr(i)&&i.contains(t))return!0;t=t.getRootNode().host}return!1}kr(t,e){const i=e.path[0],n=t.rangeCount>0?t.getRangeAt(0):void 0;if(n&&mr(i)&&n.startContainer.getRootNode()===i.getRootNode()){var s;if(!n.collapsed)return n.intersectsNode(i);const t=mr(n.startContainer)&&null!==(s=n.startContainer.childNodes[n.startOffset])&&void 0!==s?s:n.startContainer;return this.Lr(t,e)}return this.Lr(t.focusNode,e)||this.Lr(t.anchorNode,e)}Gr(){nr(n,"visibilitychange",this.an)}Qr(){nr(d,"blur",this.Fr),nr(d,"focus",this.Fr)}Dr(t,e){this.pr.forEach(i=>{const n=L_(e-i.timestamp);Pe(n)&&(Te(i[t])||i[t]>n)&&(i[t]=n)})}Kr(){nr(d,"touchstart",this.qr,{capture:!0,passive:!0}),nr(d,"touchend",this.Hr,{capture:!0,passive:!0}),nr(d,"touchcancel",this.Br,{capture:!0,passive:!0})}Ur(){const t=Te(this.io)||Pe(this.zr)&&this.zr>this.io;return(Te(this.ro)||t)&&(this.io=Date.now(),this.ro=!!(null==n?void 0:n.querySelector(F_))),!!this.ro}Ir(t){return!t||("swipe"===t.type?this.oo(t):this.so(t))}oo(e){return!(!gr(e.node)&&!this.pr.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!yr(e.node,"html")&&mr(e.node)&&function(e,i){var n;if(!t||Br(e))return!1;const s=Ae(i)?Fr:null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:Fr,{targetElementList:r}=jr(e,!1);return!Ir(r,s)}(e.node,{css_selector_ignorelist:this.Mr.css_selector_ignorelist}))}so(e){return!(this.Mr.capture_clicks_with_modifier_keys||(i=e.originalEvent,!(i.ctrlKey||i.metaKey||i.altKey||i.shiftKey)))||!!this.oo(e)||function(e){if(!t||Br(e))return!1;const{targetElementList:i}=jr(e,!1);return i.some(t=>yr(t,"a"))}(e.node);var i}no(){if(!this.pr.length)return;clearTimeout(this.eo),this.eo=void 0;const t=this.pr;this.pr=[];for(const i of t){var e;i.mutationDelayMs=null!==(e=i.mutationDelayMs)&&void 0!==e?e:this.zr&&this.zr>=i.timestamp?this.zr-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const t=D_(i.scrollDelayMs,this.Mr.scroll_threshold_ms),n=D_(i.selectionChangedDelayMs,this.Mr.selection_change_threshold_ms),s=D_(i.mutationDelayMs,this.Mr.mutation_threshold_ms),r=D_(i.absoluteDelayMs,1.1*this.Mr.mutation_threshold_ms),o=Pe(i.scrollDelayMs)&&this.Mr.scroll_threshold_ms>i.scrollDelayMs,l=Pe(i.mutationDelayMs)&&this.Mr.mutation_threshold_ms>i.mutationDelayMs,a=i.selectionChangedDuringGesture||Pe(i.selectionChangedDelayMs)&&this.Mr.selection_change_threshold_ms>i.selectionChangedDelayMs,u=Pe(i.visibilityChangedDelayMs),h=Pe(i.focusChangedDelayMs);if(!(o||l||a||u||h))if(t||s||r||n){const e=A_(i);if("$dead_swipe"===e){if(this.mr>=this.Mr.max_dead_swipes_per_page_load)continue;this.mr++}this._onCapture(i,{[`${e}_last_mutation_timestamp`]:this.zr,[`${e}_event_timestamp`]:i.timestamp,[`${e}_scroll_timeout`]:t,[`${e}_mutation_timeout`]:s,[`${e}_absolute_timeout`]:r,[`${e}_selection_changed_timeout`]:n,[`${e}_visibility_changed_timeout`]:!1})}else this.Mr.mutation_threshold_ms>i.absoluteDelayMs&&this.pr.push(i)}this.Rr()}hr(t,e){const i=A_(t);this.instance.capture(i,ue(ue(ue({},e),I_(t.node,{e:t.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Mr.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:t.scrollDelayMs,[`${i}_mutation_delay_ms`]:t.mutationDelayMs,[`${i}_absolute_delay_ms`]:t.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:t.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:t.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:t.focusChangedDelayMs,$dead_swipe_direction:t.swipeDirection,$dead_swipe_distance_px:t.swipeDistancePx}),{timestamp:new Date(t.timestamp)})}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initDeadClicksAutocapture=(t,e)=>new q_(t,e);const B_=Gs("[ExternalScriptsLoader]"),j_=t=>{const e=null==n?void 0:n.querySelectorAll("script");if(e)for(let i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},H_=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return B_.warn(`${e} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const s=j_(e);if(s){if(s.__posthog_loading_callback_fired)return i();const t=s.__posthog_loading_error;return t?i(t):(s.addEventListener("load",t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)}),void s.addEventListener("error",t=>{s.__posthog_loading_error=t,i(t)}))}const r=()=>{if(!n)return i("document not found");if(j_(e))return H_(t,e,i);let s=n.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)n.head.appendChild(s);else{const t=n.querySelectorAll("body > script");var r;t.length>0?null===(r=t[0].parentNode)||void 0===r||r.insertBefore(s,t[0]):n.body.appendChild(s)}};(null==n?void 0:n.body)?r():null==n||n.addEventListener("DOMContentLoaded",r)},U_={},z_=(t,e)=>{let i=`/static/${e}.js?v=${t.version}`;if("toolbar"===e){const t=3e5;i=`${i}&t=${Math.floor(Date.now()/t)*t}`}return t.requestRouter.endpointFor("assets",i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"===e){const e=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void H_(t,e,i)}const n=t.config.strict_script_versioning;if(n){const s=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=U_[s];if("fallback"===n&&r){if(j_(r))return void H_(t,r,i);delete U_[s]}return void H_(t,s,"fallback"===n?(n,r)=>{if(n)if("string"==typeof n)i(n);else{var o;const n=z_(t,e);U_[s]=n;const r=j_(s);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),H_(t,n,i)}else i(void 0,r)}:i)}H_(t,z_(t,e),i)},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{const n=t.requestRouter.endpointFor("api",e);H_(t,n,i)};var W_=class{constructor(t){this._instance=t}get Mr(){return this._instance.config}get consent(){return this.Ro()?0:this.Ao}isOptedOut(){return"always"===this.Mr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Mr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Mr.opt_out_capturing_by_default}optInOut(t){this.Fo.At(this.Oo,t?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Fo.Lt(this.Oo,this.Mr.cross_subdomain_cookie)}get Oo(){const{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get Ao(){const t=this.Fo.Ot(this.Oo);return ze(t)?1:ge(We,t)?0:-1}get Fo(){const t=this.Mr.opt_out_capturing_persistence_type,e="localStorage"===t?Ll:Fl,i=e.Et()?e:Ql;if(!this.Do||this.Do!==i){this.Do=i;const e="localStorage"===t?Fl:Ll;e.Ot(this.Oo)&&(this.Do.Ot(this.Oo)||this.optInOut(ze(e.Ot(this.Oo))),e.Lt(this.Oo,this.Mr.cross_subdomain_cookie))}return this.Do}Ro(){return!!this.Mr.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(t=>ze(t))}};const V_=Gs("[Dead Clicks]"),G_=()=>!0,Z_=t=>{var e;const i=!!(null===(e=t.instance.persistence)||void 0===e?void 0:e.get_property(R)),n=t.instance.config.capture_dead_clicks;return Ae(n)?n:!!Ce(n)||i};var Q_=class{get lazyLoadedDeadClicksAutocapture(){return this.Lo}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[R]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.No(()=>{this.qo()}):this.stop()}No(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this.instance,"dead-clicks-autocapture",e=>{e?V_.error("failed to load script",e):t()})}qo(){var t;if(n){if(!this.Lo&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=Ce(this.instance.config.capture_dead_clicks)?ue({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Lo=d.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Lo.start(n),V_.info("starting...")}}else V_.error("`document` not found. Cannot start.")}stop(){this.Lo&&(this.Lo.stop(),this.Lo=void 0,V_.info("stopping..."))}};const J_=Gs("[SegmentIntegration]");function K_(t,e,i=!0){const n=t.config.segment;if(!n)return e();const{analytics:s,filterProperties:r}=(t=>xe(t.register))(o=n)?{analytics:o}:o;var o;!function(t,e,i,n){const s=e=>{const s=()=>e.anonymousId()||Ml();t.config.get_device_id=s,n&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property($t,Jt)),i(n?void 0:e.anonymousId()||void 0)},r=e.user();"then"in r&&xe(r.then)?r.then(s):s(r)}(t,s,i=>{s.register(((t,e,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||J_.warn("This browser does not have Promise support, and can not use the segment integration");const n=(n,s)=>{if(!s)return n;const r=!!e&&n.event.anonymousId===e&&!n.event.userId;r||n.event.userId||n.event.anonymousId===t.get_distinct_id()||(J_.info("No userId set, resetting PostHog"),t.reset()),r||(e=void 0),n.event.userId&&n.event.userId!==t.get_distinct_id()&&(J_.info("UserId set, identifying with PostHog"),t.identify(n.event.userId));let o=t.calculateEventProperties(s,n.event.properties);if(!Re(i)){const t=n.event.properties||{},e={};for(const i of Object.keys(o))we.call(t,i)||(e[i]=o[i]);const s=((t,e)=>{const i=Se(t)?t:[t];let n=ue({},e);for(const t of i)try{if(n=t(n),Re(n))return null}catch(t){return J_.error("Error in Segment filterProperties:",t),null}return n})(i,e);if(Re(s))return n;o=s}return n.event.properties=Object.assign({},o,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return n(t,t.event.event)},page(t){return n(t,te)},identify(t){return n(t,ie)},screen(t){return n(t,"$screen")}}})(t,i,{filterProperties:r})).then(()=>{e()},t=>{J_.error("Failed to register the Segment integration",t),e()})},i)}const Y_="posthog-js";function X_(t,{organization:e,projectId:i,prefix:n,severityAllowList:s=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var l,a,u,h,c;if("*"!==s&&!s.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const d=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,t.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const v=(null===(l=o.exception)||void 0===l?void 0:l.values)||[],f=v.map(t=>ue(ue({},t),{},{stacktrace:t.stacktrace?ue(ue({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>ue(ue({},t),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:(null===(a=v[0])||void 0===a?void 0:a.value)||o.message,$exception_type:null===(u=v[0])||void 0===u?void 0:u.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(h=v[0])||void 0===h?void 0:h.value)||o.message,$sentry_exception_type:null===(c=v[0])||void 0===c?void 0:c.type,$sentry_tags:o.tags};var g;return e&&i&&(p.$sentry_url=(n||"https://sentry.io/organizations/")+e+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(g=t.exceptions)||void 0===g||g.sendExceptionEvent(p)),o}}var tb=class{constructor(t,e,i,n,s,r){this.name=Y_,this.setupOnce=function(o){o(X_(t,{organization:e,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:null==r||r}))}}},eb=class{constructor(t){this.jo=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Vs.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Bo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ho()}Ho(){var t;this.zo=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.jo)}destroy(){var t;null===(t=this.zo)||void 0===t||t.call(this),this.zo=void 0}doPageView(e,i){var n;const s=this.Uo(e,i);return this.Bo={pathname:null!==(n=null==t?void 0:t.location.pathname)&&void 0!==n?n:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.Uo(t,null===(e=this.Bo)||void 0===e?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.Bo)||void 0===t?void 0:t.pageViewId}}Uo(t,e){const i=this.Bo;if(!i)return{$pageview_id:e};let n={$pageview_id:e,$prev_pageview_id:i.pageViewId};const s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:t,lastScrollY:e,maxScrollY:i,maxContentHeight:r,lastContentY:o,maxContentY:l}=s;if(!(Te(t)||Te(e)||Te(i)||Te(r)||Te(o)||Te(l))){t=Math.ceil(t),e=Math.ceil(e),i=Math.ceil(i),r=Math.ceil(r),o=Math.ceil(o),l=Math.ceil(l);const s=t>1?Ze(e/t,0,1,Vs):1,a=t>1?Ze(i/t,0,1,Vs):1,u=r>1?Ze(o/r,0,1,Vs):1,h=r>1?Ze(l/r,0,1,Vs):1;n=Js(n,{$prev_pageview_last_scroll:e,$prev_pageview_last_scroll_percentage:s,$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:a,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:u,$prev_pageview_max_content:l,$prev_pageview_max_content_percentage:h})}}return i.pathname&&(n.$prev_pageview_pathname=i.pathname),i.timestamp&&(n.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),n}};const ib=["flags","surveys"],nb={[v]:{exposure:"hidden"},[m]:{exposure:"hidden"},[y]:{exposure:"hidden"},[S]:{exposure:"hidden"},[b]:{exposure:"hidden"},[k]:{exposure:"hidden"},[x]:{exposure:"event"},[C]:{exposure:"hidden"},[O]:{exposure:"hidden"},[T]:{exposure:"event"},[E]:{exposure:"hidden"},[I]:{exposure:"event"},[M]:{exposure:"event"},[R]:{exposure:"event"},[P]:{exposure:"hidden"},[A]:{exposure:"event"},[F]:{exposure:"hidden"},[D]:{exposure:"hidden"},[H]:{exposure:"hidden"},[U]:{exposure:"event"},[L]:{exposure:"event",shouldSkipFromEventProperties:t=>Me(t)},[z]:{exposure:"event"},[W]:{exposure:"event"},[V]:{exposure:"event"},[J]:{exposure:"event"},[K]:{exposure:"hidden"},[Y]:{exposure:"hidden",storageGroup:"flags"},[X]:{exposure:"hidden",storageGroup:"flags"},[tt]:{exposure:"hidden"},[et]:{exposure:"hidden",storageGroup:"flags"},[it]:{exposure:"hidden",storageGroup:"flags"},[nt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[st]:{exposure:"hidden",storageGroup:"flags"},[rt]:{exposure:"hidden"},[ot]:{exposure:"hidden"},[lt]:{exposure:"hidden"},[at]:{exposure:"hidden"},[ht]:{exposure:"hidden",storageGroup:"surveys"},[ct]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[dt]:{exposure:"event"},[vt]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[pt]:{exposure:"hidden"},[gt]:{exposure:"hidden"},[mt]:{exposure:"hidden"},[yt]:{exposure:"event"},[_t]:{exposure:"event"},[bt]:{exposure:"event"},[wt]:{exposure:"event"},[kt]:{exposure:"hidden"},[St]:{exposure:"hidden"},[ut]:{exposure:"event"},[xt]:{exposure:"hidden"},[Ct]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[$t]:{exposure:"hidden"},[Tt]:{exposure:"hidden"},[Et]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[Pt]:{exposure:"hidden"},[N]:{exposure:"event"},[q]:{exposure:"event"},[B]:{exposure:"event"},[j]:{exposure:"event"},[Ft]:{exposure:"event"},[Dt]:{exposure:"event"},[Lt]:{exposure:"event"},[Nt]:{exposure:"event"},[qt]:{exposure:"event"},[Bt]:{exposure:"event"},[jt]:{exposure:"event"},[Ht]:{exposure:"event"},[Ut]:{exposure:"event"},[zt]:{exposure:"event"},[Gt]:{exposure:"event"}},sb=[[G,{exposure:"hidden"}],[Z,{exposure:"hidden"}],[Q,{exposure:"hidden"}]],rb=t=>{const e=nb[t];if(e)return e;for(const[e,i]of sb)if(0===t.indexOf(e))return i},ob={flags:Ct,surveys:ct},lb=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ab=t=>`${t}_cookie_identity_change_pending`,ub=t=>{let e="",i=0;for(const n of t){const t=encodeURIComponent(JSON.stringify(n).slice(1,-1)).length;if(i+t>1e3)break;e+=n,i+=t}return e},hb="main",cb=[Y,X,et,it,nt,Ct,st,lt],db=t=>-1!==cb.indexOf(t),vb=[b,k],fb=t=>-1!==vb.indexOf(t),pb=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},gb=t=>{if(!t)return{};const e=JSON.parse(t);return Ce(e)?e:{}},mb=(t,e)=>{Qs(t,(i,n)=>{const s=rb(n);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,n)||delete t[n]})};var yb=class{constructor(e,i,n=!0){if(this.Wo={},this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=new Map,this.Xo=!1,this.Yo=!1,this.tl=!1,this.el=new Set,this.il=new Set,this.Mr=e,this.nl=n,this.props={},this.sl=void 0,this.rl=(t=>{let e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(e),this.Fo=this.ol(e),this.Zo=this.ll(e),this.load(),this.al(),e.debug&&Vs.info("Persistence loaded",e.persistence,ue({},this.props)),this.update_config(e,e,i),this.save(),t){const e=()=>this.flush();nr(t,"beforeunload",e,{capture:!1}),nr(t,"pagehide",e,{capture:!1}),this.ul=e=>{if(this.Vo&&(!e.storageArea||e.storageArea===(null==t?void 0:t.localStorage))&&e.key)if(e.key!==this.rl){if(this.Zo){const t=ib.find(t=>e.key===this.hl(t));t&&this.cl(e.key,t)}}else this.cl(e.key,hb)},nr(t,"storage",this.ul)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,e])=>{const i=this.Ko.get(t);if(!db(t)||!0===i)return;if(!0===e)return void this.dl(t,!0);const n=new Set(i||[]);e.forEach(t=>n.add(t)),n.size&&this.dl(t,n)})}onCrossTabFeatureFlagChange(t){return this.il.add(t),()=>this.il.delete(t)}destroy(){this.ul&&t&&(t.removeEventListener("storage",this.ul),this.ul=void 0),this.il.clear()}cl(t,e,i=!0){if(this.pi)return!1;let n,s;try{if(s=Ll.Ot(t),Me(s)){const t=this.vl(e);return t.storageValue=null,e!==hb&&(t.persisted=!1),!1}n=gb(s)}catch(t){return!1}const r=e===hb?n:Ll.Dt(this.rl);if(r&&this.fl(r))return!1;const o=this.pl(n,e,i);return e===hb&&this.Zo&&!pb(this.gl().main,n)||this.ml(n,e,!0,s),o}fl(t){const e=this.props[f],i=t[f];return!Te(e)&&!Te(i)&&e!==i}ml(t,e,i,n){const s=this.vl(e);s.storageValue=n,e!==hb&&(s.persisted=i);try{s.fingerprint=this.yl(t,e)}catch(t){s.fingerprint=void 0}}pl(t,e,i){let n=!1;return cb.forEach(i=>{var s;const r=null===(s=rb(i))||void 0===s?void 0:s.storageGroup;if(e===hb&&this.Zo&&r||e!==hb&&r!==e)return;const o=i in t,l=this.bl(i,o?t[i]:void 0),a=this.Ko.has(i)?i in this.props:o;a===i in this.props&&pb(l,this.props[i])||(a?this._l(i,l,!1):this.wl(i,!1),n=!0)}),n&&i&&this.il.forEach(t=>t()),n}kl(){if(!this.Vo)return!1;try{this.tl=!1;const t=Ll.Ot(this.rl),e=this.vl(hb);let i,n=!1,s=!1;if(t!==e.storageValue)if(Me(t))e.storageValue=null;else{if(i=gb(t),this.tl=!this.Yo&&this.fl(i),this.tl)return!1;s=this.pl(i,hb,!1),!this.Zo||pb(this.gl().main,i)?this.ml(i,hb,!0,t):e.storageValue=t,n=!0}return this.Zo&&ib.forEach(t=>{const e=Ll.Ot(this.hl(t)),r=this.vl(t),o=i||{},l=n&&cb.some(e=>{var i;return(null===(i=rb(e))||void 0===i?void 0:i.storageGroup)===t&&e in o});if(e===r.storageValue&&!l)return;if(Me(e))return r.storageValue=null,r.persisted=!1,void(l&&(s=this.pl(o,t,!1)||s));const a=gb(e);s=this.pl(a,t,!1)||s,this.ml(a,t,!0,e)}),s}catch(t){return!1}}dl(t,e){this.Ko.set(t,e);const i=rb(t);(null==i?void 0:i.volatile)||(this.vl((this.Zo?null==i?void 0:i.storageGroup:void 0)||hb).fingerprint=void 0,this.Sl(t))}xl(){cb.forEach(t=>this.Ko.set(t,!0))}al(){if(this.Vo)try{const t=Ll.Ot(this.rl),e=gb(t);this.vl(hb).storageValue=t,cb.forEach(t=>{var i;const n=this.Zo?null===(i=rb(t))||void 0===i?void 0:i.storageGroup:void 0,s=n?Ll.Ot(this.hl(n)):null;if(n){const t=this.vl(n);t.storageValue=s,t.persisted=!Me(s)}const r=n&&!Me(s)?gb(s):e;t in this.props?this.Cl(t,r[t],this.props[t]):t in r&&this.dl(t,!0)})}catch(t){}}bl(t,e){const i=this.Ko.get(t);if(!i)return e;if(!0===i)return this.props[t];if("$active_feature_flags"===t){const n=new Set(Se(e)?e:[]),s=new Set(Se(this.props[t])?this.props[t]:[]);return i.forEach(t=>s.has(t)?n.add(t):n.delete(t)),Array.from(n)}const n=Ce(e)?ue({},e):{},s=Ce(this.props[t])?this.props[t]:{};return i.forEach(t=>{t in s?n[t]=s[t]:delete n[t]}),n}Cl(t,e,i){if(!db(t))return;const n=this.Ko.get(t);if(!0===n)return;let s=e;if(this.Vo)try{var r;const e=this.Zo?null===(r=rb(t))||void 0===r?void 0:r.storageGroup:void 0,i=e?this.hl(e):this.rl;s=gb(Ll.Ot(i))[t]}catch(t){}const o=new Set(n||[]);if("$active_feature_flags"===t){if(!Te(e)&&!Se(e)||!Te(s)&&!Se(s)||!Se(i))return void this.dl(t,!0);const n=new Set(e||[]),r=new Set(s||[]),l=new Set(i);new Set([...n,...l]).forEach(t=>{n.has(t)!==l.has(t)&&o.add(t)}),o.forEach(t=>{r.has(t)===l.has(t)&&o.delete(t)})}else{if(!Ce(i))return void(pb(s,i)?this.Ko.delete(t):this.dl(t,!0));{if(!Te(e)&&!Ce(e)||Te(e)&&$e(i)&&Te(s))return void this.dl(t,!0);const n=Ce(e)?e:{},r=Ce(s)?s:{};new Set([...Object.keys(n),...Object.keys(i)]).forEach(t=>{t in n==t in i&&pb(n[t],i[t])||o.add(t)}),o.forEach(t=>{t in r==t in i&&pb(r[t],i[t])&&o.delete(t)})}}o.size?this.dl(t,o):this.Ko.delete(t)}$l(){var t;const e=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Pe(e)&&e>0?e:0}Tl(t){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase())if(t)try{const e=Ul(t,this.Mr.cookie_persisted_properties||[]),i=Wl(e,this.Mr.cookie_persisted_properties||[]),n=JSON.stringify(e)+"|"+JSON.stringify(i),s=Fl.Ot(this.rl)||void 0;s&&Gl(this.rl,s)===n&&(this.Il=n,this.Ml=s)}catch(t){}else try{const t=Fl.Ot(this.rl)||void 0;this.Il=t?Gl(this.rl,t):void 0,this.Ml=t}catch(t){}}syncCookieProperties(){return this.El(this.Mr)}El(t,e=!1){if(this.pi&&!e||this.Jo||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let i;try{i=Fl.Ot(this.rl)||void 0}catch(t){}if(!i||i===this.Ml)return!1;const n=Gl(this.rl,i);let s;try{s=Hl(JSON.parse(i))}catch(t){return!1}if((Fl.Ot(this.rl)||void 0)!==i)return!1;this.Il=n,this.Ml=i;const r=Vl(this.rl,i),o=[...ql,...r.properties],l={};if(Object.keys(s).forEach(t=>{const e=s[t];(Te(e)||Me(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e)&&(l[t]=!0,delete s[t])}),$e(s))return!1;const a="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,u=this.props,h=u[f],c=u[$t],d=Js({},u);[...ql,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in s)&&!l[t]&&(a||"distinct_id"!==t&&"$user_state"!==t)){const e=d[t];(r.isValid||-1===ql.indexOf(t)||!1!==e&&0!==e)&&delete d[t]}}),this.props=Js(d,s),cb.forEach(t=>{const e=t in this.props;t in u===e&&pb(u[t],this.props[t])||(e?this.Cl(t,u[t],this.props[t]):this.dl(t,!0))}),!a||"$user_state"in s||"$user_state"in this.props||this._l($t,Qt);const v=this.props[f],p=this.props[$t];return!a||v===h&&p===c||(this.Yo=!0,this.Qo=!0,Kl.At(ab(this.rl),!0),this.wl(lt),this.wl(X),this.wl(Y),this.wl(et),this.wl(it),this.wl(nt),this.wl(Ct),this.wl(xt),this.wl(kt),"anonymous"!==p||"identified"!==c&&"anonymous"!==s.$user_state&&(Te(h)||v===h)||(mb(this.props,s),this.wl(at)),"identified"===p?this.props.$user_id=v:delete this.props.$user_id,this.wl(m)),!0}consumeCookieIdentityChange(){const t=ab(this.rl),e=this.Qo||!!Kl.Ot(t);return this.Qo=!1,e&&Kl.Lt(t),e}Pl(t=!1){return!(this.Jo||this.pi&&!t||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.Jo=!0,0))}Rl(){this.Jo&&(Te(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[hb],this.Fl(!0))}Ol(t=!0){if(this.Jo)try{t?this.Rl():Te(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}isDisabled(){return!!this.pi}ol(e){-1===lb.indexOf(e.persistence.toLowerCase())&&(Vs.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const i=((e=[],i=!1)=>{const n=[...ql,...e];return ue(ue({},Ll),{},{Dt(t){try{let s,r={};try{s=Fl.Ot(t)||void 0,r=s?Hl(JSON.parse(s)):{}}catch(t){}const o=JSON.parse(Ll.Ot(t)||"{}");let l;if(i){const i=Vl(t,s),a=[...ql,...i.properties],u={};Object.keys(r).forEach(t=>{const e=r[t];Me(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e||(u[t]=e)});const h="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var e;const t=o[f],s=null!==(e=o.$user_state)&&void 0!==e?e:Qt;n.forEach(t=>{if(-1!==a.indexOf(t)&&!(t in r)&&(h||"distinct_id"!==t&&"$user_state"!==t)){const e=o[t];(i.isValid||-1===ql.indexOf(t)||!1!==e&&0!==e)&&delete o[t]}}),!h||"$user_state"in r||"$user_state"in o||(o[$t]=Qt),!h||("distinct_id"in u?u[f]:o[f])===t&&("$user_state"in u?u[$t]:o[$t])===s||(Nl.forEach(t=>delete o[t]),"identified"===u.$user_state&&"distinct_id"in u?o.$user_id=u[f]:delete o.$user_id,"identified"!==u.$user_state&&(delete o[ut],delete o[at]),delete o.__alias)}l=Js(o,u)}else l=Js(r,o);return Ll.At(t,l),l}catch(t){}return null},At(t,n,s,r,o,l){const a=Ll.At(t,n,void 0,void 0,l);try{const u=Ul(n,e);if(Object.keys(u).length){if(i){const i=Bl(t),h=Wl(u,e);if(Fl.At(i,h,s,r,o,l),Fl.Ot(i)!==JSON.stringify(h)){Fl.Lt(i,r);const e=Ul(n);return Fl.At(t,e,s,r,o,l),a}}Fl.At(t,u,s,r,o,l)}}catch(t){Ll.Pt(t)}return a},Lt(e,i){try{null==t||t.localStorage.removeItem(e),Fl.Lt(e,i),Fl.Lt(Bl(e),i)}catch(t){Ll.Pt(t)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let n,s=!1,r=!1;const o=e.persistence.toLowerCase();return"localstorage"===o&&Ll.Et()?(n=Ll,r=!0):"localstorage+cookie"===o&&i.Et()?(n=i,r=!0,s=!0):"sessionstorage"===o&&Kl.Et()?n=Kl:"memory"===o?n=Ql:"cookie"===o&&Fl.Et()?(n=Fl,s=!0):i.Et()?(n=i,r=!0,s=!0):Fl.Et()?(n=Fl,s=!0):n=Ql,this.Vo=r,this.Go=s,n}hl(t){return`${this.rl}__${t}`}ll(t){return this.Vo&&!!t.split_storage}properties(){const t={};return Qs(this.props,(e,i)=>{const n=rb(i);if(!n||"event"===n.exposure){var s;if(null==n||null===(s=n.shouldSkipFromEventProperties)||void 0===s?void 0:s.call(n,e))return;t[i]=e}}),t}load(t=!1){if(this.pi&&!t)return;const e=this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase(),i=e?Ll.Dt(this.rl):null;let n={};if(e)try{n=Hl(Fl.Dt(this.rl)),Qs(n,(t,e)=>{(Te(t)||Me(t)||""===t)&&delete n[e]})}catch(t){}const s=this.Fo.Dt(this.rl);if(s&&(this.props=Js({},s)),this.Zo&&this.Dl(),e&&s){var r,o;const t=null==i?void 0:i[f],e=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Qt,l=s[f],a=null!==(o=s.$user_state)&&void 0!==o?o:Qt;if(l!==t||a!==e){this.Qo=!0,Kl.At(ab(this.rl),!0);const i=Js({},this.props);Nl.forEach(t=>delete i[t]),"anonymous"!==a||"identified"!==e&&"anonymous"!==n.$user_state&&(Te(t)||l===t)||(mb(i,n),delete i[at]),this.props=i;const s=new Set;Nl.forEach(t=>{var e;const i=null===(e=rb(t))||void 0===e?void 0:e.storageGroup;i&&s.add(i)}),s.forEach(t=>{const e={};Qs(this.props,(i,n)=>{var s;(null===(s=rb(n))||void 0===s?void 0:s.storageGroup)===t&&(e[n]=i)}),$e(e)?(Ll.Lt(this.hl(t)),this.Wo[t]={}):Ll.At(this.hl(t),e)&&(this.Wo[t]={persisted:!0,fingerprint:this.yl(e,t)})})}}Kl.Ot(ab(this.rl))&&(this.Qo=!0)}Dl(){for(const t of ib){const e=Ll.Dt(this.hl(t));if(e&&!$e(e)){const i=this.vl(t);i.persisted=!0,this.Ll(t)||(i.fingerprint=this.yl(e,t)),this.Nl(t,e)||Js(this.props,e)}}}Ll(t){return Object.keys(this.props).some(e=>{var i;return(null===(i=rb(e))||void 0===i?void 0:i.storageGroup)===t})}Nl(t,e){const i=ob[t];if(!i)return!1;const n=e[i],s=this.props[i];return Pe(n)&&Pe(s)&&s>n}refreshKey(t){var e;if(this.pi)return;if(this.el.has(t))return;const i=this.Zo?null===(e=rb(t))||void 0===e?void 0:e.storageGroup:void 0,n=i?Ll.Dt(this.hl(i)):this.Fo.Dt(this.rl);if(n&&t in n)this._l(t,n[t],!1);else{if(i){const e=this.Fo.Dt(this.rl);if(e&&t in e)return void this._l(t,e[t],!1)}this.wl(t,!1)}}save(){if(this.pi)return;const t=this.$l();t>0?Te(this.Al)&&(this.Al=setTimeout(()=>{this.Al=void 0,this.Fl()},t)):this.Fl()}flush(){Te(this.Al)||(clearTimeout(this.Al),this.Al=void 0,this.Fl())}Fl(t=!1){if(this.pi||this.Jo&&!t)return;t||(this.syncCookieProperties(),this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||vb.forEach(t=>this.refreshKey(t)));const e=!t&&!this.Xo;e||(this.tl=!1);const i=!!e&&this.kl();if(this.tl)return void(this.Mr.debug&&Vs.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Zo)return this.ql(),void(i&&this.il.forEach(t=>t()));const n=this.jl(this.Fo,this.rl,this.props,hb);"written"===n&&this.Tl(this.props),"failed"!==n&&(this.Ko.clear(),this.Yo=!1,this.el.clear()),i&&this.il.forEach(t=>t())}ql(){const{main:t,groups:e}=this.gl(),i=this.jl(this.Fo,this.rl,t,hb);"written"===i&&this.Tl(t),"failed"!==i&&(this.Yo=!1,this.el.clear(),cb.forEach(t=>{var e;(null===(e=rb(t))||void 0===e?void 0:e.storageGroup)||this.Ko.delete(t)}));for(const t of ib){var n;const i=e[t];if($e(i)&&!(null===(n=this.Wo[t])||void 0===n?void 0:n.persisted)){cb.forEach(e=>{var i;(null===(i=rb(e))||void 0===i?void 0:i.storageGroup)===t&&this.Ko.delete(e)});continue}const s=this.jl(Ll,this.hl(t),i,t);"failed"!==s&&cb.forEach(e=>{const i=rb(e);(null==i?void 0:i.storageGroup)!==t||"written"!==s&&i.volatile||this.Ko.delete(e)})}}gl(){const t={},e={flags:{},surveys:{}};return Qs(this.props,(i,n)=>{var s;const r=null===(s=rb(n))||void 0===s?void 0:s.storageGroup;r?e[r][n]=i:t[n]=i}),{main:t,groups:e}}yl(t,e){if(e===hb)return JSON.stringify(t)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;const i={};return Qs(t,(t,e)=>{var n;i[e]=(null===(n=rb(e))||void 0===n?void 0:n.volatile)?"__volatile__":t}),JSON.stringify(i)}jl(t,e,i,n){const s=this.vl(n);if(n!==hb&&!s.dirty&&!Te(s.fingerprint))return"skipped";let r;try{if(r=this.yl(i,n),r===s.fingerprint)return s.dirty=!1,"skipped"}catch(t){r=void 0}return t.At(e,i,this.Bl,this.Hl,this.zl,this.Mr.debug)?(s.dirty=!1,n!==hb&&(s.persisted=!0),Te(r)||(s.fingerprint=r),this.Vo&&(s.storageValue=Ll.Ot(e)),"written"):(this.Mr.debug&&Vs.warn(`failed to persist storage entry "${e}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.xl(),Te(this.Al)||(clearTimeout(this.Al),this.Al=void 0),this.Fo.Lt(this.rl,!1),this.Fo.Lt(this.rl,!0),!t&&this.nl)for(const t of ib)Ll.Lt(this.hl(t));t?delete this.Wo[hb]:this.Wo={},this.Il=void 0,this.Ml=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(Ce(t)){this.syncCookieProperties(),Te(e)&&(e="None"),this.Bl=Te(i)?this.Ul:i;let n=!1;if(Qs(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this._l(i,t),n=!0)}),n)return this.save(),!0}return!1}register(t,e){if(Ce(t)){this.syncCookieProperties(),this.Bl=Te(e)?this.Ul:e;let i=!1;if(Qs(t,(e,n)=>{t.hasOwnProperty(n)&&(this.props[n]!==e||Ce(e)||Se(e))&&(this._l(n,e),i=!0)}),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();const e="string"==typeof t?[t]:t;let i=!1;for(const t of e)t in this.props&&(this.wl(t),i=!0);i&&this.save()}update_campaign_params(){const t=null==n?void 0:n.URL;if(t===this.sl)return;const e=Ia(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),i=!$e(Xs(e));return i&&this.register(e),this.sl=t,i?e:void 0}update_search_keyword(){this.register(function(){const t=null==n?void 0:n.referrer;return t?Ra(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:Fa(),$referring_domain:(null==n?void 0:n.referrer)&&(null===(t=lr(n.referrer))||void 0===t?void 0:t.host)||Aa},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Da(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[Rt]:this.Go?{r:ub(t.r),u:t.u?ub(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Qs([Mt,It],e=>{const i=this.props[e];i&&Qs(i,function(e,i){t["$initial_"+ye(i)]=e})});const e=this.props[Rt];if(e){const i=function(t,e=!1){const i=La(t,e),n={};return Qs(i,function(t,e){n[`$initial_${ye(e)}`]=t}),n}(e,this.Mr.disable_capture_url_hashes);Js(t,i)}return t}safe_merge(t){return Qs(this.props,function(e,i){i in t||(t[i]=e)}),t}update_config(t,e,i){const n=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;const i=[...t].sort(),n=[...e].sort();return i.every((t,e)=>t===n[e])})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),r=n||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,l=t.disable_persistence||!!i,a=!!this.pi&&!l;l||this.El(e,a),this.Mr=t,!l&&(n||s||o)&&(this.Il=void 0,this.Ml=void 0,this.El(ue(ue({},t),{},{cookie_persisted_properties:e.cookie_persisted_properties}),a));const u=r||o?this.ol(t):this.Fo;this.Wl();const h=this.ll(t),c=r||h!==this.Zo,d=!l&&(c||t.cross_subdomain_cookie!==this.Hl||t.secure_cookie!==this.zl)&&this.Pl(a);this.Xo=c;try{if(this.Ul=this.Bl=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),c){const t=this.props;this.clear(),this.Fo=u,this.Zo=h,this.props=t,this.save()}else o&&(this.Fo=u,l||(delete this.Wo[hb],this.Fl()))}finally{this.Xo=!1,d&&this.Ol()}}Wl(){const t=this.props[Rt];if(!this.Go||!Ce(t)||"string"!=typeof t.r)return;const e=ub(t.r),i="string"==typeof t.u?ub(t.u):t.u;e===t.r&&i===t.u||this._l(Rt,ue(ue({},t),{},{r:e,u:i}))}set_disabled(t){this.pi=t,this.pi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Hl&&(this.Hl=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.zl&&(this.zl=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){const i=this.props.__timers||{};i[t]=e,this._l(S,i),this.save()}remove_event_timer(t){const e=this.props.__timers||{},i=e[t];return Te(i)||(delete e[t],this._l(S,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this._l(t,e),this.save()}_l(t,e,i=!0){var n;const s=this.props[t];this.props[t]=e,i&&("distinct_id"!==t&&"$user_state"!==t||s===e||(this.Yo=!0),fb(t)&&!pb(s,e)&&this.el.add(t),this.Cl(t,s,e),(null===(n=rb(t))||void 0===n?void 0:n.volatile)||this.Sl(t))}wl(t,e=!0){delete this.props[t],e&&(db(t)&&this.dl(t,!0),fb(t)&&this.el.add(t),this.Sl(t))}Sl(t){var e;const i=null===(e=rb(t))||void 0===e?void 0:e.storageGroup;i&&(this.vl(i).dirty=!0)}vl(t){return this.Wo[t]||(this.Wo[t]={})}};const _b={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},bb={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},wb=Gs("[RateLimiter]");var kb=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach(t=>{wb.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void wb.warn(`could not rate limit - continuing. Error: "${null==t?void 0:t.message}"`,{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t=!1){var e,i,n;const{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,o=(new Date).getTime(),l=null!==(e=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_property("$capture_rate_limit"))&&void 0!==e?e:{tokens:s,last:o};l.tokens+=(o-l.last)/1e3*r,l.last=o,l.tokens>s&&(l.tokens=s);const a=1>l.tokens;if(a||t||(l.tokens=Math.max(0,l.tokens-1)),a&&!t){const t=(Pe(l.dropped)?l.dropped:0)+1;l.dropped=t,!this.lastEventRateLimited&&this.Vl(t)&&(l.dropped=0)}return this.lastEventRateLimited=a,null===(n=this.instance.persistence)||void 0===n||n.set_property("$capture_rate_limit",l),{isRateLimited:a,remainingTokens:l.tokens}}Gl(t){const e=this.instance.config.property_denylist;return!Se(e)||!e.includes(t)}Zl(){var t;if(this.Gl("$current_url")&&this.Gl("$pathname")&&(null==s?void 0:s.pathname))return`${null!==(t=s.origin)&&void 0!==t?t:""}${s.pathname}`}Vl(t){var e,i;const{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,r=this.Zl(),o=this.Gl("$session_id")?null===(e=(i=this.instance).get_session_id)||void 0===e?void 0:e.call(i):void 0,l=[`${t} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${l}. Config is set to ${s} events per second and ${n} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(t){const e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}};const Sb=Gs("[RemoteConfig]");var xb=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=d._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Ql(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.loadExternalDependency)?null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Jl(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:t})}load(){try{if(this.remoteConfig)return Sb.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance.Xl())return void Sb.warn("Remote config is disabled. Falling back to local config.");this.Ql(t=>{if(!t)return Sb.info("No config found after loading remote JS config. Falling back to JSON."),void this.Jl(t=>{this.Kl(t.json,t)});this.Kl(t)})}catch(t){Sb.error("Error loading remote config",t),this.Kl()}}Kl(t,e){!t&&e&&(0===e.statusCode?e.error||Sb.warn("Failed to fetch remote config from PostHog."):Sb.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(t?{ok:!0,config:t}:{ok:!1})}catch(t){Sb.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null===(i=this._instance.featureFlags)||void 0===i||i.ensureFlagsLoaded()}catch(t){Sb.error("Error loading feature flags",t)}}};const Cb=!!o||!!r,$b=new WeakMap,Tb="text/plain";let Eb=0,Ib=!1;const Mb=(t,e)=>{const[i,n]=t.split("#"),[s,r]=i.split("?");if(!r)return t;const o=r.split("&").filter(t=>t.split("=")[0]!==e).join("&");return`${s}${o?`?${o}`:""}${n?`#${n}`:""}`},Rb=(t,e,i=!0)=>{var n;const[s,r]=t.split("?"),o=ue({},e),l=null!==(n=null==r?void 0:r.split("&").map(t=>{var e;const[n,s]=t.split("="),r=i&&null!==(e=o[n])&&void 0!==e?e:s;return delete o[n],`${n}=${r}`}))&&void 0!==n?n:[],a=ar(o);return a&&l.push(a),l.length>0?`${s}?${l.join("&")}`:s},Pb=t=>{if(t.Yl)return t.Yl;const{data:e,compression:i}=t;if(!e)return;if(i===hp.GZipJS){const t=bl(wl(or(e)),{mtime:0});return{contentType:Tb,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(i===hp.Base64){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(or(e)),i=(t=>"data="+encodeURIComponent("string"==typeof t?t:or(t)))(t);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const n=or(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}},Ob=t=>{const e=()=>"sendBeacon"===t.transport?{url:Rb(t.url,{compression:hp.Base64}),encodedBody:Pb(ue(ue({},t),{},{compression:hp.Base64,Yl:void 0}))}:{url:Mb(t.url,"compression"),encodedBody:Pb(ue(ue({},t),{},{compression:void 0,Yl:void 0}))};let i;try{i=Pb(t)}catch(i){if(us(t.compression,ur(t.url,"compression")))return Vs.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return i&&us(t.compression,ur(t.url,"compression"))&&!((n=i.body)instanceof ArrayBuffer?as(new Uint8Array(n)):ArrayBuffer.isView(n)&&as(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(Ib=!0,e()):{url:t.url,encodedBody:i};var n},Ab=t=>{try{return Ob(t)}catch(i){var e;return Vs.error(i),void(null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))}},Fb=function(){var t=re(function*(t){const e=yield gs(or(t.data),Yl.DEBUG,{rethrow:!0});if(!e)return t;const i=yield e.arrayBuffer();return ue(ue({},t),{},{Yl:{contentType:Tb,body:i,estimatedSize:i.byteLength}})});return function(e){return t.apply(this,arguments)}}(),Db=/Failed to fetch|NetworkError|Load failed/i,Lb=t=>"TypeError"===(null==t?void 0:t.name)&&Db.test((null==t?void 0:t.message)||""),Nb=t=>{try{const e=function(t,e=Date.now()){if("string"!=typeof t||!t)return;const i=t.trim(),n=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(n)){const t=1e3*Math.min(Number(n),300);return t>0?t:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(n))return;const s=/^\w{3} \w{3} /.test(n)?n+" GMT":n,r=Date.parse(s)-e;return Number.isFinite(r)&&r>0?Math.min(r,sn):void 0}(t());return Te(e)?void 0:Math.min(e,3e4)}catch(t){return}},qb=t=>{const e=Ab(t);if(!e)return;const i=new o;$b.set(i,!0);const{url:n,encodedBody:s}=e;i.open(t.method||"GET",n,!0);const{contentType:r,body:l}=null!=s?s:{};Qs(t.headers,function(t,e){i.setRequestHeader(e,t)}),r&&i.setRequestHeader("Content-Type",r),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e;const n={statusCode:i.status,text:i.responseText};if(200===i.status)try{n.json=JSON.parse(i.responseText)}catch(t){}null===(e=t.callback)||void 0===e||e.call(t,n,Nb(()=>i.getResponseHeader("Retry-After")))}},i.send(l)},Bb=t=>{const e=Ab(t);if(!e)return;const{url:i,encodedBody:n}=e,{contentType:s,body:o,estimatedSize:a}=null!=n?n:{},u=new Headers;Qs(t.headers,function(t,e){u.append(e,t)}),s&&u.append("Content-Type",s);let h=null,c=!1;if(l){const e=new l;h={signal:e.signal,timeout:setTimeout(()=>{var i;c=!0,e.abort(an("AbortError","PostHog request timed out"+((i=t.timeout)?` after ${i}ms`:"")))},t.timeout)}}const d=e=>{var i;c&&"AbortError"===(null==e?void 0:e.name)||Lb(e)?Vs.warn(e):Vs.error(e),null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e})};let v=0;const f=()=>{Eb-=v,v=0,h&&clearTimeout(h.timeout)};try{const e=ue({method:(null==t?void 0:t.method)||"GET",headers:u,referrerPolicy:"strict-origin",body:o,signal:null==h?void 0:h.signal},t.fetchOptions),n=null!=a?a:Te(o)?0:void 0;e.keepalive="POST"===e.method&&!t.ta&&!1!==e.keepalive&&e.body===o&&!Te(n)&&n>=0&&52428.8>Eb+n,e.keepalive&&(v=n,Eb+=v),r(i,e).then(e=>e.text().then(i=>{var n;const s={statusCode:e.status,text:i};if(200===e.status)try{s.json=JSON.parse(i)}catch(t){Vs.error(t)}f(),null===(n=t.callback)||void 0===n||n.call(t,s,Nb(()=>e.headers.get("Retry-After")))})).catch(t=>{f(),d(t)}).finally(f)}catch(t){f(),d(t)}},jb=t=>{try{var e;const{url:n,encodedBody:s}=Ob(t),{contentType:o,body:l,estimatedSize:a}=null!=s?s:{};if(!l)return;const u=l instanceof Blob?l:new Blob([l],{type:o});if(i.sendBeacon(n,u))return;const h=Se(t.data)?t.data:null===(e=t.data)||void 0===e?void 0:e.batch;if(Se(h)&&h.length>1&&(null!=a?a:0)>16384){const e=Math.ceil(h.length/2),i=e=>Se(t.data)?e:ue(ue({},t.data),{},{batch:e});return jb(ue(ue({},t),{},{data:i(h.slice(0,e))})),void jb(ue(ue({},t),{},{data:i(h.slice(e))}))}Vs.warn(`Beacon of ~${null!=a?a:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?Bb(ue(ue({},t),{},{ta:!0})):qb(t)}catch(t){Vs.warn("Beacon send failed",t)}},Hb=(t,e,i,n)=>{const s="query"===n?"POST"===e?"sent_at":"_":void 0;return Rb(i===hp.GZipJS?Mb(t,"compression"):t,ue(ue({},s?{[s]:Date.now().toString()}:{}),i===hp.GZipJS?{}:{compression:i}))},Ub=(()=>{const t=[];return r&&t.push({transport:"fetch",method:Bb}),o&&t.push({transport:"XHR",method:qb}),(null==i?void 0:i.sendBeacon)&&t.push({transport:"sendBeacon",method:jb}),t})();let zb=!Cb&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla"));function Wb(t,e,i){var n,s,r;i&&(e=ue(ue({},e),{},{callback:t=>i(t)})),t.__loaded?zb?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null===(s=e.callback)||void 0===s||s.call(e,{statusCode:429})):(e.transport=e.transport||t.config.api_transport,e.headers=ue(ue({},t.config.request_headers),e.headers),e.compression="best-available"===e.compression?null!==(n=t.compression)&&void 0!==n?n:e.compressionFallback:e.compression,(Te(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((t,e)=>{var i,n,s;const r=ue(ue({},t),{},{callback:null!=e?e:e=>{var i;return null===(i=t.callback)||void 0===i?void 0:i.call(t,e)}});r.timeout=r.timeout||6e4;const o=null!==(i=r.transport)&&void 0!==i?i:"fetch";"sendBeacon"===o&&Te(r.compression)&&r.data&&(r.compression=hp.Base64),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(t=>{var e,i;const n=(Se(t)?t:[t]).map(t=>ue(ue({},t),t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})),s=n[0];return{api_key:null!==(e=null==s||null===(i=s.properties)||void 0===i?void 0:i.token)&&void 0!==e?e:null==s?void 0:s.token,batch:n,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((t,e=(new Date).toISOString())=>Se(t)?t.map(t=>ue(ue({},t),{},{sent_at:e})):ue(ue({},t),{},{sent_at:e}))(r.data))),r.url=Hb(r.url,r.method,r.compression,r.timestampMode);const l=Ub.filter(t=>!r.disableTransport||!t.transport||!r.disableTransport.includes(t.transport)),u=null!==(n=null===(s=function(t,e){for(let i=0;t.length>i;i++)if(e(t[i]))return t[i]}(l,t=>t.transport===o))||void 0===s?void 0:s.method)&&void 0!==n?n:l[0].method;if(!u)throw new Error("No available transport method");const h=t=>{try{u(t)}catch(t){var e;Lb(t)?Vs.warn(t):Vs.error(t),null===(e=r.callback)||void 0===e||e.call(r,{statusCode:0,error:t})}};"sendBeacon"!==o&&r.data&&r.compression===hp.GZipJS&&a&&"undefined"!=typeof Promise&&!Ib?Fb(r).then(t=>{h(t)}).catch(e=>{if(hs(e))return Ib=!0,void h(ue(ue({},r),{},{compression:void 0,url:Hb(t.url,t.method,void 0,t.timestampMode)}));cs(e)&&(Ib=!0),h(r)}):u(r)})(e,(n,s)=>{var r,o,l;t.rateLimiter.checkForLimiting(n),400>n.statusCode||null===(r=(o=t.config).on_request_error)||void 0===r||r.call(o,n),i?i(n,s):null===(l=e.callback)||void 0===l||l.call(e,n)})):e.fireCallbackOnDrop&&(null===(r=e.callback)||void 0===r||r.call(e,{statusCode:0}))}var Vb=class{constructor(t,e){this.ea=!0,this.ia=[],this.na=Ze((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,Vs.createLogger("flush interval"),3e3),this.sa=t}enqueue(t){this.ia.push(t),this.ra||this.oa()}unload(){this.la();const t=this.ia.length>0?this.aa():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.ua(t,"sendBeacon")})}enable(){this.ea=!1,this.oa()}oa(){this.ea||(this.ra=setTimeout(()=>{if(this.la(),this.ia.length>0){const t=this.aa();for(const e in t)this.ua(t[e])}},this.na))}ua(t,e){try{this.sa(t,e)}catch(t){Vs.error(t)}}la(){clearTimeout(this.ra),this.ra=void 0}aa(){const t={};return Qs(this.ia,e=>{var i;const n=e,s=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");Te(t[s])&&(t[s]=ue(ue({},n),{},{data:[]})),null===(i=t[s].data)||void 0===i||i.push(n.data)}),this.ia=[],t}};const Gb=["retriesPerformedSoFar"];var Zb=class{constructor(t){this._instance=t,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}resume(){if(!Te(t)&&"onLine"in t.navigator){if(this.da=t.navigator.onLine,this.va)return;this.va=()=>{this.da=!0,this.fa()},this.pa=()=>{this.da=!1},nr(t,"online",this.va),nr(t,"offline",this.pa)}}get length(){return this.ia.length}retriableRequest(t,e){let{retriesPerformedSoFar:i}=t,n=ys(t,Gb);Oe(i)&&(n.url=Rb(n.url,{retry_count:i})),Wb(this._instance,e?ue(ue({},n),{},{transport:e}):n,(t,e)=>{var s;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=i?i:0))return void this.Ls(ue({retriesPerformedSoFar:i},n),e);0===t.statusCode&&Vs.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${null!=i?i:0} retries.`)}null===(s=n.callback)||void 0===s||s.call(n,t)})}Ls(t,e){const i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;const n=Math.max(function(t){const e=3e3*Math.pow(2,t),i=e/2,n=Math.min(18e5,e),s=(Math.random()-.5)*(n-i);return Math.ceil(n+s)}(i),null!=e?e:0),s=Date.now()+n;this.ia.push({retryAt:s,requestOptions:t});let r=`Enqueued failed request for retry in ${n}`;navigator.onLine||(r+=" (Browser is offline)"),Vs.warn(r),this.ha||(this.ha=!0,this.ga())}ga(){if(this.ma&&clearTimeout(this.ma),0===this.ia.length)return this.ha=!1,void(this.ma=void 0);this.ma=setTimeout(()=>{this.da&&this.ia.length>0&&this.fa(),this.ga()},this.ca)}fa(){const t=Date.now(),e=[],i=this.ia.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.ia=e,i.length>0)for(const{requestOptions:t}of i)this.retriableRequest(t)}unload(){this.ma&&(clearTimeout(this.ma),this.ma=void 0),this.ha=!1,Te(t)||(this.va&&(t.removeEventListener("online",this.va),this.va=void 0),this.pa&&(t.removeEventListener("offline",this.pa),this.pa=void 0));for(const{requestOptions:t}of this.ia)try{this._instance._send_request(ue(ue({},t),{},{transport:"sendBeacon"}))}catch(t){Vs.error(t)}this.ia=[]}},Qb=class{constructor(t){this._instance=t,this.ya=()=>{var t,e,i,n;this.ba||(this.ba={});const s=this.scrollElement(),r=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,l=r+((null==s?void 0:s.clientHeight)||0),a=(null==s?void 0:s.scrollHeight)||0;this.ba.lastScrollY=Math.ceil(r),this.ba.maxScrollY=Math.max(r,null!==(t=this.ba.maxScrollY)&&void 0!==t?t:0),this.ba.maxScrollHeight=Math.max(o,null!==(e=this.ba.maxScrollHeight)&&void 0!==e?e:0),this.ba.lastContentY=l,this.ba.maxContentY=Math.max(l,null!==(i=this.ba.maxContentY)&&void 0!==i?i:0),this.ba.maxContentHeight=Math.max(a,null!==(n=this.ba.maxContentHeight)&&void 0!==n?n:0)}}get _a(){return this._instance.config.scroll_root_selector}getContext(){return this.ba}resetContext(){const t=this.ba;return this.ba=void 0,setTimeout(this.ya,0),t}startMeasuringScrollPosition(){nr(t,"scroll",this.ya,{capture:!0}),nr(t,"scrollend",this.ya,{capture:!0}),nr(t,"resize",this.ya)}scrollElement(){if(this._a){const i=Se(this._a)?this._a:[this._a];for(const n of i){var e;const i=null==t||null===(e=t.document)||void 0===e?void 0:e.querySelector(n);if(i)return i}return}var i;return null==t||null===(i=t.document)||void 0===i?void 0:i.documentElement}wa(e){var i,n;const s="y"===e?"scrollTop":"scrollLeft";if(this._a){const t=this.scrollElement();return t&&t[s]||0}return t?"y"===e?t.scrollY||t.pageYOffset||(null===(i=t.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:t.scrollX||t.pageXOffset||(null===(n=t.document)||void 0===n||null===(n=n.documentElement)||void 0===n?void 0:n.scrollLeft)||0:0}scrollY(){return this.wa("y")}scrollX(){return this.wa("x")}};const Jb=t=>Da(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);var Kb=class{constructor(t,e,i,n){this.je=t=>{const e=this.ka();if(e&&e.sessionId===t)return;const i={sessionId:t,props:this.Sa(this._instance)};this.xa.register({[Tt]:i})},this._instance=t,this.Ca=e,this.xa=i,this.Sa=n||Jb,this.Ca.onSessionId(this.je)}ka(){return this.xa.props[Tt]}getSetOnceProps(){var t;const e=null===(t=this.ka())||void 0===t?void 0:t.props;return e?"r"in e?La(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){const t={};return Qs(Xs(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t[`$session_entry_${ye(i)}`]=e}),t}},Yb=class{on(t,e){return this.$a[t]||(this.$a[t]=[]),this.$a[t].push(e),()=>{this.$a[t]=this.$a[t].filter(t=>t!==e)}}emit(t,e){for(const i of this.$a[t]||[])i(e);for(const i of this.$a["*"]||[])i(t,e)}constructor(){this.$a={}}};const Xb=Gs("[SessionId]"),tw=864e5;var ew=class{on(t,e){return this.Ta.on(t,e)}constructor(t,e,i){var n;if(this.Ia=null,this.Ma=null,this.Ea=[],this.Pa=void 0,this.Ra=!1,this.Ta=new Yb,this.Aa=(t,e)=>!(!Oe(t)||!Oe(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=t.config,this.xa=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=e||Ml,this.Da=i||Ml;const s=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Ze(this.Mr.session_idle_timeout_seconds||1800,60,36e3,Xb.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.La(),this.Na="ph_"+s+"_window_id",this.qa="ph_"+s+"_primary_window_exists",this.ja()){const t=Kl.Dt(this.Na),e=Kl.Dt(this.qa);t&&!e?this.Be=t:Kl.Lt(this.Na),Kl.At(this.qa,!0)}(null===(n=this.Mr.bootstrap)||void 0===n?void 0:n.sessionID)&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Ba()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Te(this.Ea)&&(this.Ea=[]),this.Ea.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.Ea=this.Ea.filter(e=>e!==t)}}ja(){return"memory"!==this.Mr.persistence&&!this.xa.pi&&Kl.Et()}Ha(t){t!==this.Be&&(this.Be=t,this.ja()&&Kl.At(this.Na,t))}za(){return this.Be?this.Be:this.ja()?Kl.Dt(this.Na):null}Ua(t){const e=this.Ia;return!Me(e)&&!Me(t)&&5e3>Math.abs(t-e)}Wa(t,e,i){const n=e!==this._sessionActivityTimestamp,s=!(t!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Xt=t,s&&!n||s&&this.Ua(e)||(this.Ia=e,this.xa.register({[H]:[e,t,i]}))}Va(){var t;const e=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Oe(e)&&e>0}Ga(){this.Va()?this.xa.refreshKey(H):(this.xa.flush(),this.xa.load())}Za(){var t;if(Me(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ia)return;this.Ga();const[,e,i]=this.Qa();e===this.Xt&&i===this._sessionStartTimestamp&&(this.Ia=this._sessionActivityTimestamp,this.xa.register({[H]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.xa.flush())}Ja(){const[t]=this.Qa(),e=Oe(t)?t:0,i=Oe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Ka(t){return this.Ga(),this.Aa(t,this.Ja())}Qa(){const t=this.xa.props[H];return Se(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Xa),this.Xa=void 0,this.Wa(null,null,null)}setBootstrapSessionId(t,e=!1){const i=((t,e=(new Date).getTime())=>{try{const i=(t=>{const e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void Xb.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void Xb.error("Invalid sessionID in bootstrap",t)}})(t);return!Te(i)&&(e?this.Fa={sessionId:t,sessionStartTimestamp:i}:this.Wa(t,(new Date).getTime(),i),!0)}destroy(){this.Ra=!0,this.Za(),clearTimeout(this.Xa),this.Xa=void 0,this.Pa&&t&&(t.removeEventListener(Xt,this.Pa,{capture:!1}),this.Pa=void 0),this.Ea=[]}Ba(){this.Pa=()=>{this.Za(),this.ja()&&Kl.Lt(this.qa)},nr(t,Xt,this.Pa,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,e=null,i=!1){if("always"===this.Mr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const n=e||(new Date).getTime(),s=this.Xt;if(i)this.Ma=n;else if(Me(this.Ma)||this.Ma>n||n-this.Ma>=1e3){var r,o;null===(r=(o=this.xa).syncCookieProperties)||void 0===r||r.call(o),this.Ma=n}let[,l,a]=this.Qa();const u=!Te(s)&&l!==s,h=this.Ja();let c=this.za();const d=this.Fa,v=!!d&&(d.sessionStartTimestamp>n+6e4||n-d.sessionStartTimestamp>tw),f=d?v:Oe(a)&&Math.abs(n-a)>tw;let p=!1,g=u;const m=!l||!!d,y=l;let _=!m&&!t&&this.Aa(n,h);if(_&&(_=this.Ka(n),_||Xb.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,a]=this.Qa()),m||_||f){g=!1;const t=d&&!v;l=t?d.sessionId:this.Oa(),c=this.Da(),Xb.info("new session ID assigned",{sessionId:l,windowId:c,bootstrapped:!!t,changeReason:{noSessionId:m,activityTimeout:_,sessionPastMaximumLength:f}}),a=t?d.sessionStartTimestamp:n,this.Fa=void 0,p=!0}else c||(c=this.Da(),p=!0),g=g||l!==y,g&&(Xb.info("adopted cross-tab session id",{sessionId:l,windowId:c}),p=!0);const b=Oe(h)&&t&&!f?h:n,w=Oe(a)?a:(new Date).getTime();this.Ha(c),this.Wa(l,b,w),t||this.La();const k={noSessionId:m,activityTimeout:_,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.Ea.forEach(t=>t(l,c,k)),{sessionId:l,windowId:c,sessionStartTimestamp:w,changeReason:p?k:void 0,lastActivityTimestamp:h}}La(){this.Ra||(clearTimeout(this.Xa),this.Xa=setTimeout(()=>{if(!this.Ra)if(this.Ka((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.Ta.emit("forcedIdleReset",{idleSessionId:t})}else this.La()},1.1*this.sessionTimeoutMs))}};const iw=function(t,e){if(!t)return!1;const i=t.userAgent;if(i&&Ge(i,e))return!0;try{const i=null==t?void 0:t.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(t=>Ge(null==t?void 0:t.brand,e)))return!0}catch(t){}return!!t.webdriver};function nw(){return nw=re(function*(){const t=null==i?void 0:i.userAgentData;if(null==t?void 0:t.getHighEntropyValues)try{const e=yield t.getHighEntropyValues(["model"]),i=null==e?void 0:e.model;return Ee(i)&&i.length>0?i:void 0}catch(t){return void Vs.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}),nw.apply(this,arguments)}const sw="custom",rw="i.posthog.com",ow=/^\/static\//,lw=["/s/","/e/","/i/"];var aw=class{constructor(t){this.Ya={},this.instance=t}get apiHost(){const t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){const t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t;let e=null===(t=this.instance.config.ui_host)||void 0===t?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace(`.${rw}`,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Ya[this.apiHost]||(this.Ya[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":sw),this.Ya[this.apiHost]}tu(t){if(!ow.test(t))return;const e=this.instance.config.asset_host;return"string"==typeof e&&e.trim().replace(/\/$/,"")||void 0}eu(t){const e=lr(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}iu(t,e,i){if("ui"===t)return i;let n=i;const s=this.instance.config.rewriteRequestPath;if(s){var r;const t=(null===(r=lr(i))||void 0===r?void 0:r.href)||i;n=s(new URL(t)).toString()}if(s&&"api"===t&&lw.some(t=>0===e.indexOf(t))){const t=this.eu(n);if(t){const e=this.apiHost;let i=this.nu;(null==i?void 0:i.apiHost)===e&&i.rewriteRequestPath===s||(i={apiHost:e,rewriteRequestPath:s,urls:new Set},this.nu=i),i.urls.add(t)}}return n}isIngestionEndpoint(t){const e=this.nu,i=this.eu(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e=""){if(e&&(e="/"===e[0]?e:`/${e}`),"ui"===t)return this.iu(t,e,this.uiHost+e);if("flags"===t)return this.iu(t,e,this.flagsApiHost+e);if("assets"===t){const i=this.tu(e);if(i)return this.iu(t,e,`${i}${e}`)}if(this.region===sw)return this.iu(t,e,this.apiHost+e);const i=rw+e;switch(t){case"assets":return this.iu(t,e,`https://${this.region}-assets.${i}`);case"api":return this.iu(t,e,`https://${this.region}.${i}`)}}};const uw=Gs("[PostHog ExternalIntegrations]"),hw={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var cw=class{constructor(t){this._instance=t}No(t,e){var i,n;null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,t,t=>{if(t)return uw.error("failed to load script",t);e()})}startIfEnabledOrStop(){var t;for(const[s,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var e,i,n;r&&!(null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[s])&&this.No(hw[s],()=>{var t;null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[s])||void 0===t||t.start(this._instance)}),!r&&(null===(i=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())}}},dw=class{constructor(t,e){this.$=t,this.po=e,this.su=new Map,this.So=!1}add(t){var e=this;return re(function*(){if(e.So)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.su.has(t.name))throw new Error(`Browser extension "${t.name}" is already registered`);e.su.set(t.name,t);try{const i=t.setup(e.po);i&&(yield i)}catch(i){const n=e.su.get(t.name)===t;n&&e.su.delete(t.name),e.$.error(`Failed to set up browser extension "${t.name}"`,i),n&&e.ru(t)}})()}getExtension(t){return this.su.get(t)}dispose(){if(this.So)return;this.So=!0;const t=Array.from(this.su.values()).reverse();this.su.clear();for(const e of t)this.ru(e)}ru(t){try{var e;const i=null===(e=t.dispose)||void 0===e?void 0:e.call(t);i&&xe(i.then)&&i.then(void 0,e=>{this.$.error(`Failed to dispose browser extension "${t.name}"`,e)})}catch(e){this.$.error(`Failed to dispose browser extension "${t.name}"`,e)}}},vw=class{constructor(t){this._instance=t}initialize(){}get(t){const e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);const i={};for(const n of t){const t=null==e?void 0:e.get_property(n);Te(t)||(i[n]=t)}return i}set(t,e){var i;null===(i=this._instance.persistence)||void 0===i||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null===(e=this._instance.persistence)||void 0===e||e.unregister(t)}};const fw="extensionsRemoteConfig";var pw=class{constructor(t){this.instance=t,this.So=!1,this.$=Vs,this.ou=t.lu,this.kv=new vw(t),this.onEvent=t=>kp(this.instance.on("eventCaptured",e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.$.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.So)return kp(()=>{});const e=e=>{try{t(e)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},i=this.instance.au.on(fw,e);return this.ou&&e(this.ou),kp(i)},this.uu=new dw(Vs.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){const t=this.instance.get_property(p);return"string"==typeof t?t:void 0}get library(){return{name:Yl.LIB_NAME,version:Yl.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,n;const s=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(n=null==s?void 0:s.sessionStartTimestamp)&&void 0!==n?n:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.uu.add(t)}getExtension(t){return this.uu.getExtension(t)}capture(t,e,i){var n=this;return re(function*(){i?n.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):n.instance.capture(t,e)})()}registerDynamicEventProperties(t){return kp(this.instance.hu(t))}handleRemoteConfig(t){this.So||(this.ou=t,this.instance.au.emit(fw,t))}sendRequest(t){var e=this;return re(function*(t,i={}){var n;const s=e.instance.requestRouter.endpointFor(null!==(n=i.target)&&void 0!==n?n:"api",t),r={method:i.method,url:i.query?Rb(s,i.query):s,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?ce.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(e.instance._send_request(r),{statusCode:202}):new Promise(t=>{r.callback=t,e.instance._send_request(r)})}).apply(this,arguments)}dispose(){this.So||(this.So=!0,this.uu.dispose())}};const gw={};let mw=0;const yw=()=>{},_w='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',bw="Surveys module not available",ww="sanitize_properties is deprecated. Use before_send instead",kw="Invalid value for property_denylist config: ",Sw=/^[A-Za-z0-9_-]{1,400}$/,xw=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Cw=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,$w=["token","distinct_id",At],Tw="posthog",Ew=t=>{const e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},Iw=e=>{var i;return ue({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ir(null==n?void 0:n.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:yw,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&Ee(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null===(i=t.location)||void 0===i?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Vs.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Kt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:yw},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Or,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Ew(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(e))},Mw=[["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"]],Rw=t=>{const e={};for(const[i,n]of Mw)Te(t[i])||(e[n]=t[i]);const i=Js({},e,t),n=t.__preview_external_dependency_versioned_paths;return Te(n)||(Te(t.strict_script_versioning)&&(i.strict_script_versioning=!!n),Ee(n)&&Te(t.asset_host)&&(i.asset_host=n)),Se(t.property_blacklist)&&(Te(t.property_denylist)?i.property_denylist=t.property_blacklist:Se(t.property_denylist)?i.property_denylist=[...t.property_blacklist,...t.property_denylist]:Vs.error(kw+t.property_denylist)),i};var Pw=class{constructor(){this.__forceAllowLocalhost=!1}get cu(){return this.__forceAllowLocalhost}set cu(t){Vs.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Ow=class e{du(t){if(!t)return;const e=this.su.indexOf(t);-1!==e&&this.su.splice(e,1)}vu(t,e){var i;return this.du(t),this.su.push(e),null===(i=e.initialize)||void 0===i||i.call(e),e}fu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}pu(){if(this.gu)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.fu())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.mu)return;let e,i,n;t?(e=`persistence is set to '${this.config.persistence}'`,i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",n="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(e="persistence is disabled (disable_persistence is true)",i="on every page load",n="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.gu=!0,console.warn("[PostHog.js]",`${e} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${n}`)}yu(){if(this.fu()||"$posthog_cookieless"!==this.get_distinct_id())return;const t=this.persistence;if(!t)return;this.bu()||t.load(!0);const e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){const e=this.config.get_device_id(Ml());this.register({distinct_id:e,$device_id:e}),t.set_property($t,Qt)}this._u()}get decideEndpointWasHit(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.wu=!1,this.ku=!1,this.webPerformance=new Pw,this.Su=!1,this.version=Yl.LIB_VERSION,this.xu=new Set,this.Cu="",this.au=new Yb,this.su=[],this.$u=[],this.mu=!1,this.gu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Iw(),this.SentryIntegration=tb,this.sentryIntegration=t=>function(t,e){const i=X_(t,e);return{name:Y_,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tu=!1,this.Iu=null,this.Mu=null,this.Eu=null,this.scrollManager=new Qb(this),this.pageViewManager=new eb(this),this.rateLimiter=new kb(this),this.requestRouter=new aw(this),this.consent=new W_(this),this.externalIntegrations=new cw(this);const i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,e,i)=>{const n=Ee(t)?{[t]:e}:t;this.setPersonProperties(n),null==i||i({})},set_once:(t,e,i)=>{const n=Ee(t)?{[t]:e}:t;this.setPersonProperties(void 0,n),null==i||i({})}},this.on("eventCaptured",t=>Vs.info(`send "${null==t?void 0:t.event}"`,t))}init(t,i,n){if(n&&n!==Tw){var s;const r=null!==(s=gw[n])&&void 0!==s?s:new e;return r._init(t,i,n),gw[n]=r,gw[Tw][n]=r,r}return this._init(t,i,n)}_init(e,i={},n){var s,r,o;const l=Ee(e)?e.trim():"";if(!l)return Vs.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var a;if(this.__loaded)return l!==(null===(a=this.config)||void 0===a?void 0:a.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('${l}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Iw(i.defaults),i.debug=this.Pu(i.debug),this.Ru=i,this.Au=[],i.person_profiles?this.Mu=i.person_profiles:i.process_person&&(this.Mu=i.process_person);const u=Iw(i.defaults),h=Rw(i),c=Js({},u,h,{name:n,token:l});Ce(u.rageclick)&&Ce(h.rageclick)&&(c.rageclick=Js({},u.rageclick,h.rageclick)),Ce(u.session_recording)&&Ce(h.session_recording)&&(c.session_recording=Js({},u.session_recording,h.session_recording)),this.set_config(c),this.config.on_xhr_error&&Vs.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:hp.GZipJS;const d=this.bu();if(this.persistence=new yb(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new yb(ue(ue({},this.config),{},{persistence:"sessionStorage"}),d,!1),this.Cu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&Kl.Et()){const t=Kl.Dt(this.Cu);Se(t)&&t.forEach(t=>{Ee(t)&&this.xu.add(t)})}else Kl.Lt(this.Cu);const v=ue({},this.persistence.props),f=ue({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Fu=new Vb((t,e)=>this.Ou(t,e),this.config.request_queue_config),this.Du=new Zb(this),this.__request_queue=[];const p=this.fu();p||(this.sessionManager=new ew(this),this.sessionPropsManager=new Kb(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,e,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this.Lu()})),this.Nu(),this.config.__preview_deferred_init_extensions?(Vs.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.qu(p)},0)):(Vs.info("Initializing extensions synchronously"),this.qu(p)),Yl.DEBUG=Yl.DEBUG||this.config.debug,Yl.DEBUG&&Vs.info("Starting in debug mode",{this:this,config:i,thisC:ue({},this.config),p:v,s:f}),this.config.identity_distinct_id&&!(null===(s=i.bootstrap)||void 0===s?void 0:s.distinctID)&&(i.bootstrap=ue(ue({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const m=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this.mu=!!m&&!Ie(m),null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID){const t=i.bootstrap.distinctID,e=this.get_distinct_id(),n=this.persistence.get_property($t);if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"anonymous"===n)this.identify(t);else if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"identified"===n)Vs.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const e=this.config.get_device_id(Ml()),n=i.bootstrap.isIdentifiedID?e:t;this.persistence.set_property($t,i.bootstrap.isIdentifiedID?Jt:Qt),this.register({distinct_id:t,$device_id:n})}}if(p)this.register_once({distinct_id:Ot,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(Ml());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property($t,Qt)}return nr(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),nr(t,"pageshow",()=>{var t;this.wu=!1,this.ku||null===(t=this.Du)||void 0===t||t.resume()}),i.segment?K_(this,()=>this.ju()):this.ju(),xe(this.config._onCapture)&&this.config._onCapture!==yw&&(Vs.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Vs.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 nw.apply(this,arguments)}().then(t=>{t&&this.register({[g]:t})}).catch(yw),this}Bu(t){const e=t;return Ee(e.name)&&xe(e.setup)}Hu(t,e){this.Bu(t)?e.push(()=>{this.zu().add(t).catch(()=>{var e;return null===(e=t.dispose)||void 0===e?void 0:e.call(t)}).catch(e=>{Vs.error(`Failed to dispose browser extension "${t.name}"`,e)})}):this.su.push(t)}Nu(){var t,i,n;const s=null!==(t=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:null===(n=e.__defaultExtensionClasses)||void 0===n?void 0:n.featureFlags;var r,o,l;s&&(this.featureFlags&&this.featureFlags instanceof s||(null===(r=this.Uu)||void 0===r||r.call(this),this.Uu=void 0,this.featureFlags=new s(this)),xe(this.featureFlags.onReloading)&&xe(this.featureFlags.setup)?this.Uu||(this.Uu=this.featureFlags.onReloading(()=>{this.au.emit("featureFlagsReloading",!0)}),this.zu().add(this.featureFlags)):null===(o=(l=this.featureFlags).initialize)||void 0===o||o.call(l))}qu(t){const i=performance.now(),n=ue(ue({},e.__defaultExtensionClasses),this.config.__extensionClasses),s=[];var r,o,l,a,u,h,c;n.exceptions&&this.su.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new n.exceptions(this)),n.historyAutocapture&&this.su.push(this.historyAutocapture=new n.historyAutocapture(this)),n.tracingHeaders&&this.su.push(this.tracingHeaders=new n.tracingHeaders(this)),n.siteApps&&this.su.push(this.siteApps=new n.siteApps(this)),n.sessionRecording&&!t&&this.su.push(this.sessionRecording=new n.sessionRecording(this)),this.config.disable_scroll_properties||s.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),n.autocapture&&this.Hu(this.autocapture=new n.autocapture(this),s),n.surveys&&this.Hu(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new n.surveys(this),s),n.logs&&this.Hu(this.logs=null!==(l=this.logs)&&void 0!==l?l:new n.logs(this),s),n.metrics&&this.su.push(this.metrics=null!==(a=this.metrics)&&void 0!==a?a:new n.metrics(this)),n.conversations&&this.su.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new n.conversations(this)),n.productTours&&this.su.push(this.productTours=new n.productTours(this)),n.heatmaps&&this.su.push(this.heatmaps=new n.heatmaps(this)),n.webVitalsAutocapture&&this.su.push(this.webVitalsAutocapture=new n.webVitalsAutocapture(this)),n.exceptionObserver&&this.su.push(this.exceptionObserver=new n.exceptionObserver(this)),n.deadClicksAutocapture&&this.su.push(this.deadClicksAutocapture=new n.deadClicksAutocapture(this,Z_)),n.toolbar&&this.su.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new n.toolbar(this)),n.experiments&&this.su.push(this.experiments=null!==(c=this.experiments)&&void 0!==c?c:new n.experiments(this)),this.su.forEach(t=>{t.initialize&&s.push(()=>{var e;null===(e=t.initialize)||void 0===e||e.call(t)})}),s.push(()=>{if(this.Wu){const t=this.Wu;this.Wu=void 0,this.su.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}}),this.Vu(s,i)}Vu(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout(()=>{this.Vu(t,e)},0);const i=t.shift();if(i)try{i()}catch(t){Vs.error("Error initializing extension:",t)}}const i=Math.round(performance.now()-e);this.register_for_session({[Ft]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Dt]:i}),this.config.__preview_deferred_init_extensions&&Vs.info(`PostHog extensions initialized (${i}ms)`)}Kl(t){var e;if(!n||!n.body)return Vs.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Kl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Wu=t),this.lu=t,this.compression=void 0,t.ok){var i;const e=t.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=ge(e.supportedCompression,hp.GZipJS)?hp.GZipJS:ge(e.supportedCompression,hp.Base64)?hp.Base64:void 0),(null===(i=e.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=e.analytics.endpoint)}this.set_config({person_profiles:this.Mu?this.Mu:Kt}),null===(e=this.Gu)||void 0===e||e.handleRemoteConfig(t),this.su.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}ju(){try{this.config.loaded(this)}catch(t){Vs.critical("`loaded` function failed",t)}if(this.Zu(),this.config.internal_or_test_user_hostname&&(null==s?void 0:s.hostname)){const t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.fu())&&this.Qu()},1),this.Ju=new xb(this),this.Ju.load()}Zu(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.Fu)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Zs(this.__request_queue,t=>this.Ou(t)),this.__request_queue=[],this.Zu()}_handle_unload(){var t,e,i,n,s,r;this.wu=!0,null===(t=this.surveys)||void 0===t||null===(e=t.handlePageUnload)||void 0===e||e.call(t),null===(i=this.metrics)||void 0===i||i.flush("sendBeacon"),this.config.request_batching?(this.Ku()&&this.capture(ee),null===(n=this.logs)||void 0===n||n.flushLogs("sendBeacon"),null===(s=this.Fu)||void 0===s||s.unload(),null===(r=this.Du)||void 0===r||r.unload()):this.Ku()&&this.capture(ee,null,{transport:"sendBeacon"})}_send_request(t){Wb(this,t)}Ou(t,e){this.Du?this.Du.retriableRequest(t,e):this._send_request(e?ue(ue({},t),{},{transport:e}):t)}_execute_array(t){mw++;try{let e;const i=[],n=[],s=[];Zs(t,t=>{if(t)if(e=t[0],Se(e))s.push(t);else if(xe(t))try{t.call(this)}catch(e){Vs.error("Error executing queued PostHog call",t,e)}else Se(t)&&"alias"===e?i.push(t):Se(t)&&-1!==e.indexOf("capture")&&xe(this[e])?s.push(t):n.push(t)});const r=function(t,e){Zs(t,function(t){try{if(Se(t[0])){let i=e;Qs(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){Vs.error("Error executing queued PostHog call",t,e)}})};r(i,this),r(n,this),r(s,this)}finally{mw--}}push(t){if(mw>0&&Se(t)&&Ee(t[0])){const i=e.prototype[t[0]];return void(xe(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}get Xu(){return{property:_,persistenceKey:b,cookieName:"_fbc",pattern:xw,register:(t,e)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[b]:{value:t,delivered:e}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(b)}}}get Yu(){return{property:w,persistenceKey:k,cookieName:"_fbp",pattern:Cw,register:(t,e)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[k]:{value:t,delivered:e}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(k)}}}th(t){var e;const i=null===(e=this.persistence)||void 0===e?void 0:e.get_property(t.persistenceKey);return Ee(i)&&t.pattern.test(i)?{value:i,delivered:!1}:Ce(i)&&Ee(i.value)&&t.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}eh(t,e,i){return e===(null==i?void 0:i.value)?{value:e,pending:!i.delivered}:(t.register(e,!1),{value:e,pending:!0})}ih(t){if(!this.config.save_campaign_params||this.fu())return;const e=xl(t.cookieName);return Ee(e)&&t.pattern.test(e)?e:void 0}nh(t,e,i,n){if(!this.persistence)return;const s=this.Xu;this.persistence.refreshKey(s.persistenceKey);const r=this.th(s);if(n)return void s.unregister();if(i)return Ee(e)&&xw.test(e)?this.eh(s,e,r):void s.unregister();const o=Ee(t)&&Sw.test(t)?t:void 0,l=this.ih(s);return l&&((t,e,i)=>{const n=t.split(".");if(e)return n[3]===e;if(!i)return!0;const s=i.value.split(".");return n[3]===s[3]||Number(n[2])>Number(s[2])})(l,o,r)?this.eh(s,l,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this.eh(s,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}sh(t,e,i){if(!this.persistence)return;const n=this.Yu;this.persistence.refreshKey(n.persistenceKey);const s=this.th(n);if(i)return void n.unregister();if(e)return Ee(t)&&Cw.test(t)?this.eh(n,t,s):void n.unregister();const r=this.ih(n);return r?this.eh(n,r,s):s?{value:s.value,pending:!s.delivered}:void 0}rh(t,e){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const i=this.th(t);(null==i?void 0:i.value)!==e||i.delivered||t.register(e,!0)}capture(t,e,i){var n,s;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu))return void Vs.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Te(t)||!Ee(t))return void Vs.error("No event name provided to posthog.capture");this.yu();const r=!this.config.opt_out_useragent_filter&&this._is_bot();if(r&&!this.config.__preview_capture_bot_pageviews)return;const o=(null==i?void 0:i.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==o?void 0:o.isRateLimited)return void Vs.critical("This capture call is ignored due to client rate limiting.");let l;(null==e?void 0:e.$current_url)&&!Ee(null==e?void 0:e.$current_url)&&(Vs.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||(null==i?void 0:i.oh)||Vs.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&&(l=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 a=new Date,u=(null==i?void 0:i.timestamp)||a,h=ln(null==i?void 0:i.uuid,Ml);let c={uuid:h,event:t,properties:this.calculateEventProperties(t,e||{},u,h)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&r&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),o&&(c.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens);const d="$feature_flag_called"===t&&!1===c.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!d&&(c.$set=null==i?void 0:i.$set);const v=Ce(null==e?void 0:e.$set)?e.$set:void 0,f=Se(null==e?void 0:e.$unset)?e.$unset:[],p=(null==i?void 0:i.$unset)||[],g=t=>{var e;const n=!!(null==i?void 0:i.$set)&&t in i.$set;return{hasProvided:n||!!v&&t in v,provided:n?null==i||null===(e=i.$set)||void 0===e?void 0:e[t]:null==v?void 0:v[t],unset:-1!==f.indexOf(t)||-1!==p.indexOf(t)}},m=g(_),y=g(w),b=[{channel:this.Xu,hasProvided:m.hasProvided,update:this.nh(null==l?void 0:l.fbclid,m.provided,m.hasProvided,m.unset)},{channel:this.Yu,hasProvided:y.hasProvided,update:this.sh(y.provided,y.hasProvided,y.unset)}];for(const{channel:t,hasProvided:e,update:i}of b)i&&!0===c.properties.$process_person_profile&&i.pending&&!e&&!d&&(c.$set=ue({[t.property]:i.value},c.$set));const k=null==i?void 0:i.$unset;k&&(c.$unset=k);const S=d?void 0:this.ah(null==i?void 0:i.$set_once,t!==ne,t===ie);if(S&&(c.$set_once=S),(null==i?void 0:i._noTruncate)||(x=this.config.properties_string_max_length,c=function(t,e){const i=new Set;return function t(n,s){if(n!==Object(n))return e?e(n):n;if(i.has(n))return;let r;if(i.add(n),Se(n))r=[],Zs(n,e=>{r.push(t(e))});else{const e={};Qs(Be(n)?tr(n):n,(n,s)=>{i.has(n)||(e[s]=t(n,s))}),r=e}return r}(t)}(c,t=>Ee(t)?t.slice(0,x):t)),c.timestamp=u,Te(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=a),d&&(c.properties=((t,e=[])=>{const i={},n=e=>{void 0!==t[e]&&(i[e]=t[e])};return os.forEach(n),e.forEach(n),i})(c.properties,$w)),t===_p.DISMISSED||t===_p.SENT){const i=null==e?void 0:e[bp.SURVEY_ID],n=null==e?void 0:e[bp.SURVEY_ITERATION];Mp({id:i,current_iteration:n}),c.$set=ue(ue({},c.$set),{},{[ra({id:i,current_iteration:n},t===_p.SENT?"responded":"dismissed")]:!0})}else t===_p.SHOWN&&(c.$set=ue(ue({},c.$set),{},{[bp.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var x;if(t===_b.SHOWN){const t=null==e?void 0:e[bb.TOUR_TYPE];t&&(c.$set=ue(ue({},c.$set),{},{[`${bb.TOUR_LAST_SEEN_DATE}/${t}`]:(new Date).toISOString()}))}const C=ue(ue({},c.properties.$set),c.$set);if($e(C)||this.setPersonPropertiesForFlags(C),!Re(this.config.before_send)){const t=this.Os(c);if(!t)return;c=t,c.uuid=ln(c.uuid,Ml)}const T=b.filter(({channel:t,update:e})=>{var i,n,s;const r=null!==(i=null===(n=c.$set)||void 0===n?void 0:n[t.property])&&void 0!==i?i:Ce(null===(s=c.properties)||void 0===s?void 0:s.$set)?c.properties.$set[t.property]:void 0;return(null==e?void 0:e.pending)&&r===e.value});this.au.emit("eventCaptured",c);const E=null!==(n=null==i?void 0:i._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),I="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(E),M=ue(ue(ue({method:"POST",url:E,data:c,compression:"best-available",timestampMode:I?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},I&&(null===(s=c.properties)||void 0===s?void 0:s.$session_id)?{batchGroup:c.properties.$session_id+(c.properties.$window_id?`-${c.properties.$window_id}`:"")}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),T.length?{fireCallbackOnDrop:!0,callback:t=>{if(t.statusCode>=200&&300>t.statusCode)for(const{channel:t,update:e}of T)this.rh(t,e.value)}}:{});if(!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)||T.length){var R;let t;!M.transport&&!M.callback&&$e(null!==(R=this.config.request_headers)&&void 0!==R?R:{})&&this.wu&&(t="sendBeacon"),this.Ou(M,t)}else this.Fu.enqueue(M);return c}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null===(e=this.Gu)||void 0===e?void 0:e.getExtension(t)}zu(){var t;return null!==(t=this.Gu)&&void 0!==t?t:this.Gu=new pw(this)}hu(t){this.$u.push(t);let e=!0;return()=>{if(!e)return;e=!1;const i=this.$u.indexOf(t);-1!==i&&this.$u.splice(i,1)}}uh(t=!0){var e,i,n;return!!(null===(e=this.persistence)||void 0===e?void 0:e.consumeCookieIdentityChange())&&(this.Eu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(n=this.sessionPersistence)||void 0===n||n.clear(),this.xu.clear(),this.hh()),null===(i=this.featureFlags)||void 0===i||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,r,o,l){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.uh();const a=l?void 0:this.persistence.remove_event_timer(e);let h=ue({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.fu()&&(h[At]=!0),"$snapshot"===e){const t=ue(ue({},this.persistence.properties()),this.sessionPersistence.properties());return h.distinct_id=t.distinct_id,(!Ee(h.distinct_id)&&!Pe(h.distinct_id)||Ie(h.distinct_id))&&Vs.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}const c=function(e,i,n,r=!1){var o,l,a,h;if(!u)return{};const c=e?[...Ca,...i||[]]:[],[d,v]=Zi(u),[f,p]=function(t){for(let e=0;Yi.length>e;e++){const[i,n,s]=Yi[e],r=t.match(i);if(r){const e=s&&t.match(s)||r;return[n,(null==e?void 0:e[1])||""]}}return["",""]}(u),g=function(){const t="u">typeof navigator?navigator:void 0;return(null==t?void 0:t.brave)?{brave:!0}:{}}(),m={};Te(n)||(m.detectGoogleSearchApp=n);const y={},_=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,b=null===(l=navigator)||void 0===l?void 0:l.maxTouchPoints,w=null==t||null===(a=t.screen)||void 0===a?void 0:a.width,k=null==t||null===(h=t.screen)||void 0===h?void 0:h.height,S=null==t?void 0:t.devicePixelRatio;Te(_)||(y.userAgentDataPlatform=_),Te(b)||(y.maxTouchPoints=b),Te(w)||(y.screenWidth=w),Te(k)||(y.screenHeight=k),Te(S)||(y.devicePixelRatio=S);const x=Js(Xs({$os:d,$os_version:v,$browser:zi(u,navigator.vendor,g,m),$webview_app:f,$webview_app_version:p,$device:Qi(u),$device_type:Ji(u,y),$timezone:Na(),$timezone_offset:qa()}),{$current_url:hr(r?un(null==s?void 0:s.href):null==s?void 0:s.href,c,Ta),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:Vi(u,navigator.vendor,g,m),$browser_language:Pa(),$browser_language_prefix:Oa(),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:zs.LIB_NAME,$lib_version:zs.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return zs.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=zs.SDK_DIST_CHANNEL),x}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:t,windowId:e}=this.sessionManager.checkAndGetSessionAndWindowId(l,r.getTime(),!0);h.$session_id=t,h.$window_id=e}this.sessionPropsManager&&Js(h,this.sessionPropsManager.getSessionProps());try{var d;this.sessionRecording&&Js(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null===(d=this.Du)||void 0===d?void 0:d.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}let v;if(this.requestRouter.region===sw&&(h.$lib_custom_api_host=this.config.api_host),v="$pageview"!==e||l?"$pageleave"!==e||l?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),h=Js(h,v),"$pageview"===e&&n&&(h.title=n.title),!Te(a)){const t=r.getTime()-a;h.$duration=parseFloat((t/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");const f=this.persistence.properties(),p=this.sessionPersistence.properties(),g=h.$groups,m=f.$groups;Ce(g)&&!$e(g)&&(h.$groups=ue(ue({},Ce(m)?m:{}),g)),Qs(["$referrer","$referring_domain"],t=>{t in f&&delete p[t]});const y={};if(this.$u.length>0)for(const t of this.$u.slice())try{Js(y,t())}catch(t){Vs.error("Failed to produce browser extension event properties",t)}h=Js({},c,f,p,ue(ue({},y),h)),h.$is_identified=this._isIdentified(),Se(this.config.property_denylist)?Qs(this.config.property_denylist,function(t){delete h[t]}):Vs.error(kw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const _=this.config.sanitize_properties;_&&(Vs.error(ww),h=_(h,e));const b=this.dh();return h.$process_person_profile=b,b&&!l&&this.fh("_calculate_event_properties"),h}ah(t,e=!0,i=!1){var n;if(!this.persistence||!this.dh())return t;if(this.Su&&!i)return t;const s=this.persistence.get_initial_props(),r=null===(n=this.sessionPropsManager)||void 0===n?void 0:n.getSetOnceProps();let o=Js({},s,r||{},t||{});const l=this.config.sanitize_properties;return l&&(Vs.error(ww),o=l(o,"$set_once")),e&&(this.Su=!0),$e(o)?void 0:o}register(t,e){var i;null===(i=this.persistence)||void 0===i||i.register(t,e)}register_once(t,e,i){var n;null===(n=this.persistence)||void 0===n||n.register_once(t,e,i)}register_for_session(t){var e,i;null===(e=this.persistence)||void 0===e||e.syncCookieProperties(),this.uh(),null===(i=this.sessionPersistence)||void 0===i||i.register(t),Object.keys(t).forEach(t=>this.xu.add(t)),this.hh()}unregister(t){var e;null===(e=this.persistence)||void 0===e||e.unregister(t)}unregister_for_session(t){var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t),this.xu.delete(t),this.hh()}ph(t,e){this.register({[t]:e})}Lu(){this.xu.forEach(t=>{var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t)}),this.xu.clear(),this.hh()}hh(){var t;if(!this.Cu)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.pi)||!Kl.Et())return void Kl.Lt(this.Cu);const e=[];this.xu.forEach(t=>e.push(t)),e.length>0?Kl.At(this.Cu,e):Kl.Lt(this.Cu)}getFeatureFlag(t,e){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,n;return null!==(i=null===(n=this.featureFlags)||void 0===n?void 0:n.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null===(t=this.featureFlags)||void 0===t||t.reloadFeatureFlags()}updateFlags(t,e,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e=!1,i){var n;return null===(n=this.featureFlags)||void 0===n?void 0:n.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.au.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:bw}),()=>{})}onSessionId(t){var e,i;return null!==(e=null===(i=this.sessionManager)||void 0===i?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e=!1){this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:bw})}getActiveMatchingSurveys(t,e=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:bw})}renderSurvey(t,e){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(t,e)}displaySurvey(t,e=Pp){var i;null===(i=this.surveys)||void 0===i||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null===(e=this.surveys)||void 0===e||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null===(i=this.surveys)||void 0===i?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:bw}}canRenderSurveyAsync(t,e=!1){var i,n;return null!==(i=null===(n=this.surveys)||void 0===n?void 0:n.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:bw})}gh(t){return!t||Ie(t)?(Vs.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Vs.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Vs.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return Vs.uninitializedWarning("posthog.identify");if(Pe(t)&&(t=t.toString(),Vs.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.gh(t))return;if(!this.fh("posthog.identify"))return;this.yu();const n=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,r=this.uh(!1),o=this.persistence.Pl();let l=!1;try{const n=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:n},""),t!==n&&t!==this.get_property("__alias")&&(this.unregister(m),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Qt,u=t!==n,h=!u&&o;if(u&&o){var a;const s=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:n};this.persistence.set_property($t,Jt),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$identify",s,{$set:e||{},$set_once:i||{}})&&(this.Eu=ma(t,e,i)),null===(a=this.featureFlags)||void 0===a||a.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:n)}else if(h){this.persistence.set_property($t,Jt);const n=e||{},s=i||{};this.setPersonPropertiesForFlags({$set:n,$set_once:s},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$set",{$set:n,$set_once:s})&&(this.Eu=ma(t,e,i))}else(e||i)&&this.setPersonProperties(e,i);u||s||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(kt)):h&&(e||i)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Ol(l)}}setPersonProperties(t,e){if(!t&&!e)return;if(!this.fh("posthog.setPersonProperties"))return;const i=ma(this.get_distinct_id(),t,e);this.Eu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}})&&(this.Eu=i)):Vs.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var e;const i=(Se(t)?t:[t]).filter(t=>Ee(t)&&t.length>0);0!==i.length&&this.fh("posthog.unsetPersonProperties")&&(null===(e=this.featureFlags)||void 0===e||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Eu=null)}group(t,e,i){var n;if(!t||!e)return void Vs.error("posthog.group requires a group type and group key");null===(n=this.persistence)||void 0===n||n.syncCookieProperties(),this.uh();const s=this.getGroups(),r=s[t]!==e;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ue(ue({},s),{},{[t]:e})}),(r||i)&&this.dh()){const n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(ne,n)}i&&this.setGroupPropertiesForFlags({[t]:i}),r&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e=!0){var i;null===(i=this.featureFlags)||void 0===i||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t=!0){var e;null===(e=this.featureFlags)||void 0===e||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e=!0){var i;this.fh("posthog.setGroupPropertiesForFlags")&&(null===(i=this.featureFlags)||void 0===i||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null===(e=this.featureFlags)||void 0===e||e.resetGroupPropertiesForFlags(t)}reset(t){const e=Ae(t)?t:null==t?void 0:t.resetDeviceID,i=Ae(t)||null==t?void 0:t.bootstrap;this.mh(e,!1,i)}mh(t,e=!1,i){var n,s,r,o,l,a;if(Vs.info("reset"),!this.__loaded)return Vs.uninitializedWarning("posthog.reset");const u=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(n=this.Ru)||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.Xl());const h=this.get_property(p),c=this.get_property(g),d=this.get_property(F);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();this.consent.reset(),e||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const f=null===(l=this.persistence)||void 0===l||null===(a=l.Pl)||void 0===a?void 0:a.call(l);let m=!1;try{var y,_,b,w,k,S,x,C,T,E,I,M,R;if(null===(y=this.persistence)||void 0===y||y.clear(),null===(_=this.sessionPersistence)||void 0===_||_.clear(),this.xu.clear(),this.hh(),Te(d)||null===(E=this.persistence)||void 0===E||E.register({$session_recording_remote_config:d}),null===(b=this.surveys)||void 0===b||b.reset(),null===(w=this.featureFlags)||void 0===w||w.reset(),null===(k=this.conversations)||void 0===k||k.reset(),null===(S=this.logs)||void 0===S||S.reset(),null===(x=this.metrics)||void 0===x||x.reset(),null===(C=this.persistence)||void 0===C||C.set_property("$user_state","anonymous"),null===(T=this.sessionManager)||void 0===T||T.resetSessionId(),this.Eu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Ot,$device_id:null},"");else{const e=this.config.get_device_id(Ml());this.register_once({distinct_id:e,$device_id:t?e:h},""),t||Te(c)||this.register({[g]:c})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(i.distinctID&&!this.fu()&&(null===(R=this.persistence)||void 0===R||R.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(I=this.featureFlags)||void 0===I||I.initialize(),!Re(u)&&!(null===(M=this.sessionManager)||void 0===M?void 0:M.setBootstrapSessionId(u,!0))){const t=ue({},i);delete t.sessionID,this.config.bootstrap=t}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,m=!0}finally{var P,O;f&&(null===(P=this.persistence)||void 0===P||null===(O=P.Ol)||void 0===O||O.call(P,m))}this.reloadFeatureFlags()}shutdown(t){var e=this;return re(function*(){var t,i,n,s,r,o,l,a;if(e.__loaded){e.ku=!0,e.zu().dispose(),null===(t=e.sessionRecording)||void 0===t||t.dispose(),null===(i=e.logs)||void 0===i||i.flushLogs("sendBeacon"),null===(n=e.metrics)||void 0===n||n.flush("sendBeacon"),null===(s=e.metrics)||void 0===s||s.dispose(),null===(r=e.Fu)||void 0===r||r.unload(),null===(o=e.Du)||void 0===o||o.unload();try{var u;null===(u=e.featureFlags)||void 0===u||u.destroy()}catch(t){Vs.error("Error while destroying feature flags",t)}null===(l=e.persistence)||void 0===l||l.destroy(),null===(a=e.sessionPersistence)||void 0===a||a.destroy()}else Vs.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,e){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null===(i=this.conversations)||void 0===i||i.yh()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(t=this.conversations)||void 0===t||t.bh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null===(e=this.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:e,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let n=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${e}`);if((null==t?void 0:t.withTimestamp)&&i){var s;const e=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return n;n+=`?t=${Math.max(Math.floor(((new Date).getTime()-i)/1e3)-e,0)}`}return n}alias(t,e){return t===this.get_property("$people_distinct_id")?(Vs.critical("Attempting to create alias for existing People user - aborting."),-2):this.fh("posthog.alias")?(Te(e)&&(e=this.get_distinct_id()),t!==e?(this.ph(m,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Vs.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const e=ue({},this.config);if(Ce(t)){var i,n,s,r,o,l,a,u,h,c,d,v,f,p;Js(this.config,Rw(t));const m=this.bu();null===(i=this.persistence)||void 0===i||i.update_config(this.config,e,m),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new yb(ue(ue({},this.config),{},{persistence:"sessionStorage"}),m,!1);const y=this.Pu(this.config.debug);var g;Ae(y)&&(this.config.debug=y),Ae(this.config.debug)&&(this.config.debug?(Yl.DEBUG=!0,Ll.Et()&&Ll.At("ph_debug",!0),Vs.info("set_config",{config:t,oldConfig:e,newConfig:ue({},this.config)})):(Yl.DEBUG=!1,Ll.Et()&&Ll.Lt("ph_debug"))),null===(n=this.featureFlags)||void 0===n||null===(s=n.updateConfig)||void 0===s||s.call(n,this.config,this.Xl()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(l=this.metrics)||void 0===l||l.onConfigChange(),null===(a=this.sessionRecording)||void 0===a||a.startIfEnabledOrStop(),null===(u=this.tracingHeaders)||void 0===u||u.startIfEnabledOrStop(),null===(h=this.autocapture)||void 0===h||h.startIfEnabled(),null===(c=this.heatmaps)||void 0===c||c.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(g=this.historyAutocapture)||void 0===g||g.startIfEnabledOrStop()),null===(d=this.exceptionObserver)||void 0===d||d.startIfEnabledOrStop(),null===(v=this.deadClicksAutocapture)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.surveys)||void 0===f||f.loadIfEnabled(),this._u(),null===(p=this.externalIntegrations)||void 0===p||p.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&K_(this,yw,!1)}}_overrideSDKInfo(t,e){Yl.LIB_NAME=t,Yl.LIB_VERSION=e}startSessionRecording(t){const e=!0===t,i={sampling:e||!!(null==t?void 0:t.sampling),linked_flag:e||!!(null==t?void 0:t.linked_flag),url_trigger:e||!!(null==t?void 0:t.url_trigger),event_trigger:e||!!(null==t?void 0:t.event_trigger)};var n,s,r,o,l;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===(l=this.sessionRecording)||void 0===l||l.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(null===(t=this.sessionRecording)||void 0===t?void 0:t.started)}captureException(t,e){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(ue(ue({},i),e))}catch(t){return}}addExceptionStep(t,e){var i;null===(i=this.exceptions)||void 0===i||i.addExceptionStep(t,e)}captureLog(t){var e;null===(e=this.logs)||void 0===e||e.captureLog(t)}get logger(){var t,i;return null!==(t=null===(i=this.logs)||void 0===i?void 0:i.logger)&&void 0!==t?t:e._h}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null===(i=this.toolbar)||void 0===i?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null===(e=this.persistence)||void 0===e?void 0:e.props[t]}getSessionProperty(t){var e;return null===(e=this.sessionPersistence)||void 0===e?void 0:e.props[t]}toString(){var t;let e=null!==(t=this.config.name)&&void 0!==t?t:Tw;return e!==Tw&&(e="posthog."+e),e}_isIdentified(){var t,e;return"identified"===(null===(t=this.persistence)||void 0===t?void 0:t.get_property("$user_state"))||"identified"===(null===(e=this.sessionPersistence)||void 0===e?void 0:e.get_property("$user_state"))}dh(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&$e(this.getGroups())&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.__alias)&&!(null===(e=this.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.$epp))}Ku(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.dh()||this.fh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.fh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}fh(t){return"never"===this.config.person_profiles?(Vs.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ph(Pt,!0),!0)}bu(){if("always"===this.config.cookieless_mode)return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_u(){var t,e;const i=this.bu();var n,s,r;return this.is_capturing()||null===(n=this.logs)||void 0===n||n.wh(),(null===(t=this.persistence)||void 0===t?void 0:t.pi)!==i&&(null===(s=this.persistence)||void 0===s||s.set_disabled(i)),(null===(e=this.sessionPersistence)||void 0===e?void 0:e.pi)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),i&&(this.xu.clear(),this.hh()),i}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){if(this.fu()){var n,s,r,o,l,a;null===(n=this.sessionRecording)||void 0===n||n.dispose({discardBufferedEvents:!0}),this.mh(!0,!0),null===(s=this.sessionManager)||void 0===s||s.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new ew(this),this.pageViewManager=new eb(this),this.persistence&&(this.sessionPropsManager=new Kb(this,this.sessionManager,this.persistence));const t=null!==(o=null===(l=this.config.__extensionClasses)||void 0===l?void 0:l.sessionRecording)&&void 0!==o?o:null===(a=e.__defaultExtensionClasses)||void 0===a?void 0:a.sessionRecording;var u,h;t&&(this.sessionRecording=this.vu(this.sessionRecording,new t(this)),this.lu&&(null===(u=this.sessionRecording)||void 0===u||null===(h=u.onRemoteConfig)||void 0===h||h.call(u,this.lu)))}var c,d;this.consent.optInOut(!0),this._u(),this.Zu(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(c=this.surveys)||void 0===c||c.loadIfEnabled()),(Te(null==t?void 0:t.captureEventName)||(null==t?void 0:t.captureEventName))&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Qu()}else Vs.warn(_w)}opt_out_capturing(){if("always"===this.config.cookieless_mode)return void Vs.warn(_w);const t="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;var e,i;null==t||t.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.mh(!0,!0),this.consent.optInOut(!1),this._u(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Ot,$device_id:null}),this.du(t),this.sessionRecording=void 0,null===(e=this.sessionManager)||void 0===e||e.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Qu(),this.Zu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._u()}_is_bot(){return i?iw(i,this.config.custom_blocked_useragents):void 0}Qu(){n&&("visible"===n.visibilityState?this.Tu||(this.Tu=!0,this.capture(te,{title:n.title},{send_instantly:!0}),this.Iu&&(n.removeEventListener(Yt,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),nr(n,Yt,this.Iu)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Xl(){const t=this.Ru||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Vs.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,e,i,n,s){const r=e in t&&!Re(t[e]),o=i in t&&!Re(t[i]);return r?t[e]:!!o&&(s&&s.warn(`Config field '${i}' is deprecated. Please use '${e}' instead. The old field will be removed in a future major version.`),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,Vs)}Os(t){var e;if(Re(this.config.before_send))return t;const i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(Le),n=Se(this.config.before_send)?this.config.before_send:[this.config.before_send];let s=t;for(const e of n)try{if(s=e(s),Re(s)){const e=`Event '${t.event}' was rejected in beforeSend function`;return De(t.event)?Vs.warn(`${e}. This can cause unexpected behavior.`):Vs.info(e),null}s.properties&&!$e(s.properties)||Vs.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(e){return Vs.error(`Error in beforeSend function for event '${t.event}':`,e),null}for(const e of i)if(s.properties&&Re(s.properties[e]))return Vs.warn(`Event '${t.event}' had its '${e}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return s}getPageViewId(){var t;return null===(t=this.pageViewManager.Bo)||void 0===t?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Pu(t){const e=Ae(t)&&!t,i=Ll.Et()&&"true"===Ll.Ot("ph_debug");return!e&&(!!i||t)}};Ow.__defaultExtensionClasses={},Ow._h=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(let i=0;e.length>i;i++)t.prototype[e[i]]=Ys(t.prototype[e[i]])}(Ow,["identify"]);var Aw=class{constructor(t){this._instance=t}refresh(t){const e=this._instance.config,i=Ce(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.Xl(),t.url_allowlist=null==i?void 0:i.url_allowlist,t.url_ignorelist=null==i?void 0:i.url_ignorelist,t.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,t.element_allowlist=null==i?void 0:i.element_allowlist,t.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,t.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,t.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,t.capture_copied_text=null==i?void 0:i.capture_copied_text}};const Fw=Gs("[ExceptionAutocapture]"),Dw=Gs("[TracingHeaders]"),Lw=Gs("[Web Vitals]"),Nw=9e5,qw=["CLS","FCP","INP","LCP"],Bw=["INP","LCP"],jw=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Hw=Gs("[SessionRecording]"),Uw=Gs("[Heatmaps]");function zw(t){return Ce(t)&&"clientX"in t&&"clientY"in t&&Pe(t.clientX)&&Pe(t.clientY)}const Ww=Gs("[Product Tours]"),Vw=t=>{var e;return!t.config.disable_product_tours&&!!(null===(e=t.persistence)||void 0===e?void 0:e.get_property(P))},Gw=["$set_once","$set"],Zw=Gs("[SiteApps]"),Qw="Error while initializing PostHog app with config id ",Jw=(t,e)=>(null==t?void 0:t.then)?t.then(e):e(t),Kw="SDK is not enabled or survey functionality is not yet loaded",Yw="Disabled. Not loading surveys.";var Xw=class{constructor(t,e){this.yo=t,this.kh=e,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Sh=!1,this.xh=[],this.Ch=null,this.$h=null,this.So=!1,this.Th=new Set,this.onRemoteConfig=t=>{if(this.So)return;if(this.Mr.disableSurveys)return;if(!t.ok)return Sp.warn("Remote config unavailable. Not loading surveys.");const e=t.config.surveys;if(Re(e))return Sp.warn("Flags not loaded yet. Not loading surveys.");this.Ih=Ae(e)?e:e.length>0,Sp.info(`flags response received, isSurveysEnabled: ${this.Ih}`),this.loadIfEnabled()}}setup(t){if(!this.So)return this.Mh=t,Jw(t.kv.initialize(),()=>{if(this.Mh!==t||this.So)return;this.Mh=void 0,this.po=t;const e=t.onRemoteConfig(this.onRemoteConfig);this.So?e.dispose():(this.$o=e,this.loadIfEnabled())})}dispose(){var t,e,i,n;this.So||(this.So=!0,this.Mh=void 0,this.po=void 0,null===(t=this.$o)||void 0===t||t.dispose(),this.$o=void 0,null===(e=this._surveyEventReceiver)||void 0===e||e.dispose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(n=i.dispose)||void 0===n||n.call(i),this._surveyManager=null,this.xh=[],this.Ch=null,this.Th.forEach(t=>clearTimeout(t)),this.Th.clear())}get Mr(){return this.yo.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null===(t=this._surveyEventReceiver)||void 0===t||t.reset(),localStorage.removeItem("lastSeenSurveyDate");const 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(t=>localStorage.removeItem(t))}catch(t){}}loadIfEnabled(){if(this.So||!this.po)return;const t=this.Mr;if(this._surveyManager)return;if(this.Sh)return void Sp.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Sp.info(Yw);if(t.cookielessMode&&this.yo.isOptedOut())return void Sp.info("Not loading surveys in cookieless mode without consent.");const e=this.yo.getExtensions();if(!e)return void Sp.error("PostHog Extensions not found.");if(Te(this.Ih)&&!t.advancedEnableSurveys)return;const i=this.Ih||t.advancedEnableSurveys;this.Sh=!0;try{const t=e.generateSurveys;if(t)return this.Eh(t,i),void(this.Sh=!1);const n=e.loadExternalDependency;if(!n)return this.Ph(Zt),void(this.Sh=!1);n(t=>{try{if(this.So)return;const e=this.yo.getExtensions();t||!(null==e?void 0:e.generateSurveys)?this.Ph("Could not load surveys script",t):this.Eh(e.generateSurveys,i)}finally{this.Sh=!1}})}catch(t){throw this.Sh=!1,this.Ph("Error initializing surveys",t),t}}Eh(t,e){this.So||(this._surveyManager=t(e),this._surveyEventReceiver=this.yo.createEventReceiver(),Sp.info("Surveys loaded successfully"),this.Rh({isLoaded:!0}))}Ph(t,e){Sp.error(t,e),this.Rh({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.xh.push(t),this._surveyManager&&this.Rh({isLoaded:!0}),()=>{this.xh=this.xh.filter(e=>e!==t)}}getSurveys(t,e=!1){var i;const n=null!==(i=this.po)&&void 0!==i?i:this.kh;if(!n||this.So)return;if(this.Mr.disableSurveys)return Sp.info(Yw),t([]);const s=n.kv.get(ht);if(s&&!e)return t(s,{isLoaded:!0}),void(this.Ah()&&this.getSurveys(()=>{},!0));if(this.Ch)return void this.Ch.then(({surveys:e,context:i})=>{this.So||t(e,i)}).catch(t=>Sp.error("Error in survey callback",t));const r=this.Fh("/api/surveys/",{method:"GET",query:{token:n.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(t=>{try{return this.Oh(n,t)}catch(t){return Sp.error("Error processing surveys response",t),this.Oh(n,{statusCode:0,error:t})}},t=>this.Oh(n,{statusCode:0,error:t}));this.Ch=r;const o=()=>{this.Ch===r&&(this.Ch=null)};r.then(e=>{o(),this.So||t(e.surveys,e.context)},o).catch(t=>Sp.error("Error in survey callback",t))}Fh(t,e){const i=this.po;return i?i.sendRequest(t,e):new Promise(t=>t({statusCode:0,error:new Error(Kw)}))}Oh(t,e){if(this.So)return{surveys:[],context:{isLoaded:!1,error:Kw}};const i=e.statusCode;if(200!==i||!e.json){const t=`Surveys API could not be loaded, status: ${i}`;return 0!==i?Sp.error(t):e.error||Sp.warn(t),this.$h=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.$h=null;const n=e.json.surveys||[],s=n.filter(t=>$p(t)&&(ca(t)||Tp(t)));var r;return s.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(s)),t.kv.set({[ht]:n,[ct]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}Ah(){return this.Dh()&&!this.Ch&&!this.Lh()}Dh(){var t,e;const i=null===(t=null!==(e=this.po)&&void 0!==e?e:this.kh)||void 0===t?void 0:t.kv.get(ct);return Pe(i)&&Date.now()-i>3e5}Lh(){return Pe(this.$h)&&3e5>Date.now()-this.$h}markSurveyAsSeen(t,e){var i;const n={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};Mp(n);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Rh(t){for(const e of this.xh)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Sp.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e=!1){if(!Re(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Sp.warn("init was not called")}Nh(t){let e=null;return this.getSurveys(i=>{var n;e=null!==(n=i.find(e=>e.id===t))&&void 0!==n?n:null}),e}qh(t){if(Re(this._surveyManager))return{eligible:!1,reason:Kw};const e="string"==typeof t?this.Nh(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}jh(t){if(!this.yo.isCapturing())return{eligible:!1,reason:xp};if(Re(this._surveyManager))return{eligible:!1,reason:Kw};const e="string"==typeof t?this.Nh(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Re(this._surveyManager))return Sp.warn("init was not called"),{visible:!1,disabledReason:Kw};const e=this.jh(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Re(this._surveyManager)?(Sp.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Kw})):new Promise(i=>{this.getSurveys(e=>{var n;const s=null!==(n=e.find(e=>e.id===t))&&void 0!==n?n:null;if(s){const t=this.jh(s);i({visible:t.eligible,disabledReason:t.reason})}else i({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,i){var s;if(!this.yo.isCapturing())return;if(Re(this._surveyManager))return void Sp.warn("init was not called");const r="string"==typeof t?this.Nh(t):t;if(!(null==r?void 0:r.id))return void Sp.warn("Survey not found");if(!Rp.includes(r.type))return void Sp.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const o=null==n?void 0:n.querySelector(e);if(o){if(null===(s=r.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds){Sp.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var e,n;this.Th.delete(t),!this.So&&this.yo.isCapturing()&&(Sp.info(`Rendering survey ${r.id} with delay of ${null===(e=r.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds} seconds`),null===(n=this._surveyManager)||void 0===n||n.renderSurvey(r,o,i),Sp.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Th.add(t)}this._surveyManager.renderSurvey(r,o,i)}else Sp.warn("Survey element not found")}displaySurvey(t,e){var i;if(!this.yo.isCapturing())return;if(Re(this._surveyManager))return void Sp.warn("init was not called");const n=this.Nh(t);if(!n)return void Sp.warn("Survey not found");let s=n;if((null===(i=n.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)&&e.ignoreDelay&&(s=ue(ue({},n),{},{appearance:ue(ue({},n.appearance),{},{surveyPopupDelaySeconds:0})})),e.displayType!==wp.Popover&&e.initialResponses&&Sp.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){const t=this.qh(n);if(!t.eligible)return void Sp.warn("Survey is not eligible to be displayed: ",t.reason)}e.displayType!==wp.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}cancelPendingSurvey(t){Re(this._surveyManager)?Sp.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t,e;null===(t=this._surveyManager)||void 0===t||null===(e=t.handlePageUnload)||void 0===e||e.call(t)}};function tk(t,e,i){if(Re(t))return!1;switch(i){case"exact":return t===e;case"contains":{const i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(t)}case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}var ek=class{constructor(t){this._instance=t,this.Bh=new Set,this.Hh=new Set,this.zh=new Yb,this.Uh=(t,e)=>this.Wh(t,e)&&this.Vh(t,e)&&this.Gh(t,e)&&this.Zh(t,e),this.Wh=(t,e)=>!(null==e?void 0:e.event)||(null==t?void 0:t.event)===(null==e?void 0:e.event)}init(){var t,e;Te(null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook)||(this.Qh=null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook((t,e)=>{this.on(t,e)}))}dispose(){var t;null===(t=this.Qh)||void 0===t||t.call(this),this.Qh=void 0,this.zh=new Yb}register(t){var e,i;if(!Te(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)&&(t.forEach(t=>{var e;this.Bh.add(t),null===(e=t.steps)||void 0===e||e.forEach(t=>{this.Hh.add((null==t?void 0:t.event)||"")})}),null===(i=this._instance)||void 0===i?void 0:i.autocapture)){const t=new Set;this.Bh.forEach(e=>{var i;null===(i=e.steps)||void 0===i||i.forEach(e=>{(null==e?void 0:e.selector)&&t.add(e.selector)})}),this._instance.autocapture.setElementSelectors(t)}}replace(t){this.Bh.clear(),this.Hh.clear(),this.register(t)}on(t,e){null!=e&&0!=t.length&&(this.Hh.has(t)||this.Hh.has(e.event))&&this.Bh.forEach(t=>{this.Jh(e,t)&&this.zh.emit("actionCaptured",t.name)})}Kh(t){this.onAction("actionCaptured",e=>t(e))}Jh(t,e){if(null==(null==e?void 0:e.steps))return!1;for(const i of e.steps)if(this.Uh(t,i))return!0;return!1}onAction(t,e){return this.zh.on(t,e)}Vh(t,e){if(null==e?void 0:e.url){var i;const n=null==t||null===(i=t.properties)||void 0===i?void 0:i.$current_url;if(!n||"string"!=typeof n)return!1;if(!tk(n,e.url,e.url_matching||"contains"))return!1}return!0}Gh(t,e){return!!this.Xh(t,e)&&!!this.Yh(t,e)&&!!this.tc(t,e)}Xh(t,e){var i;if(!(null==e?void 0:e.href))return!0;const n=this.ec(t);if(n.length>0)return n.some(t=>tk(t.href,e.href,e.href_matching||"exact"));const s=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!s&&tk(function(t){const e=t.match(/(?::|")href="(.*?)"/);return e?e[1]:""}(s),e.href,e.href_matching||"exact")}Yh(t,e){var i;if(!(null==e?void 0:e.text))return!0;const n=this.ec(t);if(n.length>0)return n.some(t=>tk(t.text,e.text,e.text_matching||"exact")||tk(t.$el_text,e.text,e.text_matching||"exact"));const s=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!s&&(r=function(t){const e=[],i=/(?::|")text="(.*?)"/g;let n;for(;!Re(n=i.exec(t));)e.includes(n[1])||e.push(n[1]);return e}(s),o=e.text,l=e.text_matching||"exact",r.some(t=>tk(t,o,l)));var r,o,l}tc(t,e){var i,n;if(!(null==e?void 0:e.selector))return!0;const s=null==t||null===(i=t.properties)||void 0===i?void 0:i.$element_selectors;if(null==s?void 0:s.includes(e.selector))return!0;const r=(null==t||null===(n=t.properties)||void 0===n?void 0:n.$elements_chain)||"";if(e.selector_regex&&r)try{return new RegExp(e.selector_regex).test(r)}catch(t){return!1}return!1}ec(t){var e;return null==(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}Zh(t,e){return!(null==e?void 0:e.properties)||0===e.properties.length||ga(e.properties.reduce((t,e)=>{const i=Se(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t},{}),null==t?void 0:t.properties)}},ik=class{constructor(t){var e,i;this.nc=[],this._instance=t,this.sc=new Map,this.rc=new Map,this.oc=new Map,this.lc=null===(e=this._instance)||void 0===e||null===(i=e.onSessionId)||void 0===i?void 0:i.call(e,t=>this.ac(t))}uc(t){return!1}hc(){return null}cc(t){}dc(){}vc(t,e){return!!t&&ga(t.propertyFilters,null==e?void 0:e.properties)}fc(t,e){const i=new Map;return t.forEach(t=>{var n;null===(n=t.conditions)||void 0===n||null===(n=n[e])||void 0===n||null===(n=n.values)||void 0===n||n.forEach(e=>{if(null==e?void 0:e.name){const n=i.get(e.name)||[];n.push(t.id),i.set(e.name,n)}})}),i}gc(t,e,i){const n=(i===cp.Activation?this.sc:this.rc).get(t);let s=[];return this.mc(t=>{s=t.filter(t=>null==n?void 0:n.includes(t.id))}),s.filter(n=>{var s;const r=null===(s=n.conditions)||void 0===s||null===(s=s[i])||void 0===s||null===(s=s.values)||void 0===s?void 0:s.find(e=>e.name===t);return this.vc(r,e)})}register(t){this.yc(t,!1)}replace(t){this.yc(t,!0)}yc(t,e){var i;Te(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)||(this.bc(t,e),this._c(t,e))}_c(t,e){const i=t.filter(t=>{var e;return null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length});var n;if(e&&this.oc.clear(),0===i.length)return void(e&&(null===(n=this.wc)||void 0===n||n.replace([])));this.wc||(this.wc=new ek(this._instance),this.wc.init(),this.wc.Kh(t=>this.onAction(t)));const s=[];i.forEach(t=>{var e;null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||e.values.forEach(e=>{if(s.push(e),e.name){var i;const n=null!==(i=this.oc.get(e.name))&&void 0!==i?i:[];n.includes(t.id)||n.push(t.id),this.oc.set(e.name,n)}})}),e?this.wc.replace(s):this.wc.register(s)}kc(t,e){e.forEach((e,i)=>{var n;const s=null!==(n=t.get(i))&&void 0!==n?n:[];e.forEach(t=>{s.includes(t)||s.push(t)}),t.set(i,s)})}bc(t,e){var i,n;const s=t.filter(t=>{var e,i;return(null===(e=t.conditions)||void 0===e?void 0:e.events)&&(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),r=t.filter(t=>{var e,i;return(null===(e=t.conditions)||void 0===e?void 0:e.cancelEvents)&&(null===(i=t.conditions)||void 0===i||null===(i=i.cancelEvents)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),o=this.fc(t,cp.Activation),l=this.fc(t,cp.Cancellation);e?(this.sc=o,this.rc=l):(this.kc(this.sc,o),this.kc(this.rc,l)),(0!==s.length||0!==r.length)&&(null!==(i=this.Qh)&&void 0!==i||(this.Qh=null===(n=this._instance)||void 0===n?void 0:n._addCaptureHook((t,e)=>{this.onEvent(t,e)})))}onEvent(t,e){var i,n;const s=this.Sc(),r=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$survey_id)||(null==e||null===(n=e.properties)||void 0===n?void 0:n.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const e=this.xc(t,r);if("consume"===e)return s.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.Cc([r]);if("persist"===e)return s.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.$c(r),void this.Tc([r])}if(this.rc.has(t)){const i=this.gc(t,e,cp.Cancellation);i.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:i.map(t=>t.id)}),this.Cc(i.map(t=>t.id)),i.forEach(t=>this.Ic(t.id)))}if(!this.sc.has(t))return;s.info("event name matched",{event:t,eventPayload:e,items:this.sc.get(t)});const o=this.gc(t,e,cp.Activation);this.Mc(o.map(t=>t.id))}onAction(t){this.oc.has(t)&&this.Mc(this.oc.get(t)||[])}Mc(t){var e,i;if(0===t.length)return;const n=!!(null===(e=this._instance)||void 0===e||null===(i=e.get_session_id)||void 0===i?void 0:i.call(e)),s=[];for(const e of t)n&&this.uc(e)?this.$c(e)&&this.Ec(e):s.push(e);s.length>0&&(this.nc=[...new Set([...this.nc,...s])]),this.Sc().info("updating activated items",{activatedItems:this.getActivatedIds()})}$c(t){this.nc=this.nc.filter(e=>e!==t);const e=this.Pc();return!e.includes(t)&&(this.Rc([...e,t]),this.Ac(),!0)}Cc(t){const e=new Set(t);this.nc=this.nc.filter(t=>!e.has(t));const i=this.Fc(),n=i.filter(t=>!e.has(t));n.length!==i.length&&(this.Rc(n),0===n.length&&this.Oc()),this.Tc(t)}Dc(){var t;const e=this.hc();if(!e)return{};const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[e];return i&&"object"==typeof i?i:{}}Ec(t){if(!this.hc())return;const e=this.Dc();this.cc(ue(ue({},e),{},{[t]:Date.now()}))}Tc(t){if(!this.hc())return;const e=this.Dc(),i={};let n=!1;for(const[s,r]of Object.entries(e))t.includes(s)?n=!0:i[s]=r;n&&($e(i)?this.dc():this.cc(i))}Lc(){this.hc()&&this.dc()}getActivationTimestamp(t){if(!this.Pc().includes(t))return;const e=this.Dc()[t];return Pe(e)?e:void 0}Fc(){var t;const e=this.Nc();return(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[e])||[]}Pc(){var t,e,i;const n=this.Fc();if(0===n.length)return[];const s=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[this.qc()],r=null===(e=this._instance)||void 0===e||null===(i=e.get_session_id)||void 0===i?void 0:i.call(e);return r&&s===r?n:[]}Ac(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(e=t.get_session_id)||void 0===e?void 0:e.call(t);i&&this.jc(i)}Oc(){this.Bc()}ac(t){var e;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[this.qc()];if(i&&i!==t){const t=this.Fc(),e=this.Dc();t.length>0&&(this.Rc([]),t.filter(t=>Pe(e[t])).forEach(t=>this.Ic(t))),this.Oc(),this.Lc()}}getActivatedIds(){return[...new Set([...this.Pc(),...this.nc])].filter(t=>!this.Hc(t))}dispose(){var t,e,i;null===(t=this.lc)||void 0===t||t.call(this),this.lc=void 0,null===(e=this.Qh)||void 0===e||e.call(this),this.Qh=void 0,null===(i=this.wc)||void 0===i||i.dispose(),this.wc=void 0}reset(){this.nc=[],this.Fc().length>0&&this.Rc([]),this.Oc(),this.Lc()}getEventToItemsMap(){return this.sc}zc(){return this.wc}},nk=class extends ik{constructor(t){super(t)}Nc(){return dt}qc(){return vt}hc(){return ft}cc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_timestamps:t})}dc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_timestamps")}uc(t){var e;let i;this.mc(e=>{i=e.find(e=>e.id===t)});const n=null==i||null===(e=i.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds;return Pe(n)&&n>0}Uc(){return _p.SHOWN}mc(t){var e;null===(e=this._instance)||void 0===e||e.getSurveys(t)}Ic(t){var e;null===(e=this._instance)||void 0===e||e.cancelPendingSurvey(t)}Sc(){return Sp}Rc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated:t})}jc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_session:t})}Bc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_session")}Hc(){return!1}xc(t,e){let i;return this.mc(t=>{i=t.find(t=>t.id===e)}),!i||da(i)?t===_p.SHOWN?"consume":"ignore":t===_p.SHOWN?"persist":t===_p.DISMISSED||t===_p.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},sk=class{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);const e={};for(const i of t){const t=this._instance.get_property(i);Te(t)||(e[i]=t)}return e}set(t,e){this._instance.register("string"==typeof t?{[t]:e}:t)}remove(t){"string"!=typeof t?t.forEach(t=>this._instance.unregister(t)):this._instance.unregister(t)}},rk=class{constructor(t){this._instance=t}get(){const t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const t=null==d?void 0:d.__PosthogExtensions__;if(!t)return;const{generateSurveys:e,loadExternalDependency:i}=t;return{generateSurveys:e?t=>e(this._instance,t):void 0,loadExternalDependency:i?t=>i(this._instance,"surveys",t):void 0}}createEventReceiver(){return new nk(this._instance)}};const ok=(null==t?void 0:t.location)?cr(t.location.hash,"__posthog")||cr(location.hash,"state"):null,lk="_postHogToolbarParams",ak=Gs("[Toolbar]"),uk=Gs("[FeatureFlags]");var hk=class{constructor(t,e=!1){this.Wc=!1,this.update(t,e)}update(t,e){this.Vc=((t,e)=>{var i,n,s,r,o,l,a;return{bootstrap:{featureFlags:null!==(i=null===(n=t.bootstrap)||void 0===n?void 0:n.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(s=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:void 0},remoteRequestsDisabled:e,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=t.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:Te(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(l=null!==(a=t.evaluation_contexts)&&void 0!==a?a:t.evaluation_environments)&&void 0!==l?l:[],flagKeys:Se(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.Wc||(uk.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Wc=!0),Te(t.flag_keys)||Se(t.flag_keys)||uk.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Vc}};const ck=Gs("[FeatureFlags]"),dk=Gs("[FeatureFlags]",{debugEnabled:!0}),vk="\" failed. Feature flags didn't load in time.",fk=["click","keydown","wheel","touchstart","pointerdown"],pk="connection_error",gk=t=>{const e={};for(let i=0;t.length>i;i++)e[t[i]]=!0;return e},mk=t=>{const e={};for(const[i,n]of Ks(t||{}))n&&(e[i]=n);return e},yk="Refusing to render web experiment since the viewer is a likely bot",_k={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>va(e,t),not_regex:(t,e)=>!va(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},bk=Gs("[Conversations]"),wk="Conversations not available yet.";function kk(t,e){var n,s,r,o,l,a,u;const h=null!==(n=null==t?void 0:t.flushIntervalMs)&&void 0!==n?n:3e3,c=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,d=(null==e?void 0:e.consoleCapture)?void 0:null!==(r=null==t?void 0:t.maxLogsPerInterval)&&void 0!==r?r:1e3,v=Te(d)?Math.max(c,2048):Math.max(c,d),f=ue(ue({},function(){let t="",e="";try{const n=null==i?void 0:i.userAgent;n&&([t,e]=Zi(n))}catch(t){}return function(t,e){const i=function(t){if(t)return{}.hasOwnProperty.call(Ts,t)?Ts[t]:t}(t);return ue(ue({},i?{"os.name":i}:{}),e?{"os.version":e}:{})}(t,e)}()),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(l=null==f?void 0:f["service.name"])&&void 0!==l?l:null==t?void 0:t.serviceName)&&void 0!==o?o:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(a=null==f?void 0:f["service.version"])&&void 0!==a?a:null==t?void 0:t.serviceVersion,environment:null!==(u=null==f?void 0:f["deployment.environment"])&&void 0!==u?u:null==t?void 0:t.environment,resourceAttributes:f,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:h,maxBufferSize:c,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const Sk=["debug","log","warn","error","info"],xk="console",Ck="__posthogHandledLogsRequestError",$k=(t,e)=>{const i=t instanceof Error?t:new Error(e);return i[Ck]=!0,i},Tk=t=>!!t&&"object"==typeof t&&!0===t[Ck],Ek=Gs("[NetworkMetrics]"),Ik=()=>{var e;return(null==t||null===(e=t.performance)||void 0===e?void 0:e.now)?t.performance.now():Date.now()},Mk=t=>t?`${Math.floor(t/100)}xx`:"missing",Rk=(t,e)=>{var i;const n=String(e);return{method:String(t).toUpperCase(),url:(null===(i=lr(n))||void 0===i?void 0:i.href)||n}},Pk=(t,e,i,n,s)=>{try{var r,o,l;const u=s();if(!u)return;const h=i||void 0,c=Ik()-n,d=lr(e.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;const v={url:(null==d?void 0:d.href)||e.url,method:e.method},f=xe(u.name)?u.name(v):Ee(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=ue({method:v.method,host:null!==(r=null==d?void 0:d.hostname)&&void 0!==r?r:"",path:d?(a=d.pathname,a.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/")):"",status_class:Mk(h)},null===(o=u.attributes)||void 0===o?void 0:o.call(u,v,{status:h,durationMs:c}));null===(l=t.metrics)||void 0===l||l.histogram(f,c,{unit:"ms",attributes:p})}catch(t){Ek.error("Failed to record network metric",t)}var a},Ok=()=>{},Ak=(e,i)=>xe(null==t?void 0:t.fetch)?wv(t,"fetch",t=>function(...n){const s=Ik(),r=t.apply(this,n);if(!i())return r;try{var o,l,a;const[t,u]=n,h=Rk(null!==(o=null!==(l=null==u?void 0:u.method)&&void 0!==l?l:null==t?void 0:t.method)&&void 0!==o?o:"GET",null!==(a=null==t?void 0:t.url)&&void 0!==a?a:t);return r.then(t=>(Pk(e,h,null==t?void 0:t.status,s,i),t),t=>{throw Pk(e,h,void 0,s,i),t})}catch(t){return Ek.error("Failed to observe fetch",t),r}}):Ok,Fk=(e,i)=>{var n;const s=null==t||null===(n=t.XMLHttpRequest)||void 0===n?void 0:n.prototype;if(!s)return Ok;const r=new WeakMap,o=wv(s,"open",t=>function(...e){try{(()=>$b.has(this))()||r.set(this,Rk(e[0],e[1]))}catch(t){Ek.error("Failed to observe XHR open",t)}return t.apply(this,e)}),l=wv(s,"send",t=>function(...n){let s;try{const t=r.get(this);if(t&&i()){const n=Ik();s=()=>{this.removeEventListener("loadend",s),Pk(e,t,this.status,n,i)},nr(this,"loadend",s)}}catch(t){Ek.error("Failed to observe XHR send",t)}try{return t.apply(this,n)}catch(t){throw s&&this.removeEventListener("loadend",s),t}});return()=>{o(),l()}},Dk={featureFlags:class{constructor(t){this.name="featureFlags",this.Gc=!1,this.featureFlagEventHandlers=[],this.$=ck,this.Zc={},this.Qc={},this.Jc=[],this.Kc=!1,this.Xc=!1,this.Yc=0,this.td=!1,this.ed=!1,this.nd=!1,this.sd=!1,this.rd=0,this.od=!1,this.sn=()=>{const t=this.ld();this.rd=0,t&&this.reloadFeatureFlags()},this.ad=()=>{var t,e;const i=this.ud,s=null!==(t=this.hd)&&void 0!==t?t:i;Te(i)||Te(s)||this.Mr.remoteRequestsDisabled||!n||"hidden"===n.visibilityState||Date.now()-(null!==(e=this.dd)&&void 0!==e?e:0)<s||(this.hd=this.od||!this.Mr.idleRefreshBackoff?i:Math.min(2*s,36e5),this.od=!1,this.reloadFeatureFlags(),this.vd())},this.fd=()=>{this.od&&this.hd===this.ud||this.pd()},this.an=()=>{"visible"===(null==n?void 0:n.visibilityState)&&this.pd()},"get"in t?this.yo=t:(this._instance=t,this.gd=new hk(t.config,t.Xl()),this.yo=this.gd)}updateConfig(t,e){var i;null===(i=this.gd)||void 0===i||i.update(t,e),this.po&&this.md()}setup(t){return this.Mh=t,this.$=t.logger.createLogger("[FeatureFlags]"),Jw(t.kv.initialize(),()=>{this.Mh===t&&(this.Mh=void 0,this.po=t,this.yd(t))})}yd(e){var i;if(this.po===e)return t&&nr(t,"online",this.sn),this.md(),this.bd=e.registerDynamicEventProperties(()=>this._d()?this.Zc:this.Qc),this.wd=null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.kd(),this.Sd(),this.xd()}),this.Sd(),this.initialize()}pd(){this.od=!0,this.hd=this.ud,this.ad()}md(){const t=this.Mr.refreshIntervalMs,e=!this.Mr.remoteRequestsDisabled&&n&&!Te(t)&&t>0?t:void 0;this.Mr.idleRefreshBackoff||(this.hd=e),e!==this.ud&&(this.Cd(),Te(e)||(this.ud=e,this.hd=e,this.vd(),(null==n?void 0:n.addEventListener)&&(nr(n,Yt,this.an),Zs(fk,t=>{nr(n,t,this.fd,{capture:!0})}))))}vd(){Te(this.ud)||(Te(this.$d)||clearInterval(this.$d),this.dd=Date.now(),this.$d=setInterval(this.ad,this.ud))}Cd(){var t;Te(this.$d)||(clearInterval(this.$d),this.$d=void 0,null==n||null===(t=n.removeEventListener)||void 0===t||t.call(n,"visibilitychange",this.an),Zs(fk,t=>{var e;null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,t,this.fd,{capture:!0})})),this.ud=void 0,this.hd=void 0,this.od=!1,this.dd=void 0}destroy(){this.Td()}dispose(){this.Td()}Td(){var e,i;this.Cd(),this.Yc++,this.ed=!1,this.Mh=void 0,this.po&&(this.Id(),null===(e=this.bd)||void 0===e||e.dispose(),this.bd=void 0,null===(i=this.wd)||void 0===i||i.call(this),this.wd=void 0,this.Jc=[],null==t||t.removeEventListener("online",this.sn),this.po=void 0)}get Mr(){return this.yo.get()}Md(t){var e;return this.Ed&&t in this.Ed?this.Ed[t]:null===(e=this.po)||void 0===e?void 0:e.kv.get(t)}kd(){return!!this.Ed&&(this.Ed=void 0,!0)}Pd(){var t;return!Te(null===(t=this.po)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.kd()}At(t){this.Rd(()=>{var e;return null===(e=this.po)||void 0===e?void 0:e.kv.set(t)})}Ad(t,e,i){var n;if(!(null===(n=this._instance)||void 0===n?void 0:n.persistence)||!t.$enabled_feature_flags)return;const s=this.Md("$enabled_feature_flags")||{},r=t.$enabled_feature_flags||{},o=e.flags||e.featureFlags,l=e.flags?Object.entries(e.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],a=!!e.errorsWhileComputingFlags&&!!e.flags,u=a?l:i&&!Se(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(r)])),h=this.Md("$feature_flag_payloads")||{},c=t.$feature_flag_payloads||{},d=a||i?u:Array.from(new Set([...Object.keys(h),...Object.keys(c)])),v=!a&&!i,f=!!v||u,p=!!v||d,g={[X]:f,[Y]:f,[it]:p};t.$feature_flag_details&&(g[et]=f);for(const e of[nt,Ct,st])Te(t[e])||(g[e]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(g)}Lt(t){this.Rd(()=>{var e;return null===(e=this.po)||void 0===e?void 0:e.kv.remove(t)})}Rd(t){try{t()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}Sd(){const t={};for(const e of[X,it,nt,rt]){const i=this.Md(e);Te(i)||(t[e]=i)}this.Zc=t;const e=ue({},t),i=this.Md(Y);if(i)for(const[t,n]of Object.entries(i))e[`$feature/${t}`]=n;this.Qc=e}_d(){const t=this.Mr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.Md(Ct);return"number"!=typeof e||Date.now()-e>t}Fd(){return!!this._d()&&(this.sd||this.Xc||(this.sd=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Od(){const t=this.Mr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),e}):[]}Dd(){const t=this.Mr.flagKeys;if(!Te(t))return t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),e})}initialize(){var t,e;const i=this.Mr,n=null!==(t=null===(e=i.bootstrap)||void 0===e?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(n).length){var s,r;const t=null!==(s=null===(r=i.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:{},e=Object.keys(n).filter(t=>!Te(n[t])).reduce((t,e)=>(t[e]=n[e],t),{}),o=Object.keys(t).filter(t=>e[t]).reduce((e,i)=>(e[i]=t[i],e),{});return this.Ld({featureFlags:e,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,e,i){var n,s;const r=(null==i?void 0:i.merge)&&null!==(n=this.Md("$enabled_feature_flags"))&&void 0!==n?n:{},o=(null==i?void 0:i.merge)&&null!==(s=this.Md("$feature_flag_payloads"))&&void 0!==s?s:{},l=ue(ue({},r),t),a=ue(ue({},o),e),u={};for(const[t,e]of Object.entries(l))u[t]={key:t,enabled:ss(e),variant:rs(e),reason:void 0,metadata:Te(null==a?void 0:a[t])?void 0:{id:0,version:void 0,description:void 0,payload:a[t]}};this.Ld({flags:u})}get hasLoadedFlags(){return this.Kc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.Md(et),e=this.Md(rt),i=this.Md(ot);if(!i&&!e)return t||{};const n=Js({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(const t of s){var r;const s=n[t],l=null==e?void 0:e[t],a=Te(l)?null!==(r=null==s?void 0:s.enabled)&&void 0!==r&&r:!!l,u=Te(l)?null==s?void 0:s.variant:"string"==typeof l?l:void 0,h=null==i?void 0:i[t],c=ue(ue({},s),{},{enabled:a,variant:a?null!=u?u:null==s?void 0:s.variant:void 0});var o;a!==(null==s?void 0:s.enabled)&&(c.original_enabled=null==s?void 0:s.enabled),u!==(null==s?void 0:s.variant)&&(c.original_variant=null==s?void 0:s.variant),h&&(c.metadata=ue(ue({},null==s?void 0:s.metadata),{},{payload:h,original_payload:null==s||null===(o=s.metadata)||void 0===o?void 0:o.payload})),n[t]=c}return this.Gc||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:n}),this.Gc=!0),n}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(i=>{const n=t[i];return{key:i,enabled:ss(n),variant:rs(n),payload:ns(e[i])}})}getFlagVariants(){const t=this.Md(Y),e=this.Md(rt);if(!e)return t||{};const i=Js({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.Gc||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Gc=!0),i}getFlagPayloads(){const t=this.Md(it),e=this.Md(ot);if(!e)return t||{};const i=Js({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.Gc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Gc=!0),i}reloadFeatureFlags(){this.td||this.Mr.featureFlagsDisabled||this.ld()||(this.Xc&&(this.ed=!0),this.Nd||(this.Jc.slice().forEach(t=>{try{t()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.Nd=setTimeout(()=>{this.qd()},5)))}Id(){clearTimeout(this.Nd),this.Nd=void 0}onReloading(t){return this.Jc.push(t),()=>{this.Jc=this.Jc.filter(e=>e!==t)}}ensureFlagsLoaded(){this.Kc||this.Xc||this.Nd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.td=t}resetFlagCallReported(){this.Lt(kt)}qd(t){this.Id();const e=this.po;if(!e||this.Mr.remoteRequestsDisabled||this.ld())return;if(this.Xc)return void(this.ed=!0);const i={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:ue(ue(ue({},e.initialPersonProperties),this.Md("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Md(at),timezone:Na()};Te(e.deviceId)||(i.$device_id=e.deviceId),((null==t?void 0:t.disableFlags)||this.Mr.featureFlagsDisabled)&&(i.disable_flags=!0);const n=this.Od();n.length&&(i.evaluation_contexts=n);const s=this.Dd();Te(s)||(i.flag_keys=s);const r=this.Mr.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),l=this.Yc;this.Xc=!0;const a=()=>{this.ed&&(this.ed=!1,this.qd())},u=t=>{var e,n;const s=null!==(e=t.json)&&void 0!==e?e:{},o=200!==t.statusCode;if(this.Xc=!1,l!==this.Yc)return void a();if(this.jd(t.statusCode),o||this.ed||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.ed)return;this.nd=!o;const u=[];t.error?u.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?pk:"unknown_error"):200!==t.statusCode&&u.push(`api_error_${t.statusCode}`),s.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");const h=!!(null===(n=s.quotaLimited)||void 0===n?void 0:n.includes("feature_flags"));h&&u.push("quota_limited"),this.At({[xt]:u}),h?this.$.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):i.disable_flags||this.Ld(s,o,{partialResponse:r}),a()},h=t=>{this.Xc=!1,l===this.Yc?(this.At({[xt]:[pk]}),this.$.error("Feature flag request failed",t),this.Pd()&&this.xd(!0),a()):a()};try{e.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(u).catch(h)}catch(t){h(t)}}ld(){return dr(this.rd,3)}jd(t){this.rd=vr(t,this.rd,3,()=>this.$.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,e={}){var i;if(e.fresh&&!this.nd)return;if(!(this.Kc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+t+vk);if(this.Fd())return;const n=this.getFeatureFlagResult(t,e);return null!==(i=null==n?void 0:n.variant)&&void 0!==i?i:null==n?void 0:n.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e={}){if(e.fresh&&!this.nd)return;if(!(this.Kc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+t+vk);if(this.Fd())return;const i=this.getFlagVariants(),n=t in i,s=i[t],r=this.getFlagPayloads()[t],o=String(s),l=this.Md("$feature_flag_request_id")||void 0,a=this.Md("$feature_flag_evaluated_at")||void 0;let u,h=this.Md("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var c;const t=null===(c=this.po)||void 0===c?void 0:c.session.sessionId,e=this.Md(St);t&&t!==e&&(h={},u=t)}if(e.send_event||!("send_event"in e))if(t in h&&h[t].includes(o))u&&this.At({[kt]:h,[St]:u});else{var d,v,f,p,g,m,y,_,b,w,k,S;Se(h[t])?h[t].push(o):h[t]=[o],this.At(ue({[kt]:h},u?{[St]:u}:{}));const e=this.getFeatureFlagDetails(t),i=[...null!==(d=this.Md("$feature_flag_errors"))&&void 0!==d?d:[]];Te(s)&&i.push("flag_missing");const n={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:a,$feature_flag_bootstrapped_response:null!==(v=null===(f=this.Mr.bootstrap)||void 0===f||null===(f=f.featureFlags)||void 0===f?void 0:f[t])&&void 0!==v?v:null,$feature_flag_bootstrapped_payload:null!==(p=null===(g=this.Mr.bootstrap)||void 0===g||null===(g=g.featureFlagPayloads)||void 0===g?void 0:g[t])&&void 0!==p?p:null,$used_bootstrap_value:!this.nd};Te(null==e||null===(m=e.metadata)||void 0===m?void 0:m.has_experiment)||(n.$feature_flag_has_experiment=e.metadata.has_experiment),Te(null==e||null===(y=e.metadata)||void 0===y?void 0:y.version)||(n.$feature_flag_version=e.metadata.version);const c=null!==(_=null==e||null===(b=e.reason)||void 0===b?void 0:b.description)&&void 0!==_?_:null==e||null===(w=e.reason)||void 0===w?void 0:w.code;var x;c&&(n.$feature_flag_reason=c),(null==e||null===(k=e.metadata)||void 0===k?void 0:k.id)&&(n.$feature_flag_id=e.metadata.id),Te(null==e?void 0:e.original_variant)&&Te(null==e?void 0:e.original_enabled)||(n.$feature_flag_original_response=Te(e.original_variant)?e.original_enabled:e.original_variant),(null==e||null===(S=e.metadata)||void 0===S?void 0:S.original_payload)&&(n.$feature_flag_original_payload=null==e||null===(x=e.metadata)||void 0===x?void 0:x.original_payload),i.length&&(n.$feature_flag_error=i.join(",")),this.Bd(n)}else u&&this.At({[kt]:h,[St]:u});return n?{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:ns(r)}:void 0}Bd(t){try{var e;null===(e=this.po)||void 0===e||e.capture("$feature_flag_called",t).catch(t=>{this.$.error("Failed to capture feature flag call",t)})}catch(t){this.$.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,e){this.Hd(t,e)}Hd(t,e){var i=this;return re(function*(){const n=i.po;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.Od();r.length&&(s.evaluation_contexts=r);const o=i.Dd();let l;Te(o)||(s.flag_keys=o);try{var a;const e=null===(a=(yield n.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:i.Mr.compression,sentAt:"body",timeoutMs:i.Mr.requestTimeoutMs})).json)||void 0===a?void 0:a.featureFlagPayloads;l=(null==e?void 0:e[t])||void 0}catch(t){return void i.$.error("Remote config feature flag request failed",t)}try{e(l)}catch(t){i.$.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.nd)return e.defaultValue;if(!(this.Kc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+vk),e.defaultValue;const i=this.getFeatureFlag(t,e);return Te(i)?e.defaultValue:!!i}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e,i){this.Ld(t,e,i)}Ld(t,e,i){if(!this.po)return;this.Kc=!0;const n=((t,e={},i={},n={},s,r=ck)=>{const o=((t,e)=>{const i=t.flags;if(i){const e=Object.fromEntries(Object.keys(i).map(t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]})),n=Object.fromEntries(Object.keys(i).filter(t=>i[t].enabled).filter(t=>{var e;return!Te(null===(e=i[t].metadata)||void 0===e?void 0:e.payload)}).map(t=>{var e;return[t,null===(e=i[t].metadata)||void 0===e?void 0:e.payload]}));return ue(ue({},t),{},{featureFlags:e,featureFlagPayloads:n})}return t.featureFlags&&e.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t,r),l=o.flags,a=o.featureFlags,u=o.featureFlagPayloads;if(!a)return;const h=t.requestId,c=t.evaluatedAt;if(Se(a)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const t={};if(a)for(let e=0;a.length>e;e++)t[a[e]]=!0;return{[X]:a,[Y]:t,[st]:!1}}let d=a,v=u,f=l;if(null==s?void 0:s.partialResponse){const t=Object.keys(d),s=v||{};d=ue(ue({},e),d),v=ue(ue({},i),s),t.forEach(t=>{t in s||null==v||delete v[t]}),f=ue(ue({},n),f)}else if(t.errorsWhileComputingFlags)if(l){const t=new Set(Object.keys(l).filter(t=>{var e;return!(null===(e=l[t])||void 0===e?void 0:e.failed)}));d=ue(ue({},e),Object.fromEntries(Object.entries(d).filter(([e])=>t.has(e))));const s=Object.fromEntries(Object.entries(v||{}).filter(([e])=>t.has(e)));v=ue(ue({},i),s),t.forEach(t=>{t in s||null==v||delete v[t]}),f=ue(ue({},n),Object.fromEntries(Object.entries(f||{}).filter(([e])=>t.has(e))))}else d=ue(ue({},e),d),v=ue(ue({},i),v),f=ue(ue({},n),f);return ue(ue({[X]:Object.keys(mk(d)),[Y]:d||{},[it]:v||{},[et]:f||{},[st]:!0===t.minimalFlagCalledEvents},h?{[nt]:h}:{}),c?{[Ct]:c}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.$);if(n)if(!1===(null==i?void 0:i.persist)){const t=!Te(this.po.kv.get(Y));this.Ed=n,t||this.At(n)}else this.kd(),this.Ad(n,t,!!(null==i?void 0:i.partialResponse)),this.At(n);else e&&this.Pd();e||(this.sd=!1),this.xd(e)}override(t,e=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.zd(t)}zd(t){if(this.po){if(!1===t)return this.Lt([rt,ot]),this.xd(),void dk.info("All overrides cleared");if(Se(t))return this.At({[rt]:gk(t)}),this.xd(),void dk.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e;const i=t;this.Gc=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);const n={},s=i.flags,r=i.payloads;return s&&(n[rt]=Se(s)?gk(s):s),r&&(n[ot]=r),Object.keys(n).length&&this.At(n),!1===s&&!1===r?this.Lt([rt,ot]):!1===s?this.Lt(rt):!1===r&&this.Lt(ot),this.xd(),!1===s?dk.info("Flag overrides cleared"):s&&dk.info("Flag overrides set",{flags:s}),void(!1===r?dk.info("Payload overrides cleared"):r&&dk.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.At({[rt]:t}),this.xd(),void dk.info("Flag overrides set",{flags:t});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Kc){const{flags:e,flagVariants:i}=this.Ud();try{t(e,i)}catch(t){this.$.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var n;const s=(this.Md("$early_access_features")||[]).find(e=>e.flagKey===t),r={[`$feature_enrollment/${t}`]:e},o={$feature_flag:t,$feature_enrollment:e,$set:r};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i);const l=ue(ue({},this.getFlagVariants()),{},{[t]:e});null===(n=this._instance)||void 0===n||null===(n=n.persistence)||void 0===n||n.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.At({[X]:Object.keys(mk(l)),[Y]:l,[lt]:ue(ue({},this.Md("$stored_person_properties")||{}),r)}),this.xd();try{var a;null===(a=this.po)||void 0===a||a.capture("$feature_enrollment_update",o).catch(t=>{this.$.error("Failed to capture early access feature enrollment",t)})}catch(t){this.$.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,e=!1,i){const n=this.Md(tt);!n||e?this.Wd(t,i):t(n)}Wd(t,e){var i=this;return re(function*(){const n=i.po;if(!n)return;const s=e?`&${e.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${s}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,i.At({[tt]:r})}catch(t){return void i.$.error("Early access feature request failed",t)}try{t(r)}catch(t){i.$.error("Early access feature callback failed",t)}})()}Ud(){const t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(t=>e[t]),flagVariants:Object.keys(e).filter(t=>e[t]).reduce((t,i)=>(t[i]=e[i],t),{})}}xd(t){this.Sd();const{flags:e,flagVariants:i}=this.Ud();this.featureFlagEventHandlers.forEach(n=>{try{n(e,i,{errorsLoading:t})}catch(t){this.$.error("Error while running feature flags callback",t)}})}setPersonPropertiesForFlags(t,e=!0){this.Vd(t,e)}Vd(t,e=!0){const i=this.Md("$stored_person_properties")||{},n=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),s=null==t?void 0:t.$set_once,r={};if(s)for(const t in s)({}).hasOwnProperty.call(s,t)&&(t in i||(r[t]=s[t]));this.At({[lt]:ue(ue(ue({},i),r),n)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const i=ue({},this.Md("$stored_person_properties")||{});t.forEach(t=>{delete i[t]}),this.At({[lt]:i}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(lt),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const i=this.Md("$stored_group_properties")||{},n=ue({},i);for(const e of Object.keys(t))n[e]=ue(ue({},i[e]),t[e]);this.At({[at]:n}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.Md("$stored_group_properties")||{};this.At({[at]:ue(ue({},e),{},{[t]:{}})})}else this.Lt(at)}reset(){this.Yc++,this.ed=!1,this.Zc={},this.Qc={},this.Ed=void 0,this.Kc=!1,this.td=!1,this.nd=!1,this.$anon_distinct_id=void 0,this.Id(),this.Gc=!1,this.rd=0}}},Lk={sessionRecording:class{get Mr(){return this._instance.config}get xa(){return this._instance.persistence}get started(){var t;return!!(null===(t=this.Gd)||void 0===t?void 0:t.isStarted)}get status(){var t,e;return"awaiting_config"===this.Zd||"missing_config"===this.Zd?this.Zd:null!==(t=null===(e=this.Gd)||void 0===e?void 0:e.status)&&void 0!==t?t:this.Zd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.Zd=fo,this.Qd=void 0,this.Jd=!1,this.Ke=(()=>{var e,i;if(!(null==n?void 0:n.visibilityState)||"visible"===n.visibilityState)return!0;const s=null==t||null===(e=t.performance)||void 0===e||null===(i=e.getEntriesByType)||void 0===i?void 0:i.call(e,"visibility-state");return!(null==s?void 0:s.length)||s.some(t=>"visible"===t.name)})(),this.an=()=>{var t,e;"visible"===(null==n?void 0:n.visibilityState)&&(this.Ke=!0,null===(t=this.Gd)||void 0===t||null===(e=t.setDocumentWasEverVisible)||void 0===e||e.call(t,!0))},!this._instance.sessionManager)throw Hw.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Mr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==n?void 0:n.addEventListener)&&nr(n,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.Jd=!0,null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,"visibilitychange",this.an),t?this.Kd(!0):this.stopRecording()}get Xd(){var e;const i=!!(null===(e=this._instance.get_property("$session_recording_remote_config"))||void 0===e?void 0:e.enabled),n=!this.Mr.disable_session_recording,s=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&n&&!s}startIfEnabledOrStop(t){var e;if(this.Jd)return;if(this.Xd&&(null===(e=this.Gd)||void 0===e?void 0:e.isStarted))return;const i=!Te(Object.assign)&&!Te(Array.from);this.Xd&&i?(this.Yd(t),Hw.info("starting")):(this.Zd=fo,this.stopRecording())}Yd(t){var e,i;if(this.Xd)if("awaiting_config"!==this.Zd&&"missing_config"!==this.Zd&&(this.Zd=_o),(null==d||null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.rrweb)||void 0===e?void 0:e.record)&&(null===(i=d.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this.tv(t);else{var n,s;const e=this._instance.sessionManager;null===(n=d.__PosthogExtensions__)||void 0===n||null===(s=n.loadExternalDependency)||void 0===s||s.call(n,this._instance,this.ev,i=>{if(!this.Jd&&this.Xd&&this._instance.sessionManager===e)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Hw.error("could not load recorder",i)):void this.tv(t);this.Zd="disabled"})}}stopRecording(){var t,e;null===(t=this.Qd)||void 0===t||t.call(this),this.Qd=void 0,null===(e=this.Gd)||void 0===e||e.stop()}Kd(t=!1){var e,i;null===(e=this.Qd)||void 0===e||e.call(this),this.Qd=void 0,null===(i=this.Gd)||void 0===i||i.discard({discardProducerEvents:t})}iv(){var t,e;null===(t=this.xa)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this.xa)||void 0===e||e.unregister("$replay_sample_rate")}nv(t,e){if(Re(t))return null;const i=Pe(t)?t:parseFloat(t);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(Hw.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):i;var n}sv(t){if(this.xa){var e,i;const n=this.xa,s=()=>{var e;const i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.nv(null===(e=this.Mr.session_recording)||void 0===e?void 0:e.sampleRate,"session_recording.sampleRate"),r=this.nv(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:r;Re(o)&&this.iv();const l=null==i?void 0:i.minimumDurationMilliseconds;n.register({[F]:ue(ue({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:ue({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:Te(l)?null:l,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};s(),null===(e=this.Qd)||void 0===e||e.call(this),this.Qd=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.onSessionId(s)}}onRemoteConfig(t){const e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?!1===e.sessionRecording?(this.sv(e),void this.Kd()):(this.sv(e),void this.startIfEnabledOrStop()):("awaiting_config"===this.Zd&&(this.Zd="missing_config",Hw.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var i;(null===(i=this.Gd)||void 0===i?void 0:i.log)?this.Gd.log(t,e):Hw.warn("log called before recorder was ready")}get ev(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(F);return(null==i||null===(e=i.scriptConfig)||void 0===e?void 0:e.script)||"lazy-recorder"}rv(){const t=this._instance.get_property(F);if(!t)return!1;let e;try{e="object"==typeof t?t:JSON.parse(t)}catch(t){return Hw.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!Re(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}tv(t){var e,i,n;if(!this.Jd&&this.Xd&&this._instance.sessionManager){if(!(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))return Hw.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Lt]:!0});var s;if(this.Gd||(this.Gd=null===(s=d.__PosthogExtensions__)||void 0===s?void 0:s.initSessionRecording(this._instance,this.Ke),this.Gd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.rv()){if("missing_config"===this.Zd||"awaiting_config"===this.Zd)return;return this.Zd="awaiting_config",Hw.info("persisted remote config is stale, requesting fresh config before starting"),void new xb(this._instance).load()}this.Zd=_o,null===(i=(n=this.Gd).setDocumentWasEverVisible)||void 0===i||i.call(n,this.Ke),this.Gd.start(t)}else this.Zd=fo}onRRwebEmit(t){var e,i;null===(e=this.Gd)||void 0===e||null===(i=e.onRRwebEmit)||void 0===i||i.call(e,t)}overrideLinkedFlag(){var t,e;this.Gd||null===(e=this.xa)||void 0===e||e.register({$replay_override_linked_flag:!0}),null===(t=this.Gd)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Gd||null===(e=this.xa)||void 0===e||e.register({$replay_override_sampling:!0}),null===(t=this.Gd)||void 0===t||t.overrideSampling()}overrideTrigger(t){var e,i;this.Gd||null===(i=this.xa)||void 0===i||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(e=this.Gd)||void 0===e||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null===(t=this.Gd)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!!(null===(i=this.Gd)||void 0===i?void 0:i.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;null===(t=this.Gd)||void 0===t||null===(e=t.flushBeforeIdentityReset)||void 0===e||e.call(t)}}},Nk={autocapture:class extends M_{constructor(t){super(new Aw(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.ov=this.lv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.av();return!!(t.path||t.search||this.uv(t))}startIfEnabled(){this.isEnabled&&(Vs.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.ov=this.lv(),this.startIfEnabled()}stop(){this.hv&&this.hv(),this.hv=void 0,this.dv&&this.dv(),this.dv=void 0,Vs.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.vv("pushState"),this.vv("replaceState"),this.fv(),this.uv()&&this.pv())}vv(e){var i;if(!t||(null===(i=t.history[e])||void 0===i?void 0:i.__posthog_wrapped__))return;const n=this;wv(t.history,e,t=>function(i,s,r){t.call(this,i,s,r),n.gv(e)})}lv(){const e=null==t?void 0:t.location;if(null==e?void 0:e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}av(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:Ce(t)?t:{}}uv(t=this.av()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}mv(t){const e=this.av(),i=this.ov;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.uv(e)&&t.hash!==i.hash))}gv(t){try{const e=this.lv();if(!e)return;this.mv(e)&&this._instance.capture(te,{navigation_type:t}),this.ov=e}catch(e){Vs.error(`Error capturing ${t} pageview`,e)}}fv(){if(this.hv)return;const e=()=>{this.gv("popstate")};nr(t,"popstate",e),this.hv=()=>{t&&t.removeEventListener("popstate",e)}}pv(){if(this.dv)return;const e=()=>{this.gv("hashchange")};nr(t,"hashchange",e),this.dv=()=>{t&&t.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(t){var e;this.yv=!1,this.bo=!1,this.bv=null,this.instance=t,this.yv=!!(null===(e=this.instance.persistence)||void 0===e?void 0:e.props[C]),this.rageclicks=new x_(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return Ce(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Mr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Re(this.Mr.capture_heatmaps)?Re(this.Mr.enable_heatmaps)?this.yv:this.Mr.enable_heatmaps:!1!==this.Mr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.bo)return;Uw.info("starting..."),this._v(),this.an()}else{var t;clearInterval(null!==(t=this.bv)&&void 0!==t?t:void 0),this.wv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("heatmaps"in e))return;const i=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[C]:i}),this.yv=i,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Sv(t){zw(t.originalEvent)&&this.Cr(t.originalEvent,"deadclick")}an(){this.bv&&clearInterval(this.bv),this.bv="visible"===(null==n?void 0:n.visibilityState)?setInterval(this.fa.bind(this),this.flushIntervalMilliseconds):null}_v(){t&&n&&(this.xv=this.fa.bind(this),nr(t,Xt,this.xv),this.Cv=e=>this.Cr(e||(null==t?void 0:t.event)),nr(n,"click",this.Cv,{capture:!0}),this.$v=e=>this.Tv(e||(null==t?void 0:t.event)),nr(n,"mousemove",this.$v,{capture:!0}),this.Iv=new Q_(this.instance,G_,this.Sv.bind(this)),this.Iv.startIfEnabledOrStop(),this.Mv=this.an.bind(this),nr(n,Yt,this.Mv),this.bo=!0)}wv(){var e;t&&n&&(this.xv&&t.removeEventListener(Xt,this.xv),this.Cv&&n.removeEventListener("click",this.Cv,{capture:!0}),this.$v&&n.removeEventListener("mousemove",this.$v,{capture:!0}),this.Mv&&n.removeEventListener(Yt,this.Mv),clearTimeout(this.Ev),null===(e=this.Iv)||void 0===e||e.stop(),this.bo=!1)}Pv(e,i){const n=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(e,i,n){let s=e;for(;s&&mr(s)&&!yr(s,"body");){if(s===n)return!1;let e;try{var r,o,l;e=null===(r=null!==(o=null===(l=s.ownerDocument)||void 0===l?void 0:l.defaultView)&&void 0!==o?o:t)||void 0===r?void 0:r.getComputedStyle(s).position}catch(t){return!1}if(ge(i,e))return!0;s=Mr(s)}return!1}($r(e),["fixed","sticky"],r);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:n),target_fixed:o,type:i}}Cr(t,e="click"){var i;if(gr(t.target)||!zw(t))return;const n=this.Pv(t,e);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&qr($r(t),this.instance.config.rageclick)&&this.Zs(ue(ue({},n),{},{type:"rageclick"})),this.Zs(n)}Tv(t){!gr(t.target)&&zw(t)&&(clearTimeout(this.Ev),this.Ev=setTimeout(()=>{this.Zs(this.Pv(t,"mousemove"))},500))}Zs(e){if(!t)return;const i=this.Mr.disable_capture_url_hashes?un(t.location.href):t.location.href,n=this.Mr.custom_personal_data_properties,s=this.Mr.mask_personal_data_properties?[...Ca,...n||[]]:[],r=hr(i,s,Ta);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}fa(){this.Rt&&!$e(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Q_,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.yv=!1,this.bo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Rv=()=>{clearTimeout(this.Av),this.Av=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",ue({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,e)=>ue(ue({},t),{},{[`$web_vitals_${e.name}_event`]:ue({},e),[`$web_vitals_${e.name}_value`]:e.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Fv=t=>{var e;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Re(null==t?void 0:t.name)||Re(null==t?void 0:t.value))return void Lw.error("Invalid metric received",t);const i="string"==typeof t.navigationURL?t.navigationURL:void 0,n=this.Ov(i);if(Te(n))return;const s=Pe(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${n}`;if(this.Dv&&t.value>=this.Dv)return void Lw.error("Ignoring metric with value >= "+this.Dv,t);this.Rt.navigationKey!==s&&(this.Rv(),this.Av=setTimeout(this.Rv,this.flushToCaptureTimeoutMs)),Te(this.Rt.navigationKey)&&(this.Rt.navigationKey=s,this.Rt.url=n),this.Rt.firstMetricTimestamp=Te(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const r=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0),o=ue(ue(ue({},t),i?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete o.entries,Ce(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const e={};for(const i of jw){const n="url"===i&&"string"==typeof t.attribution[i]?this.Ov(t.attribution[i]):t.attribution[i];Te(n)||(e[i]=n)}o.attribution=e}else delete o.attribution;Te(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.Rv()},this.Lv=()=>{if(this.bo)return;let t,e,i,n,s=!1;const r=d.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,l=(null==o?void 0:o[this.Nv])||("web-vitals"===this.Nv&&Te(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!Te(l)){const r=l.withoutAttribution,o=this.attributionMetrics;s=!Te(r),t=o.indexOf("LCP")>-1?l.onLCP:(null==r?void 0:r.onLCP)||l.onLCP,e=o.indexOf("CLS")>-1?l.onCLS:(null==r?void 0:r.onCLS)||l.onCLS,i=o.indexOf("FCP")>-1?l.onFCP:(null==r?void 0:r.onFCP)||l.onFCP,n=o.indexOf("INP")>-1?l.onINP:(null==r?void 0:r.onINP)||l.onINP}if(!(t&&e&&i&&n))return void Lw.error("web vitals callbacks not loaded - not starting");const a={reportSoftNavs:this.useSoftNavs},u=s&&this.attributionMetrics.indexOf("INP")>-1?ue(ue({},a),{},{includeProcessedEventEntries:!1}):a;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Fv.bind(this),a),this.allowedMetrics.indexOf("CLS")>-1&&e(this.Fv.bind(this),a),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Fv.bind(this),a),this.allowedMetrics.indexOf("INP")>-1&&n(this.Fv.bind(this),u),this.bo=!0},this.yv=!!(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[M]),this.startIfEnabled()}get qv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const i=Ce(this.qv)?null===(t=this.qv)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return Re(i)?(null===(e=this._instance.persistence)||void 0===e?void 0:e.props.$web_vitals_allowed_metrics)||qw:i}get flushToCaptureTimeoutMs(){return(Ce(this.qv)?this.qv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=Ce(this.qv)?this.qv.web_vitals_attribution:void 0;return Ae(t)?t?qw:[]:Se(t)?t:Bw}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=Ce(this.qv)?this.qv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Dv(){const t=Ce(this.qv)&&Pe(this.qv.__web_vitals_max_value)?this.qv.__web_vitals_max_value:Nw;return t>0&&6e4>=t?Nw:t}get isEnabled(){const t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Lw.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=Ce(this.qv)?this.qv.web_vitals:Ae(this.qv)?this.qv:void 0;return Ae(e)?e:this.yv}startIfEnabled(){this.isEnabled&&!this.bo&&(Lw.info("enabled, starting..."),this.No(this.Lv))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const i=Ce(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Ce(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[M]:i}),this._instance.persistence.register({[A]:n})),this.yv=i,this.startIfEnabled()}get Nv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}No(t){var e;const i=d.__PosthogExtensions__,n=this.Nv,s=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==s?void 0:s[n])||"web-vitals"===n&&Te(s)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?t():null==i||null===(e=i.loadExternalDependency)||void 0===e||e.call(i,this._instance,n,e=>{e?Lw.error("failed to load script",e):t()})}Ov(e){const i=e||(null==t?void 0:t.location.href);if(!i)return void Lw.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?[...Ca,...s||[]]:[];return hr(n,r,Ta)}}},qk={exceptionObserver:class{constructor(e){var i;this.Lv=()=>{var e;if(!t||!this.isEnabled||!(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions))return;const i=d.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=d.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=d.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.jv&&this.Mr.capture_unhandled_errors&&(this.jv=i(this.captureException.bind(this))),!this.Bv&&this.Mr.capture_unhandled_rejections&&(this.Bv=n(this.captureException.bind(this))),!this.Hv&&this.Mr.capture_console_errors&&(this.Hv=s(this.captureException.bind(this)))}catch(t){Fw.error("failed to start",t),this.zv()}},this._instance=e,this.Uv=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[T]),this.wt=new Qe(ue(ue({},function(t={}){var e,i,n,s;return{refillRate:null!==(e=null!==(i=t.exceptionRateLimiterRefillRate)&&void 0!==i?i:t.__exceptionRateLimiterRefillRate)&&void 0!==e?e:1,bucketSize:null!==(n=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==n?n:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:Fw})),this.Mr=this.Wv(),this.startIfEnabledOrStop()}Wv(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ce(t)?e=ue(ue({},e),t):(Te(t)?this.Uv:t)&&(e=ue(ue({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Fw.info("enabled"),this.zv(),this.No(this.Lv)):this.zv()}No(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"exception-autocapture",e=>{if(e)return Fw.error("failed to load script",e);t()})}zv(){var t,e,i;null===(t=this.jv)||void 0===t||t.call(this),this.jv=void 0,null===(e=this.Bv)||void 0===e||e.call(this),this.Bv=void 0,null===(i=this.Hv)||void 0===i||i.call(this),this.Hv=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.Uv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[T]:this.Uv}),this.Mr=this.Wv(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.Wv()}captureException(t){try{var e,i,n;const s=null!==(e=null==t||null===(i=t.$exception_list)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.type)&&void 0!==e?e:"Exception";if(this.wt.consumeRateLimit(s))return void Fw.info("Skipping exception capture because of client rate limiting.",{exception:s});null===(n=this._instance.exceptions)||void 0===n||n.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var e,i;this.Vv=[],this.Gv=wm(),this._instance=t,this.Vv=null!==(e=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==e?e:[],this.Zv=ts(this.Qv()),this.Jv=new es(this.Zv)}onConfigChange(){this.Zv=ts(this.Qv()),this.Jv.setConfig(this.Zv)}onRemoteConfig(t){var e,i,n;if(!t.ok)return;const s=t.config;if(!("errorTracking"in s))return;const r=null!==(e=null===(i=s.errorTracking)||void 0===i?void 0:i.suppressionRules)&&void 0!==e?e:[],o=null===(n=s.errorTracking)||void 0===n?void 0:n.captureExtensionExceptions;this.Vv=r,this._instance.persistence&&this._instance.persistence.register({[E]:this.Vv,[I]:o})}get Kv(){var t;const e=!!this._instance.get_property(I),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.Gv.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.Zv.enabled)try{if(!Ee(t)||0===t.trim().length)return void gm.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:i,droppedKeys:n}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};const e=[];return{sanitizedProperties:Object.keys(t).reduce((i,n)=>Yn.has(n)?(e.push(n),i):(i[n]=t[n],i),{}),droppedKeys:e}}(this.Xv(e));n.length>0&&gm.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Jv.add(ue({[Jn]:t,[Kn]:(new Date).toISOString()},i))}catch(t){gm.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.Yv(e)){if(this.tf(e))return this.ef("Exception dropped: matched a suppression rule"),void gm.info("Skipping exception capture because a suppression rule matched");if(!this.Kv&&this.if(e))return this.ef("Exception dropped: thrown by a browser extension"),void gm.info("Skipping exception capture because it was thrown by an extension");if(!this.Kv&&this.nf(e))return this.ef("Exception dropped: thrown by an injected browser script"),void gm.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.sf(e))return this.ef("Exception dropped: thrown by the PostHog SDK"),void gm.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this.Zv.enabled&&Re(t.$exception_steps)?this.rf(t):t,n=function(){const t=globalThis._posthogReleaseId;return"string"==typeof t&&t.length>0?t:void 0}();n&&(i.$release_id=n);try{const t=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",oh:!0});return t&&this.Jv.clear(),t}catch(t){return pm(t)||gm.error("Failed to capture exception event. Dropping this exception.",t),void this.Jv.clear()}}catch(t){return void(pm(t)||gm.error("Failed to process exception event. Ignoring this exception.",t))}}rf(t){try{const e=this.Jv.getAttachable();return 0===e.length?t:ue(ue({},t),{},{$exception_steps:e})}catch(e){return gm.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}ef(t){this.Zv.enabled&&this.Jv.add({[Jn]:t,[Kn]:(new Date).toISOString()})}Xv(t){return Ce(t)?ue({},t):{}}Qv(){var t,e;return null!==(t=null===(e=this._instance.config.error_tracking)||void 0===e?void 0:e.exception_steps)&&void 0!==t?t:{}}tf(t){if(0===t.length)return!1;try{const e=t.reduce((t,{type:e,value:i})=>(Ee(e)&&e.length>0&&t.$exception_types.push(e),Ee(i)&&i.length>0&&t.$exception_values.push(i),t),{$exception_types:[],$exception_values:[]});return this.Vv.some(t=>{const i=t.values.map(t=>{const i=pa[t.operator],n=e[t.key];if(!i||!n)return!1;const s=Se(t.value)?t.value:[t.value];return s.length>0&&i(s,n)});return"OR"===t.type?i.some(Boolean):i.every(Boolean)})}catch(t){return gm.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}if(t){const e=t.flatMap(t=>{var e,i;return null!==(e=null===(i=t.stacktrace)||void 0===i?void 0:i.frames)&&void 0!==e?e:[]}),i=e.filter(({filename:t})=>!!t&&_m.some(e=>t.startsWith(e)));return 0!==i.length&&(!i.every(({filename:t})=>!!t&&t.startsWith(mm))||t.some(({type:t,value:e})=>"NoResponse"===t||Ee(e)&&ym.some(({value:t,exact:i})=>i?e===t:e.includes(t)))&&!e.some(({in_app:t,filename:e})=>t&&!(null==e?void 0:e.startsWith(mm))))}nf(t){return t.some(({value:t})=>Ee(t)&&bm.some(e=>t.includes(e)))}sf(t){if(t.length>0){var e,i,n,s;const r=null!==(e=null===(i=t[0].stacktrace)||void 0===i?void 0:i.frames)&&void 0!==e?e:[],o=r[r.length-1];return null!==(n=null==o||null===(s=o.filename)||void 0===s?void 0:s.includes("posthog.com/static"))&&void 0!==n&&n}return!1}Yv(t){return!Re(t)&&Se(t)}}},Bk=ue({productTours:class{get xa(){return this._instance.persistence}constructor(t){this.lf=null,this.af=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if("productTours"in e){var i,n;if(this.xa&&this.xa.register({[P]:!!e.productTours}),!Vw(this._instance))return!this.lf&&Re(null===(i=this.xa)||void 0===i?void 0:i.props.ph_product_tours)||Ww.info("product tours disabled; stopping and clearing cached tours"),null===(n=this.lf)||void 0===n||n.stop(),this.lf=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.lf&&Vw(this._instance)&&this.No(()=>this.uf())}No(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"product-tours",e=>{e?Ww.error("Could not load product tours script",e):t()})}uf(){var t;!this.lf&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.lf=d.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(Se(this.af)&&!e)return void t(this.af,{isLoaded:!0});const i=this.xa;if(i){const n=i.props[pt];if(Se(n)&&!e)return this.af=n,void t(n,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:e=>{if(!Vw(this._instance))return void t([],{isLoaded:!0});const n=e.statusCode;if(200!==n||!e.json){const i=`Product Tours API could not be loaded, status: ${n}`;return 0===n?e.error||Ww.warn(i):Ww.error(i),void t([],{isLoaded:!1,error:i})}const s=Se(e.json.product_tours)?e.json.product_tours:[];this.af=s,i&&i.register({[pt]:s}),t(s,{isLoaded:!0})}})}getActiveProductTours(t){Re(this.lf)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.lf.getActiveProductTours(t)}showProductTour(t){var e;null===(e=this.lf)||void 0===e||e.showTourById(t)}previewTour(t){this.lf?this.lf.previewTour(t):this.No(()=>{var e;this.uf(),null===(e=this.lf)||void 0===e||e.previewTour(t)})}dismissProductTour(){var t;null===(t=this.lf)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.lf)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.lf)||void 0===t||t.previousStep()}clearCache(){var t;this.af=null,null===(t=this.xa)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var e;null===(e=this.lf)||void 0===e||e.resetTour(t)}resetAllTours(){var t;null===(t=this.lf)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var e;null===(e=this.lf)||void 0===e||e.cancelPendingTour(t)}}},Dk),jk={siteApps:class{constructor(t){this._instance=t,this.hf=0,this.cf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}df(t,e){if(!e)return;const i=this.globalsForEvent(e);this.cf.push(i),this.cf.length>1e3&&(this.cf=this.cf.slice(10))}get siteAppLoaders(){var t;return null===(t=d._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.df.bind(this));this.vf=()=>{t(),this.cf=[],this.vf=void 0}}}globalsForEvent(t){var e,i,n,s,r,o,l;if(!t)throw new Error("Event payload is required");const a={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(const[t,e]of Object.entries(h))a[t]={id:u[t],type:t,properties:e};const{$set_once:c,$set:d}=t;return{event:ue(ue({},ys(t,Gw)),{},{properties:ue(ue(ue({},t.properties),d?{$set:ue(ue({},null!==(e=null===(i=t.properties)||void 0===i?void 0:i.$set)&&void 0!==e?e:{}),d)}:{}),c?{$set_once:ue(ue({},null!==(n=null===(s=t.properties)||void 0===s?void 0:s.$set_once)&&void 0!==n?n:{}),c)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(l=t.properties)||void 0===l?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:a}}ff(t){var e;const i=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase();if("style"===i&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(t)||(Zw.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===i&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(t)||(Zw.error("prepare_external_dependency_script returned null"),null)}return t}pf(){var t,e,i,s,r,o,l,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const u=null==n?void 0:n.defaultView,h=null==u||null===(t=u.Node)||void 0===t?void 0:t.prototype;if(!u||!h)return()=>{};if(this.hf++,this.gf)return this.mf();const c=[],d=this,v=new WeakSet,f=(t,e,i)=>{if(!(null==t?void 0:t[e]))return;const n=t[e];t[e]=i(n),c.push(()=>{t[e]=n})},p=t=>{if(v.has(t))return t;const e=d.ff(t);return e&&v.add(e),e},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!Me(t));return f(h,"appendChild",t=>function(e){const i=p(e);return i?t.call(this,i):e}),f(h,"insertBefore",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):e}),f(h,"replaceChild",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):i}),[null===(e=u.Element)||void 0===e?void 0:e.prototype,null===(i=u.Document)||void 0===i?void 0:i.prototype,null===(s=u.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(t=>{f(t,"append",t=>function(...e){return t.apply(this,g(e))}),f(t,"prepend",t=>function(...e){return t.apply(this,g(e))})}),[null===(r=u.Element)||void 0===r?void 0:r.prototype,null===(o=u.CharacterData)||void 0===o?void 0:o.prototype,null===(l=u.DocumentType)||void 0===l?void 0:l.prototype].forEach(t=>{f(t,"before",t=>function(...e){return t.apply(this,g(e))}),f(t,"after",t=>function(...e){return t.apply(this,g(e))}),f(t,"replaceWith",t=>function(...e){const i=g(e);return e.length&&!i.length?void 0:t.apply(this,i)})}),f(null===(a=u.Element)||void 0===a?void 0:a.prototype,"insertAdjacentElement",t=>function(e,i){const n=p(i);return n?t.call(this,e,n):null}),this.gf=()=>{c.forEach(t=>t()),this.gf=void 0},this.mf()}mf(){let t=!1;return()=>{var e;t||(t=!0,this.hf--,0===this.hf&&(null===(e=this.gf)||void 0===e||e.call(this)))}}yf(t,e=!0){const i=this.pf();try{const n=t(i);return e&&i(),n}catch(t){throw i(),t}}setupSiteApp(t){const e=this.apps[t.id],i=()=>{var i;!e.errored&&this.cf.length&&(Zw.info(`Processing ${this.cf.length} events for site app with id ${t.id}`),this.cf.forEach(t=>this.yf(()=>{var i;return null===(i=e.processEvent)||void 0===i?void 0:i.call(e,t)})),e.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null===(i=this.vf)||void 0===i||i.call(this))};let n=!1;const s=s=>{e.errored=!s,e.loaded=!0,Zw.info(`Site app with id ${t.id} ${s?"loaded":"errored"}`),n&&i()};try{const{processEvent:i}=this.yf(e=>t.init({posthog:this._instance,callback(t){e(),s(t)}}),!1);i&&(e.processEvent=i),n=!0}catch(e){Zw.error(Qw+t.id,e),s(!1)}if(n&&e.loaded)try{i()}catch(i){Zw.error(`Error while processing buffered events PostHog app with config id ${t.id}`,i),e.errored=!0}}bf(){const t=this.siteAppLoaders||[];for(const e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(const e of t)this.setupSiteApp(e)}_f(t){if(0===Object.keys(this.apps).length)return;const e=this.globalsForEvent(t);for(const i of Object.values(this.apps))try{this.yf(()=>{var t;return null===(t=i.processEvent)||void 0===t?void 0:t.call(i,e)})}catch(e){Zw.error(`Error while processing event ${t.event} for site app ${i.id}`,e)}}onRemoteConfig(t){var e,i,n;if(null===(e=this.siteAppLoaders)||void 0===e?void 0:e.length)return this.isEnabled?(this.bf(),void this._instance.on("eventCaptured",t=>this._f(t))):void Zw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this.vf)||void 0===i||i.call(this),!t.ok)return;const s=t.config;if(null===(n=s.siteApps)||void 0===n?void 0:n.length)if(this.isEnabled)for(const{id:t,url:e}of s.siteApps){var r,o;d[`__$$ph_site_app_${t}`]=this._instance,null===(r=d.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,e,e=>{if(e)return Zw.error(Qw+t,e)})}else Zw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Hk={tracingHeaders:class{constructor(t){this._instance=t,this.wf=void 0,this.kf=void 0,this.Sf=void 0,this.Lv=()=>{const t=this.xf();var e,i;t?(Te(this.wf)&&(this.wf=null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Te(this.kf)&&(this.kf=null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.zv()}}initialize(){this.startIfEnabledOrStop()}No(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.tracingHeadersPatchFns)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"tracing-headers",e=>{if(e)return Dw.error("failed to load script",e);t()})}Cf(){var t,e;return null!==(t=null!==(e=this._instance.config.tracing_headers)&&void 0!==e?e:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}xf(){const t=this.Cf();return Se(t)?(Se(this.Sf)?this.Sf.splice(0,this.Sf.length,...t):this.Sf=[...t],t.length>0?this.Sf:void 0):(Se(this.Sf)&&this.Sf.splice(0),this.Sf=t||void 0,this.Sf)}zv(){var t,e;null===(t=this.wf)||void 0===t||t.call(this),null===(e=this.kf)||void 0===e||e.call(this),this.wf=void 0,this.kf=void 0}startIfEnabledOrStop(){this.xf()?this.No(this.Lv):this.zv()}}},Uk=ue({surveys:class extends Xw{constructor(t){var e;super(new rk(t),(e=t,{get projectToken(){return e.config.token},kv:new sk(e)})),this._instance=t}Fh(t,e){const i=e.query?Rb(t,e.query):t;return new Promise(t=>{var n;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor(null!==(n=e.target)&&void 0!==n?n:"api",i),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:t})})}}},Dk),zk={toolbar:class{constructor(t){this.instance=t}$f(t){d.ph_toolbar_state=t}Tf(){var t;return null!==(t=d.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,i=void 0,s=void 0){var r,o;if(sr(this.instance.config))return!1;if(!t||!n)return!1;e=null!==(r=e)&&void 0!==r?r:t.location,s=null!==(o=s)&&void 0!==o?o:t.history;try{if(!i){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}i=null==t?void 0:t.localStorage}const n=ok||cr(e.hash,"__posthog")||cr(e.hash,"state");let r;const o=n?hn(()=>JSON.parse(atob(decodeURIComponent(n))))||hn(()=>JSON.parse(decodeURIComponent(n))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):(r=JSON.parse(i.getItem(lk)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}If(t){const e=d.ph_load_toolbar||d.ph_load_editor;!Re(e)&&xe(e)?e(t,this.instance):ak.warn("No toolbar load function found")}loadToolbar(e){const i=!!(null==n?void 0:n.getElementById("__POSTHOG_TOOLBAR__"));if(!t||i)return!1;const s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=ue(ue({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(lk,JSON.stringify(ue(ue({},r),{},{source:void 0}))),2===this.Tf())this.If(r);else if(0===this.Tf()){var o,l;this.$f(1),null===(o=d.__PosthogExtensions__)||void 0===o||null===(l=o.loadExternalDependency)||void 0===l||l.call(o,this.instance,"toolbar",t=>{if(t)return ak.error("[Toolbar] Failed to load",t),void this.$f(0);this.$f(2),this.If(r)}),nr(t,"turbolinks:load",()=>{this.$f(0),this.loadToolbar(r)})}return!0}Mf(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,i=void 0){return this.maybeLoadToolbar(t,e,i)}}},Wk=ue({experiments:class e{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.Ef("retrieved web experiments from the server"),this.Pf=new Map,t.forEach(t=>{if(t.feature_flag_key){var i;this.Pf&&(e.Ef("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=this.Pf)||void 0===i||i.set(t.feature_flag_key,t));const n=this._instance.getFeatureFlag(t.feature_flag_key);Ee(n)&&t.variants[n]&&this.Rf(t.name,n,t.variants[n].transforms)}else if(t.variants)for(const i in t.variants){const n=t.variants[i];e.Af(n,this._instance)&&this.Rf(t.name,i,n.transforms)}})},t)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.Ef(yk);else if(!this.Mr.disable_web_experiments){if(Re(this.Pf))return this.Pf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Ef("applying feature flags",t),t.forEach(t=>{var e;if(this.Pf&&(null===(e=this.Pf)||void 0===e?void 0:e.has(t))){var i;const e=this._instance.getFeatureFlag(t),n=null===(i=this.Pf)||void 0===i?void 0:i.get(t);e&&(null==n?void 0:n.variants[e])&&this.Rf(n.name,e,n.variants[e].transforms)}})}}previewWebExperiment(){const t=e.getWindowLocation();if(null==t?void 0:t.search){const i=ur(null==t?void 0:t.search,"__experiment_id"),n=ur(null==t?void 0:t.search,"__experiment_variant");i&&n&&(e.Ef(`previewing web experiments ${i} && ${n}`),this.getWebExperiments(t=>{this.Ff(parseInt(i),n,t)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Mr.disable_web_experiments&&!i)return t([]);const n=this._instance.get_property("$web_experiments");if(n&&!e)return t(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Mr.token}`),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Ff(t,i,n){const s=n.filter(e=>e.id===t);s&&s.length>0&&(e.Ef(`Previewing web experiment [${s[0].name}] with variant [${i}]`),this.Rf(s[0].name,i,s[0].variants[i].transforms))}static Af(t,i){return!Re(t.conditions)&&e.Of(t,i)&&e.Df(t)}static Of(t,i){var n;if(Re(t.conditions)||Re(null===(n=t.conditions)||void 0===n?void 0:n.url))return!0;const s=e.getWindowLocation();if(s){var r,o,l;const e=fr(i,s.href);return!(null===(r=t.conditions)||void 0===r?void 0:r.url)||_k[null!==(o=null===(l=t.conditions)||void 0===l?void 0:l.urlMatchType)&&void 0!==o?o:"icontains"](t.conditions.url,e)}return!1}static getWindowLocation(){return null==t?void 0:t.location}static Df(t){var e;if(Re(t.conditions)||Re(null===(e=t.conditions)||void 0===e?void 0:e.utm))return!0;const i=Ia();if(i.utm_source){var n,s,r,o,l,a,u,h;const e=!(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)||(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)==i.utm_campaign,c=!(null===(r=t.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=t.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==i.utm_source,d=!(null===(l=t.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)||(null===(a=t.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)==i.utm_medium,v=!(null===(u=t.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)||(null===(h=t.conditions)||void 0===h||null===(h=h.utm)||void 0===h?void 0:h.utm_term)==i.utm_term;return e&&d&&v&&c}return!1}static Ef(t,...e){Vs.info(`[WebExperiments] ${t}`,e)}Rf(t,i,n){this._is_bot()?e.Ef(yk):"control"!==i?n.forEach(n=>{if(n.selector){var s;e.Ef(`applying transform of variant ${i} for experiment ${t} `,n);const r=null===(s=document)||void 0===s?void 0:s.querySelectorAll(n.selector);null==r||r.forEach(t=>{const e=t;n.html&&(e.innerHTML=n.html),n.css&&e.setAttribute("style",n.css)})}}):e.Ef("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?iw(i,this.Mr.custom_blocked_useragents):void 0}}},Dk),Vk={conversations:class{constructor(t){this._instance=t,this.Lf=void 0,this._conversationsManager=null,this.Nf=!1,this.ne=null,this.qf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return;if(this.jf=t.ok,!t.ok)return;const e=t.config.conversations;Re(e)||(Ae(e)?this.Lf=e:(this.Lf=e.enabled,this.ne=e),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.Lf=void 0,this.ne=null,this.jf=void 0,this.qf=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this.Nf)return;if(this._instance.config.disable_conversations)return;if(sr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==d?void 0:d.__PosthogExtensions__;if(t&&!Te(this.Lf)&&this.Lf)if(this.ne&&this.ne.token){this.Nf=!0;try{const e=t.initConversations;if(e)return this.Bf(e),void(this.Nf=!1);const i=t.loadExternalDependency;if(!i)return void this.Hf(Zt);i(this._instance,"conversations",e=>{e||!t.initConversations?this.Hf("Could not load conversations script",e):this.Bf(t.initConversations),this.Nf=!1})}catch(t){this.Hf("Error initializing conversations",t),this.Nf=!1}}else bk.error("Conversations enabled but missing token in remote config.")}Bf(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.qf=!1,bk.info("Conversations loaded successfully")}catch(t){this.Hf("Error completing conversations initialization",t)}else bk.error("Cannot complete initialization: remote config is null")}Hf(t,e){bk.error(t,e),this._conversationsManager=null,this.Nf=!1,this.qf=!0}show(){this._conversationsManager?this._conversationsManager.show():bk.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Lf&&!Me(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":sr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.jf?"remote_config_failed":Te(this.Lf)?this.jf?"disabled_in_project":"remote_config_pending":this.Lf?Re(this.ne)||!this.ne.token?"missing_token":(null==d?void 0:d.__PosthogExtensions__)?this.Nf?"initializing":this.qf?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,e,i){var n=this;return re(function*(){return n._conversationsManager?n._conversationsManager.sendMessage(t,e,i):(bk.warn(wk),null)})()}getMessages(t,e){var i=this;return re(function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(bk.warn(wk),null)})()}markAsRead(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(bk.warn(wk),null)})()}getTickets(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(bk.warn(wk),null)})()}requestRestoreLink(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(bk.warn(wk),null)})()}restoreFromToken(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(bk.warn(wk),null)})()}restoreFromUrlToken(){var t=this;return re(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(bk.warn(wk),null)})()}getCurrentTicketId(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}yh(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}bh(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}}},Gk={logs:class{constructor(e){var i;this._instance=e,this.name=Op,this.zf=!1,this.Uf=!1,this.Wf=!1,this.$=Gs("[logs]"),this.Vf=ue(ue({},this.$),{},{error:(...t)=>{t.some(Tk)||this.$.error(...t)}}),this.ia=[],this.Gf=[],this.rd=0,this.So=!1,this.Zf=[],this.Qf=[],this.Jf=!1,this.Kf=!1,this.Xf=()=>{var t,e;this.So||(this.rd=0,null===(t=this.Yf)||void 0===t||t.onReconnect(),null===(e=this.tp)||void 0===e||e.onReconnect())},this._instance&&(null===(i=this._instance.config.logs)||void 0===i?void 0:i.captureConsoleLogs)&&(this.zf=!0),t&&nr(t,"online",this.Xf)}ep(t,e,i,n){var s;const r=kk(null===(s=this._instance)||void 0===s||null===(s=s.config)||void 0===s?void 0:s.logs,i);return[new Ls(this.np(t,e),r,this.Vf,()=>this.sp(),t=>t(),void 0,n),r]}rp(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs;var i;return this.Yf&&this.op===e||(null===(i=this.Yf)||void 0===i||i.reset(),this.op=e,[this.Yf,this.lp]=this.ep(()=>this.ia,t=>{this.ia=t})),this.Yf}ap(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs;var i;return this.tp&&this.up===e||(null===(i=this.tp)||void 0===i||i.reset(),this.up=e,[this.tp,this.hp]=this.ep(()=>this.Gf,t=>{this.Gf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},xk)),this.tp}setup(t){var e;if(this.So)return;this.po=t,(null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.logs)||void 0===e?void 0:e.captureConsoleLogs)&&(this.zf=!0),(this.zf||this.cp()&&this.dp())&&this.vp();let i=!1;const n=t.onRemoteConfig(t=>{var e;i=t.ok&&!0===(null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs),this.onRemoteConfig(t)});this.So?n.dispose():(this.$o=n,i||this.loadIfEnabled())}dispose(){var e,i,n,s;this.So||(this.So=!0,this.fp(),null===(e=this.$o)||void 0===e||e.dispose(),this.$o=void 0,this.po=void 0,this.Wf=!1,null==t||t.removeEventListener("online",this.Xf),null===(i=this.pp)||void 0===i||i.call(this),this.pp=void 0,null===(n=this.Yf)||void 0===n||n.reset(),null===(s=this.tp)||void 0===s||s.reset())}onRemoteConfig(t){var e,i;if(this.So)return;const n=t.ok?null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs:void 0;Re(n)?this.gp():(null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$logs_capture_enabled_server_side:!!n}),n?(this.zf=!0,this.Uf||this.vp(),this.loadIfEnabled()):this.gp())}reset(){var t,e,i,n;this.fp(),null===(t=this.Yf)||void 0===t||t.clearQueue(),this.ia=[],null===(e=this.Yf)||void 0===e||e.reset(),null===(i=this.tp)||void 0===i||i.clearQueue(),this.Gf=[],null===(n=this.tp)||void 0===n||n.reset(),this.rd=0}captureLog(t){this.So||this.rp().captureLog(t)}captureConsoleLog(t){this.So||this.ap().captureLog(t)}captureBufferedConsoleLog(t,e,i){this.So||this.ap().captureLog(t,{context:e,occurredAtMs:i})}dp(){var t;return!!(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t[O])}cp(){var t,e,i;return!(null===(t=this._instance)||void 0===t||null===(e=t.Xl)||void 0===e?void 0:e.call(t))||!!(null===(i=d._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[this._instance.config.token])||void 0===i?void 0:i.config)}wh(){var t;this.fp(),null===(t=this.tp)||void 0===t||t.clearQueue(),this.Gf=[]}gp(){this.zf||this.fp()}vp(){var t;if(this.Jf||!(null==d?void 0:d.console))return;const e=kk(null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs).maxBufferSize;let i=!0;this.Qf.push(()=>{i=!1});for(const t of Sk){let n;try{n=im(d.console[t])}catch(t){continue}n&&this.Qf.push(wv(d.console,t,s=>{const r=(...n)=>{try{i&&this.mp(t,n,e)}catch(t){}return s.apply(d.console,n)};return r.__rrweb_original__=n,r}))}this.Jf=!0,this.yp=setTimeout(()=>{this.fp()},3e4)}mp(t,e,i){var n;if(this.Jf&&!this.Kf&&0!==e.length)if(null===(n=this._instance)||void 0===n?void 0:n.is_capturing()){if(i>this.Zf.length){this.Kf=!0;try{this.Zf.push({level:t,args:e,occurredAtMs:Date.now(),context:this.sp()})}finally{this.Kf=!1}}}else this.fp()}fp(){if(this.Zf=[],this.Jf){this.Jf=!1,this.yp&&(clearTimeout(this.yp),this.yp=void 0);for(const t of this.Qf)t();this.Qf=[]}}bp(){const t=this.Zf;return this.fp(),t}get logger(){return this._p||(this._p={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this._p}flushLogs(t){t?this.wp(t):(this.Yf&&this.Yf.flush().catch(t=>this.kp(t)),this.tp&&this.tp.flush().catch(t=>this.kp(t)))}kp(t){Tk(t)||this.$.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.So||!this.zf||this.Uf||this.Wf)return;const t=null==d?void 0:d.__PosthogExtensions__;if(!t)return this.$.error("PostHog Extensions not found."),void this.fp();const e=t.loadExternalDependency;if(!e)return this.$.error(Zt),void this.fp();this.Wf=!0;try{e(this._instance,"logs",e=>{if(this.Wf=!1,this.So||!this.zf)return;const i=t.logs;if(e||!(null==i?void 0:i.initializeLogs))this.$.error("Could not load logs script",e),this.fp();else{var n;const t=this.bp();var s,r;this.pp=i.initializeLogs(null!==(n=this.po)&&void 0!==n?n:this._instance),this.Uf=!0,t.length>0&&(null===(s=i.replayConsoleBuffer)||void 0===s||s.call(i,null!==(r=this.po)&&void 0!==r?r:this._instance,t))}})}catch(t){throw this.Wf=!1,t}}np(t,e){const i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===he.LogsQueue?t():void 0,setPersistedProperty(t,i){var n;t===he.LogsQueue&&e(null!==(n=i)&&void 0!==n?n:[])},js:t=>this.js(t),getLibraryId:()=>Yl.LIB_NAME,getLibraryVersion:()=>Yl.LIB_VERSION}}js(t){return new Promise(e=>{if(dr(this.rd,3))return void e({kind:"fatal",error:$k(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const n=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),n({kind:"retry-later",error:$k(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Sp(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{const e=t.statusCode;if(this.xp(e),e>=200&&300>e)n({kind:"ok"});else if(413===e)n({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)n({kind:"fatal",error:new Error(`logs request failed with status ${e}`)});else{var i;0===e?(t.error||this.$.warn("Logs request failed before receiving an HTTP response"),n({kind:"retry-later",error:$k(t.error,"logs request failed before receiving an HTTP response")})):n({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`logs request failed with status ${e}`)})}}})})}xp(t){(0!==t||this._instance.__loaded)&&(this.rd=vr(t,this.rd,3,()=>this.$.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}wp(t){this.ia.length>0&&this.Cp(t,this.ia,this.lp,Yl.LIB_NAME,t=>{this.ia=t}),this.Gf.length>0&&this.Cp(t,this.Gf,this.hp,xk,t=>{this.Gf=t})}Cp(t,e,i,n,s){if(0===e.length)return;const r=e.map(t=>t.record);s([]);const o=Os(r,Ps(i,Yl.LIB_NAME,Yl.LIB_VERSION),n,Yl.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Sp(),data:o,compression:"best-available",batchKey:"logs",transport:t})}Sp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}sp(){var t;const e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:t,windowId:i,sessionStartTimestamp:n,lastActivityTimestamp:s}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=t,e.windowId=i,Re(n)||(e.sessionStartTimestamp=n),Re(s)||(e.lastActivityTimestamp=s)}if((null==d||null===(t=d.location)||void 0===t?void 0:t.href)&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?un(d.location.href):d.location.href),this._instance.featureFlags){const t=this._instance.featureFlags.getFlags();t&&t.length>0&&(e.activeFeatureFlags=t)}return e}}},Zk={metrics:class{constructor(t){this._instance=t,this.$=Gs("[metrics]"),this.So=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.So)return;const e=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);e&&!this.$p?this.$p=(t=>{let e=!0;const i=()=>e?(t=>{var e;const i=null===(e=t.config.metrics)||void 0===e?void 0:e.network;return!0===i?{}:i||void 0})(t):void 0,n=Ak(t,i),s=Fk(t,i);return()=>{e=!1,n(),s()}})(this._instance):!e&&this.$p&&(this.$p(),this.$p=void 0)}rp(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;var i;return this.Yf&&this.op===e||(null===(i=this.Yf)||void 0===i||i.reset(),this.op=e,this.Yf=new js(this.np(),function(t){var e,i,n,s,r;const o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(e=null==o?void 0:o["service.name"])&&void 0!==e?e:null==t?void 0:t.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==t?void 0:t.serviceVersion,environment:null!==(n=null==o?void 0:o["deployment.environment"])&&void 0!==n?n:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(r=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(e),this.$)),this.Yf}count(t,e=1,i){this.rp().count(t,e,i)}gauge(t,e,i){this.rp().gauge(t,e,i)}histogram(t,e,i){this.rp().histogram(t,e,i)}flush(t){if(!this.Yf)return Promise.resolve();if(t){const e=this.Yf.drainWindow();return e&&this.Ys(e,t),Promise.resolve()}return this.Yf.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.Yf)||void 0===t||t.reset()}dispose(){var t,e;this.So=!0,null===(t=this.$p)||void 0===t||t.call(this),this.$p=void 0,null===(e=this.Yf)||void 0===e||e.reset()}np(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ys:t=>e.Ys(t),getLibraryId:()=>Yl.LIB_NAME,getLibraryVersion:()=>Yl.LIB_VERSION}}Ys(t,e){return new Promise(i=>{let n=!1;const s=t=>{n||(n=!0,clearTimeout(r),i(t))},r=setTimeout(()=>s({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(ue(ue({method:"POST",url:this.Tp(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e}),{},{fireCallbackOnDrop:!0,callback(t){const e=t.statusCode;if(e>=200&&300>e)s({kind:"ok"});else if(413===e)s({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)s({kind:"fatal",error:new Error(`metrics request failed with status ${e}`)});else{var i;s({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`metrics request failed with status ${e}`)})}}}))})}Tp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};Ow.__defaultExtensionClasses=ue({},ue(ue(ue(ue(ue(ue(ue(ue(ue(ue(ue(ue(ue({},Dk),Lk),Nk),qk),Bk),jk),Uk),Hk),zk),Wk),Vk),Gk),Zk));const Qk=function(){Yl.SDK_DIST_CHANNEL="npm";const e=gw[Tw]=new Ow;return function(){function e(){e.done||(e.done=!0,zb=!1,Qs(gw,function(t){t._dom_loaded()}))}(null==n?void 0:n.addEventListener)?"complete"===n.readyState?e():nr(n,"DOMContentLoaded",e,{capture:!1}):t&&Vs.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();var Jk=Qk;exports.Compression=hp,exports.DEFAULT_PRODUCT_TOUR_APPEARANCE={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},exports.DisplaySurveyType=wp,exports.PostHog=Ow,exports.ProductTourEventName=_b,exports.ProductTourEventProperties=bb,exports.SurveyEventName=_p,exports.SurveyEventProperties=bp,exports.SurveyEventType=cp,exports.SurveyPosition=vp,exports.SurveyQuestionBranchingType=mp,exports.SurveyQuestionType=gp,exports.SurveySchedule=yp,exports.SurveyTabPosition=fp,exports.SurveyType=pp,exports.SurveyWidgetType=dp,exports.default=Jk,exports.posthog=Qk,exports.severityLevels=["fatal","error","warning","log","info","debug"];
|