posthog-js 1.455.0 → 1.455.1

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.
Files changed (42) hide show
  1. package/dist/all-external-dependencies.js +1 -1
  2. package/dist/all-external-dependencies.js.map +1 -1
  3. package/dist/array.full.es5.js +1 -1
  4. package/dist/array.full.es5.js.map +1 -1
  5. package/dist/array.full.js +1 -1
  6. package/dist/array.full.js.map +1 -1
  7. package/dist/array.full.no-external.js +1 -1
  8. package/dist/array.full.no-external.js.map +1 -1
  9. package/dist/array.js +1 -1
  10. package/dist/array.no-external.js +1 -1
  11. package/dist/customizations.full.js +1 -1
  12. package/dist/customizations.js +1 -1
  13. package/dist/default-extensions.js +1 -1
  14. package/dist/exception-autocapture.d.ts +4 -3
  15. package/dist/exception-autocapture.js +1 -1
  16. package/dist/exception-autocapture.js.map +1 -1
  17. package/dist/extension-bundles.js +1 -1
  18. package/dist/external-scripts-loader.js +1 -1
  19. package/dist/integrity.json +28 -28
  20. package/dist/lazy-recorder.js +1 -1
  21. package/dist/main.js +1 -1
  22. package/dist/module.full.cjs +1 -1
  23. package/dist/module.full.js +1 -1
  24. package/dist/module.full.js.map +1 -1
  25. package/dist/module.full.no-external.cjs +1 -1
  26. package/dist/module.full.no-external.js +1 -1
  27. package/dist/module.full.no-external.js.map +1 -1
  28. package/dist/module.js +1 -1
  29. package/dist/module.mjs +1 -1
  30. package/dist/module.no-external.cjs +1 -1
  31. package/dist/module.no-external.js +1 -1
  32. package/dist/module.slim.js +1 -1
  33. package/dist/module.slim.no-external.js +1 -1
  34. package/dist/posthog-recorder.js +1 -1
  35. package/dist/src/entrypoints/exception-autocapture.d.ts +4 -3
  36. package/dist/surveys-preview.js +1 -1
  37. package/dist/surveys.js +1 -1
  38. package/lib/package.json +1 -1
  39. package/lib/src/entrypoints/exception-autocapture.d.ts +4 -3
  40. package/lib/src/entrypoints/exception-autocapture.js +92 -42
  41. package/lib/src/entrypoints/exception-autocapture.js.map +1 -1
  42. package/package.json +4 -4
@@ -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,c="undefined"!=typeof globalThis?globalThis:t;c&&"undefined"==typeof self&&(c.self=c),c&&"undefined"==typeof File&&(c.File=function(){});const h=null!=t?t:{},d="$early_access_features",v="$active_feature_flags",f="$feature_flag_details",p="$feature_flag_errors",g="$feature_flag_evaluated_at",m="$feature_flag_request_id",y="$minimal_flag_called_events",b="$enabled_feature_flags",_="$stored_group_properties",w="$stored_person_properties",k="$flag_call_reported",S="$flag_call_reported_session_id",x="$feature_flag_payloads",T="$override_feature_flags",C="$override_feature_flag_payloads",E="visibilitychange",M="$autocapture_disabled_server_side",I="$surveys",R="$surveys_loaded_at",A="PostHog loadExternalDependency extension not found.",O="$surveys_activated",P="$surveys_activated_session",F="$surveys_activated_timestamps",L="$people_distinct_id",D="distinct_id",N="$device_id",j="$device_model",q="__alias",B="__cmpns",z="$fbc",U="$fbc_persistence",H="$fbp",W="$fbp_persistence",V="__timers",G="$heatmaps_enabled_server_side",J="$exception_capture_enabled_server_side",Q="$error_tracking_suppression_rules",Z="$error_tracking_capture_extension_exceptions",K="$web_vitals_enabled_server_side",Y="$dead_clicks_enabled_server_side",X="$product_tours_enabled_server_side",tt="$logs_capture_enabled_server_side",et="$web_vitals_allowed_metrics",it="$session_recording_remote_config",nt="$session_recording_enabled_server_side",st="$replay_sample_rate",rt="$replay_override_sampling",ot="$replay_override_linked_flag",lt="$replay_override_url_trigger",at="$replay_override_event_trigger",ut="$sesid",ct="$session_is_sampled",ht="$session_past_minimum_duration",dt="$session_recording_url_trigger_activated_session",vt="$session_recording_event_trigger_activated_session",ft="$posthog_sr_group_event_trigger_",pt="$posthog_sr_group_url_trigger_",gt="$posthog_sr_group_sampling_",mt="$debug_first_full_snapshot_timestamp",yt="$sess_rec_flush_size",bt="$groups",_t="ph_product_tours",wt="$product_tours_activated",kt="$product_tours_activated_session",St="$conversations_widget_session_id",xt="$conversations_ticket_id",$t="$conversations_widget_state",Tt="$conversations_user_traits",Ct="$user_state",Et="$client_session_props",Mt="$capture_rate_limit",It="$initial_campaign_params",Rt="$initial_referrer_info",At="$initial_person_info",Ot="$epp",Pt="$posthog_cookieless",Ft="$cookieless_mode",Lt="$sdk_debug_extensions_init_method",Dt="$sdk_debug_extensions_init_time_ms",Nt="$sdk_debug_recording_script_not_loaded",jt="$sdk_debug_replay_stale_config",qt="$sdk_debug_replay_event_trigger_status",Bt="$sdk_debug_replay_linked_flag_trigger_status",zt="$sdk_debug_replay_matched_recording_trigger_groups",Ut="$sdk_debug_replay_pending_trigger_conditions",Ht="$sdk_debug_replay_remote_trigger_matching_config",Wt="$sdk_debug_replay_trigger_groups_count",Vt="$sdk_debug_replay_url_trigger_status",Gt="$sdk_debug_rrweb_attached",Jt="$sdk_debug_rrweb_start_attempted",Qt="$session_recording_start_reason",Zt="anonymous",Kt="identified",Yt="identified_only",Xt="beforeunload",te="$pageview",ee="$pageleave",ie="$identify",ne="$groupidentify";function se(t,e,i,n,s,r,o){try{var 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 ce=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),he=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const de="min_length",ve="max_length",fe=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],pe=["token"];function ge(t,e){return-1!==t.indexOf(e)}const me=function(t){return t.trim()},ye=function(t){return t.replace(/^\$/,"")};function be(t){var e;const i=[];return null!==(e=JSON.stringify(t,function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(e))return"[Circular]";i.push(e)}return e}}))&&void 0!==e?e:"null"}const _e=Object.prototype,we=_e.hasOwnProperty,ke=_e.toString,Se=Array.isArray||function(t){return"[object Array]"===ke.call(t)},xe=t=>"function"==typeof t,$e=t=>t===Object(t)&&!Se(t),Te=t=>{if($e(t)){for(const e in t)if(we.call(t,e))return!1;return!0}return!1},Ce=t=>void 0===t,Ee=t=>"[object String]"==ke.call(t),Me=t=>Ee(t)&&0===t.trim().length,Ie=t=>null===t,Re=t=>Ce(t)||Ie(t),Ae=t=>"[object Number]"==ke.call(t)&&t==t,Oe=t=>Ae(t)&&t>0,Pe=t=>"[object Boolean]"===ke.call(t),Fe=t=>t instanceof FormData,Le=t=>ge(fe,t),De=t=>ge(pe,t);function Ne(t){return null===t||"object"!=typeof t}function je(t,e){return{}.toString.call(t)===`[object ${e}]`}function qe(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return ze(t,Error)}}function Be(t){return"u">typeof Event&&ze(t,Event)}function ze(t,e){try{return t instanceof e}catch(t){return!1}}const Ue=[!0,"true",1,"1","yes"],He=t=>ge(Ue,t),We=[!1,"false",0,"0","no"],Ve=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","lightpanda","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Ge=new Map,Je=function(t,e=[]){if(!t)return!1;const i=function(t,e){let i="";for(let t=0;e.length>t;t++){const n=e[t];i+=n.length+":"+n}return t.length+":"+t+"|"+e.length+":"+i}(t,e),n=Ge.get(i);if(void 0!==n)return n;const s=t.toLowerCase(),r=Ve.concat(e).some(t=>-1!==s.indexOf(t.toLowerCase()));return 256>Ge.size||Ge.clear(),Ge.set(i,r),r};function Qe(t,e,i,n,s){return e>i&&(n.warn("min cannot be greater than max."),e=i),Ae(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),Qe(null!=s?s:i,e,i,n))}var Ze=class{constructor(t){this.C={},this.I=t.I,this.A=Qe(t.bucketSize,0,100,t.R),this.O=Qe(t.refillRate,0,this.A,t.R),this.$=Qe(t.refillInterval,0,864e5,t.R)}F(t,e){const i=Math.floor((e-t.lastAccess)/this.$);i>0&&(t.tokens=Math.min(t.tokens+i*this.O,this.A),t.lastAccess=t.lastAccess+i*this.$)}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.A,lastAccess:i},this.C[n]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null===(e=this.I)||void 0===e||e.call(this,t)),0===s.tokens)}stop(){this.C={}}};const Ke="Mobile",Ye="Android",Xe="Tablet",ti="Android Tablet",ei="iPad",ii="Apple Watch",ni="Safari",si="BlackBerry",ri="Samsung Internet",oi="Chrome",li="Chrome iOS",ai="Internet Explorer",ui="Internet Explorer Mobile",ci="Opera",hi="Microsoft Edge",di="Firefox",vi="Firefox iOS",fi="Nintendo",pi="PlayStation",gi="Xbox",mi="Android Mobile",yi="Mobile Safari",bi="Windows",_i="Windows Phone",wi="Nokia",ki="Ouya",Si="Generic tablet",xi="Konqueror",$i="Oculus Browser",Ti="Vivaldi",Ci="Yandex",Ei="Whale",Mi="DuckDuckGo",Ii="Pale Moon",Ri="Waterfox",Ai="Brave",Oi="Claude",Pi="Codex",Fi="ChatGPT",Li="Google Search App",Di=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ni=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),ji=new RegExp(gi,"i"),qi=new RegExp("PlayStation \\w+","i"),Bi=new RegExp("Nintendo \\w+","i"),zi=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"},Hi=function(t,e,i,n){e=e||"";const s=function(t){return(null==t?void 0:t.brave)?Ai:null}(i);return s||((null==n?void 0:n.detectGoogleSearchApp)&&ge(t,"GSA/")?Li:ge(t," OPR/")&&ge(t,"Mini")?"Opera Mini":ge(t," OPR/")?ci:zi.test(t)?si:ge(t,"IEMobile")||ge(t,"WPDesktop")?ui:ge(t,"OculusBrowser")?$i:ge(t,"SamsungBrowser")?ri:ge(t,"Edge")||ge(t,"Edg/")?hi:ge(t,"Vivaldi/")?Ti:ge(t,"YaBrowser/")?Ci:ge(t,"Whale/")?Ei:ge(t,"DuckDuckGo/")||ge(t,"Ddg/")?Mi:ge(t,"Claude/")?Oi:ge(t,"Codex/")?Pi:ge(t,"ChatGPT/")?Fi:ge(t,"FBIOS")?"Facebook Mobile":ge(t,"UCWEB")||ge(t,"UCBrowser")?"UC Browser":ge(t,"CriOS")?li:ge(t,"CrMo")||ge(t,oi)?oi:ge(t,Ye)&&ge(t,ni)?mi:ge(t,"FxiOS")?vi:ge(t.toLowerCase(),xi.toLowerCase())?xi:ge(t,"Brave/")?Ai:((t,e)=>e&&ge(e,"Apple")||function(t){return ge(t,ni)&&!ge(t,oi)&&!ge(t,Ye)}(t))(t,e)?ge(t,Ke)?yi:ni:ge(t,"PaleMoon/")?Ii:ge(t,"Waterfox/")?Ri:ge(t,di)?di:ge(t,"MSIE")||ge(t,"Trident/")?ai:ge(t,"Gecko")?di:"")},Wi={[ui]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[hi]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[oi]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[li]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[ni]:[Di],[yi]:[Di],[ci]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[di]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[vi]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[xi]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[si]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Di],[mi]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ri]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[$i]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Ti]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ci]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Ei]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ai]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Oi]:[Ni],[Pi]:[Ni],[Fi]:[Ni],[Mi]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Ri]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Li]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ai]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Vi=function(t,e,i,n){const s=Hi(t,e,i,n),r=Wi[s];if(Ce(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=>[gi,t&&t[1]||""]],[new RegExp(fi,"i"),[fi,""]],[new RegExp(pi,"i"),[pi,""]],[zi,[si,""]],[new RegExp(bi,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[_i,""];if(new RegExp(Ke).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){let t=Ui[i[1]]||"";return/arm/i.test(e)&&(t="RT"),[bi,t]}return[bi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let e="";return t&&t.length>=3&&(e=Ce(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Ye,[t[2],t[3],t[4]||"0"].join(".")]:[Ye,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Ji=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 Bi.test(t)?fi:qi.test(t)?pi:ji.test(t)?gi:new RegExp(ki,"i").test(t)?ki:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?_i:/iPad/.test(t)?ei:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ii:zi.test(t)?si:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(wi,"i").test(t)?wi:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Ke).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Ye:ti:new RegExp("(pda|Mobile)","i").test(t)?"Generic mobile":new RegExp(Xe,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?Si:""},Zi=function(t,e){var i;const n=Qi(t);return n===ei||n===ti||"Kobo"===n||"Kindle Fire"===n||n===Si?Xe:n===fi||n===gi||n===pi||n===ki?"Console":n===ii?"Wearable":n?Ke:"Android"===(null==e?void 0:e.userAgentDataPlatform)&&(null!==(i=null==e?void 0:e.maxTouchPoints)&&void 0!==i?i:0)>0?600>Math.min(null!==(s=null==e?void 0:e.screenWidth)&&void 0!==s?s:0,null!==(r=null==e?void 0:e.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==e?void 0:e.devicePixelRatio)&&void 0!==o?o:1)?Ke:Xe:"Desktop";var s,r,o},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 cn(t){try{return t()}catch(t){return}}function hn(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=hn(()=>{try{null==i||i(),t()}catch(t){s(t)}},e)})])}finally{clearTimeout(n)}})).apply(this,arguments)}let fn,pn,gn,mn;function yn(t){var e;const i=globalThis._posthogChunkIds,n=globalThis._debugIds;if(!i&&!n)return;const s=i?Object.keys(i):[],r=n?Object.keys(n):[];if(mn&&bn(i,s,pn)&&bn(n,r,gn))return mn;pn=i?ue({},i):void 0,gn=n?ue({},n):void 0,mn={},null!==(e=fn)&&void 0!==e||(fn={});const o=(e,i)=>{for(const s of e){const e=i[s];if(!e)continue;const r=null==fn?void 0:fn[s];if(r){mn[r]=e;continue}const o=t(s);for(let t=o.length-1;t>=0;t--){var n;const i=null===(n=o[t])||void 0===n?void 0:n.filename;if(i){mn[i]=e,fn[s]=i;break}}}};return n&&o(r,n),i&&o(s,i),mn}function bn(t,e,i){return t&&i?e.length===Object.keys(i).length&&e.every(e=>t[e]===i[e]):t===i}var _n=class{constructor(t,e,i=[]){this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e={}){const i=e&&e.mechanism||{handled:!0,type:"generic"},n=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),r=this.parseStacktrace(n,s);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(t){var e=this;return re(function*(){for(const i of t)i.stacktrace&&i.stacktrace.frames&&Se(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t})()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null===(e=t.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var i;let n,s;if(null!=t.cause&&(n=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack)try{s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)}catch(t){}return ue(ue({},t),{},{cause:n,stack:s,errors:null===(i=t.errors)||void 0===i?void 0:i.map(t=>this.parseStacktrace(t,e))})}applyChunkIds(t,e){return t.map(t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t))}applyCoercers(t,e){for(const i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return re(function*(){let i=t;for(const t of e.modifiers)i=yield t(i);return i})()}convertToExceptionList(t,e){const i=[],n=(t,s,r)=>{var o;const l=i.length,a=void 0===s?ue(ue({type:"string"==typeof e.type&&e.type.length>0?e.type:"generic"},"boolean"==typeof e.handled?{handled:e.handled}:void 0===e.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof e.synthetic?e.synthetic:t.synthetic,exception_id:l}):{type:"chained",source:r,synthetic:t.synthetic,exception_id:l,parent_id:s},u={type:t.type,value:t.value,mechanism:a};t.stack&&(u.stacktrace={type:"raw",frames:t.stack}),i.push(u),t.cause&&n(t.cause,l,"cause");for(const e of null!==(o=t.errors)&&void 0!==o?o:[])n(e,l,"member")};return n(t),i}buildParsingContext(t){var e;return{chunkIdMap:yn(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}getAggregateErrors(t){try{if(qe(t)){let i=Object.getPrototypeOf(t);for(let n=0;i&&100>n;n++){var e;const n=null===(e=Object.getOwnPropertyDescriptor(i,"constructor"))||void 0===e?void 0:e.value;if("function"==typeof n&&"AggregateError"===n.name){const e=t.errors;return Se(e)?e:void 0}i=Object.getPrototypeOf(i)}}}catch(t){}}buildCoercingContext(t,e,i=0){let n=0,s=0,r=!1;const o=new Set,l=[],a={},u=(t,e,i=0)=>{const u=c(e,i),h=u.apply;if(u.apply=e=>{l.push(t);try{return h(e)}finally{l.pop()}},i>4||i>0&&-1!==l.indexOf(t))return this.coerceFallback(u);const d="object"==typeof t&&null!==t||"function"==typeof t;if(0===i&&n>=50||d&&o.has(t))return;d&&o.add(t),0===i&&n++;const v=this.getAggregateErrors(t);let f,p;r||(r=!!v);try{if(f=this.applyCoercers(t,u),!f)throw a}catch(t){if(t===a)return void(0===i&&n--);if(!r)throw t;f=this.coerceFallback(u)}if(!v||n>=50)return f;try{p=v.length}catch(t){return f}if(!Number.isInteger(p)||0>p||p>4294967295)return f;const g=[];for(let t=0;50>n&&1e3>s&&p>t;t++){let i;s++;try{i=u.next(v[t])}catch(t){n++,i=this.coerceFallback(c(e+1))}i&&g.push(i)}return ue(ue({},f),{},{errors:g})},c=(i,n=0)=>ue(ue({},e),{},{syntheticException:0==i?e.syntheticException:void 0,mechanism:0==i?t:{},apply(t){const e=u(t,i,n+1);if(!e)throw a;return e},next:t=>u(t,i+1)}),h=c(i);return ue(ue({},h),{},{apply:t=>{var e;return null!==(e=u(t,i))&&void 0!==e?e:this.coerceFallback(h)}})}};const wn=/^([a-z][a-z0-9.+-]+):/i,kn=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function Sn(t){if(!t||"<anonymous>"===t)return!1;const e=wn.exec(t);return!e||kn.includes(e[1].toLowerCase())}function xn(t,e,i,n,s){const r={platform:t,filename:e,function:"<anonymous>"===i?"?":i,in_app:Sn(e)};return Ce(n)||(r.lineno=n),Ce(s)||(r.colno=s),r}const $n=(t,e)=>{const i=-1!==t.indexOf("safari-extension"),n=-1!==t.indexOf("safari-web-extension");return i||n?[-1!==t.indexOf("@")?t.split("@")[0]:"?",i?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Tn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Cn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,En=/\((\S*)(?::(\d+))(?::(\d+))\)/,Mn=(t,e)=>{const i=Tn.exec(t);if(i){const[,t,n,s]=i;return xn(e,t,"?",+n,+s)}const n=Cn.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){const t=En.exec(n[2]);t&&(n[2]=t[1],n[3]=t[2],n[4]=t[3])}const[t,i]=$n(n[1]||"?",n[2]);return xn(e,i,t,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},In=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Rn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,An=(t,e)=>{const i=In.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const t=Rn.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]=$n(n,t),xn(e,t,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},On=/\(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 Fn(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 Ln(t,e){const i=e.start+e.length,n=Nn(t,e);n&&t.splice(i+n===t.length?i:e.start,n)}function Dn(t,e){let i=e.start;for(;i>0&&Pn(t[i-1],t[i-1+e.length]);)i--;return e.start-i}function Nn(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 jn(t,e){const i=e[0];let n=t.length-(i?Dn(t,i):0);for(const i of e)n-=Nn(t,i);return n}function qn(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 Bn=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 je(t,"DOMException")}isDOMError(t){return je(t,"DOMError")}},zn=class{match(t){return qe(t)}coerce(t,e){var i;const n=this.getStack(t),s=void 0===n?null===(i=e.syntheticException)||void 0===i?void 0:i.stack:void 0,r=!!s;return{type:this.getType(t),value:this.getMessage(t,e),stack:null!=n?n:s,cause:t.cause?e.next(t.cause):void 0,synthetic:r}}getType(t){return t.name||t.constructor.name}getMessage(t,e){const i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){try{const e=t.stacktrace;if("string"==typeof e&&e.length>0)return e;const i=t.stack;return"string"==typeof i&&i.length>0?i:void 0}catch(t){return}}},Un=class{match(t){return!!je(t,"ErrorEvent")&&(null!=t.error||this.$r(t))}coerce(t,e){var i;if(null!=t.error)return e.apply(t.error);const n=e.apply(t.message);return ue(ue({},n),{},{stack:null!==(i=this.Lr(t))&&void 0!==i?i:n.stack,synthetic:!0})}$r(t){return Ee(t.message)&&t.message.length>0}Lr(t){var e,i;const n=t,s=null!==(e=n.lineno)&&void 0!==e?e:0,r=null!==(i=n.colno)&&void 0!==i?i:0;if(Ee(n.filename)&&0!==n.filename.length&&0!==s)return`Error\n at ${n.filename}:${s}:${r}`}};const Hn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Wn=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 Vn=["fatal","error","warning","log","info","debug"];function Gn(t,e=40){const i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";let n="";for(const t of i){const i=n?`${n}, ${t}`:t;if(i.length>e)break;n=i}return n}var Jn=class{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,n;const s=this.getErrorPropertyFromObject(t);return s?e.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(i=this.getStack(t))&&void 0!==i?i:null===(n=e.syntheticException)||void 0===n?void 0:n.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Be(t))return t.constructor.name;const e="name"in t?t.name:void 0;return Ee(e)&&!Me(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: ${Gn(t)}`}isSeverityLevel(t){return Ee(t)&&!Me(t)&&Vn.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(qe(i))return i}}getObjectClassName(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}},Qn=class{match(t){return Be(t)}coerce(t,e){var i;const n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${Gn(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}}},Kn=class{match(t){return je(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Be(t))return!1;try{const e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i;const n=this.getUnhandledRejectionReason(t);return Ne(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}:e.apply(n)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}};const Yn="$message",Xn="$timestamp",ts=new Set([Yn,Xn]),es={enabled:!0,max_bytes:32768};function is(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:es.enabled,max_bytes:ss(t.max_bytes,es.max_bytes)}:ue({},es)}var ns=class{constructor(t){this.ns=[],this.ss=0,this.Yr=is(t)}setConfig(t){this.Yr=is(t),this.rs()}add(t){const e=function(t){let e;try{e=be(t)}catch(t){return}try{const t=JSON.parse(e);if(!$e(t))return;const i=t,n=i[Yn],s=i[Xn];if(!Ee(n)||0===n.trim().length)return;if(!Ee(s)&&!Ae(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.Yr.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.Yr.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function ss(t,e){if(!Ae(t)||1/0===t||-1/0===t)return e;const i=Math.floor(t);return 0>i?e:i}const rs=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function os(t){return"string"==typeof t||t}function ls(t){return"string"==typeof t?t:void 0}const as=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],us="NativeGzipValidationError",cs=t=>t.length>=2&&31===t[0]&&139===t[1],hs=(t,e)=>t===he.GZipJS||e===he.GZipJS||"gzip"===e,ds=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),vs=t=>{if(!t||"object"!=typeof t)return!1;const e="name"in t?String(t.name):"";return ds(t)||e===us};let fs;const ps=t=>{throw an(us,`Native gzip produced invalid output: ${t}`)};let gs=0,ms=!1;const ys=function(){var t=re(function*(t,e){18>t.size&&ps("too-short");const i=new Uint8Array(yield t.slice(0,10).arrayBuffer());cs(i)&&8===i[2]||ps("invalid-header");const n=new DataView(yield t.slice(t.size-8).arrayBuffer()),s=e.length>>>0;n.getUint32(4,!0)!==s&&ps("invalid-size"),(ms||3>gs)&&(n.getUint32(0,!0)!==(t=>{const e=(()=>{if(fs)return fs;fs=[];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;fs[t]=e>>>0}return fs})();let i=4294967295;for(let n=0;t.length>n;n++)i=e[255&(i^t[n])]^i>>>8;return(4294967295^i)>>>0})(e)&&(ms=!0,ps("invalid-crc")),gs++)});return function(e,i){return t.apply(this,arguments)}}();function bs(t){return _s.apply(this,arguments)}function _s(){return _s=re(function*(t,e=!0,i){try{const e=(new TextEncoder).encode(t),i=new globalThis.CompressionStream("gzip"),s=i.writable.getWriter(),r=s.write(e).then(()=>s.close()).catch((n=re(function*(t){try{yield s.abort(t)}catch(t){}throw t}),function(t){return n.apply(this,arguments)})),o=new Response(i.readable).blob(),[l]=yield Promise.all([o,r]);return yield ys(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}),_s.apply(this,arguments)}function ws(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;r.length>n;n++)e.includes(i=r[n])||{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}const ks="[redacted]",Ss=/^[A-Za-z0-9+/\n\r]+=*$/,xs=/^[A-Za-z0-9_-]+={0,2}$/,$s=/[-_]/,Ts=/^data:[^,\s]*;base64,/i,Cs=/^[A-Za-z0-9+/_-]+={0,2}$/,Es=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,Ms=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,Is=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,Rs=/[\s<>"]/,As=(()=>new RegExp(Is.source,"i"))(),Os=/[a-z][a-z0-9+.-]{0,63}:\/\//i,Ps=(()=>new RegExp(`^${Os.source}`,"i"))(),Fs=(()=>new RegExp(Os.source,"gi"))(),Ls=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,Ds=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,Ns=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,js=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,qs=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,Bs=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,zs=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,Us=/\d+/g,Hs=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,Ws=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function Vs(t){return function(t){return Ms.test(t)}(t)||Ls.test(t)||Ds.test(t)}function Gs(t){return t.split("&",129).length>128}function Js(t,e,i){return Vs(t)||e.includes(";")&&function(t){return t.split(";").some(t=>Vs(t.split("=",1)[0]))}(e)?ks:As.test(e)?i?tr(e,{allowNestedUrls:!1,stripPunctuation:!0}):ks:e}function Qs(t,e){const i=new URLSearchParams;let n=!1,s=!1;for(const[r,o]of new URLSearchParams(t)){const t=er(r),l=er(o);n||(n=t!==r||l!==o);const a=Js(t,l,e);n||(n=a!==l),s=Vs(t)||a!==l,i.append(t,a)}return{changed:n,lastFieldSensitive:s,serialized:i.toString()}}function Zs(t,e){if(!t.includes("="))return{value:Ks(t,e),lastFieldSensitive:!1};const i=Qs(t,e);return{value:i.changed?i.serialized:t,lastFieldSensitive:i.lastFieldSensitive}}function Ks(t,e){return e?tr(t,{allowNestedUrls:!1,stripPunctuation:!0}):As.test(t)?ks:t}function Ys(t,e,i){return"#"===t?!e.fragment&&(e.fragment=!0):"?"===t&&(e.fragment?"="!==i&&!e.fragmentQuery&&(e.fragmentQuery=!0):!e.query&&(e.query=!0))}function Xs(t,e){var i;if(t.length>8192&&Ps.test(t))return ks;const{address:n,suffix:s}=e.stripPunctuation?function(t){let e=t.length;for(;e>0&&".,;:!?)]}'".includes(t[e-1]);)e--;return{address:t.slice(0,e),suffix:t.slice(e)}}(t):{address:t,suffix:""};let r;try{r=new URL(n)}catch(t){return ks+s}const o=r.search.slice(1),l=""!==r.hash,a=function(t){const e=t.slice(1),i=e.indexOf("?");return 0>i?{head:e,tail:null}:{head:e.slice(0,i),tail:e.slice(i+1)}}(r.hash);if(Gs(o)||Gs(a.head)||Gs(null!==(i=a.tail)&&void 0!==i?i:""))return ks+s;let u=!1;(r.username||r.password)&&(r.username=ks,r.password="",u=!0);const c=Qs(o,e.allowNestedUrls);c.changed&&(r.search=c.serialized,u=!0);const h=Zs(a.head,e.allowNestedUrls),d=null===a.tail?null:(v=a.tail,h.lastFieldSensitive?{value:""===v?"":ks,lastFieldSensitive:!0}:Zs(v,e.allowNestedUrls));var v;const f=null===d?h.value:`${h.value}?${d.value}`;f!==r.hash.slice(1)&&(r.hash=f,u=!0);const p=l?null!=d?d:h:c;return(u?er(r.toString()):n)+(p.lastFieldSensitive?"":s)}function tr(t,e){return t.replace(Is,i=>function(t,e){const i=function(t){if(!t.includes("://"))return[];const e=[...t.matchAll(Fs)].map(t=>t.index),i=[],n={query:!1,fragment:!1,fragmentQuery:!1};let s=0,r=!1,o="";for(let l=0;t.length>l&&e.length>s;l++){e[s]===l&&(l>0&&"="!==o&&i.push(l),s++);const a=t[l];Ys(a,n,o)?(o=a,r=!0):r&&"=&".includes(a)&&(o=a)}return i}(t);if(0===i.length)return Xs(t,e);let n="",s=0;for(const r of i)n+=Xs(t.slice(s,r),ue(ue({},e),{},{stripPunctuation:!1})),s=r;return n+Xs(t.slice(s),e)}(i,ue(ue({},e),{},{stripPunctuation:e.stripPunctuation&&i.length!==t.length})))}function er(t){return t.replace(Es,ks)}function ir(t,e){return function(t){return t.length>=10240&&(Ss.test(t)||function(t){const e=Ts.exec(t);if(!e)return!1;let i;try{i=decodeURIComponent(t.slice(e[0].length))}catch(t){return!1}return Cs.test(i.replace(/[\r\n]/g,""))}(t)||$s.test(t)&&xs.test(t))}(t)?"[binary data redacted - not supported by PostHog MCP analytics]":function(t,e,i){const n=4*i.maxStringLength;if(t.length>n){const s=e(t.slice(0,function(t,e){let i=e;for(;i>0&&!Rs.test(t[i-1]);)i--;return i}(t,n)));if(s.length>=2*i.maxStringLength)return s+i.truncationSuffix}return e(t)}(t,t=>function(t){return tr(t,{allowNestedUrls:!0,stripPunctuation:!0})}(function(t){let e=t.replace(Ns," ");return e=e.replace(js,ks),e=e.replace(qs,ks),e=e.replace(Bs,`$1${ks}`),e=function(t){let e="",i=0;for(let n=lr(t,0);null!==n;n=lr(t,n[1]))e+=t.slice(i,n[0])+ar(t.slice(n[0],n[1])),i=n[1];return e+t.slice(i)}(e),e=e.replace(zs,ks),e=e.replace(Hs,`$1${ks}`),e=e.replace(Ws,`$1${ks}`),e}(er(t))),e)}function nr(t){let e=0,i=!1;for(let n=t.length-1;n>=0;n--){let s=t.charCodeAt(n)-48;if(0>s||s>9)return!1;i&&(s*=2,s>9&&(s-=9)),e+=s,i=!i}return e%10==0}function sr(t,e){const i=t.charCodeAt(e);return i>=48&&57>=i}function rr(t,e){const i=t.charCodeAt(e);return sr(t,e)||95===i||i>=65&&90>=i||i>=97&&122>=i}function or(t,e){let i=e;for(;sr(t,i);)i++;return i}function lr(t,e){for(let i=e;t.length>i;i++){if(!sr(t,i)||rr(t,i-1))continue;let e=0,n=-1,s=i;for(;;){const i=or(t,s);if(e+=i-s,13>e||rr(t,i)||(n=i),s=i+1,!" ./-".includes(t.charAt(i))||!sr(t,s))break}if(n>=0)return[i,n];i=s-1}return null}function ar(t){const e=[];for(let i=Us.exec(t);null!==i;i=Us.exec(t))e.push({digits:i[0],start:i.index,end:i.index+i[0].length});let i="",n=0,s=0;for(;e.length>s;){let r="",o=-1;for(let t=s;e.length>t&&(r+=e[t].digits,19>=r.length);t++)r.length>=13&&nr(r)&&(o=t);0>o?s++:(i+=t.slice(n,e[s].start)+ks,n=e[o].end,s=o+1)}return i+t.slice(n)}const ur={}.propertyIsEnumerable;function cr(t,e){try{return vr(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function hr(t,e,i,n){if(0>=i.remainingNodes)return{stringValue:Xi};if(i.remainingNodes--,Pe(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 hr(s.call(t),e,i,n+1)}catch(t){}return Se(t)?{arrayValue:{values:dr(t,e,i,n+1)}}:{kvlistValue:{values:vr(t,e,i,n+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:en(String(t))}}function dr(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(hr(r,e,i,n))}catch(t){s.push({stringValue:tn})}return t.length>o&&s.push({stringValue:Xi}),s}function vr(t,e,i,n){const s=[];for(const r in t)if(ur.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(Ie(o)||Ce(o))continue;s.push({key:en(r),value:hr(o,e,i,n)})}catch(t){s.push({key:en(r),value:{stringValue:tn}})}}return s}function fr(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 pr=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function gr(t,e){const i=nn({},t),n={};for(const t of pr)({}).hasOwnProperty.call(i,t)&&(n[t]=i[t],delete i[t]);return[...cr(i,e),...cr(n,e)]}const mr={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 yr={text:"INFO",number:9},br={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:yr,warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}};function _r(t){try{return en(String(t))}catch(t){return tn}}function wr(t,e,i,n){const s=t.level||"info",{text:r,number:o}=br[s]||yr,l=function(t=Date.now()){return String(t)+"000000"}(Ae(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),c=t.attributes;if(c){let t=[];try{t=Object.keys(c)}catch(e){t=[]}for(const e of t){let t;try{t=c[e]}catch(e){t=tn}Object.defineProperty(u,e,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const h={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:r,body:{stringValue:_r(t.body)},attributes:cr(u,i)};return t.trace_id&&(h.traceId=t.trace_id),t.span_id&&(h.spanId=t.span_id),Ce(t.trace_flags)||(h.flags=t.trace_flags),h}function kr(t,e,i){return fr(t,e,i)}function Sr(t,e,i,n){return{resourceLogs:[{resource:{attributes:gr(e)},scopeLogs:[{scope:{name:i,version:n},logRecords:t}]}]}}var xr=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.cs}arm(t){this.clear(),this.us=Date.now()+t,this.cs=hn(()=>{this.cs=void 0,this.ls()},t)}armNoEarlierThan(t){this.cs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function $r(){return.75+.5*Math.random()}function Tr(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 Cr=class{constructor(t,e,i,n,s,r=()=>Promise.resolve(),o,l=()=>!1){var a;this._instance=t,this.Yr=e,this.R=i,this.hs=n,this.ds=s,this.vs=r,this.fs=o,this.ps=l,this.gs=new xr(()=>this.ys()),this.bs=null,this._s=0,this.ws=0,this.ks=null,this.Ss=new rn,this.xs=0,this.$s=1,this.Cs=0,this.Ts=0,this.Ms=!1,this.Is=e.maxBufferSize,this.Es=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.As=e.flushIntervalMs,this.Rs=e.maxBatchRecordsPerPost,this.Ps=e.rateCapWindowMs,this.Os=e.maxLogsPerInterval}clearQueue(){this.ws++,this._instance.setPersistedProperty(ce.LogsQueue,[])}get throttled(){return this.Ss.isOpen()}reset(){this.gs.clear(),this.Cs=0,this.Ts=0,this.Ms=!1,this.xs=0,this.$s=1,this.Ss.reset(),this.Rs=this.Yr.maxBatchRecordsPerPost}onReconnect(){this.xs=0,this.$s=1,this.Ss.isOpen()?this.Fs()&&this.Ls():this.ys()}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.Ds(t);if(null===n)return;if(!n.body)return void this.R.info("Log was rejected in beforeSend function");if(!this.Ns())return;const s={record:wr(n,null!==(i=null==e?void 0:e.context)&&void 0!==i?i:this.hs(),this.R,null==e?void 0:e.occurredAtMs)};this.ds(()=>this.js(s))}Ds(t){const e=this.Yr.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.R.info("Log was rejected in beforeSend function"),null;n=e}catch(t){return this.R.error("Error in beforeSend function for log:",t),null}return n}Ns(){if(void 0===this.Os)return!0;const t=Date.now(),e=t-this.Cs;return this.Ps>e&&e>=0||(this.Cs=t,this.Ts=0,this.Ms=!1),this.Os>this.Ts?(this.Ts++,!0):(this.Ms||(this.R.warn(`captureLog dropping logs: exceeded ${this.Os} logs per ${this.Ps}ms`),this.Ms=!0),!1)}flush(){var t=this;return re(function*(){if(!t._instance.isDisabled)return t.bs||(t.bs=t.qs().finally(()=>{t.bs=null})),t.bs})()}qs(){var t=this;return re(function*(){var e;if(t.gs.clear(),t.Bs())return;let i=null!==(e=t._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==e?e:[];if(0===i.length)return;const n=i.length;let s=0;for(;i.length>0&&n>s;){var r,o;if(t.Bs())return;const e=t.ws;t._s=0;const n=Math.min(i.length,t.Rs),l=i.slice(0,n),a=Sr(l.map(t=>t.record),t.zs(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.Hs(a);if(t.ws!==e)return;if("too-large"===u.kind&&l.length>1)t.Rs=Math.max(1,Math.floor(l.length/2)),t.R.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${t.Rs}`);else{if(t.Ss.record(u),t.gs.pending&&t.gs.arm(Math.max(t.As,t.Ss.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.R.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.Yr.maxBatchRecordsPerPost>t.Rs&&(t.Rs=Math.min(t.Yr.maxBatchRecordsPerPost,t.Rs+1)),yield t.Us(l.length),i=null!==(o=t._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===u.kind)throw u.error}}})()}Bs(){return!!this.ps()&&(this.Fs()&&this.clearQueue(),!0)}Us(t){var e=this;return re(function*(){var i;const n=Math.max(0,t-e._s),s=null!==(i=e._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(ce.LogsQueue,s.slice(n)),yield e.vs()})()}zs(){return kr(this.Yr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}js(t){var e;if(this._instance.optedOut)return;const i=null!==(e=this._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==e?e:[];this.Es>i.length||(i.shift(),this._s++,this.R.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(ce.LogsQueue,i),this.Is>i.length||this.Ss.isOpen()?this.Ls():this.ys()}Ls(){this.gs.pending||this.gs.arm(Math.max(this.As,this.Ss.remainingMs()))}Ws(){return Math.max(Tr(this.As,this.xs,this.$s,3e4),this.Ss.remainingMs())}Fs(){const t=this._instance.getPersistedProperty(ce.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return re(function*(){e.gs.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(()=>{})})})()}flushInBackground(){if(this.ks)return this.ks;const t=this.flush().then(()=>{this.xs=0,this.$s=1},t=>{this.xs++,this.$s=$r(),this.R.error("PostHog logs flush failed:",t)}).finally(()=>{this.ks===t&&(this.ks=null),!this._instance.isDisabled&&this.Fs()&&this.gs.armNoEarlierThan(this.Ws())});return this.ks=t,t}ys(){this.flushInBackground()}};const Er=/^[0-9a-f]+$/;function Mr(t,e,i){return"string"==typeof t&&t.length===e&&t!==i&&Er.test(t)}const Ir=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;const Rr="00",Ar=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Or(t){return String(t)+"000000"}function Pr(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 Fr=class{constructor(t,e,i){this._instance=t,this.Yr=e,this.R=i,this.Vs=new Map,this.gs=new xr(()=>this.flush().catch(t=>{this.R.error("Metrics flush failed:",t)})),this.bs=null,this.Gs=null,this.Js=!1,this.Qs=new Map,this.Zs=new Set,this.Ks=new Map,this.Ys=new Set,this.Xs=!1,this.Ss=new rn,this.xs=0,this.$s=1,this.Po=0}count(t,e=1,i){this.Fo({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.Fo({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.Fo({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes,bounds:Se(null==i?void 0:i.bounds)?i.bounds.slice():null==i?void 0:i.bounds})}flush(){var t=this;const e=this.bs,i=function(){var i=re(function*(){e&&(yield e.catch(()=>{})),yield t.No()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this.bs===i&&(this.bs=null)});return this.bs=i,i}flushCoalesced(){var t,e;return this.jo()?null!==(t=this.bs)&&void 0!==t?t:Promise.resolve():(this.Gs||(this.Gs=(null!==(e=this.bs)&&void 0!==e?e:Promise.resolve()).catch(()=>{}).then(()=>(this.Gs=null,this.jo()?void 0:this.flush()))),this.Gs)}jo(){return this.xs>0||this.Ss.remainingMs()>0}drainWindow(){if(0===this.Vs.size)return null;const t=this.Vs;return this.qo(),this.Bo(t)}reset(){this.Po++,this.Ss.reset(),this.xs=0,this.$s=1,this.gs.clear(),this.bs=null,this.Gs=null,this.qo(),this.Ks=new Map,this.Xs=!1}qo(){this.Vs=new Map,this.Js=!1,this.Qs=new Map,this.Zs=new Set,this.Ys=new Set}Fo(t){if(this._instance.isDisabled||this._instance.optedOut)return;const e=this.Ds(t);if(null===e)return;if(!e.name||"string"!=typeof e.name)return void this.R.warn("Dropping metric with empty name");if("number"!=typeof e.value||!Number.isFinite(e.value))return void this.R.warn(`Dropping metric '${e.name}': value must be a finite number`);if("count"!==e.type&&"gauge"!==e.type&&"histogram"!==e.type)return void this.R.warn(`Dropping metric '${e.name}': unknown type '${String(e.type)}'`);if("count"===e.type&&0>e.value)return void this.R.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=Pr(e.type,e.name,e.unit,i)}catch(t){return void this.R.warn(`Dropping metric '${e.name}': attributes could not be serialized`,t)}let s,r=this.Vs.get(n);if(!r&&!this.zo())return;if("histogram"===e.type&&(s=this.Ho(e.name,e.unit,e.bounds),!s))return;r||(r={name:e.name,type:e.type,unit:e.unit,attributes:i,windowStartMs:Date.now(),hist:s&&Dr(s)},this.Vs.set(n,r));const o=this.Qs.get(e.name);void 0===o?this.Qs.set(e.name,e.type):o===e.type||this.Zs.has(e.name)||(this.Zs.add(e.name),this.R.warn(`Metric name '${e.name}' is already used as a ${o}; recording it as a ${e.type} too will blend both series in charts. Use a distinct name.`)),this.Uo(r,e.value);const l=this.Wo();l&&(r.exemplar=ue(ue({},l),{},{value:e.value,timeMs:Date.now()})),this.Ls()}Wo(){try{var t,e;const i=function(t){const e=function(t){if("string"!=typeof t)return;const e=Ir.exec(t.trim());if(!e)return;const[,i,n,s,r,o]=e;return"ff"===i||"00"===i&&o||!function(t){return Mr(t,32,"00000000000000000000000000000000")}(n)||!function(t){return Mr(t,16,"0000000000000000")}(s)?void 0:{version:i,traceId:n,spanId:s,flags:r}}(t);return e&&{traceId:e.traceId,spanId:e.spanId,flags:(i=e.flags,1&parseInt(i,16)?"01":Rr)};var i}(null===(t=(e=this._instance).getActiveSpan)||void 0===t||null===(t=t.call(e))||void 0===t?void 0:t.traceparent());if(i&&"01"===i.flags)return{traceId:i.traceId,spanId:i.spanId}}catch(t){}}zo(){return this.Yr.maxSeriesPerFlush>this.Vs.size||(this.Js||(this.Js=!0,this.R.warn(`Metric series cap reached (${this.Yr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Ho(t,e,i){if(void 0!==i&&!function(t){if(!Se(t)||0===t.length)return!1;for(let e=0;t.length>e;e++)if(!Number.isFinite(t[e])||e>0&&t[e-1]>=t[e])return!1;return!0}(i))return void this.R.warn(`Dropping histogram '${t}': bounds must be a non-empty array of finite, strictly increasing numbers`);const n=Pr("histogram",t,e,void 0),s=this.Ks.get(n);if(s)return this.Vo(t,n,s,i),s;if(this.Ks.size>=this.Yr.maxSeriesPerFlush){if(this.Xs||(this.Xs=!0,this.R.warn(`Histogram bounds limit reached (${this.Yr.maxSeriesPerFlush} distinct histograms); new histograms that pass custom bounds are dropped. Reduce histogram name cardinality.`)),i&&!Lr(i,Ar))return;return Ar}const r=i?i.slice():Ar;return this.Ks.set(n,r),r}Vo(t,e,i,n){Lr(i,null!=n?n:Ar)||this.Ys.has(e)||(this.Ys.add(e),this.R.warn(`Histogram '${t}' already uses the bounds [${i.join(", ")}]; samples that pass different bounds are recorded in those buckets.`))}Uo(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":{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,i.bounds)]+=1;break}}}Ds(t){const e=this.Yr.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.R.info("Metric was rejected in beforeSend function"),null;n=e}catch(t){return this.R.error("Error in beforeSend function for metric:",t),null}return n}Ls(){this.gs.pending||this.gs.arm(this.Ws())}Ws(){return Math.max(Tr(this.Yr.flushIntervalMs,this.xs,this.$s,3e4),this.Ss.remainingMs())}No(){var t=this;return re(function*(){if(t.gs.clear(),0===t.Vs.size)return;const e=t.Vs;t.qo();const i=t.Po,n=yield t._instance.Go(t.Bo(e));if(i===t.Po)switch(t.Ss.record(n),"retry-later"===n.kind?(t.xs++,t.$s=$r()):(t.xs=0,t.$s=1),t.gs.pending&&t.gs.arm(t.Ws()),n.kind){case"ok":return;case"retry-later":return t.Jo(e),void t.gs.armNoEarlierThan(t.Ws());case"too-large":return void t.R.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.R.error("Failed to send metrics batch:",n.error)}})()}Bo(t){return e=this.Qo(t),i=function(t,e,i){return fr(t,e,i)}(this.Yr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:gr(i)},scopeMetrics:[{scope:{name:n,version:s},metrics:e}]}]};var e,i,n,s}Qo(t){const e=Or(Date.now()),i=new Map;for(const o of t.values()){var n;const t=Pr(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=cr(null!==(n=o.attributes)&&void 0!==n?n:{},this.R),u=Or(o.windowStartMs),c=Nr(o.exemplar);if("count"===o.type){var s;const t=ue({attributes:a,startTimeUnixNano:u,timeUnixNano:e,asDouble:null!==(s=o.total)&&void 0!==s?s:0},c);l.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t=ue({attributes:a,timeUnixNano:e,asDouble:null!==(r=o.last)&&void 0!==r?r:0},c);l.gauge.dataPoints.push(t)}else{const t=o.hist,i=ue({attributes:a,startTimeUnixNano:u,timeUnixNano:e,count:t.count,sum:t.sum,min:t.min,max:t.max,bucketCounts:t.bucketCounts,explicitBounds:t.bounds},c);l.histogram.dataPoints.push(i)}}return Array.from(i.values())}Jo(t){for(const[s,r]of t){var e;const t=this.Vs.get(s);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,r.windowStartMs),t.exemplar=null!==(e=t.exemplar)&&void 0!==e?e:r.exemplar,t.type){case"count":var i,n;t.total=(null!==(i=t.total)&&void 0!==i?i:0)+(null!==(n=r.total)&&void 0!==n?n:0);break;case"gauge":break;case"histogram":{const e=t.hist,i=r.hist;e.count+=i.count,e.sum+=i.sum,e.min=Math.min(e.min,i.min),e.max=Math.max(e.max,i.max);for(let t=0;e.bucketCounts.length>t;t++)e.bucketCounts[t]+=i.bucketCounts[t];break}}else this.zo()&&this.Vs.set(s,r)}}};function Lr(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let i=0;t.length>i;i++)if(t[i]!==e[i])return!1;return!0}function Dr(t){return{bounds:t,count:0,sum:0,min:1/0,max:-1/0,bucketCounts:new Array(t.length+1).fill(0)}}function Nr(t){return t?{exemplars:[{filteredAttributes:[],timeUnixNano:Or(t.timeMs),asDouble:t.value,traceId:t.traceId,spanId:t.spanId}]}:{}}function jr(t,e){if(!t)return;const i=t.find(t=>t.type===e);return null==i?void 0:i.value}const qr="0.14.1",Br={DEBUG:!1,LIB_VERSION:qr,LIB_NAME:"browser-common",JS_SDK_VERSION:qr},zr=(t,{debugEnabled:e}={})=>{const i={N(i,...n){let s;try{s=typeof window>"u"?void 0:window}catch(t){return}s&&(Br.DEBUG||s.POSTHOG_DEBUG||e)&&!Ce(s.console)&&s.console&&("__rrweb_original__"in s.console[i]?s.console[i].__rrweb_original__:s.console[i])(t,...n)},debug(...t){i.N("debug",...t)},info(...t){i.N("log",...t)},warn(...t){i.N("warn",...t)},error(...t){i.N("error",...t)},critical(...e){console.error(t,...e)},uninitializedWarning(t){i.error(`You must initialize PostHog before calling ${t}`)},createLogger:(e,i)=>zr(`${t} ${e}`,i)};return i},Ur=zr("[PostHog.js]"),Hr=(t,e)=>Ur.createLogger(t,e);function Wr(t,e){Se(t)&&t.forEach(e)}function Vr(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 Gr=function(t,...e){for(const i of e)for(const e in i)void 0!==i[e]&&(t[e]=i[e]);return t};function Jr(t){const e=Object.keys(t);let i=e.length;const n=new Array(i);for(;i--;)n[i]=[e[i],t[e[i]]];return n}const Qr=function(t){return function(...e){try{return t.apply(this,e)}catch(t){Ur.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ur.critical(t)}}},Zr=function(t){const e={};return Vr(t,function(t,i){(Ee(t)&&t.length>0||Ae(t))&&(e[i]=t)}),e};function Kr(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 Yr=["herokuapp.com","vercel.app","netlify.app"];function Xr(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 Yr)if(i===t)return!1;return!0}function to(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 eo(t){return"ph_toolbar_internal"===t.name}const io=t=>{const e=typeof document>"u"?void 0:document,i=null==e?void 0:e.createElement("a");return Ce(i)?null:(i.href=t,i)},no=()=>{try{return"u">typeof window&&!1!==window.navigator.onLine}catch(t){return!1}},so=(t,e)=>t>=e&&no(),ro=(t,e,i,n)=>{if(0===t){if(no()){const t=e+1;return t===i&&n(),t}return e}return 0},oo=["localhost","127.0.0.1"],lo=(t,e)=>{try{let i;return JSON.stringify(t,(t,e)=>{var n;return qe(e)?(null!==(n=i)&&void 0!==n||(i=new WeakMap),i.has(e)||i.set(e,Kr(e)),i.get(e)):"bigint"==typeof e?e.toString():e},e)}catch(e){return be(t)}},ao=function(t,e="&"){let i,n;const s=[];return Vr(t,function(t,e){Ce(t)||Ce(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)},uo=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].replace(/\+/g," ");try{t=decodeURIComponent(t)}catch(e){Ur.error("Skipping decoding for malformed query param: "+t)}return t}},co=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("?");let s=0;for(;n.length>s&&!e.includes(n[s].split("=")[0]);)s++;u.push(n.length>s?n.slice(0,s).concat(n[s].split("=")[0]+"="+i).join("?"):a[t])}let c=l;return null!=o&&(c+="?"+u.join("&")),null!=s&&(c+="#"+s),c},ho=function(t,e){const i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null};function vo(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 Ur.error("Error in get_current_url, falling back to window.location.href",t),e}}function fo(t){var e;const i=typeof window>"u"?void 0:window,n=null==i||null===(e=i.location)||void 0===e?void 0:e.href;return Ce(n)?void 0:vo(t,n)}function po(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 go(t){return!!t&&1===t.nodeType}function mo(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function yo(t){return!!t&&3===t.nodeType}function bo(t){return!!t&&11===t.nodeType&&go(t.host)}function _o(t){return t?me(t).split(/\s+/):[]}function wo(t,e){const i=fo(e);return!!(i&&t&&t.some(t=>i.match(t)))}function ko(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 _o(e)}function So(t){return Re(t)?null:me(t).split(/(\s+)/).filter(t=>il(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function xo(t){let e="";return Go(t)&&!Jo(t)&&t.childNodes&&t.childNodes.length&&Vr(t.childNodes,function(t){var i;yo(t)&&t.textContent&&(e+=null!==(i=So(t.textContent))&&void 0!==i?i:"")}),me(e)}function $o(t){var e;return Ce(t.target)?t.srcElement||null:(null===(e=t.target)||void 0===e?void 0:e.shadowRoot)?t.composedPath()[0]||null:t.target||null}const To=["a","button","form","input","select","textarea","label"];function Co(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 Eo(t,e){if(Ce(e))return!0;for(const i of t)if(e.some(t=>Co(i,t)))return!0;return!1}function Mo(t){const e=t.parentNode;return!(!e||!go(e))&&e}const Io=[".ph-no-autocapture","[data-ph-no-autocapture]"],Ro=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],Ao=(()=>[...Ro,"+","-","−","–"])(),Oo=(()=>Ao.length+10)(),Po=["button","a","input","select","textarea","label"],Fo=["button","link","tab","menuitem","option"],Lo=(t,e)=>/[a-z0-9]/i.test(e)?ge(Ao,e)?new RegExp(`\\b${e}\\b`).test(t):t.includes(e):t===e,Do=t=>ge(Po,t.tagName.toLowerCase())||ge(Fo,(t.getAttribute("role")||"").toLowerCase());function No(t){let e="",i="";const n=t=>{go(t)&&Go(t)&&!Jo(t)&&(e+=` ${xo(t)}`,i=i||t.getAttribute("aria-label")||"",Vr(t.childNodes,n))};n(t),e=me(e.replace(/\s+/g," "));const s=(il(e)?e:"").toLowerCase(),r=t.getAttribute("aria-label")||(s?"":i);return{safeText:s,ariaLabel:me(r).toLowerCase()}}const jo=[".ph-no-deadclick",".ph-no-capture"],qo=[".ph-no-rageclick",".ph-no-capture"],Bo=["","text","search","email","password","url","tel","number"];function zo(t){return!(!t||!go(t))&&(!!mo(t,"textarea")||(mo(t,"input")?ge(Bo,(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 Uo(t,e){if(!(typeof window>"u"?void 0:window)||Ho(t))return!1;let i,n,s;var r,o;if(Pe(e)?(i=!!e&&qo,n=void 0,s=!1):(i=null!==(r=null==e?void 0:e.css_selector_ignorelist)&&void 0!==r?r:qo,n=null==e?void 0:e.content_ignorelist,s=null!==(o=null==e?void 0:e.ignore_text_selection)&&void 0!==o&&o),!1===i)return!1;if(s&&zo(t))return!1;const{targetElementList:l,isComplete:a}=Wo(t,!1);return!(!a||n&&function(t,{safeText:e,ariaLabel:i}){let n;if(!0===t)n=Ro;else{if(!Se(t))return!1;if(t.length>Oo)return Ur.error(`[PostHog] content_ignorelist array cannot exceed ${Oo} items. Use css_selector_ignorelist for more complex matching.`),!1;n=t.map(t=>t.toLowerCase())}return n.some(t=>Lo(e,t)||Lo(i,t))}(n,function(t,e){for(const t of e)if(Do(t))return No(t);for(const t of e){try{var i;if("pointer"!==(null===(i=window)||void 0===i?void 0:i.getComputedStyle(t).getPropertyValue("cursor")))break}catch(t){break}const e=No(t);if(e.safeText||e.ariaLabel)return e}return No(t)}(t,l))||Eo(l,i))}const Ho=t=>!t||mo(t,"html")||!go(t),Wo=(t,e)=>{const i=typeof window>"u"?void 0:window;if(!i||Ho(t))return{parentIsUsefulElement:!1,targetElementList:[],isComplete:!1};let n=!1;const s=[t];let r=t;const o=new Set([t]);for(;!mo(r,"body");){const t=r.assignedSlot||r.parentNode,l=bo(t)?t.host:t&&go(t)?t:null;if(!l)break;if(o.has(l)||o.size>=1e3)return{parentIsUsefulElement:n,targetElementList:s,isComplete:!1};if(o.add(l),bo(t))s.push(l),r=l;else{if(e||To.indexOf(l.tagName.toLowerCase())>-1)n=!0;else try{const t=i.getComputedStyle(l);t&&"pointer"===t.getPropertyValue("cursor")&&(n=!0)}catch(t){}s.push(l),r=l}}return{parentIsUsefulElement:n,targetElementList:s,isComplete:!0}};function Vo(t){const e=new Set;let i=0,n=t;for(;n;){if(i++>=1e3||e.has(n))return!0;e.add(n);const t=ko(n);if(ge(t,"ph-sensitive")||ge(t,"ph-no-capture"))return!0;const s=n.assignedSlot||n.parentNode;n=bo(s)?s.host:s&&go(s)?s:null}return!1}function Go(t){if(Vo(t))return!1;if(ge(ko(t),"ph-include"))return!0;const e=t.type||"";if(Ee(e))switch(e.toLowerCase()){case"hidden":case"password":return!1}const i=t.name||t.id||"";return!Ee(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,""))}function Jo(t){return!!(mo(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||mo(t,"select")||mo(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const Qo=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}))$"),Zo=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Ko=[16,15,14,13],Yo=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Xo=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),tl=/[0-9A-Za-z_]/;function el(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 il(t,e=!0){if(Re(t))return!1;if(Ee(t)){if(t=me(t),e?Qo.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(Zo.lastIndex=0;e=Zo.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 Ko){const n=t+e;if(i.length>=n){const e=i.slice(t,n);if(Qo.test(e)&&el(e))return!0}}}return!1}(t))return!1;if(e?Yo.test(t):function(t){let e;for(Xo.lastIndex=0;e=Xo.exec(t);){const t=e[1],i=e[3];if(!(t&&i&&tl.test(t)&&tl.test(i)))return!0}return!1}(t))return!1}return!0}function nl(t){let e=xo(t);return e=`${e} ${sl(t)}`.trim(),il(e)?e:""}function sl(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Vr(t.childNodes,function(t){var i;if(t&&"span"===(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=xo(t);e=`${e} ${i}`.trim(),t.childNodes&&t.childNodes.length&&(e=`${e} ${sl(t)}`.trim())}catch(t){Ur.error("[AutoCapture]",t)}}),e}function rl(t){return t.replace(/"|\\"/g,'\\"')}function ol(t){const e=t.attr__class;if(e)return Se(e)?e:_o(e)}const ll=1e6;function al(t){var e;return Math.min(ll,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:ll)}const ul={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:ll,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},cl=["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"],hl=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],dl=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],vl=t=>{Re(t)||Vr(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return cl.includes(e)||dl.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},fl=["/s/","/e/","/i/"];function pl(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 gl(t,e){if(Re(t))return t;let i=t;return il(i,!1)||(i="[SessionRecording] "+e+" body redacted"),Vr(hl,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 ml=new WeakSet,yl="disabled",bl="sampled",_l="active",wl="buffering",kl="paused",Sl="lazy_loading",xl="rrweb_error",$l="trigger_activated",Tl="trigger_pending",Cl="trigger_disabled";function El(t,e,i,n,s,r){return 0===e?Cl:(null==t?void 0:t.get_property(i?n+i:s))===r?$l:Tl}function Ml(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 Il(t){return t.includes("trigger_activated")?$l:t.includes("trigger_pending")?Tl:Cl}function Rl(t){const e=new Set(t);switch(e.delete(Cl),e.size){case 0:return Cl;case 1:return Array.from(e)[0];default:return Tl}}var Al=class{constructor(t){this.j=t}triggerStatus(t){return Il(this.j.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return Il(this.j.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.j.forEach(t=>t.stop())}},Ol=class{constructor(t){this.j=t}triggerStatus(t){return Rl(this.j.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return Rl(this.j.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.j.forEach(t=>t.stop())}},Pl=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return $l}stop(){}};const Fl=t=>"sessionRecording"in t;var Ll=class{constructor(t,e){this._instance=t,this.B=[],this.U=[],this.W=new Map,this.H=new Map,this.G="",this.urlBlocked=!1,this.V=e}onConfig(t){var e,i;this.B=(Fl(t)?$e(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.U=(Fl(t)?$e(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.Z()}Z(){this.W.clear(),this.H.clear();for(const t of this.B)if("regex"===t.matching&&!this.W.has(t.url))try{this.W.set(t.url,new RegExp(t.url))}catch(e){Ur.error("Invalid URL trigger regex pattern:",t.url,e)}for(const t of this.U)if("regex"===t.matching&&!this.H.has(t.url))try{this.H.set(t.url,new RegExp(t.url))}catch(e){Ur.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}J(t){return El(this._instance,this.B.length,this.V,pt,dt,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Vt]:e}),e}triggerStatusNoSideEffects(t){return this.J(t)}isCurrentUrlBlocked(){const t=fo(this._instance);if(!t)return!1;try{return Ml(t,this.U,this.H)}catch(t){return!0}}checkUrlBlocklist(t,e){const i=fo(this._instance);if(!i)return;if(i===this.G)return;this.G=i;const n=this.urlBlocked,s=Ml(i,this.U,this.H);n&&s||(s&&!n?t():!s&&n&&e())}checkUrlTriggerConditions(t,e,i,n){const s=fo(this._instance);if(!s)return;if(s===this.G)return;this.G=s;const r=this.urlBlocked,o=Ml(s,this.U,this.H);o&&!r?t():!o&&r&&e();const l=this.J(n)===$l,a=Ml(s,this.B,this.W);!l&&a&&i("url",s)}stop(){this.G=""}},Dl=class{constructor(t){this._instance=t,this.linkedFlag=null,this.linkedFlagSeen=!1,this.Y=()=>{}}triggerStatus(){const t=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[Bt]:t}),t}triggerStatusNoSideEffects(){let t=Tl;return Re(this.linkedFlag)&&(t=Cl),this.linkedFlagSeen&&(t=$l),t}onConfig(t,e){var i;if(this.linkedFlag=(Fl(t)?$e(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!Re(this.linkedFlag)&&!this.linkedFlagSeen){const t=Ee(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=Ee(this.linkedFlag)?null:this.linkedFlag.variant;this.Y=this._instance.onFeatureFlags((n,s)=>{let r=!1;if($e(s)&&t in s){const e=s[t];r=Pe(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.Y()}},Nl=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(Fl(t)?$e(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}X(t){return El(this._instance,this.K.length,this.V,ft,vt,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[qt]:e}),e}triggerStatusNoSideEffects(t){return this.X(t)}checkEventTriggerConditions(t,e,i){if(0===this.K.length)return;const n=this.X(i)===$l,s=this.K.includes(t);!n&&s&&e("event",t)}stop(){}},jl=class{constructor(t,e,i){if(this._instance=t,this.group=e,this.tt=new Ll(t,e.id),this.et=new Nl(t,e.id),this.nt=new Dl(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.tt.onConfig(n),this.et.onConfig(n),this.nt.onConfig(n,i);const s=[this.et,this.tt,this.nt];this.it="any"===e.conditions.matchType?new Al(s):new Ol(s)}else this.it=new Pl}triggerStatus(t){return this.it.triggerStatus(t)}triggerStatusNoSideEffects(t){return this.it.triggerStatusNoSideEffects(t)}getPendingTriggerConditions(t){return"trigger_pending"!==this.triggerStatusNoSideEffects(t)?[]:[{label:"URL condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.et.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.nt.triggerStatusNoSideEffects()}].filter(({status:t})=>t===Tl).map(({label:t})=>t)}checkEventTriggerConditions(t,e,i){this.et.checkEventTriggerConditions(t,e,i)}checkUrlTriggerConditions(t,e,i,n){this.tt.checkUrlTriggerConditions(t,e,i,n)}activateTrigger(t,e){var i;const n="url"===t?pt+this.group.id:ft+this.group.id;null===(i=this._instance.persistence)||void 0===i||i.register({[n]:e})}stop(){this.tt.stop(),this.et.stop(),this.nt.stop()}};function ql(t){if(t.rrwebError)return xl;if(!t.receivedFlags)return wl;if(!t.isRecordingEnabled)return yl;if(t.urlTriggerMatching.urlBlocked)return kl;const e=!0===t.isSampled,i=new Al([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?bl:"trigger_activated"===i?_l:"trigger_pending"===i?wl:!1===t.isSampled?yl:_l}function Bl(t){if(t.rrwebError)return xl;if(!t.receivedFlags)return wl;if(!t.isRecordingEnabled)return yl;if(t.urlTriggerMatching.urlBlocked)return kl;const e=new Ol([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),i=e!==Cl,n=Pe(t.isSampled);return i&&"trigger_pending"===e?wl:i&&"trigger_disabled"===e||n&&!t.isSampled?yl:!0===t.isSampled?bl:_l}function zl(t){return"ph_replay_pending_buffer_"+JSON.stringify([t.persistence_name||t.token,t.token])}function Ul(){const t=[];return function(e,i){if($e(i)||Se(i)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(i)?"[Circular]":(t.push(i),i)}return i}}function Hl(t){try{const e=JSON.stringify(t,Ul());return e?new Blob([e]).size:0}catch(t){return-1}}function Wl(t){if(Ie(t))return 4;if(Ce(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+=Ce(n)||Ie(n)?4:Wl(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];Ce(s)||(n||(i+=1),n=!1,i+=t.length+3+Wl(s))}return i}default:return 0}}function Vl(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[Vl({size:i.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),Vl({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 Gl=Uint8Array,Jl=Uint16Array,Ql=Uint32Array,Zl=new Gl([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]),Kl=new Gl([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]),Yl=new Gl([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xl=function(t,e){for(var i=new Jl(31),n=0;31>n;++n)i[n]=e+=1<<t[n-1];var s=new Ql(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]},ta=Xl(Zl,2),ea=ta[1];ta[0][28]=258,ea[258]=28;for(var ia=Xl(Kl,0)[1],na=new Jl(32768),sa=0;32768>sa;++sa){var ra=(43690&sa)>>>1|(21845&sa)<<1;na[sa]=((65280&(ra=(61680&(ra=(52428&ra)>>>2|(13107&ra)<<2))>>>4|(3855&ra)<<4))>>>8|(255&ra)<<8)>>>1}var oa=function(t,e,i){for(var n=t.length,s=0,r=new Jl(e);n>s;++s)++r[t[s]-1];var o,l=new Jl(e);for(s=0;e>s;++s)l[s]=l[s-1]+r[s-1]<<1;if(i){o=new Jl(1<<e);var a=15-e;for(s=0;n>s;++s)if(t[s])for(var u=s<<4|t[s],c=e-t[s],h=l[t[s]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[na[h]>>>a]=u}else for(o=new Jl(n),s=0;n>s;++s)o[s]=na[l[t[s]-1]++]>>>15-t[s];return o},la=new Gl(288);for(sa=0;144>sa;++sa)la[sa]=8;for(sa=144;256>sa;++sa)la[sa]=9;for(sa=256;280>sa;++sa)la[sa]=7;for(sa=280;288>sa;++sa)la[sa]=8;var aa=new Gl(32);for(sa=0;32>sa;++sa)aa[sa]=5;var ua=oa(la,9,0),ca=oa(aa,5,0),ha=function(t){return(t/8|0)+(7&t&&1)},da=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var n=new(t instanceof Jl?Jl:t instanceof Ql?Ql:Gl)(i-e);return n.set(t.subarray(e,i)),n},va=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8},fa=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8,t[n+2]|=i>>>16},pa=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 Gl(0),0];if(1==s){var o=new Gl(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,c=1,h=2;for(i[0]={s:-1,f:l.f+a.f,l:l,r:a};c!=s-1;)l=i[i[h].f>i[u].f?u++:h++],a=i[u!=c&&i[h].f>i[u].f?u++:h++],i[c++]={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 Jl(d+1),f=ga(i[c-1],v,0);if(f>e){n=0;var p=0,g=f-e,m=1<<g;for(r.sort(function(t,e){return v[e.s]-v[t.s]||t.f-e.f});s>n;++n){var y=r[n].s;if(e>=v[y])break;p+=m-(1<<f-v[y]),v[y]=e}for(p>>>=g;p>0;){var b=r[n].s;e>v[b]?p-=1<<e-v[b]++-1:++n}for(;n>=0&&p;--n){var _=r[n].s;v[_]==e&&(--v[_],++p)}f=e}return[new Gl(v),f]},ga=function(t,e,i){return-1==t.s?Math.max(ga(t.l,e,i+1),ga(t.r,e,i+1)):e[t.s]=i},ma=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Jl(++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]},ya=function(t,e){for(var i=0,n=0;e.length>n;++n)i+=t[n]*e[n];return i},ba=function(t,e,i){var n=i.length,s=ha(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)},_a=function(t,e,i,n,s,r,o,l,a,u,c){va(e,c++,i),++s[256];for(var h=pa(s,15),d=h[0],v=h[1],f=pa(r,15),p=f[0],g=f[1],m=ma(d),y=m[0],b=m[1],_=ma(p),w=_[0],k=_[1],S=new Jl(19),x=0;y.length>x;++x)S[31&y[x]]++;for(x=0;w.length>x;++x)S[31&w[x]]++;for(var T=pa(S,7),C=T[0],E=T[1],M=19;M>4&&!C[Yl[M-1]];--M);var I,R,A,O,P=u+5<<3,F=ya(s,la)+ya(r,aa)+o,L=ya(s,d)+ya(r,p)+o+14+3*M+ya(S,C)+(2*S[16]+3*S[17]+7*S[18]);if(F>=P&&L>=P)return ba(e,c,t.subarray(a,a+u));if(va(e,c,1+(F>L)),c+=2,F>L){I=oa(d,v,0),R=d,A=oa(p,g,0),O=p;var D=oa(C,E,0);for(va(e,c,b-257),va(e,c+5,k-1),va(e,c+10,M-4),c+=14,x=0;M>x;++x)va(e,c+3*x,C[Yl[x]]);c+=3*M;for(var N=[y,w],j=0;2>j;++j){var q=N[j];for(x=0;q.length>x;++x)va(e,c,D[B=31&q[x]]),c+=C[B],B>15&&(va(e,c,q[x]>>>5&127),c+=q[x]>>>12)}}else I=ua,R=la,A=ca,O=aa;for(x=0;l>x;++x)if(n[x]>255){var B;fa(e,c,I[257+(B=n[x]>>>18&31)]),c+=R[B+257],B>7&&(va(e,c,n[x]>>>23&31),c+=Zl[B]);var z=31&n[x];fa(e,c,A[z]),c+=O[z],z>3&&(fa(e,c,n[x]>>>5&8191),c+=Kl[z])}else fa(e,c,I[n[x]]),c+=R[n[x]];return fa(e,c,I[256]),c+R[256]},wa=new Ql([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ka=new Gl(0),Sa=function(){for(var t=new Ql(256),e=0;256>e;++e){for(var i=e,n=9;--n;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),xa=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function $a(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=Sa[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 Gl(n+o+5*(1+Math.floor(o/7e3))+s),a=l.subarray(n,l.length-s),u=0;if(!e||8>o)for(var c=0;o>=c;c+=65535){var h=c+65535;o>h?u=ba(a,u,t.subarray(c,h)):(a[c]=r,u=ba(a,u,t.subarray(c,o)))}else{for(var d=wa[e-1],v=d>>>13,f=8191&d,p=(1<<i)-1,g=new Jl(32768),m=new Jl(p+1),y=Math.ceil(i/3),b=2*y,_=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<b)&p},w=new Ql(25e3),k=new Jl(288),S=new Jl(32),x=0,T=0,C=(c=0,0),E=0,M=0;o>c;++c){var I=_(c),R=32767&c,A=m[I];if(g[R]=A,m[I]=R,c>=E){var O=o-c;if((x>7e3||C>24576)&&O>423){u=_a(t,a,0,w,k,S,T,C,M,c-M,u),C=x=T=0,M=c;for(var P=0;286>P;++P)k[P]=0;for(P=0;30>P;++P)S[P]=0}var F=2,L=0,D=f,N=R-A&32767;if(O>2&&I==_(c-N))for(var j=Math.min(v,O)-1,q=Math.min(32767,c),B=Math.min(258,O);q>=N&&--D&&R!=A;){if(t[c+F]==t[c+F-N]){for(var z=0;B>z&&t[c+z]==t[c+z-N];++z);if(z>F){if(F=z,L=N,z>j)break;var U=Math.min(N,z-2),H=0;for(P=0;U>P;++P){var W=c-N+P+32768&32767,V=W-g[W]+32768&32767;V>H&&(H=V,A=W)}}}N+=(R=A)-(A=g[R])+32768&32767}if(L){w[C++]=268435456|ea[F]<<18|ia[L];var G=31&ea[F],J=31&ia[L];T+=Zl[G]+Kl[J],++k[257+G],++S[J],E=c+F,++x}else w[C++]=t[c],++k[t[c]]}}u=_a(t,a,r,w,k,S,T,C,M,c-M,u),r||(u=ba(a,u,ka))}return da(l,0,n+ha(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)),c=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&xa(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),xa(u,c-8,i.d()),xa(u,c-4,n),u}function Ta(t,e){var i=t.length;if(!e&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new Gl(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 Gl(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 da(n,0,s)}function Ca(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 Ea=class{constructor(t,e={}){var i,n,s,r;this._rrweb=t,this.rt=e,this.ot={},this.st=Date.now(),this.ut=-1/0,this.ct=()=>{const t=Date.now(),e=t-this.st;e>0?(this.dt=Math.min(this.ht,this.dt+e/1e3*this.ft),this.st=t):this.st=t},this.vt=t=>{if(!this.ot[t]){var e,i;this.ot[t]=!0;const n=this.yt(t);null===(e=(i=this.rt).onBlockedNode)||void 0===e||e.call(i,t,n)}},this.bt=t=>{const e=this.yt(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.yt=t=>this._rrweb.mirror.getNode(t),this.wt=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.wt(e);if(e.attributes){const t=e.attributes.length;e.attributes=e.attributes.filter(t=>{const[e]=this.bt(t.id);return!this.kt.consumeRateLimit(e)&&t});const i=t-e.attributes.length;var n,s;i>0&&(null===(n=(s=this.rt).onDroppedAttributeMutations)||void 0===n||n.call(s,i))}const r=this.wt(e);if(0===r&&i!==r)return;if(this.St)return t;this.ct();const o=Wl(t);var l,a;return o>this.dt?(null===(l=(a=this.rt).onDroppedOversizedMutation)||void 0===l||l.call(a,o),void this._t()):(this.dt-=o,t)},this._t=()=>{if(this.xt)return;const t=Math.max(0,this.Ct-(Date.now()-this.ut));this.xt=setTimeout(()=>{var t,e;this.xt=void 0,this.ut=Date.now(),null===(t=(e=this.rt).requestFullSnapshot)||void 0===t||t.call(e)},t)},this.kt=new Ze({bucketSize:null!==(i=this.rt.bucketSize)&&void 0!==i?i:100,refillRate:null!==(n=this.rt.refillRate)&&void 0!==n?n:10,refillInterval:1e3,I:this.vt,R:Ur}),this.ht=null!==(s=this.rt.bytesBucketSize)&&void 0!==s?s:0,this.ft=null!==(r=this.rt.bytesRefillRate)&&void 0!==r?r:25600,this.St=!Number.isFinite(this.ht)||0>=this.ht,this.dt=this.ht;const o=this.rt.resyncIntervalMs;this.Ct=Ae(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this.ot={},this.xt&&(clearTimeout(this.xt),this.xt=void 0),this.ut=Date.now()}stop(){this.kt.stop(),this.reset(),this.dt=this.ht,this.st=Date.now(),this.ut=-1/0}};const Ma=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}};var Ia=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}},Ra=class{generate(){const t=this.generateOrAbort();if(!Ce(t))return t;{this.Mt=0;const t=this.generateOrAbort();if(Ce(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return Ae(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Mt)this.Mt=t,this.Tt();else{if(this.Mt>=t+1e4)return;this.It++,this.It>4398046511103&&(this.Mt++,this.Tt())}return Ia.fromFieldsV7(this.Mt,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.At.nextUint32())}Tt(){this.It=1024*this.At.nextUint32()+(1023&this.At.nextUint32())}constructor(){this.Mt=0,this.It=0,this.At=new Pa}};const Aa=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};let Oa;var Pa=class{nextUint32(){var t;return this.Rt.length>this.Et||((null!==(t=Oa)&&void 0!==t?t:Oa="u">typeof window&&!Ce(window.crypto)&&crypto.getRandomValues?t=>{try{return crypto.getRandomValues(t)}catch(e){return Aa(t)}}:Aa)(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}};let Fa;const La=()=>Da().toString(),Da=()=>(Fa||(Fa=new Ra)).generate();let Na="";const ja=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let qa=null;const Ba={Ot(){if(!Ie(qa))return qa;if(qa=!1,n)try{const t=`__ph_cookie_support_${La()}`;Ba.$t(t,"xyz"),qa='"xyz"'===Ma(t),Ba.Dt(t)}catch(t){qa=!1}return qa},Ft(t){Ur.error("cookieStore error: "+t)},Lt:Ma,Pt(t){let e;try{e=JSON.parse(Ba.Lt(t))||{}}catch(t){}return e},$t(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(Na)return Na;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_"+La();for(;!Na&&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",Na=t)}return Na}(t);if(!e){const i=(t=>{const e=t.match(ja);return e?e[0]:""})(t);i!==e&&Ur.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&&Ur.warn("cookieStore warning: large cookie, len="+u.length),n.cookie=u,!0}catch(t){return!1}},Dt(t,e){if((null==n?void 0:n.cookie)&&(!e||!Ie(Ma(t))))try{Ba.$t(t,"",-1,e)}catch(t){return}}};let za=null;const Ua={Ot(){if(!Ie(za))return za;let e=!0;if(Ce(t))e=!1;else try{const t="__mplssupport__";Ua.$t(t,"xyz"),'"xyz"'!==Ua.Lt(t)&&(e=!1),Ua.Dt(t)}catch(t){e=!1}return e||Ur.error("localStorage unsupported; falling back to cookie store"),za=e,e},Ft(t){Ur.error("localStorage error: "+t)},Lt(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Ua.Ft(t)}return null},Pt(t){try{return JSON.parse(Ua.Lt(t))||{}}catch(t){}return null},$t(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Ua.Ft(t)}return!1},Dt(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Ua.Ft(t)}}},Ha=[w,v,b,f,x,m,g,p,k],Wa=[N,D,ut,ct,Ot,At,U,Ct],Va=t=>t+"_cpm",Ga=["__proto__","constructor","prototype"],Ja=t=>{if(!$e(t))return{};const e={};return Object.keys(t).forEach(i=>{-1===Ga.indexOf(i)&&(e[i]=t[i])}),e},Qa=(t,e=[])=>{const i={};return[...Wa,...e].forEach(e=>{const n=t[e];Ce(n)||Ie(n)||""===n||(i[e]=n)}),i},Za=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)},Ka=(t,e)=>({p:e,f:Za(JSON.stringify(t))}),Ya=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const i=Ba.Pt(Va(t)),n=(null==i?void 0:i.f)===Za(e)&&Se(i.p);return{properties:n?i.p:[],isValid:n}}catch(t){return{properties:[],isValid:!1}}},Xa=(t,e)=>e+"|"+(Ba.Lt(Va(t))||""),tu={},eu={Ot:()=>!0,Ft(t){Ur.error("memoryStorage error: "+t)},Lt:t=>t in tu?tu[t]:null,Pt:t=>t in tu?tu[t]:null,$t:(t,e)=>(tu[t]=e,!0),Dt(t){delete tu[t]}};let iu=null;const nu={Ot(){if(!Ie(iu))return iu;if(iu=!0,Ce(t))iu=!1;else try{const t="__support__";nu.$t(t,"xyz"),'"xyz"'!==nu.Lt(t)&&(iu=!1),nu.Dt(t)}catch(t){iu=!1}return iu},Ft(t){Ur.error("sessionStorage error: ",t)},Lt(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){nu.Ft(t)}return null},Pt(t){try{return JSON.parse(nu.Lt(t))||null}catch(t){}return null},$t(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){nu.Ft(t)}return!1},Dt(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){nu.Ft(t)}}};Br.DEBUG=!1,Br.LIB_VERSION="1.455.0",Br.LIB_NAME="web";var su=Br,ru=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.Nt=t.get_property.bind(t),this.qt=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.qt(yt,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){const e=this.Nt(yt);return $e(i=e)&&Ee(i.sessionId)&&Ae(i.size)&&e.sessionId===t?e.size:0;var i}};function ou(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<Qe(100*e,0,100,Ur)}function lu(t){return`$survey_response_${t}`}function au(t,e){if(!e)return null;const i=t[lu(e)];return Se(i)?[...i]:i}function uu({event:t,survey:e,responses:i={},submissionId:n,completed:s,surveyLanguage:r,questionSnapshots:o}){return ue(ue(ue(ue({},!Ce(n)&&{$survey_submission_id:n}),"sent"===t?!Ce(s)&&{$survey_completed:s}:{$survey_partially_completed:cu(i)}),r&&{$survey_language:r}),function(t={},e,i){const n={};return e.questions.forEach(e=>{if(Ce(e.originalQuestionIndex))return;const i=0===(s=e.originalQuestionIndex)?"$survey_response":`$survey_response_${s}`;var s;const r=au(t,e.id);Ce(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:au(t,e.id)}})},t),n)}(i,e,o))}function cu(t={}){return Object.values(t).some(t=>!Re(t))}function hu(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 du(t){return"string"==typeof t&&t.trim()?t.trim():null}function vu(t){return t.toLowerCase()}function fu(t,e,i){if(!t||!e)return null;const n=vu(e),s=Object.keys(t).find(t=>vu(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=>vu(t)===s);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${e})`),r}return null}const pu=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function gu(t,e,i){var n;const s=fu(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}`),Ce(e.name)||(r.name=e.name,o=!0),r.appearance){const t=ue({},r.appearance);for(const i of pu){const n=e[i];Ce(n)||(t[i]=n,o=!0)}r.appearance=t}else(function(t){return pu.some(e=>!Ce(t[e]))})(e)&&(o=!0)}const a=t.questions.map(t=>function(t,e,i){var n;const s=fu(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 Ce(r.question)||(o.question=r.question,l=!0),Ce(r.description)||(o.description=r.description,l=!0),Ce(r.buttonText)||(o.buttonText=r.buttonText,l=!0),"link"in o&&!Ce(r.link)&&(o.link=r.link,l=!0),"lowerBoundLabel"in o&&!Ce(r.lowerBoundLabel)&&(o.lowerBoundLabel=r.lowerBoundLabel,l=!0),"upperBoundLabel"in o&&!Ce(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),c=a.some(t=>t.hasChanges);let h=null;return s||(h=(null===(n=a.find(t=>t.matchedKey))||void 0===n?void 0:n.matchedKey)||null),c&&(r.questions=u,o=!0,null==i||i.info(`Applied question-level translations for language: ${e}`)),{survey:r,matchedKey:o?s||h:null}}function mu(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 yu(t){var e;return mu(t)&&!!(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e?void 0:e.repeatedActivation)||"always"===t.schedule}const bu=(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}},_u=t=>t.toLowerCase(),wu={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=>bu(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!bu(e,t))),icontains:(t,e)=>e.map(_u).some(e=>t.map(_u).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(_u).every(e=>t.map(_u).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 ku(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=wu[i.operator];return!!s&&s(i.values.map(String),[String(n)])})}const Su=t=>{const e=[...t];for(let t=e.length-1;t>0;t--){const i=Math.floor(Math.random()*(t+1));[e[t],e[i]]=[e[i],e[t]]}return e};function xu(t,e,i){return lo({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}const $u=new Set(["is_not","not_icontains","not_regex"]);function Tu(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(Ce(s)||Ie(s))return $u.has(r);const o=wu[r];return!!o&&!Ce(t.value)&&!Ie(t.value)&&o(Se(t.value)?t.value.map(String):[String(t.value)],Se(s)?s.map(String):[String(s)])})}const Cu=Hr("[SessionRecording]");function Eu(t,e){return e?t:"x"+t}function Mu(t,e){return t===e||t!=="x"+e&&null}var Iu=class{constructor(t,e,i,n,s,r,o){this._instance=t,this.tt=e,this.et=i,this.nt=n,this.jt=s,this.Bt=r,this.zt=o,this.Ut=null,this.Wt=Bl}onRemoteConfig(t){this.Ut=Ae(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ht=new Al([this.et,this.tt]),this.Wt=ql):(this.Ht=new Ol([this.et,this.tt]),this.Wt=Bl),this._instance.register_for_session({[Ht]:t.triggerMatchType}),this.tt.onConfig(t),this.et.onConfig(t),this.nt.onConfig(t,(t,e)=>{this.jt("linked_flag_matched",{flag:t,variant:e}),this.zt()})}getStatus(t){return this.Wt({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 Ae(i)?i:null}checkUrlTriggers(t,e,i,n){this.tt.checkUrlTriggerConditions(e,i,n,t)}setupEventTriggerListeners(t,e,i){if(0!==this.et.K.length&&Re(this.Gt))return this.Gt=t(t=>{try{this.et.checkEventTriggerConditions(t.event,i,e)}catch(t){Cu.error("Could not activate event trigger",t)}}),this.Gt}makeSamplingDecisions(t){var e;const i=this.Ut;var n,s;if(!Ae(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(ct),o=this._instance.get_property(st),l=Mu(r,t),a=Ae(o)&&o!==i,u=Ce(o)&&r===t,c=a||u||!Pe(l),h=c?ou(t,i):l;c&&(h?this.jt("sampled"):Cu.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:Eu(t,h),$replay_sample_rate:Ie(o)&&r===t?null:i})}ensureSamplingDecision(t){if(!Ae(this.Ut))return;const e=this._instance.get_property(ct);Pe(Mu(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.Ht)||void 0===e?void 0:e.triggerStatus(t))===Tl}getPendingTriggerConditions(t){return[{label:"URL condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.et.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.nt.triggerStatusNoSideEffects()}].filter(({status:t})=>t===Tl).map(({label:t})=>t)}stop(){var t;null===(t=this.Gt)||void 0===t||t.call(this),this.Gt=void 0,this.et.stop(),this.tt.stop(),this.nt.stop()}},Ru=class{constructor(t,e,i,n,s){this._instance=t,this.tt=e,this.jt=i,this.Vt=n,this.zt=s,this.Qt=[],this.Zt=new Map,this.Jt=!1}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Yt(t.triggerGroups),this._instance.register_for_session({[Ht]:"v2_trigger_groups",[Wt]:t.triggerGroups.length}),this.tt.onConfig(t)):Cu.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return xl;if(!t.receivedFlags)return wl;if(!t.isRecordingEnabled)return yl;if(t.urlTriggerMatching.urlBlocked)return kl;const e=t.triggerGroupMatchers,i=t.triggerGroupSamplingResults;if(0===e.length)return yl;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);Ce(e)?Ur.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(s=!0)}else"trigger_pending"===e&&(n=!0)}return s?bl:n?wl:yl}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Qt,triggerGroupSamplingResults:this.Zt,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){let e=null;for(const i of this.Qt)if("trigger_activated"===i.triggerStatus(t)){const t=i.group.minDurationMs;Ae(t)&&(Ie(e)||e>t)&&(e=t)}return e}checkUrlTriggers(t,e,i,n){this.tt.checkUrlBlocklist(e,i);for(const n of this.Qt)n.checkUrlTriggerConditions(e,i,e=>{this.Kt(n,void 0)&&(n.activateTrigger(e,t),this.updateActiveTriggers(t),this.zt(e))},t)}setupEventTriggerListeners(t,e,i){return this.Gt=t(t=>{var i;if(this.Jt)return Cu.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(i=this.Gt)||void 0===i||i.call(this),void(this.Gt=void 0);try{for(const i of this.Qt)i.checkEventTriggerConditions(t.event,n=>{if(!this.Kt(i,t.properties))return;const s=(i.group.conditions.events||[]).filter(e=>e.name===t.event),r=this._instance.get_property(w);s.some(e=>!e.properties||0===e.properties.length||Tu(e.properties,t.properties,r))&&(i.activateTrigger(n,e),this.updateActiveTriggers(e),this.zt(n))},e)}catch(t){Cu.error("Could not activate event trigger for trigger groups",t)}}),this.Gt}makeSamplingDecisions(t){for(const i of this.Qt){var e;const n=i.group,s=n.id,r=n.sampleRate,o=gt+s,l=this._instance.get_property(o);let a=null,u=!1,c=!1,h=!1;if($e(l)){const e=l.sessionId,i=l.sampleRate,n=l.sampled;u="string"==typeof e&&e!==t,c=Ae(i)&&i!==r,a=e===t&&Ae(i)&&i===r&&Pe(n)?n:null}else a=l===t||null,u="string"==typeof l&&l!==t,h=l===t;const d=u||c||h||!Pe(a),v=d?ou(t+s,r):a;d&&this.Vt("triggerGroupSamplingDecisionMade",{group_id:s,group_name:n.name,sampleRate:r,isSampled:v}),this.Zt.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.Jt=!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.Qt){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.Qt){const n=i.group,s=n.id,r="trigger_activated"===i.triggerStatus(t),o=!0===this.Zt.get(s);r&&e.push({id:s,name:n.name,matched:!0,sampled:o})}this._instance.register_for_session({[zt]:e})}hasPendingTriggers(t){for(const e of this.Qt)if("trigger_pending"===e.triggerStatus(t))return!0;return!1}getPendingTriggerConditions(t){return this.Qt.flatMap(e=>"trigger_pending"!==e.triggerStatusNoSideEffects(t)?[]:e.getPendingTriggerConditions(t).map(t=>`trigger group "${e.group.name}": ${t}`))}stop(){var t;null===(t=this.Gt)||void 0===t||t.call(this),this.Gt=void 0,this.Qt.forEach(t=>t.stop()),this.Qt=[],this.Zt.clear(),this.tt.stop()}Kt(t,e){const i=t.group.conditions.properties;return!i||0===i.length||Tu(i,e,this._instance.get_property(w))}Yt(t){this.Qt.forEach(t=>t.stop()),this.Qt=[],this.Zt.clear();for(const e of t){const t=new jl(this._instance,e,(t,i)=>{this.jt("linked_flag_matched",{flag:t,variant:i,group_id:e.id,group_name:e.name}),this.zt()});this.Qt.push(t)}}};function Au(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}const Ou=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],Pu=["ScCid","SsCid"],Fu={sccid:Pu},Lu=(()=>[...Ou,...Pu,"sscid"])(),Du=(()=>["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ou])(),Nu="<masked>",ju=["li_fat_id"];function qu(t,e,i){if(!n)return{};const s=e?[...Lu,...i||[]]:[],r=Bu(co(n.URL,s,Nu),t),o=function(){const t={};return Vr(ju,function(e){const i=Ma(e);t[e]=i||null}),t}();return Gr(o,r)}function Bu(t,e){const i=Du.concat(e||[]),n={};return Vr(i,function(e){let i=uo(t,e);!i&&we.call(Fu,e)&&Wr(Fu[e],function(e){i=i||uo(t,e)}),n[e]=i||null}),n}function zu(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(!Ie(e)){s.$search_engine=e;const t=n?uo(n.referrer,i):"";t.length&&(s.ph_keyword=t)}return s}function Uu(){return navigator.language||navigator.userLanguage}function Hu(){const t=Uu();return"string"==typeof t?t.split("-")[0]:void 0}const Wu="$direct";function Vu(){return(null==n?void 0:n.referrer)||Wu}function Gu(t,e,i=!1){const n=t?[...Lu,...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:Vu().substring(0,1e3),u:o?co(o,n,Nu):void 0}}function Ju(t,e=!1,i,n){var s;const{r:r,u:o}=t,l=e?un(o):o,a=l&&i?co(l,[...Lu,...n||[]],Nu):l,u={$referrer:r,$referring_domain:null==r?void 0:r==Wu?Wu:null===(s=io(r))||void 0===s?void 0:s.host};if(a){u.$current_url=a;const t=io(a);u.$host=null==t?void 0:t.host,u.$pathname=null==t?void 0:t.pathname,Gr(u,Bu(a))}if(r){const t=zu(r);Gr(u,t)}return u}function Qu(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const Zu=1e5,Ku=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Yu=[],Xu=()=>!1,tc="@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(" "),ec="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),ic="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(" "),nc="Accommodation AdministrativeArea Country Place State".split(" "),sc={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:ec,publisher:ic},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Yu},Offer:{seller:ic},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:ic,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:ic,areaServed:nc,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Yu}},rc=[["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(" "),sc.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),sc.Event],[ic,sc.Organization],[nc,sc.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),sc.Product]];function oc(t,e){return we.call(t,e)?t[e]:void 0}function lc(t){const e=typeof t;return Ie(t)||"string"===e||"number"===e||"boolean"===e}function ac(t,e){return e&&function(t){return Ee(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function uc(t,e){return Se(t)&&t.every(lc)?t.map(t=>ac(t,e)).filter(t=>!Ce(t)):lc(t)?ac(t,e):void 0}function cc(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 hc(t){if(we.call(sc,t))return sc[t];for(const[e,i]of rc)if(e.includes(t))return i}function dc(t,e,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0})}function vc(t,e,i,n){if(Se(t)){const s=t.map(t=>vc(t,e,i,n)).filter(t=>!Ce(t));return s.length?s:void 0}return fc(t,e,i,n)||void 0}function fc(t,e,i,n){if(!$e(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(i))return null;const s=oc(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&&Ku.test(i)&&!e.has(i)&&(e.add(i),n.push(i),20===n.length))break}return n}(s),o=r.filter(t=>!!hc(t)&&(!n||!n.length||n.includes(t))),l={};for(const n of tc){const o="@type"===n?r.length?"string"==typeof s?r[0]:r:void 0:"@id"===n?cc(oc(t,n),e):uc(oc(t,n),i.maskUrl);Ce(o)||dc(l,n,o)}for(const n of o){const s=hc(n);for(const n of Object.keys(s)){const r=oc(t,n),o=s[n];if(!0===o){const t=uc(r,i.maskUrl);Ce(t)||dc(l,n,t)}else{const t=vc(r,e,i,o);Ce(t)||dc(l,n,t)}}}const a=vc(oc(t,"@graph"),e,i);return Ce(a)||dc(l,"@graph",a),Object.keys(l).length?l:null}function pc(t,e,i){if(!$e(t))return null;const n=oc(t,"@context");if("string"!=typeof n||!/^https?:\/\/schema\.org\/?$/.test(n))return null;const s=fc(t,e,i);return s?ue({"@context":"https://schema.org"},s):null}function gc(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function mc(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 yc(t,e,i){for(let n=t;n;){if(mc(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 bc(t){return gc(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(gc)}const _c=3e5;function wc(t){return $e(t)?t.network_timing:t}const kc=/^please (take full snapshot|add custom event) after start recording$/,Sc=Hr("[SessionRecording]"),xc=[1,2,3,4,5,6,7,12],$c=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function Tc(){var t;return null==h||null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function Cc(){var t;return null===(t=Tc())||void 0===t?void 0:t.record}function Ec(t){try{return JSON.stringify(t)}catch(e){if(e instanceof RangeError)throw e;return JSON.stringify(t,Ul())}}function Mc(t){return Ca($a(Ta(Ec(t))),!0)}function Ic(t){return Rc.apply(this,arguments)}function Rc(){return(Rc=re(function*(t){const e=yield bs(Ec(t),su.DEBUG,{rethrow:!0});return Ca(new Uint8Array(yield e.arrayBuffer()),!0)})).apply(this,arguments)}let Ac,Oc;const Pc="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let Fc=!1;function Lc(t){var e;return Se(t)&&0===t.length?(Ac=null!==(e=Ac)&&void 0!==e?e:Mc([]),Ac):Mc(t)}function Dc(t){return Nc.apply(this,arguments)}function Nc(){return(Nc=re(function*(t){var e;return Se(t)&&0===t.length?Ac||(Oc=null!==(e=Oc)&&void 0!==e?e:Ic([]).then(t=>(Ac=t,t)).catch(t=>{throw Ac=void 0,Oc=void 0,t}),Oc):Ic(t)})).apply(this,arguments)}function jc(t){return Pc&&!Fc&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function qc(t){return{event:t,size:Wl(t)}}function Bc(t,e){return ue(ue({},t),{},{data:e,cv:"2024-10"})}function zc(t,e){return ue(ue({},t),{},{cv:"2024-10",data:ue(ue({},t.data),e)})}function Uc(t){try{if(2===t.type)return qc(Bc(t,Mc(t.data)));if(3===t.type&&0===t.data.source)return qc(zc(t,{texts:Lc(t.data.texts),attributes:Lc(t.data.attributes),removes:Lc(t.data.removes),adds:Lc(t.data.adds)}));if(3===t.type&&8===t.data.source)return qc(zc(t,{adds:t.data.adds?Mc(t.data.adds):void 0,removes:t.data.removes?Mc(t.data.removes):void 0}))}catch(t){Sc.warn("could not compress event - will use uncompressed event",t)}return{event:t,size:Hl(t)}}function Hc(){return Hc=re(function*(t){try{if(2===t.type)return qc(Bc(t,yield Ic(t.data)));if(3===t.type&&0===t.data.source){const[e,i,n,s]=yield Promise.all([Dc(t.data.texts),Dc(t.data.attributes),Dc(t.data.removes),Dc(t.data.adds)]);return qc(zc(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?Ic(t.data.adds):void 0,t.data.removes?Ic(t.data.removes):void 0]);return qc(zc(t,{adds:e,removes:i}))}}catch(e){return vs(e)&&(Fc=!0),Sc.warn("could not compress event asynchronously - trying synchronous compression",e),Uc(t)}return{event:t,size:Hl(t)}}),Hc.apply(this,arguments)}function Wc(t,e){return 5===t.type&&t.data.tag===e}function Vc(t){return Wc(t,"sessionIdle")}function Gc(t){return Wc(t,"$session_ending")}function Jc(t){return Wc(t,"$session_starting")}var Qc=class{get sessionId(){return this.Xt}get te(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get ee(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get ne(){return Mu(this._instance.get_property(ct),this.sessionId)}get Ut(){var t;const e=null===(t=this.ie)||void 0===t?void 0:t.sampleRate;return Ae(e)?e:null}get re(){var t,e;return null!==(t=null===(e=this.oe)||void 0===e?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t,e){this._instance=t,this.supportsSelectMasking=!0,this.se="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.ae=void 0,this.le=void 0,this.ue=!1,this.ce=Date.now(),this.de=!1,this.he=[],this.fe="unknown",this.ve=0,this.pe=0,this.me=0,this.ge=0,this.ye=0,this.be=!1,this.we=!1,this.ke=!1,this.Se=!1,this._e=!1,this.xe=!1,this.Ce=0,this.Me=void 0,this.Te=void 0,this.Ie=0,this.Ae=void 0,this.Re=void 0,this.Ee=0,this.Oe=!1,this.$e=!1,this.Le=!1,this.De=!1,this.Fe=!1,this.Pe=!1,this.Ne=!1,this.qe=void 0,this.je=void 0,this.Be=!1,this.ze=[],this.Ue=0,this.We=0,this.He=!1,this.Ge=void 0,this.Gt=void 0,this.Ve=void 0,this.Qe=void 0,this.Ze=void 0,this.Je=(t,e,i)=>{var n,s,r,o;if(!i)return;if(t===this.Xt&&e===this.Ye)return;const l=!i.noSessionId&&(i.activityTimeout||i.sessionPastMaximumLength),a=this.Xt,u=this.Ye;var c;if(l&&this.Vt("$session_ending",{currentSessionId:a,currentWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.ce,flushed_size:null===(c=this.Ke)||void 0===c?void 0:c.currentTrackedSize(a)}),null===(n=this._instance.persistence)||void 0===n||n.unregister("$debug_first_full_snapshot_timestamp"),null===(s=Tc())||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.Xe(),!(!1===this.fe&&this.isStarted||this.Xt===t&&this.Ye===e)){const e=this.Xt!==t&&!1!==this.fe;this.fe="unknown",this.tn(e)}l&&this.Vt("$session_starting",{previousSessionId:a,previousWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.ce}),null===(o=this.oe)||void 0===o||o.makeSamplingDecisions(t)},this.en=!1,this.nn=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[ht])===this.Xt},this.rn=()=>{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 Ae(i)&&Ae(n)?n-i:null},this.sn=()=>{var t,e;const i=this.re;if(!Ae(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.an;return Ae(t)&&t>=0&&i>t}if(this.nn())return!1;const n=this.rn();return!!Ie(n)||i>n||(null===(s=this._instance.persistence)||void 0===s||s.register({$session_past_minimum_duration:this.Xt}),!1);var s},this.ln=()=>{"buffering"!==this.status?(this.be&&this.we&&this.un&&(this.cn(void 0),this.ke&&(this.ke=!1,this.Bt())),this.dn(),this.hn(!0)):this.fn()},this.vn=()=>{this.ln()},this.pn=()=>{this.Vt("browser offline",{})},this.mn=()=>{this.Vt("browser online",{})},this.gn=()=>{(null==n?void 0:n.visibilityState)&&("visible"===n.visibilityState&&(this.un=!0),this.Vt("window "+n.visibilityState,{}))},this.un=null==e||e;const{sessionId:i,windowId:s,sessionStartTimestamp:r}=this.te.checkAndGetSessionAndWindowId();this.Xt=i,this.Ye=s,this._sessionStartTimestamp=r,this.nt=new Dl(this._instance),this.tt=new Ll(this._instance),this.et=new Nl(this._instance),this.Rt=this.fn(),this.yn=zl(this._instance.config),this.te.sessionTimeoutMs>this.ee||Sc.warn(`session_idle_threshold_ms (${this.ee}) is greater than the session timeout (${this.te.sessionTimeoutMs}). Session will never be detected as idle`),this.Ke=new ru(this._instance)}setDocumentWasEverVisible(t){t&&(this.un=!0)}get bn(){var t,e,i,n,s,r,o,l,a;const u=null===(t=this.ie)||void 0===t?void 0:t.masking,c={maskAllInputs:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.maskAllInputs,maskTextSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.maskTextSelector,blockSelector:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.blockSelector,maskAllElementAttributes:null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.maskAllElementAttributes},h=null!==(r=null==c?void 0:c.maskAllInputs)&&void 0!==r?r:null==u?void 0:u.maskAllInputs,d=null!==(o=null==c?void 0:c.maskTextSelector)&&void 0!==o?o:null==u?void 0:u.maskTextSelector,v=null!==(l=null==c?void 0:c.blockSelector)&&void 0!==l?l:null==u?void 0:u.blockSelector,f=null!==(a=null==c?void 0:c.maskAllElementAttributes)&&void 0!==a?a:null==u?void 0:u.maskAllElementAttributes;return Ce(h)&&Ce(d)&&Ce(v)&&Ce(f)?void 0:{maskAllInputs:null==h||h,maskTextSelector:d,blockSelector:v,maskAllElementAttributes:f}}wn(){var t;if(this.Le)return;const e=null===(t=this.ie)||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!Ce(n)&&n!==s});0!==n.length&&(this.Le=!0,Sc.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 kn(){var t;return Qe(null===(t=this._instance.config.session_recording.canvasCapture)||void 0===t?void 0:t.resolutionScale,.1,1,Hr("canvas recording resolution scale"),1)}get Sn(){var t,e,i,n,s,r,o;const l=this._instance.config.session_recording.captureCanvas,a=null===(t=this.ie)||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,c=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 h=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 h){const t=parseFloat(h);h=isNaN(t)?.4:t}return{enabled:u,fps:Qe(c,0,12,Hr("canvas recording fps"),4),quality:Qe(h,0,1,Hr("canvas recording quality"),.4)}}get _n(){var t;const e=!!(null===(t=this.ie)||void 0===t?void 0:t.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return null!=i?i:e}get xn(){var t,e,i;const n=null===(t=this.ie)||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=!1!==s.recordHeaders&&(s.recordHeaders||(null==n?void 0:n.recordHeaders)),o=!1!==s.recordBody&&(s.recordBody||(null==n?void 0:n.recordBody)),l=wc(this._instance.config.capture_performance),a=wc(null==n?void 0:n.capturePerformance),u=!!(Pe(l)?l:a);return r||o||u?{recordHeaders:r,recordBody:o,recordPerformance:u}:void 0}Cn(){var t,e;const i=[],n=null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;n&&this._n&&i.push(n());const r=null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordNetworkPlugin;if(this.xn&&xe(r))if(!oo.includes(s.hostname)||this._forceAllowLocalhostNetworkCapture){const t=xe(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(r(ue(ue({},((t,e,i)=>{const n={payloadSizeLimitBytes:ul.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...ul.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...ul.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=al(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=pl(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=pl(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=io(t.name);let r=0===e.indexOf("http")?null===(n=io(e))||void 0===n?void 0:n.pathname:e;"/"===r&&(r="");const o=null==s?void 0:s.pathname.replace(r||"","");return s&&o&&fl.some(t=>0===o.indexOf(t))?void 0:t})((vl((n=e).requestHeaders),vl(n.responseHeaders),n),t.api_host,i));var n},u=xe(t.session_recording.maskNetworkRequestFn);return u&&xe(t.session_recording.maskCapturedNetworkRequestFn)?Ur.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});if(i||!e.isInitial)return 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?(ml.add(r),r):null!=o?o:void 0}:t=>function(t){if(!Ce(t))return t.requestBody=gl(t.requestBody,"Request"),t.responseBody=gl(t.responseBody,"Response"),t}(a(t)),ue(ue(ue({},ul),n),{},{recordHeaders:s,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.xn,t)),{},{captureFetchSynchronously:!0===this._instance.config.__preview_replay_sync_fetch,returnFetchResponseEarly:!0===this._instance.config.__preview_replay_early_fetch_response})))}else Sc.info("NetworkCapture not started because we are on localhost.");return i}Mn(t){return this._instance.config.disable_capture_url_hashes?un(t):t}Tn(t,e=!1){const i=e?un(t):this.Mn(t),n=this._instance.config.mask_personal_data_properties?[...Lu,...this._instance.config.custom_personal_data_properties||[]]:[];return this.In(co(i,n,Nu))}In(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}An(t){try{return t.rrwebMethod(),!0}catch(s){var e,i,n;this.Ce+=1;const r=String(null!==(e=null==s?void 0:s.message)&&void 0!==e?e:s);return this.Me=kc.test(r)?r:"other",this.Te=null===(i=Cc())||void 0===i||null===(n=i.isRecording)||void 0===n?void 0:n.call(i),10>this.he.length?this.he.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):Sc.warn("could not emit queued rrweb event.",s,t),!1}}Vt(t,e){return this.An($c(()=>Cc().addCustomEvent(t,e)))}Rn(){var t;return this.ue&&!0===(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)&&!this.tt.urlBlocked&&!0!==this.fe}En(t){if(!this.Rn())return!1;try{const e=Cc();return!!e&&(e.addCustomEvent("$json_ld",t),this.Rn())}catch(t){return!1}}On(t=!1){Promise.resolve().then(()=>{var e;return null===(e=this.$n)||void 0===e?void 0:e.scan(t)})}Ln(){try{if(this._instance.config.capture_pageview||!t)return;const e=new URL(t.location.href),i=this.Tn(e.origin+e.pathname+e.search);this.Dn!==i&&(this.Dn=i,this.Vt("$url_changed",{href:i}))}catch(t){}}Fn(){if(this.he.length){const t=[...this.he];this.he=[],t.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this.An(t)})}}Bt(){const t=this.An($c(()=>Cc().takeFullSnapshot())),e=this.ae;return!t&&e&&setTimeout(()=>this.Pn(e),0),t}Pn(t){var e,i;const s=Date.now();if(this.ae!==t||this.Ae||Ce(this.qe)||this.Nn||!["interactive","complete"].includes(null!==(e=null==n?void 0:n.readyState)&&void 0!==e?e:"")||!Ce(this.Re)&&_c>s-this.Re)return;this.Re=s,this.Ee+=1,Sc.warn("rrweb stopped recording while replay was started, restarting it");const r=()=>{this.ae=void 0;const e={stopRequested:!1,startRequested:!1};this.Ae=e;try{this.qn(t)}finally{this.Ae=void 0}this.he=[],e.stopRequested&&!e.startRequested||this._instance.config.disable_session_recording||this._instance.has_opted_out_capturing()||this.jn()},o=null===(i=Cc())||void 0===i?void 0:i.withStyleRuleSourceHandoff;this.Oe=!0;try{o?o(t,r):r()}finally{this.Oe=!1}this.isStarted&&this.Vt("$replay_recorder_restarted",{reason:"rrweb_not_recording"})}get Bn(){var t,e,i;if((null===(t=this.oe)||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 Ae(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:_c}zn(){if(this.Un&&clearInterval(this.Un),!0===this.fe)return;const t=this.Bn;t&&(this.Un=setInterval(()=>{this.Bt()},t))}zt(t){"event"===t&&this.Wn(),!this.tt.urlBlocked&&["sampled","active"].includes(this.status)&&this.zn()}Hn(){var t;this.tt.urlBlocked||(this.tt.urlBlocked=!0,null===(t=this.$n)||void 0===t||t.scan(),clearInterval(this.Un),Sc.info("recording paused due to URL blocker"),this.Vt("recording paused",{reason:"url blocker"}))}Gn(){var t;this.tt.urlBlocked&&(null===(t=this.$n)||void 0===t||t.scan(),this.tt.urlBlocked=!1,this.Bt(),this.On(),this.zn(),this.Vt("recording resumed",{reason:"left blocked url"}),Sc.info("recording resumed"))}Vn(t,e){var i;if("event"===t&&this.Wn(),!this.de&&(null===(i=this.oe)||void 0===i?void 0:i.hasPendingTriggers(this.sessionId))){this.de=!0;try{var n,s;const i="url"===t?dt:vt;null===(n=this._instance.persistence)||void 0===n||n.register({[i]:this.sessionId}),null===(s=this.oe)||void 0===s||s.updateActiveTriggers(this.sessionId),this.zt(),this.hn(),this.jt(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.de=!1}}}get isStarted(){return!!this.ae}get ie(){const t=this._instance.get_property(it);if(!t)return;let e;try{e=$e(t)?t:JSON.parse(t)}catch(t){return void Sc.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.en&&!this.Oe){var i;const n=null!==(i=e.cache_timestamp)&&void 0!==i?i:Date.now();if(Date.now()-n>36e5)return void Sc.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t})}return e}Qn(t,e,i){this._instance.get_property(t)&&(e(),i())}start(e){var i,s;const r=this.ie;if(!r)return void Sc.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const t=!1!==this.fe&&!this.Se;this.cn(t?"no_interaction_since_recording_started":void 0),this.Se=!1,this.we=t,this.ke=!1}this.He&&(this.Zn(),this.fn());const{sessionId:o,windowId:l,sessionStartTimestamp:a}=this.te.checkAndGetSessionAndWindowId();this.Xt=o,this.Ye=l,this._sessionStartTimestamp=a,this.Jn(),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),(null==r?void 0:r.endpoint)&&(this.se=null==r?void 0:r.endpoint),this.oe=2===(null==r?void 0:r.version)&&(null==r?void 0:r.triggerGroups)&&r.triggerGroups.length>0?new Ru(this._instance,this.tt,this.jt.bind(this),this.Vt.bind(this),this.zt.bind(this)):new Iu(this._instance,this.tt,this.et,this.nt,this.jt.bind(this),this.Bt.bind(this),this.zt.bind(this)),this.oe.onRemoteConfig(r),null===(s=this.Gt)||void 0===s||s.call(this),this.Gt=this.oe.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(t,e)=>this.Vn(t,e)),this.Qn(rt,()=>{this.overrideSampling()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(rt)}),this.Qn(ot,()=>{this.overrideLinkedFlag()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(ot)}),this.Qn(at,()=>{this.overrideTrigger("event")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(at)}),this.Qn(lt,()=>{this.overrideTrigger("url")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(lt)}),this.oe.makeSamplingDecisions(this.sessionId),this.jn(),!this._e&&this.isStarted&&(to(t,"beforeunload",this.ln),to(t,"pagehide",this.vn),to(t,"offline",this.pn),to(t,"online",this.mn),to(n,"visibilitychange",this.gn),!this.Ve&&xe(this.te.onSessionId)&&(this.Ve=this.te.onSessionId(this.Je)),!this.Qe&&xe(this.te.on)?this.Qe=this.te.on("forcedIdleReset",()=>{this.Xe(),this.fe="unknown",this.stop(),this.Ze=this.te.onSessionId((t,e,i)=>{var n;null===(n=this.Ze)||void 0===n||n.call(this),this.Ze=void 0,this.Je(t,e,i)})}):xe(this.te.on)||Sc.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Re(this.Ge)&&(this.Ge=this._instance.on("eventCaptured",t=>{try{if("$pageview"===t.event){const e=(null==t?void 0:t.properties.$current_url)?this.Tn(t.properties.$current_url):"";if(!e)return;this.Vt("$pageview",{href:e})}}catch(t){Sc.error("Could not add $pageview to rrweb session",t)}})),"active"===this.status&&this.jt(e||"recording_initialized"))}Yn(e=!1){var i,s,r,o,l,a;null==t||t.removeEventListener("beforeunload",this.ln),null==t||t.removeEventListener("pagehide",this.vn),null==t||t.removeEventListener("offline",this.pn),null==t||t.removeEventListener("online",this.mn),null==n||n.removeEventListener("visibilitychange",this.gn),clearInterval(this.Un),this.Kn(),null===(i=this.Ge)||void 0===i||i.call(this),this.Ge=void 0,null===(s=this.Gt)||void 0===s||s.call(this),this.Gt=void 0,null===(r=this.Ve)||void 0===r||r.call(this),this.Ve=void 0,null===(o=this.Qe)||void 0===o||o.call(this),this.Qe=void 0,null===(l=this.Ze)||void 0===l||l.call(this),this.Ze=void 0,null===(a=this.oe)||void 0===a||a.stop(),this.Xn(e),this.Zn()}Zn(){this.We+=1,this.ze=[],this.Ue=0,this.ti=void 0,this.He=!1}Xn(t=!1){var e,i,n;t||null===(n=this.le)||void 0===n||n.cancel(),null===(e=this.ei)||void 0===e||e.stop(),this.he=[],null===(i=this.$n)||void 0===i||i.stop(),this.$n=void 0,this.ue=!1,this.Ae&&(this.Ae.stopRequested=!0,this.Ae.startRequested=!1),this.ae&&this.qn(this.ae),this.ae=void 0}qn(t){this.Ie-=1;try{t()}catch(t){Sc.warn("could not stop rrweb",t)}}ni(){if(!this.ti||0===this.Ue)return!1;if(this.He)return!0;this.He=!0,this.ii=void 0;const t=this.We;return this.Kn(),this.Xn(),this.ti.catch(()=>{}).then(()=>{t===this.We&&(this.He=!1,this.hn(),this.fn(),this.ri(),this.Yn(),Sc.info("stopped"))}).catch(()=>{this.He=!1,this.ri(),this.Yn(),Sc.info("stopped")}),!0}stop(t=!1){if(this.Xn(t),this.en)this.dn();else if(this.ni())return;this.hn(),this.fn(),this.ri(),this.Yn(t),Sc.info("stopped")}ri(){this.cn(void 0,{preserveLogDedup:this.en}),this.we=!1}flushBeforeIdentityReset(){(this.isStarted||this.He)&&(this.dn(),this.hn())}tn(t){const e=this.le,i=this.en;let n;this.en=!0,this.ce=Date.now();const s={cancelled:!1,cancel(){s.cancelled=!0,null==e||e.cancel(),null==n||n()}};this.le=s;const r=()=>{var t,e;this.stop(!0),s.cancelled||this._instance.config.disable_session_recording||this._instance.has_opted_out_capturing()?s.cancel():(this.oi=void 0,this.ye=0,this.pe=0,this.me=0,this.ge=0,this.Ce=0,this.Me=void 0,this.Te=void 0,null===(t=Tc())||void 0===t||null===(e=t.resetSnapshotCostState)||void 0===e||e.call(t),this.start("session_id_changed"),(s.cancelled&&!this.isStarted||this._instance.config.disable_session_recording||this._instance.has_opted_out_capturing())&&(s.cancel(),this.discard({discardProducerEvents:!0})))};try{var o;const t=null===(o=Cc())||void 0===o?void 0:o.withStyleRuleSourceHandoff;t&&this.ae?t(this.ae,t=>{n=t,r()}):r()}finally{this.le=e,this.en=i}s.cancelled||(this.cn(t?"no_interaction_since_session_rotated":void 0),this.we=!1)}cn(t,{preserveLogDedup:e=!1}={}){if(this.be=!Ce(t),this.ii=t,Ce(t))return void(e||(this.si=void 0));if(this.en)return;const i=`${this.sessionId}:${t}`;i!==this.si&&(this.si=i,Sc.info(`holding buffer: ${t}. nothing is uploaded until the user interacts with the page`))}Wn(){this.isStarted||(this.Se=!0),this.be&&(this.cn(void 0),this.we=!1,this.ke&&(this.ke=!1,this.Bt()),this.ai())}discard({discardProducerEvents:t=!1}={}){t&&(this.li||this._instance.config.session_recording.selectMaskingFn)&&nu.Dt(this.yn),this.be=!0,t&&(this.fn(),this.Xn()),this.fn(),this.Yn(),this.fn(),this.ri(),Sc.info("discarded")}ui(t,e,i,n,s){if(-1===i)return this.ye+=1,void Sc.warn("could not stringify event - dropping it to keep the rest of the recording");const r={$snapshot_bytes:i,$snapshot_data:e,$session_id:n,$window_id:s};"disabled"!==this.status?(this.ci(t,n),this.di(r)):this.fn()}hi(){try{this.fi()}catch(t){this.$e||(this.$e=!0,Sc.error("could not track full snapshot cost",t))}}fi(){var t,e;const i=null===(t=Tc())||void 0===t||null===(e=t.getLastSnapshotCost)||void 0===e?void 0:e.call(t);i&&i!==this.oi&&(this.oi=i,500>i.durationMs||Sc.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}))}ci(t,e){2!==t.type?3===t.type&&(Ce(this.qe)||this.qe===e||this.je===e||(this.je=e,Sc.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.Bt())):this.qe=e}pi(t){t.counted&&t.generation===this.We&&(this.Ue=Math.max(0,this.Ue-1)),t.counted=!1,this.ze=this.ze.filter(e=>e!==t)}mi(t,e,i){t.processed||t.generation!==this.We||(t.processed=!0,this.ui(t.event,e,i,t.targetSessionId,t.targetWindowId))}gi(t){try{let e,i=t.event;if(t.compressionEnabled)try{({event:i,size:e}=Uc(t.event))}catch(t){Sc.warn("could not process queued compression event - will use uncompressed event",t)}Ce(e)&&(e=Hl(t.event));try{this.mi(t,i,e)}catch(t){Sc.warn("could not capture queued compression event",t)}}finally{this.pi(t)}}dn(){[...this.ze].forEach(t=>{try{this.gi(t)}catch(t){Sc.warn("could not drain queued compression event",t)}})}yi(t,e,i,n){var s=this;const r={event:t,compressionEnabled:e,targetSessionId:i,targetWindowId:n,generation:this.We,processed:!1,counted:!0};this.ze.push(r),this.Ue+=1;const o=(l=re(function*(){try{if(r.processed)return;let i,n;try{const s=e?jc(t)?yield function(t){return Hc.apply(this,arguments)}(t):Uc(t):{event:t,size:Hl(t)};i=s.event,n=s.size}catch(e){Sc.warn("could not process queued compression event - will use uncompressed event",e),i=t,n=Hl(t)}s.mi(r,i,n)}finally{s.pi(r)}}),function(){return l.apply(this,arguments)});var l;this.ti=this.ti?this.ti.catch(()=>{}).then(o):o()}onRRwebEmit(e,i){var n,s,r,o,l,a,u,c,h,d,v;if(!this._instance.sessionManager)return;if(this.Fn(),!e||!$e(e))return;if(4===e.type){const t=this.Tn(e.data.href);if(this.Dn=t,!t)return;e.data.href=t}else this.Ln();if(null===(n=this.oe)||void 0===n||n.checkUrlTriggers(this.sessionId,()=>this.Hn(),()=>this.Gn(),(t,e)=>this.Vn(t,e)),this.tt.urlBlocked&&!function(t){return 5===t.type&&"recording paused"===t.data.tag}(e))return;2===e.type&&(this.hi(),Promise.resolve().then(()=>this.hi()),this.zn(),null===(d=this.ei)||void 0===d||d.reset(),null===(v=this._instance.persistence)||void 0===v||v.register_once({$debug_first_full_snapshot_timestamp:e.timestamp},void 0));const f=2===e.type&&(null===(s=this.oe)||void 0===s?void 0:s.hasPendingTriggers(this.sessionId));f&&this.bi();const p=this.ei?this.ei.throttleMutations(e):e;if(!p)return void(!0===this.fe&&this.ve++);const g=function(t){const e=t;if(e&&$e(e)&&6===e.type&&$e(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));const i=[];for(let t=0;e.data.payload.payload.length>t;t++)i.push(e.data.payload.payload[t]&&e.data.payload.payload[t].length>2e3?e.data.payload.payload[t].slice(0,2e3)+"...[truncated]":e.data.payload.payload[t]);return e.data.payload.payload=i,t}return t}(p),m=function(t){return Gc(t)?t.data.payload:null}(g),y=function(t){return Jc(t)?t.data.payload:null}(g),b=function(t){return Vc(t)?t.data.payload:null}(g);m||y?(null==m?void 0:m.lastActivityTimestamp)&&(g.timestamp=m.lastActivityTimestamp):(null==b?void 0:b.sessionId)||this.wi(g,i);const _=null!==(r=null!==(o=null!==(l=null==m?void 0:m.currentSessionId)&&void 0!==l?l:null==y?void 0:y.nextSessionId)&&void 0!==o?o:null==b?void 0:b.sessionId)&&void 0!==r?r:this.Xt,w=null!==(a=null!==(u=null!==(c=null==m?void 0:m.currentWindowId)&&void 0!==c?c:null==y?void 0:y.nextWindowId)&&void 0!==u?u:null==b?void 0:b.windowId)&&void 0!==a?a:this.Ye;if(!0===this.fe&&!function(t){return Vc(t)||Gc(t)||Jc(t)}(g))return void(function(t){return 2===t.type||4===t.type||3===t.type&&9!==t.data.source}(g)&&this.ve++);2===g.type&&(this.ve=0),b&&(g.timestamp=b.lastActivityTimestamp+b.threshold);const k=this.ue;this.ue=!0,f?this.On(!0):k||this.On();const S=null===(h=this._instance.config.session_recording.compress_events)||void 0===h||h;if(5===g.type&&"$json_ld"===g.data.tag){let e;try{e=t?this.Tn(t.location.href):void 0}catch(t){}g.data.href=e}if(this.Ue>0||S&&jc(g))return void this.yi(g,S,_,w);const{event:x,size:T}=S?Uc(g):{event:g,size:Hl(g)};this.ui(g,x,T,_,w)}get status(){return this.oe?this.oe.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.ne,rrwebError:this._e,urlTriggerMatching:this.tt,eventTriggerMatching:this.et,linkedFlagMatching:this.nt,remoteConfig:this.ie}):yl}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.nt.linkedFlagSeen=!0,this.Bt(),this.Wn(),this.jt("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.Bt(),this.Wn(),this.jt("sampling_overridden")}overrideTrigger(t){this.Vn(t),this.Wn()}ki(){try{var e;const i=null==t||null===(e=t.location)||void 0===e?void 0:e.href;if(!i)return;const n=this.Tn(i);if(!n)return;return new URL(n).hostname||void 0}catch(t){return}}Kn(){this.Si&&(clearTimeout(this.Si),this.Si=void 0)}ai(){this.Si||(this.Si=setTimeout(()=>{this.hn()},2e3))}xi(){return this.qe!==this.Rt.sessionId&&0!==this.Rt.data.length&&this.Rt.data.every(t=>5===(null==t?void 0:t.type)&&!Gc(t)&&!Jc(t))}Ci(){var t,e;return null!==(t=null===(e=this.oe)||void 0===e?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}Mi(t){if("buffering"!==t)return Ce(this.Ti)||this._instance.register_for_session({[Ut]:[]}),void(this.Ti=void 0);const e=this.Ci();if(0===e.length)return Ce(this.Ti)||this._instance.register_for_session({[Ut]:[]}),void(this.Ti=void 0);const i=e.join(", "),n=`${this.sessionId}:${i}`;n!==this.Ti&&(this.Ti=n,this._instance.register_for_session({[Ut]:e}),Sc.info(`buffering: ${i}`))}Ii(){var t;return"memory"!==this._instance.config.persistence&&!0!==(null===(t=this._instance.persistence)||void 0===t?void 0:t.Ai)&&nu.Ot()}Ri(){this.li||this._instance.config.session_recording.selectMaskingFn||0!==this.Rt.data.length&&this.Rt.size!==this.Ei&&943718.4>=this.Rt.size&&this.Ii()&&(this.Ei=this.Rt.size,nu.$t(this.yn,this.Rt))}Jn(){if(this.Be||!this.Ii())return;this.Be=!0;const t=nu.Pt(this.yn);nu.Dt(this.yn),!this._instance.config.session_recording.selectMaskingFn&&$e(t)&&Se(t.data)&&0!==t.data.length&&Se(t.sizes)&&t.sizes.length===t.data.length&&Ae(t.size)&&t.sessionId===this.Xt&&t.windowId===this.Ye&&(this.Rt.data.length>0||(this.Rt=t))}hn(t=!1){var e;if(this.Kn(),this.be)return this.Rt;if(this.xi())return this.Rt.size>943718.4?this.fn():(t&&this.Ri(),this.Rt);const i=this.Rt;null===(e=this.oe)||void 0===e||e.ensureSamplingDecision(this.sessionId);const n=this.sn(),s=this.status;if(this.Mi(s),"buffering"===s||"paused"===s||"disabled"===s||n)return!t||"active"!==s&&"sampled"!==s||this.Ri(),this.ai(),this.Rt;if(this.Rt!==i)return this.Rt;if(i.data.length>0){var r;const t=this.ki();Vl(i).forEach(e=>{try{var i;null===(i=this.Ke)||void 0===i||i.trackSize(e.sessionId,e.size),this.Oi(ue(ue(ue(ue({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:su.LIB_NAME,$lib_version:su.LIB_VERSION,$snapshot_host:t},this.pe>0?{$sdk_debug_replay_throttled_mutations_dropped:this.pe}:{}),this.me>0?{$sdk_debug_replay_oversized_mutations_dropped:this.me}:{}),this.ge>0?{$sdk_debug_replay_oversized_mutation_bytes_dropped:this.ge}:{}),this.ye>0?{$sdk_debug_replay_unstringifiable_events_dropped:this.ye}:{}))}catch(t){Sc.warn("could not capture snapshot chunk - skipping it",t)}}),Ce(this.Ei)||(nu.Dt(this.yn),this.Ei=void 0),null===(r=this.oe)||void 0===r||r.onFlushComplete()}return this.fn()}di(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.fe&&!this.be&&this.Rt.size+t.$snapshot_bytes+i>943718.4){const e=this.Xt;if(this.Rt=this.hn(),this.Xt!==e)return;s&&this.Rt.data.length>0&&(this.Rt=this.fn()),this.Rt.sessionId=n,this.Rt.windowId=t.$window_id}this.be&&(this.ke||this.Rt.size+t.$snapshot_bytes+i>943718.4)?this.ke=!0:(this.Rt.size+=t.$snapshot_bytes,this.Rt.data.push(t.$snapshot_data),this.Rt.sizes.push(t.$snapshot_bytes),!0===this.fe||this.be||this.ai())}Oi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.se),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get an(){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}bi(){if(!this.Rt||0===this.Rt.data.length)return this.fn();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.fn():(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)}fn(){return this.Rt={size:0,data:[],sizes:[],sessionId:this.Xt,windowId:this.Ye},this.Rt}jt(t,e){this._instance.register_for_session({[Qt]:t}),Sc.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Vt("$recording_started",ue({reason:t},e))}$i(t,e){var i;return!e&&3===t.type&&-1!==xc.indexOf(null===(i=t.data)||void 0===i?void 0:i.source)}wi(t,e){const i=this.$i(t,e);i||!0===this.fe||t.timestamp-this.ce>this.ee&&(this.fe=!0,clearInterval(this.Un),this.Vt("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.ce,threshold:this.ee,bufferLength:this.Rt.data.length,bufferSize:this.Rt.size,sessionId:this.Xt,windowId:this.Ye}),this.hn());const{windowId:n,sessionId:s}=this.te.checkAndGetSessionAndWindowId(!i,t.timestamp);let r=!1;if(i&&(this.ce=t.timestamp,this.fe)){const e="unknown"===this.fe;this.fe=!1,e||(this.Vt("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}const o=this.Xt!==s,l=this.Ye!==n;if(this.Ye=n,this.Xt=s,o||l){const t=o&&!1!==this.fe;t&&(this.fe="unknown"),this.tn(t)}else if(i&&this.Wn(),r){var a;const t=["sampled","active"].includes(this.status)||(null===(a=this.oe)||void 0===a?void 0:a.hasPendingTriggers(this.sessionId));this.ve>0&&t&&this.Bt(),this.On(),this.zn()}}Xe(){var t;null===(t=this.oe)||void 0===t||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t;return ue(ue({$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this.ii,$sdk_debug_replay_internal_buffer_length:this.Rt.data.length,$sdk_debug_replay_internal_buffer_size:this.Rt.size,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(t=this.Ke)||void 0===t?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_rrweb_error:this._e,[Gt]:this.Nn,[Jt]:this.xe},this.Ce>0?{$sdk_debug_replay_rrweb_method_failures:this.Ce,$sdk_debug_replay_rrweb_last_method_error:this.Me,$sdk_debug_replay_rrweb_recording_at_failure:this.Te,$sdk_debug_replay_rrweb_live_recorders:this.Ie}:{}),this.Ee>0?{$sdk_debug_replay_rrweb_restarts:this.Ee}:{})}get Nn(){var t,e,i;return!!this.ae&&(null===(t=null===(e=Cc())||void 0===e||null===(i=e.isRecording)||void 0===i?void 0:i.call(e))||void 0===t||t)}jn(){var e;if(this.ae)return;if(this.Ae)return void(this.Ae.startRequested=this.Ae.stopRequested);this.xe=!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,selectMaskingFn: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={};Ce(t.mousemove)||(n.mousemove=t.mousemove),Ce(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.Sn&&this.Sn.enabled&&(i.recordCanvas=!0,i.sampling=ue(ue({},i.sampling),{},{canvas:this.Sn.fps}),i.dataURLOptions={type:"image/webp",quality:this.Sn.quality},i.canvasResolutionScale=this.kn,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.Fe||(this.Fe=!0,Sc.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.bn&&(i.maskAllInputs=null===(r=this.bn.maskAllInputs)||void 0===r||r,i.maskTextSelector=null!==(o=this.bn.maskTextSelector)&&void 0!==o?o:void 0,i.blockSelector=null!==(l=this.bn.blockSelector)&&void 0!==l?l:void 0,i.maskAllElementAttributes=null!==(a=this.bn.maskAllElementAttributes)&&void 0!==a&&a),i.maskAllElementAttributes&&i.maskAttributeFn&&(i.maskAttributeFn=void 0,this.De||(this.De=!0,Sc.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.wn();const u=Cc();if(!u)return void Sc.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");if(i.selectMaskingFn&&!0!==u.supportsSelectMasking)return void Sc.error("Session recording has not started: the recorder does not support selectMaskingFn.");this.ei=null!==(e=this.ei)&&void 0!==e?e:new Ea(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`;Sc.info(i,{node:e}),this.log("[SessionRecording] "+i,"warn")},onDroppedAttributeMutations:t=>this.pe+=t,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this.Bn,onDroppedOversizedMutation:t=>{0===this.me&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this.me+=1,this.ge+=t},requestFullSnapshot:()=>this.Bt()});const c=i.selectMaskingFn;this.li=c,c&&(i.selectMaskingFn=t=>{try{return c(t)}catch(t){throw this.Ne||(this.Ne=!0,Sc.warn("selectMaskingFn threw; affected selects are recorded as masked.",t)),t}});const h=this.Cn(),d=this.le,v={stopRequested:!1,startRequested:!1};let f;this.Ae=v;try{f=u(ue(ue({emit:(t,e,i)=>{(null==d?void 0:d.cancelled)||v.stopRequested||(d&&this.le===d&&(this._instance.config.disable_session_recording||this._instance.has_opted_out_capturing())?d.cancel():this.onRRwebEmit(t,i))},plugins:h,errorHandler:(t,e)=>"rrweb"===e&&(this.Pe||(this.Pe=!0,Sc.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},i),{},{recordAfter:"DOMContentLoaded"}))}finally{this.Ae=void 0}if(f&&(this.Ie+=1),v.stopRequested){if(f&&this.qn(f),v.startRequested){const t=this.le;(null==t?void 0:t.cancelled)&&(this.le=void 0),this.jn(),this.le=t}}else{if(this.ae=f,!this.ae)return this._e=!0,void Sc.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this._e=!1,!0===(null==s?void 0:s.captureJsonLd)&&n&&(null==t?void 0:t.MutationObserver)&&!this.$n&&(this.$n=function(t,e,i){const n=new WeakMap,s=i.getCaptureState||(()=>!0);let r=Zu;const o=function(t,e){const i=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?Xu:i=>{const n=t.getElementById(i);return!!n&&"SCRIPT"!==n.nodeName&&(!e.isRecordedElement||e.isRecordedElement(n))&&!yc(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 yc(t,e.blockClass,e.blockSelector)||yc(t,e.maskTextClass,e.maskTextSelector)}(e,i))return;const a=function(t,e=Xu,i){if(!t||t.length>Zu)return null;try{const n=JSON.parse(t),s={maskUrl:i,remainingNodes:2048,exceeded:!1},r=Se(n)?n.map(t=>pc(t,e,s)):pc(n,e,s);if(s.exceeded||Ie(r)||Se(r)&&(!r.length||r.some(Ie)))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,c]=a;if(Ie(l))return void n.set(e,c);if(n.get(e)!==c){if(c.length>r)return void(r=0);i.emit(u)&&(n.set(e,c),r-=c.length)}}catch(t){return}};try{const i=new e(t=>{try{if(!r||!1===s())return;const e=t=>{for(const e of bc(t))l(e)};for(const i of t)if("childList"===i.type)gc(i.target)&&l(i.target),i.addedNodes.forEach(e);else if("characterData"===i.type){const t=i.target.parentNode;t&&gc(t)&&l(t)}else"attributes"===i.type&&gc(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()&&bc(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.Tn(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.tt.urlBlocked||this.tt.isCurrentUrlBlocked()?null:this.Rn()},emit:t=>this.En(t)}),this.tt.isCurrentUrlBlocked()&&this.$n.scan()),this.ce=Date.now(),this.fe=Pe(this.fe)?this.fe:"unknown",this.tryAddCustomEvent("$remote_config_received",this.ie),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 Zc=["type"];var Kc=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}({}),Yc=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}({}),Xc=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}({}),th=function(t){return t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t}({}),eh=function(t){return t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t}({}),ih=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}({}),nh=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 sh(t,e){return-1!==t.indexOf(e)}Date,Date;var rh={Node:["childNodes","parentNode","parentElement","textContent","previousSibling","nextSibling","lastChild"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},oh={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},lh={};function ah(t){if(lh[t])return lh[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 rh?rh[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 oh?oh[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 lh[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 sh(t,"AppleWebKit")&&!sh(t,"Chrome")}(navigator.userAgent)&&(l.classList.add("rr-block","ph-no-capture"),l.setAttribute("__rrwebUntaintedPrototype",t),a=!0),lh[t]=s):i}catch(t){return i}finally{!a&&l.parentNode&&document.body.removeChild(l)}}var uh=Object.create(null);function ch(t,e,i){var n;const s=uh[t],r=s[i];if(r)return r.call(e);const o=ah(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]}uh.Node=Object.create(null),uh.ShadowRoot=Object.create(null),uh.MutationObserver=Object.create(null),uh.Element=Object.create(null);var hh,dh={};function vh(t,e,i){const n=`${t}.${String(i)}`;if(dh[n])return dh[n].bind(e);const s=ah(t)[i];return"function"!=typeof s?e[i]:(dh[n]=s,s.bind(e))}function fh(){return ah("MutationObserver").constructor}function ph(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 gh={childNodes:t=>ch("Node",t,"childNodes"),parentNode:t=>ch("Node",t,"parentNode"),parentElement:t=>ch("Node",t,"parentElement"),textContent:t=>ch("Node",t,"textContent"),previousSibling:t=>ch("Node",t,"previousSibling"),nextSibling:t=>ch("Node",t,"nextSibling"),lastChild:t=>ch("Node",t,"lastChild"),isConnected(t){if(void 0===hh){var e;const t=null===(e=Object.getOwnPropertyDescriptor(ah("Node"),"isConnected"))||void 0===e?void 0:e.get;hh=(null==t?void 0:t.toString().includes("[native code]"))?t:null}return null==hh?void 0:hh.call(t)},contains:(t,e)=>vh("Node",t,"contains")(e),getRootNode:t=>vh("Node",t,"getRootNode")(),host:t=>t&&"host"in t?ch("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?ch("Element",t,"shadowRoot"):null,querySelector:(t,e)=>vh("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>vh("Element",t,"querySelectorAll")(e),mutationObserver:fh,patch:ph},mh=new WeakMap;function yh(t){let e=Object.getPrototypeOf(t);for(;e;){const t=mh.get(e);if(t)return t;e=Object.getPrototypeOf(e)}}var bh=new WeakMap,_h=new WeakSet,wh=new WeakSet,kh=!1;function Sh(t){return/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(t)}function xh(t){return!!t.includes("var(")&&(!!/["'\\]|\/\*|url\(/i.test(t)||t.replace(/\{[^{};]*(?:;\s*)?\}/g,"{}").replace(/(^|[;{])\s*(?:--[\w-]+|color|background-color|width|height|min-width|max-width|min-height|max-height|font-size|font-weight|line-height|opacity|z-index|top|right|bottom|left)\s*:[^;{}]*/gi,"$1").includes("var("))}function $h(t){try{for(;t;)bh.delete(t),t=t.parentRule}catch(t){Rh()}}function Th(t,e){try{if($h(t),kh||wh.has(t)||"string"!=typeof e||!xh(e))return;if("cssRules"in t&&t.cssRules.length>0){var i;let e=t.parentStyleSheet;for(;null==e?void 0:e.ownerRule;)e=e.ownerRule.parentStyleSheet;if("LINK"===(null==e||null===(i=e.ownerNode)||void 0===i?void 0:i.nodeName))return}const n=t.cssText;if(Sh(n)){bh.set(t,{text:e,cssText:n,realm:yh(t)});let i=t.parentRule;for(;i;)_h.add(i),i=i.parentRule}}catch(t){}}function Ch(t,e){try{if(kh||"string"!=typeof e||!xh(e))return;const i=Array.from(t.cssRules);if(!i.some(t=>Sh(t.cssText)))return;const n=function(t){const e=[];let i=0,n=0,s=0,r=0,o="",l=!1,a=!1;for(let u=0;t.length>u;u++){const c=t[u];if(l)"*"===c&&"/"===t[u+1]&&(l=!1,u++);else if("\\"!==c)if(o)c===o&&(o="");else if("/"!==c||"*"!==t[u+1]){if(!a){const e=t.startsWith("\x3c!--",u)?4:t.startsWith("--\x3e",u)?3:0;if(e){u+=e-1,i=u+1;continue}}-1===" \t\n\r\f".indexOf(c)&&(a=!0),'"'!==c&&"'"!==c?("("===c?s++:")"===c?s--:"["===c?r++:"]"===c&&r--,s||r||("{"===c?n++:"}"===c&&n--,("}"===c&&0===n||";"===c&&0===n)&&(e.push(t.slice(i,u+1).trim()),i=u+1,a=!1))):o=c}else l=!0,u++;else a=!0,u++}return n||s||r||o||l?[]:e}(e);if(n.length!==i.length)return;i.forEach((t,e)=>Th(t,n[e]))}catch(t){}}function Eh(t){var e;const i=bh.get(t);if(i){if(!1!==(null===(e=i.realm)||void 0===e?void 0:e.active)&&i.cssText===t.cssText)return i.text;bh.delete(t)}}function Mh(t){$h(t);try{let e=t;for(;e;)wh.add(e),e=e.parentRule}catch(t){Rh()}}function Ih(){bh=new WeakMap,_h=new WeakSet}function Rh(){Ih(),kh=!0}function Ah(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var Oh=0;function Ph(){Oh+=1}function Fh(){return Oh}function Lh(t,e){return(e!==Oh||t>6e4)&&!0}var Dh=0,Nh=0,jh=0,qh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},Bh=null,zh=null,Uh=[],Hh=0,Wh=0,Vh={slowestBatchMs:0},Gh={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function Jh(t){(Dh+=1)>1||(qh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},Uh=[],Hh=0,zh=(t=>t&&t>0?t:null)(t),Nh=Ah(),jh=Oh)}function Qh(){return 0===Dh?Bh||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(Dh-=1)>0?qh:(qh.durationMs=Ah()-Nh,qh.deferredStylesheetCount=Hh,Gh.deferredCount+=Hh,zh=null,Lh(qh.durationMs,jh)?qh:Bh=qh)}function Zh(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+=Zh(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+=Zh(s,e,i+1))}}}catch(t){}}return n}function Kh(t){if(0===Dh)return;const e=Zh(t,null,0);qh.cssRuleCount+=e,Wh>0&&(qh.nonDeferrableCssRuleCount+=e)}function Yh(t){Wh+=1;try{return t()}finally{Wh-=1}}function Xh(t){Dh>0&&(qh.stylesheetMs+=t)}function td(t){if(0===Dh||null===zh)return!1;const e=qh.cssRuleCount-qh.nonDeferrableCssRuleCount;return e>=zh||e+function(t){try{const e=t&&(t.rules||t.cssRules);if(!e)return 0;const i=new WeakSet;return i.add(t),Zh(e,i,0)}catch(t){return 0}}(t)>zh}function ed(){const t=Uh;return Uh=[],t}function id(){Gh.failedCount+=1}function nd(t){t>0&&(Gh.abandonedCount+=t)}function sd(t){return sd="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},sd(t)}function rd(t,e,i){return(e=function(t){var e=function(t){if("object"!=sd(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=sd(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==sd(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function od(t){return t.nodeType===t.ELEMENT_NODE}function ld(t){const e=t&&"host"in t&&"mode"in t&&gh.host(t)||null;return Boolean(e&&"shadowRoot"in e&&gh.shadowRoot(e)===t)}function ad(t){return"[object ShadowRoot]"==={}.toString.call(t)}function ud(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 cd(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 hd=0;function dd(t){const e=0===hd,i=e?Ah():0;hd+=1;try{const e=t.rules||t.cssRules;if(!e)return null;Kh(e);let i=t.href;return!i&&t.ownerNode&&(i=t.ownerNode.baseURI),ud(Array.from(e,t=>vd(t,i)).join(""))}catch(t){return null}finally{hd-=1,e&&Xh(Ah()-i)}}function vd(t,e){if(pd(t)){let e;try{e=dd(t.styleSheet)||cd(t)}catch(i){e=t.cssText}try{var i;if(e&&(null===(i=t.styleSheet)||void 0===i?void 0:i.href))return Rd(e,t.styleSheet.href)}catch(t){}return e}{var n;let i=Eh(t);if(void 0===i&&function(t){return _h.has(t)}(t)){const e=bd(t);null!==e&&(i=e+Array.from(t.cssRules,t=>vd(t,null)).join("")+"}")}return null!==(n=i)&&void 0!==n||(i=t.cssText),gd(t)&&t.selectorText.includes(":")&&(i=fd(i)),e?Rd(i,e):i}}function fd(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function pd(t){return"styleSheet"in t}function gd(t){return"selectorText"in t}var md=/^-?[A-Za-z_][\w-]*$/,yd=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function bd(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(gd(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&&!md.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]?md.test(e.name)?`@keyframes ${e.name} {`:null:""===e.name?"@layer {":yd.test(e.name)?`@layer ${e.name} {`:null:null}var _d=class{constructor(){rd(this,"idNodeMap",new Map),rd(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)),od(t)){const e=gh.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 wd({element:t,maskInputOptions:e,tagName:i,type:n,value:s,maskInputFn:r}){let o=s||"";const l=n&&kd(n);return(e[i.toLowerCase()]||l&&e[l])&&(o=r?r(o,t):"*".repeat(o.length)),o}function kd(t){return t.toLowerCase()}var Sd=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 xd({element:t,name:e,value:i,maskAllElementAttributes:n,maskAttributeFn:s,isGenerated:r=!1}){return i?n?r&&Sd.has(kd(e))?i:"*".repeat(i.length):s?s(e,i,t):i:i}var $d="__rrweb_original__";function Td(t){try{const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?kd(e):null}catch(t){return null}}var Cd=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Ed=/^(?:[a-z+]+:)?\/\//i,Md=/^www\..*/i,Id=/^(data:)([^,]*),(.*)/i;function Rd(t,e){return(t||"").replace(Cd,(t,i,n,s,r,o)=>{const l=n||r||o,a=i||s||"";if(!l)return t;if(Ed.test(l)||Md.test(l))return`url(${a}${l}${a})`;if(Id.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=l.split("#")[0],c=l.substring(u.length),h=e.split("#")[0].split("/"),d=u.split("/");h.pop();for(const t of d)"."!==t&&(".."===t?h.pop():h.push(t));return`url(${a}${h.join("/")}${c}${a})`})}var Ad=new Map;function Od(t){return"http://www.w3.org/1999/xhtml"===t.namespaceURI?t.localName:void 0}function Pd(t,e,i,n=void 0){if(!i||"select"!==Od(t))return e;const s=null==n?void 0:n.input.get(t);if(s)return s;let r;try{r="unmasked"!==i(t)}catch(t){r=!0}const o=ue(ue({},e),{},{select:r});return null==n||n.input.set(t,o),o}function Fd(t,e,i,n){if(!i)return!1;let s=gh.parentNode(t);const r=[];let o=!1;for(;s;){const t=null==n?void 0:n.content.get(s);if(void 0!==t){o=t;break}if(r.push(s),od(s)&&"selectedcontent"===Od(s)){let t=gh.parentElement(s);for(;t;){const s=t.localName;if("option"===s)break;if("select"===s){"select"===Od(t)&&Pd(t,e,i,n).select&&(o=!0);break}t=gh.parentElement(t)}if(o)break}s=ld(s)?gh.host(s):gh.parentNode(s)}for(const t of r)null==n||n.content.set(t,o);return o}var Ld,Dd,Nd=1,jd=new RegExp("[^a-z0-9-_:]");function qd(){return Nd++}var Bd=!1,zd=/^[^ \t\n\r\u000c]+/,Ud=/^[, \t\n\r\u000c]+/,Hd=new WeakMap;function Wd(t,e){return e&&""!==e.trim()?Vd(t,e):e}function Vd(t,e){let i=Hd.get(t);if(i||(i=t.createElement("a"),Hd.set(t,i)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return i.setAttribute("href",e),i.href}function Gd(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 Jd(t,e,i,n,s,r){if(!n)return n;if("src"===i||"href"===i&&("use"!==e||"#"!==n[0])){const i=Wd(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=Ad.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(Ad.size>=10){const t=Ad.keys().next().value;void 0!==t&&Ad.delete(t)}return Ad.set(e,{type:i,quality:n,result:l}),l}catch(t){return e}}(s,i,r.type,r.quality)),Gd(t,r)}if("image"===e)return Gd(i,r)}return i}if("xlink:href"===i&&"#"!==n[0]){const i=Wd(t,n);return"image"===e&&i.startsWith("data:")?Gd(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(Ud),e.length>i;){let r=n(zd);if(","===r.slice(-1))r=Wd(t,r.substring(0,r.length-1)),s.push(r);else{let n="";r=Wd(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?Rd(n,Vd(t)):"object"===e&&"data"===i?Wd(t,n):n:Wd(t,n)}function Qd(t,e,i){return("video"===t||"audio"===t)&&"autoplay"===kd(e)}function Zd(t){return"string"==typeof t&&kd(t).split(/\s+/).includes("stylesheet")}function Kd(t,e,i){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else if(Yd(t,e,!1))return!0;if(i)return t.matches(i)}catch(t){}return!1}function Yd(t,e,i){if(!t||!e)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!i&&Yd(gh.parentNode(t),e,i);const n=e.global||e.sticky?new RegExp(e):e;for(let e=t.classList.length;e--;)if(n.test(t.classList[e]))return!0;return!!i&&Yd(gh.parentNode(t),e,i)}function Xd(t,e,i,n){let s;if(od(t)){if(s=t,!gh.childNodes(s).length)return!1}else{if(null===gh.parentElement(t))return!1;s=gh.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(Yd(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 tv(t,e,i){const n=t.removeEventListener;"function"==typeof n&&n.call(t,e,i)}var ev=new Map;function iv(t={}){ev.forEach((e,i)=>{t.keepChangedLinks&&e.changedLinkBaseline||(e.controller.abort(),ev.delete(i))})}function nv(t){try{return t.sheet}catch(t){return null}}function sv(t,e,i,n,s){const r=new AbortController,o=()=>{var e;(null===(e=ev.get(t))||void 0===e?void 0:e.controller)===r&&ev.delete(t),r.abort()};let l=!1;const a=()=>{if(!l){l=!0;try{e()}finally{o()}}};t.addEventListener("load",a,{signal:r.signal,once:!0}),t.addEventListener("error",o,{signal:r.signal,once:!0});const u=Date.now()+6e4;let c;const h=e=>{const s=n.length>e?n[e]:Math.max(n[n.length-1],1e3);c=setTimeout(()=>{t.isConnected?i()?a():Date.now()<u?h(e+1):o():o()},s)};r.signal.addEventListener("abort",()=>clearTimeout(c),{once:!0}),h(0),ev.set(t,{controller:r,changedLinkBaseline:s})}var rv=[100,200,400,800,1600,3200,6400,12800,25600];function ov(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function lv(t){return null==t?"":t.toLowerCase()}var av=!1,uv=!1;function cv(t,e,i=void 0){const{doc:n,mirror:s,blockClass:r,blockSelector:o,maskTextClass:l,maskTextSelector:a,skipChild:u=!1,inlineStylesheet:c=!0,maskInputOptions:h={},maskTextFn:d,maskInputFn:v,selectMaskingFn:f,maskAllElementAttributes:p=!1,maskAttributeFn:g,slimDOMOptions:m,dataURLOptions:y={},inlineImages:b=!1,recordCanvas:_=!1,canvasMaskingConfigured:w,onSerialize:k,onIframeLoad:S,iframeLoadTimeout:x=5e3,onIframeListenerRegistered:T,onStylesheetLoad:C,stylesheetLoadTimeout:E=5e3,keepIframeSrcFn:M=()=>!1,newlyAddedElement:I=!1,depth:R=0,maxDepth:A=50}=e;let{needsMask:O}=e,{preserveWhiteSpace:P=!0}=e;if(f&&!i&&(i={input:new WeakMap,content:new WeakMap,owner:new WeakMap}),f&&Fd(t,h,f,i))return null;if(R>=A)return uv=!0,av||(av=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${A}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;O||(O=Xd(t,l,a,void 0===O)),Dh>0&&(qh.nodeCount+=1);const F=function(t,e,i){const{doc:n,mirror:s,blockClass:r,blockSelector:o,needsMask:l,inlineStylesheet:a,maskInputOptions:u={},maskTextFn:c,maskInputFn:h,selectMaskingFn:d,maskAllElementAttributes:v=!1,maskAttributeFn:f,dataURLOptions:p={},inlineImages:g,recordCanvas:m,canvasMaskingConfigured:y,keepIframeSrcFn:b,newlyAddedElement:_=!1}=e,w=function(t,e){if(!e.hasNode(t))return;const i=e.getId(t);return 1===i?void 0:i}(n,s);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:nh.Document,childNodes:[],compatMode:t.compatMode}:{type:nh.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:nh.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:w};case t.ELEMENT_NODE:return function(t,e,i){const{doc:n,blockClass:s,blockSelector:r,inlineStylesheet:o,maskInputOptions:l={},maskInputFn:a,selectMaskingFn:u,maskAllElementAttributes:c=!1,maskAttributeFn:h,dataURLOptions:d={},inlineImages:v,recordCanvas:f,canvasMaskingConfigured:p,keepIframeSrcFn:g,newlyAddedElement:m=!1,rootId:y}=e,b=Kd(t,s,r),_=u&&Od(t),w="select"===_||"option"===_||"selectedcontent"===_?_:function(t){if(t instanceof HTMLFormElement)return"form";const e=kd(t.tagName);return jd.test(e)?"div":e}(t);let k=l;if(u&&!b&&("select"===w||"option"===w)){const e="option"===w?function(t,e){let i=gh.parentElement(t);const n=[];for(;i&&"select"!==Od(i);){const t=null==e?void 0:e.owner.get(i);if(void 0!==t){i=t;break}n.push(i),i=gh.parentElement(i)}for(const t of n)null==e||e.owner.set(t,i);return i}(t,i):t;e&&(k=Pd(e,l,u,i))}const S=new Set;let x={};const T=t.attributes.length;for(let e=0;T>e;e++){const i=t.attributes[e];Qd(w,i.name)||(x[i.name]=Jd(n,w,kd(i.name),i.value,t,d))}if("link"===w&&"string"==typeof x.href){var C;const e=null===(C=nv(t))||void 0===C?void 0:C.href;e&&(x.href=e)}if("link"===w&&o&&!b&&Zd(x.rel)){let e=t.sheet;if(!e){const i=function(t){return t.href}(t);i&&(e=ov(n,i),!e&&i.includes(".css"))&&(e=ov(n,window.location.origin+"/"+i.replace(window.location.href,"")))}let i=null;e&&(td(e)?Dh>0&&(Uh.push(t),Hh+=1):i=dd(e)),i&&(delete x.rel,delete x.href,x._cssText=i)}var E;if("style"===w&&t.sheet&&!(t.innerText||gh.textContent(t)||"").trim().length){const e=Yh(()=>dd(t.sheet));e&&(x._cssText=e)}if("input"===w||"textarea"===w||"select"===w){var M;const e="select"===w?t.selectedOptions:void 0,i=e?(null===(M=Array.from(e).find(e=>{let i=e;for(;i&&i!==t;){if(Kd(i,s,r))return!1;i=gh.parentElement(i)}return!0}))||void 0===M?void 0:M.value)||"":t.value,n=t.checked;"radio"!==x.type&&"checkbox"!==x.type&&"submit"!==x.type&&"button"!==x.type&&(e||i)?x.value=i?wd({element:t,type:Td(t),tagName:w,value:i,maskInputOptions:k,maskInputFn:a}):"":n&&(x.checked=n)}if("select"===w&&(u||k.select&&!a)&&(x.rr_maskedSelect=!!k.select||null,S.add("rr_maskedSelect")),"option"===w&&(t.selected&&!k.select?x.selected=!0:delete x.selected),"dialog"===w&&t.open){try{x.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){x.rr_open_mode="modal",x.ph_rr_could_not_detect_modal=!0}S.add("rr_open_mode")}if("canvas"===w&&f&&!(null==p?void 0:p()))try{if("2d"===t.__context)(function(t){const e=t.getContext("2d");if(!e)return!0;for(let i=0;t.width>i;i+=50)for(let n=0;t.height>n;n+=50){const s=e.getImageData,r=$d in s?s[$d]:s;let o;try{o=r.call(e,i,n,Math.min(50,t.width-i),Math.min(50,t.height-n))}catch(t){return!1}if(new Uint32Array(o.data.buffer).some(t=>0!==t))return!1}return!0})(t)||(x.rr_dataURL=t.toDataURL(d.type,d.quality));else if(!("__context"in t)){const e=t.toDataURL(d.type,d.quality),i=n.createElement("canvas");i.width=t.width,i.height=t.height,e!==i.toDataURL(d.type,d.quality)&&(x.rr_dataURL=e)}}catch(t){"SecurityError"===(null==(E=t)?void 0:E.name)?Bd||(Bd=!0,console.warn("Cannot read canvas pixels, so this canvas is left out of the recording. A cross-origin image or video drawn into it taints it.",E)):console.warn("Cannot read canvas pixels, so this canvas is left out of the recording.",E)}let I,R=!1;if("img"===w&&v){Ld||(Ld=n.createElement("canvas"),Dd=Ld.getContext("2d"));const e=t,i=e.currentSrc||e.getAttribute("src")||"<unknown-src>",s=e.crossOrigin,r=(e,i)=>R?xd({element:t,name:e,value:i,maskAllElementAttributes:c,maskAttributeFn:h}):i,o=()=>{tv(e,"load",o);try{Ld.width=e.naturalWidth,Ld.height=e.naturalHeight,Dd.drawImage(e,0,0);const t=Ld.toDataURL(d.type,d.quality);x.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=${i}! Error: ${t}`)}"anonymous"===e.crossOrigin&&(s?x.crossOrigin=r("crossOrigin",s):e.removeAttribute("crossorigin"))};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if("audio"===w||"video"===w){const e=x;e.rr_mediaState=t.paused?"paused":"played",S.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(m||function(t){return"function"!=typeof t.checkVisibility||t.checkVisibility({contentVisibilityAuto:!0})}(t)&&(t.scrollLeft&&(x.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(x.rr_scrollTop=t.scrollTop)),b){var A,O,P;const{width:e,height:i,left:s,top:r}=t.getBoundingClientRect(),o=null===(A=n.defaultView)||void 0===A?void 0:A.getComputedStyle(t);x={class:x.class,rr_width:`${e}px`,rr_height:`${i}px`,rr_left:`${Math.floor(s+((null===(O=n.defaultView)||void 0===O?void 0:O.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(P=n.defaultView)||void 0===P?void 0:P.scrollY)||0))}px`},S.add("rr_width"),S.add("rr_height"),S.add("rr_left"),S.add("rr_top"),o&&(x.rr_position=o.position||"static",S.add("rr_position"),o.transform&&"none"!==o.transform&&(x.rr_transform=o.transform,S.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(x.rr_display=o.display,S.add("rr_display")))}if("iframe"!==w||g(x.src)||(t.contentDocument||(x.rr_src=x.src),delete x.src),c||h)for(const[e,i]of Object.entries(x))"string"!=typeof i&&null!==i||(x[e]=xd({element:t,name:e,value:i,maskAllElementAttributes:c,maskAttributeFn:h,isGenerated:S.has(e)}));R=!0;try{customElements.get(w)&&(I=!0)}catch(t){}return{type:nh.Element,tagName:w,attributes:x,childNodes:[],isSVG:(F=t,Boolean("svg"===F.tagName||F.ownerSVGElement)||void 0),needBlock:b,rootId:y,isCustom:I};var F}(t,{doc:n,blockClass:r,blockSelector:o,inlineStylesheet:a,maskInputOptions:u,maskInputFn:h,selectMaskingFn:d,maskAllElementAttributes:v,maskAttributeFn:f,dataURLOptions:p,inlineImages:g,recordCanvas:m,canvasMaskingConfigured:y,keepIframeSrcFn:b,newlyAddedElement:_,rootId:w},i);case t.TEXT_NODE:case t.CDATA_SECTION_NODE:return function(t,e){const{needsMask:i,maskTextFn:n,rootId:s}=e,r=gh.parentNode(t),o=r&&r.tagName;let l=gh.textContent(t);const a="STYLE"===o||void 0,u="string"==typeof o&&"SCRIPT"===o.toUpperCase();if(a&&l){try{var c;if(t.nextSibling||t.previousSibling);else if(td(r.sheet));else if(null===(c=r.sheet)||void 0===c?void 0:c.cssRules){const t=dd(r.sheet);t&&!Sh(t)&&(l=t)}}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}l=Rd(l,Vd(e.doc))}return u&&(l="SCRIPT_PLACEHOLDER"),!a&&!u&&l&&i&&(l=n?n(l,gh.parentElement(t)):l.replace(/[\S]/g,"*")),{type:nh.Text,textContent:l||"",isStyle:a,rootId:s}}(t,{doc:n,needsMask:l,maskTextFn:c,rootId:w});case t.COMMENT_NODE:return{type:nh.Comment,textContent:gh.textContent(t)||"",rootId:w};default:return!1}}(t,{doc:n,mirror:s,blockClass:r,blockSelector:o,needsMask:O,inlineStylesheet:c,maskInputOptions:h,maskTextFn:d,maskInputFn:v,selectMaskingFn:f,maskAllElementAttributes:p,maskAttributeFn:g,dataURLOptions:y,inlineImages:b,recordCanvas:_,canvasMaskingConfigured:w,keepIframeSrcFn:M,newlyAddedElement:I},i);if(!F)return console.warn(t,"not serialized"),null;let L;L=s.hasNode(t)?s.getId(t):function(t,e){if(e.comment&&t.type===nh.Comment)return!0;if(t.type===nh.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&&(lv(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===lv(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(lv(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&lv(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(lv(t.attributes.property).match(/^(og|twitter|fb):/)||lv(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===lv(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(lv(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(lv(t.attributes.name))||lv(t.attributes.property).match(/^article:/)||lv(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(lv(t.attributes.name)))return!0}}return!1}(F,m)||!P&&F.type===nh.Text&&!F.isStyle&&!F.textContent.replace(/^\s+|\s+$/gm,"").length?-2:qd();const D=Object.assign(F,{id:L});if(s.add(t,D),-2===L)return null;k&&k(t);let N=!u;if(D.type===nh.Element){N=N&&!D.needBlock,delete D.needBlock;const e=gh.shadowRoot(t);e&&ad(e)&&(D.isShadowHost=!0)}if((D.type===nh.Document||D.type===nh.Element)&&N){m.headWhitespace&&D.type===nh.Element&&"head"===D.tagName&&(P=!1);const e={doc:n,mirror:s,blockClass:r,blockSelector:o,needsMask:O,maskTextClass:l,maskTextSelector:a,skipChild:u,inlineStylesheet:c,maskInputOptions:h,maskTextFn:d,maskInputFn:v,selectMaskingFn:f,maskAllElementAttributes:p,maskAttributeFn:g,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,canvasMaskingConfigured:w,preserveWhiteSpace:P,onSerialize:k,onIframeLoad:S,iframeLoadTimeout:x,onIframeListenerRegistered:T,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:M,depth:R+1,maxDepth:A};if(D.type===nh.Element&&"textarea"===D.tagName&&void 0!==D.attributes.value);else for(const n of Array.from(gh.childNodes(t))){const t=cv(n,e,i);t&&D.childNodes.push(t)}let I=null;if(od(t)&&(I=gh.shadowRoot(t)))for(const t of Array.from(gh.childNodes(I))){const n=cv(t,e,i);n&&(ad(I)&&(n.isShadow=!0),D.childNodes.push(n))}}const j=gh.parentNode(t);if(j&&ld(j)&&ad(j)&&(D.isShadow=!0),D.type===nh.Element&&"iframe"===D.tagName&&!Kd(t,r,o)){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),tv(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?tv(t,"load",o):(n=!0,tv(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),tv(t,"load",o)}}return t.addEventListener("load",o),()=>{tv(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&S){const i=cv(e,{doc:e,mirror:s,blockClass:r,blockSelector:o,needsMask:O,maskTextClass:l,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:h,maskTextFn:d,maskInputFn:v,selectMaskingFn:f,maskAllElementAttributes:p,maskAttributeFn:g,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,canvasMaskingConfigured:w,preserveWhiteSpace:P,onSerialize:k,onIframeLoad:S,iframeLoadTimeout:x,onIframeListenerRegistered:T,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:M,depth:R+1,maxDepth:A});i&&S(t,i)}},x);null==T||T(t,e)}var q,B,z;return D.type===nh.Element&&"link"===D.tagName&&Zd(D.attributes.rel)&&(B=()=>{if(C){const e=s.getMeta(t),i=cv(t,{doc:n,mirror:s,blockClass:r,blockSelector:o,needsMask:O,maskTextClass:l,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:h,maskTextFn:d,maskInputFn:v,selectMaskingFn:f,maskAllElementAttributes:p,maskAttributeFn:g,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,canvasMaskingConfigured:w,preserveWhiteSpace:P,onSerialize:k,onIframeLoad:S,iframeLoadTimeout:x,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:M,depth:R,maxDepth:A});i&&C(t,i,e)}},z=E,ev.has(q=t)||nv(q)||sv(q,B,()=>Boolean(nv(q)),[z])),D}function hv(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 dv=class t{constructor(...t){rd(this,"parentElement",null),rd(this,"parentNode",null),rd(this,"ownerDocument",void 0),rd(this,"firstChild",null),rd(this,"lastChild",null),rd(this,"previousSibling",null),rd(this,"nextSibling",null),rd(this,"ELEMENT_NODE",1),rd(this,"TEXT_NODE",3),rd(this,"nodeType",void 0),rd(this,"nodeName",void 0),rd(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 vv(t,e,i=document){const n={capture:!0,passive:!0};return i.addEventListener(t,e,n),()=>fv(i,t,e,n)}function fv(t,e,i,n){pv(()=>{const s=t.removeEventListener;"function"==typeof s&&(void 0!==n?s.call(t,e,i,n):s.call(t,e,i))})}function pv(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function gv(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var mv="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.",yv={map:{},getId(){return console.warn(mv),-1},getNode(){return console.warn(mv),null},removeNodeFromMap(){console.warn(mv)},has(){return console.warn(mv),!1},reset(){console.warn(mv)}};function bv(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 _v(t){let e="function"==typeof t.setTimeout?t.setTimeout:void 0;try{var i,n;const s=null===(i=t.Zone)||void 0===i||null===(n=i.__symbol__)||void 0===n?void 0:n.call(i,"setTimeout"),r=s?t[s]:void 0;"function"==typeof r&&(e=r)}catch(t){}if(!e)return()=>{};const s=e;return e=>{try{s.call(t,e,0)}catch(t){}}}function wv(t,e,i,n,s=window){const r=s.Object.getOwnPropertyDescriptor(t,e),o=()=>wv(t,e,r||{},!0);if(n)return s.Object.defineProperty(t,e,i),o;const l=_v(s);return s.Object.defineProperty(t,e,{set(t){if(l(()=>{try{i.set.call(this,t)}catch(t){}}),r&&r.set){if(r.get)try{r.get.call(this)}catch(t){return}r.set.call(this,t)}}}),o}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(yv=new Proxy(yv,{get(t,e,i){return"map"===e&&console.warn(mv),Reflect.get(t,e,i)}}));var kv=Date.now;function Sv(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=gh.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=gh.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 xv(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function $v(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Tv(t){return t?t.nodeType===t.ELEMENT_NODE?t:gh.parentElement(t):null}function Cv(t,e,i,n){if(!t)return!1;const s=Tv(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(Yd(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 Ev(t,e,i){const n=e&&"string"!=typeof e&&(e.global||e.sticky)?new RegExp(e):null;for(;t;){if(n&&(n.lastIndex=0),Cv(t,n||e,i,!0))return!0;const s="getRootNode"in t?gh.getRootNode(t):null;t=(null==s?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?gh.host(s):null}return!1}function Mv(t,e,i){return!("TITLE"!==t.tagName||!i.headTitleMutations)||-2===e.getId(t)}function Iv(t,e){if(ld(t))return!1;const i=e.getId(t);if(!e.has(i))return!0;const n=gh.parentNode(t);return(!n||n.nodeType!==t.DOCUMENT_NODE)&&(!n||Iv(n,e))}function Rv(t){return Boolean(t.changedTouches)}function Av(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Ov(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Pv(t){return!!t&&(t instanceof dv&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(gh.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(kv=()=>(new Date).getTime());var Fv=class{constructor(){rd(this,"id",1),rd(this,"styleIDMap",new WeakMap),rd(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 Lv(t){var e;let i=null;return"getRootNode"in t&&(null===(e=gh.getRootNode(t))||void 0===e?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&gh.host(gh.getRootNode(t))&&(i=gh.host(gh.getRootNode(t))),i}function Dv(t){const e=t.ownerDocument;if(!e)return!1;if(gh.contains(e,t))return!0;const i=gh.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=Lv(i);)i=e;return i}(t);return gh.contains(e,i)}(t)}var Nv,jv=new WeakMap,qv=(t,e)=>`${t}@${e}`,Bv=class{constructor(){rd(this,"frozen",!1),rd(this,"locked",!1),rd(this,"takePendingRecords",void 0),rd(this,"texts",new Map),rd(this,"attributes",new Map),rd(this,"generatedAttributes",new WeakMap),rd(this,"selectedAttributeChanges",new Set),rd(this,"removes",[]),rd(this,"mapRemoves",new Set),rd(this,"movedMap",{}),rd(this,"addedSet",new Set),rd(this,"movedSet",new Set),rd(this,"droppedSet",new Set),rd(this,"removesSubTreeCache",new Set),rd(this,"mutationCb",void 0),rd(this,"blockClass",void 0),rd(this,"blockSelector",void 0),rd(this,"maskTextClass",void 0),rd(this,"maskTextSelector",void 0),rd(this,"inlineStylesheet",void 0),rd(this,"maskInputOptions",void 0),rd(this,"maskTextFn",void 0),rd(this,"maskInputFn",void 0),rd(this,"selectMaskingFn",void 0),rd(this,"maskAllElementAttributes",void 0),rd(this,"maskAttributeFn",void 0),rd(this,"keepIframeSrcFn",void 0),rd(this,"recordCanvas",void 0),rd(this,"canvasMaskingConfigured",void 0),rd(this,"inlineImages",void 0),rd(this,"slimDOMOptions",void 0),rd(this,"dataURLOptions",void 0),rd(this,"doc",void 0),rd(this,"mirror",void 0),rd(this,"iframeManager",void 0),rd(this,"stylesheetManager",void 0),rd(this,"shadowDomManager",void 0),rd(this,"canvasManager",void 0),rd(this,"processedNodeManager",void 0),rd(this,"unattachedDoc",void 0),rd(this,"canvasManagerReleased",!1),rd(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),rd(this,"emit",()=>{if(this.frozen||this.locked)return;const t=Ah(),e=Fh();try{this.processBufferedMutations()}finally{i=Ah()-t,n=e,Dh>0||Lh(i,null!=n?n:Oh)||i>Vh.slowestBatchMs&&(Vh.slowestBatchMs=i)}var i,n}),rd(this,"processBufferedMutations",()=>{const t=[],e=new Set,i=this.selectMaskingFn?{input:new WeakMap,content:new WeakMap,owner:new WeakMap}:void 0,n=t=>{let e=t,i=-2;for(;-2===i;)e=e&&gh.nextSibling(e),i=e&&this.mirror.getId(e);return i};let s;const r=r=>{var o;const l=gh.parentNode(r);if(!l||!Dv(r)||"TEXTAREA"===l.tagName)return!0;if(this.isBlockedAtEmission(l,i))return!0;if(this.selectMaskingFn&&Fd(r,this.maskInputOptions,this.selectMaskingFn,i))return!0;const a=ld(l)?this.mirror.getId(Lv(r)):this.mirror.getId(l),u=n(r);if(-1===a||-1===u)return!1;null!==(o=s)&&void 0!==o||(s=this.buildSerializationOptions());const c=cv(r,s,i);return c&&(t.push({parentId:a,nextId:u,node:c}),e.add(c.id)),!0};for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t);for(const t of this.movedSet)Uv(this.removesSubTreeCache,t)&&!this.movedSet.has(gh.parentNode(t))||this.addedSet.add(t);for(const t of Array.from(this.addedSet)){const e=Hv(this.droppedSet,t),i=Uv(this.removesSubTreeCache,t),n=this.movedSet.has(t)||Hv(this.movedSet,t);!e&&!i||n||(this.droppedSet.add(t),this.addedSet.delete(t))}const o=new Set;let l=null;const a=this.addedSet.values();let u=a.next();for(;this.addedSet.size;){let t=null;if(null!==l)for(t=gh.previousSibling(l);t&&-2===this.mirror.getId(t);)t=gh.previousSibling(t);if(t&&this.addedSet.has(t))l=t;else{for(this.addedSet.has(u.value)||(u=a.next()),l=u.value;;){const t=gh.parentNode(l),e=t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?gh.host(t):t;if(!e||!this.addedSet.has(e))break;l=e}const t=gh.parentNode(l);if(t&&this.addedSet.has(gh.lastChild(t)))l=gh.lastChild(t);else if(t)for(;;){let t=gh.nextSibling(l);for(;t&&-2===this.mirror.getId(t);)t=gh.nextSibling(t);if(!t||!this.addedSet.has(t))break;l=t}}this.addedSet.delete(l);const e=gh.parentNode(l),i=e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE?gh.host(e):e;i&&o.has(i)?o.add(l):r(l)||o.add(l)}o.size>0&&console.warn(`[rrweb] dropped ${o.size} node(s) with unresolved parent at emit`);const c={texts:Array.from(this.texts,([t,e])=>({node:t,value:e})).filter(t=>!this.isBlockedAtEmission(t.node,i)).map(t=>{const e=t.node,i=gh.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:Array.from(this.attributes.values()).filter(t=>!this.isBlockedAtEmission(t.node,i)).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]=xd({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},h=[];if(this.inlineStylesheet)for(const{id:t,attributes:e}of c.attributes){if(!("rel"in e)&&!("href"in e))continue;const i=this.mirror.getNode(t);i&&"link"===kd(i.nodeName)&&Zd(i.getAttribute("rel"))&&i.getAttribute("href")&&!i.disabled&&h.push(i)}this.texts.clear(),this.attributes.clear(),this.generatedAttributes=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={};const d=this.selectedAttributeChanges;this.selectedAttributeChanges=new Set,(c.texts.length||c.attributes.length||c.removes.length||c.adds.length)&&this.mutationCb(c);for(const t of d){var v;null===(v=jv.get(t.ownerDocument))||void 0===v||v.forEach(e=>e(t))}for(const t of h)this.stylesheetManager.inlineLinkStylesheetAfterChange(t,{currentId:()=>this.mirror.getId(t),reserializeWithoutCss:()=>({previous:this.mirror.getMeta(t),current:cv(t,ue(ue({},this.buildSerializationOptions()),{},{inlineStylesheet:!1}))}),lastSerialization:()=>this.mirror.getMeta(t),readdAsMove:()=>this.recordReinsertion(t)})}),rd(this,"bufferBelongsToIframe",t=>this.doc===t.contentDocument),rd(this,"genTextAreaValueMutation",t=>{let e=this.attributes.get(t);e||(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.set(t,e));const i=Array.from(gh.childNodes(t),t=>gh.textContent(t)||"").join("");e.attributes.value=wd({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Td(t),value:i,maskInputFn:this.maskInputFn})}),rd(this,"processMutation",t=>{if(!Mv(t.target,this.mirror,this.slimDOMOptions)){if(this.selectMaskingFn){var e;const i=null===(e=Tv(t.target))||void 0===e?void 0:e.closest("select");i&&this.selectedAttributeChanges.add(i)}switch(t.type){case"characterData":{const e=gh.textContent(t.target);Cv(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.set(t.target,Xd(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,Tv(t.target)):e.replace(/[\S]/g,"*"):e);break}case"attributes":{var i;const e=t.target,s=!this.selectMaskingFn||"http://www.w3.org/1999/xhtml"!==e.namespaceURI||"select"!==e.localName&&"option"!==e.localName?kd(e.tagName):e.localName,r=t.attributeName,o=null!==(i=t.attributeNamespace)&&void 0!==i?i: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}(e,r,o),a=o?e.getAttributeNS(o,r):t.target.getAttribute(r);if("option"===s&&"selected"===l&&(this.selectMaskingFn||this.maskInputOptions.select)){let i=gh.parentElement(e);if("OPTGROUP"===(null==i?void 0:i.tagName)&&(i=gh.parentElement(i)),this.selectMaskingFn||!this.maskInputFn||"SELECT"!==(null==i?void 0:i.tagName)||!i.multiple)return void(a!==t.oldValue&&"SELECT"===(null==i?void 0:i.tagName)&&this.selectedAttributeChanges.add(i))}if("value"===l){const t=e,i=Td(t);a=wd({element:t,maskInputOptions:Pd(t,this.maskInputOptions,this.selectMaskingFn),tagName:this.selectMaskingFn&&"select"===s?"select":e.tagName,type:i,value:a,maskInputFn:this.maskInputFn})}if(Cv(t.target,this.blockClass,this.blockSelector,!1)||a===t.oldValue)return;let u=this.attributes.get(t.target);const c="iframe"===s&&"src"===l;if(c&&!this.keepIframeSrcFn(a)&&e.contentDocument)return;if("type"===l&&"input"===s&&"password"===(t.oldValue||"").toLowerCase()&&e.setAttribute("data-rr-is-password","true"),!Qd(s,l)){var n;u||(u={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.set(t.target,u));const i=Jd(this.doc,s,kd(l),a,e,this.dataURLOptions);if(c&&!this.keepIframeSrcFn(a)&&(l="rr_src"),u.attributes[l]=i,null===(n=this.generatedAttributes.get(t.target))||void 0===n||n.delete(l),"style"===l){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const i=this.unattachedDoc.createElement("span"),n=e.style;t.oldValue&&(i.style.cssText=t.oldValue);for(const t of Array.from(n)){const e=n.getPropertyValue(t),s=n.getPropertyPriority(t);e!==i.style.getPropertyValue(t)||s!==i.style.getPropertyPriority(t)?u.styleDiff[t]=""===s?e:[e,s]:u._unchangedStyles[t]=[e,s]}for(const t of Array.from(i.style))""===n.getPropertyValue(t)&&(u.styleDiff[t]=!1)}else if("open"===l&&"dialog"===s){u.attributes.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal";let i=this.generatedAttributes.get(t.target);i||(i=new Set,this.generatedAttributes.set(t.target,i)),i.add("rr_open_mode")}}break}case"childList":if(t.removedNodes.forEach(t=>{Dv(t)||this.shadowDomManager.removeShadowRootsIn(t)}),Cv(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=ld(t.target)?this.mirror.getId(gh.host(t.target)):this.mirror.getId(t.target);Cv(t.target,this.blockClass,this.blockSelector,!1)||Mv(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(zv(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===i||Iv(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[qv(i,n)]?zv(this.movedSet,e):(this.removes.push({parentId:n,id:i,isShadow:!(!ld(t.target)||!ad(t.target))||void 0}),function(t,e){const i=[t];for(;i.length;){const t=i.pop();e.has(t)||(e.add(t),gh.childNodes(t).forEach(t=>i.push(t)))}}(e,this.removesSubTreeCache))),this.mapRemoves.add(e))})}}}),rd(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(Mv(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[qv(this.mirror.getId(t),i)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!Cv(t,this.blockClass,this.blockSelector,!1)){if(t.nodeType===t.TEXT_NODE)return;const e=gh.childNodes(t);for(let t=0,i=e.length;i>t;t++){const i=e[t];i&&this.genAdds(i)}if(Pv(t)){const e=gh.childNodes(gh.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","selectMaskingFn","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()}readPendingRecordsFrom(t){this.takePendingRecords=()=>t.takeRecords()}reset(){this.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){this.selectedAttributeChanges.clear();for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t)}isBlockedAtEmission(t,e){return Ev(t,this.blockClass,this.blockSelector)||!!this.selectMaskingFn&&!!t&&Fd(t,this.maskInputOptions,this.selectMaskingFn,e)}recordReinsertion(t){var e;const i=gh.parentNode(t);if(!i)return;null===(e=this.takePendingRecords)||void 0===e||e.call(this).forEach(this.processMutation);const n=(t,e)=>({type:"childList",target:i,removedNodes:t,addedNodes:e,oldValue:null,attributeName:null});this.processMutation(n([t],[])),this.processMutation(n([],[t])),this.emit()}buildSerializationOptions(){return{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,selectMaskingFn:this.selectMaskingFn,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:t=>{Av(t,this.mirror)&&this.iframeManager.addIframe(t),Ov(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Pv(t)&&!Cv(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(gh.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,i)=>{this.stylesheetManager.attachLinkElement(t,e,i)}}}};function zv(t,e){const i=[e];for(;i.length;){const e=i.pop();if(t.delete(e),e.nodeType===e.TEXT_NODE)continue;const n=gh.childNodes(e);for(let t=0,e=n.length;e>t;t++){const e=n[t];e&&i.push(e)}}}function Uv(t,e,i){return 0!==t.size&&function(t,e){const i=gh.parentNode(e);return!!i&&t.has(i)}(t,e)}function Hv(t,e){if(0===t.size)return!1;let i=gh.parentNode(e);for(;i;){if(t.has(i))return!0;i=gh.parentNode(i)}return!1}function Wv(t){Nv=t}function Vv(){Nv=void 0}var Gv=(t,e="rrweb")=>Nv?(...i)=>{try{return t(...i)}catch(t){if(Nv&&!0===Nv(t,e))return;throw t}}:t,Jv=[];function Qv(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 Zv(t,e){const i=new Bv;let n;i.init(t);try{n=new(fh())(Gv(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),i.readPendingRecordsFrom(n),Jv.push(i),{observer:n,buffer:i}}catch(t){try{null==n||n.disconnect(),i.destroy(),i.reset()}catch(t){}throw t}}function Kv({scrollCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){const o=new Map,l=r=>{const l=Qv(r);if(!l||Cv(l,n,s,!0))return;const a=i.getId(l);let u,c;if(l===e&&e.defaultView){const t=Sv(e.defaultView);u=t.left,c=t.top}else u=l.scrollLeft,c=l.scrollTop;const h=`${u},${c}`;o.get(a)!==h&&(o.set(a,h),t({id:a,x:u,y:c}))},a=Gv(l),u=new WeakMap,c=[vv("scroll",Gv(t=>{const e=t.target;if(!e)return;let i=u.get(e);i||(i=bv(a,r.scroll||100),u.set(e,i)),i(t)}),e)];return"onscrollend"in e&&c.push(vv("scrollend",Gv(l),e)),()=>c.forEach(t=>t())}function Yv(t,e){for(let i=Jv.length-1;i>=0;i--){const n=Jv[i];if(!n)continue;let s=n.bufferBelongsToIframe(t);!s&&e&&e.has(n.bufferDoc())&&(s=!0),s&&(n.reset(),Jv.splice(i,1))}}var Xv=["INPUT","TEXTAREA","SELECT"],tf=new WeakMap,ef=new WeakMap;function nf(t){return function t(e,i){if(cf("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||cf("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||cf("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||cf("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 sf(t,e,i){let n,s;return t?(t.ownerNode?n=e.getId(t.ownerNode):s=i.getId(t),{styleId:s,id:n}):{}}var rf=Symbol.for("rrweb.adoptedStyleSheets.rejected"),of=new WeakMap;function lf({mirror:t,stylesheetManager:e},i){var n,s;let r=null;r=t.getId("#document"===i.nodeName?i:gh.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=Object.getOwnPropertyDescriptor(i,"adoptedStyleSheets"),a=null!=l?l:(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(o.prototype,"adoptedStyleSheets"):void 0;if(null===r||-1===r||!o||!1===(null==l?void 0:l.configurable)||!(null==a?void 0:a.get)||!(null==a?void 0:a.set))return()=>{};const u={stylesheetManager:e,previousDescriptor:l,get:void 0},c={configurable:!0,enumerable:a.enumerable,get(){var t;return null===(t=a.get)||void 0===t?void 0:t.call(this)},set(t){let e;try{var i;e=null===(i=a.set)||void 0===i?void 0:i.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return rf;throw t}if(e===rf)return e;if(u.stylesheetManager&&null!==r&&-1!==r)try{u.stylesheetManager.adoptStyleSheets(t,r)}catch(t){}return e}};try{Object.defineProperty(i,"adoptedStyleSheets",c)}catch(t){return()=>{}}return u.get=c.get,of.set(c.set,u),Gv(()=>{u.stylesheetManager=void 0;const t=Object.getOwnPropertyDescriptor(i,"adoptedStyleSheets");if(!(null==t?void 0:t.configurable)||t.get!==c.get||t.set!==c.set)return;let e=l;for(;null==e?void 0:e.set;){const t=of.get(e.set);if(!t||t.stylesheetManager||t.get!==e.get)break;e=t.previousDescriptor}e?Object.defineProperty(i,"adoptedStyleSheets",e):delete i.adoptedStyleSheets})}var af=new Set;function uf(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:c,canvasMutationCb:h,fontCb:d,selectionCb:v,customElementCb:f}=t;t.mutationCb=(...t)=>{e.mutation&&e.mutation(...t),i(...t)},t.mousemoveCb=(...t)=>{e.mousemove&&e.mousemove(...t),n(...t)},t.mouseInteractionCb=(...t)=>{e.mouseInteraction&&e.mouseInteraction(...t),s(...t)},t.scrollCb=(...t)=>{e.scroll&&e.scroll(...t),r(...t)},t.viewportResizeCb=(...t)=>{e.viewportResize&&e.viewportResize(...t),o(...t)},t.inputCb=(...t)=>{e.input&&e.input(...t),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),c(...t)},t.canvasMutationCb=(...t)=>{e.canvasMutation&&e.canvasMutation(...t),h(...t)},t.fontCb=(...t)=>{e.font&&e.font(...t),d(...t)},t.selectionCb=(...t)=>{e.selection&&e.selection(...t),v(...t)},t.customElementCb=(...t)=>{e.customElement&&e.customElement(...t),f(...t)}}(t,e);const r=[],o=Gv(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=Jv.indexOf(s);-1!==t&&Jv.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==n||n.disconnect()}finally{gv(r)}}),l=(t,e)=>{const i=Gv(()=>{try{return e()}catch(e){throw af.add(t),e}})();"function"==typeof i&&r.push(i)};try{if(t.recordDOM&&l("mutation",()=>{const e=Zv(t,t.doc);n=e.observer,s=e.buffer}),l("move",()=>function({mousemoveCb:t,sampling:e,doc:i,mirror:n}){if(!1===e.mousemove)return()=>{};const s="number"==typeof e.mousemove?e.mousemove:50,r="number"==typeof e.mousemoveCallback?e.mousemoveCallback:500;let o,l=[];const a=bv(Gv(e=>{const i=Date.now()-o;t(l.map(t=>(t.timeOffset-=i,t)),e),l=[],o=null}),r),u=Gv(bv(Gv(t=>{const e=Qv(t),{clientX:i,clientY:s}=Rv(t)?t.changedTouches[0]:t;o||(o=kv()),l.push({x:i,y:s,id:n.getId(e),timeOffset:kv()-o}),a("drag"===t.type?Yc.Drag:"touchmove"===t.type?Yc.TouchMove:Yc.MouseMove)}),s,{trailing:!1})),c=[vv("mousemove",u,i),vv("touchmove",u,i),vv("drag",u,i)];return Gv(()=>{c.forEach(t=>t())})}(t)),l("mouseInteraction",()=>function({mouseInteractionCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){if(!1===r.mouseInteraction)return()=>{};const o=!0===r.mouseInteraction||void 0===r.mouseInteraction?{}:r.mouseInteraction,l=[];let a=null;return Object.keys(Xc).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t]).forEach(r=>{let o=kd(r);const u=(e=>r=>{const o=Qv(r);if(Cv(o,n,s,!0))return;let l=null,u=e;if("pointerType"in r){switch(r.pointerType){case"mouse":l=th.Mouse;break;case"touch":l=th.Touch;break;case"pen":l=th.Pen}l===th.Touch&&(Xc[e]===Xc.MouseDown?u="TouchStart":Xc[e]===Xc.MouseUp&&(u="TouchEnd"))}else Rv(r)&&(l=th.Touch);null!==l?(a=l,(u.startsWith("Touch")&&l===th.Touch||u.startsWith("Mouse")&&l===th.Mouse)&&(l=null)):Xc[e]===Xc.Click&&(l=a,a=null);const c=Rv(r)?r.changedTouches[0]:r;if(!c)return;const h=i.getId(o),{clientX:d,clientY:v}=c;Gv(t)(ue({type:Xc[u],id:h,x:d,y:v},null!==l&&{pointerType:l}))})(r);if(window.PointerEvent)switch(Xc[r]){case Xc.MouseDown:case Xc.MouseUp:o=o.replace("mouse","pointer");break;case Xc.TouchStart:case Xc.TouchEnd:return}l.push(vv(o,u,e))}),Gv(()=>{l.forEach(t=>t())})}(t)),l("scroll",()=>Kv(t)),l("viewportResize",()=>function({viewportResizeCb:t},{win:e}){let i=-1,n=-1;return vv("resize",Gv(bv(Gv(()=>{const e=xv(),s=$v();i===e&&n===s||(t({width:Number(s),height:Number(e)}),i=e,n=s)}),200)),e)}(t,{win:i})),l("input",()=>function({inputCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,ignoreClass:r,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,selectMaskingFn:u,sampling:c,userTriggeredOnInput:h}){let d=!0;const v=new Map;let f=!1;function p(t){return"SELECT"===t.tagName||!!u&&"select"===t.localName&&"http://www.w3.org/1999/xhtml"===t.namespaceURI}function g(t){const i=e.defaultView;if(t&&i&&!(t instanceof i.HTMLElement))return null;if(u&&"option"===(null==t?void 0:t.localName)&&"http://www.w3.org/1999/xhtml"===t.namespaceURI){let e=gh.parentElement(t);for(;e&&("select"!==e.localName||"http://www.w3.org/1999/xhtml"!==e.namespaceURI);)e=gh.parentElement(e);return e}return t&&"OPTION"===t.tagName&&(t=gh.parentElement(t))&&"OPTGROUP"===t.tagName&&(t=gh.parentElement(t)),t}function m(t){b(g(Qv(t)),t.isTrusted)}function y(t){return Array.from(t.selectedOptions).filter(t=>!Cv(t,n,s,!0))}function b(t,c,v=!1,f=!1){var g;const m=t&&(p(t)?"SELECT":t.tagName);var b;if(u&&"SELECT"===m&&((null===(b=Jv[0])||void 0===b?void 0:b.isFrozen())&&Jv.forEach(t=>t.unfreeze()),!d))return;if(!t||!m||0>Xv.indexOf(m)||Cv(t,n,s,!0))return;if(t.classList.contains(r)||o&&t.matches(o))return;const w=Td(t)||"",S=Pd(t,l,u);if(u&&(!d||Cv(t,n,s,!0)))return;const x=S[m.toLowerCase()]||S[w];let T="SELECT"===m?y(t):void 0;if(T&&(0>=i.getId(t)||T.some(t=>0>=i.getId(t)))){var C;if(null===(C=Jv[0])||void 0===C?void 0:C.isFrozen()){if(Jv.forEach(t=>t.unfreeze()),!d)return;T=y(t)}if(!v)return void _(t,c,f);if(0>=i.getId(t)||!x&&T.some(t=>0>=i.getId(t)))return}let E,M=T?(null===(g=T[0])||void 0===g?void 0:g.value)||"":t.value,I=!1;"radio"===w||"checkbox"===w?I=t.checked:x?M=wd({element:t,maskInputOptions:S,tagName:m,type:w,value:M,maskInputFn:a}):T&&(E=T.map(t=>i.getId(t)));const R={text:M,isChecked:I};E&&(R.selectedOptionIds=E),u&&T&&function(t,e,i){if("SELECT"!==t.nodeName)return;const n=e.getMeta(t),s=!!i||null;(null==n?void 0:n.type)!==nh.Element||!0!==n.attributes.rr_maskedSelect&&null!==n.attributes.rr_maskedSelect||n.attributes.rr_maskedSelect===s||e.add(t,ue(ue({},n),{},{attributes:ue(ue({},n.attributes),{},{rr_maskedSelect:s})}))}(t,i,!!x),h&&(R.userTriggered=c),k(t,R,f);const A=t.name;"radio"===w&&A&&I&&e.querySelectorAll(`input[type="radio"][name="${A}"]`).forEach(e=>{if(e!==t){const t=e.value;k(e,h?{text:t,isChecked:!I,userTriggered:!1}:{text:t,isChecked:!I})}})}function _(t,e,i=!1){var n;const s=v.get(t);v.set(t,{userTriggered:e||(null==s?void 0:s.userTriggered)||!1,fromMutation:i&&(null===(n=null==s?void 0:s.fromMutation)||void 0===n||n)}),f||(f=!0,T(w))}function w(){f=!1;const t=Array.from(v);v.clear(),gv(t.map(([t,{userTriggered:e,fromMutation:i}])=>()=>{d&&Gv(b)(t,e,!0,i)}))}function k(e,n,s=!1){var r,o,l;const a=p(e)?ef:tf,u=a.get(e);if(!u||u.text!==n.text||u.isChecked!==n.isChecked||(null===(r=u.selectedOptionIds)||void 0===r?void 0:r.length)!==(null===(o=n.selectedOptionIds)||void 0===o?void 0:o.length)||(null===(l=n.selectedOptionIds)||void 0===l?void 0:l.some((t,e)=>{var i;return t!==(null===(i=u.selectedOptionIds)||void 0===i?void 0:i[e])}))){a.set(e,n);const r=i.getId(e);Gv(t)(ue(ue({},n),{},{id:r}),s)}}const S=("last"===c.input?["change"]:["input","change"]).map(t=>vv(t,Gv(m),e)),x=e.defaultView;if(!x)return()=>{S.forEach(t=>t())};const T=_v(x),C=x.Object.getOwnPropertyDescriptor(x.HTMLInputElement.prototype,"value");return C&&C.set&&S.push(...[[x.HTMLInputElement.prototype,"value"],[x.HTMLInputElement.prototype,"checked"],[x.HTMLSelectElement.prototype,"value"],[x.HTMLTextAreaElement.prototype,"value"],[x.HTMLSelectElement.prototype,"selectedIndex"],[x.HTMLOptionElement.prototype,"selected"]].map(t=>wv(t[0],t[1],{set(){if(!d)return;const t=Gv(g)(this);t&&(p(t)?_(t,!1):Gv(b)(t,!1))}},!1,x))),S.unshift(function(t,e){const i=jv.get(t)||new Set;return jv.set(t,i),i.add(e),()=>{i.delete(e),i.size||jv.get(t)!==i||jv.delete(t)}}(e,Gv(t=>{i.getId(t)>0&&Dv(t)&&!Ev(t,n,s)&&b(t,!1,!1,!!u)}))),Gv(()=>{gv([w]),d=!1,v.clear(),gv(S)})}(t)),l("mediaInteraction",()=>function({mediaInteractionCb:t,blockClass:e,blockSelector:i,mirror:n,sampling:s,doc:r}){const o=Gv(r=>bv(Gv(s=>{const o=Qv(s);if(!function(t){const e=null==t?void 0:t.tagName;if("string"!=typeof e)return!1;const i=kd(e);return"video"===i||"audio"===i}(o)||Cv(o,e,i,!0))return;const{currentTime:l,volume:a,muted:u,playbackRate:c,loop:h}=o;t({type:r,id:n.getId(o),currentTime:l,volume:a,muted:u,playbackRate:c,loop:h})}),s.media||500)),l=[vv("play",o(ih.Play),r),vv("pause",o(ih.Pause),r),vv("seeked",o(ih.Seeked),r),vv("volumechange",o(ih.VolumeChange),r),vv("ratechange",o(ih.RateChange),r)];return Gv(()=>{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 c={emit:l,ready:!1};u.push(c);let h,d=!1,v=!1;const f=()=>{d||v||(d=!0,void 0!==h&&i.delete(h),c.ready=!0,c.emit=void 0,r(o))};try{h=t.setTimeout(f,5e3),d||v?t.clearTimeout(h):i.add(h)}catch(t){f()}return e=>{!v&&n&&(v=!0,void 0!==h&&(t.clearTimeout(h),i.delete(h)),d?e&&s(a):(c.ready=!0,e||(c.emit=void 0),r(o)))}},reset(){n=!1,i.forEach(e=>t.clearTimeout(e)),i.clear(),e.clear()}}}(i);r.push(e.reset),l("styleSheet",()=>function({styleSheetRuleCb:t,mirror:e,stylesheetManager:i},{win:n,mutationQueue:s}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const r=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:Gv((n,r,o)=>{const[l]=o,a=n.apply(r,o);Th(r.cssRules[a],l),i.onCssomSheetMutation(r);const{id:u,styleId:c}=sf(r,e,i.styleMirror);return(u&&-1!==u||c&&-1!==c)&&s.queueMutation(r,()=>t({id:u,styleId:c,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:Gv((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:c}=sf(r,e,i.styleMirror);return(u&&-1!==u||c&&-1!==c)&&s.queueMutation(r,()=>t({id:u,styleId:c,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:Gv((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;const o=i.onCssomSheetMutation(r),{id:u,styleId:c}=sf(r,e,i.styleMirror),h=u&&-1!==u||c&&-1!==c?s.queuePendingMutation(r,()=>t({id:u,styleId:c,replace:l}),()=>{const e=dd(r);null!==e&&t({id:u,styleId:c,replace:e})}):void 0;try{n.call(a,()=>{i.isCurrentCssomMutation(r,o)&&Ch(r,l),null==h||h(!0)},()=>null==h?void 0:h(!1))}catch(t){null==h||h(!1)}}catch(t){}return a},"host")})),n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Gv((n,r,o)=>{const[l]=o,a=n.apply(r,o);Ch(r,l),i.onCssomSheetMutation(r);const{id:u,styleId:c}=sf(r,e,i.styleMirror);return(u&&-1!==u||c&&-1!==c)&&s.queueMutation(r,()=>t({id:u,styleId:c,replaceSync:l})),a},"host")}));const u={};hf("CSSGroupingRule")?u.CSSGroupingRule=n.CSSGroupingRule:(hf("CSSMediaRule")&&(u.CSSMediaRule=n.CSSMediaRule),hf("CSSConditionRule")&&(u.CSSConditionRule=n.CSSConditionRule),hf("CSSSupportsRule")&&(u.CSSSupportsRule=n.CSSSupportsRule));const c={};return Object.entries(u).forEach(([n,r])=>{c[n]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(c[n].insertRule,{apply:Gv((n,r,o)=>{const[l]=o,a=n.apply(r,o);Th(r.cssRules[a],l),i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:c}=sf(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||c&&-1!==c)){const e=[...nf(r),a];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:c,adds:[{rule:l,index:e}]}))}return a},"host")}),r.prototype.deleteRule=new Proxy(c[n].deleteRule,{apply:Gv((n,r,o)=>{const[l]=o,a=n.apply(r,o);$h(r),i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:c}=sf(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||c&&-1!==c)){const e=[...nf(r),l];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:c,removes:[{index:e}]}))}return a},"host")})}),Gv(()=>{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=c[t].insertRule,e.prototype.deleteRule=c[t].deleteRule})})}(t,{win:i,mutationQueue:e})),l("adoptedStyleSheet",()=>lf(t,t.doc)),l("styleDeclaration",()=>function({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:i,stylesheetManager:n},{win:s,mutationQueue:r}){const o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Gv((s,o,l)=>{var a;const[u,c,h]=l,d=s.apply(o,l);if($h(o.parentRule),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}=sf(v,e,n.styleMirror);if(f&&-1!==f||p&&-1!==p){const e=nf(o.parentRule);r.queueMutation(v,()=>t({id:f,styleId:p,set:{property:u,value:c,priority:h},index:e}))}return d},"host")});const l=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:Gv((s,o,l)=>{var a;const[u]=l,c=s.apply(o,l);if($h(o.parentRule),i.has(u))return c;const h=null===(a=o.parentRule)||void 0===a?void 0:a.parentStyleSheet;n.onCssomSheetMutation(h);const{id:d,styleId:v}=sf(h,e,n.styleMirror);if(d&&-1!==d||v&&-1!==v){const e=nf(o.parentRule);r.queueMutation(h,()=>t({id:d,styleId:v,remove:{property:u},index:e}))}return c},"host")}),Gv(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=l})}(t,{win:i,mutationQueue:e})),t.collectFonts&&l("font",()=>function({fontCb:t,doc:e}){const i=e.defaultView;if(!i)return()=>{};const n=[],s=new WeakMap,r=i.FontFace;i.FontFace=function(t,e,i){const n=new r(t,e,i);return s.set(n,{family:t,buffer:"string"!=typeof e,descriptors:i,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),n};const o=ph(e.fonts,"add",function(e){return function(i){return setTimeout(Gv(()=>{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),Gv(()=>{n.forEach(t=>t())})}(t))}l("selection",()=>function(t){const{doc:e,mirror:i,blockClass:n,blockSelector:s,selectionCb:r}=t;let o=!0;const l=Gv(()=>{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);Cv(r,n,s,!0)||Cv(a,n,s,!0)||l.push({start:i.getId(r),startOffset:o,end:i.getId(a),endOffset:u})}r({ranges:l})});return l(),vv("selectionchange",l)}(t)),l("customElement",()=>function({doc:t,customElementCb:e}){const i=t.defaultView;return i&&i.customElements?ph(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)l(`plugin:${e.name}`,()=>e.observer(e.callback,i,e.options))}catch(t){try{o()}catch(t){}throw t}return o}function cf(t){return void 0!==window[t]}function hf(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}function df(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)}}var vf,ff,pf=class{constructor(t){rd(this,"generateIdFn",void 0),rd(this,"iframeRemoteIdToLocalIdMap",new WeakMap),rd(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}},gf=class{constructor(t){rd(this,"iframes",new WeakMap),rd(this,"crossOriginIframeMap",new WeakMap),rd(this,"crossOriginIframeMirror",new pf(qd)),rd(this,"crossOriginIframeStyleMirror",void 0),rd(this,"crossOriginIframeRootIdMap",new WeakMap),rd(this,"mirror",void 0),rd(this,"mutationCb",void 0),rd(this,"wrappedEmit",void 0),rd(this,"loadListener",void 0),rd(this,"pageHideListener",void 0),rd(this,"stylesheetManager",void 0),rd(this,"recordCrossOriginIframes",void 0),rd(this,"blockClass",void 0),rd(this,"blockSelector",void 0),rd(this,"messageHandler",void 0),rd(this,"nestedIframeListeners",new Map),rd(this,"attachedWindows",new WeakMap),rd(this,"attachedDocuments",new WeakMap),rd(this,"attachedIframes",new Map),rd(this,"loadListenerDisposers",new WeakMap),rd(this,"iframeElementsById",new Map),rd(this,"pageHideHandlers",new WeakMap),this.blockClass=t.blockClass,this.blockSelector=t.blockSelector,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new pf(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){Kd(t,this.blockClass,this.blockSelector)||(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=>pv(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{fv(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);pv(()=>{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)})}pv(()=>{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,!0===e.data.nonInteractive)}transformCrossOriginEvent(t,e){switch(e.type){case Kc.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:Kc.IncrementalSnapshot,data:{source:Yc.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Kc.Meta:case Kc.Load:case Kc.DomContentLoaded:return!1;case Kc.Plugin:return e;case Kc.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case Kc.IncrementalSnapshot:switch(e.data.source){case Yc.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 Yc.Drag:case Yc.TouchMove:case Yc.MouseMove:return e.data.positions.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case Yc.ViewportResize:return!1;case Yc.MediaInteraction:case Yc.MouseInteraction:case Yc.Scroll:case Yc.CanvasMutation:return this.replaceIds(e.data,t,["id"]),e;case Yc.Input:return this.replaceIds(e.data,t,["id","selectedOptionIds"]),e;case Yc.StyleSheetRule:case Yc.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case Yc.Font:return e;case Yc.Selection:return e.data.ranges.forEach(e=>{this.replaceIds(e,t,["start","end"])}),e;case Yc.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===nh.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&&(fv(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(i)),t&&this.nestedIframeListeners.has(t)&&(fv(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=>{pv(()=>this.mirror.removeNodeFromMap(t))}),pv(()=>Yv(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&&fv(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{fv(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}},mf=new Map,yf=new WeakMap;function bf(t){t.dispose(),mf.get(t.win)===t&&mf.delete(t.win)}function _f(){(null==ff?void 0:ff.valid)&&(ff.valid=!1,(null==vf?void 0:vf.stopped)?Rh():Ih())}var wf=class{constructor(t,e){rd(this,"win",void 0),rd(this,"owned",new Map),rd(this,"pending",new Set),rd(this,"stopped",!1),rd(this,"ready",!1),this.win=t;try{const n=ff;if(e&&(null==n?void 0:n.valid)&&n.stopCompleted&&!n.next&&["interactive","complete"].includes(t.document.readyState)){n.next=this;for(const e of n.retained)try{var i;e.win.CSSRule.prototype!==e.prototype||e.win!==t&&!(null===(i=e.win.frameElement)||void 0===i?void 0:i.isConnected)||(this.acquire(e.win),e.win!==t&&this.pending.add(e.win))}catch(t){}}else{if(_f(),n){for(const t of n.retained)0===t.owners&&bf(t);n.retained.clear()}Ih(),wh=new WeakSet,kh=!1}vf=this,e&&this.acquire(t)}catch(t){throw this.stop(),t}}acquire(t){if(!t.CSSRule)return Rh(),()=>{};const e=this.owned.get(t);if(e)return e;let i=mf.get(t);if(!i){const e=function(t){const e={active:!0};return mh.set(t,e),()=>{e.active=!1,mh.get(t)===e&&mh.delete(t)}}(t.CSSRule.prototype);let n;try{n=function(t){const e=[],i=(t,i)=>{const n="appendRule"===i||"deleteRule"===i||"insertRule"===i,s=Object.getOwnPropertyDescriptor(t,i);if(!s)return void(("style"===i||n)&&Rh());const r="style"===i||"styleMap"===i||"media"===i;if(!s.configurable||r&&!s.get||n&&"function"!=typeof s.value)return void Rh();const o=ue({},s);if(n&&(o.value=new Proxy(s.value,{apply(t,e,i){const n=t.apply(e,i);return Mh(e),n}})),s.get&&r){const t=s.get;o.get=function(){const e=t.call(this);return Mh(this),e}}if(s.set){const t=s.set;o.set=function(e){const i=t.call(this,e);return Mh(this),i}}try{Object.defineProperty(t,i,o),e.push(()=>{const e=Object.getOwnPropertyDescriptor(t,i);(null==e?void 0:e.get)===o.get&&(null==e?void 0:e.set)===o.set&&(null==e?void 0:e.value)===o.value&&Object.defineProperty(t,i,s)})}catch(t){Rh()}};try{var n,s,r;const o=t;for(const e of[t.CSSStyleRule,t.CSSKeyframeRule,t.CSSPageRule,t.CSSFontFaceRule,o.CSSNestedDeclarations,o.CSSMarginRule,o.CSSPositionTryRule])e&&(i(e.prototype,"style"),i(e.prototype,"styleMap"));for(const e of[t.CSSMediaRule,t.CSSImportRule])e&&i(e.prototype,"media");t.CSSStyleRule&&i(t.CSSStyleRule.prototype,"selectorText"),t.CSSKeyframeRule&&i(t.CSSKeyframeRule.prototype,"keyText"),t.CSSKeyframesRule&&(i(t.CSSKeyframesRule.prototype,"name"),i(t.CSSKeyframesRule.prototype,"appendRule"),i(t.CSSKeyframesRule.prototype,"deleteRule"));const l=t.CSSGroupingRule?[t.CSSGroupingRule]:[t.CSSMediaRule,t.CSSConditionRule,t.CSSSupportsRule];for(const t of l)t&&(i(t.prototype,"insertRule"),i(t.prototype,"deleteRule"));const a=null===(n=t.CSSStyleRule)||void 0===n?void 0:n.prototype;for(const t of["insertRule","deleteRule"])a&&{}.hasOwnProperty.call(a,t)&&i(a,t);const u=null===(s=t.CSSRule)||void 0===s?void 0:s.prototype;return u&&(null===(r=Object.getOwnPropertyDescriptor(u,"cssText"))||void 0===r?void 0:r.set)&&i(u,"cssText"),()=>gv(e)}catch(t){throw gv(e),Rh(),t}}(t)}catch(t){throw e(),t}i={win:t,prototype:t.CSSRule.prototype,owners:0,dispose:()=>gv([e,n])},mf.set(t,i)}const n=i;n.owners++;const s=()=>{this.owned.get(t)===s&&(this.owned.delete(t),this.pending.delete(t),n.owners--,0===n.owners&&((null==ff?void 0:ff.valid)&&ff.previous===this&&ff.stopStarted?ff.retained.add(n):bf(n)))};return this.owned.set(t,s),s}observe(t){return this.prune(),this.pending.delete(t),t===this.win?()=>{}:this.acquire(t)}prune(){for(const i of this.pending){var t;try{var e;const t=mf.get(i);if((null===(e=i.frameElement)||void 0===e?void 0:e.isConnected)&&i.CSSRule.prototype===(null==t?void 0:t.prototype))continue}catch(t){}null===(t=this.owned.get(i))||void 0===t||t()}}beforeStop(){(null==ff?void 0:ff.previous)===this&&ff.valid&&!ff.stopStarted?ff.stopStarted=!0:_f()}stop(){if(!this.stopped){for(const t of[...this.owned.values()])t();this.stopped=!0,(null==ff?void 0:ff.valid)&&ff.previous===this?ff.stopCompleted=!0:vf===this&&(Rh(),vf=void 0)}}},kf=class{constructor(t){rd(this,"shadowDoms",new Map),rd(this,"mutationCb",void 0),rd(this,"scrollCb",void 0),rd(this,"bypassOptions",void 0),rd(this,"mirror",void 0),rd(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(!ad(t))return;if(this.shadowDoms.has(t))return;const s=null!==(i=null===(n=gh.host(t))||void 0===n?void 0:n.ownerDocument)&&void 0!==i?i:e,r={doc:s,handlers:[]};this.shadowDoms.set(t,r);const{observer:o,buffer:l}=Zv(ue(ue({},this.bypassOptions),{},{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);r.handlers.push(()=>{o.disconnect(),l.destroy(),l.releaseCanvasManager();const t=Jv.indexOf(l);-1!==t&&Jv.splice(t,1)}),r.handlers.push(Kv(ue(ue({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))),setTimeout(()=>{this.shadowDoms.get(t)===r&&(t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(gh.host(t))),r.handlers.push(lf({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)))},0)}removeShadowRootsIn(t){if(0===this.shadowDoms.size)return;const e=gh.shadowRoot(t);e&&(this.shadowDoms.has(e)&&this.removeShadowRoot(e),this.removeShadowRootsIn(e)),gh.childNodes(t).forEach(t=>this.removeShadowRootsIn(t))}removeShadowRoot(t){const e=this.shadowDoms.get(t);this.shadowDoms.delete(t),null==e||e.handlers.forEach(Sf)}observeAttachShadow(t){pv(()=>{const e=t.contentWindow,i=t.contentDocument;e&&i&&this.patchAttachShadow(e.Element,i)})}patchAttachShadow(t,e){const i=this;this.restoreHandlers.push({doc:e,handler:ph(t.prototype,"attachShadow",function(t){return function(n){const s=t.call(this,n),r=gh.shadowRoot(this);return r&&Dv(this)&&i.addShadowRoot(r,e),s}})})}reset(){this.restoreHandlers.forEach(({handler:t})=>Sf(t)),this.restoreHandlers=[];const t=this.shadowDoms;this.shadowDoms=new Map,t.forEach(({handlers:t})=>t.forEach(Sf))}resetForDoc(t){const e=[];for(const i of this.restoreHandlers)i.doc===t?Sf(i.handler):e.push(i);this.restoreHandlers=e,this.shadowDoms.forEach((e,i)=>{e.doc===t&&this.removeShadowRoot(i)})}};function Sf(t){try{t()}catch(t){}}var xf="skip-frame";function $f(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 Tf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cf="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Ef=0;64>Ef;Ef++)Cf[Tf.charCodeAt(Ef)]=Ef;var Mf=function(t){var e,i=new Uint8Array(t),n=i.length,s="";for(e=0;n>e;e+=3)s+=Tf[i[e]>>2],s+=Tf[(3&i[e])<<4|i[e+1]>>4],s+=Tf[(15&i[e+1])<<2|i[e+2]>>6],s+=Tf[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},If=!1,Rf=new Map,Af=(t,e,i)=>{if(!t||!Ff(t,e)&&"object"!=typeof t)return;const n=function(t,e){let i=Rf.get(t);return i||(i=new Map,Rf.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 Of(t,e,i,n){if(t instanceof Array)return t.map(t=>Of(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:Mf(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Of(t.buffer,e,i,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const e=t.constructor.name,{src:i}=t;return{rr_type:e,src:i}}if(t instanceof HTMLCanvasElement){const e="HTMLImageElement";let i;try{i=t.toDataURL(n.type,n.quality)}catch(t){throw function(t){"SecurityError"===(null==t?void 0:t.name)?If||(If=!0,console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read. A cross-origin image or video drawn into it taints it.",t)):console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read.",t)}(t),t}return{rr_type:e,src:i}}return t instanceof ImageData?{rr_type:t.constructor.name,args:[Of(t.data,e,i,n),t.width,t.height]}:Ff(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:Af(t,e,i)}:t}var Pf=(t,e,i,n)=>t.map(t=>Of(t,e,i,n)),Ff=(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]))},Lf=["webgl","webgl2"];function Df(t){return"nodeType"in t}function Nf(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 ph(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||Df(r)&&Cv(r,e,i,!0))return n.call(this,s);Df(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=ph(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(s,...r){const o=function(t){return"experimental-webgl"===t?"webgl":t}(s);if(!Cv(this,e,i,!0)&&("__context"in this||(this.__context=o),n&&Lf.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 jf(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=ph(t,u,function(t){return function(...l){const a=t.apply(this,l);if(Af(a,r,this),this.canvas&&"tagName"in this.canvas&&!Cv(this.canvas,n,s,!0)){let t;try{t=Pf(l,r,this,o)}catch(t){}t&&i(this.canvas,{type:e,property:u,args:t})}return a}});l.push(a)}catch(r){const o=wv(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!Cv(this.canvas,n,s,!0)&&i(this.canvas,{type:e,property:u,args:[t],setter:!0})}});l.push(o)}return l}var qf='(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\tlet webpProbeStarted = false;\n\tlet noWebpEncoder = false;\n\tfunction probeWebpEncoder() {\n\t\twebpProbeStarted = true;\n\t\tnew OffscreenCanvas(1, 1).convertToBlob({ type: "image/webp" }).then((blob) => {\n\t\t\tnoWebpEncoder = blob.type !== "image/webp";\n\t\t}).catch(() => void 0);\n\t}\n\tfunction isOpaque(pixels) {\n\t\tfor (let i = 3; i < pixels.length; i += 4) if (pixels[i] !== 255) return false;\n\t\treturn true;\n\t}\n\tfunction encodeOptions(options, pixels) {\n\t\tif (options.type !== "image/webp") return options;\n\t\tif (!webpProbeStarted) probeWebpEncoder();\n\t\treturn noWebpEncoder && isOpaque(pixels) ? {\n\t\t\t...options,\n\t\t\ttype: "image/jpeg"\n\t\t} : options;\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 pixels = ctx.getImageData(0, 0, width, height).data;\n\t\t\t\tconst fingerprint = frameFingerprint(width, height, pixels);\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(encodeOptions(dataURLOptions, pixels));\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',Bf="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",qf],{type:"text/javascript;charset=utf-8"});function zf(t){let e;try{if(e=Bf&&(self.URL||self.webkitURL).createObjectURL(Bf),!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(qf),{name:null==t?void 0:t.name})}}var Uf="A page CSP that omits blob: from worker-src or script-src blocks it";function Hf(t,...e){console.warn(`[replay] canvas capture: ${t}`,...e)}var Wf=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){rd(this,"pendingCanvasMutations",new Map),rd(this,"rafStamps",{latestId:0,invokeId:null}),rd(this,"mirror",void 0),rd(this,"mutationCb",void 0),rd(this,"resetObservers",void 0),rd(this,"frozen",!1),rd(this,"locked",!1),rd(this,"rafIdTimestamp",null),rd(this,"rafIdFlush",null),rd(this,"refCount",0),rd(this,"torndown",!1),rd(this,"resetFrameDedup",null),rd(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 void Hf("disabled because this browser does not support OffscreenCanvas");const o="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,l=Nf(e,i,n,!0),a=new Map;let u;try{u=new zf}catch(t){return Hf(`disabled because the encode worker did not start. ${Uf}`,t),void l()}let c=!1;u.onerror=t=>{var e;c=!0,Hf(`stopped because the encode worker failed. ${Uf}`,t),cancelAnimationFrame(f),null===(e=u.terminate)||void 0===e||e.call(u),this.resetFrameDedup=null},this.resetFrameDedup=()=>{u.postMessage({resetFrameDedup:!0})},u.onmessage=t=>{const{id:e}=t.data;if(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:eh["2D"],commands:[{property:"clearRect",args:[0,0,s,r]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:n}]},0,0,s,r]}],displayWidth:s,displayHeight:r})};let h=!1,d=!1;const v=1e3/t;let f,p=0;const g=t=>{var l;c||(p&&v>t-p||(p=t,(()=>{const t=[],s=e=>{try{e.querySelectorAll("canvas").forEach(e=>{Cv(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(-1!==e&&!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,c=Math.max(1,Math.round(r*o)),d=Math.max(1,Math.round(l*o)),v=function(t,e,i,n,s,r){if(!t||"function"!=typeof t.regionsFn)return;let o;try{o=t.regionsFn(e)}catch(t){return xf}if(void 0===o)return;if(!Array.isArray(o)||!o.every($f))return xf;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,c,d,r,l);if("skip-frame"===v)return h||(h=!0,Hf("dropped a frame because the mask provider did not return valid regions. A provider that always fails records no canvas frames at all")),void a.set(e,!1);const f=yield createImageBitmap(t,1>o?{resizeWidth:c,resizeHeight:d,resizeQuality:"medium"}:{resizeWidth:c,resizeHeight:d});u.postMessage({id:e,bitmap:f,width:c,height:d,displayWidth:r,displayHeight:l,dataURLOptions:s.dataURLOptions,maskRegions:v},[f])}catch(t){d||(d=!0,Hf("dropped a frame because the snapshot failed. A canvas that fails every frame records no canvas frames at all",t)),a.set(e,!1)}}}),function(t){return l.apply(this,arguments)}))),f=requestAnimationFrame(g))};f=requestAnimationFrame(g),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(f),null===(t=u.terminate)||void 0===t||t.call(u),this.resetFrameDedup=null}}initCanvasMutationObserver(t,e,i,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=Nf(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=ph(e.CanvasRenderingContext2D.prototype,l,function(r){return function(...o){return Cv(this.canvas,i,n,!0)||setTimeout(()=>{let i;try{i=Pf(o,e,this,s)}catch(t){return}t(this.canvas,{type:eh["2D"],property:l,args:i})},0),r.apply(this,o)}});r.push(o)}catch(s){const o=wv(e.CanvasRenderingContext2D.prototype,l,{set(e){Cv(this.canvas,i,n,!0)||t(this.canvas,{type:eh["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(...jf(e.WebGLRenderingContext.prototype,eh.WebGL,t,i,n,e,s)),void 0!==e.WebGL2RenderingContext&&r.push(...jf(e.WebGL2RenderingContext.prototype,eh.WebGL2,t,i,n,e,s)),()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,i,n);this.resetObservers=()=>{s(),r(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,e)=>{const i=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,i)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,e){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(t);if(!i||-1===e)return;const n=i.map(t=>ws(t,Zc)),{type:s}=i[0];this.mutationCb({id:e,type:s,commands:n}),this.pendingCanvasMutations.delete(t)}};function Vf(t){var e,i,n;const s={};for(const n of Object.keys(null!==(e=null===(i=t.previous)||void 0===i?void 0:i.attributes)&&void 0!==e?e:{}))s[n]=null;return Object.assign(s,null===(n=t.current)||void 0===n?void 0:n.attributes),delete s.rel,delete s.href,s}var Gf,Jf,Qf,Zf=class{constructor(t){var e,i,n;rd(this,"trackedLinkElements",new WeakSet),rd(this,"pendingDeferredSheets",new Set),rd(this,"cssomRevisions",new WeakMap),rd(this,"stopped",!1),rd(this,"changedLinkJobs",new Map),rd(this,"linksInlinedSinceSnapshot",new WeakSet),rd(this,"mutationCb",void 0),rd(this,"adoptedStyleSheetCb",void 0),rd(this,"maskAllElementAttributes",void 0),rd(this,"maskAttributeFn",void 0),rd(this,"blockClass",void 0),rd(this,"blockSelector",void 0),rd(this,"styleMirror",new Fv),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(e=t.maskAllElementAttributes)&&void 0!==e&&e,this.maskAttributeFn=t.maskAttributeFn,this.blockClass=null!==(i=t.blockClass)&&void 0!==i?i:"rr-block",this.blockSelector=null!==(n=t.blockSelector)&&void 0!==n?n:null}isLinkBlocked(t){return Ev(t,this.blockClass,this.blockSelector)}attachLinkElement(t,e,i=null){this.stopped||!("_cssText"in e.attributes)||this.isLinkBlocked(t)||(this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:Vf({previous:i,current:e})}]}),this.linksInlinedSinceSnapshot.add(t)),this.trackLinkElement(t)}beginDeferredLinkInlining(t,e,i={}){var n;const s=null!==(n=i.emitCssText)&&void 0!==n?n:i=>this.emitCssTextMutation(t,e,i);if(-1===e||!t.isConnected)return null;let r=null,o=null;try{o=t.sheet,o&&(r=function(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||cd(e)}catch(t){s=e.cssText}try{var n;s&&(null===(n=e.styleSheet)||void 0===n?void 0:n.href)&&(s=Rd(s,e.styleSheet.href))}catch(t){}s&&t.parts.push(s),t.index+=1}catch(t){r(null)}}function l(t){var i;const n=t.rules[t.index];if("sheet"===t.kind&&pd(n)){const i=s.get(n);return null===i?(t.parts.push(n.cssText),void(t.index+=1)):i?void e.push({kind:"sheet",sheet:i.sheet,rules:i.rules,sheetHref:i.sheetHref,index:0,parts:[],importRule:n}):void o(t,n,null)}if(function(t,i){try{if(void 0!==Eh(t))return!1;const n=bd(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?Rd(n,s):n,fixColons:"sheet"===i.kind&&gd(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(n,t))return;let r=null!==(i=Eh(n))&&void 0!==i?i:n.cssText;"sheet"===t.kind&&gd(n)&&n.selectorText.includes(":")&&(r=fd(r)),t.parts.push(t.sheetHref?Rd(r,t.sheetHref):r),t.index+=1}return function(t){try{const i=t.rules||t.cssRules;if(!i)return!1;Kh(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,!pd(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;Kh(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=Ah();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?fd(i):i}else e=ud(t.parts.join(""))}catch(t){}r(e);continue}o-=1;try{l(t)}catch(t){r(null)}}}catch(t){i=!0,n=null}finally{Xh(Ah()-s)}return i},text(){return i?n:null},remainingRules(){if(i)return 0;let t=0;for(const i of e)t+=i.rules.length-i.index;return t}}}(o))}catch(t){}var l;if(!r||!o)return id(),null===(l=i.onUninlinable)||void 0===l||l.call(i),null;const a=r;let u=!1;const c={sheet:o,invalidate(){u=!0}};this.pendingDeferredSheets.add(c);let h=!1;return{advance:e=>{if(h)return!0;const n=Ah(),r=Fh();let l=!0;try{if(u)return h=!0,i.onInvalidatedBySheetMutation?i.onInvalidatedBySheetMutation():id(),!0;if(!a.advance(e))return l=!1,!1;h=!0;const n=a.text();if(!t.isConnected)return!0;let r=null;try{r=t.sheet}catch(t){}return r!==o?(id(),!0):n?(this.isLinkBlocked(t)||s(n),!0):(id(),null===(d=i.onUninlinable)||void 0===d||d.call(i),!0);var d}finally{l&&this.pendingDeferredSheets.delete(c),Lh(v=Ah()-n,null!=(f=r)?f:Oh)||(Gh.totalMs+=v,v>Gh.slowestSliceMs&&(Gh.slowestSliceMs=v))}var v,f},remainingRules:()=>a.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(c)}}}onCssomSheetMutation(t){var e;if(!t)return;const i=(null!==(e=this.cssomRevisions.get(t))&&void 0!==e?e:0)+1;this.cssomRevisions.set(t,i);for(const e of this.pendingDeferredSheets)e.sheet===t&&(this.pendingDeferredSheets.delete(e),e.invalidate());return i}isCurrentCssomMutation(t,e){return!this.stopped&&this.cssomRevisions.get(t)===e}inlineLinkStylesheetAfterChange(t,e){this.stopped||-1===e.currentId()||function(t,e){const i=nv(t),n=ev.get(t);if(n)return void(n.changedLinkBaseline&&(n.changedLinkBaseline.sheetAtLatestChange=i));const s={sheetAtLatestChange:i},r=()=>{const e=nv(t);return Boolean(e&&(e!==s.sheetAtLatestChange||e.href===t.href))};r()?e():sv(t,e,r,rv,s)}(t,()=>this.inlineChangedLinkStylesheet(t,e,3))}inlineChangedLinkStylesheet(t,e,i){var n;const s=e.currentId();if(this.stopped||!t.isConnected||-1===s||this.isLinkBlocked(t))return;null===(n=this.changedLinkJobs.get(t))||void 0===n||n.drop();let r=!1;const o=this.beginDeferredLinkInlining(t,s,{emitCssText:i=>this.emitCssTextMutation(t,s,i,Vf(e.reserializeWithoutCss())),onInvalidatedBySheetMutation(){r=!0},onUninlinable:()=>this.readdAsPlainLink(t,e)});if(!o)return;let l=null;const a=()=>{o.discard(),null==l||l.cancel(),l=null,this.changedLinkJobs.get(t)===u&&this.changedLinkJobs.delete(t)},u={remainingRules:()=>o.remainingRules(),runSlice:()=>{try{return this.stopped||this.changedLinkJobs.get(t)!==u||-1===e.currentId()||this.isLinkBlocked(t)?(a(),!0):!!o.advance(200)&&(a(),!r||(i>0?this.inlineChangedLinkStylesheet(t,e,i-1):id(),!0))}catch(t){return a(),!0}},drop:a};this.changedLinkJobs.set(t,u);const c=t=>{l=null;let e,i=0;do{e=u.runSlice(),i+=1}while(!e&&(t?!t.didTimeout&&t.timeRemaining()>5:10>i));e||(l=df(c))};l=df(c)}flushChangedLinkInlining(t){let e=0;for(const i of this.changedLinkJobs.values()){let n=!1;for(;!n;){if(Math.floor(i.remainingRules()/200)+1>t-e){i.drop(),nd(1);break}n=i.runSlice(),e+=1}}return e}inlineDeferredLinkElement(t,e){var i;null===(i=this.beginDeferredLinkInlining(t,e))||void 0===i||i.advance(1/0)}emitCssTextMutation(t,e,i,n={}){this.stopped||(this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e,attributes:ue(ue({},n),{},{_cssText:xd({element:t,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})})}]}),this.linksInlinedSinceSnapshot.add(t))}readdAsPlainLink(t,e){try{var i,n;if(this.stopped||!t.isConnected||this.isLinkBlocked(t))return;if(!this.linksInlinedSinceSnapshot.has(t)&&!("_cssText"in(null!==(i=null===(n=e.lastSerialization())||void 0===n?void 0:n.attributes)&&void 0!==i?i:{})))return;this.linksInlinedSinceSnapshot.delete(t),e.readdAsMove()}catch(t){}}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=Ah();try{Yh(()=>{try{const t=e.rules||e.cssRules;t&&Kh(t)}catch(t){}n.push({styleId:i,rules:Array.from(e.rules||CSSRule,(t,i)=>({rule:vd(t,e.href),index:i}))})})}finally{Xh(Ah()-s)}}i.styleIds.push(t)}n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}stop(){this.stopped=!0,this.dropChangedLinkJobs(),iv()}dropChangedLinkJobs(){Array.from(this.changedLinkJobs.values()).forEach(t=>t.drop())}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),this.dropChangedLinkJobs(),this.linksInlinedSinceSnapshot=new WeakSet,iv({keepChangedLinks:!0})}trackStylesheetInLinkElement(t){}},Kf=class{constructor(){rd(this,"nodeMap",new WeakMap),rd(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(){}},Yf=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var Xf;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(Xf=t.contentWindow)||void 0===Xf?void 0:Xf.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var tp=new _d,ep=new Set([Yc.Mutation,Yc.MediaInteraction,Yc.StyleSheetRule,Yc.CanvasMutation,Yc.Font,Yc.Log,Yc.StyleDeclaration,Yc.AdoptedStyleSheet]);function ip(t={}){let e,i=!1,n=!1;const{emit:s,checkoutEveryNms:r,checkoutEveryNth:o,blockClass:l="rr-block",blockSelector:a=null,ignoreClass:u="rr-ignore",ignoreSelector:c=null,maskTextClass:h="rr-mask",maskTextSelector:d=null,inlineStylesheet:v=!0,inlineStylesheetBudgetRules:f,maskAllInputs:p,maskInputOptions:g,slimDOMOptions:m,maskInputFn:y,selectMaskingFn:b,maskTextFn:_,maskAllElementAttributes:w=!1,maskAttributeFn:k,hooks:S,packFn:x,sampling:T={},dataURLOptions:C={},canvasResolutionScale:E,canvasMasking:M,mousemoveWait:I,recordDOM:R=!0,recordCanvas:A=!1,recordCrossOriginIframes:O=!1,recordAfter:P=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:F=!1,collectFonts:L=!1,inlineImages:D=!1,plugins:N,keepIframeSrcFn:j=()=>!1,ignoreCSSAttributes:q=new Set([]),attributeFilter:B,errorHandler:z}=t;Wv(z);const U=ue({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},C),H=!O||window.parent===window;let W=!1;if(!H)try{window.parent.document&&(W=!1)}catch(t){W=!0}if(H&&!s)throw new Error("emit function is required");if(!H&&!W)return()=>{};void 0!==I&&void 0===T.mousemove&&(T.mousemove=I),tp.reset(),iv();const V=!0===p?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0,hidden:!0}:void 0!==g?g:{password:!0},G=hv(void 0!==m&&m);let J;!function(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();let Q=0;const Z=new Map;let K,Y;const X=t=>{for(const e of N||[])e.eventProcessor&&(t=e.eventProcessor(t));return x&&!W&&(t=x(t)),t};Gf=(t,e,i)=>{var n;const l=t;if(l.timestamp=kv(),!(null===(n=Jv[0])||void 0===n?void 0:n.isFrozen())||l.type===Kc.FullSnapshot||l.type===Kc.IncrementalSnapshot&&ep.has(l.data.source)||Jv.forEach(t=>t.unfreeze()),H)i?null==s||s(X(l),e,!0):null==s||s(X(l),e);else if(W){const t={type:"rrweb",event:X(l),origin:window.location.origin,isCheckout:e};i&&(t.nonInteractive=!0),window.parent.postMessage(t,"*")}if(l.type===Kc.FullSnapshot)J=l,Q=0;else if(l.type===Kc.IncrementalSnapshot){if(l.data.source===Yc.Mutation&&l.data.isAttachIframe)return;Q++,(o&&Q>=o||r&&l.timestamp-J.timestamp>r)&&Jf(!0)}};const tt=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=tp.getNode(e.node.id);t&&"IFRAME"===t.nodeName&&i.add(t)}t.removes.forEach(({id:t})=>{if(e&&e.has(t))return;const n=ot.getIframeElementById(t);n&&i.has(n)?ot.forgetIframeId(t):(null==K||K(t),ot.removeIframeById(t))}),null==Y||Y(),ot.cleanupDetachedIframes()}Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.Mutation},t)})},et=t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.Scroll},t)}),it=t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.CanvasMutation},t)}),nt=new Zf({mutationCb:tt,adoptedStyleSheetCb:t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.AdoptedStyleSheet},t)}),maskAllElementAttributes:w,maskAttributeFn:k,blockClass:l,blockSelector:a});let st=!1;const rt=()=>{if(!st){st=!0;try{var t;const i=null!==(t=null==e?void 0:e.flush())&&void 0!==t?t:0;nt.flushChangedLinkInlining(50-i)}finally{st=!1}}},ot=new gf({mirror:tp,mutationCb:tt,stylesheetManager:nt,recordCrossOriginIframes:O,wrappedEmit:Gf,blockClass:l,blockSelector:a});for(const t of N||[])t.getMirror&&t.getMirror({nodeMirror:tp,crossOriginIframeMirror:ot.crossOriginIframeMirror,crossOriginIframeStyleMirror:ot.crossOriginIframeStyleMirror});const lt=new Kf,at=null==M?void 0:M.configured;Qf=new Wf({recordCanvas:A,mutationCb:it,win:window,blockClass:l,blockSelector:a,mirror:tp,sampling:T.canvas,dataURLOptions:U,resolutionScale:E,canvasMasking:M});const ut=new kf({mutationCb:tt,scrollCb:et,bypassOptions:{blockClass:l,blockSelector:a,maskTextClass:h,maskTextSelector:d,inlineStylesheet:v,maskInputOptions:V,dataURLOptions:U,maskTextFn:_,maskInputFn:y,selectMaskingFn:b,maskAllElementAttributes:w,maskAttributeFn:k,recordCanvas:A,canvasMaskingConfigured:at,inlineImages:D,sampling:T,slimDOMOptions:G,iframeManager:ot,stylesheetManager:nt,canvasManager:Qf,keepIframeSrcFn:j,processedNodeManager:lt,attributeFilter:B},mirror:tp});Jf=(t=!1)=>{if(R){Jh(f);try{if(Gf({type:Kc.Meta,data:{href:window.location.href,width:$v(),height:xv()}},t),i)return;null==e||e.cancel(),e=void 0,nt.reset(),ut.init(),Jv.forEach(t=>t.lock());let n=null,s=[];try{n=function(t,e){const{mirror:i=new _d,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:u=!1,canvasMaskingConfigured:c,maskAllInputs:h=!1,maskTextFn:d,maskInputFn:v,selectMaskingFn:f,maskAllElementAttributes:p=!1,maskAttributeFn:g,slimDOM:m=!1,dataURLOptions:y,preserveWhiteSpace:b,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:T,keepIframeSrcFn:C=()=>!1,maxDepth:E,inlineStylesheetBudgetRules:M}=e||{},I=!0===h?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0,hidden:!0}:!1===h?{password:!0}:h,R=hv(m);Jh(M);try{return cv(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:I,maskTextFn:d,maskInputFn:v,selectMaskingFn:f,maskAllElementAttributes:p,maskAttributeFn:g,slimDOMOptions:R,dataURLOptions:y,inlineImages:a,recordCanvas:u,canvasMaskingConfigured:c,preserveWhiteSpace:b,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:T,keepIframeSrcFn:C,newlyAddedElement:!1,maxDepth:E})}finally{Qh()}}(document,{mirror:tp,blockClass:l,blockSelector:a,maskTextClass:h,maskTextSelector:d,inlineStylesheet:v,maskAllInputs:V,inlineStylesheetBudgetRules:f,maskTextFn:_,maskInputFn:y,selectMaskingFn:b,maskAllElementAttributes:w,maskAttributeFn:k,slimDOM:G,dataURLOptions:U,recordCanvas:A,canvasMaskingConfigured:at,inlineImages:D,onSerialize(t){Av(t,tp)&&ot.addIframe(t),Ov(t,tp)&&nt.trackLinkElement(t),Pv(t)&&ut.addShadowRoot(gh.shadowRoot(t),document)},onIframeLoad(t,e){ot.attachIframe(t,e),ut.observeAttachShadow(t)},onIframeListenerRegistered(t,e){ot.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e,i){nt.attachLinkElement(t,e,i)},keepIframeSrcFn:j})}finally{s=ed()}if(i)return;if(!n)return console.warn("Failed to snapshot the document");if(ef=new WeakMap,Gf({type:Kc.FullSnapshot,data:{node:n,initialOffset:Sv(window)}},t),i)return;if(Jv.forEach(t=>t.unlock()),Qf.onFullSnapshot(),s.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&&pv(()=>{o=e.beginDeferredLinkInlining(i,tp.getId(i))})},u=()=>{if(!o)return;const t=o;let e=!0;pv(()=>{e=t.advance(200)}),e&&(o=null)},c=()=>{o||a(),u()},h=t=>{if(s=null,n)return;let e=0;do{try{c()}catch(t){null==o||o.discard(),o=null,nd(1)}e+=1}while(!n&&l()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));n||(l()?s=df(h):i())};return s=df(h),{cancel(){n=!0,null==o||o.discard(),o=null,null==s||s.cancel(),s=null},flush(){if(n)return 0;n=!0,null==s||s.cancel(),s=null;let e=0,c=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,c+=1;else{try{u()}catch(t){null==o||o.discard(),o=null,c+=1}e+=1}}if(l()||c>0){let e=c+(null!==o?1:0);for(let i=r;t.length>i;i++)null!==t[i]&&(e+=1);nd(e),null==o||o.discard(),o=null}return i(),e}}}(s,nt,()=>{e===t&&(e=void 0)});e=t}O&&ot.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&nt.adoptStyleSheets(document.adoptedStyleSheets,tp.getId(document))}finally{Qh()}}};const ct=[];let ht;try{ht=new wf(window,R),ct.push(vv("pagehide",()=>{try{rt()}catch(t){}e=void 0},window));for(const t of["visibilitychange","freeze","resume"])ct.push(vv(t,Ph,document));K=t=>{const e=Z.get(t);e&&(e.forEach(t=>{pv(t);const e=ct.indexOf(t);-1!==e&&ct.splice(e,1)}),Z.delete(t))},Y=()=>{null==ht||ht.prune();for(const[t]of Z){const e=tp.getNode(t);if(e)try{e.contentDocument&&e.contentDocument.defaultView||null==K||K(t)}catch(e){null==K||K(t)}else null==K||K(t)}};const t=t=>{var e;return Gv(uf)({mutationCb:tt,mousemoveCb:(t,e)=>Gf({type:Kc.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.MouseInteraction},t)}),scrollCb:et,viewportResizeCb:t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.ViewportResize},t)}),inputCb:(t,e)=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.Input},t)},void 0,e),mediaInteractionCb:t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.MediaInteraction},t)}),styleSheetRuleCb:t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.StyleSheetRule},t)}),styleDeclarationCb:t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.StyleDeclaration},t)}),canvasMutationCb:it,fontCb:t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.Font},t)}),selectionCb(t){Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.Selection},t)})},customElementCb(t){Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.CustomElement},t)})},blockClass:l,ignoreClass:u,ignoreSelector:c,maskTextClass:h,maskTextSelector:d,maskInputOptions:V,inlineStylesheet:v,sampling:T,recordDOM:R,recordCanvas:A,canvasMaskingConfigured:at,inlineImages:D,userTriggeredOnInput:F,collectFonts:L,doc:t,maskInputFn:y,selectMaskingFn:b,maskTextFn:_,maskAllElementAttributes:w,maskAttributeFn:k,keepIframeSrcFn:j,blockSelector:a,slimDOMOptions:G,dataURLOptions:U,mirror:tp,iframeManager:ot,stylesheetManager:nt,shadowDomManager:ut,processedNodeManager:lt,canvasManager:Qf,ignoreCSSAttributes:q,attributeFilter:B,plugins:(null==N||null===(e=N.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({name:t.name,observer:t.observer,options:t.options,callback:e=>Gf({type:Kc.Plugin,data:{plugin:t.name,payload:e}})})))||[]},S)},s=e=>{const i=e.defaultView?null==ht?void 0:ht.observe(e.defaultView):void 0;try{const n=t(e);return()=>gv([()=>null==n?void 0:n(),()=>null==i?void 0:i()])}catch(t){throw null==i||i(),t}},r=new WeakMap,o=new WeakMap;ot.addLoadListener(t=>{null==ht||ht.prune();try{const e=t.contentDocument,i=tp.getId(t);if(!e)return;const n=o.get(t);if(n){o.delete(t),pv(n);const e=ct.indexOf(n);-1!==e&&ct.splice(e,1)}const l=r.get(e);if(-1!==i&&l){if(l())return;null==K||K(i)}const a=s(e);if("function"==typeof a){let n=!1;const s=vv("rrweb-check-iframe-observers",()=>{n=!0},e);-1!==i&&r.set(e,()=>{n=!1;const t=e.createEvent("Event");return t.initEvent("rrweb-check-iframe-observers",!1,!1),e.dispatchEvent(t),n});const l=()=>{r.delete(e),s(),a()};if(ct.push(l),-1!==i){let t=Z.get(i);t||(t=new Set,Z.set(i,t)),t.add(l)}else o.set(t,l)}}catch(t){console.warn(t)}}),ot.addPageHideListener(t=>{const e=tp.getId(t);null==K||K(e),Yv(t)});let f=-1;const p=t=>Gf({type:Kc.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),g=()=>{var t,e,i,n;const s=document,r=null!==(t=null!==(e=null!==(i=null!==(n=s.fullscreenElement)&&void 0!==n?n:s.webkitFullscreenElement)&&void 0!==i?i:s.mozFullScreenElement)&&void 0!==e?e:s.msFullscreenElement)&&void 0!==t?t:null,o=r?tp.getId(r):-1;o!==f&&(-1!==f&&p({id:f,enter:!1}),f=o,-1!==o&&p({id:o,enter:!0}))},m=()=>{if(i||n)return;if(n=!0,Jf(),i)return;const t=s(document);i?"function"==typeof t&&gv([t]):("function"==typeof t&&ct.push(t),ct.push(vv("fullscreenchange",g)),ct.push(vv("webkitfullscreenchange",g)),ct.push(vv("mozfullscreenchange",g)),ct.push(vv("MSFullscreenChange",g)),Yf=!0,ht&&(ht.ready=!0))};["interactive","complete"].includes(document.readyState)?m():(ct.push(vv("DOMContentLoaded",()=>{Gf({type:Kc.DomContentLoaded,data:{}}),"DOMContentLoaded"===P&&setTimeout(m,0)})),ct.push(vv("load",()=>{Gf({type:Kc.Load,data:{}}),"load"===P&&m()},window)));const x=()=>{if(null==ht||ht.beforeStop(),!i){i=!0;try{rt()}catch(t){}e=void 0,nt.stop(),gv(ct),lt.destroy(),ot.removeLoadListener(),ot.destroy(),Z.clear(),ut.reset(),tp.reset(),Yf=!1,Vv(),null==ht||ht.stop()}};return ht&&function(t,e){yf.set(t,e)}(x,ht),x}catch(t){i=!0,gv(ct),null==ht||ht.stop(),console.warn(t)}}ip.withStyleRuleSourceHandoff=function(t,e){const i=yf.get(t);if(!i||i.stopped||vf!==i||ff)return _f(),void e(()=>{});const n={previous:i,next:void 0,valid:!0,stopStarted:!1,stopCompleted:!1,retained:new Set};ff=n;try{e(()=>{ff===n&&_f()})}finally{var s;(null===(s=n.next)||void 0===s?void 0:s.ready)||_f();for(const t of n.retained)0===t.owners&&bf(t);n.retained.clear(),ff===n&&(ff=void 0)}},ip.addCustomEvent=(t,e)=>{if(!Yf)throw new Error("please add custom event after start recording");Gf({type:Kc.Custom,data:{tag:t,payload:e}})},ip.freezePage=()=>{Jv.forEach(t=>t.freeze())},ip.takeFullSnapshot=t=>{if(!Yf)throw new Error("please take full snapshot after start recording");Jf(t)},ip.isRecording=()=>Yf,ip.supportsSelectMasking=!0,ip.mirror=tp,Date,Date;var np=Object.create(null);function sp(t){return sp="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},sp(t)}function rp(t,e,i){return(e=function(t){var e=function(t){if("object"!=sp(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=sp(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==sp(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}np.Node=Object.create(null),np.ShadowRoot=Object.create(null),np.MutationObserver=Object.create(null),np.Element=Object.create(null);var op=class{constructor(t){rp(this,"fileName",void 0),rp(this,"functionName",void 0),rp(this,"lineNumber",void 0),rp(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}`}},lp=/(^|@)\S+:\d+/,ap=/^\s*at .*(\S+:\d+|\(native\))/m,up=/^(eval@)?(\[native code])?$/,cp={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(ap)?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(ap)},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 op({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(up)},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 op({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(e),n=i&&i[1]?i[1]:void 0,s=this.extractLocation(t.replace(e,""));return new op({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 op({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 op({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(lp)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),i=this.extractLocation(e.pop());return new op({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function hp(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 dp(t){return Array.isArray(t)}function vp(t){return"object"==typeof t&&null!==t&&!dp(t)}function fp(t,e){if(0===e)return!0;const i=Object.keys(t);for(const n of i)if(vp(t[n])&&fp(t[n],e-1))return!0;return!1}function pp(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(vp(r=e)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||vp(r)&&fp(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]=dp(n)?hp(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 gp={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function mp(t,e,i){const n=i?Object.assign({},gp,i):gp,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:cp.parse(e.error).map(t=>t.toString()),payload:[pp(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=[pp(`Uncaught (in promise) ${i.name}: ${i.message}`,n.stringifyOptions)]):(i=new Error,s=[pp("Uncaught (in promise)",n.stringifyOptions),pp(e.reason,n.stringifyOptions)]),t({level:"error",trace:cp.parse(i).map(t=>t.toString()),payload:s})};e.addEventListener("unhandledrejection",s),u.push(()=>{e.removeEventListener("unhandledrejection",s)})}for(const t of n.level)u.push(c(r,t));return()=>{a=!1,u.forEach(t=>t())};function c(e,i){return e[i]?function(s,r){try{if(!(r in s))return()=>{};const u=s[r],c={next:u},h=(s=>(...r)=>{if(s.apply(e,r),a&&!("assert"===i&&r[0]||l)){l=!0;try{const e=cp.parse(new Error).map(t=>t.toString()).splice(1),s=("assert"===i?r.slice(1):r).map(t=>pp(t,n.stringifyOptions));o++,n.lengthThreshold>o?t({level:i,trace:e,payload:s}):o===n.lengthThreshold&&t({level:"warn",trace:[],payload:[pp("The number of log records reached the threshold.")]})}catch(t){s.apply(e,["rrweb logger error:",t,...r])}finally{l=!1}}})(function(...t){return c.next.apply(this,t)});return"function"==typeof h&&(h.prototype=h.prototype||{},Object.defineProperties(h,{__rrweb_original__:{enumerable:!1,value:u},__rrweb_layer__:{enumerable:!1,value:c}})),s[r]=h,()=>{if(s[r]===h)return void(s[r]=c.next);const t=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let e=s[r],i=t(e);for(;i;){if(i.next===h)return void(i.next=c.next);e=i.next,i=t(e)}}}catch(t){return()=>{}}}(e,i):()=>{}}}var yp=t=>({name:"rrweb/console@1",observer:mp,options:t});const bp=()=>{},_p=t=>{var e;if(xe(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function wp(t,e,i){try{if(!(e in t))return bp;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=_p(i);for(;r;){if(r.next===s)return void(r.next=n.next);i=r.next,r=_p(i)}}}catch(t){return bp}}function kp(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 Sp=Hr("[Recorder]"),xp=t=>"navigation"===t.entryType,$p=t=>"resource"===t.entryType,Tp=()=>{};function Cp(t,e){var i;return xp(e)&&"complete"===(null===(i=t.document)||void 0===i?void 0:i.readyState)&&e.loadEventEnd>0}function Ep(t,e){return e.recordInitialRequests?t.performance.getEntries().filter(i=>Cp(t,i)||$p(i)&&e.initiatorTypes.includes(i.initiatorType)):e.performanceEntryTypeToObserve.includes("navigation")?function(t){var e;return"complete"!==(null===(e=t.document)||void 0===e?void 0:e.readyState)?[]:t.performance.getEntriesByType("navigation").filter(e=>Cp(t,e))}(t):[]}function Mp(t,e){return!!e&&(Pe(e)||e[t])}function Ip(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 Rp=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function Ap({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:!!Ip(e)&&t(e.url)}catch(t){return!1}}(n))return!1;if(s(Rp))return!1;if(Pe(e))return!0;if(Se(e))return s(e);const r=e[t];return Pe(r)?r:s(r)}function Op(t,e,i,n,s){return Pp.apply(this,arguments)}function Pp(){return Pp=re(function*(t,e,i,n,s,r=0){if(r>10)return Sp.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=>$p(t)&&t.initiatorType===e&&(Ce(n)||t.startTime>=n)&&(Ce(s)||s>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*r)),Op(t,e,i,n,s,r+1))}),Pp.apply(this,arguments)}function Fp({body:t,options:e,url:i}){if(Re(t))return null;const{hostname:n,isHostDenied:s}=kp(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 ao(t);if($e(t))try{return JSON.stringify(t)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}const Lp=t=>!Ie(t)&&("navigation"===t.entryType||"resource"===t.entryType);function Dp(t,{entry:e,method:i,status:n,networkRequest:s,isInitial:r,start:o,end:l,url:a,initiatorType:u}){o=e?e.startTime:o,l=e?e.responseEnd:l;const c=Math.floor(Date.now()-t.performance.now()),h=Math.floor(c+(o||0)),d=[ue(ue({},e?JSON.parse(JSON.stringify(e.toJSON())):{name:a}),{},{startTime:Ce(o)?void 0:Math.round(o),endTime:Ce(l)?void 0:Math.round(l),timeOrigin:c,timestamp:h,method:i,initiatorType:u||(e?e.initiatorType:void 0),status:n,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:r})];if(Lp(e))for(const t of e.serverTiming||[])d.push({timeOrigin:c,timestamp:h,startTime:Math.round(e.startTime),name:t.name,duration:t.duration,entryType:"serverTiming"});return d}const Np=["video/","audio/"];function jp(t){return $e(t)&&xe(t.getReader)&&xe(t.tee)}const qp="[SessionReplay] Timeout while trying to read body",Bp="[SessionReplay] Failed to read body";function zp(t){return`${Bp}: ${t}`}function Up(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function Hp(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const i=setTimeout(()=>e(qp),500);try{t.clone().text().then(t=>e(t),t=>e(zp(t))).finally(()=>clearTimeout(i))}catch(t){clearTimeout(i),e(Bp)}})}(t);const i=al(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(Up(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(qp),500);let a;try{a=t.clone()}catch(t){return void o(Bp)}const u=a.body;if(!jp(u)||"undefined"==typeof TextDecoder){try{a.text().then(t=>o(t),t=>o(zp(t)))}catch(t){o(Bp)}return}try{n=u.getReader()}catch(t){return void o(Bp)}const c=[];let h=0;!function t(){n.read().then(({done:i,value:n})=>{if(s)r();else if(i)o((new TextDecoder).decode(function(t,e){const i=new Uint8Array(e);let n=0;for(const e of t)i.set(e,n),n+=e.byteLength;return i}(c,h)));else{if(n){if(h+n.byteLength>e)return void o(Up(e));h+=n.byteLength,c.push(n)}t()}},t=>o(zp(t)))}()})}(t,i)}function Wp(t){return Vp.apply(this,arguments)}function Vp(){return Vp=re(function*({r:t,options:e,url:i}){const{hostname:n,isHostDenied:s}=kp(i,e);return s?Promise.resolve(n+" is in deny list"):Hp(t,e)}),Vp.apply(this,arguments)}function Gp(t){return Jp.apply(this,arguments)}function Jp(){return Jp=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=Np.some(t=>null==s?void 0:s.startsWith(t));if(s&&r)return`Content-Type ${s} is not supported`;const{hostname:o,isHostDenied:l}=kp(i,e);return l?o+" is in deny list":null}({r:t,options:e,url:i});return Ie(n)?Hp(t,e):Promise.resolve(n)}),Jp.apply(this,arguments)}let Qp=null;function Zp(t,e,i){if(!("performance"in e))return()=>{};if(Qp)return Sp.warn("Network observer already initialised, doing nothing"),()=>{};const n=i?Object.assign({},ul,i):ul;let s=!0,r=!1;const o=e=>{if(!s)return;const i=[];let o=!1;e.requests.forEach(t=>{const e="serverTiming"===t.entryType;if(e&&o)return;let s;try{s=n.maskRequestFn(t)}catch(t){return r||(r=!0,Sp.warn("Network capture masking callback failed; dropping the record. Further masking failures will not be logged for this observer.")),void(e||(o=!0))}e||(o=!s||(t=>!!t&&ml.has(t))(s)),s&&i.push(s)}),i.length>0&&t(ue(ue({},e),{},{requests:i}))},l=function(t,e,i){try{t({requests:Ep(e,i).flatMap(t=>Dp(e,{entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}catch(t){Sp.error("Failed to capture initial performance entries for network capture",t)}const n=e.PerformanceObserver,s=null==n?void 0:n.supportedEntryTypes;if(!n||!Se(s))return;const r=s.filter(t=>i.performanceEntryTypeToObserve.includes(t));if(!r.length)return;const o=new n(n=>{t({requests:n.getEntries().filter(t=>xp(t)||$p(t)&&i.initiatorTypes.includes(t.initiatorType)&&(t=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>Dp(e,{entry:t,method:void 0,status:void 0,networkRequest:{}}))})});return o.observe({entryTypes:r}),()=>{o.disconnect()}}(o,e,n),a=n.recordHeaders||n.recordBody;if(!l&&!a)return s=!1,Tp;let u=()=>{},c=()=>{};return a&&(u=function(t,e,i){if(!i.initiatorTypes.includes("xmlhttprequest"))return()=>{};const n=Mp("request",i.recordHeaders),s=Mp("response",i.recordHeaders),r=wp(e.XMLHttpRequest.prototype,"open",r=>function(o,l,a=!0,u,c){const h=this;try{const r=new Request(l),a={};let u,c;const d={},v=h.setRequestHeader.bind(h);h.setRequestHeader=(t,e)=>(d[t]=e,v(t,e)),n&&(a.requestHeaders=d);const f=h.send.bind(h);h.send=t=>(Ap({type:"request",headers:d,url:l,recordBody:i.recordBody})&&(a.requestBody=Fp({body:t,options:i,url:l})),u=e.performance.now(),f(t));const p=()=>{h.removeEventListener("readystatechange",g),h.removeEventListener("error",p),h.removeEventListener("abort",p),h.removeEventListener("timeout",p)},g=()=>{if(h.readyState!==h.DONE)return;p(),c=e.performance.now();const n={};h.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(t=>{const e=t.split(": "),i=e.shift(),s=e.join(": ");i&&(n[i]=s)}),s&&(a.responseHeaders=n),Ap({type:"response",headers:n,url:l,recordBody:i.recordBody})&&(a.responseBody=Fp({body:h.response,options:i,url:l})),Op(e,"xmlhttprequest",r.url,u,c).then(i=>{t({requests:Dp(e,{entry:i,method:o,status:null==h?void 0:h.status,networkRequest:a,start:u,end:c,url:l.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};h.addEventListener("readystatechange",g),h.addEventListener("error",p),h.addEventListener("abort",p),h.addEventListener("timeout",p)}catch(t){Sp.error("Failed to instrument XHR for network capture",t)}r.call(h,o,l.toString(),a,u,c)});return()=>{r()}}(o,e,n),c=!0===n.captureFetchSynchronously?function(t,e,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=Mp("request",i.recordHeaders),s=Mp("response",i.recordHeaders),r=wp(e,"fetch",r=>function(o,l){let a;try{a=new Request(o,l)}catch(t){Sp.error("Failed to instrument fetch for network capture",t);try{return Promise.resolve(r(o,l))}catch(t){return new Promise((e,i)=>i(t))}}const u={};let c,h;const d=re(function*(){try{const t={};a.headers.forEach((e,i)=>{t[i]=e}),n&&(u.requestHeaders=t),!jp(null==l?void 0:l.body)&&Ap({type:"request",headers:t,url:o,recordBody:i.recordBody})&&(u.requestBody=yield Wp({r:a,options:i,url:o}))}catch(t){Sp.error("Failed to record fetch request for network capture",t)}})(),v=(f=re(function*(t){try{const e={};t.headers.forEach((t,i)=>{e[i]=t}),s&&(u.responseHeaders=e),Ap({type:"response",headers:e,url:o,recordBody:i.recordBody})&&(u.responseBody=yield Gp({r:t,options:i,url:o}))}catch(t){Sp.error("Failed to record fetch response for network capture",t)}}),function(t){return f.apply(this,arguments)});var f;try{c=e.performance.now()}catch(t){}let p;try{p=Ip(o)?r(a):r(o,l)}catch(t){p=new Promise((e,i)=>i(t))}const g=Promise.resolve(p).then(t=>{try{h=e.performance.now()}catch(t){}return{status:"fulfilled",response:t}},t=>({status:"rejected",error:t})),m=i=>{(i=>Op(e,"fetch",a.url,c,h).then(n=>{t({requests:Dp(e,{entry:n,method:a.method,status:null==i?void 0:i.status,networkRequest:u,start:c,end:h,url:a.url,initiatorType:"fetch"})})}))(i).catch(()=>{})};return re(function*(){let t,e=!1;try{yield d;const n=yield g;if("rejected"===n.status)throw n.error;if(t=n.response,!0===i.returnFetchResponseEarly){const i=t;e=!0;const n=()=>m(i);return v(i).then(n,n),i}return yield v(t),t}finally{e||m(t)}})()});return()=>{r()}}(o,e,n):function(t,e,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=Mp("request",i.recordHeaders),s=Mp("response",i.recordHeaders),r=wp(e,"fetch",r=>function(){var o=re(function*(o,l){let a,u;try{a=new Request(o,l)}catch(t){return Sp.error("Failed to instrument fetch for network capture",t),r(o,l)}const c={};let h,d;try{try{const t={};a.headers.forEach((e,i)=>{t[i]=e}),n&&(c.requestHeaders=t),!jp(null==l?void 0:l.body)&&Ap({type:"request",headers:t,url:o,recordBody:i.recordBody})&&(c.requestBody=yield Wp({r:a,options:i,url:o}))}catch(t){Sp.error("Failed to record fetch request for network capture",t)}h=e.performance.now(),u=Ip(o)?yield r(a):yield r(o,l),d=e.performance.now();try{const t={};u.headers.forEach((e,i)=>{t[i]=e}),s&&(c.responseHeaders=t),Ap({type:"response",headers:t,url:o,recordBody:i.recordBody})&&(c.responseBody=yield Gp({r:u,options:i,url:o}))}catch(t){Sp.error("Failed to record fetch response for network capture",t)}return u}finally{Op(e,"fetch",a.url,h,d).then(i=>{t({requests:Dp(e,{entry:i,method:a.method,status:null==u?void 0:u.status,networkRequest:c,start:h,end:d,url:a.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(t,e){return o.apply(this,arguments)}}());return()=>{r()}}(o,e,n)),Qp=()=>{s=!1,null==l||l(),u(),c(),Qp=null},Qp}const Kp=t=>({name:"rrweb/network@1",observer:Zp,options:t});var Yp,Xp,tg,eg,ig,ng,sg,rg,og,lg,ag,ug,cg,hg,dg;h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:yp,getRecordNetworkPlugin:Kp},h.__PosthogExtensions__.rrweb={record:ip,version:"v2",wasMaxDepthReached:()=>uv,resetMaxDepthState(){uv=!1,av=!1},getLastSnapshotCost:()=>Bh,getMutationCost:()=>ue({},Vh),getObserverInitFailures:()=>af.size?Array.from(af):void 0,resetSnapshotCostState(){Dh=0,Nh=0,jh=0,Oh=0,qh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},Bh=null,zh=null,Uh=[],Hh=0,Wh=0,Vh={slowestBatchMs:0},Gh={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},h.rrweb={record:ip,version:"v2"},h.rrwebConsoleRecord={getRecordConsolePlugin:yp},h.getRecordNetworkPlugin=Kp,h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initSessionRecording=(t,e)=>new Qc(t,e),h.__PosthogExtensions__.initSessionRecording.supportsSelectMasking=!0;var vg={},fg=[],pg=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,gg=Array.isArray;function mg(t,e){for(var i in e)t[i]=e[i];return t}function yg(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function bg(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?Yp.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 _g(t,o,n,s,null)}function _g(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?++tg:s,__i:-1,__u:0};return null==s&&null!=Xp.vnode&&Xp.vnode(r),r}function wg(t){return t.children}function kg(t,e){this.props=t,this.context=e}function Sg(t,e){if(null==e)return t.__?Sg(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?Sg(t):null}function xg(t){if(t.__P&&t.__d){var e=t.__v,i=e.__e,n=[],s=[],r=mg({},e);r.__v=e.__v+1,Xp.vnode&&Xp.vnode(r),Pg(t.__P,r,e,t.__n,t.__P.namespaceURI,32&e.__u?[i]:null,n,null==i?Sg(e):i,!!(32&e.__u),s),r.__v=e.__v,r.__.__k[r.__i]=r,Lg(n,r,s),e.__e=e.__=null,r.__e!=i&&$g(r)}}function $g(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}),$g(t)}function Tg(t){(!t.__d&&(t.__d=!0)&&eg.push(t)&&!Cg.__r++||ig!=Xp.debounceRendering)&&((ig=Xp.debounceRendering)||ng)(Cg)}function Cg(){try{for(var t,e=1;eg.length;)eg.length>e&&eg.sort(sg),t=eg.shift(),e=eg.length,xg(t)}finally{eg.length=Cg.__r=0}}function Eg(t,e,i,n,s,r,o,l,a,u,c){var h,d,v,f,p,g,m,y=n&&n.__k||fg,b=e.length;for(a=function(t,e,i,n,s){var r,o,l,a,u,c=i.length,h=c,d=0;for(t.__k=new Array(s),r=0;s>r;r++)null!=(o=e[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=t.__k[r]=_g(null,o,null,null,null):gg(o)?o=t.__k[r]=_g(wg,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=t.__k[r]=_g(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=Ig(o,i,a,h))&&(h--,(l=i[u])&&(l.__u|=2)),null==l||null==l.__v?(-1==u&&(s>c?d--:c>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(h)for(r=0;c>r;r++)null!=(l=i[r])&&!(2&l.__u)&&(l.__e==n&&(n=Sg(l)),jg(l,l));return n}(i,e,y,a,b),h=0;b>h;h++)null!=(v=i.__k[h])&&(d=-1!=v.__i&&y[v.__i]||vg,v.__i=h,g=Pg(t,v,d,s,r,o,l,a,u,c),f=v.__e,v.ref&&d.ref!=v.ref&&(d.ref&&Ng(d.ref,null,v),c.push(v.ref,v.__c||f,v)),null==p&&null!=f&&(p=f),(m=!!(4&v.__u))||d.__k===v.__k?(a=Mg(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 Mg(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=Mg(s[r],e,i,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=Sg(t)),i.insertBefore(t.__e,e||null)),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function Ig(t,e,i,n){var s,r,o,l=t.key,a=t.type,u=e[i],c=null!=u&&!(2&u.__u);if(null===u&&null==l||c&&l==u.key&&a==u.type)return i;if(n>(c?1:0))for(s=i-1,r=i+1;s>=0||e.length>r;)if(null!=(u=e[o=0>s?r++:s--])&&!(2&u.__u)&&l==u.key&&a==u.type)return o;return-1}function Rg(t,e,i){"-"==e[0]?t.setProperty(e,null==i?"":i):t[e]=null==i?"":"number"!=typeof i||pg.test(e)?i:i+"px"}function Ag(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||Rg(t.style,e,"");if(i)for(e in i)n&&i[e]==n[e]||Rg(t.style,e,i[e])}else if("o"==e[0]&&"n"==e[1])r=e!=(e=e.replace(ag,"$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[lg]=n[lg]:(i[lg]=ug,t.addEventListener(e,r?hg:cg,r)):t.removeEventListener(e,r?hg:cg,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 Og(t){return function(e){if(this.l){var i=this.l[e.type+t];if(null==e[og])e[og]=ug++;else if(i[lg]>e[og])return;return i(Xp.event?Xp.event(e):e)}}}function Pg(t,e,i,n,s,r,o,l,a,u){var c,h,d,v,f,p,g,m,y,b,$,_,w,k,S,x,T=e.type;if(void 0!==e.constructor)return null;128&i.__u&&(a=!!(32&i.__u),r=[l=e.__e=i.__e]),(c=Xp.__b)&&c(e);t:if("function"==typeof T){h=o.length;try{if(y=e.props,b=T.prototype&&T.prototype.render,$=(c=T.contextType)&&n[c.__c],_=c?$?$.props.value:c.__:n,i.__c?m=(d=e.__c=i.__c).__=d.__E:(b?e.__c=d=new T(y,_):(e.__c=d=new kg(y,_),d.constructor=T,d.render=qg),$&&$.sub(d),d.state||(d.state={}),d.__n=n,v=d.__d=!0,d.__h=[],d._sb=[]),b&&null==d.__s&&(d.__s=d.state),b&&null!=T.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=mg({},d.__s)),mg(d.__s,T.getDerivedStateFromProps(y,d.__s))),f=d.props,p=d.state,d.__v=e,v)b&&null==T.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),b&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(b&&null==T.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,_),e.__v==i.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,_)){e.__v!=i.__v&&(d.props=y,d.state=d.__s,d.__d=!1),e.__e=i.__e,e.__k=i.__k,e.__k.some(function(t){t&&(t.__=e)}),fg.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break t}null!=d.componentWillUpdate&&d.componentWillUpdate(y,d.__s,_),b&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(f,p,g)})}if(d.context=_,d.props=y,d.__P=t,d.__e=!1,w=Xp.__r,k=0,b)d.state=d.__s,d.__d=!1,w&&w(e),c=d.render(d.props,d.state,d.context),fg.push.apply(d.__h,d._sb),d._sb=[];else do{d.__d=!1,w&&w(e),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&25>++k);d.state=d.__s,null!=d.getChildContext&&(n=mg(mg({},n),d.getChildContext())),b&&!v&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(f,p)),S=null!=c&&c.type===wg&&null==c.key?Dg(c.props.children):c,l=Eg(t,gg(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=h,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--;)yg(r[x]);Fg(e)}else e.__e=i.__e,!e.__k&&i.__k&&(e.__k=i.__k),t.then||Fg(e);Xp.__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,c,h,d,v,f,p,g=i.props||vg,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&&(Xp.__m&&Xp.__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&&Yp.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?h=v:"children"==u||u in m||"value"==u&&"defaultValue"in m||"checked"==u&&"defaultChecked"in m||Ag(t,u,null,v,s);for(u in m)v=m[u],"children"==u?d=v:"dangerouslySetInnerHTML"==u?c=v:"value"==u?f=v:"checked"==u?p=v:l&&"function"!=typeof v||g[u]===v||Ag(t,u,v,g[u],s);if(c)l||h&&(c.__html==h.__html||c.__html==t.innerHTML)||(t.innerHTML=c.__html),e.__k=[];else if(h&&(t.innerHTML=""),Eg("template"==e.type?t.content:t,gg(d)?d:[d],e,i,n,"foreignObject"==y?"http://www.w3.org/1999/xhtml":s,r,o,r?r[0]:i.__k&&Sg(i,0),l,a),null!=r)for(u=r.length;u--;)yg(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])&&Ag(t,u,f,g[u],s),u="checked",null!=p&&p!=t[u]&&Ag(t,u,p,g[u],s))}return t}(i.__e,e,i,n,s,r,o,a,u);return(c=Xp.diffed)&&c(e),128&e.__u?void 0:l}function Fg(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(Fg))}function Lg(t,e,i){for(var n=0;i.length>n;n++)Ng(i[n],i[++n],i[++n]);Xp.__c&&Xp.__c(e,t),t.some(function(e){try{t=e.__h,e.__h=[],t.some(function(t){t.call(e)})}catch(t){Xp.__e(t,e.__v)}})}function Dg(t){return"object"!=typeof t||null==t||t.__b>0?t:gg(t)?t.map(Dg):void 0!==t.constructor?null:mg({},t)}function Ng(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){Xp.__e(t,i)}}function jg(t,e,i){var n,s;if(Xp.unmount&&Xp.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Ng(n,null,e)),null!=(n=t.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(t){Xp.__e(t,e)}n.base=n.__P=n.__n=null}if(n=t.__k)for(s=0;n.length>s;s++)n[s]&&jg(n[s],e,i||"function"!=typeof t.type);i||yg(t.__e),t.__c=t.__=t.__e=void 0}function qg(t,e,i){return this.constructor(t,i)}function Bg(t,e,i){var n,s,r,o;e==document&&(e=document.documentElement),Xp.__&&Xp.__(t,e),s=(n="function"==typeof i)?null:i&&i.__k||e.__k,r=[],o=[],Pg(e,t=(!n&&i||e).__k=bg(wg,null,[t]),s||vg,vg,e.namespaceURI,!n&&i?[i]:s?null:e.firstChild?Yp.call(e.childNodes):null,r,!n&&i?i:s?s.__e:e.firstChild,n,o),Lg(r,t,o),t.props.children=null}Yp=fg.slice,Xp={__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}},tg=0,kg.prototype.setState=function(t,e){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=mg({},this.state);"function"==typeof t&&(t=t(mg({},i),this.props)),t&&mg(i,t),null!=t&&this.__v&&(e&&this._sb.push(e),Tg(this))},kg.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Tg(this))},kg.prototype.render=wg,eg=[],ng="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,sg=function(t,e){return t.__v.__b-e.__v.__b},Cg.__r=0,rg=Math.random().toString(8),og="__d"+rg,lg="__a"+rg,ag=/(PointerCapture)$|Capture$/i,ug=0,cg=Og(!1),hg=Og(!0),dg=0;var zg=0;function Ug(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:--zg,__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 Xp.vnode&&Xp.vnode(u),u}const Hg="featureFlagsCommon";function Wg({client:t,config:e}){var i;if(!t||!e.uiHost)return;const n=null===(i=t.session)||void 0===i?void 0:i.sessionId;return n?`${e.uiHost}/project/${t.projectToken}/replay/${n}`:void 0}var Vg,Gg,Jg,Qg,Zg=0,Kg=[],Yg=Xp,Xg=Yg.__b,tm=Yg.__r,em=Yg.diffed,im=Yg.__c,nm=Yg.unmount,sm=Yg.__;function rm(t,e){Yg.__h&&Yg.__h(Gg,t,Zg||e),Zg=0;var i=Gg.__H||(Gg.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function om(t){return Zg=1,function(t,e){var i=rm(Vg++,2);if(i.t=t,!i.__c&&(i.__=[mm(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=Gg,!Gg.__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};Gg.__f=!0;var s=Gg.shouldComponentUpdate,r=Gg.componentWillUpdate;Gg.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)},Gg.shouldComponentUpdate=n}return i.__N||i.__}(mm,t)}function lm(t,e){var i=rm(Vg++,3);!Yg.__s&&gm(i.__H,e)&&(i.__=t,i.u=e,Gg.__H.__h.push(i))}function am(t){return Zg=5,um(function(){return{current:t}},[])}function um(t,e){var i=rm(Vg++,7);return gm(i.__H,e)&&(i.__=t(),i.__H=e,i.__h=t),i.__}function cm(t){var e=Gg.context[t.__c],i=rm(Vg++,9);return i.c=t,e?(null==i.__&&(i.__=!0,e.sub(Gg)),e.props.value):t.__}function hm(){for(var t;t=Kg.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(fm),e.__h.some(pm),e.__h=[]}catch(i){e.__h=[],Yg.__e(i,t.__v)}}}Yg.__b=function(t){Gg=null,Xg&&Xg(t)},Yg.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),sm&&sm(t,e)},Yg.__r=function(t){tm&&tm(t),Vg=0;var e=(Gg=t.__c).__H;e&&(Jg===Gg?(e.__h=[],Gg.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.length&&hm(),Vg=0)),Jg=Gg},Yg.diffed=function(t){em&&em(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==Kg.push(e)&&Qg===Yg.requestAnimationFrame||((Qg=Yg.requestAnimationFrame)||vm)(hm)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),Jg=Gg=null},Yg.__c=function(t,e){e.some(function(t){try{t.__h.some(fm),t.__h=t.__h.filter(function(t){return!t.__||pm(t)})}catch(i){e.some(function(t){t.__h&&(t.__h=[])}),e=[],Yg.__e(i,t.__v)}}),im&&im(t,e)},Yg.unmount=function(t){nm&&nm(t);var e,i=t.__c;i&&i.__H&&(i.__H.__.some(function(t){try{fm(t)}catch(t){e=t}}),i.__H=void 0,e&&Yg.__e(e,i.__v))};var dm="function"==typeof requestAnimationFrame;function vm(t){var e,i=function(){clearTimeout(n),dm&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(i,35);dm&&(e=requestAnimationFrame(i))}function fm(t){var e=Gg,i=t.__c;"function"==typeof i&&(t.__c=void 0,i()),Gg=e}function pm(t){var e=Gg;t.__c=t.__(),Gg=e}function gm(t,e){return!t||t.length!==e.length||e.some(function(e,i){return e!==t[i]})}function mm(t,e){return"function"==typeof e?e(t):e}const ym={Activation:"events",Cancellation:"cancelEvents"},bm={Button:"button",Tab:"tab",Selector:"selector"},_m={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"},wm={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},km={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Sm={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},xm={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},$m={Once:"once",Recurring:"recurring",Always:"always"},Tm={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Cm={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"},Em={Popover:"popover",Inline:"inline"},Mm=Hr("[Surveys]"),Im="PostHog is not capturing, so a survey response cannot be recorded";function Rm(t){return!(!t.start_date||t.end_date)}function Am(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 Om=(t,e)=>`${t}${function(t){return t.current_iteration&&t.current_iteration>0?`${t.id}_${t.current_iteration}`:t.id}(e)}`,Pm=t=>Om("seenSurvey_",t),Fm=t=>{try{const e=Pm(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){Mm.error("Failed to persist survey seen state",t)}},Lm=[km.Popover,km.Widget,km.API],Dm={ignoreConditions:!1,ignoreDelay:!1,displayType:Em.Popover};function Nm(t,e){this.v=t,this.k=e}function jm(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);e>i;i++)n[i]=t[i];return n}function qm(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,s,r,o,l=[],a=!0,u=!1;try{if(r=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;a=!1}else for(;!(a=(n=r.call(i)).done)&&(l.push(n.value),l.length!==e);a=!0);}catch(t){u=!0,s=t}finally{try{if(!a&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return jm(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?jm(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Bm(t){var e,i;function n(e,i){try{var r=t[e](i),o=r.value,l=o instanceof Nm;Promise.resolve(l?o.v:o).then(function(i){if(l){var a="return"===e&&o.k?e:"next";if(!o.k||i.done)return n(a,i);i=t[a](i).value}s(!!r.done,i)},function(t){n("throw",t)})}catch(t){s(2,t)}}function s(t,s){2===t?e.reject(s):e.resolve({value:s,done:t}),(e=e.next)?n(e.key,e.arg):i=null}this._invoke=function(t,s){return new Promise(function(r,o){var l={key:t,arg:s,resolve:r,reject:o,next:null};i?i=i.next=l:(e=i=l,n(t,s))})},"function"!=typeof t.return&&(this.return=void 0)}Bm.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Bm.prototype.next=function(t){return this._invoke("next",t)},Bm.prototype.throw=function(t){return this._invoke("throw",t)},Bm.prototype.return=function(t){return this._invoke("return",t)};const zm=Object.entries,Um=Object.keys,Hm=Object.setPrototypeOf,Wm=Object.isFrozen,Vm=Object.getPrototypeOf,Gm=Object.getOwnPropertyDescriptor;let Jm=Object.freeze,Qm=Object.seal,Zm=Object.create,Km="undefined"!=typeof Reflect&&Reflect,Ym=Km.apply,Xm=Km.construct;Jm||(Jm=function(t){return t}),Qm||(Qm=function(t){return t}),Ym||(Ym=function(t,e){for(var i=arguments.length,n=new Array(i>2?i-2:0),s=2;i>s;s++)n[s-2]=arguments[s];return t.apply(e,n)}),Xm||(Xm=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;e>n;n++)i[n-1]=arguments[n];return new t(...i)});const ty=$y([].forEach),ey=$y([].lastIndexOf),iy=$y([].pop),ny=$y([].push),sy=$y([].slice),ry=$y([].splice),oy=Array.isArray,ly=Ty(Set),ay=$y(Set.prototype.add),uy=$y(Set.prototype.has),cy=$y("".toLowerCase),hy=$y("".toString),dy=$y("".match),vy=$y("".replace),fy=$y("".indexOf),py=$y("".trim),gy=$y((0).toString),my=$y(Boolean.prototype.toString),yy="undefined"==typeof BigInt?null:$y(BigInt.prototype.toString),by="undefined"==typeof Symbol?null:$y(Symbol.prototype.toString),_y=$y({}.hasOwnProperty),wy=$y({}.toString),ky=/t/.test,Sy=function(t,e){return t instanceof RegExp&&(t.lastIndex=0),Ym(ky,t,[e])},xy=Ty(TypeError);function $y(t){return function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),s=1;i>s;s++)n[s-1]=arguments[s];return Ym(t,e,n)}}function Ty(t){return function(){for(var e=arguments.length,i=new Array(e),n=0;e>n;n++)i[n]=arguments[n];return Xm(t,i)}}function Cy(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:cy;if(Hm&&Hm(t,null),!oy(e))return t;let n=e.length;for(;n--;){let s=e[n];if("string"==typeof s){const t=i(s);t!==s&&(Wm(e)||(e[n]=t),s=t)}t[s]=!0}return t}function Ey(t){for(let e=0;t.length>e;e++)_y(t,e)||(t[e]=null);return t}function My(t){const e=Zm(null);for(const n of zm(t)){var i=qm(n,2);const s=i[0],r=i[1];_y(t,s)&&(e[s]=oy(r)?Ey(r):r&&"object"==typeof r&&r.constructor===Object?My(r):r)}return e}function Iy(t){const e=Zm(null),i=Um(t);let n=i.length;for(;n--;)e[i[n]]=t[i[n]];return e}function Ry(t,e){for(;null!==t;){const i=Gm(t,e);if(i){if(i.get)return $y(i.get);if("function"==typeof i.value)return $y(i.value)}t=Vm(t)}return function(){return null}}const Ay=Jm(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Oy=Jm(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Py=Jm(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Fy=Jm(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ly=Jm(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Dy=Jm(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ny=Jm(["#text"]),jy=Jm(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),qy=Jm(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),By=Jm(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),zy=Jm(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Uy=Qm(/{{[\w\W]*|^[\w\W]*}}/g),Hy=Qm(/<%[\w\W]*|^[\w\W]*%>/g),Wy=Qm(/\${[\w\W]*/g),Vy=Qm(/{{|}}|\${|<%|%>|&lt;%|%&gt;/),Gy=Qm(/^data-[\-\w.\u00B7-\uFFFF]+$/),Jy=Qm(/^aria-[\-\w]+$/),Qy=Qm(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Zy=Qm(/^(?:\w+script|data):/i),Ky=Qm(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Yy=Qm(/^html$/i),Xy=Qm(/^[a-z][.\w]*(-[.\w]+)+$/i),tb=Qm(/<[/\w!]/g),eb=Qm(/<[/\w]/g),ib=Qm(/<\/no(script|embed|frames)/i),nb=Qm(/\/>/i),sb=Qm(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i),rb=Qm(/^[\r\n\t ]+/),ob=Jm(Cy({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),lb=function(){return"undefined"==typeof window?null:window},ab=function(t,e,i,n){return _y(t,e)&&oy(t[e])?Cy(n.base?Iy(n.base):{},t[e],n.transform):i},ub=function(t,e,i){const n=_y(t,e)?t[e]:void 0;return n&&"object"==typeof n?My(n):i};var cb=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:lb();const i=e=>t(e);if(i.version="3.4.18",i.removed=[],!e||!e.document||9!==e.document.nodeType||!e.Element)return i.isSupported=!1,i;let n=e.document;const s=n,r=s.currentScript,o=e.HTMLTemplateElement,l=e.Node,a=e.NodeFilter,u=e.DOMParser,c=e.trustedTypes,h=e.Element.prototype,d=Ry(h,"cloneNode"),v=Ry(h,"remove"),f=Ry(h,"removeAttributeNode"),p=Ry(h,"nextSibling"),g=Ry(h,"childNodes"),m=Ry(h,"parentNode"),y=Ry(h,"shadowRoot"),b=Ry(h,"attributes"),_=l&&l.prototype?Ry(l.prototype,"nodeType"):null,w=l&&l.prototype?Ry(l.prototype,"nodeName"):null,k=l&&l.prototype?Ry(l.prototype,"ownerDocument"):null,S=function(t){return _?_(t):t.nodeType},x=function(t){return w?w(t):t.nodeName},T=function(t){for(;null!==t;){const e=Gm(t,"namespaceURI");if(e)return e.get?$y(e.get):null;t=Vm(t)}return null}(h),C=function(t){return T?T(t):t.namespaceURI};if("function"==typeof o){const t=n.createElement("template");t.content&&t.content.ownerDocument&&(n=t.content.ownerDocument)}let E,M,I="",R=!1,A=0;const O=function(){if(A>0)throw xy('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},P=function(t){O(),A++;try{return E.createHTML(t)}finally{A--}},F=function(t){return E&&yt?P(t):t},L=n.implementation,D=n.createNodeIterator,N=n.createDocumentFragment,j=n.getElementsByTagName,q=s.importNode;let B={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};i.isSupported="function"==typeof zm&&"function"==typeof m&&L&&void 0!==L.createHTMLDocument;const z=Uy,U=Hy,H=Wy,W=Gy,V=Jy,G=Zy,J=Ky,Q=Xy;let Z=Qy,K=null;const Y=Cy({},[...Ay,...Oy,...Py,...Ly,...Ny]);let X=null;const tt=Cy({},[...jy,...qy,...By,...zy]);let et=null,it=null,nt=null;const st=Object.seal(Zm(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let rt=!0,ot=!0,lt=!1,at=!0,ut=!1,ct=!0,ht=!1,dt=!1,vt=null,ft=null,pt=!1,gt=!1,mt=!1,yt=!1,bt=!0,_t=!1;const wt="user-content-";let kt=!0,St=!1,xt=null,$t=!1,Tt=null;const Ct=Cy({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Et=null;const Mt=Cy({},["audio","video","img","source","image","track"]);let It=null;const Rt=Cy({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),At="http://www.w3.org/1998/Math/MathML",Ot="http://www.w3.org/2000/svg",Pt="http://www.w3.org/1999/xhtml";let Ft=Pt,Lt=!1,Dt=null;const Nt=Cy({},[At,Ot,Pt],hy),jt=Jm(Cy({},["mi","mo","mn","ms","mtext"]));let qt=null;const Bt=Jm(Cy({},["annotation-xml"]));let zt=null;const Ut=Jm(Zm(null)),Ht=Cy({},["title","style","font","a","script"]);let Wt=null;const Vt=["application/xhtml+xml","text/html"];let Gt=null,Jt=null;const Qt=n.createElement("form"),Zt=function(t){return t instanceof RegExp||t instanceof Function},Kt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t&&"object"==typeof t||(t={}),t=My(t),Wt=-1===Vt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Gt="application/xhtml+xml"===Wt?hy:cy,K=ab(t,"ALLOWED_TAGS",Y,{transform:Gt}),X=ab(t,"ALLOWED_ATTR",tt,{transform:Gt}),Dt=ab(t,"ALLOWED_NAMESPACES",Nt,{transform:hy}),It=ab(t,"ADD_URI_SAFE_ATTR",Rt,{transform:Gt,base:Rt}),Et=ab(t,"ADD_DATA_URI_TAGS",Mt,{transform:Gt,base:Mt}),Tt=ab(t,"FORBID_CONTENTS",Ct,{transform:Gt}),it=ab(t,"FORBID_TAGS",Zm(null),{transform:Gt}),nt=ab(t,"FORBID_ATTR",Zm(null),{transform:Gt}),$t=!!_y(t,"USE_PROFILES")&&(t.USE_PROFILES&&"object"==typeof t.USE_PROFILES?My(t.USE_PROFILES):t.USE_PROFILES),rt=!1!==t.ALLOW_ARIA_ATTR,ot=!1!==t.ALLOW_DATA_ATTR,lt=t.ALLOW_UNKNOWN_PROTOCOLS||!1,at=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,ut=t.SAFE_FOR_TEMPLATES||!1,ct=!1!==t.SAFE_FOR_XML,ht=t.WHOLE_DOCUMENT||!1,gt=t.RETURN_DOM||!1,mt=t.RETURN_DOM_FRAGMENT||!1,yt=t.RETURN_TRUSTED_TYPE||!1,pt=t.FORCE_BODY||!1,bt=!1!==t.SANITIZE_DOM,_t=t.SANITIZE_NAMED_PROPS||!1,kt=!1!==t.KEEP_CONTENT,St=t.IN_PLACE||!1,Z=function(t){if(!t)return!1;try{return Sy(t,""),!0}catch(t){return!1}}(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:Qy,Ft="string"==typeof t.NAMESPACE?t.NAMESPACE:Pt,qt=ub(t,"MATHML_TEXT_INTEGRATION_POINTS",jt),zt=ub(t,"HTML_INTEGRATION_POINTS",Bt);const e=ub(t,"CUSTOM_ELEMENT_HANDLING",Ut);if(et=Zm(null),_y(e,"tagNameCheck")&&Zt(e.tagNameCheck)&&(et.tagNameCheck=e.tagNameCheck),_y(e,"attributeNameCheck")&&Zt(e.attributeNameCheck)&&(et.attributeNameCheck=e.attributeNameCheck),_y(e,"allowCustomizedBuiltInElements")&&"boolean"==typeof e.allowCustomizedBuiltInElements&&(et.allowCustomizedBuiltInElements=e.allowCustomizedBuiltInElements),Qm(et),ut&&(ot=!1),mt&&(gt=!0),$t&&((_y(t,"ALLOWED_TAGS")||_y(t,"ALLOWED_ATTR"))&&"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("DOMPurify: USE_PROFILES overrides ALLOWED_TAGS and ALLOWED_ATTR. Do not use these options together."),K=Cy({},Ny),X=Zm(null),!0===$t.html&&(Cy(K,Ay),Cy(X,jy)),!0===$t.svg&&(Cy(K,Oy),Cy(X,qy),Cy(X,zy)),!0===$t.svgFilters&&(Cy(K,Py),Cy(X,qy),Cy(X,zy)),!0===$t.mathMl&&(Cy(K,Ly),Cy(X,By),Cy(X,zy))),st.tagCheck=null,st.attributeCheck=null,_y(t,"ADD_TAGS")&&("function"==typeof t.ADD_TAGS?st.tagCheck=t.ADD_TAGS:oy(t.ADD_TAGS)&&(K===Y&&(K=Iy(K)),Cy(K,t.ADD_TAGS,Gt))),_y(t,"ADD_ATTR")&&("function"==typeof t.ADD_ATTR?st.attributeCheck=t.ADD_ATTR:oy(t.ADD_ATTR)&&(X===tt&&(X=Iy(X)),Cy(X,t.ADD_ATTR,Gt))),_y(t,"ADD_FORBID_CONTENTS")&&oy(t.ADD_FORBID_CONTENTS)&&(Tt===Ct&&(Tt=Iy(Tt)),Cy(Tt,t.ADD_FORBID_CONTENTS,Gt)),kt&&(K["#text"]=!0),ht&&Cy(K,["html","head","body"]),K.table&&(K.tbody=!0,delete it.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw xy('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw xy('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const e=E;E=t.TRUSTED_TYPES_POLICY;try{I=P("")}catch(t){throw E=e,t}}else null===t.TRUSTED_TYPES_POLICY?(E=void 0,I=""):(void 0===E&&(R||(M=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let i=null;const n="data-tt-policy-suffix";e&&e.hasAttribute(n)&&(i=e.getAttribute(n));const s="dompurify"+(i?"#"+i:"");try{return t.createPolicy(s,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+s+" could not be created."),null}}(c,r),R=!0),E=M),E&&"string"==typeof I&&(I=P("")));Jt=Jm(t)},Yt=Cy({},[...Oy,...Py,...Fy]),Xt=Cy({},[...Ly,...Dy]),te=function(t){ny(i.removed,{element:t});try{m(t).removeChild(t)}catch(e){if(v(t),!m(t))throw xy("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},ee=function(t,e,i){try{f(t,e)}catch(e){try{t.removeAttribute(i)}catch(t){}}},ie=function(t){oe(t);const e=g(t);e&&ty(sy(e),t=>{try{v(t)}catch(t){}}),1===S(t)&&se(t,!1)},ne=function(t,e,n){if(!n)try{n=e.getAttributeNode(t)}catch(t){n=null}if(ny(i.removed,{attribute:n||null,from:e}),n)ee(e,n,t);else try{e.removeAttribute(t)}catch(t){}if("is"===t)if(gt||mt)try{te(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},se=function(t,e){const i=b(t);if(i)for(let n=i.length-1;n>=0;--n){const s=i[n],r=s&&s.name;"string"!=typeof r||e&&X[Gt(r)]||ee(t,s,r)}},re=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=[t];for(;n.length>0;){const t=n.pop();if(!1===e(t))continue;if(i&&1===S(t)){const e=y(t);ye(e)&&n.push(e)}const s=g(t);if(s)for(let t=s.length-1;t>=0;--t)n.push(s[t])}},oe=function(t){re(t,t=>{1===S(t)&&se(t,!0)})},le=function(t){const e=[];return re(t,t=>{e.push(t)},!0),e},ae=function(t,e){let n=!1;return ty(i.removed,e=>{e.element&&(n=n||e.element===t,oe(e.element))}),function(t,e){const i=ly();ty(le(t),t=>{1===S(t)&&ay(i,t)}),ty(e,t=>{1!==S(t)||uy(i,t)||se(t,!0)})}(t,e),n},ue=function(t,e,i,n){const s=de(t);let r;for(;r=s.nextNode();)uy(n,r)&&!uy(xt,r)&&(e&&_e(B.uponSanitizeShadowNode,r,null),Re(r,i))},ce=function(t,e){return!!ct&&("patchsrc"===t||"for"===t&&"label"!==e&&"output"!==e)},he=function(t){let e=null,i=null;if(pt)t="<remove></remove>"+t;else{const e=dy(t,rb);i=e&&e[0]}"application/xhtml+xml"===Wt&&Ft===Pt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const s=E?P(t):t;if(Ft===Pt)try{e=(new u).parseFromString(s,Wt)}catch(t){}if(!e||!e.documentElement){e=L.createDocument(Ft,"template",null);try{e.documentElement.innerHTML=Lt?I:s}catch(t){}}const r=e.body||e.documentElement;return t&&i&&r.insertBefore(n.createTextNode(i),r.childNodes[0]||null),Ft===Pt?j.call(e,ht?"html":"body")[0]:ht?e.documentElement:r},de=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=k?k(t):t.ownerDocument;return D.call(i||t,t,(e?0:a.SHOW_ELEMENT)|a.SHOW_COMMENT|a.SHOW_TEXT|a.SHOW_PROCESSING_INSTRUCTION|a.SHOW_CDATA_SECTION,null)},ve=function(t){return t=vy(t,z," "),t=vy(t,U," "),vy(t,H," ")},fe=function(t){var e;pe(t);const i=null===(e=t.querySelectorAll)||void 0===e?void 0:e.call(t,"template");i&&ty(i,t=>{ye(t.content)&&fe(t.content)})},pe=function(t){t.normalize();const e=de(t,!0);let i=e.nextNode();for(;i;)i.data=ve(i.data),i=e.nextNode()},ge=function(t){const e=w?w(t):null;return"string"==typeof e&&"form"===Gt(e)&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||t.attributes!==b(t)||"function"!=typeof t.removeAttribute||"function"!=typeof t.removeAttributeNode||"function"!=typeof t.getAttributeNode||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes||t.nodeType!==_(t)||t.childNodes!==g(t))},me=function(t){if(!_||"object"!=typeof t||null===t)return null;try{const e=_(t);return"number"==typeof e?e:null}catch(t){return null}},ye=function(t){return 11===me(t)},be=function(t){return null!==me(t)};function _e(t,e,n){0!==t.length&&ty(t,t=>{t.call(i,e,n,Jt)})}const we=function(t,e){if(t instanceof RegExp)return Sy(t,e);if(t instanceof Function){for(var i=arguments.length,n=new Array(i>2?i-2:0),s=2;i>s;s++)n[s-2]=arguments[s];return Boolean(t(e,...n))}return!1},ke=function(t,e,i,n){return 0===t.length?e:e===i||e===n?Iy(e):e},Se=function(t,e){return t!==e&&null===m(t)&&(St&&oe(t),!0)},xe=function(t,e){if(xt&&ay(xt,t),_e(B.beforeSanitizeElements,t,null),Se(t,e))return!0;if(ge(t))return te(t),!0;const n=Gt(x(t)),s=S(t);if(K=ke(B.uponSanitizeElement,K,Y,vt),_e(B.uponSanitizeElement,t,{tagName:n,allowedTags:K}),Se(t,e))return!0;if(function(t,e,i){return!!(ct&&1===i&&t.hasChildNodes()&&!be(t.firstElementChild)&&Sy(tb,t.textContent)&&Sy(tb,t.innerHTML))||!!(ct&&ob[e]&&1===i&&C(t)===Pt&&(be(t.firstElementChild)||"string"==typeof t.textContent&&Sy(tb,t.textContent)))||7===i||!(!ct||8!==i||!Sy(eb,t.data))}(t,n,s))return te(t),!0;if(it[n]||!(st.tagCheck instanceof Function&&st.tagCheck(n))&&!K[n]){const i=function(t,e,i){if(!it[e]&&Ce(e)&&we(et.tagNameCheck,e))return!1;if(kt&&!Tt[e]&&!Tt[cy(e)]){const e=m(t),n=g(t);if(n&&e)for(let s=n.length-1;s>=0;--s){const r=t===i?d(n[s],!0):n[s];e.insertBefore(r,p(t))}}return te(t),!0}(t,n,e);return!(!1!==i||(_e(B.afterSanitizeElements,t,null),!Se(t,e)))||i}if(1===s&&!function(t){const e=C(t),i=cy(x(t)),n=m(t);let s=Ft,r="template";return n&&1===S(n)&&(s=C(n),r=cy(x(n))),!!Dt[e]&&(e===Ot?function(t,e,i){return e===Pt?"svg"===t:e===At?"svg"===t&&("annotation-xml"===i||qt[i]):Boolean(Yt[t])}(i,s,r):e===At?function(t,e,i){return e===Pt?"math"===t:e===Ot?"math"===t&&zt[i]:Boolean(Xt[t])}(i,s,r):e===Pt?function(t,e,i){return!(e===Ot&&!zt[i])&&!(e===At&&!qt[i])&&!Xt[t]&&(Ht[t]||!Yt[t])}(i,s,r):"application/xhtml+xml"===Wt)}(t))return te(t),!0;if(("noscript"===n||"noembed"===n||"noframes"===n)&&Sy(ib,t.innerHTML))return te(t),!0;if(ut&&3===s){const e=t.textContent,n=ve(e);e!==n&&(ny(i.removed,{element:t.cloneNode()}),t.textContent=n)}return _e(B.afterSanitizeElements,t,null),Se(t,e)},$e=function(t,e,i){if(nt[e])return!1;if(ce(e,t))return!1;if(bt&&("id"===e||"name"===e)&&(i in n||i in Qt))return!1;const s=X[e]||st.attributeCheck instanceof Function&&st.attributeCheck(e,t);if(ot&&Sy(W,e))return!0;if(rt&&Sy(V,e))return!0;if(!s)return Ce(t)&&we(et.tagNameCheck,t)&&we(et.attributeNameCheck,e,t)||"is"===e&&et.allowCustomizedBuiltInElements&&we(et.tagNameCheck,i);if(It[e])return!0;const r=vy(i,J,"");return!(!Sy(Z,r)&&("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==fy(i,"data:")||!Et[t])&&(!lt||Sy(G,r))&&i)},Te=Cy({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ce=function(t){return!Te[cy(t)]&&Sy(Q,t)},Ee=function(t,e,i,n){if(E&&"object"==typeof c&&"function"==typeof c.getAttributeType&&!i)switch(c.getAttributeType(t,e)){case"TrustedHTML":return P(n);case"TrustedScriptURL":return function(t){O(),A++;try{return E.createScriptURL(t)}finally{A--}}(n)}return n},Me=function(t,e,i,n){try{return i?t.setAttributeNS(i,e,n):t.setAttribute(e,n),!ge(t)||(te(t),!1)}catch(i){return ne(e,t),!1}},Ie=function(t,e){return!(!ct||!Sy(sb,e))||"attributename"===cy(t)&&-1!==fy(e,"href")},Re=function(t,e){xe(t,e),function(t,e){if(_e(B.beforeSanitizeAttributes,t,null),Se(t,e))return;const n=t.attributes;if(!n||ge(t))return;X=ke(B.uponSanitizeAttribute,X,tt,ft);const s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:X,forceKeepAttr:void 0};let r=n.length;const o=Gt(x(t));for(;r--;){const e=n[r],l=e.name,a=e.namespaceURI,u=e.value,c=Gt(l),h=u;let d="value"===l?h:py(h),v=!1;s.attrName=c,s.attrValue=d,s.keepAttr=!0,s.forceKeepAttr=void 0,_e(B.uponSanitizeAttribute,t,s),d=s.attrValue,!_t||"id"!==c&&"name"!==c||0===fy(d,wt)||(ne(l,t,e),d=wt+d,v=!0),Ie(l,d)?ne(l,t,e):s.forceKeepAttr||(!s.keepAttr||!at&&Sy(nb,d)?ne(l,t,e):(ut&&(d=ve(d)),$e(o,c,d)?(d=Ee(o,c,a,d),d!==h&&Me(t,l,a,d)&&v&&iy(i.removed)):ne(l,t,e)))}_e(B.afterSanitizeAttributes,t,null),Se(t,e)}(t,e),ye(t.content)&&Ae(t.content)},Ae=function(t){let e=null;const i=de(t);for(_e(B.beforeSanitizeShadowDOM,t,null);e=i.nextNode();)if(_e(B.uponSanitizeShadowNode,e,null),Re(e,t),1===S(e)){const t=y(e);ye(t)&&(Oe(t),Ae(t))}ut&&pe(t),_e(B.afterSanitizeShadowDOM,t,null)},Oe=function(t){const e=[{node:t,shadow:null}];for(;e.length>0;){const t=e.pop();if(t.shadow){Ae(t.shadow);continue}const i=t.node,n=1===S(i),s=g(i);if(s)for(let t=s.length-1;t>=0;--t)e.push({node:s[t],shadow:null});if(n){const t=w?w(i):null;if("string"==typeof t&&"template"===Gt(t)){const t=i.content;ye(t)&&e.push({node:t,shadow:null})}}if(n){const t=y(i);ye(t)&&e.push({node:null,shadow:t},{node:t,shadow:null})}}};return i.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=null,o=null,l=null;if(Lt=!t,Lt&&(t="\x3c!--\x3e"),"string"!=typeof t&&!be(t)&&"string"!=typeof(t=function(t){switch(typeof t){case"string":return t;case"number":return gy(t);case"boolean":return my(t);case"bigint":return yy?yy(t):"0";case"symbol":return by?by(t):"Symbol()";case"undefined":default:return wy(t);case"function":case"object":{if(null===t)return wy(t);const e=t,i=Ry(e,"toString");if("function"==typeof i){const t=i(e);return"string"==typeof t?t:wy(t)}return wy(t)}}}(t)))throw xy("dirty is not a string, aborting");if(!i.isSupported)return t;dt?(K=vt,X=ft):Kt(e),i.removed=[];const a=St&&"string"!=typeof t&&be(t);let u=[];const c=xt;if(a){ct&&re(t,t=>{const e=S(t);if(7===e||8===e&&Sy(eb,t.data)){try{v(t)}catch(t){}return!1}if(1===e){const e=t,i=Gt(x(t));try{e.hasAttribute&&e.hasAttribute("patchsrc")&&e.removeAttribute("patchsrc"),e.hasAttribute&&e.hasAttribute("for")&&ce("for",i)&&e.removeAttribute("for")}catch(t){}}return!0});const e=x(t);if("string"==typeof e){const i=Gt(e);if(!K[i]||it[i])throw ie(t),xy("root node is forbidden and cannot be sanitized in-place")}if(ge(t))throw ie(t),xy("root node is clobbered and cannot be sanitized in-place");u=le(t),xt=ly()}else if(be(t))n=he("\x3c!----\x3e"),r=n.ownerDocument.importNode(t,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?n=r:n.appendChild(r),Oe(n);else{if(!gt&&!ut&&!ht&&-1===t.indexOf("<"))return F(t);if(n=he(t),!n)return gt?null:yt?I:""}n&&pt&&te(n.firstChild);const h=a?t:n;try{a&&Oe(t);const e=de(h);for(;o=e.nextNode();)Re(o,h);a&&function(t,e){const i=xt;let n=null;const s=()=>(n||(n=ly(),ty(e,t=>{ay(n,t)})),n);for(let e=0;;e++){const n=le(t),r=[t];let o=!1;if(ty(n,t=>{11===S(t)?ny(r,t):o||uy(i,t)||(o=uy(s(),t))}),!o)return;if(e>=8)throw xy("the tree kept changing during in-place sanitization; refusing to return it");ty(r,(e,i)=>{ue(e,i>0,t,s())})}}(t,u)}catch(e){throw a&&(ie(t),ae(t,u)),e}finally{xt=c}if(a){if(ae(t,u))throw xy("a node selected for removal could not be safely returned; refusing to sanitize in place");return ut&&fe(t),t}if(gt){if(ut&&fe(n),mt)for(l=N.call(n.ownerDocument);n.firstChild;)l.appendChild(n.firstChild);else l=n;return(X.shadowroot||X.shadowrootmode)&&(l=q.call(s,l,!0)),l}const d=()=>ht?n.outerHTML:n.innerHTML;let f=d();return ut&&Sy(Vy,f)&&(pe(n),f=d()),ht&&K["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&Sy(Yy,n.ownerDocument.doctype.name)&&(f="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+f),F(f)},i.setConfig=function(){Kt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),dt=!0,vt=K,ft=X},i.clearConfig=function(){Jt=null,dt=!1,vt=null,ft=null,E=M,I=""},i.isValidAttribute=function(t,e,i){Jt||Kt({});const n=Gt(t),s=Gt(e);return("string"!=typeof i||!(Ie(e,i)||!at&&Sy(nb,i)))&&$e(n,s,i)},i.addHook=function(t,e){"function"==typeof e&&_y(B,t)&&ny(B[t],e)},i.removeHook=function(t,e){if(_y(B,t)){if(void 0!==e){const i=ey(B[t],e);return-1===i?void 0:ry(B[t],i,1)[0]}return iy(B[t])}},i.removeHooks=function(t){_y(B,t)&&(B[t]=[])},i.removeAllHooks=function(){B={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},i}();const hb=["a","abbr","acronym","area","article","aside","b","bdi","bdo","blockquote","br","caption","center","cite","code","col","colgroup","data","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","footer","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","img","ins","kbd","li","map","mark","nav","ol","p","pre","q","rp","rt","rtc","ruby","s","samp","small","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","time","tr","tt","u","ul","var","wbr"],db=["style","lang","title","width","height"],vb=["abbr","align","axis","bgcolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"],fb={a:["href","hreflang","target","rel"],bdo:["dir"],blockquote:["cite"],col:["align","char","charoff","span"],colgroup:["align","char","charoff","span"],del:["cite","datetime"],hr:["align","size","width"],img:["align","alt","height","src","width"],ins:["cite","datetime"],ol:["start","type"],q:["cite"],table:["align","bgcolor","border","cellpadding","cellspacing","frame","rules","summary","width"],tbody:["align","char","charoff","valign"],td:vb,tfoot:["align","char","charoff","valign"],th:vb,thead:["align","char","charoff","valign"],tr:["align","bgcolor","char","charoff","valign"]};let pb;function gb(t){var e;const i=(null!==(e=pb)&&void 0!==e?e:pb=cb()).sanitize(t,{ALLOWED_TAGS:hb,ALLOWED_ATTR:[],ALLOW_ARIA_ATTR:!1,ALLOW_DATA_ATTR:!1,ALLOWED_NAMESPACES:["http://www.w3.org/1999/xhtml"],ADD_ATTR:(t,e)=>-1!==db.indexOf(t)||{}.hasOwnProperty.call(fb,e)&&-1!==(fb[e]||[]).indexOf(t),RETURN_DOM_FRAGMENT:!0}),n=i.querySelectorAll("a");for(let t=0;n.length>t;t++)n.item(t).relList.add("noopener");const s=document.createElement("div");return s.appendChild(i),s.innerHTML}const mb=Hr("[Stylesheet Loader]"),yb="#020617",bb={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:_m.Right,widgetType:bm.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,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:yb,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},_b=[_m.Center,_m.Left,_m.Right];function wb(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 kb(t=bb.backgroundColor){let e;"#"===t[0]&&(e=wb(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=wb(i)),!e)return yb;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?yb:"white"}return yb}const Sb=(t,e,i)=>{const n=zb(t),s=document.querySelector(`.${n}`);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};const r=document.createElement("div");((t,e,i)=>{const n=ue(ue({},bb),i),s=t.style,r=!_b.includes(n.position)||e===km.Widget&&(null==i?void 0:i.widgetType)===bm.Tab;var o;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)||kb(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",kb(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||kb(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),o=s,"white"===kb(n.backgroundColor)?o.setProperty("--ph-logo-mono","1"):o.removeProperty("--ph-logo-mono"),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",kb(n.widgetColor)),s.setProperty("--ph-widget-z-index",n.zIndex);const l=(null==i?void 0:i.inputBackground)||(null==i?void 0:i.inputBackgroundColor);let a=l||n.inputBackground;l||"white"!==n.backgroundColor||(a="#f8f8f8"),s.setProperty("--ph-survey-input-background",a);const u=(null==i?void 0:i.inputTextColor)||kb(a);s.setProperty("--ph-survey-input-text-color",u),s.setProperty("--ph-survey-rating-text-color",u),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||(mb.error("prepare_external_dependency_stylesheet returned null"),null)})(document,':host{--ph-survey-font-family:-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--ph-survey-box-padding:20px 24px;--ph-survey-max-width:300px;--ph-survey-z-index:calc(2147480000 + 3645);--ph-survey-border-color:#dcdcdc;--ph-survey-border-bottom:1.5px solid var(--ph-survey-border-color);--ph-survey-border-radius:10px;--ph-survey-background-color:#eeeded;--ph-survey-box-shadow:0 4px 12px #00000026;--ph-survey-submit-button-color:black;--ph-survey-submit-button-text-color:white;--ph-survey-rating-bg-color:white;--ph-survey-rating-text-color:#020617;--ph-survey-rating-active-bg-color:black;--ph-survey-rating-active-text-color:white;--ph-survey-text-primary-color:#020617;--ph-survey-text-subtle-color:#939393;--ph-widget-color:#e0a045;--ph-widget-text-color:white;--ph-survey-scrollbar-thumb-color:var(--ph-survey-border-color);--ph-survey-scrollbar-track-color:var(--ph-survey-background-color);--ph-survey-outline-color:#3b82f6cc;--ph-survey-input-background:white;--ph-survey-input-text-color:#020617;--ph-survey-disabled-button-opacity:.6}.ph-survey{min-width:300px;width:var(--ph-survey-max-width);max-width:85%;z-index:var(--ph-survey-z-index);height:fit-content;margin:0;position:fixed;bottom:0}.ph-survey h3,.ph-survey p{margin:0}.ph-survey *{box-sizing:border-box;font-family:var(--ph-survey-font-family);color:var(--ph-survey-text-primary-color)}.ph-survey textarea,.ph-survey input[type=text],.ph-survey .multiple-choice-options label{color:var(--ph-survey-input-text-color);background:var(--ph-survey-input-background);border:1.5px solid var(--ph-survey-border-color);border-radius:4px;padding:10px;transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey textarea,.ph-survey input[type=text]{transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input{margin:0}.ph-survey textarea:focus,.ph-survey textarea:focus-visible,.ph-survey input[type=text]:focus,.ph-survey input[type=text]:focus-visible,.ph-survey .form-submit:focus,.ph-survey .form-submit:focus-visible,.ph-survey input[type=checkbox]:focus,.ph-survey input[type=radio]:focus,.ph-survey input[type=checkbox]:focus-visible,.ph-survey input[type=radio]:focus-visible{outline:1.5px solid var(--ph-survey-outline-color);border-color:var(--ph-survey-rating-active-bg-color);outline-offset:2px}.ph-survey textarea:focus:not(:focus-visible),.ph-survey input[type=text]:focus:not(:focus-visible),.ph-survey button:focus:not(:focus-visible),.ph-survey input[type=checkbox]:focus:not(:focus-visible),.ph-survey input[type=radio]:focus:not(:focus-visible){outline:none}.ph-survey textarea:hover:not(:focus),.ph-survey input[type=text]:hover:not(:focus){border-color:var(--ph-survey-rating-active-bg-color)}@media (max-width:768px){.ph-survey textarea,.ph-survey input[type=text]{font-size:1rem}}.ph-survey .multiple-choice-options label,.ph-survey .rating-options-number,.ph-survey .form-cancel,.ph-survey input[type=checkbox],.ph-survey input[type=radio]{border:1.5px solid var(--ph-survey-border-color)}.ph-survey label,.ph-survey input[type=checkbox],.ph-survey input[type=radio],.ph-survey .ratings-emoji,.ph-survey .ratings-number,.ph-survey .footer-branding,.ph-survey .form-cancel,.ph-survey .form-submit{transition:all .2s ease-out}@media (prefers-reduced-motion:no-preference){.ph-survey button:active,.ph-survey input[type=checkbox]:active,.ph-survey input[type=radio]:active,.ph-survey label:active{transition-duration:.1s}}.ph-survey-widget-tab{background:var(--ph-widget-color);color:var(--ph-widget-text-color);text-align:center;cursor:pointer;z-index:var(--ph-survey-z-index);border:none;border-radius:3px 3px 0 0;padding:10px 12px;transition:padding .2s ease-out;position:fixed}.ph-survey-widget-tab:hover:not(.widget-tab-top){padding-bottom:16px}.ph-survey-widget-tab.widget-tab-top{border-radius:0 0 3px 3px}.ph-survey-widget-tab.widget-tab-top:hover{padding-top:16px}@keyframes ph-survey-fade-in{0%{opacity:0}to{opacity:1}}.survey-box{flex-direction:column;gap:16px;display:flex}.bottom-section{flex-direction:column;gap:8px;display:flex}.thank-you-message-header~.bottom-section,.intro-screen-header~.bottom-section{padding-top:16px}.question-container,.thank-you-message,.intro-screen{flex-direction:column;gap:8px;display:flex}.survey-question{font-size:14px;font-weight:500}.survey-question-description{opacity:.8;padding-top:4px;font-size:13px}.survey-question-description,.thank-you-message-body,.intro-screen-body{word-wrap:break-word;overflow-wrap:break-word}:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) img,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) video,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) iframe,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) embed,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) object,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) svg{max-width:100%;height:auto}.question-textarea-wrapper{flex-direction:column;display:flex}.survey-form{animation:.3s ease-out forwards ph-survey-fade-in}.survey-form,.thank-you-message,.intro-screen{text-align:left;width:100%;z-index:var(--ph-survey-z-index);border:1.5px solid var(--ph-survey-border-color);border-bottom:var(--ph-survey-border-bottom);background:var(--ph-survey-background-color);border-radius:var(--ph-survey-border-radius);box-shadow:var(--ph-survey-box-shadow);padding:var(--ph-survey-box-padding);margin:0;position:relative}.survey-form textarea,.survey-form input[type=text]{min-width:100%}.survey-form textarea:focus,.survey-form textarea:focus-visible{box-shadow:0 4px 12px #00000014}.survey-form textarea:focus:not(:focus-visible){box-shadow:none}.survey-box .question-header--empty~.multiple-choice-options,.survey-box .question-header--empty~textarea{margin-top:0}.multiple-choice-options{border:none;flex-direction:column;gap:8px;margin:0;padding:1px 0;font-size:14px;display:flex}.multiple-choice-options label,.multiple-choice-options .response-choice{color:inherit;align-items:center;gap:8px;display:flex}.multiple-choice-options label{cursor:pointer;font-size:13px}.multiple-choice-options label:hover:not(:has(input:checked)){border-color:var(--ph-survey-text-subtle-color);box-shadow:0 2px 8px #00000014}.multiple-choice-options label:has(input:checked){border-color:var(--ph-survey-rating-active-bg-color);box-shadow:0 1px 4px #0000000d}.multiple-choice-options label.choice-option-open{flex-wrap:wrap}.multiple-choice-options label span{color:inherit}.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ph-survey-input-background);cursor:pointer;z-index:1;border-radius:3px;flex-shrink:0;width:1rem;height:1rem;transition:all .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out;position:relative}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):focus{transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):hover{border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):active{transform:scale(.95)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked{background:var(--ph-survey-rating-active-bg-color);border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked:hover{transform:scale(1.05)}.multiple-choice-options input[type=checkbox]:checked:after{border:solid var(--ph-survey-rating-active-text-color);border-width:0 2px 2px 0;width:4px;height:8px;animation:.2s ease-out .1s forwards ph-survey-checkmark-reveal;left:4px;transform:rotate(45deg)scale(0)}.multiple-choice-options input[type=radio]:checked:after{background:var(--ph-survey-rating-active-text-color);border-radius:50%;width:6px;height:6px;animation:.15s ease-out 50ms forwards ph-survey-radio-reveal;top:5px;left:5px;transform:scale(0)}.multiple-choice-options input[type=checkbox]:checked:after,.multiple-choice-options input[type=radio]:checked:after{content:"";box-sizing:content-box;position:absolute}.multiple-choice-options input[type=radio]{border-radius:50%}.multiple-choice-options input[type=radio]:checked{border:none}:is(.multiple-choice-options input[type=checkbox]:checked,.multiple-choice-options input[type=radio]:checked)~*{font-weight:700}.multiple-choice-options .choice-option-open input[type=text]::placeholder{color:var(--ph-survey-text-subtle-color);font-weight:400}.rating-options-emoji{justify-content:space-between;display:flex}.rating-options-emoji-2{justify-content:space-around}.ratings-emoji{opacity:.5;background-color:#0000;border:none;padding:0;font-size:16px}.ratings-emoji:hover{cursor:pointer;opacity:1;transform:scale(1.15)}.ratings-emoji.rating-active{opacity:1}.ratings-emoji svg{fill:var(--ph-survey-text-primary-color);transition:fill .2s ease-out}.rating-options-number{border-radius:6px;grid-auto-columns:1fr;grid-auto-flow:column;display:grid;overflow:hidden}.rating-options-number .ratings-number{border-right:1px solid var(--ph-survey-border-color);text-align:center;cursor:pointer;color:var(--ph-survey-rating-text-color);border-top:none;border-bottom:none;border-left:none;font-weight:700}.rating-options-number .ratings-number:last-of-type{border-right:0}.rating-options-number .ratings-number.rating-active{background:var(--ph-survey-rating-active-bg-color);color:var(--ph-survey-rating-active-text-color)}.ratings-number{background-color:var(--ph-survey-rating-bg-color);border:none;padding:8px 0}.ratings-number .rating-active{background-color:var(--ph-survey-rating-active-bg-color)}.ratings-number{cursor:pointer}@media (hover:hover) and (pointer:fine){.ratings-number:hover:not(.rating-active){background-color:color-mix(in srgb, var(--ph-survey-rating-active-bg-color) 14%, var(--ph-survey-rating-bg-color))}}.rating-text{opacity:.7;flex-direction:row;justify-content:space-between;font-size:11px;display:flex}.form-buttons{flex-direction:row;gap:8px;width:100%;display:flex}.form-buttons-with-back>.form-submit{flex:auto;min-width:0}.form-submit{text-align:center;cursor:pointer;user-select:none;background:var(--ph-survey-submit-button-color);color:var(--ph-survey-submit-button-text-color);border:none;border-radius:6px;min-width:100%;padding:12px;font-weight:700;box-shadow:0 2px #0000000b}.form-submit:not([disabled]):hover{transform:scale(1.02);box-shadow:0 4px 8px #0000001a}.form-submit:not([disabled]):active{transform:scale(.98);box-shadow:0 1px 2px #0000000d}.form-submit[disabled]{opacity:var(--ph-survey-disabled-button-opacity);cursor:not-allowed}.form-back{text-align:center;cursor:pointer;user-select:none;color:var(--ph-survey-text-primary-color);border:1.5px solid var(--ph-survey-border-color);background:0 0;border-radius:6px;flex:none;padding:12px 16px;font-weight:600}.form-back:hover{transform:scale(1.02)}.form-back:active{transform:scale(.98)}.validation-hint{opacity:.7;margin-top:4px;font-size:12px}.form-cancel{cursor:pointer;background:#fff;border-radius:100%;padding:12px;line-height:0;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.form-cancel:hover{opacity:.7;transform:translate(50%,-50%)scale(1.1)}.footer-branding{opacity:.6;justify-content:center;align-items:center;gap:4px;font-size:11px;font-weight:500;text-decoration:none;display:flex}.footer-branding:hover{opacity:1}.footer-branding a{text-decoration:none}.thank-you-message{text-align:center}.thank-you-message-header{margin:10px 0 0}.thank-you-message-body{opacity:.8;font-size:14px}.intro-screen{text-align:center;animation:.3s ease-out forwards ph-survey-fade-in}.intro-screen-header{margin:10px 0 0}.intro-screen-body{opacity:.8;font-size:14px}.limit-height{scrollbar-width:thin;scrollbar-color:var(--ph-survey-scrollbar-thumb-color) var(--ph-survey-scrollbar-track-color);max-height:256px;overflow:hidden auto}.limit-height::-webkit-scrollbar{width:8px}.limit-height::-webkit-scrollbar-track{background:var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb{background-color:var(--ph-survey-scrollbar-thumb-color);border:2px solid var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb:hover{background-color:var(--ph-survey-text-subtle-color)}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.ph-survey *{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@keyframes ph-survey-checkmark-reveal{0%{opacity:0;transform:rotate(45deg)scale(0)}50%{opacity:1;transform:rotate(45deg)scale(1.2)}to{opacity:1;transform:rotate(45deg)scale(1)}}@keyframes ph-survey-radio-reveal{0%{opacity:0;transform:scale(0)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}',null==t?void 0:t.config.prepareStylesheet);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||document.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},xb=t=>{try{const e=Pm(t);localStorage.getItem(e)||localStorage.setItem(e,"true")}catch(t){Mm.error("Failed to persist survey seen state",t)}},$b=({responses:t,survey:e,surveySubmissionId:i,posthog:n,isSurveyCompleted:s,properties:r,surveyLanguage:o,questionSnapshots:l})=>{var a,u,c;n?(null===(a=n.client)||void 0===a?void 0:a.canCapture)&&(xb(e),s&&Bb(e),null===(u=n.client)||void 0===u||u.capture(Tm.SENT,ue(ue(ue({[Cm.SURVEY_NAME]:e.name,[Cm.SURVEY_ID]:e.id,[Cm.SURVEY_ITERATION]:e.current_iteration,[Cm.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,sessionRecordingUrl:Wg(n)},uu(ue(ue({event:"sent",survey:e,responses:t,submissionId:i,completed:s},!Ce(o)&&{surveyLanguage:o}),!Ce(l)&&{questionSnapshots:l}))),r),{},{$set:{[hu(e,"responded")]:!0}})),s&&(window.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:e.id}})),null===(c=n.client)||void 0===c||null===(c=c.getExtension("featureFlagsCommon"))||void 0===c||c.reloadFeatureFlags())):Mm.error("[survey sent] event not captured, PostHog instance not found.")},Tb=(t,e,i,n)=>ue({[Cm.SURVEY_NAME]:e.name,[Cm.SURVEY_ID]:e.id,[Cm.SURVEY_ITERATION]:e.current_iteration,[Cm.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,sessionRecordingUrl:Wg(n)},uu(ue(ue(ue(ue({event:t,survey:e},!Ce(null==i?void 0:i.responses)&&{responses:i.responses}),!Ce(null==i?void 0:i.surveySubmissionId)&&{submissionId:i.surveySubmissionId}),!Ce(null==i?void 0:i.surveyLanguage)&&{surveyLanguage:i.surveyLanguage}),!Ce(null==i?void 0:i.questionSnapshots)&&{questionSnapshots:i.questionSnapshots}))),Cb=(t,e,i,n)=>{var s;if(!e)return void Mm.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const r=jb(t),o=r?r.surveyLanguage:n,l=ue(ue(ue({},Tb("dismissed",t,r,e)),o&&{[Cm.SURVEY_LANGUAGE]:o}),{},{$set:{[hu(t,"dismissed")]:!0}});Bb(t),xb(t),null===(s=e.client)||void 0===s||s.capture(Tm.DISMISSED,l),window.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:t.id}}))},Eb=(t,e)=>{var i,n;if(!e)return void Mm.error("[survey abandoned] event not captured, PostHog instance not found.");if(!(null===(i=e.client)||void 0===i?void 0:i.canCapture))return;const s=(t=>Om("abandonedSurvey_",t))(t);try{if("true"===localStorage.getItem(s))return}catch(t){return}const r=jb(t);if(r){try{localStorage.setItem(s,"true")}catch(t){}null===(n=e.client)||void 0===n||n.capture(Tm.ABANDONED,Tb("abandoned",t,r,e),{delivery:"unload"})}},Mb=t=>{const e=t.map(t=>t.id);return e.every(t=>!!t)?e:void 0},Ib=(t,e)=>{var i,n,s;return(t=>t.questions.some(t=>{var e;return!!(null===(e=t.branching)||void 0===e?void 0:e.type)}))(t)?t.questions:e?null!==(i=((t,e)=>{if(!e||e.length!==t.questions.length)return null;const i=new Map(t.questions.map(t=>[t.id,t])),n=[];for(const t of e){const e=i.get(t);if(!e)return null;n.push(e)}return n})(t,e.questionOrder))&&void 0!==i?i:t.questions:t.appearance&&t.appearance.shuffleQuestions&&!t.enable_partial_responses?(n=t.questions,s=Su(t.questions),n.length===s.length&&n.every((t,e)=>t===s[e])?s.reverse():s):t.questions},Rb=t=>yu(t)||qb(t),Ab=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,Tg(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"+dg++,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}),Ob=()=>cm(Ab),Pb=({component:t,children:e,renderAsHtml:i,style:n})=>function(t,e,i){var n,s,r,o,l=mg({},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?Yp.call(arguments,2):i),_g(t.type,l,n||t.key,s||t.ref,null)}(t,i?{dangerouslySetInnerHTML:{__html:gb(e)},style:n}:{children:e,style:n});function Fb(t,e){var i,n,s;if(!(null===(i=t.conditions)||void 0===i?void 0:i.url))return!0;const r=null!==(n=fo(e))&&void 0!==n?n:"u">typeof window?window.location.href:void 0;if(!r)return!1;const o=[t.conditions.url],l=function(t){return null!=t?t:"icontains"}(null===(s=t.conditions)||void 0===s?void 0:s.urlMatchType);return wu[l](o,[r])}const Lb=t=>Om("inProgressSurvey_",t),Db={},Nb=(t,e)=>{const i=Lb(t);try{localStorage.setItem(i,JSON.stringify(e)),delete Db[i]}catch(t){Mm.error("Error setting in-progress survey state in localStorage",t),Db[i]=e}},jb=t=>{const e=Lb(t),i=Db[e];if(i)return i;try{const t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch(t){Mm.error("Error getting in-progress survey state from localStorage",t)}return null},qb=t=>{const e=jb(t);return!Re(null==e?void 0:e.surveySubmissionId)},Bb=t=>{const e=Lb(t);delete Db[e];try{localStorage.removeItem(e)}catch(t){Mm.error("Error clearing in-progress survey state from localStorage",t)}};function zb(t,e=!1){const i=`PostHogSurvey-${t.id}`;return e?`.${i}`:i}function Ub(t,e=_m.Right,i){if(t===km.ExternalSurvey)return{};switch(e){case _m.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case _m.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case _m.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case _m.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case _m.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case _m.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case _m.Left:return{left:"30px"};case _m.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:t===km.Widget&&i===bm.Tab?"60px":"30px"}}}const Hb=Ug("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Ug("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"})}),Wb=Ug("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Ug("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"})}),Vb=Ug("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Ug("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"})}),Gb=Ug("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Ug("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"})}),Jb=Ug("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Ug("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"})}),Qb=Ug("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Ug("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"})}),Zb=Ug("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Ug("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"})}),Kb=({fill:t="currentColor"}={})=>Ug("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:[Ug("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),Ug("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})]}),Yb=Ug("svg",{width:"80",height:"14",viewBox:"0 0 160 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Ug("g",{"clip-path":"url(#ph-survey-logo-clip)",style:"opacity: calc(1 - var(--ph-logo-mono, 0))",children:[Ug("path",{fill:"currentColor",d:"M51.66 25.22A1.9 1.9 0 0 0 50 23.33l-.34-.04c-1-.13-1.94-.6-2.65-1.33L33.28 7.75V28H49a2.66 2.66 0 0 0 2.67-2.67zM39.2 23.54h-.09a1.78 1.78 0 1 1 .1 0"}),Ug("path",{fill:"url(#ph-survey-logo-paint0)",d:"M21.96 2.67v4.96l11.3 11.6h.02V7.75L26.63.85a2.8 2.8 0 0 0-2-.85 2.67 2.67 0 0 0-2.67 2.67"}),Ug("path",{fill:"url(#ph-survey-logo-paint1)",d:"M21.96 7.63v11.05L31.03 28h2.25v-8.75z"}),Ug("path",{fill:"url(#ph-survey-logo-paint2)",d:"M21.96 28h9.07l-9.07-9.32z"}),Ug("path",{fill:"url(#ph-survey-logo-paint3)",d:"M10.74 2.66v4.5l11.22 11.52V7.63L15.3.8a2.66 2.66 0 0 0-4.56 1.86"}),Ug("path",{fill:"url(#ph-survey-logo-paint4)",d:"M10.74 28h8.96l-8.96-9.32z"}),Ug("path",{fill:"url(#ph-survey-logo-paint5)",d:"M10.74 7.16v11.52L19.7 28h2.26v-9.32z"}),Ug("path",{fill:"url(#ph-survey-logo-paint6)",d:"M10.74 7.16 4.54.8A2.66 2.66 0 0 0 0 2.66V7.5l10.74 11.18z"}),Ug("path",{fill:"url(#ph-survey-logo-paint7)",d:"M9.19 28h1.55v-9.32L0 7.5v10.73z"}),Ug("path",{fill:"url(#ph-survey-logo-paint8)",d:"M0 25.41A2.6 2.6 0 0 0 2.58 28H9.2L0 18.23z"})]}),Ug("path",{"clip-path":"url(#ph-survey-logo-clip)",fill:"currentColor",style:"opacity: var(--ph-logo-mono, 0)",d:"m50.02 23.34-.34-.04c-1-.13-1.95-.6-2.66-1.33L35.58 10.11a.5.5 0 0 0-.86.35V27.5c0 .28.22.5.5.5H49c1.48 0 2.67-1.2 2.67-2.67v-.1a1.9 1.9 0 0 0-1.66-1.9m-10.81.2a1.78 1.78 0 1 1 0-3.56 1.78 1.78 0 0 1 0 3.57M0 25.41A2.6 2.6 0 0 0 2.59 28h5.22a.5.5 0 0 0 .37-.84L.87 19.13a.5.5 0 0 0-.87.34zm18.81 1.74a.5.5 0 0 1-.36.85h-7.09a.5.5 0 0 1-.37-.17L8.94 25.5.13 15.82A.5.5 0 0 1 0 15.5V8.75a.5.5 0 0 1 .86-.34zM0 2.68C0 .28 2.92-.91 4.59.82l25.6 26.33a.5.5 0 0 1-.36.85h-7.76a.5.5 0 0 1-.37-.17l-2.1-2.33L.28 5.3A1 1 0 0 1 0 4.6zm10.74 0c0-2.4 2.92-3.59 4.59-1.87L32.5 18.48l.5.51v7.3a.5.5 0 0 1-.86.35l-1.12-1.14L11.3 5.23a2 2 0 0 1-.57-1.4zM33 7.46v7.8a.5.5 0 0 1-.85.36l-9.61-9.89a2 2 0 0 1-.57-1.4V2.69c0-2.4 2.92-3.59 4.59-1.86z"}),Ug("path",{fill:"currentColor",d:"M64.9 22.88c-.67 0-1.23-.56-1.23-1.24V5.24c0-.69.56-1.24 1.24-1.24h6.55c3.89 0 6.39 2.32 6.39 5.9 0 3.6-2.5 5.91-6.4 5.91h-3.53v5.83c0 .68-.56 1.24-1.24 1.24zm3.02-11.94c0 .68.55 1.23 1.23 1.23h1.88c1.6 0 2.58-.86 2.58-2.26s-.97-2.27-2.58-2.27h-1.88c-.68 0-1.23.55-1.23 1.23zM84.71 23.1c-4.18 0-7.14-2.97-7.14-7.02s2.96-7.01 7.14-7.01c4.14 0 7.14 2.97 7.14 7.01 0 4.05-3 7.01-7.14 7.01m-3.22-7.02c0 2.16 1.3 3.64 3.22 3.64 1.9 0 3.2-1.48 3.2-3.64s-1.3-3.64-3.2-3.64c-1.93 0-3.22 1.48-3.22 3.64m16.34 7.03a6.2 6.2 0 0 1-5.54-3.01c-.34-.57-.01-1.26.6-1.5l.77-.3c.7-.27 1.45.15 1.92.73a2.8 2.8 0 0 0 2.25 1.08c1.05 0 1.75-.51 1.75-1.27 0-2.13-7.17-.7-7.17-5.85 0-2.13 1.85-3.91 4.83-3.91 2.27 0 4.2.9 5.17 2.31.36.53.05 1.2-.54 1.44l-.85.35c-.68.29-1.45-.14-2-.63a2.5 2.5 0 0 0-1.64-.64c-.89 0-1.5.38-1.5.97 0 2.16 7.27.38 7.27 5.88 0 2.35-2.15 4.34-5.32 4.34m14.64-1.31c.04.57-.3 1.1-.86 1.2q-.6.1-1.27.11c-2.92 0-5.15-1.56-5.15-4.85v-5.66h-.91c-.69 0-1.24-.56-1.24-1.24v-.82c0-.68.55-1.23 1.24-1.23h.91v-2.7c0-.69.55-1.24 1.23-1.24h1.48c.68 0 1.24.55 1.24 1.23v2.7h2.04c.68 0 1.23.56 1.23 1.24v.82c0 .68-.55 1.24-1.23 1.24h-2.04v5.15c0 1.2.64 1.91 1.6 1.91.75 0 1.6.5 1.66 1.25zM125.5 5.23c0-.68.55-1.23 1.23-1.23h1.8c.68 0 1.23.55 1.23 1.23v16.41c0 .68-.55 1.24-1.23 1.24h-1.8c-.68 0-1.23-.56-1.23-1.24v-5.43c0-.68-.56-1.23-1.24-1.23h-5c-.67 0-1.23.55-1.23 1.23v5.43c0 .68-.55 1.24-1.23 1.24h-1.77c-.69 0-1.24-.56-1.24-1.24V5.24c0-.69.55-1.24 1.24-1.24h1.77c.68 0 1.23.55 1.23 1.23v4.87c0 .68.56 1.23 1.24 1.23h5c.67 0 1.23-.55 1.23-1.23zm12.87 17.87c-4.19 0-7.14-2.97-7.14-7.02s2.95-7.01 7.14-7.01c4.13 0 7.14 2.97 7.14 7.01 0 4.05-3 7.01-7.14 7.01m-3.22-7.02c0 2.16 1.29 3.64 3.22 3.64 1.9 0 3.2-1.48 3.2-3.64s-1.3-3.64-3.2-3.64c-1.93 0-3.22 1.48-3.22 3.64m17.17 6.37c-3.84 0-6.2-2.58-6.2-6.68s2.36-6.69 6.12-6.69c1.58 0 2.82.54 3.54 1.37 0-.64.52-1.15 1.16-1.15h1.5c.68 0 1.24.55 1.24 1.23V21.9c0 3.64-2.77 6.09-6.93 6.09-2.64 0-4.9-1.2-5.85-3.09-.31-.62.16-1.29.85-1.4l1.14-.17c.67-.11 1.29.4 1.78.85.5.46 1.26.7 2.08.7 1.85 0 3.06-1.04 3.06-2.55v-1.3c-.7.9-2.01 1.4-3.49 1.4m-2.36-6.68c0 2.02 1.18 3.31 3 3.31 1.86 0 3.04-1.29 3.04-3.31s-1.18-3.32-3.03-3.32c-1.83 0-3.01 1.3-3.01 3.32"}),Ug("defs",{children:[Ug("linearGradient",{id:"ph-survey-logo-paint0",x1:"21.96",x2:"33.28",y1:"9.62",y2:"9.62",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#ffd849"}),Ug("stop",{offset:".96","stop-color":"#fbae01"})]}),Ug("linearGradient",{id:"ph-survey-logo-paint1",x1:"21.96",x2:"33.28",y1:"17.81",y2:"17.81",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#ffb700"}),Ug("stop",{offset:"1","stop-color":"#f9aa01"})]}),Ug("linearGradient",{id:"ph-survey-logo-paint2",x1:"21.96",x2:"31.03",y1:"23.34",y2:"23.34",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#ff9500"}),Ug("stop",{offset:"1","stop-color":"#f8aa00"})]}),Ug("linearGradient",{id:"ph-survey-logo-paint3",x1:"10.74",x2:"21.96",y1:"9.34",y2:"9.34",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#ff651e"}),Ug("stop",{offset:"1","stop-color":"#e4400a"})]}),Ug("linearGradient",{id:"ph-survey-logo-paint4",x1:"10.74",x2:"19.7",y1:"23.34",y2:"23.34",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#c42c00"}),Ug("stop",{offset:"1","stop-color":"#d63600"})]}),Ug("linearGradient",{id:"ph-survey-logo-paint5",x1:"10.74",x2:"21.96",y1:"17.58",y2:"17.58",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#ef3c00"}),Ug("stop",{offset:"1","stop-color":"#d63601"})]}),Ug("linearGradient",{id:"ph-survey-logo-paint6",x1:"0",x2:"10.74",y1:"9.34",y2:"9.34",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#3f80ff"}),Ug("stop",{offset:"1","stop-color":"#084fe0"})]}),Ug("linearGradient",{id:"ph-survey-logo-paint7",x1:"0",x2:"10.74",y1:"17.75",y2:"17.75",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#0255ff"}),Ug("stop",{offset:"1","stop-color":"#0145d2"})]}),Ug("linearGradient",{id:"ph-survey-logo-paint8",x1:"0",x2:"9.19",y1:"23.11",y2:"23.11",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#0041c6"}),Ug("stop",{offset:"1","stop-color":"#0045d0"})]}),Ug("clipPath",{id:"ph-survey-logo-clip",children:Ug("path",{fill:"#fff",d:"M0 0h51.67v28H0z"})})]})]});function Xb({urlParams:t}){const e=t?Object.entries(t).map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"):"";return Ug("a",{href:"https://posthog.com/surveys"+(e?`?${e}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",Yb]})}function t_({text:t,submitDisabled:e,appearance:i,onSubmit:n,link:s,onPreviewSubmit:r,skipSubmitButton:o,canGoBack:l,onBack:a}){const{isPreviewMode:u}=cm(Ab),c=!!l&&!!a,h=!o&&Ug("button",{className:"form-submit",disabled:e,type:"button",onClick(){var t;s&&(null===(t=window)||void 0===t||t.open(s)),u?null==r||r():n()},children:t});return Ug("div",{className:"bottom-section",children:[c?Ug("div",{className:"form-buttons form-buttons-with-back",children:[Ug("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:a,children:i.backButtonText||"Back"}),h]}):h,!i.whiteLabel&&Ug(Xb,{urlParams:{utm_source:"survey-footer"}})]})}function e_({question:t,forceDisableHtml:e,htmlFor:i}){return Ug("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[Ug(t.type===Sm.Open?"label":"h3",{className:"survey-question",htmlFor:i,children:t.question}),t.description&&Pb({component:bg("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!e&&"text"!==t.descriptionContentType})]})}function i_({onClick:t}){const{isPreviewMode:e}=cm(Ab);return Ug("button",{className:"form-cancel",onClick:t,disabled:e,"aria-label":"Close survey",type:"button",children:Kb({fill:"black"})})}function n_({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onClose:r}){const{isPopup:o}=cm(Ab);return lm(()=>{const t=t=>{"Enter"!==t.key&&"Escape"!==t.key||(t.preventDefault(),r())};return to(window,"keydown",t),()=>{window.removeEventListener("keydown",t)}},[r]),Ug("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&Ug(i_,{onClick:()=>r()}),Ug("h3",{className:"thank-you-message-header",children:t}),e&&Pb({component:bg("p",{className:"thank-you-message-body"}),children:e,renderAsHtml:!n&&"text"!==i}),o&&Ug(t_,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>r()})]})}function s_({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onStart:r}){const{isPopup:o,onPreviewSubmit:l,onPopupSurveyDismissed:a}=cm(Ab);return Ug("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&Ug(i_,{onClick:()=>a()}),t&&Ug("h3",{className:"intro-screen-header",children:t}),e&&Pb({component:bg("p",{className:"intro-screen-body"}),children:e,renderAsHtml:!n&&"text"!==i}),Ug(t_,{text:s.introScreenButtonText||"Get started",submitDisabled:!1,appearance:s,onSubmit:r,onPreviewSubmit:()=>l(null)})]})}const r_=t=>Se(t)&&t.every(t=>Ee(t));function o_({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,displayQuestionIndex:r,initialValue:o,canGoBack:l,onBack:a}){const{isPreviewMode:u}=Ob(),c=am(null),[h,d]=om(()=>Ee(o)?o:""),v=null==i?void 0:i.disableAutofocus;lm(()=>{v||setTimeout(()=>{var t;u||null===(t=c.current)||void 0===t||t.focus()},100)},[u,v]);const f=`surveyQuestion${r}`,p=um(()=>function(t,e,i){const n=t.trim();if(!i&&""===n)return"This field is required";if(""===n)return!1;if(e&&e.length>0)for(const t of e)switch(t.type){case de:var s;if(void 0!==t.value&&t.value>n.length)return null!==(s=t.errorMessage)&&void 0!==s?s:`Please enter at least ${t.value} characters`;break;case ve:var r;if(void 0!==t.value&&n.length>t.value)return null!==(r=t.errorMessage)&&void 0!==r?r:`Please enter no more than ${t.value} characters`}return!1}(h,t.validation,t.optional),[h,t.validation,t.optional]),g=jr(t.validation,de),m=jr(t.validation,ve),y=um(()=>function(t,e){const i=1===t?void 0:t;return i&&e?`Enter ${i}-${e} characters`:i?`Enter at least ${i} ${1===i?"character":"characters"}`:e?`Maximum ${e} ${1===e?"character":"characters"}`:void 0}(g,m),[g,m]),b=()=>{p||n(h.trim())},_=()=>{p||s(h.trim())};return Ug(wg,{children:[Ug("div",{className:"question-container",children:[Ug(e_,{question:t,forceDisableHtml:e,htmlFor:f}),Ug("textarea",{ref:c,id:f,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:g,maxLength:m,onInput(t){d(t.currentTarget.value),t.stopPropagation()},onKeyDown(t){t.stopPropagation(),"Enter"!==t.key||!t.metaKey&&!t.ctrlKey||p||(t.preventDefault(),u?_():b())},value:h}),y&&Ug("div",{className:"validation-hint",children:y})]}),Ug(t_,{text:t.buttonText||"Submit",submitDisabled:!!p,appearance:i,onSubmit:b,onPreviewSubmit:_,canGoBack:l,onBack:a})]})}function l_({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,canGoBack:r,onBack:o}){return Ug(wg,{children:[Ug("div",{className:"question-container",children:Ug(e_,{question:t,forceDisableHtml:e})}),Ug(t_,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:()=>n("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:r,onBack:o})]})}function a_({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:l,onBack:a}){var u;const c=t.scale,h=10===t.scale?0:1,[d,v]=om(()=>Ae(o)?o:Se(o)&&o.length>0&&Ae(parseInt(o[0]))?parseInt(o[0]):Ee(o)&&Ae(parseInt(o))?parseInt(o):null),f="emoji"===t.display&&2===t.scale,{isPreviewMode:p}=Ob(),g=t=>p?r(t):s(t);return Ug(wg,{children:[Ug("div",{className:"question-container",children:[Ug(e_,{question:t,forceDisableHtml:e}),Ug("div",{className:"rating-section",children:[Ug("div",{className:"rating-options",children:["emoji"===t.display&&Ug("div",{className:"rating-options-emoji"+(f?" rating-options-emoji-2":""),children:null===(u=f_[t.scale])||void 0===u?void 0:u.map((e,n)=>Ug("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&&Ug("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${c-h+1}, minmax(0, 1fr))`},children:p_(t.scale).map((e,s)=>Ug(u_,{displayQuestionIndex:i,active:d===e,appearance:n,num:e,setActiveNumber(e){v(e),t.skipSubmitButton&&g(e)}},s))})]}),!f&&Ug("div",{className:"rating-text",children:[Ug("div",{children:t.lowerBoundLabel}),Ug("div",{children:t.upperBoundLabel})]})]})]}),Ug(t_,{text:t.buttonText||(null==n?void 0:n.submitButtonText)||"Submit",submitDisabled:Ie(d)&&!t.optional,appearance:n,onSubmit:()=>s(d),onPreviewSubmit:()=>r(d),skipSubmitButton:t.skipSubmitButton,canGoBack:l,onBack:a})]})}function u_({num:t,active:e,displayQuestionIndex:i,setActiveNumber:n}){return Ug("button",{"aria-label":`Rate ${t}`,className:`ratings-number question-${i}-rating-${t} ${e?"rating-active":""}`,type:"button",onClick(){n(t)},children:t})}function c_({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:l,onBack:a}){const u=am(null),c=um(()=>(t=>{var e;if(!t.shuffleOptions)return t.choices;const i=[...t.choices],n=t.hasOpenChoice&&null!==(e=i.pop())&&void 0!==e?e:null,s=(r=i,(o=Su(i)).length>1&&r.every((t,e)=>t===o[e])?o.reverse():o);var r,o;return Ie(n)||s.push(n),s})(t),[t]),[h,d]=om(()=>((t,e)=>Ee(t)||r_(t)?t:e===Sm.SingleChoice?null:[])(o,t.type)),[v,f]=om(()=>((t,e)=>{if(Ee(t)&&!e.includes(t))return{isSelected:!0,inputValue:t};if(r_(t)){const i=t.find(t=>!e.includes(t));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,c)),{isPreviewMode:p}=Ob(),g=t.type===Sm.SingleChoice,m=t.type===Sm.MultipleChoice,y=t.skipSubmitButton&&g&&!t.hasOpenChoice,b=(t,e)=>{if(e){const t=!v.isSelected;return f(e=>ue(ue({},e),{},{isSelected:t,inputValue:t?e.inputValue:""})),g&&d(""),void(t&&setTimeout(()=>{var t;return null===(t=u.current)||void 0===t?void 0:t.focus()},75))}if(g)return d(t),f(t=>ue(ue({},t),{},{isSelected:!1,inputValue:""})),void(y&&(s(t),p&&r(t)));m&&Se(h)&&(h.includes(t)?d(h.filter(e=>e!==t)):d([...h,t]))},_=t=>{t.stopPropagation();const e=t.currentTarget.value;f(t=>ue(ue({},t),{},{inputValue:e})),g&&d(e)},w=t=>{t.stopPropagation(),"Enter"!==t.key||k()||(t.preventDefault(),S()),"Escape"===t.key&&(t.preventDefault(),f(t=>ue(ue({},t),{},{isSelected:!1,inputValue:""})),g&&d(null))},k=()=>!(t.optional||!Ie(h)&&(!Se(h)||v.isSelected||0!==h.length)&&(!v.isSelected||""!==v.inputValue.trim())),S=()=>{v.isSelected&&m?Se(h)&&(p?r([...h,v.inputValue]):s([...h,v.inputValue])):p?r(h):s(h)};return Ug(wg,{children:[Ug("div",{className:"question-container",children:[Ug(e_,{question:t,forceDisableHtml:e}),Ug("fieldset",{className:"multiple-choice-options limit-height",children:[Ug("legend",{className:"sr-only",children:m?" Select all that apply":" Select one"}),c.map((e,n)=>{const s=!!t.hasOpenChoice&&n===t.choices.length-1,r=`surveyQuestion${i}Choice${n}`,o=`${r}Open`,l=s?v.isSelected:g?h===e:Se(h)&&h.includes(e);return Ug("label",{className:s?"choice-option-open":"",children:[Ug("div",{className:"response-choice",children:[Ug("input",{type:g?"radio":"checkbox",name:r,checked:l,onChange:()=>b(e,s),id:r,"aria-controls":o}),Ug("span",{children:s?`${e}:`:e})]}),s&&Ug("input",{type:"text",ref:u,id:o,name:`question${i}Open`,value:v.inputValue,onKeyDown:w,onInput:_,onClick(t){v.isSelected||b(e,!0),t.stopPropagation()},"aria-label":`${e} - please specify`})]},n)})]})]}),Ug(t_,{text:t.buttonText||"Submit",submitDisabled:k(),appearance:n,onSubmit:S,onPreviewSubmit:S,skipSubmitButton:y,canGoBack:l,onBack:a})]})}const h_=[1,2,3,4,5],d_=[1,2,3,4,5,6,7],v_=[0,1,2,3,4,5,6,7,8,9,10],f_={2:[Qb,Zb],3:[Vb,Wb,Hb],5:[Gb,Vb,Wb,Hb,Jb]};function p_(t){switch(t){case 5:default:return h_;case 7:return d_;case 10:return v_}}const g_=Hr("[Surveys]");function m_(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?xm.End:r;if(s.branching.type===xm.End)return xm.End;if(s.branching.type===xm.SpecificQuestion){if(Number.isInteger(s.branching.index))return s.branching.index}else if(s.branching.type===xm.ResponseBased){if(s.type===Sm.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];if(Number.isInteger(e))return e;if(e===xm.End)return xm.End}}else if(s.type===Sm.Rating){var l;if(s.optional&&Re(i))return r===t.questions.length?xm.End:r;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const e=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(e)){const t=s.branching.responseValues[e];if(Number.isInteger(t))return t;if(t===xm.End)return xm.End}}return r}return g_.warn("Falling back to next question index due to unexpected branching type"),r}const y_=Hr("[SurveyTranslations]");function b_(t,e){const i=function(t){var e;return function({overrideLanguage:t,storedPersonProperties:e,locale:i},n){const s=du(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?du(t.language):null}(e);if(r)return null==n||n.info(`Using person property language: ${r}`),r;const o=du(i);return o?(null==n||n.info(`Using detected locale: ${o}`),o):(null==n||n.info("No user language detected"),null)}({overrideLanguage:t.config.overrideLanguage,storedPersonProperties:null===(e=t.client)||void 0===e?void 0:e.kv.get(w),locale:"u">typeof navigator?navigator.language||navigator.userLanguage:void 0},y_)}(e);if(!i)return y_.info("No user language detected"),{survey:t,language:null};const n=gu(t,i,y_);return{survey:n.survey,language:n.matchedKey}}const __="ph:show_survey_widget",w_="PHWidgetSurveyClickListener";function k_(t,e){try{const i=t.getBoundingClientRect(),n=window.innerHeight,s=window.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:bb.zIndex}}catch(t){return Mm.warn("Failed to calculate trigger position:",t),null}}var S_=class{constructor(t){var e,i;this.Li=new Map,this.Di=new Map,this.Fi=new Map,this.Pi=new Map,this.Ni=new Set,this.qi=!1,this.ji=null,this.Bi=!1,this.zi=null,this.Ui=null,this.Wi=null,this.Hi=!1,this.handlePageUnload=()=>{var t;const e=null===(t=this.Gi.client)||void 0===t?void 0:t.kv.get(I);if(e)for(const t of e)qb(t)&&Eb(t,this.Gi)},this.handlePopoverSurvey=(t,e,{resumeDelayFromActivation:i=!1}={})=>{var n,s,r,o,l,a,u;if(!(null===(n=this.Gi.client)||void 0===n?void 0:n.canCapture))return;const{survey:c,language:h}=this.Vi(t);this.ji=h,this.Wi=null,this.Qi=e;const d=this.Zi(c,e);this.Ji(d.id);const{properties:v,initialResponses:f}=null!=e?e:{},p=!(!f||0>=Object.keys(f).length)&&this.Yi(d,f,v,h);if(p&&!(null===(s=d.appearance)||void 0===s?void 0:s.displayThankYouMessage))return;this.Ki(d);let g={};if((null===(r=d.appearance)||void 0===r?void 0:r.position)===_m.NextToTrigger&&(null===(o=d.appearance)||void 0===o?void 0:o.widgetSelector)){var m;const t=document.querySelector(d.appearance.widgetSelector);t&&(g=k_(t,parseInt((null===(m=d.appearance)||void 0===m?void 0:m.maxWidth)||bb.maxWidth))||{})}const y=(null===(l=d.appearance)||void 0===l?void 0:l.surveyPopupDelaySeconds)||0,{shadow:b}=Sb(d,this.Gi);this.Pi.set(b,b.host);const _={posthog:this.Gi,survey:d,removeSurveyFromFocus:this.Xi,properties:v,style:g,isSurveyCompleted:p,skipShownEvent:null==e?void 0:e.skipShownEvent,surveyLanguage:h};if(this.Wi=_,0>=y)return this.Bi=!0,Bg(Ug(C_,ue({},_)),b);const w=()=>{this.Bi=!0;const{survey:i,language:n}=this.Vi(t);this.ji=n;const s=this.Zi(i,e),r=ue(ue({},_),{},{survey:s,surveyLanguage:n});this.Wi=r,Bg(Ug(C_,ue(ue({},r),{},{survey:ue(ue({},s),{},{appearance:ue(ue({},s.appearance),{},{surveyPopupDelaySeconds:0})})})),b)},k=()=>{var t;if(!(null===(t=this.Gi.client)||void 0===t?void 0:t.canCapture)||!this.er(d))return Mm.info(`Survey ${d.id} no longer eligible when its display delay elapsed; not displaying`),this.Xi(d);w()},S=i?null===(a=this.Gi.surveys)||void 0===a||null===(a=a._surveyEventReceiver)||void 0===a||null===(u=a.getActivationTimestamp)||void 0===u?void 0:u.call(a,d.id):void 0,x=Ae(S)?Math.max(0,Date.now()-S):0,T=Math.max(0,1e3*y-x);if(0>=T)return k();const C=window.setTimeout(()=>{this.Li.delete(d.id),k()},T);this.Li.set(d.id,C)},this.nr=t=>{var e;const{survey:i,language:n}=this.Vi(t),{shadow:s,isNewlyCreated:r}=Sb(i,this.Gi);this.Pi.set(s,s.host),(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===bm.Tab&&this.Fi.set(t.id,t),r&&Bg(Ug(M_,{posthog:this.Gi,survey:i,surveyLanguage:n},t.id),s)},this.ir=t=>{const e=this.Di.get(t);e&&(e.element.removeEventListener("click",e.listener),e.element.removeAttribute(w_),this.Di.delete(t),Mm.info(`Removed click listener for survey ${t}`))},this.rr=t=>{this.sr(t)||(this.ar(t),this.ir(t.id))},this.lr=t=>{this.sr(t)||(this.ar(t),this.Fi.delete(t.id))},this.sr=t=>{try{var e;const i=document.querySelector(zb(t,!0));return!!(null==i||null===(e=i.shadowRoot)||void 0===e?void 0:e.querySelector(".ph-survey"))}catch(t){return!1}},this.ur=(t,e)=>{const i=document.querySelector(e),n=this.Di.get(t.id);if(i){if(this.nr(t),n){if(i===n.element)return;Mm.info(`Selector element changed for survey ${t.id}. Re-attaching listener.`),this.ir(t.id)}if(!i.hasAttribute(w_)){const e=e=>{var i,n;e.stopPropagation();const s=(null===(i=t.appearance)||void 0===i?void 0:i.position)===_m.NextToTrigger?k_(e.currentTarget,parseInt((null===(n=t.appearance)||void 0===n?void 0:n.maxWidth)||bb.maxWidth)):{};window.dispatchEvent(new CustomEvent(__,{detail:{surveyId:t.id,position:s}}))};to(i,"click",e),i.setAttribute(w_,"true"),this.Di.set(t.id,{element:i,listener:e,survey:t}),Mm.info(`Attached click listener for feedback button survey ${t.id}`)}}else n&&this.rr(t)},this.renderPopover=t=>{var e;if(!(null===(e=this.Gi.client)||void 0===e?void 0:e.canCapture))return;const{survey:i,language:n}=this.Vi(t),{shadow:s}=Sb(i,this.Gi);this.Pi.set(s,s.host),Bg(Ug(C_,{posthog:this.Gi,survey:i,removeSurveyFromFocus:this.Xi,surveyLanguage:n}),s)},this.renderSurvey=(t,e,i)=>{var n;if(!(null===(n=this.Gi.client)||void 0===n?void 0:n.canCapture))return;const{survey:s,language:r}=this.Vi(t);let o=!1;this.Gi.config.prefillFromUrl&&(o=this.cr(s,r,i)),Bg(Ug(C_,{posthog:this.Gi,survey:s,removeSurveyFromFocus:this.Xi,isPopup:!1,properties:i,isSurveyCompleted:o,surveyLanguage:r}),e)},this.getActiveMatchingSurveys=(t,e=!1)=>{var i;null===(i=this.Gi.surveys)||void 0===i||i.getSurveys(e=>{t(e.filter(t=>this.er(t)))},e)},this.callSurveysAndEvaluateDisplayLogic=(t=!1)=>{this.getActiveMatchingSurveys(t=>{var e;const i=null===(e=this.Gi.client)||void 0===e?void 0:e.canCapture,n=t.filter(t=>i&&(t.type===km.Popover||t.type===km.Widget)),s=new Set(n.map(t=>t.id));for(const t of Array.from(this.Li.keys()))s.has(t)||this.cancelSurvey(t);const r=this.dr(n),o=new Set,l=new Set;r.forEach(t=>{if(t.type===km.Widget){var e,i,n,s;if((null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===bm.Tab)return l.add(t.id),void this.nr(t);(null===(i=t.appearance)||void 0===i?void 0:i.widgetType)===bm.Selector&&(null===(n=t.appearance)||void 0===n?void 0:n.widgetSelector)&&(o.add(t.id),this.ur(t,null===(s=t.appearance)||void 0===s?void 0:s.widgetSelector))}Ie(this.vr)&&t.type===km.Popover&&this.handlePopoverSurvey(t,void 0,{resumeDelayFromActivation:!0})}),this.Di.forEach(({survey:t})=>{o.has(t.id)||this.rr(t)}),this.Fi.forEach((t,e)=>{l.has(e)||this.lr(t)})},t)},this.Ki=t=>{Ie(this.vr)||Mm.error(`Survey ${this.vr} already in focus. Cannot add survey ${t.id}.`),this.vr=t.id},this.Xi=t=>{this.vr!==t.id&&Mm.error(`Survey ${t.id} is not in focus. Cannot remove survey ${t.id}.`),this.Ji(t.id),this.vr=null,this.ji=null,this.Bi=!1,this.Wi=null,this.Qi=void 0,this.ar(t)},this.Gi=t,this.vr=null,this.zi=()=>this.pr(),to(window,"languagechange",this.zi),this.Ui=null!==(e=null===(i=t.client)||void 0===i||null===(i=i.getExtension("featureFlagsCommon"))||void 0===i?void 0:i.onFeatureFlags(()=>this.pr()))&&void 0!==e?e:null}pr(){var t;if(Ie(this.vr))return;const e=null===(t=this.Gi.client)||void 0===t?void 0:t.kv.get(I),i=null==e?void 0:e.find(t=>t.id===this.vr);if(!i)return;const{survey:n,language:s}=this.Vi(i);if(s===this.ji)return;if(this.ji=s,!this.Bi)return;const r=this.Zi(n,this.Qi),{shadow:o}=Sb(r,this.Gi);Bg(Ug(C_,ue(ue({},this.Wi),{},{posthog:this.Gi,survey:r,removeSurveyFromFocus:this.Xi,surveyLanguage:s})),o)}Zi(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}Ji(t){const e=this.Li.get(t);e&&(clearTimeout(e),this.Li.delete(t))}cancelSurvey(t){this.Li.has(t)&&(Mm.info(`Cancelled pending survey ${t}`),this.Ji(t),this.vr===t&&(this.vr=null,this.ji=null,this.Bi=!1,this.Wi=null,this.Qi=void 0))}startAutomaticDisplay(){if(this.qi||this.mr||!1===this.Gi.config.automaticDisplay)return;this.mr=()=>{};const t=function(t){let e;t.callSurveysAndEvaluateDisplayLogic(!0);const i=()=>{Ce(e)&&(e=setInterval(()=>{t.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},n=()=>{Ce(e)||(clearInterval(e),e=void 0)};i();const s=()=>{document.hidden?n():(t.callSurveysAndEvaluateDisplayLogic(!1),i())};return to(document,"visibilitychange",s),()=>{n(),document.removeEventListener("visibilitychange",s)}}(this);this.qi?t():this.mr=t}clearInMemoryInProgressSurveyState(){(()=>{for(const t of Object.keys(Db))delete Db[t]})()}dispose(){var t;this.qi=!0,null===(t=this.mr)||void 0===t||t.call(this),this.mr=void 0,this.zi&&(window.removeEventListener("languagechange",this.zi),this.zi=null),this.Ui&&(this.Ui(),this.Ui=null),this.Li.forEach((t,e)=>this.Ji(e)),this.Di.forEach((t,e)=>this.ir(e)),this.Pi.forEach((t,e)=>{Bg(null,e),null==t||t.remove()}),this.Pi.clear(),this.Fi.clear(),this.vr=null}dr(t){return t.sort((t,e)=>{var i,n;const s=qb(t),r=qb(e);if(s&&!r)return-1;if(!s&&r)return 1;const o=t.schedule===$m.Always,l=e.schedule===$m.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)})}Vi(t){return b_(t,this.Gi)}cr(t,e,i){if(this.Ni.has(t.id))return!1;const{params:n}=function(){const t={};let e=!1;const i=window.location.search.replace(/^\?/,"");if(!i)return{params:t,autoSubmit:e};const n=i.split("&");for(const i of n){const n=i.indexOf("=");if(0>=n)continue;let s,r;try{s=decodeURIComponent(i.slice(0,n)),r=decodeURIComponent(i.slice(n+1))}catch(t){continue}if("auto_submit"===s&&"true"===r){e=!0;continue}const o=s.match(/^q(\d+)$/);if(o){const e=parseInt(o[1],10);t[e]||(t[e]=[]),t[e].push(r)}}return{params:t,autoSubmit:e}}();if(0===Object.keys(n).length)return!1;Mm.info("[Survey Prefill] Detected URL prefill parameters");const s=this.gr(t,n,e);return!!s&&(this.yr(t,s,i,e),this.Ni.add(t.id),s.isSurveyCompleted)}yr(t,e,i,n){const{responses:s,submissionId:r,isSurveyCompleted:o,skippedResponses:l}=e;(Object.keys(l).length>0&&t.enable_partial_responses||o)&&$b({responses:o?s:l,survey:t,surveySubmissionId:r,posthog:this.Gi,isSurveyCompleted:o,properties:i,surveyLanguage:n})}Yi(t,e,i,n){const s={};for(const[t,i]of Object.entries(e))s[parseInt(t)]=Se(i)?i.map(String):[String(i)];Mm.info("[Survey] Processing initial responses");const r=this.gr(t,s,n);return!!r&&(this.yr(t,r,i,n),r.isSurveyCompleted)}gr(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=lu(t.id);try{switch(t.type){case Sm.SingleChoice:{if(!t.choices||0===t.choices.length)return void Ur.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 Ur.warn(`[Survey Prefill] Invalid choice index for q${n}: ${s[0]}`);i[r]=t.choices[e];break}case Sm.MultipleChoice:{if(!t.choices||0===t.choices.length)return void Ur.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 Ur.warn(`[Survey Prefill] No valid choices for q${n}`);const o=[...new Set(e.map(e=>t.choices[e]))];e.length>o.length&&Ur.warn(`[Survey Prefill] Removed duplicate choices for q${n}`),i[r]=o;break}case Sm.Rating:{const e=parseInt(s[0],10),o=t.scale||10,l=10===o?0:1;if(isNaN(e)||l>e||e>o)return void Ur.warn(`[Survey Prefill] Invalid rating for q${n}: ${s[0]} (scale: ${l}-${o})`);i[r]=e;break}default:Ur.info(`[Survey Prefill] Question type ${t.type} does not support prefill`)}}catch(t){Ur.error(`[Survey Prefill] Error converting q${n}:`,t)}}),i}(t,e);if(0===Object.keys(n).length)return Mm.warn("[Survey Prefill] No valid responses after conversion"),null;const s=La(),{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=lu(e.id);Ce(i[t])||(s[t]=i[t])}r.push(n);const o=m_(t,n,e.id?i[lu(e.id)]:null);if(o===xm.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)).filter(e=>{const i=t.questions[e];return(null==i?void 0:i.id)&&!Ce(n[lu(i.id)])}),n),a=r>=t.questions.length;return Nb(t,{surveySubmissionId:s,responses:n,lastQuestionIndex:r,questionOrder:Mb(t.questions),visitedIndices:l,surveyLanguage:i}),Mm.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:n,submissionId:s,startQuestionIndex:r,isSurveyCompleted:a,skippedResponses:o}}catch(t){return Mm.error("[Survey Prefill] Error handling prefill:",t),null}}br(t,e){var i;if(!t)return!0;const n=null===(i=this.Gi.client)||void 0===i?void 0:i.getExtension(Hg),s=!!(null==n?void 0:n.isFeatureEnabled(t,{send_event:!t.startsWith("survey-targeting-")}));let r=!0;e&&(r=(null==n?void 0:n.getFeatureFlag(t,{send_event:!1}))===e||"any"===e);const o=s&&r;return o||this.wr(t),o}wr(t){this.Hi||!1!==this.Gi.config.featureFlagEvaluation||(this.Hi=!0,Mm.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.`))}kr(t){return!t.conditions||Fb(t,this.Gi)&&function(t){var e,i;return function(t,e){var i,n,s;if(!t||0===t.length)return!0;const r="u">typeof window?window:void 0,o="u">typeof globalThis?globalThis:r,l=null==o?void 0:o.navigator,a=null==l?void 0:l.userAgent;if(!a)return!1;const u=Zi(a,{userAgentDataPlatform:null==l||null===(i=l.userAgentData)||void 0===i?void 0:i.platform,maxTouchPoints:null==l?void 0:l.maxTouchPoints,screenWidth:null==r||null===(n=r.screen)||void 0===n?void 0:n.width,screenHeight:null==r||null===(s=r.screen)||void 0===s?void 0:s.height,devicePixelRatio:null==r?void 0:r.devicePixelRatio});return wu[null!=e?e:"icontains"](t,[u])}(null===(e=t.conditions)||void 0===e?void 0:e.deviceTypes,null===(i=t.conditions)||void 0===i?void 0:i.deviceTypesMatchType)}(t)&&function(t){var e,i;return!(null===(e=t.conditions)||void 0===e?void 0:e.selector)||!!(null===(i=document)||void 0===i?void 0:i.querySelector(t.conditions.selector))}(t)}Sr(t){var e;return Rb(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.Gi.client)||void 0===e||null===(e=e.getExtension("featureFlagsCommon"))||void 0===e?void 0:e.hasLoadedFlags)?(this.wr(t.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this.br(t.internal_targeting_flag_key)}}checkSurveyEligibility(t){var e,i;const n={eligible:!0,reason:void 0};if(!Rm(t))return n.eligible=!1,n.reason=`Survey is not running. It was completed on ${t.end_date}`,n;if(!Lm.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.br(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.br(t.targeting_flag_key))return n.eligible=!1,n.reason="Survey targeting feature flag is not enabled",n;const r=this.Sr(t);var o;return r.satisfied?(t=>{let e=null;try{e=localStorage.getItem("lastSeenSurveyDate")}catch(t){Mm.error("localStorage error: "+t)}return 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}(t,e)})(null===(i=t.conditions)||void 0===i?void 0:i.seenSurveyWaitPeriodInDays)?((t=>{let e=null;try{e=localStorage.getItem(Pm(t))}catch(t){Mm.error("localStorage error: "+t)}return!!e&&!Rb(t)})(t)&&(n.eligible=!1,n.reason="Survey has already been seen and it can't be activated again"),n):(n.eligible=!1,n.reason="Survey wait period has not passed",n):(n.eligible=!1,n.reason=null!==(o=r.reason)&&void 0!==o?o:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",n)}checkSurveyCaptureEligibility(){var t;return(null===(t=this.Gi.client)||void 0===t?void 0:t.canCapture)?{eligible:!0}:{eligible:!1,reason:Im}}checkSurveyDisplayEligibility(t){const e=this.checkSurveyCaptureEligibility();return e.eligible?this.checkSurveyEligibility(t):e}checkSurveyRenderability(t){const e=this.checkSurveyDisplayEligibility(t);return e.eligible&&!this._r(t)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:e}_r(t){var e;if(!mu(t)&&!Am(t))return!0;const i=null===(e=this.Gi.surveys)||void 0===e||null===(e=e._surveyEventReceiver)||void 0===e?void 0:e.getSurveys();return!!(null==i?void 0:i.includes(t.id))}Cr(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.br(e))}er(t){return this.checkSurveyEligibility(t).eligible&&this.kr(t)&&this._r(t)&&this.Cr(t)}ar(t){try{const e=document.querySelector(zb(t,!0));(null==e?void 0:e.shadowRoot)&&(Bg(null,e.shadowRoot),this.Pi.delete(e.shadowRoot)),null==e||e.remove()}catch(e){Mm.warn(`Failed to remove survey ${t.id} from DOM:`,e)}}getTestAPI(){return{addSurveyToFocus:this.Ki,removeSurveyFromFocus:this.Xi,surveyInFocus:this.vr,surveyTimeouts:this.Li,handleWidget:this.nr,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this.ur,sortSurveysByAppearanceDelay:this.dr.bind(this),checkFlags:this.Cr.bind(this),isSurveyFeatureFlagEnabled:this.br.bind(this),onLanguageChange:this.pr.bind(this),currentLanguage:this.ji,surveyIsRendered:this.Bi}}};function x_({survey:t,removeSurveyFromFocus:e=()=>{},setSurveyVisible:i,isPreviewMode:n=!1,posthog:s}){lm(()=>{var r;if(n||!(null===(r=t.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var n;const r=t.type===km.Widget,o=Fb(t,s),l=(null===(n=t.appearance)||void 0===n?void 0:n.widgetType)===bm.Tab&&r;if(!o)return Mm.info(`Hiding survey ${t.id} because URL does not match`),i(!1),e(t);l&&(Mm.info(`Showing survey ${t.id} because it is a feedback button tab and URL matches`),i(!0))};to(window,"popstate",o),to(window,"hashchange",o);const l=window.history.pushState,a=window.history.replaceState;return window.history.pushState=function(...t){l.apply(this,t),o()},window.history.replaceState=function(...t){a.apply(this,t),o()},()=>{window.removeEventListener("popstate",o),window.removeEventListener("hashchange",o),window.history.pushState=l,window.history.replaceState=a}},[n,t,e,i,s])}const $_=200;function T_(t=wm.Right){switch(t){case wm.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case wm.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case wm.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function C_({survey:t,forceDisableHtml:e,posthog:i,style:n={},previewPageIndex:s,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:l=()=>{},onPreviewBack:a=()=>{},onPopupSurveyDismissed:u=()=>{},onCloseConfirmationMessage:c=()=>{},properties:h,isSurveyCompleted:d,skipShownEvent:v,surveyLanguage:f}){var p,g,m,y,b,_,w,k,S,x,T,C;const E=am(null),M=Number.isInteger(s),{isPopupVisible:I,isSurveySent:R,hidePopupWithAnimation:A}=function(t,e,i,n,s,r,o,l,a){const[u,c]=om(n||0===i||t.type===km.ExternalSurvey),[h,d]=om(!1),v=am(!1),f=()=>{const e=()=>{r&&s(t),c(!1)};if(v.current)return;const i=null==o?void 0:o.current;i?(v.current=!0,i.style.transition=`opacity ${$_}ms ease-out`,i.style.opacity="0",setTimeout(()=>{v.current=!1,e()},250)):e()},p=e=>{e.detail.surveyId===t.id&&f()};return lm(()=>{if(!e)return void Mm.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=()=>{var i;if(Fb(t,e)){c(!0);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}window.dispatchEvent(new Event("PHSurveyShown")),l||null===(i=e.client)||void 0===i||i.capture(Tm.SHOWN,ue(ue({[Cm.SURVEY_NAME]:t.name,[Cm.SURVEY_ID]:t.id,[Cm.SURVEY_ITERATION]:t.current_iteration,[Cm.SURVEY_ITERATION_START_DATE]:t.current_iteration_start_date},a&&{[Cm.SURVEY_LANGUAGE]:a}),{},{sessionRecordingUrl:Wg(e)}))}};to(window,"PHSurveyClosed",p),to(window,"PHSurveySent",r);const u=i>0?setTimeout(o,i):void 0;return Ce(u)&&o(),()=>{Ce(u)||clearTimeout(u),Ce(s)||clearTimeout(s),window.removeEventListener("PHSurveyClosed",p),window.removeEventListener("PHSurveySent",r)}},[]),x_({survey:t,removeSurveyFromFocus:s,setSurveyVisible:c,isPreviewMode:n,posthog:e}),{isPopupVisible:u,isSurveySent:h,setIsPopupVisible:c,hidePopupWithAnimation:f}}(t,i,(null===(p=t.appearance)||void 0===p?void 0:p.surveyPopupDelaySeconds)?1e3*t.appearance.surveyPopupDelaySeconds:0,M,r,o,E,v,f),O=R||s===t.questions.length||!0===d,[P,F]=om(!1),L=um(()=>!!jb(t),[t]),D=!(!(null===(g=t.appearance)||void 0===g?void 0:g.introScreenHeader)&&!(null===(m=t.appearance)||void 0===m?void 0:m.introScreenDescription)),N=M?-1===s:!!(null===(y=t.appearance)||void 0===y?void 0:y.displayIntroScreen)&&D&&!P&&!L,j=um(()=>{const e=jb(t),n=(null==e?void 0:e.surveySubmissionId)||La()||"";return{isPreviewMode:M,previewPageIndex:s,onPopupSurveyDismissed(){f?Cb(t,i,M,f):Cb(t,i,M),u()},isPopup:o||!1,surveySubmissionId:n,onPreviewSubmit:l,onPreviewBack:a,posthog:i,properties:h,surveyLanguage:f}},[M,s,o,i,t,u,l,a,h,f]);return I?Ug(Ab.Provider,{value:j,children:Ug("div",{className:"ph-survey",style:ue(ue({},Ub(t.type,null===(b=t.appearance)||void 0===b?void 0:b.position,null===(_=t.appearance)||void 0===_?void 0:_.widgetType)),n),ref:E,children:O?Ug(n_,{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||bb,onClose(){A(),c()}}):N?Ug(s_,{header:(null===(x=t.appearance)||void 0===x?void 0:x.introScreenHeader)||"",description:(null===(T=t.appearance)||void 0===T?void 0:T.introScreenDescription)||"",forceDisableHtml:!!e,contentType:null===(C=t.appearance)||void 0===C?void 0:C.introScreenDescriptionContentType,appearance:t.appearance||bb,onStart:()=>F(!0)}):Ug(E_,{survey:t,forceDisableHtml:!!e,posthog:i})})}):null}function E_({survey:t,forceDisableHtml:e,posthog:i}){var n,s;const r=um(()=>{const e=jb(t);if(!e)return null;const i=Ae(e.lastQuestionIndex);return!i||i&&e.lastQuestionIndex>=0&&t.questions.length>e.lastQuestionIndex?e:(Bb(t),null)},[t]),[o,l]=om(()=>((null==r?void 0:r.responses)&&Mm.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[a,u]=om(!1),{previewPageIndex:c,onPopupSurveyDismissed:h,isPopup:d,onPreviewSubmit:v,onPreviewBack:f,surveySubmissionId:p,isPreviewMode:g,properties:m,surveyLanguage:y}=cm(Ab),[b,_]=om(()=>{const e=null==r?void 0:r.lastQuestionIndex,i=Ae(e)&&e>=0&&t.questions.length>e?e:0;return Ae(c)&&c>=0?c:i}),[w,k]=om(()=>{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]=om(()=>{var e;const i=jb(t);return null!==(e=null==i?void 0:i.questionSnapshots)&&void 0!==e?e:{}}),T=um(()=>Mb(Ib(t,r)),[t.id,r]),C=um(()=>{if(!T||new Set(T).size!==T.length)return Ib(t,r);const e=new Map(t.questions.map(t=>[t.id,t])),i=T.map(t=>e.get(t)).filter(t=>!!t);return i.length===T.length?i:t.questions},[T,t.questions,t,r]);lm(()=>{!g||Ce(c)||0>c||_(c)},[c,g]);const E=!!(null===(n=t.appearance)||void 0===n?void 0:n.allowGoBack)&&(g?(null!=c?c:0)>0:w.length>0),M=C.at(b);return M?Ug("form",{className:"survey-form",name:"surveyForm",children:[d&&!0!==(null===(s=t.appearance)||void 0===s?void 0:s.hideCancelButton)&&Ug(i_,{onClick(){h()}}),Ug("div",{className:"survey-box","data-question-index":b,children:[a&&Ug("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),I_({question:M,forceDisableHtml:e,displayQuestionIndex:b,appearance:t.appearance||bb,onSubmit:e=>(({res:e,displayQuestionIndex:n,questionId:s})=>{var r;if(!i)return void Mm.error("onNextButtonClick called without a PostHog instance.");if(!(null===(r=i.client)||void 0===r?void 0:r.canCapture))return void u(!0);if(u(!1),!s)return void Mm.error("onNextButtonClick called without a questionId.");const{responses:a,questionSnapshots:c}=function({responses:t,questionSnapshots:e={}},i,n,s){return{responses:ue(ue({},t),{},{[lu(i)]:n}),questionSnapshots:(null==s?void 0:s.id)?ue(ue({},e),{},{[s.id]:s.question}):e}}({responses:o,questionSnapshots:S},s,e,C[n]);l(a),x(c);const h=m_(t,n,e),d=h===xm.End,v=[...w,n];if(d||(k(v),_(h),Nb(t,{surveySubmissionId:p,responses:a,lastQuestionIndex:h,questionOrder:Mb(C),visitedIndices:v,surveyLanguage:y,questionSnapshots:c})),t.enable_partial_responses||d){const e=new Set(v.map(t=>{var e;return null===(e=C[t])||void 0===e?void 0:e.id}).filter(t=>!!t).map(t=>lu(t))),n=Object.fromEntries(Object.entries(a).filter(([t])=>e.has(t)));$b({responses:n,survey:t,surveySubmissionId:p,isSurveyCompleted:d,posthog:i,properties:m,surveyLanguage:y,questionSnapshots:c})}})({res:e,displayQuestionIndex:b,questionId:M.id}),onPreviewSubmit:v,initialValue:M.id?o[lu(M.id)]:void 0,canGoBack:E,onBack(){if(g)return void f();if(0===w.length)return;const e=w[w.length-1],i=w.slice(0,-1);k(i),_(e),Nb(t,{surveySubmissionId:p,responses:o,lastQuestionIndex:e,questionOrder:Mb(C),visitedIndices:i,surveyLanguage:y,questionSnapshots:S})}})]})]}):null}function M_({survey:t,forceDisableHtml:e,posthog:i,readOnly:n,surveyLanguage:s}){var r,o,l,a,u,c,h,d;const[v,f]=om(!0),[p,g]=om(!1),[m,y]=om({}),b=am(void 0),_=()=>{var t;(p||!i||n||(null===(t=i.client)||void 0===t?void 0:t.canCapture))&&g(!p)};if(lm(()=>{var e,s,r;if(!i)return void Mm.error("FeedbackWidget called without a PostHog instance.");if(n)return;"tab"===(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)&&y((r=null===(s=t.appearance)||void 0===s?void 0:s.position)&&r!==_m.Right&&r!==_m.NextToTrigger?{}:{top:"50%",bottom:"auto"});const o=e=>{var i;const n=e;(null===(i=n.detail)||void 0===i?void 0:i.surveyId)===t.id&&(Mm.info(`Received show event for feedback button survey ${t.id}`),y(n.detail.position||{}),_())};return to(window,__,o),()=>{Ce(b.current)||(clearTimeout(b.current),b.current=void 0),window.removeEventListener(__,o)}},[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.position,null===(l=t.appearance)||void 0===l?void 0:l.widgetSelector,null===(a=t.appearance)||void 0===a?void 0:a.borderColor]),x_({survey:t,setSurveyVisible:f,posthog:i}),!v)return null;const w=()=>{t.schedule!==$m.Always&&f(!1),Ce(b.current)||clearTimeout(b.current),b.current=setTimeout(()=>{b.current=void 0,g(!1)},200)};return Ug(wg,{children:["tab"===(null===(u=t.appearance)||void 0===u?void 0:u.widgetType)&&Ug("button",{className:"ph-survey-widget-tab "+((null===(c=t.appearance)||void 0===c?void 0:c.tabPosition)===wm.Top?"widget-tab-top":""),onClick:_,disabled:n,style:T_(null===(h=t.appearance)||void 0===h?void 0:h.tabPosition),children:(null===(d=t.appearance)||void 0===d?void 0:d.widgetLabel)||""}),p&&Ug(C_,{posthog:i,survey:t,forceDisableHtml:e,style:m,onPopupSurveyDismissed:w,onCloseConfirmationMessage:w,surveyLanguage:s})]})}const I_=({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 Sm.Open:return bg(o_,ue(ue({},u),{},{question:t,key:t.id}));case Sm.Link:return bg(l_,ue(ue({},u),{},{question:t,key:t.id}));case Sm.Rating:return bg(a_,ue(ue({},u),{},{question:t,key:t.id}));case Sm.SingleChoice:case Sm.MultipleChoice:return bg(c_,ue(ue({},u),{},{question:t,key:t.id}));default:return Mm.error(`Unsupported question type: ${t.type}`),null}},R_={GZipJS:"gzip-js",Base64:"base64"};function A_(t){let e=!0;return{dispose(){if(e){e=!1;const i=t();i&&xe(i.then)&&i.then(void 0,()=>{})}}}}var O_=class{on(t,e){return this.Zo[t]||(this.Zo[t]=[]),this.Zo[t].push(e),()=>{this.Zo[t]=this.Zo[t].filter(t=>t!==e)}}emit(t,e){for(const i of this.Zo[t]||[])i(e);for(const i of this.Zo["*"]||[])i(t,e)}constructor(){this.Zo={}}};function P_(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 F_=class{constructor(t){this.Gi=t,this.Ko=new Set,this.Yo=new Set,this.Xo=new O_,this.tl=(t,e)=>this.el(t,e)&&this.il(t,e)&&this.nl(t,e)&&this.sl(t,e),this.el=(t,e)=>!(null==e?void 0:e.event)||(null==t?void 0:t.event)===(null==e?void 0:e.event)}init(){var t,e;Ce(null===(t=this.Gi)||void 0===t?void 0:t.subscribeCapture)||(this.rl=null===(e=this.Gi)||void 0===e?void 0:e.subscribeCapture((t,e)=>{this.on(t,e)}))}dispose(){var t,e,i;null===(t=this.rl)||void 0===t||t.call(this),this.rl=void 0,null===(e=this.Gi)||void 0===e||null===(i=e.setElementSelectors)||void 0===i||i.call(e,new Set,this),this.Xo=new O_}register(t){var e,i;if(!Ce(null===(e=this.Gi)||void 0===e?void 0:e.subscribeCapture)&&(t.forEach(t=>{var e;this.Ko.add(t),null===(e=t.steps)||void 0===e||e.forEach(t=>{this.Yo.add((null==t?void 0:t.event)||"")})}),null===(i=this.Gi)||void 0===i?void 0:i.setElementSelectors)){const t=new Set;this.Ko.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.Gi.setElementSelectors(t,this)}}replace(t){this.Ko.clear(),this.Yo.clear(),this.register(t)}on(t,e){null!=e&&0!=t.length&&(this.Yo.has(t)||this.Yo.has(e.event))&&this.Ko.forEach(t=>{this.ll(e,t)&&this.Xo.emit("actionCaptured",t.name)})}al(t){this.onAction("actionCaptured",e=>t(e))}ll(t,e){if(null==(null==e?void 0:e.steps))return!1;for(const i of e.steps)if(this.tl(t,i))return!0;return!1}onAction(t,e){return this.Xo.on(t,e)}il(t,e){if(null==e?void 0:e.url){var i;let r=null==t||null===(i=t.properties)||void 0===i?void 0:i.$current_url;if(!(null==t?void 0:t.properties)||!("$current_url"in t.properties))try{var n,s;r=null===(n=this.Gi)||void 0===n||null===(s=n.getActionUrl)||void 0===s?void 0:s.call(n)}catch(t){return!1}if(!r||"string"!=typeof r)return!1;if(!P_(r,e.url,e.url_matching||"contains"))return!1}return!0}nl(t,e){return!!this.ul(t,e)&&!!this.cl(t,e)&&!!this.hl(t,e)}ul(t,e){var i;if(!(null==e?void 0:e.href))return!0;const n=this.dl(t);if(n.length>0)return n.some(t=>P_(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&&P_(function(t){const e=t.match(/(?::|")href="(.*?)"/);return e?e[1]:""}(s),e.href,e.href_matching||"exact")}cl(t,e){var i;if(!(null==e?void 0:e.text))return!0;const n=this.dl(t);if(n.length>0)return n.some(t=>P_(t.text,e.text,e.text_matching||"exact")||P_(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=>P_(t,o,l)));var r,o,l}hl(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}dl(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}sl(t,e){return!(null==e?void 0:e.properties)||0===e.properties.length||ku(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)}},L_=class{constructor(t,e){this.vl=e,this.fl=[],this.Gi=t,this.pl=new Map,this.gl=new Map,this.ml=new Map}yl(){var t,e;this.bl=null===(t=(e=this.Gi).subscribeSession)||void 0===t?void 0:t.call(e,t=>this._l(t))}wl(t){return!1}kl(){return null}Sl(t){}xl(){}$l(t,e){return!!t&&ku(t.propertyFilters,null==e?void 0:e.properties)}Cl(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}Tl(t,e,i){const n=(i===ym.Activation?this.pl:this.gl).get(t);let s=[];return this.Ml(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.$l(r,e)})}register(t){this.Il(t,!1)}replace(t){this.Il(t,!0)}Il(t,e){Ce(this.Gi.subscribeCapture)||(this.El(t,e),this.Al(t,e))}Al(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.ml.clear(),0===i.length)return void(e&&(null===(n=this.Rl)||void 0===n||n.replace([])));this.Rl||(this.Rl=new F_(this.Gi),this.Rl.init(),this.Rl.al(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.ml.get(e.name))&&void 0!==i?i:[];n.includes(t.id)||n.push(t.id),this.ml.set(e.name,n)}})}),e?this.Rl.replace(s):this.Rl.register(s)}Pl(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)})}El(t,e){var i,n,s;const r=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}),o=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}),l=this.Cl(t,ym.Activation),a=this.Cl(t,ym.Cancellation);e?(this.pl=l,this.gl=a):(this.Pl(this.pl,l),this.Pl(this.gl,a)),(0!==r.length||0!==o.length||t.some(t=>{var e;return null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length}))&&(null!==(i=this.rl)&&void 0!==i||(this.rl=null===(n=(s=this.Gi).subscribeCapture)||void 0===n?void 0:n.call(s,(t,e)=>{this.onEvent(t,e)})))}onEvent(t,e){var i,n;const s=this.Ol(),r=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$survey_id)||(null==e||null===(n=e.properties)||void 0===n?void 0:n.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const i=this.Fl(t,r,e);if("consume"===i)return s.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.Ll([r]);if("persist"===i)return s.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.Dl(r),void this.Nl([r])}if(this.gl.has(t)){const i=this.Tl(t,e,ym.Cancellation);i.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:i.map(t=>t.id)}),this.Ll(i.map(t=>t.id)),i.forEach(t=>this.jl(t.id)))}if(!this.pl.has(t))return;s.info("event name matched",{event:t,eventPayload:e,items:this.pl.get(t)});const o=this.Tl(t,e,ym.Activation);this.ql(o.map(t=>t.id))}onAction(t){this.ml.has(t)&&this.ql(this.ml.get(t)||[])}ql(t){if(0===t.length)return;const e=!!this.Gi.getSessionId(),i=[];for(const n of t)e&&this.wl(n)?this.Dl(n)&&this.Bl(n):i.push(n);i.length>0&&(this.fl=[...new Set([...this.fl,...i])]),this.Ol().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.zl()}Dl(t){this.fl=this.fl.filter(e=>e!==t);const e=this.Hl();return!e.includes(t)&&(this.Ul([...e,t]),this.Wl(),!0)}Ll(t){const e=new Set(t);this.fl=this.fl.filter(t=>!e.has(t));const i=this.Vl(),n=i.filter(t=>!e.has(t));n.length!==i.length&&(this.Ul(n),0===n.length&&this.Gl()),this.Nl(t),this.zl()}zl(){try{var t;null===(t=this.vl)||void 0===t||t.call(this)}catch(t){this.Ol().error("Error while handling activated items change",t)}}Jl(){const t=this.kl();if(!t)return{};const e=this.Gi.getProperty(t);return e&&"object"==typeof e?e:{}}Bl(t){if(!this.kl())return;const e=this.Jl();this.Sl(ue(ue({},e),{},{[t]:Date.now()}))}Nl(t){if(!this.kl())return;const e=this.Jl(),i={};let n=!1;for(const[s,r]of Object.entries(e))t.includes(s)?n=!0:i[s]=r;n&&(Te(i)?this.xl():this.Sl(i))}Ql(){this.kl()&&this.xl()}getActivationTimestamp(t){if(!this.Hl().includes(t))return;const e=this.Jl()[t];return Ae(e)?e:void 0}Vl(){const t=this.Zl();return this.Gi.getProperty(t)||[]}Hl(){const t=this.Vl();if(0===t.length)return[];const e=this.Gi.getProperty(this.Kl()),i=this.Gi.getSessionId();return i&&e===i?t:[]}Wl(){const t=this.Gi.getSessionId();t&&this.Yl(t)}Gl(){this.Xl()}_l(t){const e=this.Gi.getProperty(this.Kl());if(e&&e!==t){const t=this.Vl(),e=this.Jl();t.length>0&&(this.Ul([]),t.filter(t=>Ae(e[t])).forEach(t=>this.jl(t))),this.Gl(),this.Ql(),t.length>0&&this.zl()}}getActivatedIds(){return[...new Set([...this.Hl(),...this.fl])].filter(t=>!this.ta(t))}dispose(){var t,e,i;null===(t=this.bl)||void 0===t||t.call(this),this.bl=void 0,null===(e=this.rl)||void 0===e||e.call(this),this.rl=void 0,null===(i=this.Rl)||void 0===i||i.dispose(),this.Rl=void 0}reset(){this.fl=[],this.Vl().length>0&&this.Ul([]),this.Gl(),this.Ql(),this.zl()}getEventToItemsMap(){return this.pl}ea(){return this.Rl}},D_=class extends L_{constructor(t,e,i,n){var s;super({subscribeCapture(e){const i=t.onEvent(t=>e(t.event,t));return()=>i.dispose()},subscribeSession(e){const i=t.onSession(e);return()=>i.dispose()},getSessionId(){var e;return null===(e=t.session)||void 0===e?void 0:e.sessionId},getProperty:e=>t.kv.get(e),getActionUrl:null==i?void 0:i.getActionUrl,setElementSelectors:null!==(s=null==i?void 0:i.setElementSelectors)&&void 0!==s?s:(e,i)=>{var n;return null===(n=t.getExtension("autocapture"))||void 0===n?void 0:n.setElementSelectors(e,i)}},n),this.ia=t,this.na=e,this.yl()}Zl(){return O}Kl(){return P}kl(){return F}Sl(t){this.ia.kv.set({[F]:t})}xl(){this.ia.kv.remove(F)}wl(t){var e;let i;this.Ml(e=>{i=e.find(e=>e.id===t)});const n=null==i||null===(e=i.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds;return Ae(n)&&n>0}sa(){return Tm.SHOWN}Ml(t){this.na.getSurveys(t)}jl(t){this.na.cancelPendingSurvey(t)}Ol(){return Mm}Ul(t){this.ia.kv.set({[O]:t})}Yl(t){this.ia.kv.set({[P]:t})}Xl(){this.ia.kv.remove(P)}ta(){return!1}Fl(t,e,i){var n;if(t===Tm.SENT&&!1===(null==i||null===(n=i.properties)||void 0===n?void 0:n.$survey_completed))return"ignore";let s;return this.Ml(t=>{s=t.find(t=>t.id===e)}),!s||yu(s)?t===Tm.SHOWN?"consume":"ignore":t===Tm.SHOWN?"persist":t===Tm.DISMISSED||t===Tm.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}};const N_=(t,e)=>(null==t?void 0:t.then)?t.then(e):e(t),j_="SDK is not enabled or survey functionality is not yet loaded",q_="Disabled. Not loading surveys.";var B_=class{constructor(t){this.ra=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.oa=!1,this.la=!1,this.aa=[],this.ua=[],this.ca=null,this.ha=null,this.qi=!1,this.da=new Set,this.onRemoteConfig=t=>{if(this.qi)return;if(this.Yr.disableSurveys)return;if(!t.ok)return this.la=!0,this.va({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),Mm.warn("Remote config unavailable. Not loading surveys.");const e=t.config.surveys;if(Re(e))return Mm.warn("Flags not loaded yet. Not loading surveys.");this.fa=Pe(e)?e:e.length>0,Mm.info(`flags response received, isSurveysEnabled: ${this.fa}`),this.loadIfEnabled()},this.va=t=>{this.ua.slice().forEach(e=>this.pa(e,t))}}setup(t){if(!this.qi)return this.ga=t,N_(t.kv.initialize(),()=>{if(this.ga!==t||this.qi)return;this.ga=void 0,this.ia=t;const e=t.onRemoteConfig(this.onRemoteConfig);this.qi?e.dispose():(this.ma=e,this.loadIfEnabled())})}dispose(){var t,e,i,n,s;this.qi||(this.qi=!0,this.ga=void 0,this.ia=void 0,null===(t=this.ma)||void 0===t||t.dispose(),this.ma=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.aa=[],this.ua.forEach(t=>{t.active=!1}),this.ua=[],null===(s=this.ya)||void 0===s||s.call(this),this.ya=void 0,this.ca=null,this.da.forEach(t=>clearTimeout(t)),this.da.clear())}get Yr(){return this.ra.get()}getRenderContext(){if(!this.ia)return;const t=this;return{client:this.ia,get config(){return t.Yr},surveys:t}}initialize(){this.loadIfEnabled()}reset(){var t,e;null===(t=this._surveyManager)||void 0===t||null===(e=t.clearInMemoryInProgressSurveyState)||void 0===e||e.call(t);try{var i;null===(i=this._surveyEventReceiver)||void 0===i||i.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let e=0;e<localStorage.length;e++){const i=localStorage.key(e);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&t.push(i)}t.forEach(t=>localStorage.removeItem(t))}catch(t){}this.va()}loadIfEnabled(){if(this.qi||!this.ia)return;const t=this.Yr;if(this._surveyManager)return;if(this.oa)return void Mm.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Mm.info(q_);if(t.cookielessMode&&this.ia.isOptedOut)return void Mm.info("Not loading surveys in cookieless mode without consent.");const e=this.ra.getExtensions();if(!e)return void this.ba("PostHog Extensions not found.");if(Ce(this.fa)&&!t.advancedEnableSurveys)return;const i=this.fa||t.advancedEnableSurveys;this.oa=!0,this.la=!1;try{const t=e.generateSurveys;if(t)return this._a(t,i),void(this.oa=!1);const n=e.loadExternalDependency;if(!n)return this.ba(A),void(this.oa=!1);n(t=>{try{if(this.qi)return;const e=this.ra.getExtensions();t||!(null==e?void 0:e.generateSurveys)?this.ba("Could not load surveys script",t):this._a(e.generateSurveys,i)}finally{this.oa=!1}})}catch(t){throw this.oa=!1,this.ba("Error initializing surveys",t),t}}_a(t,e){var i;if(this.qi)return;this._surveyManager=t(e),this._surveyEventReceiver=this.wa(this.ia,this.va);const n=null===(i=this.ia)||void 0===i?void 0:i.kv.get(I);n&&this.ka(n),Mm.info("Surveys loaded successfully"),this.Sa(),this.va(),this.xa({isLoaded:!0})}wa(t,e){return new D_(t,this,void 0,e)}ba(t,e){this.la=!0,Mm.error(t,e),this.va({isLoaded:!1,error:t}),this.xa({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.aa.push(t),this._surveyManager&&this.xa({isLoaded:!0}),()=>{this.aa=this.aa.filter(e=>e!==t)}}getSurveys(t,e=!1){if(this.qi)return;const i=this.ia;if(!i)return t([],{isLoaded:!1,error:j_});if(this.Yr.disableSurveys)return Mm.info(q_),t([]);const n=i.kv.get(I);if(n&&!e)return t(n,{isLoaded:!0}),void(this.$a()&&this.getSurveys(()=>{},!0));if(this.ca)return void this.ca.then(({surveys:e,context:i})=>{this.qi||t(e,i)}).catch(t=>Mm.error("Error in survey callback",t));const s=i.sendRequest("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Yr.requestTimeoutMs}).then(t=>{try{return this.Ca(i,t)}catch(t){return Mm.error("Error processing surveys response",t),this.Ca(i,{statusCode:0,error:t})}},t=>this.Ca(i,{statusCode:0,error:t}));this.ca=s;const r=()=>{this.ca===s&&(this.ca=null)};s.then(e=>{r(),this.qi||(this.va(e.context),t(e.surveys,e.context))},r).catch(t=>Mm.error("Error in survey callback",t))}Ca(t,e){if(this.qi)return{surveys:[],context:{isLoaded:!1,error:j_}};const i=e.statusCode;if(200!==i||!e.json){const t=`Surveys API could not be loaded, status: ${i}`;return 0!==i?Mm.error(t):e.error||Mm.warn(t),this.ha=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.ha=null;const n=e.json.surveys||[];return t.kv.set({[I]:n,[R]:Date.now()}),this.ka(n),{surveys:n,context:{isLoaded:!0}}}ka(t){const e=t.filter(t=>Rm(t)&&(mu(t)||Am(t)));this.Ta(e)}Ta(t){var e;null===(e=this._surveyEventReceiver)||void 0===e||e.replace(t)}$a(){return this.Ma()&&!this.ca&&!this.Ia()}Ma(){var t;const e=null===(t=this.ia)||void 0===t?void 0:t.kv.get(R);return Ae(e)&&Date.now()-e>3e5}Ia(){return Ae(this.ha)&&3e5>Date.now()-this.ha}markSurveyAsSeen(t,e){var i;const n={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};Fm(n);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}this.va()}xa(t){for(const e of this.aa){if(this.qi)return;try{t.isLoaded?this.getSurveys(e):e([],t)}catch(t){Mm.error("Error in survey callback",t)}}}getActiveMatchingSurveys(t,e=!1){if(!Re(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Mm.warn("init was not called")}onActiveMatchingSurveysChanged(t){var e;if(this.qi)return()=>{};const i={callback:t,active:!0,revision:0};this.ua.push(i),this.Sa();const n=null===(e=this.ia)||void 0===e?void 0:e.kv.get(I);return this.Yr.disableSurveys||!this._surveyManager&&this.la&&!this.oa||!n&&!Re(this.ha)&&!this.ca?this.pa(i,{isLoaded:!1}):this._surveyManager&&this.pa(i),()=>{var t;i.active=!1,this.ua=this.ua.filter(t=>t!==i),0===this.ua.length&&(null===(t=this.ya)||void 0===t||t.call(this),this.ya=void 0)}}Sa(){var t,e,i;this._surveyManager&&this.ua.length>0&&(null!==(t=this.ya)&&void 0!==t||(this.ya=null===(e=(i=this.ra).onMatchingConditionsChanged)||void 0===e?void 0:e.call(i,this.va)))}pa(t,e){if(this.qi||!t.active)return;const i=++t.revision,n=n=>{if(!this.qi&&t.active&&i===t.revision)try{const i=null!=e?e:{isLoaded:!0},s=JSON.stringify([n,i]);if(s===t.lastResult)return;t.lastResult=s,t.callback(n,i)}catch(t){Mm.error("Error in active matching surveys callback",t)}};try{e&&!e.isLoaded?n([]):this.getActiveMatchingSurveys(n)}catch(t){Mm.error("Error in active matching surveys callback",t)}}Ea(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}Aa(t){if(Re(this._surveyManager))return{eligible:!1,reason:j_};const e="string"==typeof t?this.Ea(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Ra(t){var e;if(!(null===(e=this.ia)||void 0===e?void 0:e.canCapture))return{eligible:!1,reason:Im};if(Re(this._surveyManager))return{eligible:!1,reason:j_};const i="string"==typeof t?this.Ea(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Re(this._surveyManager))return Mm.warn("init was not called"),{visible:!1,disabledReason:j_};const e=this.Ra(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Re(this._surveyManager)?(Mm.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:j_})):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.Ra(s);i({visible:t.eligible,disabledReason:t.reason})}else i({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,i){var n,s,r;if(!(null===(n=this.ia)||void 0===n?void 0:n.canCapture))return;if(Re(this._surveyManager))return void Mm.warn("init was not called");const o="string"==typeof t?this.Ea(t):t;if(!(null==o?void 0:o.id))return void Mm.warn("Survey not found");if(!Lm.includes(o.type))return void Mm.warn(`Surveys of type ${o.type} cannot be rendered in the app`);const l=null===(s=typeof document>"u"?void 0:document)||void 0===s?void 0:s.querySelector(e);if(l){if(null===(r=o.appearance)||void 0===r?void 0:r.surveyPopupDelaySeconds){Mm.info(`Rendering survey ${o.id} with delay of ${o.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var e,n,s;this.da.delete(t),!this.qi&&(null===(e=this.ia)||void 0===e?void 0:e.canCapture)&&(Mm.info(`Rendering survey ${o.id} with delay of ${null===(n=o.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds} seconds`),null===(s=this._surveyManager)||void 0===s||s.renderSurvey(o,l,i),Mm.info(`Survey ${o.id} rendered`))},1e3*o.appearance.surveyPopupDelaySeconds);return void this.da.add(t)}this._surveyManager.renderSurvey(o,l,i)}else Mm.warn("Survey element not found")}displaySurvey(t,e){var i,n;if(!(null===(i=this.ia)||void 0===i?void 0:i.canCapture))return;if(Re(this._surveyManager))return void Mm.warn("init was not called");const s=this.Ea(t);if(!s)return void Mm.warn("Survey not found");let r=s;if((null===(n=s.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)&&e.ignoreDelay&&(r=ue(ue({},s),{},{appearance:ue(ue({},s.appearance),{},{surveyPopupDelaySeconds:0})})),e.displayType!==Em.Popover&&e.initialResponses&&Mm.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){const t=this.Aa(s);if(!t.eligible)return void Mm.warn("Survey is not eligible to be displayed: ",t.reason)}e.displayType!==Em.Inline?this._surveyManager.handlePopoverSurvey(r,e):this.renderSurvey(r,e.selector,e.properties)}cancelPendingSurvey(t){Re(this._surveyManager)?Mm.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)}},z_=class{constructor(t){this.disabled=!1===t;const e=$e(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;const n=this.clicks[this.clicks.length-1];if(n&&Math.abs(t-n.x)+Math.abs(e-n.y)<this.thresholdPx&&this.timeoutMs>i-n.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}};const U_=()=>typeof window>"u"?void 0:window,H_=()=>typeof document>"u"?void 0:document,W_="$copy_autocapture",V_=["password","hidden","file","checkbox","button","submit","reset","image"],G_=Hr("[AutoCapture]");function J_(t,e){return e.length>t?e.slice(0,t)+"...":e}function Q_(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do{e=e.previousSibling}while(e&&!go(e));return e}function Z_(t,{e:e,maskAllElementAttributes:i,maskAllText:n,elementAttributeIgnoreList:s,elementsChainAsString:r,disableCaptureUrlHashes:o}){var l,a;if(!go(t))return{props:{}};const u=[t],c=new Set([t]);let h=t;for(;!mo(h,"body")&&1e3>u.length;){const t=h.assignedSlot||h.parentNode,e=bo(t)?t.host:t&&go(t)?t:null;if(!e||c.has(e))break;c.add(e),u.push(e),h=e}const d="click"===e.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?u.findIndex(t=>mo(t,"button")||mo(t,"a")):-1;d>0&&(n=n||u.slice(0,d+1).some(t=>!Go(t)||Jo(t)));const v=[],f={};let p,g=!1,m=!1;if(Vr(u,t=>{const e=Go(t);if(e&&mo(t,"a")&&!i&&!(null==s?void 0:s.includes("href"))){const i=t.getAttribute("href");g=!!(e&&i&&il(i))&&(o?un(i):i)}ge(ko(t),"ph-no-capture")&&(m=!0),v.push(function(t,e,i,n,s=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};To.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?J_(1024,nl(t)):J_(1024,xo(t)));const l=ko(t);e||(null==n?void 0:n.includes("class"))||0>=l.length||(o.classes=l.filter(function(t){return""!==t})),Vr(Vo(t)?[]:t.attributes,function(i){var r;if((!Jo(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==n?void 0:n.includes(i.name))&&!e&&il(i.value)&&(!Ee(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=i.value;"class"===i.name&&(t=_o(t).join(" ")),o["attr__"+i.name]=J_(1024,"href"===i.name&&s?un(t):t)}});let a=1,u=1,c=t;for(;c=Q_(c);)a++,c.tagName===t.tagName&&u++;return o.nth_child=a,o.nth_of_type=u,o}(t,i,n,s,o)),Vr(function(t){if(!Go(t))return{};const e={};return Vr(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&&il(n)&&(e[i]=n)}}),e}(t),(t,e)=>{({}).hasOwnProperty.call(f,e)||(f[e]=t)})}),m)return{props:{},explicitNoCapture:m};if(d>0&&(t=u[d],v.splice(0,d)),n||(v[0].$el_text=mo(t,"a")||mo(t,"button")?nl(t):xo(t)),g){var y,b;v[0].attr__href=g;const t=null===(y=io(g))||void 0===y?void 0:y.host,e=null===(b=U_())||void 0===b||null===(b=b.location)||void 0===b?void 0:b.host;t&&e&&t!==e&&(p=g)}return{props:Gr((w=e.type,{$event_type:w,$ce_version:1}),r?{}:{$elements:v},{$elements_chain:(_=v,Se(_)?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 Jr(s).sort(([t],[e])=>function(t,e){return e>t?-1:t>e?1:0}(t,e)).forEach(([t,e])=>r[rl(t.toString())]=rl(e.toString())),n+=":",n+=Jr(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:ol(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Jr(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,e])=>n.attributes[t]=e),n})}(_)):"")},(null===(l=v[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(a=v[0])||void 0===a?void 0:a.$el_text}:{},p&&"click"===e.type?{$external_click_url:p}:{},f),target:t};var _,w}const K_="autocapture";var Y_=class{Pa(){this.Oa=void 0,clearTimeout(this.Fa),this.Fa=void 0}La(t){var e;if(!Go(t))return!0;const i=null!==(e=this.Da().css_selector_ignorelist)&&void 0!==e?e:Io,n=new Set;let s=t;for(;s;){if(n.size>=1e3||n.has(s))return!0;n.add(s);const t=s,e=ko(t);if(ge(e,"ph-no-capture")||ge(e,"ph-sensitive")||Jo(t)||i.some(e=>Co(t,e)))return!0;const r=s.assignedSlot||s.parentNode;s=bo(r)?r.host:r&&go(r)?r:null}return!1}Na(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.Pa();if("pointerdown"===t.type){var e;this.Pa();const i=$o(t);return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&i&&go(i)&&(this.Oa={target:i,excluded:this.La(i),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(e=this.ia)||void 0===e?void 0:e.distinctId}))}const i=this.Oa;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.Pa():"pointerup"===t.type&&(i.released=!0,this.Fa=setTimeout(()=>this.Pa(),0)))}ja(t){var e;const i=this.Oa;this.Pa();const n=$o(t);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(e=this.ia)||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)&&n&&(mo(n,"html")||mo(n,"body"))){var s,r,o;if(i.excluded)return null;const t=null!==(s=this.Da().css_selector_ignorelist)&&void 0!==s?s:Io;return[n,null===(r=H_())||void 0===r?void 0:r.documentElement,null===(o=H_())||void 0===o?void 0:o.body].some(e=>{if(!e)return!1;const i=ko(e);return ge(i,"ph-no-capture")||ge(i,"ph-sensitive")||!Go(e)||Jo(e)||t.some(t=>Co(e,t))})?null:i.target}}constructor(t){this.ra=t,this.name=K_,this.qa=!1,this.Ba=null,this.za=!1,this.Ha=new Map,this.Ua=!1,this.Yr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.qi=!1,this.ra.refresh(this.Yr),this.rageclicks=new z_(this.Yr.rageclick),this.Wa=null}setup(t){this.Va(),this.ia=t;const e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.qi?e.dispose():(this.ma=e,this.startIfEnabled())}dispose(){var t;this.qi||(this.qi=!0,this.ia=void 0,null===(t=this.ma)||void 0===t||t.dispose(),this.ma=void 0,this.Ha.clear(),this.Wa=null,this.Ga())}Da(){return this.ra.refresh(this.Yr),this.Yr}Va(){var t,e;return this.Da(),this.Yr.url_allowlist=null===(t=this.Yr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Yr.url_ignorelist=null===(e=this.Yr.url_ignorelist)||void 0===e?void 0:e.map(t=>new RegExp(t)),this.Yr}Ja(){const t=U_(),e=H_();if(!this.isBrowserSupported())return void G_.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!e)return;this.Qa=t,this.Za=e;const i=this.Ka=e=>{e=e||(null==t?void 0:t.event);try{if("blur"===e.type)return void this.Pa();if(0===e.type.indexOf("pointer"))return void this.Na(e);const t="click"===e.type?this.ja(e):void 0;if(Ie(t))return;this.Ya(e,"$autocapture",t)}catch(t){G_.error("Failed to capture event",t)}};if(to(t,"blur",i),to(e,"submit",i,{capture:!0}),to(e,"change",i,{capture:!0}),to(e,"click",i,{capture:!0}),Vr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{to(e,t,i,{capture:!0})}),this.Da().capture_copied_text){const i=this.Xa=e=>{e=e||(null==t?void 0:t.event);try{this.Ya(e,W_)}catch(t){G_.error("Failed to capture clipboard event",t)}};to(e,"copy",i,{capture:!0}),to(e,"cut",i,{capture:!0}),to(e,"paste",i,{capture:!0})}}Ga(){const t=this.Qa,e=this.Za;this.Pa(),this.Ka&&(null==t||t.removeEventListener("blur",this.Ka),Vr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==e||e.removeEventListener(t,this.Ka,!0)}),null==e||e.removeEventListener("submit",this.Ka,!0),null==e||e.removeEventListener("change",this.Ka,!0),null==e||e.removeEventListener("click",this.Ka,!0),this.Ka=void 0),this.Xa&&(null==e||e.removeEventListener("copy",this.Xa,!0),null==e||e.removeEventListener("cut",this.Xa,!0),null==e||e.removeEventListener("paste",this.Xa,!0),this.Xa=void 0),this.Qa=void 0,this.Za=void 0,this.qa=!1}startIfEnabled(){this.isEnabled||this.Pa(),!this.qi&&this.ia&&this.isEnabled&&!this.qa&&(this.Ja(),this.qa=!0)}onRemoteConfig(t){if(this.qi)return;if(this.za=!0,!t.ok)return void this.startIfEnabled();const e=t.config;e.elementsChainAsString&&(this.Ua=e.elementsChainAsString);const i=e.autocapture_opt_out;var n;Pe(i)&&(null===(n=this.ia)||void 0===n||n.kv.set("$autocapture_disabled_server_side",i),this.Ba=i),this.startIfEnabled()}setElementSelectors(t,e=this){if(this.qi)return;t.size?this.Ha.set(e,new Set(t)):this.Ha.delete(e);const i=new Set;this.Ha.forEach(t=>{t.forEach(t=>i.add(t))}),this.Wa=i}getElementSelectors(t,e){var i;const n=[];return null===(i=this.Wa)||void 0===i||i.forEach(i=>{var s;const r=null===(s=H_())||void 0===s?void 0:s.querySelectorAll(i);null==r||r.forEach(s=>{t!==s&&e!==s||ge(n,i)||n.push(i)})}),n}get isEnabled(){var t,e;if(this.qi)return!1;const i=null===(t=this.ia)||void 0===t?void 0:t.kv.get(M),n=this.Ba,s=this.Da();if(!s.remoteRequestsDisabled&&!this.za)return!1;const r=s.remoteRequestsDisabled&&!this.za;if(Ie(n)&&!Pe(i)&&!r)return!1;const o=null!==(e=this.Ba)&&void 0!==e?e:!!i;return!!s.enabled&&!o}Ya(t,e="$autocapture",i){if(!this.isEnabled)return void this.Pa();let n=i||$o(t);yo(n)&&(n=n.parentNode||null);const s=this.Va();var r;"$autocapture"===e&&"click"===t.type&&t instanceof MouseEvent&&s.rageclick&&(null===(r=this.rageclicks)||void 0===r?void 0:r.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime()))&&Uo(n,s.rageclick)&&this.Ya(t,"$rageclick",i);const o=e===W_,l=o?ue(ue({},s),{},{dom_event_allowlist:void 0}):s;if(n&&function(t,e,i,n,s,r){var o;const l=typeof window>"u"?void 0:window;if(!l||Ho(t))return!1;if((null==i?void 0:i.url_allowlist)&&!wo(i.url_allowlist,r))return!1;if((null==i?void 0:i.url_ignorelist)&&wo(i.url_ignorelist,r))return!1;if(null==i?void 0:i.dom_event_allowlist){const t=i.dom_event_allowlist;if(t&&!t.some(t=>e.type===t))return!1}const{parentIsUsefulElement:a,targetElementList:u,isComplete:c}=Wo(t,n);if(!c)return!1;if(!function(t,e){const i=null==e?void 0:e.element_allowlist;if(Ce(i))return!0;for(const e of t)if(i.some(t=>e.tagName.toLowerCase()===t))return!0;return!1}(u,i))return!1;if(!Eo(u,null==i?void 0:i.css_selector_allowlist))return!1;if(Eo(u,null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Io))return!1;try{const i=l.getComputedStyle(t);if(i&&"pointer"===i.getPropertyValue("cursor")&&"click"===e.type)return!0}catch(t){}const h=t.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return a?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(To.indexOf(h)>-1||"true"===t.getAttribute("contenteditable"))}}(n,t,l,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:s.getCurrentUrl}})){var a;const{props:i,explicitNoCapture:r,target:o}=Z_(n,{e:t,maskAllElementAttributes:s.maskAllElementAttributes,maskAllText:s.maskAllText,elementAttributeIgnoreList:s.element_attribute_ignorelist,elementsChainAsString:this.Ua,disableCaptureUrlHashes:s.disableCaptureUrlHashes});if(r)return!1;const l=this.getElementSelectors(n,o);if(l&&l.length>0&&(i.$element_selectors=l),e===W_){const e=t.type||"clipboard";if("paste"!==e){var u,c;const t=null===(u=U_())||void 0===u||null===(u=u.getSelection())||void 0===u?void 0:u.toString(),e=So(t);if(!e)return!1;i.$selected_content=e,i.$clipboard_text_length=null!==(c=null==t?void 0:t.length)&&void 0!==c?c:0}i.$copy_type=e}if("$autocapture"===e&&"change"===t.type&&s.capture_value_css_selector_allowlist&&!s.maskAllText&&(mo(h=n,"input")?!ge(V_,h.type):mo(h,"textarea")||mo(h,"select")&&!h.multiple)&&function(t,e){var i;if(!Go(t))return!1;const n=null!==(i=e.css_selector_ignorelist)&&void 0!==i?i:Io,s=new Set;let r=t;for(mo(t,"select")&&(r=t.options[t.selectedIndex]||t);r;){const t=r,e=ko(t);if(s.size>=1e3||s.has(r)||ge(e,"ph-sensitive")||ge(e,"ph-no-capture")||n.some(e=>Co(t,e)))return!1;s.add(r);const i=r.assignedSlot||r.parentNode;r=bo(i)?i.host:i&&go(i)?i:null}return!0}(n,s)&&!n.querySelector(".ph-no-capture, .ph-sensitive")){const t=s.capture_value_css_selector_allowlist;let e=!1;try{e=xe(t)?!!t(n):Se(t)&&t.some(t=>Co(n,t))}catch(t){G_.error("capture_value_css_selector_allowlist threw",t)}e&&(i.$input_value=n.value)}return null===(a=this.ia)||void 0===a||a.capture(e,i),!0}var h}isBrowserSupported(){var t;return xe(null===(t=H_())||void 0===t?void 0:t.querySelectorAll)}};const X_="featureFlags",tw="logs",ew=!!o||!!r,iw=new WeakMap,nw="text/plain";let sw=0,rw=!1;const ow=(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}`:""}`},lw=(t,e,i=!0)=>{const n=t.indexOf("#"),s=-1===n?"":t.slice(n),r=-1===n?t:t.slice(0,n),o=r.indexOf("?"),l=-1===o?r:r.slice(0,o),a=-1===o?"":r.slice(o+1),u=ue({},e),c=a.split("&").filter(t=>""!==t).map(t=>{const e=t.indexOf("="),n=-1===e?t:t.slice(0,e),s=i?u[n]:void 0;return delete u[n],Re(s)?t:`${n}=${s}`}),h=ao(u);return h&&c.push(h),`${c.length>0?`${l}?${c.join("&")}`:l}${s}`},aw=t=>{if(t.Mr)return t.Mr;const{data:e,compression:i}=t;if(!e)return;if(i===R_.GZipJS){const t=$a(Ta(lo(e)),{mtime:0});return{contentType:nw,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(i===R_.Base64){const i=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(lo(e)),n="sendBeacon"===t.transport,s=n?i:(t=>"data="+encodeURIComponent("string"==typeof t?t:lo(t)))(i);return{contentType:n?nw:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}const n=lo(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}},uw=t=>{const e=()=>"sendBeacon"===t.transport?{url:lw(t.url,{compression:R_.Base64}),encodedBody:aw(ue(ue({},t),{},{compression:R_.Base64,Mr:void 0}))}:{url:ow(t.url,"compression"),encodedBody:aw(ue(ue({},t),{},{compression:void 0,Mr:void 0}))};let i;try{i=aw(t)}catch(i){if(hs(t.compression,uo(t.url,"compression")))return Ur.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return i&&hs(t.compression,uo(t.url,"compression"))&&!((n=i.body)instanceof ArrayBuffer?cs(new Uint8Array(n)):ArrayBuffer.isView(n)&&cs(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(rw=!0,e()):{url:t.url,encodedBody:i};var n},cw=t=>{try{return uw(t)}catch(i){var e;return Ur.error(i),void(null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))}},hw=function(){var t=re(function*(t){const e=yield bs(lo(t.data),su.DEBUG,{rethrow:!0});if(!e)return t;const i=yield e.arrayBuffer();return ue(ue({},t),{},{Mr:{contentType:nw,body:i,estimatedSize:i.byteLength}})});return function(e){return t.apply(this,arguments)}}(),dw=t=>an("AbortError","PostHog request timed out"+(t?` after ${t}ms`:"")),vw=/Failed to fetch|NetworkError|Load failed/i,fw=t=>"TypeError"===(null==t?void 0:t.name)&&vw.test((null==t?void 0:t.message)||""),pw=t=>{try{const e=function(t,e=Date.now(),i=3e5){if("string"!=typeof t||!t)return;const n=t.trim(),s=/^\d+\s*,/.test(n)?n.slice(0,n.indexOf(",")).trim():n;if(/^\d+$/.test(s)){const t=1e3*Math.min(Number(s),i/1e3);return t>0?t:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(s))return;const r=/^\w{3} \w{3} /.test(s)?s+" GMT":s,o=Date.parse(r)-e;return Number.isFinite(o)&&o>0?Math.min(o,i):void 0}(t());return Ce(e)?void 0:Math.min(e,3e4)}catch(t){return}},gw=t=>{var e;const i=cw(t);if(!i)return;const n=new o;iw.set(n,!0);const{url:s,encodedBody:r}=i;n.open(t.method||"GET",s,!0);const{contentType:l,body:a}=null!=r?r:{};Vr(t.headers,function(t,e){n.setRequestHeader(e,t)}),l&&n.setRequestHeader("Content-Type",l),t.timeout&&(n.timeout=t.timeout);let u=!1;n.ontimeout=()=>{u=!0},n.onloadend=()=>{var e;if(u){var i;const e=dw(t.timeout);return Ur.warn(e),void(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))}const s={statusCode:n.status,text:n.responseText};if(200===n.status)try{s.json=JSON.parse(n.responseText)}catch(t){}null===(e=t.callback)||void 0===e||e.call(t,s,pw(()=>n.getResponseHeader("Retry-After")))},null===(e=t.onSend)||void 0===e||e.call(t,s),n.send(a)},mw=t=>{const e=cw(t);if(!e)return;const{url:i,encodedBody:n}=e,{contentType:s,body:o,estimatedSize:a}=null!=n?n:{},u=new Headers;Vr(t.headers,function(t,e){u.append(e,t)}),s&&u.append("Content-Type",s);let c=null,h=!1;if(l){const e=new l;c={signal:e.signal,timeout:setTimeout(()=>{h=!0;try{e.abort(dw(t.timeout))}catch(t){v(t)}},t.timeout)}}let d=!1;const v=e=>{var i;d||(d=!0,h&&"AbortError"===(null==e?void 0:e.name)||fw(e)?Ur.warn(e):Ur.error(e),null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))};let f=0;const p=()=>{sw-=f,f=0,c&&clearTimeout(c.timeout)};try{var g;const e=ue({method:(null==t?void 0:t.method)||"GET",headers:u,referrerPolicy:"strict-origin",body:o,signal:null==c?void 0:c.signal},t.fetchOptions);null===(g=t.onSend)||void 0===g||g.call(t,i);const n=null!=a?a:Ce(o)?0:void 0;e.keepalive="POST"===e.method&&!t.tu&&!1!==e.keepalive&&e.body===o&&!Ce(n)&&n>=0&&52428.8>sw+n,e.keepalive&&(f=n,sw+=f),r(i,e).then(e=>e.text().then(i=>{var n;if(d)return;const s={statusCode:e.status,text:i};if(200===e.status)try{s.json=JSON.parse(i)}catch(t){Ur.error(t)}d=!0,p(),null===(n=t.callback)||void 0===n||n.call(t,s,pw(()=>e.headers.get("Retry-After")))})).catch(t=>{p(),v(t)}).finally(p)}catch(t){p(),v(t)}},yw=t=>{try{var e;const{url:n,encodedBody:s}=uw(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 c=Se(t.data)?t.data:null===(e=t.data)||void 0===e?void 0:e.batch;if(Se(c)&&c.length>1&&(null!=a?a:0)>16384){const e=Math.ceil(c.length/2),i=e=>Se(t.data)?e:ue(ue({},t.data),{},{batch:e});return yw(ue(ue({},t),{},{data:i(c.slice(0,e))})),void yw(ue(ue({},t),{},{data:i(c.slice(e))}))}Ur.warn(`Beacon of ~${null!=a?a:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?mw(ue(ue({},t),{},{tu:!0})):gw(t)}catch(t){Ur.warn("Beacon send failed",t)}},bw=(t,e,i,n)=>{const s="query"===n?"POST"===e?"sent_at":"_":void 0;return lw(i===R_.GZipJS?ow(t,"compression"):t,ue(ue({},s?{[s]:Date.now().toString()}:{}),i===R_.GZipJS?{}:{compression:i}))},_w=(()=>{const t=[];return r&&t.push({transport:"fetch",method:mw}),o&&t.push({transport:"XHR",method:gw}),(null==i?void 0:i.sendBeacon)&&t.push({transport:"sendBeacon",method:yw}),t})(),ww=()=>{var e;return(null==t||null===(e=t.performance)||void 0===e?void 0:e.now)?t.performance.now():Date.now()},kw=[],Sw=[50,75,100,150,200,300,400,500,750,1e3,1500,2e3,3e3,5e3,1e4],xw=[5,10,25,...Sw];var $w=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);Ce(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)}},Tw=class{constructor(t){this.instance=t,this.R=Ur,this.kv=new $w(t),this.onSession=t=>A_(this.instance.onSessionId(e=>{try{t(e)}catch(t){this.R.error("Browser extension session listener failed",t)}})),this.onEvent=t=>A_(this.instance._addCaptureHook((e,i)=>{if(i)try{t({event:e,properties:i.properties})}catch(t){this.R.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{const e=e=>{try{t(e)}catch(t){this.R.error("Browser extension remote config listener failed",t)}},i=this.instance.Tr.on("extensionsRemoteConfig",e);return this.instance.Ir&&e(this.instance.Ir),A_(i)}}get logger(){return this.R}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(N);return"string"==typeof t?t:void 0}get library(){return{name:su.LIB_NAME,version:su.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,n,s;const r=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==r?void 0:r.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==r?void 0:r.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(n=null==r?void 0:r.sessionStartTimestamp)&&void 0!==n?n:0,lastActivityTimestamp:null!==(s=null==r?void 0:r.lastActivityTimestamp)&&void 0!==s?s:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return xe(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get isRateLimited(){var t;return!!(null===(t=this.instance.rateLimiter)||void 0===t?void 0:t.isClientRateLimited)}get projectToken(){return this.instance.config.token}getExtension(t){let e;switch(t){case X_:case Hg:e=this.instance.featureFlags;break;case tw:e=this.instance.logs;break;case"surveys":e=this.instance.surveys;break;case K_:e=this.instance.autocapture}return e}capture(t,e,i){if(!i)return this.Ar(this.instance.capture(t,e));const n=ue(ue({timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce},"unload"===i.delivery?{transport:"sendBeacon",send_instantly:!0}:{}),"immediate"===i.delivery?{send_instantly:!0}:{});return this.Ar(this.instance.capture(t,e,n))}Ar(t){var e;return!Ce(t)||!(null===(e=this.instance.rateLimiter)||void 0===e?void 0:e.lastEventRateLimited)}registerDynamicEventProperties(t){return A_(this.instance.Rr(t))}sendRequest(e){var i=this;return re(function*(e,n={}){var s;const r=null!==(s=n.target)&&void 0!==s?s:"api",o=n.query?lw(e,n.query):e,l=i.instance.requestRouter.endpointFor(r,o),a={method:n.method,url:l,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,compressionFallback:"flags"===n.target&&"best-available"===n.compression?he.Base64:void 0,timestampMode:n.sentAt};return"api"===r&&"/i/v1/logs"===e&&(a.batchKey="logs"),"sendBeacon"===n.transport?(i.instance._send_request(a),{statusCode:202}):new Promise(e=>{var n;if(a.callback=e,"flags"===r&&(null===(n=i.instance.config.metrics)||void 0===n?void 0:n.flags)){let n,s;a.onDispatch=()=>{n=ww()},a.onSend=e=>{s=(e=>{try{return(e=>{var i;const n=null==t?void 0:t.PerformanceObserver,s=null===(i=io(e))||void 0===i?void 0:i.href;if(!n||!s)return;const r=ww(),o={name:s,before:1/0,inFlight:!0};let l,a,u,c=1/0,h=!1;const d=()=>{h||(h=!0,clearTimeout(u),p.disconnect(),kw.splice(kw.indexOf(o),1))};let v=!1;const f=t=>{for(const e of t){const t=e.startTime;e.name!==s||(v?r>=t:r>t)||t>=o.before||l&&t>=l.startTime||(l=e)}if(l&&a&&c>=l.startTime){const t=a;d(),t(l)}},p=new n(t=>f(t.getEntriesByName(s,"resource")));p.observe({entryTypes:["resource"]});for(const t of kw)t.name===s&&(t.before=Math.min(t.before,r),v=v||t.inFlight);return kw.push(o),{take(t,e){h||(c=t,o.inFlight=!1,a=e,u=setTimeout(d,5e3),xe(p.takeRecords)&&f(p.takeRecords()))},stop:d}})(e)}catch(t){return}})(e)},a.callback=t=>{if(e(t),Ce(n))return;const r=n,o=ww();try{const e=((t,e)=>{var i,n;const s=e.statusCode||void 0,r={"server.address":(null!==(i=null===(n=io(t))||void 0===n?void 0:n.hostname)&&void 0!==i?i:t).replace(/^\[(.*)\]$/,"$1")};s&&(r["http.response.status_code"]=s);const o=((t,e)=>t?400>t?void 0:String(t):"AbortError"===(null==e?void 0:e.name)?"timeout":"_OTHER")(s,e.error);o&&(r["error.type"]=o);const l=Au();return l&&(r["client.timezone"]=l),r})(l,t);if(i.Er("posthog.flags.request.duration",o-r,Sw,e),t.statusCode&&s)return void s.take(o,t=>i.Or(t,r,o,e))}catch(t){Ur.error("Failed to record the /flags request timing",t)}null==s||s.stop()}}i.instance._send_request(a)})}).apply(this,arguments)}Or(t,e,i,n){if(t.responseEnd>=t.startTime)try{const s=Math.min(t.responseEnd,i);this.Er("posthog.flags.request.pre_send_duration",t.startTime-e,xw,n),this.Er("posthog.flags.request.network_duration",s-t.startTime,Sw,n),this.Er("posthog.flags.request.main_thread_duration",i-s,xw,n)}catch(t){Ur.error("Failed to record the /flags request timing split",t)}}Er(t,e,i,n){var s;null===(s=this.instance.metrics)||void 0===s||s.histogram(t,e,{unit:"ms",attributes:ue({},n),bounds:i})}};let Cw;const Ew=t=>{var e;return(null==t?void 0:t.config.require_subresource_integrity)?t.__loadExternalDependency:null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.loadExternalDependency};var Mw=class{constructor(t){this._instance=t}get(){var t,e,i,n;const s=null===(t=this._instance)||void 0===t?void 0:t.config;return{disableSurveys:!!(null==s?void 0:s.disable_surveys),cookielessMode:!!(null==s?void 0:s.cookieless_mode),advancedEnableSurveys:!!(null==s?void 0:s.advanced_enable_surveys),requestTimeoutMs:null!==(e=null==s?void 0:s.surveys_request_timeout_ms)&&void 0!==e?e:1e4,prefillFromUrl:!!(null==s||null===(i=s.surveys)||void 0===i?void 0:i.prefillFromUrl),automaticDisplay:!(null==s?void 0:s.disable_surveys_automatic_display),featureFlagEvaluation:!(null==s?void 0:s.advanced_disable_feature_flags),overrideLanguage:null==s?void 0:s.override_display_language,prepareStylesheet:null==s?void 0:s.prepare_external_dependency_stylesheet,get_current_url:null==s?void 0:s.get_current_url,uiHost:null===(n=this._instance)||void 0===n||null===(n=n.requestRouter)||void 0===n?void 0:n.endpointFor("ui","")}}getExtensions(){const t=null==h?void 0:h.__PosthogExtensions__;if(!t||!this._instance)return;const e=this._instance,{generateSurveys:i}=t,n=Ew(e);return{generateSurveys:i?t=>i(e,t):void 0,loadExternalDependency:n?t=>n(e,"surveys",t):void 0}}onMatchingConditionsChanged(e){var i,n;const s=null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook(t=>{"$pageview"!==t&&t!==Tm.SHOWN&&t!==Tm.DISMISSED&&t!==Tm.SENT||e()}),r=()=>e();to(t,"PHSurveyShown",r);let o=!1;const l=null===(n=this._instance)||void 0===n?void 0:n.onFeatureFlags(()=>{o&&e()});return o=!0,()=>{o=!1,null==s||s(),null==l||l(),null==t||t.removeEventListener("PHSurveyShown",r)}}};const Iw=new WeakMap,Rw=(t,e)=>{const i=function(t){var e;const i=new Mw(t);if(!t)return{get config(){return i.get()}};if(null===(e=t.surveys)||void 0===e?void 0:e.getRenderContext)return t.surveys.getRenderContext();let n=Iw.get(t);return n||(n={client:new Tw(t),get config(){return i.get()},surveys:t.surveys},Iw.set(t,n)),n}(t);return i?function(t,e){if(typeof document>"u"||typeof window>"u")return;const i=new S_(t);return!1===t.config.automaticDisplay?(Mm.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i):!1===e?(Mm.info("There are no surveys to load or Surveys is disabled in the project settings."),i):(i.startAutomaticDisplay(),i)}(i,e):void 0};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.generateSurveys=Rw,h.extendPostHogWithSurveys=Rw;const Aw=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},Ow=1e4,Pw=(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),Fw=(t,e,i)=>{const n=JSON.stringify(t);if(i.remaining>=n.length)return Pw(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 Pw(e,JSON.stringify(t.slice(0,s)),i)},Lw=t=>void 0!==t&&"function"!=typeof t&&"symbol"!=typeof t&&"bigint"!=typeof t,Dw=(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}},Nw=(t,e,i)=>{if(!i.truncated)if($e(t)){if(i.seen.has(t))return void Dw(e||"circular","[Circular]",i);i.seen.add(t);try{for(const n in t)try{if(!{}.hasOwnProperty.call(t,n))continue;if(Nw(t[n],e?`${e}.${n}`:n,i),i.truncated)break}catch(t){continue}}catch(t){}}else Dw(e,t,i)},jw=(t,e,i,n,s=!1,r)=>{if(!Lw(t))return!s||Pw(e,"null",i);if(Ie(t)||(t=>{try{return Ae(t)||Pe(t)}catch(t){return!1}})(t))return Pw(e,JSON.stringify(t),i);if("string"==typeof t)return Fw(t,e,i);if(!$e(t)&&!Se(t))return Pw(e,JSON.stringify(t),i);if(n.has(t))return Fw("[Circular]",e,i);n.add(t);try{const r=t.toJSON;if(xe(r))return jw(r.call(t),e,i,n,s)}catch(t){}try{const n={}.toString.call(t);if("[object String]"===n)return Fw(String(t.valueOf()),e,i);if("[object Number]"===n||"[object Boolean]"===n)return Pw(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 jw(o,e,i,n,s,r)}if(Se(t)){if(!Pw(e,"[",i))return!1;for(let s=0;t.length>s;s++){if(s>0&&!Pw(e,",",i))return!1;let r;try{r=t[s]}catch(t){r=void 0}if(!jw(r,e,i,n,!0))return!1}return Pw(e,"]",i)}if(!Pw(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{Nw(l,s,r)}catch(t){}if(!Lw(l))continue;const a=`${o?"":","}${JSON.stringify(s)}:`;if(a.length>=i.remaining)return i.truncated=!0,!1;const u=e.length,c=i.remaining,h=i.truncated;if(!Pw(e,a,i))return!1;const d=e.length,v=jw(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=c,i.truncated=v?h:f,!v)return!1}}catch(t){}return Pw(e,"}",i)},qw=(t,e)=>{const i=[],n={remaining:e,truncated:!1},s=$e(t[0])?{result:{},keysRemaining:50,sizeRemaining:Ow,truncated:!1,seen:new WeakSet([t[0]])}:void 0;for(let e=0;t.length>e&&(0>=e||Pw(i," ",n))&&jw(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)||{}}},Bw={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},zw=t=>"canCapture"in t,Uw=t=>({console:h.console,hostname:h.location.host,getCapturingLogs(){let e;return e=zw(t)?t.canCapture?t.getExtension(tw):void 0:(xe(t.is_capturing)?t.is_capturing():!t.has_opted_out_capturing())?t.logs:void 0,e?{captureConsoleLog:i=>((t,e,i)=>{if(zw(t))return void e.captureConsoleLog(i);const n=(t=>{const e=/^1\.(\d+)\.(\d+)$/.exec(t);if(!e)return;const i=Number(e[1]),n=Number(e[2]);return 392>i||i>419?void 0:410===i?n>4?n>10?void 0:"de":"le":418===i?n>3?n>10?n>14?n>17?void 0:"vi":"ci":"ui":"he":419===i?n>2?void 0:"vi":410>i?"le":"he"})(t.version),s=n?e[n]:void 0;n?xe(s)&&s.call(e,i):xe(e.captureConsoleLog)&&e.captureConsoleLog(i)})(t,e,i),captureBufferedConsoleLog(t,i,n){var s;return null===(s=e.captureBufferedConsoleLog)||void 0===s?void 0:s.call(e,t,i,n)}}:void 0}});h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.logs={initializeLogs:t=>(t=>{const e=t.console;let i=t;const n=[],s={host:t.hostname};let r=!1;const o=()=>{i=void 0;for(const t of n)try{t()}catch(t){}};try{for(const t of Object.keys(Bw)){const o=n=>(...o)=>{let l=!1;try{if(o.length>0&&!r&&i){const e=i.getCapturingLogs();if(e){r=!0,l=!0;const{body:i,truncated:n,attributes:a}=qw(o,Ow),u=ue(ue({},s),n?{body_truncated:"true"}:{}),c={level:Bw[t],body:i,attributes:ue(ue({"log.source":`console.${t}`},u),a)};e.captureConsoleLog(c)}}}catch(t){}finally{l&&(r=!1),n.apply(e,o)}},l=e[t];n.push(wp(e,t,t=>{const e=o(t);return e.__rrweb_original__=Aw(l),e}))}}catch(t){throw o(),t}return o})(Uw(t)),replayConsoleBuffer:(t,e)=>((t,e)=>{const i=t.getCapturingLogs();if(i)for(const s of e)try{var n;const{body:e,truncated:r,attributes:o}=qw(s.args,Ow);null===(n=i.captureBufferedConsoleLog)||void 0===n||n.call(i,{level:Bw[s.level],body:e,attributes:ue(ue({"log.source":`console.${s.level}`,host:t.hostname},r?{body_truncated:"true"}:{}),o)},s.context,s.occurredAtMs)}catch(t){}})(Uw(t),e)};const Hw=t=>qe(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Ww=Hr("[Error tracking]"),Vw="webkit-masked-url:",Gw=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Jw=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Vw],Qw=["__firefox__","__gCrWeb"];function Zw(){return new _n([new Bn,new Kn,new Un,new zn,new Qn,new Jn,new Wn,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=On.test(n)?n.replace(On,"$1"):n;if(!o.match(/\S*Error: /)){for(const i of e){const e=i(o,t);if(e){s.push(e);const t=Fn(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(jn(s,l)>=50)break}}const a=[...l].sort((t,e)=>e.start-t.start),u=a[a.length-1];if(u){const t=Dn(s,u);s.splice(u.start-t,t);for(const e of a)e.start-=t}for(const t of a)Ln(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++)qn(e,t,i)&&(i=t);t.push(...t.splice(0,i))}(s),function(t){if(!t.length)return[];const e=Array.from(t);return e.reverse(),e.slice(0,50).map(t=>{return ue(ue({},t),{},{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||"?"});var i})}(s)}}("web:javascript",Mn,An))}const Kw=Hr("[ExceptionAutocapture]"),Yw=Zw(),Xw=(t,e)=>{try{return t()}catch(t){return e}},tk=(t,e)=>Xw(()=>t(e()),void 0),ek=t=>Xw(()=>xe(t)&&xe(t.call),!1),ik=(t,e)=>Xw(()=>{t[e].__POSTHOG_INSTRUMENTED__=!0},void 0),nk=(t,e,i)=>{Xw(()=>{var i;null===(i=t[e])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),Xw(()=>{t[e]=i},void 0)},sk=e=>{const i=t;i||Kw.info("window not available, cannot wrap onerror");const n=Xw(()=>i.onerror,void 0);return i.onerror=function(...t){var i;return tk(e,()=>Yw.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}})),!!ek(n)&&null!==(i=n(...t))&&void 0!==i&&i},ik(i,"onerror"),()=>nk(i,"onerror",n)},rk=(e,i=!1)=>{const n=t;n||Kw.info("window not available, cannot wrap onUnhandledRejection");const s=Xw(()=>n.onunhandledrejection,void 0);return n.onunhandledrejection=function(t){var n;return tk(e,()=>Yw.buildFromUnknown(t,{mechanism:{handled:!1}})),ek(s)?null!==(n=s(t))&&void 0!==n&&n:i},ik(n,"onunhandledrejection"),()=>nk(n,"onunhandledrejection",s)},ok={wrapOnError:sk,wrapUnhandledRejection:rk,wrapConsoleError(t){const e=console;e||Kw.info("console not available, cannot wrap console.error");const i=Xw(()=>e.error,void 0);return e.error=function(...e){Xw(()=>e.length>1&&Ee(e[0])&&(/^\[PostHog\.js\](?: |$)/.test(e[0])||"rrweb logger error:"===e[0]),!1)||tk(t,()=>{let t;t=1==e.length?e[0]:e.join(" ");const i=e.find(t=>t instanceof Error);return Yw.buildFromUnknown(i||t,{mechanism:{handled:!0,type:"onconsole"},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),ek(i)&&i(...e)},ik(e,"error"),()=>nk(e,"error",i)}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.errorWrappingFunctions=ok,h.posthogErrorWrappingFunctions=ok;const lk=(t,e)=>{if(!xe(null==t?void 0:t.capture))return;const i=null==e?void 0:e.autocaptureExceptions,n=!Ie(i)&&"object"==typeof i&&Se(i.errors_to_ignore)?i.errors_to_ignore.reduce((t,e)=>{try{t.push(new RegExp(e))}catch(t){Kw.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){Kw.error("Failed to capture exception for a legacy client",t)}};sk(t=>{n.some(e=>t.$exception_list.some(t=>e.test(t.value||"")))||s(t)}),rk(s,!0)};h.extendPostHogWithExceptionAutoCapture=lk,h.extendPostHogWithExceptionAutocapture=lk;const ak="X-POSTHOG-SESSION-ID",uk="X-POSTHOG-WINDOW-ID",ck="X-POSTHOG-DISTINCT-ID",hk=[ak,uk,ck],dk="traceparent",vk=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],fk=(t,e)=>({}.hasOwnProperty.call(t,e)),pk=t=>"object"==typeof t&&!Ie(t)||xe(t),gk=t=>"undefined"!=typeof Request&&(t instanceof Request||"[object Request]"==={}.toString.call(t)),mk=e=>{try{var i;return gk(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}},yk=(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;const l=(t=>xe(t)?t():t)(e);if(l&&"$posthog_cookieless"!==l){try{s.set(ck,l)}catch(t){return!1}o=!0}if(i){const{sessionId:t,windowId:e}=i.checkAndGetSessionAndWindowId(!0);s.set(ak,t),s.set(uk,e),o=!0}return o},bk=e=>{const i=new Uint8Array(e),n=null==t?void 0:t.crypto;if(n&&xe(n.getRandomValues))n.getRandomValues(i);else for(let t=0;e>t;t++)i[t]=Math.floor(256*Math.random());let s="";for(let t=0;e>t;t++)s+=(16>i[t]?"0":"")+i[t].toString(16);return s},_k=t=>{let e=bk(t);for(;/^0+$/.test(e);)e=bk(t);return e},wk=()=>`00-${_k(16)}-${_k(8)}-01`,kk=t=>{try{return new URL(t).origin}catch(t){return}},Sk=(t,e)=>{if(!Se(t)||0===t.length)return!1;let i;try{i=new URL(e)}catch(t){return!1}for(let e=0;t.length>e;e++){const n=t[e];if(Ee(n))if(n.indexOf("://")>-1){if(kk(n)===i.origin)return!0}else if(n.toLowerCase()===i.hostname)return!0}return!1},xk=(t,e,i)=>!(i.has(dk)||!Sk(t,e)||(i.set(dk,wk()),0));h.__PosthogExtensions__=h.__PosthogExtensions__||{};const $k={_patchFetch:(e,i,n,s)=>wp(t,"fetch",t=>function(r,o){const l=arguments.length>1?[r,o]:[r];let a=l;try{const t=mk(r);if(t)if(gk(r)){const t=new Request(r,o);a=[t];const l=new Headers;try{yk(e,i,n,t.url,l),l.forEach((e,i)=>t.headers.set(i,e))}catch(t){}xk(s,t.url,t.headers)}else{const l=new Headers(pk(o)?o.headers:void 0),u=yk(e,i,n,t,l),c=xk(s,t,l);if(u||c){const t=((t,e)=>{if(Ce(t)||Ie(t))return{headers:e};if(!pk(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)=>fk(t,e)?Reflect.get(t,e):Reflect.get(i,e,i),has:(t,e)=>fk(t,e)||e in i,ownKeys(t){const e=new Set(Reflect.ownKeys(t));return Reflect.ownKeys(i).forEach(t=>e.add(t)),vk.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&&vk.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)})})(o,l);t&&(a=[r,t])}}}catch(t){a=l}return t.apply(this,a)}),_patchXHR(e,i,n,s){const r=Se(s)&&"undefined"!=typeof WeakMap?new WeakMap:void 0,o=wp(t.XMLHttpRequest.prototype,"open",t=>function(s,o,l=!0,a,u){const c=this;let h=new Headers;const d=mk(o);if(d)try{yk(e,i,n,d,h)}catch(t){h=new Headers}r&&(r.delete(c),d&&r.set(c,d));const v=t.call(c,s,o,l,a,u);return hk.forEach(t=>{const e=h.get(t);if(e)try{c.setRequestHeader(t,e)}catch(t){}}),v});if(!r)return o;const l=t.XMLHttpRequest.prototype,a=wp(l,"setRequestHeader",t=>function(e,i){return(t=>{try{return String(t).toLowerCase()===dk}catch(t){return!1}})(e)&&r.delete(this),t.call(this,e,i)}),u=wp(l,"send",e=>function(){const i=r.get(this);if(i){r.delete(this);try{!Sk(s,i)||(e=>{try{return!!t&&new URL(e,t.location.href).origin===t.location.origin}catch(t){return!1}})(i)&&(e=>{try{let s=e;for(let e=0;xe(s)&&20>e;e++){var i,n;const e=s;if(e.__wrapped){const e=null==t?void 0:t[Symbol.for("opentelemetry.js.api.1")];return!!(null==e?void 0:e.propagation)}s=null===(i=null!==(n=e.__posthog_layer__)&&void 0!==n?n:e.__rrweb_layer__)||void 0===i?void 0:i.next}return!1}catch(t){return!1}})(null==c?void 0:c.next)||this.setRequestHeader(dk,wk())}catch(t){}}return e.apply(this,arguments)});let c;try{var h;c=null===(h=l.send)||void 0===h?void 0:h.__posthog_layer__}catch(t){}return()=>{u(),a(),o()}}};h.__PosthogExtensions__.tracingHeadersPatchFns=$k,h.postHogTracingHeadersPatchFns=$k,"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 Tk=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 Ck=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Ek=t=>{if("loading"===document.readyState)return"loading";const e=Ck();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"},Mk=t=>{const e=t.nodeName;return 1===t.nodeType?e.toLowerCase():e.toUpperCase().replace(/^#/,"")},Ik=t=>{let e="";try{for(;9!==(null==t?void 0:t.nodeType);){var i;const n=t,s=n.id?"#"+n.id:[Mk(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},Rk=new WeakMap;function Ak(t,e){let i=Rk.get(e);return i||(i=new WeakMap,Rk.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}let Ok=-1;const Pk=()=>Ok,Fk=t=>{addEventListener("pageshow",e=>{e.persisted&&(Ok=e.timeStamp,t(e))},!0)},Lk=(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)))}},Dk=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},Nk=()=>{var t,e;return null!==(t=null===(e=Ck())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let jk=-1;const qk=new Set,Bk=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,zk=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of qk)t();isFinite(jk)||(jk="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",zk,!0))}},Uk=(t=!1)=>{if(t&&(jk=1/0),0>jk){var e;const t=Nk(),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;jk=null!=i?i:Bk(),addEventListener("visibilitychange",zk,!0),addEventListener("prerenderingchange",zk,!0),Fk(()=>{setTimeout(()=>{jk=Bk()})})}return{get firstHiddenTime(){return jk},onHidden(t){qk.add(t)}}},Hk=(t,e=-1,i,n=0,s,r,o)=>{const l=Ck(),a=(null==l?void 0:l.navigationId)||0;let u="navigate";return i?u=i:0>Pk()?l&&(document.prerendering||Nk()>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}},Wk=(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){}},Vk=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},Gk=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},Jk=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var Qk=class{constructor(){this.u=void 0}};const Zk=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},Kk=[1800,3e3],Yk=(t,e={})=>{const i=Vk(e);Zk(()=>{const n=Ak(e,Qk),s=Uk();let r,o=Hk("FCP");const l=Wk(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(l.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-Nk(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});l&&(r=Lk(t,o,Kk,e.reportAllChanges),Fk(i=>{o=Hk("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Pk()),r=Lk(t,o,Kk,e.reportAllChanges),Dk(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Wk(["soft-navigation"],i=>{i.forEach(i=>{n.u&&i.navigationId&&Gk(n.u,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Hk("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Lk(t,o,Kk,e.reportAllChanges),r(!0)})},e)})},Xk=[.1,.25],tS=t=>t.find(t=>{var e;return 1===(null===(e=t.node)||void 0===e?void 0:e.nodeType)})||t[0],eS=(t,e={})=>{const i=Ak(e=Object.assign({},e),Tk),n=new WeakMap;i.t=t=>{var i;if(null==t||null===(i=t.sources)||void 0===i?void 0:i.length){const i=tS(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:Ik(o);n.set(i,t)}}},((t,e={})=>{const i=Uk();Yk(Jk(()=>{let n,s=Hk("CLS",0);const r=Ak(e,Tk),o=(i,o,l,a,u)=>{s=Hk("CLS",0,i,o,l,a,u),r.o=0,n=Lk(t,s,Xk,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()},c=["layout-shift"];Vk(e)&&c.push("soft-navigation");const h=Wk(c,u);h&&(n=Lk(t,s,Xk,e.reportAllChanges),i.onHidden(()=>{u(h.takeRecords()),n(!0)}),Fk(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Pk()),Dk(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=tS(s.sources);t&&(e={largestShiftTarget:n.get(t),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:t,largestShiftEntry:s,loadState:Ek(s.startTime)})}}return Object.assign(t,{attribution:e})})(e))},e)},iS=(t,e={})=>{const i=Ak(e=Object.assign({},e),Qk);Vk(e)&&(i.u=new Map),Yk(e=>{t((t=>{let e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:Ek(Pk())};if("soft-navigation"!==t.navigationType){if(t.entries.length){const i=Ck(),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:Ek(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 nS=0,sS=1/0,rS=0;const oS=t=>{for(const e of t)e.interactionId&&(sS=Math.min(sS,e.interactionId),rS=Math.max(rS,e.interactionId),nS=rS?(rS-sS)/7+1:0)};let lS;const aS=()=>{var t;return lS?nS:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var uS=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return aS()-this.h}D(){this.h=aS(),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 cS=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=Jk(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})}},hS=[200,500],dS=(t,e={})=>{const i=Ak(e=Object.assign({},e),uS);let n=[],s=[],r=0;const o=new WeakMap,l=new WeakMap;let a=!1;const u=()=>{a||(cS(c),a=!0)},c=()=>{const t=new Set(i.v.map(t=>o.get(t.entries[0]))),e=s.length-10;s=s.filter((i,n)=>n>=e||t.has(i));const l=new Set;for(const t of s){const e=h(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:Ik(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 h=(t,e)=>{const i=[];for(const s of n)if(s.startTime+s.duration>=t){if(s.startTime>e)break;i.push(s)}return i};Wk(["long-animation-frame"],t=>{n=n.concat(t),u()},e),((t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Uk();Zk(()=>{var n;"interactionCount"in performance||lS||(lS=Wk(["event"],oS,{durationThreshold:0}));let s,r=Hk("INP");const o=Ak(e,uS),l=(i,n,l,a,u)=>{o.D(),r=Hk("INP",-1,i,n,l,a,u),s=Lk(t,r,hS,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)},c=(t,e=!1)=>{cS(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.l(e):u(e);a(),e&&s(!0)})},h=["event","first-input"];Vk(e)&&h.push("soft-navigation");const d=Wk(h,c,ue(ue({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=Lk(t,r,hS,e.reportAllChanges),d&&(i.onHidden(()=>{c(d.takeRecords(),!0)}),Fk(()=>{l("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Pk())}))})})(e=>{t((t=>{if(0===t.entries.length){const e={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:t.value,loadState:Ek(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),c=h(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:c,inputDelay:s-e.startTime,processingDuration:a-s,presentationDelay:r-a,loadState:Ek(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,c=0,h=0;for(const e of t.longAnimationFrameEntries){u=u+e.startTime+e.duration-e.styleAndLayoutStart;for(const t of e.scripts){const e=t.startTime+t.duration;if(i>e)continue;const n=e-Math.max(i,t.startTime),c=t.duration?n/t.duration*t.forcedStyleAndLayoutDuration:0;a+=n-c,u+=c,n>h&&(l=i+s>t.startTime?"input-delay":i+s+r>t.startTime?"processing-duration":"presentation-delay",o=t,h=n)}}const d=t.longAnimationFrameEntries.at(-1),v=d?d.startTime+d.duration:0;v>=i+s+r&&(c=n-v),o&&l&&(t.longestScript={entry:o,subpart:l,intersectingDuration:h}),t.totalScriptDuration=a,t.totalStyleAndLayoutDuration=u,t.totalPaintDuration=c,t.totalUnattributedDuration=n-i-a-u-c})(v),Object.assign(t,{attribution:v})})(e))},e)};var vS=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 fS=50;const pS=[];Wk(["resource"],t=>{for(const e of t)pS.push(e),pS.length>fS&&pS.shift()});const gS=(t,e={})=>{null!=(e=Object.assign({},e)).resourceBufferSize&&(fS=e.resourceBufferSize);const i=Ak(e,vS),n=new WeakMap;Vk(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:Ik(i);n.set(t,o)}else t.id&&n.set(t,`#${t.id}`)},((t,e={})=>{let i=!1;const n=Vk(e);Zk(()=>{let s,r=Uk(),o=Hk("LCP");const l=Ak(e,vS),a=(n,l,a,u,c)=>{o=Hk("LCP",-1,n,l,a,u,c),s=Lk(t,o,$,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=Uk(!0))},u=t=>{var e;l.u&&t.navigationId&&Gk(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&&c([n])},c=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],a=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-Nk(),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())}},h=["largest-contentful-paint"];n&&h.push("interaction-contentful-paint","soft-navigation");const d=Wk(h,c);if(d){s=Lk(t,o,$,e.reportAllChanges);const r=["keydown","click","visibilitychange"],l=t=>{if(t.isTrusted&&!i){const t=o.id;cS(()=>{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});Fk(n=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Pk()),s=Lk(t,o,$,e.reportAllChanges),Dk(()=>{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&&(pS.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 c=0,h=0;if("soft-navigation"!==t.navigationType?(u=Ck(),c=null!==(s=null==u?void 0:u.activationStart)&&void 0!==s?s:0,h=null!==(r=null==u?void 0:u.responseStart)&&void 0!==r?r:0):(c=t.navigationStartTime||0,u=null===(o=i.u)||void 0===o?void 0:o.get(t.navigationId)),u){const i=Math.max(0,h-c),n=Math.max(i,a?(a.requestStart||a.startTime)-c:0),s=Math.min(t.value,Math.max(n,a?a.responseEnd-c:0));e=ue(ue({},e),{},{timeToFirstByte:i,resourceLoadDelay:n-i,resourceLoadDuration:s-n,elementRenderDelay:t.value-s,navigationEntry:u})}}return Object.assign(t,{attribution:e})})(e))},e)};let mS=-1;const yS=()=>mS,bS=t=>{addEventListener("pageshow",e=>{e.persisted&&(mS=e.timeStamp,t(e))},!0)},_S=(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)))}},wS=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},kS=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},SS=()=>{var t,e;return null!==(t=null===(e=kS())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let xS=-1;const $S=new Set,TS=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,CS=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of $S)t();isFinite(xS)||(xS="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",CS,!0))}},ES=(t=!1)=>{if(t&&(xS=1/0),0>xS){var e;const t=SS(),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;xS=null!=i?i:TS(),addEventListener("visibilitychange",CS,!0),addEventListener("prerenderingchange",CS,!0),bS(()=>{setTimeout(()=>{xS=TS()})})}return{get firstHiddenTime(){return xS},onHidden(t){$S.add(t)}}},MS=(t,e=-1,i,n=0,s,r,o)=>{const l=kS(),a=(null==l?void 0:l.navigationId)||0;let u="navigate";return i?u=i:0>yS()?l&&(document.prerendering||SS()>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}},IS=new WeakMap;function RS(t,e){let i=IS.get(e);return i||(i=new WeakMap,IS.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}var AS=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 OS=(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){}},PS=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},FS=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},LS=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var DS=class{constructor(){this.l=void 0}};const NS=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},jS=[1800,3e3],qS=(t,e={})=>{const i=PS(e);NS(()=>{const n=RS(e,DS),s=ES();let r,o=MS("FCP");const l=OS(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(l.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-SS(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});l&&(r=_S(t,o,jS,e.reportAllChanges),bS(i=>{o=MS("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,yS()),r=_S(t,o,jS,e.reportAllChanges),wS(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&OS(["soft-navigation"],i=>{i.forEach(i=>{n.l&&i.navigationId&&FS(n.l,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=MS("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=_S(t,o,jS,e.reportAllChanges),r(!0)})},e)})},BS=[.1,.25],zS=(t,e={})=>{const i=ES();qS(LS(()=>{let n,s=MS("CLS",0);const r=RS(e,AS),o=(i,o,l,a,u)=>{s=MS("CLS",0,i,o,l,a,u),r.i=0,n=_S(t,s,BS,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()},c=["layout-shift"];PS(e)&&c.push("soft-navigation");const h=OS(c,u);h&&(n=_S(t,s,BS,e.reportAllChanges),i.onHidden(()=>{u(h.takeRecords()),n(!0)}),bS(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,yS()),wS(n)}),setTimeout(n))}))};let US=0,HS=1/0,WS=0;const VS=t=>{for(const e of t)e.interactionId&&(HS=Math.min(HS,e.interactionId),WS=Math.max(WS,e.interactionId),US=WS?(WS-HS)/7+1:0)};let GS;const JS=()=>{var t;return GS?US:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var QS=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return JS()-this.u}M(){this.u=JS(),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 ZS=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=LS(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})}},KS=[200,500],YS=(t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=ES();NS(()=>{var n;"interactionCount"in performance||GS||(GS=OS(["event"],VS,{durationThreshold:0}));let s,r=MS("INP");const o=RS(e,QS),l=(i,n,l,a,u)=>{o.M(),r=MS("INP",-1,i,n,l,a,u),s=_S(t,r,KS,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)},c=(t,e=!1)=>{ZS(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.h(e):u(e);a(),e&&s(!0)})},h=["event","first-input"];PS(e)&&h.push("soft-navigation");const d=OS(h,c,ue(ue({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=_S(t,r,KS,e.reportAllChanges),d&&(i.onHidden(()=>{c(d.takeRecords(),!0)}),bS(()=>{l("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,yS())}))})};var XS=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 tx=[2500,4e3],ex=(t,e={})=>{let i=!1;const n=PS(e);NS(()=>{let s,r=ES(),o=MS("LCP");const l=RS(e,XS),a=(n,l,a,u,c)=>{o=MS("LCP",-1,n,l,a,u,c),s=_S(t,o,tx,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=ES(!0))},u=t=>{var e;l.l&&t.navigationId&&FS(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&&c([n])},c=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],a=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-SS(),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())}},h=["largest-contentful-paint"];n&&h.push("interaction-contentful-paint","soft-navigation");const d=OS(h,c);if(d){s=_S(t,o,tx,e.reportAllChanges);const r=["keydown","click","visibilitychange"],l=t=>{if(t.isTrusted&&!i){const t=o.id;ZS(()=>{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});bS(n=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,yS()),s=_S(t,o,tx,e.reportAllChanges),wS(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})},ix={onLCP:gS,onCLS:eS,onFCP:iS,onINP:dS,withoutAttribution:{onLCP:ex,onCLS:zS,onFCP:qS,onINP:YS}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=ix,h.__PosthogExtensions__.postHogWebVitalsCallbacks=ix,h.postHogWebVitalsCallbacks=ix;const nx={onLCP:ex,onCLS:zS,onFCP:qS,onINP:YS};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=nx,h.__PosthogExtensions__.postHogWebVitalsCallbacks=nx,h.postHogWebVitalsCallbacks=nx,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>nx;const sx={onLCP:gS,onCLS:eS,onFCP:iS,onINP:dS,withoutAttribution:{onLCP:ex,onCLS:zS,onFCP:qS,onINP:YS}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=sx,h.__PosthogExtensions__.postHogWebVitalsCallbacks=sx,h.postHogWebVitalsCallbacks=sx;const rx={onLCP:ex,onCLS:zS,onFCP:qS,onINP:YS};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=rx,h.__PosthogExtensions__.postHogWebVitalsCallbacks=rx,h.postHogWebVitalsCallbacks=rx,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>rx;const ox={};function lx(t,e){const i=$o(t);return i?ue({node:i,originalEvent:t,timestamp:Date.now()},e):null}function ax(t){return!!cn(()=>go(t))}function ux(t,e){return Math.abs(t)<Math.abs(e)?0>e?"up":"down":0>t?"left":"right"}function cx(t){return"swipe"===t.type?"$dead_swipe":"$dead_click"}const hx="canvas,video,audio,embed,object";function dx(t,e){return Ae(t)&&t>=e}function vx(t,e=1e3){return t>=0&&e>t?t:void 0}function fx(t,e,i=1e3){return Ae(e)?vx(t-e,i):void 0}var px=class{Dr(t){var e,i,n,s,r,o,l,a;const u=this.Fr((null==t?void 0:t.__onCapture)||this.Pr.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.Nr=new WeakSet,this.qr=!1,this.jr=[],this.Br=0,this.Fr=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.zr=()=>{clearTimeout(this.Ur),this.Ur=void 0,this.Wr=void 0},this.Hr=t=>{if(this.Gr(t),this.zr(),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.Vr(i,e),this.Wr=e}},this.Qr=t=>{Ie(t.relatedTarget)&&this.zr()},this.Zr=t=>{const e=this.Wr,i=t;if(!e||0!==i.button||t.isTrusted!==e.trusted)return;const n=t.composedPath();for(const t of e.path)if(ax(t)&&-1!==n.indexOf(t)){e.clickTarget=t;break}e.clickDetail=i.detail,this.Ur=h.setTimeout(this.zr,0)},this.Jr=t=>{this.Gr(t);const e=t,i=lx(e,{type:"click"}),n=this.Wr;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.Yr.selection_change_threshold_ms>0,this.zr()),Ie(i)||this.Kr(i)||this.Xr(i),this.eo()},this.no=()=>{const t=Date.now();this.io=t,t%50==0&&this.jr.forEach(e=>{Ce(e.scrollDelayMs)&&(e.scrollDelayMs=t-e.timestamp)})},this.ro=t=>{var e,i;const s=null==n?void 0:n.getSelection(),r=this.qr;this.qr="Range"===(null==s?void 0:s.type);const o=null==s?void 0:s.focusNode,l=o&&(go(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 c=zo($o(t))||zo(null!=l?l:null)||zo(null!==(i=u)&&void 0!==i?i:null),h="Caret"===(null==s?void 0:s.type)&&u&&!u.shadowRoot&&o&&o!==a&&o.contains(null!=a?a:null);if(!(r||this.qr||c||h))return;const d=Date.now();this.oo=d;const v=this.Wr;if(v&&(r||this.qr||c)){const e=$o(t);let i;if(zo(e))i=e;else if("Caret"===(null==s?void 0:s.type)){var f;zo(null!==(f=u)&&void 0!==f?f:null)||h?i=u:c&&(i=l)}const n=i?this.so(i,v):s&&(o||s.anchorNode)?this.Vr(s,v):r&&!this.qr&&v.selectionInitiallyRelated;v.selectionChanged=v.selectionChanged||n}this.jr.forEach(t=>{const e=d-t.timestamp;0>e||!Ce(t.selectionChangedDelayMs)&&e>=t.selectionChangedDelayMs||(t.selectionChangedDelayMs=e)})},this.gn=()=>{"hidden"===(null==n?void 0:n.visibilityState)&&this.zr();const t=Date.now();this.ao=t,this.lo("visibilityChangedDelayMs",t)},this.uo=()=>{const t=Date.now();this.co=t,this.lo("focusChangedDelayMs",t)},this.do=t=>{this.Gr(t);const e=t.touches,i=1===(null==e?void 0:e.length)?e[0]:void 0;this.ho=i&&this.fo()?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this.vo=()=>{this.ho=void 0},this.po=t=>{var e;const i=this.ho;if(this.ho=void 0,Ce(i)||this.Br>=this.Yr.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.Yr.swipe_threshold_px;if(u*u>a)return;if([this.io,this.mo,this.oo].some(t=>Ae(t)&&t>=i.timestamp))return;var c,h;if(this.yo()&&(null!==(c=null==n||null===(h=n.elementsFromPoint)||void 0===h?void 0:h.call(n,i.x,i.y))&&void 0!==c?c:[]).some(t=>{var e;return null===(e=t.matches)||void 0===e?void 0:e.call(t,hx)}))return;const d=lx(s,{type:"swipe",swipeDirection:ux(o,l),swipeDistancePx:Math.round(Math.sqrt(a))});Ie(d)||this.Kr(d)||this.Xr(d),this.eo()},this.Yr=this.Dr(e),this._onCapture=this.Yr.__onCapture}start(t){this.bo(),this.wo(),this.ko(),this.So(),this._o(),this.xo(t),this.Yr.capture_dead_swipes&&this.Co()}xo(e){if(!this.Mo){const i=function(e){return function(e,i){const n=ox[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 ox[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){Ur.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)?ox[e]=s.bind(i):s}("MutationObserver",e)}(h);this.Mo=new i(t=>{this.To(t)}),this.Io(e)}}Io(t){t&&this.Mo&&(this.Nr.has(t)||(this.Mo.observe(t,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),this.Nr.add(t),this.Ao(t)))}Ao(t,e){var i,n;go(t)&&t.shadowRoot&&this.Io(t.shadowRoot);const s=null!==(i=null===(n=t.querySelectorAll)||void 0===n?void 0:n.call(t,"*"))&&void 0!==i?i:[];for(let t=0;s.length>t;t++)null==e||e.add(s[t]),this.Io(s[t].shadowRoot)}Gr(t){var e,i;const n=null!==(e=null===(i=t.composedPath)||void 0===i?void 0:i.call(t))&&void 0!==e?e:[];for(let t=0;n.length>t;t++){const e=n[t];ax(e)&&this.Io(e.shadowRoot)}}stop(){var t;null===(t=this.Mo)||void 0===t||t.disconnect(),this.Mo=void 0,this.Nr=new WeakSet,h.removeEventListener("click",this.Jr,{capture:!0}),h.removeEventListener("mousedown",this.Hr,{capture:!0}),h.removeEventListener("mouseup",this.Zr,{capture:!0}),h.removeEventListener("mouseout",this.Qr,{capture:!0}),h.removeEventListener("dragstart",this.zr,{capture:!0}),h.removeEventListener("pointercancel",this.zr,{capture:!0}),h.removeEventListener("blur",this.zr),this.zr(),h.removeEventListener("scroll",this.no,{capture:!0}),null==n||n.removeEventListener("selectionchange",this.ro),h.removeEventListener("touchstart",this.do,{capture:!0}),h.removeEventListener("touchend",this.po,{capture:!0}),h.removeEventListener("touchcancel",this.vo,{capture:!0}),null==n||n.removeEventListener("visibilitychange",this.gn),h.removeEventListener("blur",this.uo),h.removeEventListener("focus",this.uo),this.ho=void 0}To(t){const e=new Set;for(const n of t)try{var i;if(!1===(null===(i=n.target)||void 0===i?void 0:i.isConnected))continue;this.mo=Date.now();const t=n.addedNodes;for(let i=0;t.length>i;i++){const n=t[i];ax(n)&&!e.has(n)&&this.Ao(n,e)}}catch(t){}}bo(){to(h,"click",this.Jr,{capture:!0}),to(h,"mousedown",this.Hr,{capture:!0}),to(h,"mouseup",this.Zr,{capture:!0}),to(h,"mouseout",this.Qr,{capture:!0}),to(h,"dragstart",this.zr,{capture:!0}),to(h,"pointercancel",this.zr,{capture:!0}),to(h,"blur",this.zr)}Xr(t){this.fo()&&(t.selectionChangedDelayMs=fx(t.timestamp,this.oo,this.Yr.selection_change_threshold_ms),t.visibilityChangedDelayMs=fx(t.timestamp,this.ao),t.focusChangedDelayMs=fx(t.timestamp,this.co),this.jr.push(t))}eo(){this.jr.length&&Ce(this.Ro)&&(this.Ro=h.setTimeout(()=>{this.Eo()},1e3))}wo(){to(h,"scroll",this.no,{capture:!0})}ko(){var t;this.qr="Range"===(null==n||null===(t=n.getSelection())||void 0===t?void 0:t.type),to(n,"selectionchange",this.ro)}so(t,e){const i=e.path[0];try{for(;t;){if(-1!==e.path.indexOf(t)||go(i)&&i.contains(t))return!0;t=t.getRootNode().host}}catch(t){}return!1}Vr(t,e){const i=e.path[0],n=t.rangeCount>0?t.getRangeAt(0):void 0,s=!!n&&cn(()=>n.startContainer.getRootNode()===i.getRootNode());if(n&&s&&go(i)){var r;if(!n.collapsed)return n.intersectsNode(i);const t=go(n.startContainer)&&null!==(r=n.startContainer.childNodes[n.startOffset])&&void 0!==r?r:n.startContainer;return this.so(t,e)}return this.so(t.focusNode,e)||this.so(t.anchorNode,e)}So(){to(n,"visibilitychange",this.gn)}_o(){to(h,"blur",this.uo),to(h,"focus",this.uo)}lo(t,e){this.jr.forEach(i=>{const n=vx(e-i.timestamp);Ae(n)&&(Ce(i[t])||i[t]>n)&&(i[t]=n)})}Co(){to(h,"touchstart",this.do,{capture:!0,passive:!0}),to(h,"touchend",this.po,{capture:!0,passive:!0}),to(h,"touchcancel",this.vo,{capture:!0,passive:!0})}fo(){return xe(this.instance.is_capturing)?this.instance.is_capturing():!this.instance.has_opted_out_capturing()}yo(){const t=Ce(this.Oo)||Ae(this.mo)&&this.mo>this.Oo;return(Ce(this.$o)||t)&&(this.Oo=Date.now(),this.$o=!!(null==n?void 0:n.querySelector(hx))),!!this.$o}Kr(t){return!t||("swipe"===t.type?this.Lo(t):this.Do(t))}Lo(t){return!(!po(t.node)&&!this.jr.some(e=>e.type===t.type&&e.node===t.node&&1e3>Math.abs(e.timestamp-t.timestamp))&&!mo(t.node,"html")&&go(t.node)&&function(t,e){var i;if(!(typeof window>"u"?void 0:window)||Ho(t))return!1;const n=Pe(e)?jo:null!==(i=null==e?void 0:e.css_selector_ignorelist)&&void 0!==i?i:jo,{targetElementList:s,isComplete:r}=Wo(t,!1);return!!r&&!Eo(s,n)}(t.node,{css_selector_ignorelist:this.Yr.css_selector_ignorelist}))}Do(t){return!(this.Yr.capture_clicks_with_modifier_keys||(e=t.originalEvent,!(e.ctrlKey||e.metaKey||e.altKey||e.shiftKey)))||!!this.Lo(t)||function(t){if(!(typeof window>"u"?void 0:window)||Ho(t))return!1;const{targetElementList:e,isComplete:i}=Wo(t,!1);return!i||e.some(t=>mo(t,"a"))}(t.node);var e}Eo(){if(!this.jr.length)return;clearTimeout(this.Ro),this.Ro=void 0;const t=this.jr;this.jr=[];for(const i of t){var e;i.mutationDelayMs=null!==(e=i.mutationDelayMs)&&void 0!==e?e:this.mo&&this.mo>=i.timestamp?this.mo-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const t=dx(i.scrollDelayMs,this.Yr.scroll_threshold_ms),n=dx(i.selectionChangedDelayMs,this.Yr.selection_change_threshold_ms),s=dx(i.mutationDelayMs,this.Yr.mutation_threshold_ms),r=dx(i.absoluteDelayMs,1.1*this.Yr.mutation_threshold_ms),o=Ae(i.scrollDelayMs)&&this.Yr.scroll_threshold_ms>i.scrollDelayMs,l=Ae(i.mutationDelayMs)&&this.Yr.mutation_threshold_ms>i.mutationDelayMs,a=i.selectionChangedDuringGesture||Ae(i.selectionChangedDelayMs)&&this.Yr.selection_change_threshold_ms>i.selectionChangedDelayMs,u=Ae(i.visibilityChangedDelayMs),c=Ae(i.focusChangedDelayMs);if(!(o||l||a||u||c))if(t||s||r||n){const e=cx(i);if("$dead_swipe"===e){if(this.Br>=this.Yr.max_dead_swipes_per_page_load)continue;this.Br++}this._onCapture(i,{[`${e}_last_mutation_timestamp`]:this.mo,[`${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.Yr.mutation_threshold_ms>i.absoluteDelayMs&&this.jr.push(i)}this.eo()}Pr(t,e){const i=cx(t);this.instance.capture(i,ue(ue(ue({},e),Z_(t.node,{e:t.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Yr.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:t.scrollDelayMs,[`${i}_mutation_delay_ms`]:t.mutationDelayMs,[`${i}_absolute_delay_ms`]:t.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:t.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:t.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:t.focusChangedDelayMs,$dead_swipe_direction:t.swipeDirection,$dead_swipe_distance_px:t.swipeDistancePx}),{timestamp:new Date(t.timestamp)})}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initDeadClicksAutocapture=(t,e)=>new px(t,e);const gx={"conversations.js":"sha384-8fPy3IASBzA8AWqnw4GisFo+FugHLE1xLpCaDmKKa+sdTroMj7fsaSQxeJdciOoP","crisp-chat-integration.js":"sha384-qVSPPiM5PHJlVNpiLPyETnf0VXOGevtCqjm2K8EmWnKpLQnY/TMu+iLJ8wWLW8iA","dead-clicks-autocapture.js":"sha384-MYefNCyD6/XLhTOKa8DavuGsgGJvAJO/X4iqoFkAqgGk7H9qgcIoysU9F2qVGMk1","exception-autocapture.js":"sha384-Ot3PAv2xl7Vye6W3KF/aQEiQCB6EmsnQVaLKN/6s0WyUBnPoJUdyyEzh1gGYgqGY","intercom-integration.js":"sha384-gWEoUxf+HEPSZ4GZthxep/3LlEectgXxzj8uWkW7dnvRRV6AKkHXtZEmcb0OqOvn","lazy-recorder.js":"sha384-wvfcx3cUmMBWsygl+eSTZvGBcUaZjgCJcoYUNRc+gUcUy8NfZZV11pqEVwCQ975g","logs.js":"sha384-HGXa+FeVH5JwY3bwubM1EJrP+LG95rh6oU9TbtzHZLs1ECpl5mCXv5FcYF8SgNjk","product-tours.js":"sha384-TlWlQfnDBI1yB3+CuhSTePe38C4bKqQwtK1m0/T6kk/EAsKbWvIya0UeuVkDmSV7","recorder.js":"sha384-t08QiFh+RHB6Jdz9IrPZ5yxf3Dzwdz92Mz0l8Ga/nox8o5+oO0I0gosm16hHDlCF","surveys.js":"sha384-YzGVGUYhh29eFCBFPwTkXhwXFO/T1ZmnwGr4caQVpv1GZg84B0VxXGH7LlB2Gw7g","tracing-headers.js":"sha384-Zb7V2jbC5lJGl7yFzBe8HpCvO3xgJln/lEcqY5xAQ9Z1LLCnbi2glbsfvRPRIYcD","web-vitals-soft-navs.js":"sha384-recN8i2tLQWaeNtCAnErAmFlgg4+33FAHvs8l84aE+SHr6oqLAPwhFVZdP4SfKT6","web-vitals-with-attribution-soft-navs.js":"sha384-f9L4YQQre9lKeUzyvy2Kt4dHLIXECipeMmbr7SPQAOqLi+ZCHbh1I1g/OwsK/zrp","web-vitals-with-attribution.js":"sha384-QVSLDmgzPE1K6g6gBB8QKx/YDQbI2ot0gAcajFIAkGf34SWA3oe6m+WzcmbzpVjD","web-vitals.js":"sha384-wNvgQ2MIesvfVwpUOblaIO/5weiMjR0Ld1eSNtW14MURV24BwfW8Svo6TsBJ3Bk9"},mx=/^sha384-[A-Za-z0-9+/]{64}$/,yx=Hr("[ExternalScriptsLoader]"),bx=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]},_x=(t,e,i)=>{i?yx.critical(e):yx.warn(e),t(e)},wx=(t,e,i,s)=>{if(t.config.disable_external_dependency_loading)return yx.warn(`${e} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const r=()=>{if(null==n||n.removeEventListener("DOMContentLoaded",r),t.config.disable_external_dependency_loading)return i("Loading of external scripts is disabled");if(!n)return i("document not found");let l=n.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",s&&(l.integrity=s),l.src=e,l.onload=t=>{l.__posthog_loading_callback_fired=!0,i(void 0,t)},l.onerror=t=>{l.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(l=t.config.prepare_external_dependency_script(l)),!l)return i("prepare_external_dependency_script returned null");if(s&&(!l.src||l.integrity!==s||"anonymous"!==l.crossOrigin))return _x(i,`prepare_external_dependency_script must keep src, integrity and crossOrigin 'anonymous' for ${e}`,!0);if(t.config.disable_external_dependency_loading)return i("Loading of external scripts is disabled");const a=bx(l.src);if(a){if(a.integrity!==l.integrity||a.crossOrigin!==l.crossOrigin||a.nonce!==l.nonce)return i("Existing script conflicts with prepared script policy");if(a.__posthog_loading_callback_fired)return i();const t=a.__posthog_loading_error;return t?i(t):(a.addEventListener("load",t=>{a.__posthog_loading_callback_fired=!0,i(void 0,t)}),void a.addEventListener("error",t=>{a.__posthog_loading_error=t,i(t)}))}if(!n.body)return o();if("head"===t.config.external_scripts_inject_target)n.head.appendChild(l);else{const t=n.querySelectorAll("body > script");var u;t.length>0?null===(u=t[0].parentNode)||void 0===u||u.insertBefore(l,t[0]):n.body.appendChild(l)}},o=()=>{null==n||n.addEventListener("DOMContentLoaded",r)};(null==n?void 0:n.body)||bx(e)?r():o()},kx={},Sx=(t,e)=>{let i=`/static/${e}.js?v=${t.version}`;if("toolbar"===e){const t=3e5;i=`${i}&t=${Math.floor(Date.now()/t)*t}`}return t.requestRouter.endpointFor("assets",i)};h.__PosthogExtensions__=h.__PosthogExtensions__||{};const xx=(t,e,i)=>{if(t.config.require_subresource_integrity){if("remote-config"===e||"toolbar"===e)return _x(i,`${e} can't be integrity-verified, so it is not loaded with require_subresource_integrity`);if(!n||!("integrity"in n.createElement("script")))return _x(i,"This browser does not support Subresource Integrity",!0);const s=`${e}.js`,r=gx[s];return Ee(r)&&mx.test(r)?void wx(t,t.requestRouter.endpointFor("assets",`/static/${t.version}/${s}`),i,r):_x(i,`No integrity hash for ${s}`,!0)}if("remote-config"===e){const e=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void wx(t,e,i)}const s=t.config.strict_script_versioning;if(s){const n=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=kx[n];if("fallback"===s&&r){if(bx(r))return void wx(t,r,i);delete kx[n]}return void wx(t,n,"fallback"===s?(s,r)=>{if(s)if("string"==typeof s)i(s);else{var o;const s=Sx(t,e);kx[n]=s;const r=bx(n);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),wx(t,s,i)}else i(void 0,r)}:i)}wx(t,Sx(t,e),i)};Cw=xx,h.__PosthogExtensions__.loadExternalDependency=xx,h.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{if(t.config.require_subresource_integrity)return _x(i,`Site apps can't be integrity-verified, so ${e} is not loaded with require_subresource_integrity`);const n=t.requestRouter.endpointFor("api",e);wx(t,n,i)};var $x=class{constructor(t){this._instance=t}get Yr(){return this._instance.config}get consent(){return this.eu()?0:this.iu}isOptedOut(){return"always"===this.Yr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Yr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Yr.opt_out_capturing_by_default}optInOut(t){this.nu.$t(this.su,t?1:0,this.Yr.cookie_expiration,this.Yr.cross_subdomain_cookie,this.Yr.secure_cookie)}reset(){this.nu.Dt(this.su,this.Yr.cross_subdomain_cookie)}get su(){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 iu(){const t=this.nu.Lt(this.su);return He(t)?1:ge(We,t)?0:-1}get nu(){const t=this.Yr.opt_out_capturing_persistence_type,e="localStorage"===t?Ua:Ba,i=e.Ot()?e:eu;if(!this.ru||this.ru!==i){this.ru=i;const e="localStorage"===t?Ba:Ua;e.Lt(this.su)&&(this.ru.Lt(this.su)||this.optInOut(He(e.Lt(this.su))),e.Dt(this.su,this.Yr.cross_subdomain_cookie))}return this.ru}eu(){return!!this.Yr.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,h.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(t=>He(t))}};const Tx=Hr("[Dead Clicks]"),Cx=()=>!0,Ex=t=>{var e;const i=!!(null===(e=t.instance.persistence)||void 0===e?void 0:e.get_property(Y)),n=t.instance.config.capture_dead_clicks;return Pe(n)?n:!!$e(n)||i};var Mx=class{get lazyLoadedDeadClicksAutocapture(){return this.ou}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({[Y]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lu(()=>{this.au()}):this.stop()}lu(t){var e,i;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)?t():null===(i=Ew(this.instance))||void 0===i||i(this.instance,"dead-clicks-autocapture",e=>{e?Tx.error("failed to load script",e):t()})}au(){var t;if(n){if(!this.ou&&(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=$e(this.instance.config.capture_dead_clicks)?ue({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.ou=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ou.start(n),Tx.info("starting...")}}else Tx.error("`document` not found. Cannot start.")}stop(){this.ou&&(this.ou.stop(),this.ou=void 0,Tx.info("stopping..."))}};const Ix=Hr("[SegmentIntegration]");function Rx(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()||La();t.config.get_device_id=s,n&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property(Ct,Kt)),i(n?void 0:e.anonymousId()||void 0)},r=e.user();"then"in r&&xe(r.then)?r.then(s):s(r)}(t,s,i=>{s.register(((t,e,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||Ix.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()||(Ix.info("No userId set, resetting PostHog"),t.reset()),r||(e=void 0),n.event.userId&&n.event.userId!==t.get_distinct_id()&&(Ix.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 Ix.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=>{Ix.error("Failed to register the Segment integration",t),e()})},i)}const Ax="posthog-js";function Ox(t,{organization:e,projectId:i,prefix:n,severityAllowList:s=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var l,a,u,c,h;if("*"!==s&&!s.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const d=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,t.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const v=(null===(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===(c=v[0])||void 0===c?void 0:c.value)||o.message,$sentry_exception_type:null===(h=v[0])||void 0===h?void 0:h.type,$sentry_tags:o.tags};var g;return e&&i&&(p.$sentry_url=(n||"https://sentry.io/organizations/")+e+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(g=t.exceptions)||void 0===g||g.sendExceptionEvent(p)),o}}var Px=class{constructor(t,e,i,n,s,r){this.name=Ax,this.setupOnce=function(o){o(Ox(t,{organization:e,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:null==r||r}))}}},Fx=class{constructor(t){this.uu=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Ur.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.cu=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.hu()}hu(){var t;this.du=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.uu)}destroy(){var t;null===(t=this.du)||void 0===t||t.call(this),this.du=void 0}doPageView(e,i){var n;const s=this.vu(e,i);return this.cu={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.vu(t,null===(e=this.cu)||void 0===e?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.cu)||void 0===t?void 0:t.pageViewId}}vu(t,e){const i=this.cu;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(!(Ce(t)||Ce(e)||Ce(i)||Ce(r)||Ce(o)||Ce(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?Qe(e/t,0,1,Ur):1,a=t>1?Qe(i/t,0,1,Ur):1,u=r>1?Qe(o/r,0,1,Ur):1,c=r>1?Qe(l/r,0,1,Ur):1;n=Gr(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:c})}}return i.pathname&&(n.$prev_pageview_pathname=i.pathname),i.timestamp&&(n.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),n}};const Lx=["flags","surveys"],Dx={[L]:{exposure:"hidden"},[q]:{exposure:"hidden"},[B]:{exposure:"hidden"},[V]:{exposure:"hidden"},[U]:{exposure:"hidden"},[W]:{exposure:"hidden"},[M]:{exposure:"event"},[G]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[J]:{exposure:"event"},[Q]:{exposure:"hidden"},[Z]:{exposure:"event"},[K]:{exposure:"event"},[Y]:{exposure:"event"},[X]:{exposure:"hidden"},[et]:{exposure:"event"},[it]:{exposure:"hidden"},[nt]:{exposure:"hidden"},[ut]:{exposure:"hidden"},[ct]:{exposure:"event"},[st]:{exposure:"event",shouldSkipFromEventProperties:t=>Ie(t)},[ht]:{exposure:"event"},[dt]:{exposure:"event"},[vt]:{exposure:"event"},[mt]:{exposure:"event"},[yt]:{exposure:"hidden"},[b]:{exposure:"hidden",storageGroup:"flags"},[v]:{exposure:"hidden",storageGroup:"flags"},[d]:{exposure:"hidden"},[f]:{exposure:"hidden",storageGroup:"flags"},[x]:{exposure:"hidden",storageGroup:"flags"},[m]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[y]:{exposure:"hidden",storageGroup:"flags"},[T]:{exposure:"hidden"},[C]:{exposure:"hidden"},[w]:{exposure:"hidden"},[_]:{exposure:"hidden"},[I]:{exposure:"hidden",storageGroup:"surveys"},[R]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[O]:{exposure:"event"},[P]:{exposure:"hidden"},[F]:{exposure:"hidden"},[_t]:{exposure:"hidden"},[wt]:{exposure:"hidden"},[kt]:{exposure:"hidden"},[St]:{exposure:"event"},[xt]:{exposure:"event"},[$t]:{exposure:"event"},[Tt]:{exposure:"event"},[k]:{exposure:"hidden"},[S]:{exposure:"hidden"},[bt]:{exposure:"event"},[p]:{exposure:"hidden"},[g]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ct]:{exposure:"hidden"},[Et]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[At]:{exposure:"hidden"},[Ot]:{exposure:"hidden"},[rt]:{exposure:"event"},[ot]:{exposure:"event"},[lt]:{exposure:"event"},[at]:{exposure:"event"},[Lt]:{exposure:"event"},[Dt]:{exposure:"event"},[Nt]:{exposure:"hidden"},[jt]:{exposure:"hidden"},[qt]:{exposure:"hidden"},[Bt]:{exposure:"hidden"},[zt]:{exposure:"hidden"},[Ut]:{exposure:"hidden"},[Ht]:{exposure:"hidden"},[Wt]:{exposure:"hidden"},[Vt]:{exposure:"hidden"},[Qt]:{exposure:"event"}},Nx=[[ft,{exposure:"hidden"}],[pt,{exposure:"hidden"}],[gt,{exposure:"hidden"}]],jx=t=>{const e=Dx[t];if(e)return e;for(const[e,i]of Nx)if(0===t.indexOf(e))return i},qx={flags:g,surveys:R},Bx=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],zx=t=>`${t}_cookie_identity_change_pending`,Ux=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},Hx="main",Wx=[b,v,f,x,m,g,y,w],Vx=t=>-1!==Wx.indexOf(t),Gx=[U,W],Jx=t=>-1!==Gx.indexOf(t),Qx=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},Zx=t=>{if(!t)return{};const e=JSON.parse(t);return $e(e)?e:{}},Kx=t=>{const e=t[f];return $e(e)?ue(ue({},t),{},{[f]:Object.fromEntries(Object.entries(e).map(([t,e])=>{var i;if(!$e(e)||!("value"in e)||1!==(null===(i=e.metadata)||void 0===i?void 0:i.config_version))return[t,e];const n=ue(ue({},e),{},{metadata:ue({},e.metadata)});delete n.value;for(const t of["config_version","rule_type","rule_id","variant_key","forced_variant"])delete n.metadata[t];return[t,n]}))}):t},Yx=(t,e)=>{Vr(t,(i,n)=>{const s=jx(n);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,n)||delete t[n]})};var Xx=class{constructor(e,i,n=!0,s=!e.cookieless_mode){if(this.fu={},this.pu=!1,this.gu=!1,this.mu=!1,this.yu=!1,this.bu=!1,this._u=new Map,this.wu=!1,this.ku=!1,this.Su=!1,this.xu=new Set,this.$u=new Set,this.Yr=e,this.Cu=n,this.props={},this.Tu=void 0,this.Mu=(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.Ai=e.disable_persistence||!!i,this.nu=this.Iu(e),this.mu=this.Eu(e),this.load(s),this.Au(),e.debug&&Ur.info("Persistence loaded",e.persistence,ue({},this.props)),this.update_config(e,e,i),this.save(),t){const e=()=>this.flush();to(t,"beforeunload",e,{capture:!1}),to(t,"pagehide",e,{capture:!1}),this.Ru=e=>{if(this.pu&&(!e.storageArea||e.storageArea===(null==t?void 0:t.localStorage))&&e.key)if(e.key!==this.Mu){if(this.mu){const t=Lx.find(t=>e.key===this.Pu(t));t&&this.Ou(e.key,t)}}else this.Ou(e.key,Hx)},to(t,"storage",this.Ru)}}reconcileFeatureFlagsBeforeMerge(){return!(this.Ai||this.bu||this.wu)&&this.Fu()}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,e])=>{const i=this._u.get(t);if(!Vx(t)||!0===i)return;if(!0===e)return void this.Lu(t,!0);const n=new Set(i||[]);e.forEach(t=>n.add(t)),n.size&&this.Lu(t,n)})}onCrossTabFeatureFlagChange(t){return this.$u.add(t),()=>this.$u.delete(t)}destroy(){this.Ru&&t&&(t.removeEventListener("storage",this.Ru),this.Ru=void 0),this.$u.clear()}Ou(t,e,i=!0){if(this.Ai)return!1;let n,s;try{if(s=Ua.Lt(t),Ie(s)){const t=this.Du(e);return t.storageValue=null,e!==Hx?t.persisted=!1:this.Nu({}),!1}n=Zx(s)}catch(t){return!1}e===Hx&&this.Nu(n);const r=e===Hx?n:Ua.Pt(this.Mu);if(r&&this.ju(r))return!1;const o=this.qu(n,e,i);return e===Hx&&this.mu&&!Qx(this.Bu().main,n)||this.zu(n,e,!0,s),o}ju(t){const e=this.props[D],i=t[D];return!Ce(e)&&!Ce(i)&&e!==i}zu(t,e,i,n){const s=this.Du(e);s.storageValue=n,e!==Hx&&(s.persisted=i);try{s.fingerprint=this.Hu(t,e)}catch(t){s.fingerprint=void 0}}qu(t,e,i){let n=!1;return Wx.forEach(i=>{var s;const r=null===(s=jx(i))||void 0===s?void 0:s.storageGroup;if(e===Hx&&this.mu&&r||e!==Hx&&r!==e)return;const o=i in t,l=this.Uu(i,o?t[i]:void 0),a=this._u.has(i)?i in this.props:o;a===i in this.props&&Qx(l,this.props[i])||(a?this.Wu(i,l,!1):this.Vu(i,!1),n=!0)}),n&&i&&this.$u.forEach(t=>t()),n}Nu(t){const e=this.gu&&this.Yr.cookieWinsOnConflict?[...Wa,...this.Yr.cookie_persisted_properties||[]]:[];Gx.forEach(i=>{this.xu.has(i)||-1!==e.indexOf(i)||(i in t?Qx(t[i],this.props[i])||this.Wu(i,t[i],!1):i in this.props&&this.Vu(i,!1))})}Gu(){return this.gu&&this.pu&&!this.Yr.cookieWinsOnConflict}Ju(){if(!this.Gu())return;let t,e;try{t=Ba.Lt(this.Mu)||void 0}catch(t){return}if(t&&t!==this.Qu){this.Qu=t;try{e=Ja(JSON.parse(t))}catch(t){return}Gx.forEach(t=>{!(t in e)||t in this.props||this.xu.has(t)||this.Wu(t,e[t],!1)})}}Zu(t){if(this.Gu())try{const e=JSON.stringify(Qa(t,this.Yr.cookie_persisted_properties||[])),i=Ba.Lt(this.Mu)||void 0;i===e&&(this.Qu=i)}catch(t){}}Fu(){if(!this.pu)return!1;try{this.Su=!1;const t=Ua.Lt(this.Mu),e=this.Du(Hx);let i,n=!1,s=!1;if(t!==e.storageValue)if(Ie(t))Ee(e.storageValue)&&this.Nu({}),e.storageValue=null;else{if(i=Zx(t),this.Nu(i),this.Su=!this.ku&&this.ju(i),this.Su)return!1;s=this.qu(i,Hx,!1),!this.mu||Qx(this.Bu().main,i)?this.zu(i,Hx,!0,t):e.storageValue=t,n=!0}return this.mu&&Lx.forEach(t=>{const e=Ua.Lt(this.Pu(t)),r=this.Du(t),o=i||{},l=n&&Wx.some(e=>{var i;return(null===(i=jx(e))||void 0===i?void 0:i.storageGroup)===t&&e in o});if(e===r.storageValue&&!l)return;if(Ie(e))return r.storageValue=null,r.persisted=!1,void(l&&(s=this.qu(o,t,!1)||s));const a=Zx(e);s=this.qu(a,t,!1)||s,this.zu(a,t,!0,e)}),s}catch(t){return!1}}Lu(t,e){this._u.set(t,e);const i=jx(t);(null==i?void 0:i.volatile)||(this.Du((this.mu?null==i?void 0:i.storageGroup:void 0)||Hx).fingerprint=void 0,this.Ku(t))}Yu(){Wx.forEach(t=>this._u.set(t,!0))}Au(){if(this.pu)try{const t=Ua.Lt(this.Mu),e=Zx(t);this.Du(Hx).storageValue=t,Wx.forEach(t=>{var i;const n=this.mu?null===(i=jx(t))||void 0===i?void 0:i.storageGroup:void 0,s=n?Ua.Lt(this.Pu(n)):null;if(n){const t=this.Du(n);t.storageValue=s,t.persisted=!Ie(s)}const r=n&&!Ie(s)?Zx(s):e;t in this.props?this.Xu(t,r[t],this.props[t]):t in r&&this.Lu(t,!0)})}catch(t){}}Uu(t,e){const i=this._u.get(t);if(!i)return e;if(!0===i)return this.props[t];if("$active_feature_flags"===t){const n=new Set(Se(e)?e:[]),s=new Set(Se(this.props[t])?this.props[t]:[]);return i.forEach(t=>s.has(t)?n.add(t):n.delete(t)),Array.from(n)}const n=$e(e)?ue({},e):{},s=$e(this.props[t])?this.props[t]:{};return i.forEach(t=>{t in s?n[t]=s[t]:delete n[t]}),n}Xu(t,e,i){if(!Vx(t))return;const n=this._u.get(t);if(!0===n)return;let s=e;if(this.pu)try{var r;const e=this.mu?null===(r=jx(t))||void 0===r?void 0:r.storageGroup:void 0,i=e?this.Pu(e):this.Mu;s=Zx(Ua.Lt(i))[t]}catch(t){}const o=new Set(n||[]);if("$active_feature_flags"===t){if(!Ce(e)&&!Se(e)||!Ce(s)&&!Se(s)||!Se(i))return void this.Lu(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(!$e(i))return void(Qx(s,i)?this._u.delete(t):this.Lu(t,!0));{if(!Ce(e)&&!$e(e)||Ce(e)&&Te(i)&&Ce(s))return void this.Lu(t,!0);const n=$e(e)?e:{},r=$e(s)?s:{};new Set([...Object.keys(n),...Object.keys(i)]).forEach(t=>{t in n==t in i&&Qx(n[t],i[t])||o.add(t)}),o.forEach(t=>{t in r==t in i&&Qx(r[t],i[t])&&o.delete(t)})}}o.size?this.Lu(t,o):this._u.delete(t)}tc(){var t;const e=null===(t=this.Yr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Ae(e)&&e>0?e:0}ec(t){if(this.Yr.cookieWinsOnConflict&&"localstorage+cookie"===this.Yr.persistence.toLowerCase())if(t)try{const e=Qa(t,this.Yr.cookie_persisted_properties||[]),i=Ka(e,this.Yr.cookie_persisted_properties||[]),n=JSON.stringify(e)+"|"+JSON.stringify(i),s=Ba.Lt(this.Mu)||void 0;s&&Xa(this.Mu,s)===n&&(this.nc=n,this.sc=s)}catch(t){}else try{const t=Ba.Lt(this.Mu)||void 0;this.nc=t?Xa(this.Mu,t):void 0,this.sc=t}catch(t){}}syncCookieProperties(){return this.rc(this.Yr)}rc(t,e=!1){if(this.Ai&&!e||this.bu||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let i;try{i=Ba.Lt(this.Mu)||void 0}catch(t){}if(!i||i===this.sc)return!1;const n=Xa(this.Mu,i);let s;try{s=Ja(JSON.parse(i))}catch(t){return!1}if((Ba.Lt(this.Mu)||void 0)!==i)return!1;this.nc=n,this.sc=i;const r=Ya(this.Mu,i),o=[...Wa,...r.properties],l={};if(Object.keys(s).forEach(t=>{const e=s[t];(Ce(e)||Ie(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e)&&(l[t]=!0,delete s[t])}),Te(s))return!1;const a="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,u=this.props,c=u[D],h=u[Ct],d=Gr({},u);[...Wa,...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===Wa.indexOf(t)||!1!==e&&0!==e)&&delete d[t]}}),this.props=Gr(d,s),Wx.forEach(t=>{const e=t in this.props;t in u===e&&Qx(u[t],this.props[t])||(e?this.Xu(t,u[t],this.props[t]):this.Lu(t,!0))}),!a||"$user_state"in s||"$user_state"in this.props||this.Wu(Ct,Zt);const y=this.props[D],S=this.props[Ct];return!a||y===c&&S===h||(this.ku=!0,this.yu=!0,nu.$t(zx(this.Mu),!0),this.Vu(w),this.Vu(v),this.Vu(b),this.Vu(f),this.Vu(x),this.Vu(m),this.Vu(g),this.Vu(p),this.Vu(k),"anonymous"!==S||"identified"!==h&&"anonymous"!==s.$user_state&&(Ce(c)||y===c)||(Yx(this.props,s),this.Vu(_)),"identified"===S?this.props.$user_id=y:delete this.props.$user_id,this.Vu(q)),!0}consumeCookieIdentityChange(){const t=zx(this.Mu),e=this.yu||!!nu.Lt(t);return this.yu=!1,e&&nu.Dt(t),e}oc(t=!1){return!(this.bu||this.Ai&&!t||!this.Yr.cookieWinsOnConflict||"localstorage+cookie"!==this.Yr.persistence.toLowerCase()||(this.bu=!0,0))}lc(){this.bu&&(Ce(this.ac)||(clearTimeout(this.ac),this.ac=void 0),delete this.fu[Hx],this.uc(!0))}cc(t=!0){if(this.bu)try{t?this.lc():Ce(this.ac)||(clearTimeout(this.ac),this.ac=void 0)}finally{this.bu=!1}}isDisabled(){return!!this.Ai}Iu(e){-1===Bx.indexOf(e.persistence.toLowerCase())&&(Ur.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const i=((e=[],i=!1,n=()=>!1)=>{const s=[...Wa,...e];return ue(ue({},Ua),{},{Pt(t){try{let r,o={};try{r=Ba.Lt(t)||void 0,o=r?Ja(JSON.parse(r)):{}}catch(t){}const l=JSON.parse(Ua.Lt(t)||"{}");let a;if(i){const i=Ya(t,r),n=[...Wa,...i.properties],u={};Object.keys(o).forEach(t=>{const e=o[t];Ie(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e||(u[t]=e)});const c="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var e;const t=l[D],r=null!==(e=l.$user_state)&&void 0!==e?e:Zt;s.forEach(t=>{if(-1!==n.indexOf(t)&&!(t in o)&&(c||"distinct_id"!==t&&"$user_state"!==t)){const e=l[t];(i.isValid||-1===Wa.indexOf(t)||!1!==e&&0!==e)&&delete l[t]}}),!c||"$user_state"in o||"$user_state"in l||(l[Ct]=Zt),!c||("distinct_id"in u?u[D]:l[D])===t&&("$user_state"in u?u[Ct]:l[Ct])===r||(Ha.forEach(t=>delete l[t]),"identified"===u.$user_state&&"distinct_id"in u?l.$user_id=u[D]:delete l.$user_id,"identified"!==u.$user_state&&(delete l[bt],delete l[_]),delete l.__alias)}a=Gr(l,u)}else a=Gr(o,l);return n()||Ua.$t(t,a),a}catch(t){}return null},$t(t,n,s,r,o,l){const a=Ua.$t(t,n,void 0,void 0,l);try{const u=Qa(n,e);if(Object.keys(u).length){if(i){const i=Va(t),c=Ka(u,e);if(Ba.$t(i,c,s,r,o,l),Ba.Lt(i)!==JSON.stringify(c)){Ba.Dt(i,r);const e=Qa(n);return Ba.$t(t,e,s,r,o,l),a}}Ba.$t(t,u,s,r,o,l)}}catch(t){Ua.Ft(t)}return a},Dt(e,i){try{null==t||t.localStorage.removeItem(e),Ba.Dt(e,i),Ba.Dt(Va(e),i)}catch(t){Ua.Ft(t)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict,()=>!!this.Ai);let n,s=!1,r=!1;const o=e.persistence.toLowerCase();return"localstorage"===o&&Ua.Ot()?(n=Ua,r=!0):"localstorage+cookie"===o&&i.Ot()?(n=i,r=!0,s=!0):"sessionstorage"===o&&nu.Ot()?n=nu:"memory"===o?n=eu:"cookie"===o&&Ba.Ot()?(n=Ba,s=!0):i.Ot()?(n=i,r=!0,s=!0):Ba.Ot()?(n=Ba,s=!0):n=eu,this.pu=r,this.gu=s,n}Pu(t){return`${this.Mu}__${t}`}Eu(t){return this.pu&&!!t.split_storage}properties(){const t={};return Vr(this.props,(e,i)=>{const n=jx(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.Ai&&!t)return;const e=this.Yr.cookieWinsOnConflict&&"localstorage+cookie"===this.Yr.persistence.toLowerCase(),i=e?Ua.Pt(this.Mu):null;let n={};if(e)try{n=Ja(Ba.Pt(this.Mu)),Vr(n,(t,e)=>{(Ce(t)||Ie(t)||""===t)&&delete n[e]})}catch(t){}const s=this.nu.Pt(this.Mu);if(s&&(this.props=Gr({},s)),this.mu&&this.hc(),e&&s){var r,o;const t=null==i?void 0:i[D],e=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Zt,l=s[D],a=null!==(o=s.$user_state)&&void 0!==o?o:Zt,u=nu.Pt(this.Mu),c=!Ce(t)||!Ce(null==i?void 0:i.$user_state)||!!u&&!Te(u);if(l!==t||a!==e){c&&(this.yu=!0,this.Ai||nu.$t(zx(this.Mu),!0));const i=Gr({},this.props);Ha.forEach(t=>delete i[t]),c&&"anonymous"===a&&("identified"===e||"anonymous"===n.$user_state||!Ce(t)&&l!==t)&&(Yx(i,n),delete i[_]),this.props=i;const s=new Set;Ha.forEach(t=>{var e;const i=null===(e=jx(t))||void 0===e?void 0:e.storageGroup;i&&s.add(i)}),s.forEach(t=>{if(this.Ai)return;const e={};Vr(this.props,(i,n)=>{var s;(null===(s=jx(n))||void 0===s?void 0:s.storageGroup)===t&&(e[n]=i)});const i=Kx(e);Te(e)?(Ua.Dt(this.Pu(t)),this.fu[t]={}):Ua.$t(this.Pu(t),i)&&(this.fu[t]={persisted:!0,fingerprint:this.Hu(i,t)})})}}nu.Lt(zx(this.Mu))&&(this.yu=!0)}hc(){for(const t of Lx){const e=Ua.Pt(this.Pu(t));if(e&&!Te(e)){const i=this.Du(t);i.persisted=!0,this.dc(t)||(i.fingerprint=this.Hu(e,t)),this.vc(t,e)||Gr(this.props,e)}}}dc(t){return Object.keys(this.props).some(e=>{var i;return(null===(i=jx(e))||void 0===i?void 0:i.storageGroup)===t})}vc(t,e){const i=qx[t];if(!i)return!1;const n=e[i],s=this.props[i];return Ae(n)&&Ae(s)&&s>n}refreshKey(t){this.fc([t])}fc(t){if(this.Ai)return;let e,i=!1;const n=()=>(i||(e=this.nu.Pt(this.Mu),i=!0),e);t.forEach(t=>{var e;if(this.xu.has(t))return;const i=this.mu?null===(e=jx(t))||void 0===e?void 0:e.storageGroup:void 0,s=i?Ua.Pt(this.Pu(i)):n();if(s&&t in s)this.Wu(t,s[t],!1);else{if(i){const e=n();if(e&&t in e)return void this.Wu(t,e[t],!1)}this.Vu(t,!1)}})}refreshMetaIdentifiers(){this.Ai||(this.gc()?this.mc():this.fc(Gx))}mc(){const t=this.yc();(Ce(t)||t!==this.bc)&&(this.fc(Gx),this._c(t))}_c(t=this.yc()){this.bc=0===this.xu.size?t:void 0}refreshMetaIdentifiersBeforeCapture(){this.Ai||this.bu||(this.gc()||this.Ju(),this.mc())}gc(){return this.nu===Ba||this.nu===nu||this.nu===eu}yc(){const t=this.nu.Lt(this.Mu);return Ee(t)?t:void 0}save(){if(this.Ai)return;const t=this.tc();t>0?Ce(this.ac)&&(this.ac=setTimeout(()=>{this.ac=void 0,this.uc()},t)):this.uc()}flush(){Ce(this.ac)||(clearTimeout(this.ac),this.ac=void 0,this.uc())}uc(t=!1){if(this.Ai||this.bu&&!t)return;t||(this.syncCookieProperties(),this.gc()&&this.refreshMetaIdentifiers());const e=!t&&!this.wu;e||(this.Su=!1);const i=!!e&&this.Fu();if(this.Su)return void(this.Yr.debug&&Ur.warn("skipping persistence write because storage belongs to a different distinct ID"));if(t||this.Ju(),this.mu)return this.wc(),void(i&&this.$u.forEach(t=>t()));const n=this.kc(this.nu,this.Mu,this.props,Hx);"written"===n&&(this.ec(this.props),this.Zu(this.props)),"failed"!==n&&(this._u.clear(),this.ku=!1,this.xu.clear()),"written"===n&&this._c(),i&&this.$u.forEach(t=>t())}wc(){const{main:t,groups:e}=this.Bu(),i=this.kc(this.nu,this.Mu,t,Hx);"written"===i&&(this.ec(t),this.Zu(t)),"failed"!==i&&(this.ku=!1,this.xu.clear(),Wx.forEach(t=>{var e;(null===(e=jx(t))||void 0===e?void 0:e.storageGroup)||this._u.delete(t)})),"written"===i&&this._c();for(const t of Lx){var n;const i=e[t];if(Te(i)&&!(null===(n=this.fu[t])||void 0===n?void 0:n.persisted)){Wx.forEach(e=>{var i;(null===(i=jx(e))||void 0===i?void 0:i.storageGroup)===t&&this._u.delete(e)});continue}const s=this.kc(Ua,this.Pu(t),i,t);"failed"!==s&&Wx.forEach(e=>{const i=jx(e);(null==i?void 0:i.storageGroup)!==t||"written"!==s&&i.volatile||this._u.delete(e)})}}Bu(){const t={},e={flags:{},surveys:{}};return Vr(this.props,(i,n)=>{var s;const r=null===(s=jx(n))||void 0===s?void 0:s.storageGroup;r?e[r][n]=i:t[n]=i}),{main:t,groups:e}}Hu(t,e){if(e===Hx)return JSON.stringify(t)+"|"+this.Sc+"|"+this.xc+"|"+this.$c;const i={};return Vr(t,(t,e)=>{var n;i[e]=(null===(n=jx(e))||void 0===n?void 0:n.volatile)?"__volatile__":t}),JSON.stringify(i)}kc(t,e,i,n){const s=this.Du(n);if(n!==Hx&&!s.dirty&&!Ce(s.fingerprint))return"skipped";let r,o=i;try{if(o=Kx(i),r=this.Hu(o,n),r===s.fingerprint)return s.dirty=!1,"skipped"}catch(t){r=void 0}return t.$t(e,o,this.Sc,this.xc,this.$c,this.Yr.debug)?(s.dirty=!1,n!==Hx&&(s.persisted=!0),Ce(r)||(s.fingerprint=r),this.pu&&(s.storageValue=Ua.Lt(e)),"written"):(this.Yr.debug&&Ur.warn(`failed to persist storage entry "${e}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.Yu(),Ce(this.ac)||(clearTimeout(this.ac),this.ac=void 0),this.nu.Dt(this.Mu,!1),this.nu.Dt(this.Mu,!0),!t&&this.Cu)for(const t of Lx)Ua.Dt(this.Pu(t));t?delete this.fu[Hx]:this.fu={},this.nc=void 0,this.sc=void 0,this.Qu=void 0}clear(){this.remove(),this.props={},this.Tu=void 0}register_once(t,e,i){if($e(t)){this.syncCookieProperties(),Ce(e)&&(e="None"),this.Sc=Ce(i)?this.Cc:i;let n=!1;if(Vr(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Wu(i,t),n=!0)}),n)return this.save(),!0}return!1}register(t,e){if($e(t)){this.syncCookieProperties(),this.Sc=Ce(e)?this.Cc:e;let i=!1;if(Vr(t,(e,n)=>{t.hasOwnProperty(n)&&(this.props[n]!==e||$e(e)||Se(e))&&(this.Wu(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.Vu(t),i=!0);i&&this.save()}update_campaign_params(){const t=null==n?void 0:n.URL;if(t===this.Tu)return;const e=qu(this.Yr.custom_campaign_params,this.Yr.mask_personal_data_properties,this.Yr.custom_personal_data_properties),i=!Te(Zr(e));return i&&this.register(e),this.Tu=t,i?e:void 0}update_search_keyword(){this.register(function(){const t=null==n?void 0:n.referrer;return t?zu(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:Vu(),$referring_domain:(null==n?void 0:n.referrer)&&(null===(t=io(n.referrer))||void 0===t?void 0:t.host)||Wu},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Gu(this.Yr.mask_personal_data_properties,this.Yr.custom_personal_data_properties,this.Yr.disable_capture_url_hashes);this.register_once({[At]:this.gu?{r:Ux(t.r),u:t.u?Ux(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Vr([Rt,It],e=>{const i=this.props[e];i&&Vr(i,function(e,i){t["$initial_"+ye(i)]=e})});const e=this.props[At];if(e){const i=function(t,e=!1,i,n){const s=Ju(t,e,i,n),r={};return Vr(s,function(t,e){r[`$initial_${ye(e)}`]=t}),r}(e,this.Yr.disable_capture_url_hashes,this.Yr.mask_personal_data_properties,this.Yr.custom_personal_data_properties);Gr(t,i)}return t}safe_merge(t){return Vr(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.Ai&&!l;l||this.rc(e,a),this.Yr=t,!l&&(n||s||o)&&(this.nc=void 0,this.sc=void 0,this.Qu=void 0,this.rc(ue(ue({},t),{},{cookie_persisted_properties:e.cookie_persisted_properties}),a));const u=r||o?this.Iu(t):this.nu;this.Tc();const c=this.Eu(t),h=r||c!==this.mu,d=!l&&(h||t.cross_subdomain_cookie!==this.xc||t.secure_cookie!==this.$c)&&this.oc(a);this.wu=h;try{if(this.Cc=this.Sc=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),h){const t=this.props;this.clear(),this.nu=u,this.mu=c,this.props=t,this.save()}else o&&(this.nu=u,l||(delete this.fu[Hx],this.uc()))}finally{this.wu=!1,d&&this.cc()}}Tc(){const t=this.props[At];if(!this.gu||!$e(t)||"string"!=typeof t.r)return;const e=Ux(t.r),i="string"==typeof t.u?Ux(t.u):t.u;e===t.r&&i===t.u||this.Wu(At,ue(ue({},t),{},{r:e,u:i}))}set_disabled(t){this.Ai=t,this.Ai?this.remove():this.save()}set_cross_subdomain(t){t!==this.xc&&(this.xc=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.$c&&(this.$c=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){const i=this.props.__timers||{};i[t]=e,this.Wu(V,i),this.save()}remove_event_timer(t){const e=this.props.__timers||{},i=e[t];return Ce(i)||(delete e[t],this.Wu(V,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Wu(t,e),this.save()}Wu(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.ku=!0),Jx(t)&&!Qx(s,e)&&this.xu.add(t),this.Xu(t,s,e),(null===(n=jx(t))||void 0===n?void 0:n.volatile)||this.Ku(t))}Vu(t,e=!0){delete this.props[t],e&&(Vx(t)&&this.Lu(t,!0),Jx(t)&&this.xu.add(t),this.Ku(t))}Ku(t){var e;const i=null===(e=jx(t))||void 0===e?void 0:e.storageGroup;i&&(this.Du(i).dirty=!0)}Du(t){return this.fu[t]||(this.fu[t]={})}};const t$={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"},e$={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"},i$=Hr("[RateLimiter]");var n$=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=>{i$.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void i$.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)}get isClientRateLimited(){return 1>this.Mc().tokens}clientRateLimitContext(t=!1){var e;const i=this.Mc(),n=1>i.tokens;if(n||t||(i.tokens=Math.max(0,i.tokens-1)),n&&!t){const t=(Ae(i.dropped)?i.dropped:0)+1;i.dropped=t,!this.lastEventRateLimited&&this.Ic(t)&&(i.dropped=0)}return this.lastEventRateLimited=n,null===(e=this.instance.persistence)||void 0===e||e.set_property("$capture_rate_limit",i),{isRateLimited:n,remainingTokens:i.tokens}}Mc(){var t;const{captureEventsBurstLimit:e,captureEventsPerSecond:i}=this,n=(new Date).getTime(),s=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_property(Mt),r=s?ue({},s):{tokens:e,last:n};return r.tokens+=Math.max(0,n-r.last)/1e3*i,r.last=Math.max(r.last,n),r.tokens>e&&(r.tokens=e),r}Ec(t){const e=this.instance.config.property_denylist;return!Se(e)||!e.includes(t)}Ac(){var t;if(this.Ec("$current_url")&&this.Ec("$pathname")&&(null==s?void 0:s.pathname))return`${null!==(t=s.origin)&&void 0!==t?t:""}${s.pathname}`}Ic(t){var e,i;const{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,r=this.Ac(),o=this.Ec("$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 s$=Hr("[RemoteConfig]");var r$=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=h._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Rc(t){const e=Ew(this._instance);e?e(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Pc(t){const e=this._instance.__pending_remote_config_callbacks;if(e)return void e.push(t);const i=[t];this._instance.__pending_remote_config_callbacks=i;try{this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),batchKey:"remote_config",fireCallbackOnDrop:!0,callback:t=>{this._instance.__pending_remote_config_callbacks=void 0,i.forEach(e=>e(t))}})}catch(t){throw this._instance.__pending_remote_config_callbacks=void 0,t}}load(){try{if(this.remoteConfig)return s$.info("Using preloaded remote config",this.remoteConfig),void this.Oc(this.remoteConfig);if(this._instance.Fc())return void s$.warn("Remote config is disabled. Falling back to local config.");if(!this._instance.config.opt_in_site_apps)return void this.Pc(t=>{this.Oc(t.json,t)});this.Rc(t=>{if(!t)return s$.info("No config found after loading remote JS config. Falling back to JSON."),void this.Pc(t=>{this.Oc(t.json,t)});this.Oc(t)})}catch(t){s$.error("Error loading remote config",t),this.Oc()}}Oc(t,e){!t&&e&&(0===e.statusCode?e.error||s$.warn("Failed to fetch remote config from PostHog."):s$.error("Failed to fetch remote config from PostHog."));try{this._instance.Oc(t?{ok:!0,config:t}:{ok:!1})}catch(t){s$.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){s$.error("Error loading feature flags",t)}}};let o$=!ew&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla"));function l$(t,e,i){var n,s,r,o;i&&(e=ue(ue({},e),{},{callback:t=>i(t)})),t.__loaded?o$?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null===(r=e.callback)||void 0===r||r.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,(Ce(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,null===(s=e.onDispatch)||void 0===s||s.call(e),((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&&Ce(r.compression)&&r.data&&(r.compression=R_.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=bw(r.url,r.method,r.compression,r.timestampMode);const l=_w.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 c=t=>{try{u(t)}catch(t){var e;fw(t)?Ur.warn(t):Ur.error(t),null===(e=r.callback)||void 0===e||e.call(r,{statusCode:0,error:t})}};"sendBeacon"!==o&&!r.preferSyncCompression&&r.data&&r.compression===R_.GZipJS&&a&&"undefined"!=typeof Promise&&!rw?hw(r).then(t=>{c(t)}).catch(e=>{if(ds(e))return rw=!0,void c(ue(ue({},r),{},{compression:void 0,url:bw(t.url,t.method,void 0,t.timestampMode)}));vs(e)&&(rw=!0),c(r)}):c(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===(o=e.callback)||void 0===o||o.call(e,{statusCode:0}))}var a$=class{constructor(t,e){this.Lc=!0,this.Dc=[],this.Nc=Qe((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,Ur.createLogger("flush interval"),3e3),this.jc=t}enqueue(t){this.Dc.push(t),this.qc||this.Bc()}unload(){this.zc();const t=this.Dc.length>0?this.Hc():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.Uc(ue(ue({},t),{},{callback:void 0}),"sendBeacon")})}enable(){this.Lc=!1,this.Bc()}Bc(){this.Lc||(this.qc=setTimeout(()=>{this.zc(),this.Wc()},this.Nc))}Wc(){if(this.Dc.length>0){const t=this.Hc();for(const e in t)this.Uc(t[e])}}Uc(t,e){try{this.jc(t,e)}catch(t){Ur.error(t)}}zc(){clearTimeout(this.qc),this.qc=void 0}Hc(){const t={},e={};Vr(this.Dc,i=>{var n;const s=i,r=((s?s.batchKey:null)||s.url)+(s.batchGroup?`:${s.batchGroup}`:"");Ce(t[r])&&(t[r]=ue(ue({},s),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),e[r]=[]),null===(n=t[r].data)||void 0===n||n.push(s.data),s.callback&&e[r].push(s.callback)});for(const i in e){const n=e[i];n.length&&(t[i].callback=t=>{for(const e of n)e(t)})}return this.Dc=[],t}};const u$=["retriesPerformedSoFar"];var c$=class{constructor(t){this._instance=t,this.Vc=!1,this.Gc=3e3,this.Dc=[],this.Dc=[],this.Jc=!0,this.resume()}resume(){if(!Ce(t)&&"onLine"in t.navigator){if(this.Jc=t.navigator.onLine,this.Qc)return;this.Qc=()=>{this.Jc=!0,this.Wc()},this.Zc=()=>{this.Jc=!1},to(t,"online",this.Qc),to(t,"offline",this.Zc)}}get length(){return this.Dc.length}retriableRequest(t,e){let{retriesPerformedSoFar:i}=t,n=ws(t,u$);Oe(i)&&(n.url=lw(n.url,{retry_count:i})),l$(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.js(ue({retriesPerformedSoFar:i},n),e);0===t.statusCode&&Ur.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)})}js(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.Dc.push({retryAt:s,requestOptions:t});let r=`Enqueued failed request for retry in ${n}`;navigator.onLine||(r+=" (Browser is offline)"),Ur.warn(r),this.Vc||(this.Vc=!0,this.Kc())}Kc(){if(this.Yc&&clearTimeout(this.Yc),0===this.Dc.length)return this.Vc=!1,void(this.Yc=void 0);this.Yc=setTimeout(()=>{this.Jc&&this.Dc.length>0&&this.Wc(),this.Kc()},this.Gc)}Wc(){const t=Date.now(),e=[],i=this.Dc.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.Dc=e,i.length>0)for(const{requestOptions:t}of i)this.retriableRequest(t)}unload(){this.Yc&&(clearTimeout(this.Yc),this.Yc=void 0),this.Vc=!1,Ce(t)||(this.Qc&&(t.removeEventListener("online",this.Qc),this.Qc=void 0),this.Zc&&(t.removeEventListener("offline",this.Zc),this.Zc=void 0));for(const{requestOptions:t}of this.Dc)try{this._instance._send_request(ue(ue({},t),{},{callback:Se(t.data)?void 0:t.callback,transport:"sendBeacon"}))}catch(t){Ur.error(t)}this.Dc=[]}},h$=class{constructor(t){this._instance=t,this.Xc=()=>{var t,e,i,n;this.eh||(this.eh={});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.eh.lastScrollY=Math.ceil(r),this.eh.maxScrollY=Math.max(r,null!==(t=this.eh.maxScrollY)&&void 0!==t?t:0),this.eh.maxScrollHeight=Math.max(o,null!==(e=this.eh.maxScrollHeight)&&void 0!==e?e:0),this.eh.lastContentY=l,this.eh.maxContentY=Math.max(l,null!==(i=this.eh.maxContentY)&&void 0!==i?i:0),this.eh.maxContentHeight=Math.max(a,null!==(n=this.eh.maxContentHeight)&&void 0!==n?n:0)}}get ih(){return this._instance.config.scroll_root_selector}getContext(){return this.eh}resetContext(){const t=this.eh;return this.eh=void 0,setTimeout(this.Xc,0),t}startMeasuringScrollPosition(){to(t,"scroll",this.Xc,{capture:!0}),to(t,"scrollend",this.Xc,{capture:!0}),to(t,"resize",this.Xc)}scrollElement(){if(this.ih){const i=Se(this.ih)?this.ih:[this.ih];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}nh(e){var i,n;const s="y"===e?"scrollTop":"scrollLeft";if(this.ih){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.nh("y")}scrollX(){return this.nh("x")}};const d$=t=>Gu(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 v$=class{constructor(t,e,i,n){this.Je=t=>{const e=this.sh();if(e&&e.sessionId===t)return;const i={sessionId:t,props:this.rh(this._instance)};this.oh.register({[Et]:i})},this._instance=t,this.ah=e,this.oh=i,this.rh=n||d$,this.ah.onSessionId(this.Je)}sh(){return this.oh.props[Et]}getSetOnceProps(){var t;const e=null===(t=this.sh())||void 0===t?void 0:t.props;return e?"r"in e?Ju(e,this._instance.config.disable_capture_url_hashes,this._instance.config.mask_personal_data_properties,this._instance.config.custom_personal_data_properties):{$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 Vr(Zr(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t[`$session_entry_${ye(i)}`]=e}),t}};const f$=Hr("[SessionId]"),p$=864e5;var g$=class{on(t,e){return this.uh.on(t,e)}constructor(t,e,i){var n;if(this.hh=null,this.dh=null,this.fh=[],this.ph=void 0,this.gh=!1,this.uh=new O_,this.mh=(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.Yr=t.config,this.oh=t.persistence,this.Ye=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.yh=void 0,this._sessionActivityTimestamp=null,this.bh=e||La,this._h=i||La;const s=this.Yr.persistence_name||this.Yr.token;if(this._sessionTimeoutMs=1e3*Qe(this.Yr.session_idle_timeout_seconds||1800,60,36e3,f$.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.wh(),this.kh="ph_"+s+"_window_id",this.Sh="ph_"+s+"_primary_window_exists",this.xh()){const t=nu.Pt(this.kh),e=nu.Pt(this.Sh);t&&!e?this.Ye=t:nu.Dt(this.kh),nu.$t(this.Sh,!0)}(null===(n=this.Yr.bootstrap)||void 0===n?void 0:n.sessionID)&&this.setBootstrapSessionId(this.Yr.bootstrap.sessionID),this.$h()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Ce(this.fh)&&(this.fh=[]),this.fh.push(t),this.Xt&&t(this.Xt,this.Ye),()=>{this.fh=this.fh.filter(e=>e!==t)}}xh(){return"memory"!==this.Yr.persistence&&!this.oh.Ai&&nu.Ot()}Ch(t){t!==this.Ye&&(this.Ye=t,this.xh()&&nu.$t(this.kh,t))}Th(){return this.Ye?this.Ye:this.xh()?nu.Pt(this.kh):null}Mh(t){const e=this.hh;return!Ie(e)&&!Ie(t)&&5e3>Math.abs(t-e)}Ih(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.Mh(e)||(this.hh=e,this.oh.register({[ut]:[e,t,i]}))}Eh(){var t;const e=null===(t=this.Yr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Oe(e)&&e>0}Ah(){this.Eh()?this.oh.refreshKey(ut):(this.oh.flush(),this.oh.load())}Rh(){var t;if(Ie(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.hh)return;this.Ah();const[,e,i]=this.Ph();e===this.Xt&&i===this._sessionStartTimestamp&&(this.hh=this._sessionActivityTimestamp,this.oh.register({[ut]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.oh.flush())}Oh(){const[t]=this.Ph(),e=Oe(t)?t:0,i=Oe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Fh(t){return this.Ah(),this.mh(t,this.Oh())}Ph(){const t=this.oh.props[ut];return Se(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.hh=null,this.yh=void 0,clearTimeout(this.Lh),this.Lh=void 0,this.Ih(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 f$.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void f$.error("Invalid sessionID in bootstrap",t)}})(t);return!Ce(i)&&(e?this.yh={sessionId:t,sessionStartTimestamp:i}:this.Ih(t,(new Date).getTime(),i),!0)}destroy(){this.gh=!0,this.Rh(),clearTimeout(this.Lh),this.Lh=void 0,this.ph&&t&&(t.removeEventListener(Xt,this.ph,{capture:!1}),this.ph=void 0),this.fh=[]}$h(){this.ph=()=>{this.Rh(),this.xh()&&nu.Dt(this.Sh)},to(t,Xt,this.ph,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,e=null,i=!1){if("always"===this.Yr.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.dh=n;else if(Ie(this.dh)||this.dh>n||n-this.dh>=1e3){var r,o;null===(r=(o=this.oh).syncCookieProperties)||void 0===r||r.call(o),this.dh=n}let[,l,a]=this.Ph();const u=!Ce(s)&&l!==s,c=this.Oh();let h=this.Th();const d=this.yh,v=!!d&&(d.sessionStartTimestamp>n+6e4||n-d.sessionStartTimestamp>p$),f=d?v:Oe(a)&&Math.abs(n-a)>p$;let p=!1,g=u,m=!l||!!d;const y=l;let b=!m&&!t&&this.mh(n,c);if(b&&(b=this.Fh(n),b||f$.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,a]=this.Ph(),b||(m=!l||!!d)),m||b||f){g=!1;const t=d&&!v;l=t?d.sessionId:this.bh(),h=this._h(),f$.info("new session ID assigned",{sessionId:l,windowId:h,bootstrapped:!!t,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:f}}),a=t?d.sessionStartTimestamp:n,this.yh=void 0,p=!0}else h||(h=this._h(),p=!0),g=g||l!==y,g&&(f$.info("adopted cross-tab session id",{sessionId:l,windowId:h}),p=!0);const _=Oe(c)&&t&&!f?c:n,w=Oe(a)?a:(new Date).getTime();this.Ch(h),this.Ih(l,_,w),t||this.wh();const k={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.fh.forEach(t=>t(l,h,k)),{sessionId:l,windowId:h,sessionStartTimestamp:w,changeReason:p?k:void 0,lastActivityTimestamp:c}}wh(){this.gh||(clearTimeout(this.Lh),this.Lh=setTimeout(()=>{if(!this.gh)if(this.Fh((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.uh.emit("forcedIdleReset",{idleSessionId:t})}else this.wh()},1.1*this.sessionTimeoutMs))}};const m$=Object.freeze(["2026-08-30","2026-08-29","2026-06-25","2026-05-30","2026-01-30","2025-11-30","2025-05-24"]),y$=function(t,e){if(!t)return!1;const i=t.userAgent;if(i&&Je(i,e))return!0;try{const i=null==t?void 0:t.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(t=>Je(null==t?void 0:t.brand,e)))return!0}catch(t){}return!!t.webdriver};function b$(){return b$=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 Ur.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}),b$.apply(this,arguments)}const _$="custom",w$="i.posthog.com",k$=/^\/static\//,S$=["/s/","/e/","/i/"];var x$=class{constructor(t){this.Dh={},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(`.${w$}`,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Dh[this.apiHost]||(this.Dh[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":_$),this.Dh[this.apiHost]}Nh(t){if(!k$.test(t))return;const e=this.instance.config.asset_host;return"string"==typeof e&&e.trim().replace(/\/$/,"")||void 0}jh(t){const e=io(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}qh(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=io(i))||void 0===r?void 0:r.href)||i;n=s(new URL(t)).toString()}if(s&&"api"===t&&S$.some(t=>0===e.indexOf(t))){const t=this.jh(n);if(t){const e=this.apiHost;let i=this.Bh;(null==i?void 0:i.apiHost)===e&&i.rewriteRequestPath===s||(i={apiHost:e,rewriteRequestPath:s,urls:new Set},this.Bh=i),i.urls.add(t)}}return n}isIngestionEndpoint(t){const e=this.Bh,i=this.jh(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.qh(t,e,this.uiHost+e);if("flags"===t)return this.qh(t,e,this.flagsApiHost+e);if("assets"===t){const i=this.Nh(e);if(i)return this.qh(t,e,`${i}${e}`)}if(this.region===_$)return this.qh(t,e,this.apiHost+e);const i=w$+e;switch(t){case"assets":return this.qh(t,e,`https://${this.region}-assets.${i}`);case"api":return this.qh(t,e,`https://${this.region}.${i}`)}}};const $$=Hr("[PostHog ExternalIntegrations]"),T$={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var C$=class{constructor(t){this._instance=t}lu(t,e){var i;null===(i=Ew(this._instance))||void 0===i||i(this._instance,t,t=>{if(t)return $$.error("failed to load script",t);e()})}startIfEnabledOrStop(){var t;for(const[s,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var e,i,n;r&&!(null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[s])&&this.lu(T$[s],()=>{var t;null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[s])||void 0===t||t.start(this._instance)}),!r&&(null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[s])&&(null===(n=h.__PosthogExtensions__)||void 0===n||null===(n=n.integrations)||void 0===n||null===(n=n[s])||void 0===n||n.stop())}}};const E$={};let M$=0;const I$=()=>{},R$='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',A$="Surveys module not available",O$="sanitize_properties is deprecated. Use before_send instead",P$="Invalid value for property_denylist config: ",F$=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],L$=["$feature_flag_called","$$heatmap","$snapshot"],D$=t=>"$"===t.charAt(0)&&!ge(L$,t),N$=/^[A-Za-z0-9_-]{1,400}$/,j$=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,q$=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,B$=["token","distinct_id",Ft],z$="posthog",U$=[...m$].sort()[m$.length-1],H$=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},W$=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:Xr(null==n?void 0:n.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:I$,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_replay_sync_fetch:!0,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&Ee(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null===(i=t.location)||void 0===i?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(t){Ur.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Yt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:I$},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Ao,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:H$(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))},V$=[["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"]],G$=t=>{const e={};for(const[i,n]of V$)Ce(t[i])||(e[n]=t[i]);const i=Gr({},e,t),n=t.__preview_external_dependency_versioned_paths;return Ce(n)||(Ce(t.strict_script_versioning)&&(i.strict_script_versioning=!!n),Ee(n)&&Ce(t.asset_host)&&(i.asset_host=n)),Se(t.property_blacklist)&&(Ce(t.property_denylist)?i.property_denylist=t.property_blacklist:Se(t.property_denylist)?i.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ur.error(P$+t.property_denylist)),i};var J$=class{constructor(){this.__forceAllowLocalhost=!1}get zh(){return this.__forceAllowLocalhost}set zh(t){Ur.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Q$=class e{Hh(t){if(!t)return;const e=this.Uh.indexOf(t);-1!==e&&this.Uh.splice(e,1)}Wh(t,e){var i;return this.Hh(t),this.Uh.push(e),null===(i=e.initialize)||void 0===i||i.call(e),e}Vh(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}Gh(){if(this.Jh)return;if(!this.Qh||!("capture_pageview"in this.Qh))return;if(ue(ue({},e.__defaultExtensionClasses),this.config.__extensionClasses).historyAutocapture)return;const t=this.config.capture_pageview;("history_change"===t||$e(t)&&(t.path||t.search||t.hash&&!this.config.disable_capture_url_hashes))&&(this.Jh=!0,Ur.warn("capture_pageview is set to capture history changes, but the history autocapture extension is not loaded, so only the first pageview of each page load is captured. With the slim bundle, pass __extensionClasses: { historyAutocapture: AnalyticsExtensions.historyAutocapture } from 'posthog-js/dist/extension-bundles', or set capture_pageview: true to capture page loads only."))}Zh(){if(this.Kh)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.Vh())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.Yh)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.Kh=!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}`)}Xh(){const t=this.persistence;if(!t||this.ed)return;if(this.Vh())return void("on_reject"===this.config.cookieless_mode&&"$posthog_cookieless"!==this.get_distinct_id()&&(this.nd(),this.sd()));if("$posthog_cookieless"!==this.get_distinct_id())return;this.rd()||t.load(!0);const e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){const e=this.config.get_device_id(La());this.register({distinct_id:e,$device_id:e}),t.set_property(Ct,Zt)}this.nd()}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.od=!1,this.ld=!1,this.ad=!1,this.webPerformance=new J$,this.ud=!1,this.version=su.LIB_VERSION,this.__loadExternalDependency=Cw,this.hd=new Set,this.dd="",this.Tr=new O_,this.Uh=[],this.vd=[],this.fd=!1,this.Yh=!1,this.Kh=!1,this.Jh=!1,this.ed=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=W$(),this.SentryIntegration=Px,this.sentryIntegration=t=>function(t,e){const i=Ox(t,e);return{name:Ax,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.pd=!1,this.gd=null,this.md=null,this.yd=null,this.scrollManager=new h$(this),this.pageViewManager=new Fx(this),this.rateLimiter=new n$(this),this.requestRouter=new x$(this),this.consent=new $x(this),this.externalIntegrations=new C$(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=>Ur.info(`send "${null==t?void 0:t.event}"`,t))}init(t,i,n){if(n&&n!==z$){var s;const r=null!==(s=E$[n])&&void 0!==s?s:new e;return r._init(t,i,n),E$[n]=r,E$[z$][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 Ur.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=W$(i.defaults),i.debug=this.bd(i.debug),this.Qh=i,this._d=[],i.person_profiles?this.md=i.person_profiles:i.process_person&&(this.md=i.process_person);const u=W$(i.defaults),c=G$(i),h=Gr({},u,c,{name:n,token:l});$e(u.rageclick)&&$e(c.rageclick)&&(h.rageclick=Gr({},u.rageclick,c.rageclick)),$e(u.session_recording)&&$e(c.session_recording)&&(h.session_recording=Gr({},u.session_recording,c.session_recording)),this.set_config(h),this.config.on_xhr_error&&Ur.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:R_.GZipJS;const d=this.rd(),v=!this.Vh();if(this.persistence=new Xx(this.config,d,!0,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Xx(ue(ue({},this.config),{},{persistence:"sessionStorage"}),d,!1,v),this.dd="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&nu.Ot()){const t=nu.Pt(this.dd);Se(t)&&t.forEach(t=>{Ee(t)&&this.hd.add(t)})}else nu.Dt(this.dd);const f=ue({},this.persistence.props),p=ue({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.wd=new a$((t,e)=>this.kd(t,e),this.config.request_queue_config),this.Sd=new c$(this),this.__request_queue=[];const g=this.Vh();g||(this.sessionManager=new g$(this),this.sessionPropsManager=new v$(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.xd()})),this.$d(),this.config.__preview_deferred_init_extensions?(Ur.info("Deferring extension initialization to improve startup performance"),this.Cd=setTimeout(()=>{this.Cd=void 0,this.Td(g)},0)):(Ur.info("Initializing extensions synchronously"),this.Td(g)),su.DEBUG=su.DEBUG||this.config.debug,su.DEBUG&&Ur.info("Starting in debug mode",{this:this,config:i,thisC:ue({},this.config),p:f,s:p}),this.config.identity_distinct_id&&!(null===(s=i.bootstrap)||void 0===s?void 0:s.distinctID)&&(i.bootstrap=ue(ue({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const m=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this.Yh=!!m&&!Me(m),null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID){const t=i.bootstrap.distinctID,e=this.get_distinct_id(),n=this.persistence.get_property(Ct);if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"anonymous"===n)this.identify(t);else if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"identified"===n)Ur.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(La()),n=i.bootstrap.isIdentifiedID?e:t;this.persistence.set_property(Ct,i.bootstrap.isIdentifiedID?Kt:Zt),this.register({distinct_id:t,$device_id:n})}}if(g)this.register_once({distinct_id:Pt,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(La());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(Ct,Zt)}return to(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),to(t,"pageshow",t=>{if(this.ld=!1,!this.ad){var e;if(t.persisted&&this.persistence){const t=this.persistence.get_property(D),e=this.persistence.get_property(Ct);this.persistence.load(),this.Md()||t===this.persistence.get_property("distinct_id")&&e===this.persistence.get_property("$user_state")||this.Id()}null===(e=this.Sd)||void 0===e||e.resume()}}),i.segment?Rx(this,()=>this.Ed()):this.Ed(),xe(this.config._onCapture)&&this.config._onCapture!==I$&&(Ur.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Ur.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 b$.apply(this,arguments)}().then(t=>{t&&this.register({[j]:t})}).catch(I$),this}Ad(t){const e=t;return Ee(e.name)&&xe(e.setup)}Rd(t,e){var i=this;this.Ad(t)?e.push(re(function*(){try{yield t.setup(i.Pd())}catch(i){Ur.error(`Failed to set up extension "${t.name}"`,i);try{var e;yield null===(e=t.dispose)||void 0===e?void 0:e.call(t)}catch(e){Ur.error(`Failed to dispose extension "${t.name}"`,e)}}})):this.Uh.push(t)}$d(){var t,i,n,s=this;const r=null!==(t=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:null===(n=e.__defaultExtensionClasses)||void 0===n?void 0:n.featureFlags;var o,l,a;if(r)if(this.featureFlags&&this.featureFlags instanceof r||(null===(o=this.Od)||void 0===o||o.call(this),this.Od=void 0,this.featureFlags=new r(this)),xe(this.featureFlags.onReloading)&&xe(this.featureFlags.setup)){if(!this.Od){this.Od=this.featureFlags.onReloading(()=>{this.Tr.emit("featureFlagsReloading",!0)});const t=this.featureFlags;re(function*(){try{yield t.setup(s.Pd())}catch(e){Ur.error("Failed to set up feature flags",e);const i=s.Od;s.Od=void 0;try{null==i||i()}catch(t){Ur.error("Failed to unsubscribe feature flag reloading",t)}try{yield t.dispose()}catch(t){Ur.error("Failed to dispose feature flags",t)}}})()}}else null===(l=(a=this.featureFlags).initialize)||void 0===l||l.call(a)}Td(t){const i=performance.now(),n=ue(ue({},e.__defaultExtensionClasses),this.config.__extensionClasses),s=[];var r,o,l,a,u,c,h,d;n.exceptions&&this.Uh.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new n.exceptions(this)),n.historyAutocapture&&this.Uh.push(this.historyAutocapture=new n.historyAutocapture(this)),this.Gh(),n.tracingHeaders&&this.Uh.push(this.tracingHeaders=new n.tracingHeaders(this)),n.siteApps&&this.Uh.push(this.siteApps=new n.siteApps(this)),n.sessionRecording&&!t&&this.Uh.push(this.sessionRecording=new n.sessionRecording(this)),n.autocapture&&this.Rd(this.autocapture=new n.autocapture(this),s),n.surveys&&this.Rd(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new n.surveys(this),s),n.logs&&this.Rd(this.logs=null!==(l=this.logs)&&void 0!==l?l:new n.logs(this),s),n.metrics&&this.Uh.push(this.metrics=null!==(a=this.metrics)&&void 0!==a?a:new n.metrics(this)),n.conversations&&this.Uh.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new n.conversations(this)),n.productTours&&this.Uh.push(this.productTours=new n.productTours(this)),n.heatmaps&&this.Uh.push(this.heatmaps=new n.heatmaps(this)),n.webVitalsAutocapture&&this.Uh.push(this.webVitalsAutocapture=new n.webVitalsAutocapture(this)),n.exceptionObserver&&this.Uh.push(this.exceptionObserver=new n.exceptionObserver(this)),n.deadClicksAutocapture&&this.Uh.push(this.deadClicksAutocapture=new n.deadClicksAutocapture(this,Ex)),n.toolbar&&this.Uh.push(this.toolbar=null!==(c=this.toolbar)&&void 0!==c?c:new n.toolbar(this)),n.experiments&&this.Uh.push(this.experiments=null!==(h=this.experiments)&&void 0!==h?h:new n.experiments(this)),n.webMCP&&this.Uh.push(this.webMCP=null!==(d=this.webMCP)&&void 0!==d?d:new n.webMCP(this));const v=this.Uh.length>0||s.length>0;this.config.disable_scroll_properties||s.unshift(()=>{this.scrollManager.startMeasuringScrollPosition()}),this.Uh.forEach(t=>{t.initialize&&s.push(()=>{var e;null===(e=t.initialize)||void 0===e||e.call(t)})}),s.push(()=>{if(this.Fd){const t=this.Fd;this.Fd=void 0,this.Uh.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}}),this.Ld(s,i,v)}Ld(t,e,i){for(var n,s;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void(this.Cd=setTimeout(()=>{this.Cd=void 0,this.Ld(t,e,i)},0));const n=t.shift();if(n)try{n()}catch(t){Ur.error("Error initializing extension:",t)}}const r=Math.round(performance.now()-e);i&&r>0?this.register_for_session({[Lt]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Dt]:r}):Ce(null===(n=this.sessionPersistence)||void 0===n?void 0:n.props.$sdk_debug_extensions_init_method)&&Ce(null===(s=this.sessionPersistence)||void 0===s?void 0:s.props.$sdk_debug_extensions_init_time_ms)||(this.unregister_for_session(Lt),this.unregister_for_session(Dt)),this.config.__preview_deferred_init_extensions&&Ur.info(`PostHog extensions initialized (${r}ms)`)}Oc(t){if(!n||!n.body)return Ur.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Oc(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Fd=t),this.Ir=t,this.compression=void 0,t.ok){var e;const i=t.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=ge(i.supportedCompression,R_.GZipJS)?R_.GZipJS:ge(i.supportedCompression,R_.Base64)?R_.Base64:void 0),(null===(e=i.analytics)||void 0===e?void 0:e.endpoint)&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.md?this.md:Yt}),this.Tr.emit("extensionsRemoteConfig",t),this.Uh.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}Ed(){try{this.config.loaded(this)}catch(t){Ur.critical("`loaded` function failed",t)}if(this.Dd(),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.Vh())&&this.Nd()},1),this.jd=new r$(this),this.jd.load()}Dd(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.wd)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Wr(this.__request_queue,t=>this.kd(t)),this.__request_queue=[],this.Dd()}_handle_unload(){var t,e,i,n,s,r;this.ld=!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.qd()&&this.capture(ee),null===(n=this.logs)||void 0===n||n.flushLogs("sendBeacon"),null===(s=this.wd)||void 0===s||s.unload(),null===(r=this.Sd)||void 0===r||r.unload()):this.qd()&&this.capture(ee,null,{transport:"sendBeacon"})}_send_request(t){l$(this,t)}kd(t,e){this.Sd?this.Sd.retriableRequest(t,e):this._send_request(e?ue(ue({},t),{},{transport:e}):t)}_execute_array(t){M$++;try{let e;const i=[],n=[],s=[];Wr(t,t=>{if(t)if(e=t[0],Se(e))s.push(t);else if(xe(t))try{t.call(this)}catch(e){Ur.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){Wr(t,function(t){try{if(Se(t[0])){let i=e;Vr(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){Ur.error("Error executing queued PostHog call",t,e)}})};r(i,this),r(n,this),r(s,this)}finally{M$--}}push(t){if(M$>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 Bd(){return{property:z,persistenceKey:U,cookieName:"_fbc",pattern:j$,register:(t,e)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[U]:{value:t,delivered:e}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(U)}}}get zd(){return{property:H,persistenceKey:W,cookieName:"_fbp",pattern:q$,register:(t,e)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[W]:{value:t,delivered:e}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(W)}}}Hd(t){var e;const i=null===(e=this.persistence)||void 0===e?void 0:e.get_property(t.persistenceKey);return Ee(i)&&t.pattern.test(i)?{value:i,delivered:!1}:$e(i)&&Ee(i.value)&&t.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}Ud(t,e,i){return e===(null==i?void 0:i.value)?{value:e,pending:!i.delivered}:(t.register(e,!1),{value:e,pending:!0})}Wd(t){if(!this.config.save_campaign_params||this.Vh())return;const e=Ma(t.cookieName);return Ee(e)&&t.pattern.test(e)?e:void 0}Vd(t,e,i,n){if(!this.persistence)return;const s=this.Bd,r=this.Hd(s);if(n)return void s.unregister();if(i)return Ee(e)&&j$.test(e)?this.Ud(s,e,r):void s.unregister();const o=Ee(t)&&N$.test(t)?t:void 0,l=this.Wd(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.Ud(s,l,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this.Ud(s,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}Gd(t,e,i){if(!this.persistence)return;const n=this.zd,s=this.Hd(n);if(i)return void n.unregister();if(e)return Ee(t)&&q$.test(t)?this.Ud(n,t,s):void n.unregister();const r=this.Wd(n);return r?this.Ud(n,r,s):s?{value:s.value,pending:!s.delivered}:void 0}Jd(t){if(!this.persistence)return;const e=({channel:t,value:e})=>{const i=this.Hd(t);return(null==i?void 0:i.value)===e&&!i.delivered},i=t.filter(e);i.length&&(this.persistence.refreshMetaIdentifiers(),i.filter(e).forEach(({channel:t,value:e})=>t.register(e,!0)))}capture(t,e,i){var n,s,r,o,l;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.wd))return void Ur.uninitializedWarning("posthog.capture");if(!this.is_capturing())return void Ur.info(`Event "${t}" was not captured because capturing is disabled (opted out or consent pending).`);if(Ce(t)||!Ee(t))return void Ur.error("No event name provided to posthog.capture");if(this.Xh(),"$snapshot"===t&&this.Vh())return;const a=!this.config.opt_out_useragent_filter&&this._is_bot();if(a&&!this.config.__preview_capture_bot_pageviews)return this.od||(this.od=!0,console.warn("[PostHog.js] Events are being dropped because the user agent looks like a bot. Set `opt_out_useragent_filter: true` to capture them, e.g. in end-to-end tests. Note that logs from `captureLog` are not subject to this filter.")),void Ur.info(`Event "${t}" was not captured because the user agent looks like a bot. Set \`opt_out_useragent_filter: true\` to capture it.`);const u=(null==i?void 0:i.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==u?void 0:u.isRateLimited)return void Ur.critical("This capture call is ignored due to client rate limiting.");let c;(null==e?void 0:e.$current_url)&&!Ee(null==e?void 0:e.$current_url)&&(Ur.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.Qd)||Ur.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.persistence.syncCookieProperties(),this.Md(),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(c=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const h=new Date,d=(null==i?void 0:i.timestamp)||h,v=ln(null==i?void 0:i.uuid,La);let f={uuid:v,event:t,properties:this.Zd(t,e||{},d,v,!1,!0)};const p=null===(n=this.featureFlags)||void 0===n||null===(s=n.flagEventCapture)||void 0===s?void 0:s.call(n,e);var g;if(p&&(Vr(p.omit,t=>{delete f.properties[t]}),!1===(null===(g=p.resolved)||void 0===g?void 0:g.call(p,f.properties))))return;"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&a&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),u&&(f.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens);const m="$feature_flag_called"===t&&!1===f.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!m&&(f.$set=null==i?void 0:i.$set);const y=$e(null==e?void 0:e.$set)?e.$set:void 0,b=Se(null==e?void 0:e.$unset)?e.$unset:[],_=(null==i?void 0:i.$unset)||[],w=t=>{var e;const n=!!(null==i?void 0:i.$set)&&t in i.$set;return{hasProvided:n||!!y&&t in y,provided:n?null==i||null===(e=i.$set)||void 0===e?void 0:e[t]:null==y?void 0:y[t],unset:-1!==b.indexOf(t)||-1!==_.indexOf(t)}};this.persistence.refreshMetaIdentifiersBeforeCapture();const k=w(z),S=w(H),x=[{channel:this.Bd,hasProvided:k.hasProvided,update:this.Vd(null==c?void 0:c.fbclid,k.provided,k.hasProvided,k.unset)},{channel:this.zd,hasProvided:S.hasProvided,update:this.Gd(S.provided,S.hasProvided,S.unset)}];for(const{channel:t,hasProvided:e,update:i}of x)i&&!0===f.properties.$process_person_profile&&i.pending&&!e&&!m&&(f.$set=ue({[t.property]:i.value},f.$set));const T=null==i?void 0:i.$unset;T&&(f.$unset=T);const C=m?void 0:this.Kd(null==i?void 0:i.$set_once,t!==ne,t===ie);if(C&&(f.$set_once=C),(null==i?void 0:i._noTruncate)||(E=this.config.properties_string_max_length,f=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=[],Wr(n,e=>{r.push(t(e))});else{const e={};Vr(qe(n)?Kr(n):n,(n,s)=>{i.has(n)||(e[s]=t(n,s))}),r=e}return r}(t)}(f,t=>Ee(t)?t.slice(0,E):t)),f.timestamp=d,Ce(null==i?void 0:i.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=h),m&&(f.properties=((t,e=[])=>{const i={},n=e=>{void 0!==t[e]&&(i[e]=t[e])};return as.forEach(n),e.forEach(n),i})(f.properties,p?B$.concat(p.keep):B$)),t===Tm.DISMISSED||t===Tm.SENT){const i=null==e?void 0:e[Cm.SURVEY_ID],n=null==e?void 0:e[Cm.SURVEY_ITERATION];Fm({id:i,current_iteration:n}),f.$set=ue(ue({},f.$set),{},{[hu({id:i,current_iteration:n},t===Tm.SENT?"responded":"dismissed")]:!0})}else t===Tm.SHOWN&&(f.$set=ue(ue({},f.$set),{},{[Cm.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var E;if(t===t$.SHOWN){const t=null==e?void 0:e[e$.TOUR_TYPE];t&&(f.$set=ue(ue({},f.$set),{},{[`${e$.TOUR_LAST_SEEN_DATE}/${t}`]:(new Date).toISOString()}))}const M=ue(ue({},f.properties.$set),f.$set);if(Te(M)||this.setPersonPropertiesForFlags(M),!Re(this.config.before_send)){const t=this.Ds(f,null==p?void 0:p.failed);if(!t)return;f=t,f.uuid=ln(f.uuid,La)}this.sessionRecording&&!this.sessionRecording.isReplayOff&&!this.fd&&D$(t)&&(this.fd=!0,setTimeout(()=>this.fd=!1,3e4));const I=[];x.forEach(({channel:t,update:e})=>{var i,n,s;const r=null!==(i=null===(n=f.$set)||void 0===n?void 0:n[t.property])&&void 0!==i?i:$e(null===(s=f.properties)||void 0===s?void 0:s.$set)?f.properties.$set[t.property]:void 0;(null==e?void 0:e.pending)&&r===e.value&&I.push({channel:t,value:e.value})}),this.Tr.emit("eventCaptured",f);const R=null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),A="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(R),O=ue(ue(ue({method:"POST",url:R,data:f,compression:"best-available",preferSyncCompression:null==i?void 0:i.send_instantly,timestampMode:A?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},A&&(null===(o=f.properties)||void 0===o?void 0:o.$session_id)?{batchGroup:f.properties.$session_id+(f.properties.$window_id?`-${f.properties.$window_id}`:"")}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),I.length?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.Jd(I)}}:{});if(!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)){var P;let t;!O.transport&&!O.callback&&Te(null!==(P=this.config.request_headers)&&void 0!==P?P:{})&&this.ld&&(t="sendBeacon"),this.kd(O,t)}else this.wd.enqueue(O);return null===(l=this.featureFlags)||void 0===l||l.sendFlagCallsPendingCapture(),f}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null===(e=this.Yd)||void 0===e?void 0:e.getExtension(t)}Pd(){var t;return null!==(t=this.Yd)&&void 0!==t?t:this.Yd=new Tw(this)}Rr(t){this.vd.push(t);let e=!0;return()=>{if(!e)return;e=!1;const i=this.vd.indexOf(t);-1!==i&&this.vd.splice(i,1)}}Md(t=!0){var e;return!!(null===(e=this.persistence)||void 0===e?void 0:e.consumeCookieIdentityChange())&&(this.Id(t),!0)}Id(t=!0){var e,i,n;this.yd=null,"anonymous"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property("$user_state"))&&(null===(n=this.sessionPersistence)||void 0===n||n.clear(),this.hd.clear(),this.Xd()),null===(i=this.featureFlags)||void 0===i||i.reset(),t&&this.reloadFeatureFlags()}calculateEventProperties(t,e,i,n,s){return this.Zd(t,e,i,n,s,!1)}Zd(e,i,r,o,l,a=!1){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.Xh(),a||(this.persistence.syncCookieProperties(),this.Md());const c=l?void 0:this.persistence.remove_event_timer(e);let h=ue({},i);if(h.token=this.config.token,h.$config_defaults="latest"===this.config.defaults?U$:this.config.defaults,this.Vh()&&(h[Ft]=!0),"$snapshot"===e){const t=ue(ue({},this.persistence.properties()),this.sessionPersistence.properties());return h.distinct_id=t.distinct_id,(!Ee(h.distinct_id)&&!Ae(h.distinct_id)||Me(h.distinct_id))&&Ur.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}const d=function(e,i,n,r=!1){var o,l,a,c;if(!u)return{};const h=e?[...Lu,...i||[]]:[],[d,v]=Ji(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={};Ce(n)||(m.detectGoogleSearchApp=n);const y={},b=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,_=null===(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===(c=t.screen)||void 0===c?void 0:c.height,S=null==t?void 0:t.devicePixelRatio;Ce(b)||(y.userAgentDataPlatform=b),Ce(_)||(y.maxTouchPoints=_),Ce(w)||(y.screenWidth=w),Ce(k)||(y.screenHeight=k),Ce(S)||(y.devicePixelRatio=S);const x=Gr(Zr({$os:d,$os_version:v,$browser:Hi(u,navigator.vendor,g,m),$webview_app:f,$webview_app_version:p,$device:Qi(u),$device_type:Zi(u,y),$timezone:Au(),$timezone_offset:Qu()}),{$current_url:co(r?un(null==s?void 0:s.href):null==s?void 0:s.href,h,Nu),$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:Uu(),$browser_language_prefix:Hu(),$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:Br.LIB_NAME,$lib_version:Br.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Br.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=Br.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}let v,f;this.sessionPropsManager&&Gr(h,this.sessionPropsManager.getSessionProps());try{var p;if(this.sessionRecording){const t=this.sessionRecording.sdkDebugProperties,i=!this.fd&&D$(e);for(const e in t)(i||ge(F$,e))&&(h[e]=t[e])}v=null===(p=this.Sd)||void 0===p?void 0:p.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===_$&&(h.$lib_custom_api_host=this.config.api_host),f="$pageview"!==e||l?"$pageleave"!==e||l?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),h=Gr(h,f),"$pageview"===e&&n&&(h.title=n.title),!Ce(c)){const t=r.getTime()-c;h.$duration=parseFloat((t/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");const g=this.persistence.properties(),m=this.sessionPersistence.properties(),y=h.$groups,b=g.$groups;$e(y)&&!Te(y)&&(h.$groups=ue(ue({},$e(b)?b:{}),y)),Vr(["$referrer","$referring_domain"],t=>{t in g&&delete m[t]});const _={};if(this.vd.length>0)for(const t of this.vd.slice())try{Gr(_,t())}catch(t){Ur.error("Failed to produce browser extension event properties",t)}h=Gr({},d,g,m,ue(ue({},_),h)),v?h.$sdk_debug_retry_queue_size=v:delete h.$sdk_debug_retry_queue_size,h.$is_identified=this._isIdentified(),Se(this.config.property_denylist)?Vr(this.config.property_denylist,function(t){delete h[t]}):Ur.error(P$+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const w=this.config.sanitize_properties;w&&(Ur.error(O$),h=w(h,e));const k=this.tv();return h.$process_person_profile=k,k&&!l&&this.ev("_calculate_event_properties"),h}Kd(t,e=!0,i=!1){var n;if(!this.persistence||!this.tv())return t;if(this.ud&&!i)return t;const s=this.persistence.get_initial_props(),r=null===(n=this.sessionPropsManager)||void 0===n?void 0:n.getSetOnceProps();let o=Gr({},s,r||{},t||{});const l=this.config.sanitize_properties;return l&&(Ur.error(O$),o=l(o,"$set_once")),e&&(this.ud=!0),Te(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.Md(),null===(i=this.sessionPersistence)||void 0===i||i.register(t),Object.keys(t).forEach(t=>this.hd.add(t)),this.Xd()}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.hd.delete(t),this.Xd()}iv(t,e){this.register({[t]:e})}xd(){this.hd.forEach(t=>{var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t)}),this.hd.clear(),this.Xd()}Xd(){var t;if(!this.dd)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.Ai)||!nu.Ot())return void nu.Dt(this.dd);const e=[];this.hd.forEach(t=>e.push(t)),e.length>0?nu.$t(this.dd,e):nu.Dt(this.dd)}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.Tr.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:A$}),()=>{})}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:A$})}getActiveMatchingSurveys(t,e=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:A$})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:A$}),()=>{})}renderSurvey(t,e){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(t,e)}displaySurvey(t,e=Dm){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:A$}}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:A$})}nv(t){return!t||Me(t)?(Ur.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Ur.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())||(Ur.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 Ur.uninitializedWarning("posthog.identify");if(Ae(t)&&(t=t.toString(),Ur.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.nv(t))return;if(!this.ev("posthog.identify"))return;this.Xh();const n=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,r=this.Md(!1),o=this.persistence.oc();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(q),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Zt,u=t!==n,c=!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(Ct,Kt),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.lc(),this.capture("$identify",s,{$set:e||{},$set_once:i||{}})&&(this.yd=xu(t,e,i)),null===(a=this.featureFlags)||void 0===a||a.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:n)}else if(c){this.persistence.set_property(Ct,Kt);const n=e||{},s=i||{};this.setPersonPropertiesForFlags({$set:n,$set_once:s},!1),this.config.cookieWinsOnConflict&&this.persistence.lc(),this.capture("$set",{$set:n,$set_once:s})&&(this.yd=xu(t,e,i))}else(e||i)&&this.setPersonProperties(e,i);u||s||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(k)):c&&(e||i)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.cc(l)}}setPersonProperties(t,e){if(!t&&!e)return;if(!this.ev("posthog.setPersonProperties"))return;const i=xu(this.get_distinct_id(),t,e);this.yd!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}})&&(this.yd=i)):Ur.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.ev("posthog.unsetPersonProperties")&&(null===(e=this.featureFlags)||void 0===e||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.yd=null)}group(t,e,i){var n;if(!t||!e)return void Ur.error("posthog.group requires a group type and group key");null===(n=this.persistence)||void 0===n||n.syncCookieProperties(),this.Md();const s=this.getGroups(),r=s[t]!==e;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ue(ue({},s),{},{[t]:e})}),(r||i)&&this.tv()){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.ev("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=Pe(t)?t:null==t?void 0:t.resetDeviceID,i=Pe(t)||null==t?void 0:t.bootstrap;this.sv(e,!1,i)}sv(t,e=!1,i){var n,s,r,o,l,a;if(Ur.info("reset"),!this.__loaded)return Ur.uninitializedWarning("posthog.reset");const u=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(n=this.Qh)||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.Fc());const c=this.get_property(N),h=this.get_property(j),d=this.get_property(it);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();e||this.consent.reset(),e||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const f=null===(l=this.persistence)||void 0===l||null===(a=l.oc)||void 0===a?void 0:a.call(l),p=this.ed;this.ed=p||e;let g=!1;try{var m,y,b,_,w,k,S,x,T,C,E,M,I;if(null===(m=this.persistence)||void 0===m||m.clear(),null===(y=this.sessionPersistence)||void 0===y||y.clear(),this.hd.clear(),this.Xd(),Ce(d)||null===(C=this.persistence)||void 0===C||C.register({$session_recording_remote_config:d}),null===(b=this.surveys)||void 0===b||b.reset(),null===(_=this.featureFlags)||void 0===_||_.reset(),null===(w=this.conversations)||void 0===w||w.reset(),null===(k=this.logs)||void 0===k||k.reset(),null===(S=this.metrics)||void 0===S||S.reset(),null===(x=this.persistence)||void 0===x||x.set_property("$user_state","anonymous"),null===(T=this.sessionManager)||void 0===T||T.resetSessionId(),this.yd=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Pt,$device_id:null},"");else{const e=this.config.get_device_id(La());this.register_once({distinct_id:e,$device_id:t?e:c},""),t||Ce(h)||this.register({[j]:h})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(i.distinctID&&!this.Vh()&&(null===(I=this.persistence)||void 0===I||I.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(E=this.featureFlags)||void 0===E||E.initialize(),!Re(u)&&!(null===(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,g=!0}finally{var R,A;this.ed=p,f&&(null===(R=this.persistence)||void 0===R||null===(A=R.cc)||void 0===A||A.call(R,g))}var O;this.Ir&&(null===(O=this.conversations)||void 0===O||O.onRemoteConfig(this.Ir)),this.reloadFeatureFlags()}shutdown(t){var e=this;return re(function*(){if(!e.__loaded)return void Ur.uninitializedWarning("posthog.shutdown");e.ad=!0,clearTimeout(e.Cd),e.Cd=void 0;const t=e.Od;e.Od=void 0;for(const i of[()=>{var t;return null===(t=e.sessionRecording)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=e.logs)||void 0===t?void 0:t.flushLogs("sendBeacon")},()=>{var t;return null===(t=e.metrics)||void 0===t?void 0:t.flush("sendBeacon")},()=>{var t;return null===(t=e.metrics)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=e.logs)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=e.surveys)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=e.autocapture)||void 0===t?void 0:t.dispose()},()=>null==t?void 0:t(),()=>{var t;return null===(t=e.wd)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=e.Sd)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=e.featureFlags)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=e.persistence)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=e.sessionPersistence)||void 0===t?void 0:t.destroy()}])try{const t=i();t&&xe(t.then)&&t.then(void 0,t=>{Ur.error("Error during shutdown",t)})}catch(t){Ur.error("Error during shutdown",t)}})()}setIdentity(t,e){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null===(i=this.conversations)||void 0===i||i.rv()}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.ov()}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")?(Ur.critical("Attempting to create alias for existing People user - aborting."),-2):this.ev("posthog.alias")?(Ce(e)&&(e=this.get_distinct_id()),t!==e?(this.iv(q,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Ur.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const e=ue({},this.config);if($e(t)){var i,n,s,r,o,l,a,u,c,h,d,v,f,p;Gr(this.config,G$(t));const _=this.rd();if(this.persistence){const t="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;var g,m;if(t&&this.sessionPersistence!==this.persistence&&(null===(g=this.sessionPersistence)||void 0===g||g.remove(),null===(m=this.sessionPersistence)||void 0===m||m.destroy()),this.persistence.update_config(this.config,e,_),t)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new Xx(ue(ue({},this.config),{},{persistence:"sessionStorage"}),_,!1);else{var y;null===(y=this.sessionPersistence)||void 0===y||y.update_config(ue(ue({},this.config),{},{persistence:"sessionStorage"}),ue(ue({},e),{},{persistence:"sessionStorage"}),_)}}const w=this.bd(this.config.debug);var b;Pe(w)&&(this.config.debug=w),Pe(this.config.debug)&&(this.config.debug?(su.DEBUG=!0,Ua.Ot()&&Ua.$t("ph_debug",!0),Ur.info("set_config",{config:t,oldConfig:e,newConfig:ue({},this.config)})):(su.DEBUG=!1,Ua.Ot()&&Ua.Dt("ph_debug"))),null===(i=this.featureFlags)||void 0===i||null===(n=i.updateConfig)||void 0===n||n.call(i,this.config,this.Fc()),null===(s=this.exceptionObserver)||void 0===s||s.onConfigChange(),null===(r=this.exceptions)||void 0===r||r.onConfigChange(),null===(o=this.metrics)||void 0===o||o.onConfigChange(),null===(l=this.webMCP)||void 0===l||l.startIfEnabled(),null===(a=this.sessionRecording)||void 0===a||a.startIfEnabledOrStop(),null===(u=this.tracingHeaders)||void 0===u||u.startIfEnabledOrStop(),null===(c=this.autocapture)||void 0===c||c.startIfEnabled(),null===(h=this.heatmaps)||void 0===h||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(b=this.historyAutocapture)||void 0===b||b.startIfEnabledOrStop()),null===(d=this.exceptionObserver)||void 0===d||d.startIfEnabledOrStop(),null===(v=this.deadClicksAutocapture)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.surveys)||void 0===f||f.loadIfEnabled(),this.nd(),null===(p=this.externalIntegrations)||void 0===p||p.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&Rx(this,I$,!1)}}_overrideSDKInfo(t,e){su.LIB_NAME=t,su.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.lv}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:z$;return e!==z$&&(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"))}tv(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&Te(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))}qd(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.tv()||this.ev("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ev("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ev(t){return"never"===this.config.person_profiles?(Ur.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Zh(),this.iv(Ot,!0),!0)}rd(){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)}nd(){var t,e;const i=this.rd();var n,s,r,o;return this.is_capturing()||(null===(n=this.logs)||void 0===n||n.av(),null===(s=this.heatmaps)||void 0===s||s.discardPending()),(null===(t=this.persistence)||void 0===t?void 0:t.Ai)!==i&&(null===(r=this.persistence)||void 0===r||r.set_disabled(i)),(null===(e=this.sessionPersistence)||void 0===e?void 0:e.Ai)!==i&&(null===(o=this.sessionPersistence)||void 0===o||o.set_disabled(i)),this.Xd(),i}opt_in_capturing(t){var i,n,s;if("always"===this.config.cookieless_mode)return void Ur.warn(R$);if(this.Vh()){var r,o,l,a,u,c;null===(r=this.sessionRecording)||void 0===r||r.dispose({discardBufferedEvents:!0}),this.sv(!0,!0),null===(o=this.sessionManager)||void 0===o||o.destroy(),null===(l=this.pageViewManager)||void 0===l||l.destroy(),this.sessionManager=new g$(this),this.pageViewManager=new Fx(this),this.persistence&&(this.sessionPropsManager=new v$(this,this.sessionManager,this.persistence));const t=null!==(a=null===(u=this.config.__extensionClasses)||void 0===u?void 0:u.sessionRecording)&&void 0!==a?a:null===(c=e.__defaultExtensionClasses)||void 0===c?void 0:c.sessionRecording;var h,d;t&&(this.sessionRecording=this.Wh(this.sessionRecording,new t(this)),this.Ir&&(null===(h=this.sessionRecording)||void 0===h||null===(d=h.onRemoteConfig)||void 0===d||d.call(h,this.Ir)))}const v=1===this.consent.consent;var f,p,g,m;v?this.Xh():null===(f=this.heatmaps)||void 0===f||f.discardPending(),this.consent.optInOut(!0),this.nd(),this.Dd(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(p=this.surveys)||void 0===p||p.loadIfEnabled(),null===(g=this.conversations)||void 0===g||g.loadIfEnabled()),v||!Ce(null==t?void 0:t.captureEventName)&&!(null==t?void 0:t.captureEventName)||this.capture(null!==(m=null==t?void 0:t.captureEventName)&&void 0!==m?m:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),null===(n=this.persistence)||void 0===n||n.syncCookieProperties(),this.Md(),null===(s=this.featureFlags)||void 0===s||s.sendFlagCallsPendingCapture(),this.config.capture_pageview&&this.Nd()}opt_out_capturing(){"always"!==this.config.cookieless_mode?(this.consent.optInOut(!1),this.nd(),"on_reject"===this.config.cookieless_mode&&this.sd()):Ur.warn(R$)}sd(){var t,e,i;const n=this.sessionRecording;null==n||n.dispose({discardBufferedEvents:!0}),null===(t=this.heatmaps)||void 0===t||t.discardPending(),"$posthog_cookieless"!==this.get_distinct_id()&&this.sv(!0,!0),this.register({distinct_id:Pt,$device_id:null}),this.Hh(n),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.Nd(),this.Dd()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return!this.ed&&("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.nd()}_is_bot(){return i?y$(i,this.config.custom_blocked_useragents):void 0}Nd(){n&&("visible"===n.visibilityState?this.pd||(this.pd=!0,this.capture(te,{title:n.title},{send_instantly:!0}),this.gd&&(n.removeEventListener(E,this.gd),this.gd=null)):this.gd||(this.gd=this.Nd.bind(this),to(n,E,this.gd)))}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}))}Fc(){const t=this.Qh||{};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?(Ur.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,Ur)}Ds(t,e){var i;if(Re(this.config.before_send))return t;const n=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(De),s=Se(this.config.before_send)?this.config.before_send:[this.config.before_send];let r=t;for(const i of s)try{if(r=i(r),Re(r)){const e=`Event '${t.event}' was rejected in beforeSend function`;return Le(t.event)?Ur.warn(`${e}. This can cause unexpected behavior.`):Ur.info(e),null}r.properties&&!Te(r.properties)||Ur.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(i){return Ur.error(`Error in beforeSend function for event '${t.event}':`,i),null==e||e(),null}for(const e of n)if(r.properties&&Re(r.properties[e]))return Ur.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 r}getPageViewId(){var t;return null===(t=this.pageViewManager.cu)||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)})}bd(t){const e=Pe(t)&&!t,i=Ua.Ot()&&"true"===Ua.Lt("ph_debug");return!e&&(!!i||t)}};Q$.__defaultExtensionClasses={},Q$.lv=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(let i=0;e.length>i;i++)t.prototype[e[i]]=Qr(t.prototype[e[i]])}(Q$,["identify"]);const Z$=["[data-ph-capture-value]"];var K$=class{constructor(t){this._instance=t}refresh(t){var e;const i=this._instance.config,n=$e(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance.Fc(),t.url_allowlist=null==n?void 0:n.url_allowlist,t.url_ignorelist=null==n?void 0:n.url_ignorelist,t.dom_event_allowlist=null==n?void 0:n.dom_event_allowlist,t.element_allowlist=null==n?void 0:n.element_allowlist,t.css_selector_allowlist=null==n?void 0:n.css_selector_allowlist,t.css_selector_ignorelist=null==n?void 0:n.css_selector_ignorelist,t.element_attribute_ignorelist=null==n?void 0:n.element_attribute_ignorelist,t.capture_copied_text=null==n?void 0:n.capture_copied_text,t.capture_value_css_selector_allowlist=null!==(e=null==n?void 0:n.capture_value_css_selector_allowlist)&&void 0!==e?e:Z$}};const Y$=Hr("[ExceptionAutocapture]"),X$=Hr("[TracingHeaders]"),tT=Hr("[Web Vitals]"),eT=9e5,iT=["CLS","FCP","INP","LCP"],nT=["INP","LCP"],sT=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],rT=Hr("[SessionRecording]"),oT=[Nt,jt,qt,Bt,zt,Ut,Ht,Wt,Vt],lT=Hr("[Heatmaps]");function aT(t){return $e(t)&&"clientX"in t&&"clientY"in t&&Ae(t.clientX)&&Ae(t.clientY)}const uT=Hr("[Product Tours]"),cT=t=>{var e;return!t.config.disable_product_tours&&!!(null===(e=t.persistence)||void 0===e?void 0:e.get_property(X))},hT=["$set_once","$set"],dT=Hr("[SiteApps]"),vT="Error while initializing PostHog app with config id ",fT=(()=>(null==t?void 0:t.location)?ho(t.location.hash,"__posthog")||ho(location.hash,"state"):null)(),pT="_postHogToolbarParams",gT=Hr("[Toolbar]"),mT=Hr("[FeatureFlags]"),yT=Hr("[FeatureFlags]",{debugEnabled:!0}),bT="\" failed. Feature flags didn't load in time.",_T=[502,504],wT=["click","keydown","wheel","touchstart","pointerdown"],kT="connection_error",ST=(t,e)=>{const i=Object.keys(e||{}).filter(t=>{var i;return null==e||null===(i=e[t])||void 0===i?void 0:i.failed});if(!i.length)return t||{};const n=ue({},t);return i.forEach(t=>delete n[t]),n},xT=(t,e)=>{const i=ue({},t);return e.forEach(t=>{var e;(null===(e=i[t])||void 0===e?void 0:e.failed)&&delete i[t]}),i},$T=(t,e)=>!!(null==e?void 0:e.partialResponse)||!!t.errorsWhileComputingFlags,TT=t=>{const e={};for(let i=0;t.length>i;i++)e[t[i]]=!0;return e},CT=t=>{const e={};for(const[i,n]of Jr(t||{}))n&&(e[i]=n);return e},ET={version:2},MT=(t,e)=>t.distinctId===e.distinctId&&t.sessionId===e.sessionId&&((t,e)=>{const i=Object.keys(t);return i.length===Object.keys(e).length&&i.every(i=>t[i]===e[i])})(t.groups,e.groups);var IT=class{constructor(t){this.name="featureFlags",this.uv=!1,this.featureFlagEventHandlers=[],this.R=mT,this.hv={},this.dv={},this.vv=[],this.fv=new Set,this.pv=new Set,this.gv=!1,this.mv=!1,this.yv=0,this.bv=!1,this._v=!1,this.wv=!1,this.Sv=new Map,this.xv=!1,this.$v=!1,this.Cv=!1,this.Tv=0,this.Mv=!1,this.Iv=!1,this.Ev=new WeakMap,this.Av=new Map,this.mn=()=>{const t=this.Rv();this.Tv=0,t&&this.reloadFeatureFlags()},this.Pv=()=>{var t,e;const i=this.Ov,n=null!==(t=this.Fv)&&void 0!==t?t:i;Ce(i)||Ce(n)||this.Yr.remoteRequestsDisabled||!this.Lv||"hidden"===this.Lv.visibilityState||Date.now()-(null!==(e=this.Dv)&&void 0!==e?e:0)<n||(this.Fv=this.Mv||!this.Yr.idleRefreshBackoff?i:Math.min(2*n,36e5),this.Mv=!1,this.reloadFeatureFlags(),this.Nv())},this.jv=()=>{this.Mv&&this.Fv===this.Ov||this.qv()},this.gn=()=>{var t;"visible"===(null===(t=this.Lv)||void 0===t?void 0:t.visibilityState)&&this.qv()},this.ra=t}get Bv(){return ET}get zv(){}Hv(){this.ia&&this.Uv()}setup(t){try{this.Wv=typeof window>"u"?void 0:window,this.Lv=typeof document>"u"?void 0:document}catch(t){this.Wv=void 0,this.Lv=void 0}return this.ga=t,this.R=t.logger.createLogger("[FeatureFlags]"),N_(t.kv.initialize(),()=>{this.ga===t&&(this.ga=void 0,this.ia=t,this.Vv(t))})}Vv(t){var e;if(this.ia===t)return this.Wv&&to(this.Wv,"online",this.mn),this.Uv(),this.Gv=t.registerDynamicEventProperties(()=>this.Jv()?this.hv:this.dv),this.Qv=null===(e=this.zv)||void 0===e?void 0:e.onCrossTabFeatureFlagChange(()=>{this.Zv(),this.Kv(),this.Yv()}),this.Kv(),this.initialize()}qv(){this.Mv=!0,this.Fv=this.Ov,this.Pv()}Uv(){var t;const e=this.Yr.refreshIntervalMs,i=!this.Yr.remoteRequestsDisabled&&this.Lv&&!Ce(e)&&e>0?e:void 0;this.Yr.idleRefreshBackoff||(this.Fv=i),i!==this.Ov&&(this.Xv(),Ce(i)||(this.Ov=i,this.Fv=i,this.Nv(),(null===(t=this.Lv)||void 0===t?void 0:t.addEventListener)&&(to(this.Lv,E,this.gn),Wr(wT,t=>{to(this.Lv,t,this.jv,{capture:!0})}))))}Nv(){Ce(this.Ov)||(Ce(this.tf)||clearInterval(this.tf),this.Dv=Date.now(),this.tf=setInterval(this.Pv,this.Ov))}Xv(){var t,e;Ce(this.tf)||(clearInterval(this.tf),this.tf=void 0,null===(t=this.Lv)||void 0===t||null===(e=t.removeEventListener)||void 0===e||e.call(t,"visibilitychange",this.gn),Wr(wT,t=>{var e,i;null===(e=this.Lv)||void 0===e||null===(i=e.removeEventListener)||void 0===i||i.call(e,t,this.jv,{capture:!0})})),this.Ov=void 0,this.Fv=void 0,this.Mv=!1,this.Dv=void 0}destroy(){this.ef()}dispose(){this.ef()}ef(){var t,e,i;this.Xv(),this.yv++,this._v=!1,this.ga=void 0,this.if(this.fv,"cancelled"),this.if(this.pv,"cancelled"),this.ia&&(this.nf(),null===(t=this.Gv)||void 0===t||t.dispose(),this.Gv=void 0,null===(e=this.Qv)||void 0===e||e.call(this),this.Qv=void 0,this.vv=[],null===(i=this.Wv)||void 0===i||i.removeEventListener("online",this.mn),this.ia=void 0)}get Yr(){return this.ra.get()}sf(t){var e;return this.rf&&t in this.rf?this.rf[t]:null===(e=this.ia)||void 0===e?void 0:e.kv.get(t)}Zv(){return!!this.rf&&(this.rf=void 0,!0)}lf(){var t;return!Ce(null===(t=this.ia)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.Zv()}$t(t){this.af(()=>{var e;return null===(e=this.ia)||void 0===e?void 0:e.kv.set(t)})}uf(t,e,i){if(!this.zv||!t.$enabled_feature_flags)return;const n=this.sf("$enabled_feature_flags")||{},s=t.$enabled_feature_flags||{},r=e.flags||e.featureFlags,o=e.flags?Object.entries(e.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],l=!!e.errorsWhileComputingFlags&&!!e.flags,a=l||i&&e.flags?o:i&&!Se(r)?Object.keys(r||{}):Array.from(new Set([...Object.keys(n),...Object.keys(s)])),u=this.sf("$feature_flag_payloads")||{},c=t.$feature_flag_payloads||{},h=l||i?a:Array.from(new Set([...Object.keys(u),...Object.keys(c)])),d=!l&&!i,p=!!d||a,_=!!d||h,w={[v]:p,[b]:p,[x]:_};t.$feature_flag_details&&(w[f]=p);for(const e of[m,g,y])Ce(t[e])||(w[e]=!0);this.zv.markCrossTabFeatureFlagChanges(w)}Dt(t){this.af(()=>{var e;return null===(e=this.ia)||void 0===e?void 0:e.kv.remove(t)})}af(t){try{t()}catch(t){this.R.error("Failed to update feature flag persistence",t)}}Kv(){const t={},e=this.sf(f);for(const e of[m,T]){const i=this.sf(e);Ce(i)||(t[e]=i)}const i=this.sf(v);i&&(t[v]=i.filter(t=>{var i;return!(null==e||null===(i=e[t])||void 0===i?void 0:i.failed)}));const n=this.sf(x);n&&(t[x]=ST(n,e)),this.hv=t;const s=ue({},t),r=ST(this.sf(b),e);if(r)for(const[t,e]of Object.entries(r))s[`$feature/${t}`]=e;this.dv=s}Jv(){const t=this.Yr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.sf(g);return"number"!=typeof e||Date.now()-e>t}cf(){return!!this.Jv()&&(this.Cv||this.mv||(this.Cv=!0,this.R.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hf(){const t=this.Yr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.R.error("Invalid evaluation context found:",t,"Expected non-empty string"),e}):[]}df(){const t=this.Yr.flagKeys;if(!Ce(t))return t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.R.error("Invalid flag key found:",t,"Expected non-empty string"),e})}initialize(){var t,e;const i=this.Yr,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=>!Ce(n[t])).reduce((t,e)=>(t[e]=n[e],t),{}),o=Object.keys(t).filter(t=>e[t]).reduce((e,n)=>(e[n]=i.encodeBootstrapPayloads?JSON.stringify(t[n]):t[n],e),{});return this.vf({featureFlags:e,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,e,i){const n=(null==i?void 0:i.merge)?ST(this.sf(b),this.sf(f)):{},s=(null==i?void 0:i.merge)?ST(this.sf(x),this.sf(f)):{},r=ue(ue({},n),t),o=ue(ue({},s),e),l={};for(const[t,e]of Object.entries(r))l[t]={key:t,enabled:os(e),variant:ls(e),reason:void 0,metadata:Ce(null==o?void 0:o[t])?void 0:{id:0,version:void 0,description:void 0,payload:o[t]}};this.vf({flags:l})}get hasLoadedFlags(){return this.gv}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.ff(),e=this.Bv.publicDetail;return e?Object.fromEntries(Object.entries(t).map(([t,i])=>[t,e(i)])):t}ff(){const t=this.sf(f),e=this.sf(T),i=this.sf(C);if(!i&&!e)return t||{};const n=Gr({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(const t of s){var r,o;const s=n[t],l=null==e?void 0:e[t],a=Ce(l)?null!==(r=null==s?void 0:s.enabled)&&void 0!==r&&r:!!l,u=Ce(l)?null==s?void 0:s.variant:"string"==typeof l?l:void 0,c=null==i?void 0:i[t],h=ue(ue({},s),{},{enabled:a,variant:a?null!=u?u:null==s?void 0:s.variant:void 0});a!==(null==s?void 0:s.enabled)&&(h.original_enabled=null==s?void 0:s.enabled),u!==(null==s?void 0:s.variant)&&(h.original_variant=null==s?void 0:s.variant),c&&(h.metadata=ue(ue({},null==s?void 0:s.metadata),{},{payload:c,original_payload:null==s||null===(o=s.metadata)||void 0===o?void 0:o.payload})),n[t]=h}return this.uv||(this.R.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:n}),this.uv=!0),n}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(i=>{const n=t[i];return{key:i,enabled:os(n),variant:ls(n),payload:rs(e[i])}})}getFlagVariants(){const t=ST(this.sf(b),this.sf(f)),e=this.sf(T);if(!e)return t||{};const i=Gr({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.uv||(this.R.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.uv=!0),i}getFlagPayloads(){const t=ST(this.sf(x),this.sf(f)),e=this.sf(C);if(!e)return t||{};const i=Gr({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.uv||(this.R.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.uv=!0),i}reloadFeatureFlags(){this.bv||this.Yr.featureFlagsDisabled||this.Rv()||(this.wv&&this.R.warn("reloadFeatureFlags() was called inside an onFeatureFlags callback. This callback also runs when flags change in other tabs, so this can cause a request loop."),this.mv&&(this._v=!0),this.pf||(this.pf=setTimeout(()=>{this.gf()},5),this.vv.slice().forEach(t=>{try{t()}catch(t){this.R.error("Error while running feature flags reloading callback",t)}})))}reloadFeatureFlagsAsync(){return!this.ia||this.bv||this.Yr.featureFlagsDisabled||this.Yr.remoteRequestsDisabled||this.Rv()?Promise.resolve({status:"skipped"}):new Promise(t=>{this.fv.add(t),this.reloadFeatureFlags()})}if(t,e){t.forEach(t=>t({status:e})),t.clear()}nf(){clearTimeout(this.pf),this.pf=void 0}onReloading(t){return this.vv.push(t),()=>{this.vv=this.vv.filter(e=>e!==t)}}ensureFlagsLoaded(){this.gv||this.mv||this.pf||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.bv=t}resetFlagCallReported(){this.Dt(k),this.Sv=new Map,this.Av=new Map}sendFlagCallsPendingCapture(){var t;if(0!==this.Sv.size&&!this.xv&&(null===(t=this.ia)||void 0===t?void 0:t.canCapture)&&!this.ia.isRateLimited){this.xv=!0;try{const t=this.getFlagVariants();for(const i of Array.from(this.Sv.keys())){var e;const n=this.Sv.get(i);if(!n)continue;const s=null===(e=this.mf(i,t[i]))||void 0===e?void 0:e.calledKey;if(n.value!==String(t[i])||n.calledKey&&n.calledKey!==s||!MT(n.context,this.yf()))this.Sv.delete(i);else if(this.getFeatureFlagResult(i),this.Sv.has(i))break}}finally{this.xv=!1}}}gf(t){var e;this.nf();const i=this.ia;if(!i||this.Yr.remoteRequestsDisabled||this.Rv())return void this.if(this.fv,"skipped");if(this.mv)return void(this._v=!0);const n={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:ue(ue(ue({},i.initialPersonProperties),this.sf("$stored_person_properties")||{}),{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.sf(_),timezone:Au()};Ce(i.deviceId)||(n.$device_id=i.deviceId),((null==t?void 0:t.disableFlags)||this.Yr.featureFlagsDisabled)&&(n.disable_flags=!0);const s=this.hf();s.length&&(n.evaluation_contexts=s);const r=this.df();Ce(r)||(n.flag_keys=r);const o=this.Yr.onlyEvaluateSurveyFeatureFlags,l=`/flags/?v=${this.Bv.version}${o?"&only_evaluate_survey_feature_flags=true":""}`,a=this.yv,u=this.fv;this.fv=new Set,this.pv=u,this.mv=!0;const c=()=>{this._v&&(this._v=!1,this.gf())},h=t=>{var e;const i=this.bf(t.json),s=200!==t.statusCode;if(this.mv=!1,a!==this.yv)return void c();if(this._f(t.statusCode),s||this._v||(this.$anon_distinct_id=void 0),n.disable_flags&&!this._v)return void this.if(u,"skipped");this.$v=!s;const r=[];t.error?r.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?kT:"unknown_error"):200!==t.statusCode&&r.push(`api_error_${t.statusCode}`),i.errorsWhileComputingFlags&&r.push("errors_while_computing_flags");const l=!!(null===(e=i.quotaLimited)||void 0===e?void 0:e.includes("feature_flags"));l&&r.push("quota_limited"),this.$t({[p]:r}),l?this.R.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):n.disable_flags||this.vf(i,s,{partialResponse:o}),this.if(u,n.disable_flags?"skipped":r.length||!i.flags&&!i.featureFlags?"error":"loaded"),c()},d=t=>{this.mv=!1,a===this.yv?(this.$t({[p]:[kT]}),this.R.error("Feature flag request failed",t),this.lf()&&this.Yv(!0),this.if(u,"error"),c()):c()};let v=null!==(e=this.Yr.requestMaxRetries)&&void 0!==e?e:1;const f=()=>v>0&&a===this.yv,g=()=>{if(a!==this.yv||!this.ia||this.Yr.remoteRequestsDisabled)return this.mv=!1,this.if(u,"skipped"),void c();try{i.sendRequest(l,{target:"flags",method:"POST",body:n,compression:this.Yr.compression,sentAt:"body",timeoutMs:this.Yr.requestTimeoutMs}).then(t=>{if((t=>_T.includes(t.statusCode)||(t=>0===t.statusCode&&t.error instanceof Error&&"AbortError"===t.error.name)(t))(t)&&f())return v--,void setTimeout(g,500);h(t)}).catch(d)}catch(t){d(t)}};g()}bf(t){const e=null!=t?t:{},i=this.Bv.read;if(!i)return e;const{body:n,withoutTypedValues:s}=i(e);return s&&!this.Iv&&(this.Iv=!0,this.R.info("The /flags response has no typed flag values. Its flags are read as before.")),n}Rv(){return so(this.Tv,3)}_f(t){this.Tv=ro(t,this.Tv,3,()=>this.R.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."))}wf(t){var e;return!this.gv&&!this.getFlags().length&&!(null===(e=this.getFeatureFlagDetails(t))||void 0===e?void 0:e.failed)}getFeatureFlag(t,e={}){var i;if(e.fresh&&!this.$v)return;if(this.wf(t))return void this.R.warn('getFeatureFlag for key "'+t+bT);if(this.cf())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){const e=this.ff()[t],i=this.Bv.publicDetail;return e&&i?i(e):e}getFeatureFlagPayload(t){const e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e={}){var i;if(e.fresh&&!this.$v)return;if(this.wf(t))return void this.R.warn('getFeatureFlagResult for key "'+t+bT);if(this.cf())return;const n=null===(i=this.sf("$feature_flag_details"))||void 0===i||null===(i=i[t])||void 0===i?void 0:i.failed,s=n?void 0:this.sf(b),r=n?void 0:this.sf(x),o=this.sf(T),l=!!o&&{}.hasOwnProperty.call(o,t),a=l||!!s&&t in s,u=l?o[t]:null==s?void 0:s[t],c=this.sf(C),h=c&&{}.hasOwnProperty.call(c,t)?c[t]:null==r?void 0:r[t],d=String(u),v=this.sf("$feature_flag_request_id")||void 0,f=this.sf("$feature_flag_evaluated_at")||void 0;let p,g=this.sf("$flag_call_reported")||{};if(this.Yr.deduplicateCallsPerSession){var m;const t=null===(m=this.ia)||void 0===m||null===(m=m.session)||void 0===m?void 0:m.sessionId,e=this.sf(S);t&&t!==e&&(g={},p=t)}if(!e.send_event&&"send_event"in e)p&&this.$t({[k]:g,[S]:p});else{var y,_,w,E;const e=!(null===(y=this.ia)||void 0===y?void 0:y.canCapture),i=!e&&!(null===(_=this.ia)||void 0===_?void 0:_.isRateLimited),n=this.mf(t,u),s=n?n.calledKey:d,r=null==n?void 0:n.exposureKey,o=()=>this.kf(t,d,null==n?void 0:n.calledKey);var M,I;i?this.Sv.delete(t):(e&&Object.keys(g).length>0&&(g={},this.$t({[k]:g})),(!(null===(M=g[t])||void 0===M?void 0:M.includes(s))||r&&!(null===(I=g[t])||void 0===I?void 0:I.includes(r)))&&o());const l=!(null===(w=g[t])||void 0===w?void 0:w.includes(s)),a=!!r&&!(null===(E=g[t])||void 0===E?void 0:E.includes(r));if(i&&n&&(l||a)){p&&this.$t({[k]:g,[S]:p});const e=n.build(this.Sf(t,u,h,v,f)),i=l?this.xf(t,s,e.called,o):void 0;a&&e.exposure&&this.xf(t,r,e.exposure,o,i)}else if(i&&l){Se(g[t])?g[t].push(d):g[t]=[d],this.$t(ue({[k]:g},p?{[S]:p}:{}));const e=this.Sf(t,u,h,v,f);this.$f(e)||(this.Cf(t,d),o())}else p&&this.$t({[k]:g,[S]:p})}return a?{key:t,enabled:!!u,variant:"string"==typeof u?u:void 0,payload:rs(h)}:void 0}Sf(t,e,i,n,s){var r,o,l,a,u,c,h,d,v,f,p,g,m;const y=this.ff()[t],b=[...null!==(r=this.sf("$feature_flag_errors"))&&void 0!==r?r:[]];Ce(e)&&b.push((null==y?void 0:y.failed)?"evaluation_failed":"flag_missing");const _={$feature_flag:t,$feature_flag_response:e,$feature_flag_payload:null!=i?i:null,$feature_flag_request_id:n,$feature_flag_evaluated_at:s,$feature_flag_bootstrapped_response:null!==(o=null===(l=this.Yr.bootstrap)||void 0===l||null===(l=l.featureFlags)||void 0===l?void 0:l[t])&&void 0!==o?o:null,$feature_flag_bootstrapped_payload:null!==(a=null===(u=this.Yr.bootstrap)||void 0===u||null===(u=u.featureFlagPayloads)||void 0===u?void 0:u[t])&&void 0!==a?a:null,$used_bootstrap_value:!this.$v};Ce(null==y||null===(c=y.metadata)||void 0===c?void 0:c.has_experiment)||(_.$feature_flag_has_experiment=y.metadata.has_experiment),Ce(null==y||null===(h=y.metadata)||void 0===h?void 0:h.version)||(_.$feature_flag_version=y.metadata.version);const w=null!==(d=null==y||null===(v=y.reason)||void 0===v?void 0:v.description)&&void 0!==d?d:null==y||null===(f=y.reason)||void 0===f?void 0:f.code;return w&&(_.$feature_flag_reason=w),(null==y||null===(p=y.metadata)||void 0===p?void 0:p.id)&&(_.$feature_flag_id=y.metadata.id),Ce(null==y?void 0:y.original_variant)&&Ce(null==y?void 0:y.original_enabled)||(_.$feature_flag_original_response=Ce(y.original_variant)?y.original_enabled:y.original_variant),(null==y||null===(g=y.metadata)||void 0===g?void 0:g.original_payload)&&(_.$feature_flag_original_payload=null==y||null===(m=y.metadata)||void 0===m?void 0:m.original_payload),b.length&&(_.$feature_flag_error=b.join(",")),_}mf(t,e){var i,n,s;const r=this.Bv.flagEvents,o=this.sf(T);if(!(!r||$e(o)&&we.call(o,t)))return r({key:t,response:e,groups:null!==(i=null===(n=this.ia)||void 0===n?void 0:n.groups)&&void 0!==i?i:{},record:null===(s=this.sf("$feature_flag_details"))||void 0===s?void 0:s[t]})}xf(t,e,i,n,s){var r;const o=this.sf("$flag_call_reported")||{},l=t+e,a=this.Av.get(l)||0;if((null===(r=o[t])||void 0===r?void 0:r.includes(e))||a>1)return;this.$t({[k]:ue(ue({},o),{},{[t]:[...o[t]||[],e].slice(-10)})});let u,c,h=!1,d=!1;this.Ev.set(i.properties,ue(ue({},i.capture),{},{failed(){h=!0},resolved:t=>(c=t.$session_id,u=JSON.stringify([t.distinct_id,t.$groups,c,t.$process_person_profile]),d=!!s&&u!==s,!d)}));let v=!1;try{var f,p;v=!1!==(null===(f=this.ia)||void 0===f?void 0:f.capture(i.event,i.properties))&&!!(null===(p=this.ia)||void 0===p?void 0:p.canCapture),v||n()}catch(t){h=!0,this.R.error("Failed to capture "+i.event,t)}h&&this.Av.set(l,a+1);const g=v&&!h&&!d;return g||this.Cf(t,e),this.Yr.deduplicateCallsPerSession&&c&&c!==this.sf("$flag_call_reported_session_id")&&this.$t({[k]:g?{[t]:[e]}:{},[S]:c}),u}flagEventCapture(t){return t?this.Ev.get(t):void 0}$f(t){try{var e;return!1!==(null===(e=this.ia)||void 0===e?void 0:e.capture("$feature_flag_called",t))}catch(t){return this.R.error("Failed to capture feature flag call",t),!0}}kf(t,e,i){this.Sv.set(t,{value:e,calledKey:i,context:this.yf()})}yf(){var t,e,i;return{distinctId:null===(t=this.ia)||void 0===t?void 0:t.distinctId,groups:ue({},null===(e=this.ia)||void 0===e?void 0:e.groups),sessionId:this.Yr.deduplicateCallsPerSession?null===(i=this.ia)||void 0===i||null===(i=i.session)||void 0===i?void 0:i.sessionId:void 0}}Cf(t,e){const i=this.sf("$flag_call_reported")||{},n=i[t];Se(n)&&n.includes(e)&&(i[t]=n.filter(t=>t!==e),this.$t({[k]:i}))}getRemoteConfigPayload(t,e){this.Tf(t,e)}Tf(t,e){var i=this;return re(function*(){const n=i.ia;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.hf();r.length&&(s.evaluation_contexts=r);const o=i.df();let l;Ce(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.Yr.compression,sentAt:"body",timeoutMs:i.Yr.requestTimeoutMs})).json)||void 0===a?void 0:a.featureFlagPayloads;l=(null==e?void 0:e[t])||void 0}catch(t){return void i.R.error("Remote config feature flag request failed",t)}try{e(l)}catch(t){i.R.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.$v)return e.defaultValue;if(this.wf(t))return this.R.warn('isFeatureEnabled for key "'+t+bT),e.defaultValue;const i=this.getFeatureFlag(t,e);return Ce(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.vf(t,e,i)}vf(t,e,i){if(!this.ia)return;var n,s;this.gv=!0,!1!==(null==i?void 0:i.persist)&&$T(t,i)&&(null===(n=this.zv)||void 0===n||null===(s=n.reconcileFeatureFlagsBeforeMerge)||void 0===s?void 0:s.call(n))&&this.Zv();const r=this.getFlagVariants(),o=!t.flags&&Se(t.featureFlags),l=((t,e={},i={},n={},s,r=mT)=>{const o=((t,e)=>{const i=t.flags;if(i){const e=Object.fromEntries(Object.keys(i).filter(t=>!i[t].failed).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].failed&&i[t].enabled).filter(t=>{var e;return!Ce(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 c=t.requestId,h=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{[v]:a,[b]:t,[f]:xT(n,a),[x]:ST(i,n),[y]:!1}}let d=a,p=u,_=l;if($T(t,s)){const t=t=>({}.hasOwnProperty.call(e,t)&&!Ce(e[t])),r=Object.keys(d),o=p||{};d=ue(ue({},e),d),p=ue(ue({},i),o),((null==s?void 0:s.partialResponse)||l)&&r.forEach(t=>{t in o||null==p||delete p[t]}),_=l?ue(ue({},n),Object.fromEntries(Object.entries(l).filter(([e,i])=>!i.failed||!t(e)))):xT(n,r)}return ue(ue({[v]:Object.keys(CT(d)),[b]:d||{},[x]:p||{},[f]:_||{},[y]:!0===t.minimalFlagCalledEvents},c?{[m]:c}:{}),h?{[g]:h}:{})})(t,r,o?this.sf("$feature_flag_payloads")||{}:this.getFlagPayloads(),o?this.sf("$feature_flag_details")||{}:this.ff(),i,this.R);if(l)if(!1===(null==i?void 0:i.persist)){const t=!Ce(this.ia.kv.get(b));this.rf=l,t||this.$t(l)}else this.Zv(),this.uf(l,t,!!(null==i?void 0:i.partialResponse)),this.$t(l);else e&&this.lf();e||(this.Cv=!1),this.Yv(e)}override(t,e=!1){this.R.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.Mf(t)}Mf(t){if(this.ia){if(!1===t)return this.Dt([T,C]),this.Yv(),void yT.info("All overrides cleared");if(Se(t))return this.$t({[T]:TT(t)}),this.Yv(),void yT.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e;const i=t;this.uv=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);const n={},s=i.flags,r=i.payloads;return s&&(n[T]=Se(s)?TT(s):s),r&&(n[C]=r),Object.keys(n).length&&this.$t(n),!1===s&&!1===r?this.Dt([T,C]):!1===s?this.Dt(T):!1===r&&this.Dt(C),this.Yv(),!1===s?yT.info("Flag overrides cleared"):s&&yT.info("Flag overrides set",{flags:s}),void(!1===r?yT.info("Payload overrides cleared"):r&&yT.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.$t({[T]:t}),this.Yv(),void yT.info("Flag overrides set",{flags:t});this.R.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.R.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.gv){const{flags:e,flagVariants:i}=this.If();try{t(e,i)}catch(t){this.R.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var n,s;const r=(this.sf("$early_access_features")||[]).find(e=>e.flagKey===t),o={[`$feature_enrollment/${t}`]:e},l={$feature_flag:t,$feature_enrollment:e,$set:o};r&&(l.$early_access_feature_name=r.name),i&&(l.$feature_enrollment_stage=i);const a=ue(ue({},this.getFlagVariants()),{},{[t]:e}),u=ue({},this.sf(f)),c=null===(n=u[t])||void 0===n?void 0:n.failed,h=ue({},this.sf(x));c&&(delete u[t],delete h[t]),null===(s=this.zv)||void 0===s||s.markCrossTabFeatureFlagChanges(ue(ue({$active_feature_flags:[t],$enabled_feature_flags:[t]},c?{$feature_flag_details:[t],$feature_flag_payloads:[t]}:{}),{},{$stored_person_properties:Object.keys(o)})),this.$t(ue(ue({[v]:Object.keys(CT(a)),[b]:a},c?{[f]:u,[x]:h}:{}),{},{[w]:ue(ue({},this.sf("$stored_person_properties")||{}),o)})),this.Yv();try{var d;null===(d=this.ia)||void 0===d||d.capture("$feature_enrollment_update",l)}catch(t){this.R.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,e=!1,i){const n=this.sf(d);!n||e?this.Ef(t,i):t(n)}Ef(t,e){var i=this;return re(function*(){const n=i.ia;if(!n)return;const s=e?`&${e.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${s}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,i.$t({[d]:r})}catch(t){return void i.R.error("Early access feature request failed",t)}try{t(r)}catch(t){i.R.error("Early access feature callback failed",t)}})()}If(){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),{})}}Yv(t){this.Kv();const{flags:e,flagVariants:i}=this.If(),n=this.wv;this.wv=!0,this.featureFlagEventHandlers.forEach(n=>{try{n(e,i,{errorsLoading:t})}catch(t){this.R.error("Error while running feature flags callback",t)}}),this.wv=n}setPersonPropertiesForFlags(t,e=!0){this.Af(t,e)}Af(t,e=!0){const i=this.sf("$stored_person_properties")||{},n=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),s=null==t?void 0:t.$set_once,r={};if(s)for(const t in s)({}).hasOwnProperty.call(s,t)&&(t in i||(r[t]=s[t]));this.$t({[w]:ue(ue(ue({},i),r),n)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const i=ue({},this.sf("$stored_person_properties")||{});t.forEach(t=>{delete i[t]}),this.$t({[w]:i}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Dt(w),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const i=this.sf("$stored_group_properties")||{},n=ue({},i);for(const e of Object.keys(t))n[e]=ue(ue({},i[e]),t[e]);this.$t({[_]:n}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.sf("$stored_group_properties")||{};this.$t({[_]:ue(ue({},e),{},{[t]:{}})})}else this.Dt(_)}reset(){this.yv++,this.if(this.fv,"cancelled"),this.if(this.pv,"cancelled"),this._v=!1,this.hv={},this.dv={},this.rf=void 0,this.gv=!1,this.bv=!1,this.$v=!1,this.$anon_distinct_id=void 0,this.nf(),this.uv=!1,this.Tv=0,this.Sv=new Map,this.Av=new Map}};const RT=t=>$e(t)&&"value"in t?t:void 0,AT=t=>Ee(t)?t:Ae(t)||$e(t)||!0===t,OT="$experiment_exposure",PT="experiment_split",FT="experiment",LT={targeting_match:["targeted_release","percentage_rollout"],[PT]:[FT],rollout_miss:["percentage_rollout",FT],experiment_paused:[FT],holdout:[FT]},DT="$feature_flag_config_version",NT="$feature_flag_reason_code",jT="$feature_flag_rule_id",qT="$feature_flag_rule_type",BT="$feature_flag_variant_key",zT="$feature_flag_experiment_id",UT="$feature_flag_forced_variant",HT=[DT,NT,jT,qT,BT],WT=[...HT,"$feature_flag_reason",UT,zT],VT=[DT,NT,qT,"$experiment_exposure_source",zT,UT],GT=["$feature_flag_id","$feature_flag_version","$feature_flag_request_id","$feature_flag_evaluated_at"],JT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,QT=t=>Ee(t)?t:void 0,ZT={},KT=t=>Ae(t)&&t%1==0,YT=[["key",Ee],["failed",Pe]],XT=[["code",Ee],["condition_index",KT],["description",Ee]],tC=[["id",KT],["version",KT],["description",Ee],["has_experiment",Pe],["config_version",KT],["rule_type",Ee],["rule_id",Ee],["variant_key",Ee],["forced_variant",Pe],["experiment_id",KT]],eC=(t,e)=>{if(Re(t))return;if(!$e(t))throw ZT;const i={};for(const[n,s]of e){const e=t[n];if(!Re(e)){if(!s(e))throw ZT;i[n]=e}}return i},iC=(t,e)=>{const i=eC(e,YT),n=null==e?void 0:e.value;if(!i||!(Ie(n)||Pe(n)||Ee(n)||$e(n)||Ae(n)&&isFinite(n)))throw ZT;const s=e.metadata,r=eC(s,tC),o=!0===i.failed,l=o?null:n,a=Ae(l)||$e(l),u=AT(l);return{key:t,enabled:!1!==u,variant:Ee(u)?u:null,value:l,reason:eC(e.reason,XT),metadata:r||a?ue(ue({},r),{},{payload:o?null:a?JSON.stringify(l):null==s?void 0:s.payload,experiment_id:void 0}):void 0,failed:o||void 0}},nC=["config_version","rule_type","rule_id","variant_key","forced_variant"],sC={version:4,read(t){const e=$e(t)?t.flags:void 0;let i=!1;if(!$e(e)){const e=$e(t)?t.featureFlags:void 0;return{body:t,withoutTypedValues:$e(e)&&Object.keys(e).length>0}}const n=Object.fromEntries(Object.keys(e).map(t=>{const n=e[t];if($e(n)&&!("value"in n))return i=!0,[t,n];try{return[t,iC(t,n)]}catch(e){return[t,{key:t,enabled:!1}]}}));return{body:ue(ue({},t),{},{flags:n}),withoutTypedValues:i}},publicDetail(t){if(!RT(t))return t;const e=ue({},t);if(delete e.value,$e(e.metadata)){const t=e.metadata=ue({},e.metadata);for(const e of nC)delete t[e]}return e},flagEvents(t){const{key:e,response:i,record:n}=t,s=(t=>{var e;const i=RT(t),n=null==i?void 0:i.metadata;if(!i||2!==(null==n?void 0:n.config_version))return;const s=QT(null===(e=i.reason)||void 0===e?void 0:e.code)||void 0;let r,o,l;const a=s&&we.call(LT,s)?LT[s]:void 0,u=QT(n.rule_id),c=QT(n.rule_type);return!i.failed&&a&&u&&JT.test(u)&&c&&-1!==a.indexOf(c)&&(s!==PT?(r=u,o=c):Ee(n.variant_key)&&(r=u,o=c,l=n.variant_key)),{reasonCode:s,ruleId:r,ruleType:o,variantKey:l}})(n),r=RT(n);if(!s||!r||(r.failed?!Ce(i):AT(r.value)!==i))return;const{reasonCode:o,ruleId:l,ruleType:a,variantKey:u}=s,c=Object.keys(t.groups).sort().map(e=>[e,t.groups[e]]),h={[DT]:2};o&&(h[NT]=o),l&&(h[jT]=l,h[qT]=a);const d=Ee(u);return d&&(h[BT]=u),{calledKey:JSON.stringify([i,c,2,o||null,l||null,a||null,d?u:null]),exposureKey:d?JSON.stringify([OT,c,2,l,u]):void 0,build(t){const n=ue(ue({},t),h);delete n.$feature_flag_reason;const s={event:"$feature_flag_called",properties:n,capture:{omit:WT.filter(t=>!(t in n)),keep:HT}};if(!d)return{called:s,exposure:void 0};const r={};for(const t of GT)Ce(n[t])||(r[t]=n[t]);return r.$feature_flag=e,r.$feature_flag_response=i,r[BT]=u,r[jT]=l,r.locally_evaluated=!1,{called:s,exposure:{event:OT,properties:r,capture:{omit:VT,keep:[]}}}}}}},rC=Hr("[FeatureFlags]");var oC=class{constructor(t,e=!1){this.Rf=!1,this.update(t,e)}update(t,e){this.Pf=((t,e)=>{var i,n,s,r,o,l,a,u;return{bootstrap:{featureFlags:null!==(i=null===(n=t.bootstrap)||void 0===n?void 0:n.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(s=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:void 0},remoteRequestsDisabled:e,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=t.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:Ce(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!==(l=t.feature_flag_request_max_retries)&&void 0!==l?l:1),compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(a=null!==(u=t.evaluation_contexts)&&void 0!==u?u:t.evaluation_environments)&&void 0!==a?a:[],flagKeys:Se(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.Rf||(rC.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Rf=!0),Ce(t.flag_keys)||Se(t.flag_keys)||rC.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Pf}};const lC="Refusing to render web experiment since the viewer is a likely bot",aC={ADD_ATTR:(t,e)=>"target"===t&&"a"===e||"form"===t&&/^(button|fieldset|input|output|select|textarea)$/.test(e),ADD_URI_SAFE_ATTR:["form"]};let uC;const cC={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>bu(e,t),not_regex:(t,e)=>!bu(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},hC=Hr("[Conversations]"),dC="Conversations not available yet.";function vC(t,e){var i,n,s,r,o,l,a;const u=null!==(i=null==t?void 0:t.flushIntervalMs)&&void 0!==i?i:3e3,c=null!==(n=null==t?void 0:t.maxBufferSize)&&void 0!==n?n:100,h=(null==e?void 0:e.consoleCapture)?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,d=Ce(h)?Math.max(c,2048):Math.max(c,h),v=ue(ue({},function(){let t="",e="";try{var i;const n="u">typeof globalThis?globalThis:"u">typeof window?window:void 0,s=null==n||null===(i=n.navigator)||void 0===i?void 0:i.userAgent;s&&([t,e]=Ji(s))}catch(t){}return function(t,e){const i=function(t){if(t)return{}.hasOwnProperty.call(mr,t)?mr[t]:t}(t);return ue(ue({},i?{"os.name":i}:{}),e?{"os.version":e}:{})}(t,e)}()),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(r=null!==(o=null==v?void 0:v["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==r?r:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(l=null==v?void 0:v["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(a=null==v?void 0:v["deployment.environment"])&&void 0!==a?a:null==t?void 0:t.environment,resourceAttributes:v,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:c,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const fC=["debug","log","warn","error","info"],pC="console",gC="__posthogHandledLogsRequestError",mC=(t,e)=>{const i=t instanceof Error?t:new Error(e);return i[gC]=!0,i},yC=t=>!!t&&"object"==typeof t&&!0===t[gC];var bC=class{get Of(){return ue(ue({},this.R),{},{error:(...t)=>{t.some(yC)||this.R.error(...t)}})}constructor(t,e){var i;this.ra=t,this.Ff=e,this.name="logs",this.Lf=!1,this.Df=!1,this.Nf=!1,this.R=Hr("[logs]"),this.Dc=[],this.jf=[],this.Tv=0,this.qf=!1,this.qi=!1,this.Bf=[],this.zf=[],this.Hf=!1,this.Uf=!1,this.Wf=!1,this.Vf=()=>{var t,e;this.qi||(this.Tv=0,null===(t=this.Gf)||void 0===t||t.onReconnect(),null===(e=this.Jf)||void 0===e||e.onReconnect())},this.Lf=!!(null===(i=t.get())||void 0===i?void 0:i.captureConsoleLogs)}get Qf(){return!0}Zf(){}Kf(){if(!this.Wf){try{this.Wv=typeof window>"u"?void 0:window}catch(t){this.Wv=void 0}this.Wv&&(to(this.Wv,"online",this.Vf),this.Wf=!0)}}Yf(t,e,i,n){this.Kf();const s=vC(this.ra.get(),i);return[new Cr(this.Xf(t,e),s,this.Of,()=>this.Ff(),t=>t(),void 0,n),s]}tp(){const t=this.ra.get();var e;return this.Gf&&this.ep===t||(null===(e=this.Gf)||void 0===e||e.reset(),this.ep=t,[this.Gf,this.np]=this.Yf(()=>this.Dc,t=>{this.Dc=t})),this.Gf}sp(){const t=this.ra.get();var e;return this.Jf&&this.rp===t||(null===(e=this.Jf)||void 0===e||e.reset(),this.rp=t,[this.Jf,this.op]=this.Yf(()=>this.jf,t=>{this.jf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},pC)),this.Jf}setup(t){if(!this.qi&&!this.qf)return this.qf=!0,this.ia=t,this.R=t.logger.createLogger("[logs]"),N_(t.kv.initialize(),()=>{this.qi||this.Vv(t)})}Vv(t){var e;this.Kf(),(null===(e=this.ra.get())||void 0===e?void 0:e.captureConsoleLogs)&&(this.Lf=!0),(this.Lf||this.ra.remoteConfigWillArrive&&t.kv.get(this.ra.captureHintKey))&&this.lp();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.qi?n.dispose():(this.ma=n,i||this.loadIfEnabled())}dispose(){var t,e,i,n,s,r,o;this.qi||(this.qi=!0,this.ap(),null===(t=this.ma)||void 0===t||t.dispose(),this.ma=void 0,this.ia=void 0,this.Nf=!1,null===(e=this.Wv)||void 0===e||e.removeEventListener("online",this.Vf),null===(i=this.up)||void 0===i||i.call(this),this.up=void 0,null===(n=this.Gf)||void 0===n||n.clearQueue(),null===(s=this.Jf)||void 0===s||s.clearQueue(),null===(r=this.Gf)||void 0===r||r.reset(),null===(o=this.Jf)||void 0===o||o.reset())}onRemoteConfig(t){var e,i;if(this.qi)return;const n=t.ok?null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs:void 0;Re(n)?this.cp():(null===(i=this.ia)||void 0===i||i.kv.set(this.ra.captureHintKey,!!n),n?(this.Lf=!0,this.Df||this.lp(),this.loadIfEnabled()):this.cp())}reset(){var t,e,i,n;this.ap(),null===(t=this.Gf)||void 0===t||t.clearQueue(),this.Dc=[],null===(e=this.Gf)||void 0===e||e.reset(),null===(i=this.Jf)||void 0===i||i.clearQueue(),this.jf=[],null===(n=this.Jf)||void 0===n||n.reset(),this.Tv=0}captureLog(t){!this.qi&&this.ia&&this.tp().captureLog(t)}captureConsoleLog(t){!this.qi&&this.ia&&this.sp().captureLog(t)}captureBufferedConsoleLog(t,e,i){!this.qi&&this.ia&&this.sp().captureLog(t,{context:e,occurredAtMs:i})}av(){var t;this.ap(),null===(t=this.Jf)||void 0===t||t.clearQueue(),this.jf=[]}cp(){this.Lf||this.ap()}lp(){var t;if(this.Hf||!(null===(t=this.Wv)||void 0===t?void 0:t.console))return;const e=vC(this.ra.get()).maxBufferSize;let i=!0;this.zf.push(()=>{i=!1});for(const t of fC){let n;try{n=Aw(this.Wv.console[t])}catch(t){continue}n&&this.zf.push(wp(this.Wv.console,t,s=>{const r=(...n)=>{try{i&&this.hp(t,n,e)}catch(t){}return s.apply(this.Wv.console,n)};return r.__rrweb_original__=n,r}))}this.Hf=!0,this.dp=setTimeout(()=>{this.ap()},3e4)}hp(t,e,i){var n;if(this.Hf&&!this.Uf&&0!==e.length)if(null===(n=this.ia)||void 0===n?void 0:n.canCapture){if(i>this.Bf.length){this.Uf=!0;try{this.Bf.push({level:t,args:e,occurredAtMs:Date.now(),context:this.Ff()})}finally{this.Uf=!1}}}else this.ap()}ap(){if(this.Bf=[],this.Hf){this.Hf=!1,this.dp&&(clearTimeout(this.dp),this.dp=void 0);for(const t of this.zf)t();this.zf=[]}}vp(){const t=this.Bf;return this.ap(),t}get logger(){return this.fp||(this.fp={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.fp}flushLogs(t){this.ia&&(t?this.pp(t):(this.Gf&&this.Gf.flush().catch(t=>this.gp(t)),this.Jf&&this.Jf.flush().catch(t=>this.gp(t))))}flush(){var t=this;return re(function*(){var e,i;const n=null===(e=t.Gf)||void 0===e?void 0:e.flush().catch(e=>t.gp(e)),s=null===(i=t.Jf)||void 0===i?void 0:i.flush().catch(e=>t.gp(e));yield n,yield s})()}gp(t){yC(t)||this.R.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.qi||!this.Lf||this.Df||this.Nf)return;const t=this.Zf();if(t){this.Nf=!0;try{t((t,e)=>{if(this.Nf=!1,!this.qi&&this.Lf)if(t||!e)this.R.error("Could not load logs script",t),this.ap();else{const t=this.vp();this.up=e.initialize(this.ia),this.Df=!0,t.length>0&&e.replay(this.ia,t)}})}catch(t){throw this.Nf=!1,t}}else this.ap()}Xf(t,e){const i=this.ia;return{get isDisabled(){return!1},get optedOut(){return!i.canCapture},getPersistedProperty:e=>e===ce.LogsQueue?t():void 0,setPersistedProperty(t,i){t===ce.LogsQueue&&e(null!=i?i:[])},Hs:t=>this.Hs(t),getLibraryId:()=>i.library.name,getLibraryVersion:()=>i.library.version}}Hs(t){return new Promise(e=>{if(so(this.Tv,3))return void e({kind:"fatal",error:mC(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const n=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout(()=>{this.R.warn("Logs request timed out before receiving a response"),n({kind:"retry-later",error:mC(void 0,"logs request timed out")})},9e4),r=this.Qf;this.ia.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.ia.projectToken},body:t,compression:"best-available",timeoutMs:6e4}).then(t=>{var e;const i=t.statusCode;this.mp(i,r),i>=200&&300>i?n({kind:"ok"}):413===i?n({kind:"too-large"}):0!==i&&408!==i&&429!==i&&500>i?n({kind:"fatal",error:new Error(`logs request failed with status ${i}`)}):0===i?(t.error||this.R.warn("Logs request failed before receiving an HTTP response"),n({kind:"retry-later",error:mC(t.error,"logs request failed before receiving an HTTP response")})):n({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error(`logs request failed with status ${i}`)})},t=>{n({kind:"retry-later",error:t})})})}mp(t,e){(0!==t||e)&&(this.Tv=ro(t,this.Tv,3,()=>this.R.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.")))}pp(t){this.Dc.length>0&&this.yp(t,this.Dc,this.np,this.ia.library.name,t=>{this.Dc=t}),this.jf.length>0&&this.yp(t,this.jf,this.op,pC,t=>{this.jf=t})}yp(t,e,i,n,s){if(0===e.length)return;const r=e.map(t=>t.record);s([]);const o=Sr(r,kr(i,this.ia.library.name,this.ia.library.version),n,this.ia.library.version);this.ia.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.ia.projectToken},body:o,compression:"best-available",transport:t,timeoutMs:6e4}).catch(t=>this.gp(t))}};const _C=Hr("[NetworkMetrics]"),wC={"http:":80,"https:":443},kC=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),SC=t=>Ee(t)&&0===t.toLowerCase().indexOf("text/event-stream"),xC=t=>{try{return t()}catch(t){return}},$C=(t,e)=>{var i;const n=String(e);return{method:String(t).toUpperCase(),url:(null===(i=io(n))||void 0===i?void 0:i.href)||n}},TC=(t,e,i,n,s,r,o=!1)=>{try{var l,a;const u=s();if(!u)return;const c=i||void 0,h=ww()-n,d=io(e.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;const v={url:(null==d?void 0:d.href)||e.url,method:e.method},f=xe(u.name)?u.name(v):Ee(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=o&&!c?void 0:((t,e)=>t?400>t?void 0:String(t):(null==e?void 0:e.name)||"_OTHER")(c,r),g=ue(ue(ue(ue(ue({},(t=>{const e=kC.has(t)?t:"_OTHER";return ue({"http.request.method":e},"_OTHER"===e&&t!==e?{"http.request.method_original":t}:{})})(v.method)),d?(t=>{return{"server.address":t.hostname.startsWith("[")&&t.hostname.endsWith("]")?t.hostname.slice(1,-1):t.hostname,"server.port":Number(t.port)||wC[t.protocol],"url.scheme":t.protocol.slice(0,-1),"url.template":(e=t.pathname,e.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/"))};var e})(d):{}),c?{"http.response.status_code":c}:{}),p?{"error.type":p}:{}),null===(l=u.attributes)||void 0===l?void 0:l.call(u,v,{status:c,durationMs:h}));null===(a=t.metrics)||void 0===a||a.histogram(f,h,{unit:"ms",attributes:g})}catch(t){_C.error("Failed to record network metric",t)}},CC=()=>{},EC=(e,i)=>xe(null==t?void 0:t.fetch)?wp(t,"fetch",t=>function(...n){const s=ww(),r=t.apply(this,n);if(!i())return r;try{var o,l,a;const[t,u]=n,c=$C(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=>(SC(xC(()=>{var e;return null==t||null===(e=t.headers)||void 0===e?void 0:e.get("content-type")}))||TC(e,c,null==t?void 0:t.status,s,i,void 0,!0),t),t=>{throw TC(e,c,void 0,s,i,t),t})}catch(t){return _C.error("Failed to observe fetch",t),r}}):CC,MC=(e,i)=>{var n;const s=null==t||null===(n=t.XMLHttpRequest)||void 0===n?void 0:n.prototype;if(!s)return CC;const r=new WeakMap,o=wp(s,"open",t=>function(...e){try{(()=>iw.has(this))()||r.set(this,$C(e[0],e[1]))}catch(t){_C.error("Failed to observe XHR open",t)}return t.apply(this,e)}),l=wp(s,"send",t=>function(...n){let s,o;try{const t=r.get(this);if(t&&i()){const n=ww(),r=()=>SC(xC(()=>this.getResponseHeader("content-type")));let l=!1;o=()=>{2===this.readyState&&(l=r())},s=()=>{this.removeEventListener("loadend",s),this.removeEventListener("readystatechange",o),l||r()||TC(e,t,this.status,n,i)},to(this,"readystatechange",o),to(this,"loadend",s)}}catch(t){_C.error("Failed to observe XHR send",t)}try{return t.apply(this,n)}catch(t){throw s&&this.removeEventListener("loadend",s),o&&this.removeEventListener("readystatechange",o),t}});return()=>{o(),l()}},IC=new WeakMap,RC=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),AC={maxStringLength:2048,truncationSuffix:"..."},OC={maxStringLength:2048,truncationSuffix:"..."};function PC(t){if(t)return!0===t?{intent:!0,model:!0}:{intent:!1!==t.intent,model:!1!==t.model}}function FC(t,e){return{}.hasOwnProperty.call(t,e)}function LC(t,e){const i=Object.create(t);return e&&Object.defineProperty(i,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:e}),i}function DC(t,e,i=!1){if(!Ee(t))return;const n=t.trim();return n?(i?ir(n,AC):n).slice(0,e):void 0}function NC(t){try{return $e(t)&&!0===t.isError}catch(t){return!1}}function jC(t){return ir(t||"Unknown error",OC).slice(0,2048)}function qC(t,e){try{return jC(e?function(t){try{if(!$e(t)||!Se(t.content))return;return t.content.filter(t=>$e(t)&&"text"===t.type&&Ee(t.text)).map(t=>t.text).join(" ").trim()||void 0}catch(t){return}}(t):$e(t)&&Ee(t.message)?t.message:Ee(t)?t:String(t))}catch(t){return"Unknown error"}}function BC(t,e,i){return e.errorResult?[{type:"Error",value:i,mechanism:{type:"generic",handled:!0,synthetic:!0,exception_id:0}}]:t.buildProperties(e.error,{handled:!0}).$exception_list.map(t=>ue(ue({},t),{},{value:jC(t.value)}))}function zC(t,e){if(e)return"Error";try{if(!$e(t))return"Error";let e=Ee(t.name)?t.name.trim():"";const i=t.constructor;return e&&"Error"!==e||!xe(i)||"Error"===i.name||(e=i.name),(e||"Error").slice(0,256)}catch(t){return"Error"}}function UC(t,e){return{message:qC(t,e),type:zC(t,e)}}Q$.__defaultExtensionClasses=ue({},{featureFlags:class extends IT{constructor(t){const e=new oC(t.config,t.Fc());super(e),this.name=X_,this._instance=t,this.bp=e}get zv(){return this._instance.persistence}get Bv(){return sC}updateConfig(t,e){this.bp.update(t,e),this.Hv()}},sessionRecording:class{get Yr(){return this._instance.config}get oh(){return this._instance.persistence}get started(){var t;return!!(null===(t=this._p)||void 0===t?void 0:t.isStarted)}get status(){var t,e;return this.isReplayOff?yl:"awaiting_config"===this.wp||"missing_config"===this.wp?this.wp:null!==(t=null===(e=this._p)||void 0===e?void 0:e.status)&&void 0!==t?t:this.wp}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.wp=yl,this.kp=void 0,this.Sp=!1,this.li=void 0,this.un=(()=>{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.gn=()=>{var t,e;"visible"===(null==n?void 0:n.visibilityState)&&(this.un=!0,null===(t=this._p)||void 0===t||null===(e=t.setDocumentWasEverVisible)||void 0===e||e.call(t,!0))},!this._instance.sessionManager)throw rT.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Yr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');const i=this._instance.get_property(ct);var s;Ee(i)&&"!"===i[0]&&(null===(s=this.oh)||void 0===s||s.unregister("$session_is_sampled")),(null==n?void 0:n.addEventListener)&&to(n,"visibilitychange",this.gn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.Sp=!0,null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,"visibilitychange",this.gn),t?this.xp(!0):this.stopRecording()}get $p(){var e;const i=!!(null===(e=this._instance.get_property("$session_recording_remote_config"))||void 0===e?void 0:e.enabled),n=!this.Yr.disable_session_recording,s=this.Yr.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&n&&!s}get isReplayOff(){var t;return!!this.Yr.disable_session_recording||this._instance.consent.isOptedOut()||!1===(null===(t=this._instance.get_property("$session_recording_remote_config"))||void 0===t?void 0:t.enabled)}startIfEnabledOrStop(t){if(this.Sp)return;var e;if(this._p)if(this.li!==(null===(e=this.Yr.session_recording)||void 0===e?void 0:e.selectMaskingFn))nu.Dt(zl(this.Yr)),this._p.discard({discardProducerEvents:!0}),this.li=void 0;else if(this._p.isStarted&&this.$p)return void(this.Cp()||this.xp(!0));const i=!Ce(Object.assign)&&!Ce(Array.from);this.$p&&i?(this.Tp(t),rT.info("starting")):(this.wp=yl,this.stopRecording())}Tp(t){var e,i;if(this.$p)if("awaiting_config"!==this.wp&&"missing_config"!==this.wp&&(this.wp=Sl),(null==h||null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.rrweb)||void 0===e?void 0:e.record)&&(null===(i=h.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this.Mp(t);else{var n;const e=this._instance.sessionManager;null===(n=Ew(this._instance))||void 0===n||n(this._instance,this.Ip,i=>{if(!this.Sp&&this.$p&&this._instance.sessionManager===e)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),rT.error("could not load recorder",i)):void this.Mp(t);this.wp="disabled"})}}stopRecording(){var t,e;null===(t=this.kp)||void 0===t||t.call(this),this.kp=void 0,null===(e=this._p)||void 0===e||e.stop()}xp(t=!1){var e,i,n;t&&(this.li||(null===(e=this.Yr.session_recording)||void 0===e?void 0:e.selectMaskingFn))&&nu.Dt(zl(this.Yr)),null===(i=this.kp)||void 0===i||i.call(this),this.kp=void 0,null===(n=this._p)||void 0===n||n.discard({discardProducerEvents:t}),this.li=void 0}Ep(){var t,e;null===(t=this.oh)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this.oh)||void 0===e||e.unregister("$replay_sample_rate")}Ap(t,e){if(Re(t))return null;const i=Ae(t)?t:parseFloat(t);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(rT.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):i;var n}Rp(t){if(this.oh){var e,i;const n=this.oh,s=()=>{var e;const i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Ap(null===(e=this.Yr.session_recording)||void 0===e?void 0:e.sampleRate,"session_recording.sampleRate"),r=this.Ap(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:r;Re(o)&&this.Ep();const l=null==i?void 0:i.minimumDurationMilliseconds;n.register({[it]: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:Ce(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.kp)||void 0===e||e.call(this),this.kp=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.Rp(e),void this.xp()):(this.Rp(e),void this.startIfEnabledOrStop()):("awaiting_config"===this.wp&&(this.wp="missing_config",this._instance.register_for_session({[jt]:!0}),rT.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var i;(null===(i=this._p)||void 0===i?void 0:i.log)?this._p.log(t,e):rT.warn("log called before recorder was ready")}get Ip(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(it);return(null==i||null===(e=i.scriptConfig)||void 0===e?void 0:e.script)||"lazy-recorder"}Pp(){const t=this._instance.get_property(it);if(!t)return!1;let e;try{e="object"==typeof t?t:JSON.parse(t)}catch(t){return rT.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}Cp(){var t,e,i;return!(null===(t=this.Yr.session_recording)||void 0===t?void 0:t.selectMaskingFn)||!(!0!==(null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.rrweb)||void 0===e||null===(e=e.record)||void 0===e?void 0:e.supportsSelectMasking)||!0!==(null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.initSessionRecording)||void 0===i?void 0:i.supportsSelectMasking)||this._p&&!0!==this._p.supportsSelectMasking)||(this.wp=yl,rT.error("Session recording has not started: the recorder does not support selectMaskingFn."),!1)}Mp(t){var e,i,n,s,r,o;if(this.Sp||!this.$p||!this._instance.sessionManager)return void(this.wp=yl);if(!(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))return rT.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Nt]:!0});if(!this.Cp())return;if(this._p||(this._p=null===(o=h.__PosthogExtensions__)||void 0===o?void 0:o.initSessionRecording(this._instance,this.un),this._p._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Cp())return void this.xp(!0);if(!this.Pp()){if("missing_config"===this.wp||"awaiting_config"===this.wp)return;return this.wp="awaiting_config",rT.info("persisted remote config is stale, requesting fresh config before starting"),void new r$(this._instance).load()}this.wp=Sl,null===(i=(n=this._p).setDocumentWasEverVisible)||void 0===i||i.call(n,this.un);const l=null===(s=this.Yr.session_recording)||void 0===s?void 0:s.selectMaskingFn;this._p.start(t),this.li=l,this._p.isStarted&&l!==(null===(r=this.Yr.session_recording)||void 0===r?void 0:r.selectMaskingFn)&&this.startIfEnabledOrStop()}onRRwebEmit(t){var e,i;null===(e=this._p)||void 0===e||null===(i=e.onRRwebEmit)||void 0===i||i.call(e,t)}overrideLinkedFlag(){var t,e;this._p||null===(e=this.oh)||void 0===e||e.register({$replay_override_linked_flag:!0}),null===(t=this._p)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,e;this._p||null===(e=this.oh)||void 0===e||e.register({$replay_override_sampling:!0}),null===(t=this._p)||void 0===t||t.overrideSampling()}overrideTrigger(t){var e,i;this._p||null===(i=this.oh)||void 0===i||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(e=this._p)||void 0===e||e.overrideTrigger(t)}get sdkDebugProperties(){var t;if(this.isReplayOff)return{$recording_status:yl};const e={};for(const t of oT){var i;const n=null===(i=this._instance.sessionPersistence)||void 0===i?void 0:i.get_property(t);Ce(n)||(e[t]=n)}return ue(ue({},e),(null===(t=this._p)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(t,e){var i;return!!(null===(i=this._p)||void 0===i?void 0:i.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;null===(t=this._p)||void 0===t||null===(e=t.flushBeforeIdentityReset)||void 0===e||e.call(t)}},autocapture:class extends Y_{constructor(t){super(new K$(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.Op=!1,this._instance=t,this.Fp=this.Lp()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.Dp();return!!(t.path||t.search||this.Np(t))}startIfEnabled(){this.isEnabled&&(Ur.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Fp=this.Lp(),this.startIfEnabled()}stop(){this.jp&&this.jp(),this.jp=void 0,this.qp&&this.qp(),this.qp=void 0,Ur.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.Bp("pushState"),this.Bp("replaceState"),this.zp(),this.Np()&&this.Hp())}Bp(e){var i;if(!t||(null===(i=t.history[e])||void 0===i?void 0:i.__posthog_wrapped__))return;const n=this;wp(t.history,e,i=>function(s,r,o){var l;n.Up(o)&&n.Wp(),i.call(this,s,r,o),n.Vp(e,!n.Op&&"popstate"!==(null==t||null===(l=t.event)||void 0===l?void 0:l.type))})}Lp(){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}}Dp(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:$e(t)?t:{}}Np(t=this.Dp()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Gp(t){const e=this.Dp(),i=this.Fp;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.Np(e)&&t.hash!==i.hash))}Vp(t,e=!1){try{e||this.Wp();const i=this.Lp();if(!i)return;if(this.Gp(i)){const i=()=>this._instance.capture(te,{navigation_type:t});e?(this.Jp=i,Promise.resolve().then(()=>this.Wp())):i()}this.Fp=i}catch(e){Ur.error(`Error capturing ${t} pageview`,e)}}Up(e){var i,n;return!(Re(e)||!t)&&(null===(i=io(String(e)))||void 0===i?void 0:i.href)!==(null===(n=t.location)||void 0===n?void 0:n.href)}Wp(){const t=this.Jp;if(t){this.Jp=void 0,this.Op=!0;try{t()}catch(t){Ur.error("Error capturing deferred pageview",t)}finally{this.Op=!1}this.Fp=this.Lp()}}zp(){if(this.jp)return;const e=()=>{this.Vp("popstate")};to(t,"popstate",e),this.jp=()=>{t&&t.removeEventListener("popstate",e)}}Hp(){if(this.qp)return;const e=()=>{this.Vp("hashchange")};to(t,"hashchange",e),this.qp=()=>{t&&t.removeEventListener("hashchange",e)}}},heatmaps:class{get Yr(){return this.instance.config}constructor(t){var e;this.Qp=!1,this.qa=!1,this.Zp=!1,this.Kp=0,this.Yp=null,this.instance=t,this.Qp=!!(null===(e=this.instance.persistence)||void 0===e?void 0:e.props[G]),this.rageclicks=new z_(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return $e(this.Yr.capture_heatmaps)&&this.Yr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Yr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Re(this.Yr.capture_heatmaps)?Re(this.Yr.enable_heatmaps)?this.Qp:this.Yr.enable_heatmaps:!1!==this.Yr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.qa)return;lT.info("starting..."),this.Xp(),this.gn()}else{var t;clearInterval(null!==(t=this.Yp)&&void 0!==t?t:void 0),this.tg(),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({[G]:i}),this.Qp=i,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}discardPending(){this.Kp=Date.now(),clearTimeout(this.eg),this.eg=void 0,this.getAndClearBuffer()}ig(t){aT(t.originalEvent)&&t.timestamp>this.Kp&&this.Jr(t.originalEvent,"deadclick")}gn(){this.Yp&&clearInterval(this.Yp),this.Yp="visible"===(null==n?void 0:n.visibilityState)?setInterval(this.Wc.bind(this),this.flushIntervalMilliseconds):null}Xp(){t&&n&&(this.ng=this.Wc.bind(this),to(t,Xt,this.ng),this.sg=e=>this.Jr(e||(null==t?void 0:t.event)),to(n,"click",this.sg,{capture:!0}),this.rg=e=>this.og(e||(null==t?void 0:t.event)),to(n,"mousemove",this.rg,{capture:!0}),this.lg=new Mx(this.instance,Cx,this.ig.bind(this)),this.lg.startIfEnabledOrStop(),this.ag=this.gn.bind(this),to(n,E,this.ag),this.qa=!0)}tg(){var e;t&&n&&(this.ng&&t.removeEventListener(Xt,this.ng),this.sg&&n.removeEventListener("click",this.sg,{capture:!0}),this.rg&&n.removeEventListener("mousemove",this.rg,{capture:!0}),this.ag&&n.removeEventListener(E,this.ag),clearTimeout(this.eg),this.eg=void 0,null===(e=this.lg)||void 0===e||e.stop(),this.qa=!1)}ug(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&&go(s)&&!mo(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=Mo(s)}return!1}($o(e),["fixed","sticky"],r);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:n),target_fixed:o,type:i}}Jr(t,e="click"){var i;if(po(t.target)||!aT(t)||!this.instance.is_capturing())return;const n=this.ug(t,e);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&Uo($o(t),this.instance.config.rageclick)&&this.Fo(ue(ue({},n),{},{type:"rageclick"})),this.Fo(n)}og(t){!po(t.target)&&aT(t)&&(Ce(this.eg)&&(this.Zp=this.instance.is_capturing()),clearTimeout(this.eg),this.eg=setTimeout(()=>{this.eg=void 0,this.Zp&&this.instance.is_capturing()&&this.Fo(this.ug(t,"mousemove"))},500))}Fo(e){if(!t)return;const i=this.Yr.disable_capture_url_hashes?un(t.location.href):t.location.href,n=this.Yr.custom_personal_data_properties,s=this.Yr.mask_personal_data_properties?[...Lu,...n||[]]:[],r=co(i,s,Nu);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}Wc(){this.Rt&&!Te(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Mx,webVitalsAutocapture:class{constructor(e){var i;this._instance=e,this.Qp=!1,this.qa=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.cg=(t=!1)=>{clearTimeout(this.hg),this.hg=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}),{})),t?{transport:"sendBeacon",send_instantly:!0}:void 0),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.dg=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 tT.error("Invalid metric received",t);const i="string"==typeof t.navigationURL?t.navigationURL:void 0,n=this.vg(i);if(Ce(n))return;const s=Ae(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${n}`;if(this.fg&&t.value>=this.fg)return void tT.error("Ignoring metric with value >= "+this.fg,t);this.Rt.navigationKey!==s&&(this.cg(),this.hg=setTimeout(this.cg,this.flushToCaptureTimeoutMs)),Ce(this.Rt.navigationKey)&&(this.Rt.navigationKey=s,this.Rt.url=n),this.Rt.firstMetricTimestamp=Ce(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const r=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0),o=ue(ue(ue({},t),i?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete o.entries,$e(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const e={};for(const i of sT){const n="url"===i&&"string"==typeof t.attribution[i]?this.vg(t.attribution[i]):t.attribution[i];Ce(n)||(e[i]=n)}o.attribution=e}else delete o.attribution;Ce(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.cg()},this.pg=()=>{if(this.qa)return;let e,i,n,s,r=!1;const o=h.__PosthogExtensions__,l=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,a=(null==l?void 0:l[this.gg])||("web-vitals"===this.gg&&Ce(l)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!Ce(a)){const t=a.withoutAttribution,o=this.attributionMetrics;r=!Ce(t),e=o.indexOf("LCP")>-1?a.onLCP:(null==t?void 0:t.onLCP)||a.onLCP,i=o.indexOf("CLS")>-1?a.onCLS:(null==t?void 0:t.onCLS)||a.onCLS,n=o.indexOf("FCP")>-1?a.onFCP:(null==t?void 0:t.onFCP)||a.onFCP,s=o.indexOf("INP")>-1?a.onINP:(null==t?void 0:t.onINP)||a.onINP}if(!(e&&i&&n&&s))return void tT.error("web vitals callbacks not loaded - not starting");const u={reportSoftNavs:this.useSoftNavs},c=r&&this.attributionMetrics.indexOf("INP")>-1?ue(ue({},u),{},{includeProcessedEventEntries:!1}):u;this.allowedMetrics.indexOf("LCP")>-1&&e(this.dg.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&i(this.dg.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&n(this.dg.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&s(this.dg.bind(this),c);const d=null==t?void 0:t.document;to(d,E,()=>{"hidden"===(null==d?void 0:d.visibilityState)&&this.cg(!0)}),to(t,"pagehide",()=>this.cg(!0)),this.qa=!0},this.Qp=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[K]),this.startIfEnabled()}get mg(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const i=$e(this.mg)?null===(t=this.mg)||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)||iT:i}get flushToCaptureTimeoutMs(){return($e(this.mg)?this.mg.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=$e(this.mg)?this.mg.web_vitals_attribution:void 0;return Pe(t)?t?iT:[]:Se(t)?t:nT}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=$e(this.mg)?this.mg.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get fg(){const t=$e(this.mg)&&Ae(this.mg.__web_vitals_max_value)?this.mg.__web_vitals_max_value:eT;return t>0&&6e4>=t?eT:t}get isEnabled(){const t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return tT.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=$e(this.mg)?this.mg.web_vitals:Pe(this.mg)?this.mg:void 0;return Pe(e)?e:this.Qp}startIfEnabled(){this.isEnabled&&!this.qa&&(tT.info("enabled, starting..."),this.lu(this.pg))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const i=$e(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=$e(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[K]:i}),this._instance.persistence.register({[et]:n})),this.Qp=i,this.startIfEnabled()}get gg(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}lu(t){var e;const i=h.__PosthogExtensions__,n=this.gg,s=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==s?void 0:s[n])||"web-vitals"===n&&Ce(s)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?t():null===(e=Ew(this._instance))||void 0===e||e(this._instance,n,e=>{e?tT.error("failed to load script",e):t()})}vg(e){const i=e||(null==t?void 0:t.location.href);if(!i)return void tT.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?[...Lu,...s||[]]:[];return co(n,r,Nu)}},exceptionObserver:class{constructor(e){var i;this.pg=()=>{var e;if(!t||!this.isEnabled||!(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions))return;const i=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.yg&&this.Yr.capture_unhandled_errors&&(this.yg=i(this.captureException.bind(this))),!this.bg&&this.Yr.capture_unhandled_rejections&&(this.bg=n(this.captureException.bind(this))),!this._g&&this.Yr.capture_console_errors&&(this._g=s(this.captureException.bind(this)))}catch(t){Y$.error("failed to start",t),this.wg()}},this._instance=e,this.kg=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[J]),this.kt=new Ze(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,R:Y$})),this.Yr=this.Sg(),this.startIfEnabledOrStop()}Sg(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return $e(t)?e=ue(ue({},e),t):(Ce(t)?this.kg:t)&&(e=ue(ue({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Yr.capture_console_errors||this.Yr.capture_unhandled_errors||this.Yr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Y$.info("enabled"),this.wg(),this.lu(this.pg)):this.wg()}lu(t){var e,i;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions)?t():null===(i=Ew(this._instance))||void 0===i||i(this._instance,"exception-autocapture",e=>{if(e)return Y$.error("failed to load script",e);t()})}wg(){var t,e,i;null===(t=this.yg)||void 0===t||t.call(this),this.yg=void 0,null===(e=this.bg)||void 0===e||e.call(this),this.bg=void 0,null===(i=this._g)||void 0===i||i.call(this),this._g=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.kg=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[J]:this.kg}),this.Yr=this.Sg(),this.startIfEnabledOrStop())}onConfigChange(){this.Yr=this.Sg()}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.kt.consumeRateLimit(s))return void Y$.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.xg=[],this.$g=Zw(),this._instance=t,this.xg=null!==(e=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==e?e:[],this.Cg=is(this.Tg()),this.Mg=new ns(this.Cg)}onConfigChange(){this.Cg=is(this.Tg()),this.Mg.setConfig(this.Cg)}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.xg=r,this._instance.persistence&&this._instance.persistence.register({[Q]:this.xg,[Z]:o})}get Ig(){var t;const e=!!this._instance.get_property(Z),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.$g.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.Cg.enabled)try{if(!Ee(t)||0===t.trim().length)return void Ww.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)=>ts.has(n)?(e.push(n),i):(i[n]=t[n],i),{}),droppedKeys:e}}(this.Eg(e));n.length>0&&Ww.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Mg.add(ue({[Yn]:t,[Xn]:(new Date).toISOString()},i))}catch(t){Ww.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.Ag(e)){if(this.Rg(e))return this.Pg("Exception dropped: matched a suppression rule"),void Ww.info("Skipping exception capture because a suppression rule matched");if(!this.Ig&&this.Og(e))return this.Pg("Exception dropped: thrown by a browser extension"),void Ww.info("Skipping exception capture because it was thrown by an extension");if(!this.Ig&&this.Fg(e))return this.Pg("Exception dropped: thrown by an injected browser script"),void Ww.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Lg(e))return this.Pg("Exception dropped: thrown by the PostHog SDK"),void Ww.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this.Cg.enabled&&Re(t.$exception_steps)?this.Dg(t):t,n=function(){if("u">typeof process){var t;const e=null===(t=process.env.POSTHOG_RELEASE_ID)||void 0===t?void 0:t.trim();if(e)return e}const e=globalThis._posthogReleaseId;return"string"==typeof e&&e.length>0?e:void 0}();n&&(i.$release_id=n);try{const t=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Qd:!0});return t&&this.Mg.clear(),t}catch(t){return Hw(t)||Ww.error("Failed to capture exception event. Dropping this exception.",t),void this.Mg.clear()}}catch(t){return void(Hw(t)||Ww.error("Failed to process exception event. Ignoring this exception.",t))}}Dg(t){try{const e=this.Mg.getAttachable();return 0===e.length?t:ue(ue({},t),{},{$exception_steps:e})}catch(e){return Ww.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Pg(t){this.Cg.enabled&&this.Mg.add({[Yn]:t,[Xn]:(new Date).toISOString()})}Eg(t){return $e(t)?ue({},t):{}}Tg(){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:{}}Rg(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.xg.some(t=>{const i=t.values.map(t=>{const i=wu[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 Ww.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Og(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&&Jw.some(e=>t.startsWith(e)));return 0!==i.length&&(!i.every(({filename:t})=>!!t&&t.startsWith(Vw))||t.some(({type:t,value:e})=>"NoResponse"===t||Ee(e)&&Gw.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(Vw))))}Fg(t){return t.some(({value:t})=>Ee(t)&&Qw.some(e=>t.includes(e)))}Lg(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}Ag(t){return!Re(t)&&Se(t)}},productTours:class{get oh(){return this._instance.persistence}constructor(t){this.Ng=null,this.jg=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.oh&&this.oh.register({[X]:!!e.productTours}),!cT(this._instance))return!this.Ng&&Re(null===(i=this.oh)||void 0===i?void 0:i.props.ph_product_tours)||uT.info("product tours disabled; stopping and clearing cached tours"),null===(n=this.Ng)||void 0===n||n.stop(),this.Ng=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Ng&&cT(this._instance)&&this.lu(()=>this.qg())}lu(t){var e,i;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)?t():null===(i=Ew(this._instance))||void 0===i||i(this._instance,"product-tours",e=>{e?uT.error("Could not load product tours script",e):t()})}qg(){var t;!this.Ng&&(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.Ng=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(Se(this.jg)&&!e)return void t(this.jg,{isLoaded:!0});const i=this.oh;if(i){const n=i.props[_t];if(Se(n)&&!e)return this.jg=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(!cT(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||uT.warn(i):uT.error(i),void t([],{isLoaded:!1,error:i})}const s=Se(e.json.product_tours)?e.json.product_tours:[];this.jg=s,i&&i.register({[_t]:s}),t(s,{isLoaded:!0})}})}getActiveProductTours(t){Re(this.Ng)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ng.getActiveProductTours(t)}showProductTour(t){var e;null===(e=this.Ng)||void 0===e||e.showTourById(t)}previewTour(t){this.Ng?this.Ng.previewTour(t):this.lu(()=>{var e;this.qg(),null===(e=this.Ng)||void 0===e||e.previewTour(t)})}dismissProductTour(){var t;null===(t=this.Ng)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.Ng)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.Ng)||void 0===t||t.previousStep()}clearCache(){var t;this.jg=null,null===(t=this.oh)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var e;null===(e=this.Ng)||void 0===e||e.resetTour(t)}resetAllTours(){var t;null===(t=this.Ng)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var e;null===(e=this.Ng)||void 0===e||e.cancelPendingTour(t)}},siteApps:class{constructor(t){this._instance=t,this.Bg=0,this.zg=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps&&!this._instance.config.require_subresource_integrity}Hg(t,e){if(!e)return;const i=this.globalsForEvent(e);this.zg.push(i),this.zg.length>1e3&&(this.zg=this.zg.slice(10))}get siteAppLoaders(){var t;return null===(t=h._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this._instance.config.opt_in_site_apps&&!this.isEnabled&&dT.critical("opt_in_site_apps is ignored: require_subresource_integrity disables site apps"),this.isEnabled){const t=this._instance._addCaptureHook(this.Hg.bind(this));this.Ug=()=>{t(),this.zg=[],this.Ug=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")||[],c=this._instance.get_property("$stored_group_properties")||{};for(const[t,e]of Object.entries(c))a[t]={id:u[t],type:t,properties:e};const{$set_once:h,$set:d}=t;return{event:ue(ue({},ws(t,hT)),{},{properties:ue(ue(ue({},t.properties),d?{$set:ue(ue({},null!==(e=null===(i=t.properties)||void 0===i?void 0:i.$set)&&void 0!==e?e:{}),d)}:{}),h?{$set_once:ue(ue({},null!==(n=null===(s=t.properties)||void 0===s?void 0:s.$set_once)&&void 0!==n?n:{}),h)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(l=t.properties)||void 0===l?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:a}}Wg(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)||(dT.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)||(dT.error("prepare_external_dependency_script returned null"),null)}return t}Vg(){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,c=null==u||null===(t=u.Node)||void 0===t?void 0:t.prototype;if(!u||!c)return()=>{};if(this.Bg++,this.Gg)return this.Jg();const h=[],d=this,v=new WeakSet,f=(t,e,i)=>{if(!(null==t?void 0:t[e]))return;const n=t[e];t[e]=i(n),h.push(()=>{t[e]=n})},p=t=>{if(v.has(t))return t;const e=d.Wg(t);return e&&v.add(e),e},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!Ie(t));return f(c,"appendChild",t=>function(e){const i=p(e);return i?t.call(this,i):e}),f(c,"insertBefore",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):e}),f(c,"replaceChild",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):i}),[null===(e=u.Element)||void 0===e?void 0:e.prototype,null===(i=u.Document)||void 0===i?void 0:i.prototype,null===(s=u.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(t=>{f(t,"append",t=>function(...e){return t.apply(this,g(e))}),f(t,"prepend",t=>function(...e){return t.apply(this,g(e))})}),[null===(r=u.Element)||void 0===r?void 0:r.prototype,null===(o=u.CharacterData)||void 0===o?void 0:o.prototype,null===(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.Gg=()=>{h.forEach(t=>t()),this.Gg=void 0},this.Jg()}Jg(){let t=!1;return()=>{var e;t||(t=!0,this.Bg--,0===this.Bg&&(null===(e=this.Gg)||void 0===e||e.call(this)))}}Qg(t,e=!0){const i=this.Vg();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.zg.length&&(dT.info(`Processing ${this.zg.length} events for site app with id ${t.id}`),this.zg.forEach(t=>this.Qg(()=>{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.Ug)||void 0===i||i.call(this))};let n=!1;const s=s=>{e.errored=!s,e.loaded=!0,dT.info(`Site app with id ${t.id} ${s?"loaded":"errored"}`),n&&i()};try{const{processEvent:i}=this.Qg(e=>t.init({posthog:this._instance,callback(t){e(),s(t)}}),!1);i&&(e.processEvent=i),n=!0}catch(e){dT.error(vT+t.id,e),s(!1)}if(n&&e.loaded)try{i()}catch(i){dT.error(`Error while processing buffered events PostHog app with config id ${t.id}`,i),e.errored=!0}}Zg(){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)}Kg(t){if(0===Object.keys(this.apps).length)return;const e=this.globalsForEvent(t);for(const i of Object.values(this.apps))try{this.Qg(()=>{var t;return null===(t=i.processEvent)||void 0===t?void 0:t.call(i,e)})}catch(e){dT.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.Zg(),void this._instance.on("eventCaptured",t=>this.Kg(t))):void dT.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this.Ug)||void 0===i||i.call(this),!t.ok)return;const s=t.config;if(null===(n=s.siteApps)||void 0===n?void 0:n.length)if(this.isEnabled)for(const{id:t,url:e}of s.siteApps){var r,o;h[`__$$ph_site_app_${t}`]=this._instance,null===(r=h.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,e,e=>{if(e)return dT.error(vT+t,e)})}else dT.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},surveys:class extends B_{constructor(t){super(new Mw(t))}},tracingHeaders:class{constructor(t){this._instance=t,this.Yg=void 0,this.Xg=void 0,this.tm=void 0,this.im=void 0,this.nm=[],this.pg=()=>{const{hostnames:t,traceparentTargets:e}=this.sm();var i,n;t||e?(t||Se(this.tm)||(this.tm=[]),this.im!==this.tm&&(this.wg(),this.im=this.tm),Ce(this.Yg)&&(this.Yg=null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchXHR(this.tm,()=>this._instance.get_distinct_id(),this._instance.sessionManager,this.nm)),Ce(this.Xg)&&(this.Xg=null===(n=h.__PosthogExtensions__)||void 0===n||null===(n=n.tracingHeadersPatchFns)||void 0===n?void 0:n._patchFetch(this.tm,()=>this._instance.get_distinct_id(),this._instance.sessionManager,this.nm))):this.wg()}}initialize(){this.startIfEnabledOrStop()}lu(t){var e,i;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.tracingHeadersPatchFns)?t():null===(i=Ew(this._instance))||void 0===i||i(this._instance,"tracing-headers",e=>{if(e)return X$.error("failed to load script",e);t()})}rm(){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}om(){const t=this.rm();return Se(t)?(Se(this.tm)?this.tm.splice(0,this.tm.length,...t):this.tm=[...t],t.length>0?this.tm:void 0):!Se(this.tm)||(this.tm.splice(0),t)?(this.tm=t||void 0,this.tm):void 0}lm(){const t=this._instance.config.trace_propagation_targets,e=Se(t)?t.filter(t=>Ee(t)&&!!t):[];return this.nm.splice(0,this.nm.length,...e),e.length>0?this.nm:void 0}sm(){return{hostnames:this.om(),traceparentTargets:this.lm()}}wg(){var t,e;null===(t=this.Yg)||void 0===t||t.call(this),null===(e=this.Xg)||void 0===e||e.call(this),this.Yg=void 0,this.Xg=void 0}startIfEnabledOrStop(){const{hostnames:t,traceparentTargets:e}=this.sm();t||e?this.lu(this.pg):this.wg()}},toolbar:class{constructor(t){this.instance=t}am(t){h.ph_toolbar_state=t}um(){var t;return null!==(t=h.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,i=void 0,s=void 0){var r,o;if(eo(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=fT||ho(e.hash,"__posthog")||ho(e.hash,"state");let r;const o=n?cn(()=>JSON.parse(atob(decodeURIComponent(n))))||cn(()=>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(pT)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}hm(t){const e=h.ph_load_toolbar||h.ph_load_editor;!Re(e)&&xe(e)?e(t,this.instance):gT.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(pT,JSON.stringify(ue(ue({},r),{},{source:void 0}))),2===this.um())this.hm(r);else if(0===this.um()){var o;this.am(1),null===(o=Ew(this.instance))||void 0===o||o(this.instance,"toolbar",t=>{if(t)return gT.error("[Toolbar] Failed to load",t),void this.am(0);this.am(2),this.hm(r)}),to(t,"turbolinks:load",()=>{this.am(0),this.loadToolbar(r)})}return!0}dm(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,i=void 0){return this.maybeLoadToolbar(t,e,i)}},experiments:class e{get Yr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.vm("retrieved web experiments from the server"),this.fm=new Map,t.forEach(t=>{if(t.feature_flag_key){var i;this.fm&&(e.vm("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=this.fm)||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.pm(t,n)}else if(t.variants)for(const i in t.variants){const n=t.variants[i];e.gm(n,this._instance)&&this.ym(t.name,i,n.transforms)}})},t)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.vm(lC);else if(!this.Yr.disable_web_experiments){if(Re(this.fm))return this.fm=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.vm("applying feature flags",t),t.forEach(t=>{var e;if(this.fm&&(null===(e=this.fm)||void 0===e?void 0:e.has(t))){var i;const e=this._instance.getFeatureFlag(t),n=null===(i=this.fm)||void 0===i?void 0:i.get(t);e&&(null==n?void 0:n.variants[e])&&this.pm(n,e)}})}}previewWebExperiment(){const t=e.getWindowLocation();if(null==t?void 0:t.search){const i=uo(null==t?void 0:t.search,"__experiment_id"),n=uo(null==t?void 0:t.search,"__experiment_variant");i&&n&&(e.vm(`previewing web experiments ${i} && ${n}`),this.getWebExperiments(t=>{this.bm(parseInt(i),n,t)},!1,!0))}}loadIfEnabled(){this.Yr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Yr.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.Yr.token}`),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}bm(t,i,n){const s=n.filter(e=>e.id===t);s&&s.length>0&&(e.vm(`Previewing web experiment [${s[0].name}] with variant [${i}]`),this.ym(s[0].name,i,s[0].variants[i].transforms))}pm(t,i){const n=t.variants[i];e._m(n,this._instance)?this.ym(t.name,i,n.transforms):e.vm(`skipping variant ${i} of experiment ${t.name} because this page does not match its url conditions`)}static gm(t,i){return!Re(t.conditions)&&e._m(t,i)&&e.wm(t)}static _m(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=vo(i,s.href);return!(null===(r=t.conditions)||void 0===r?void 0:r.url)||cC[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 wm(t){var e;if(Re(t.conditions)||Re(null===(e=t.conditions)||void 0===e?void 0:e.utm))return!0;const i=qu();if(i.utm_source){var n,s,r,o,l,a,u,c;const e=!(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)||(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)==i.utm_campaign,h=!(null===(r=t.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=t.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==i.utm_source,d=!(null===(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===(c=t.conditions)||void 0===c||null===(c=c.utm)||void 0===c?void 0:c.utm_term)==i.utm_term;return e&&d&&v&&h}return!1}static vm(t,...e){Ur.info(`[WebExperiments] ${t}`,e)}static km(t,...e){Ur.warn(`[WebExperiments] ${t}`,e)}static Sm(t){("http://www.w3.org/1999/xhtml"===t.namespaceURI&&"template"===t.localName?t.content:t).querySelectorAll("a[target], template").forEach(t=>{var i;if("template"===t.localName)return void("http://www.w3.org/1999/xhtml"===t.namespaceURI&&e.Sm(t));if("http://www.w3.org/1999/xhtml"!==t.namespaceURI||"_blank"!==(null===(i=t.getAttribute("target"))||void 0===i?void 0:i.toLowerCase()))return void t.removeAttribute("target");const n=(t.getAttribute("rel")||"").split(/\s+/).filter(t=>t&&!/^(opener|noopener)$/i.test(t));n.push("noopener"),t.setAttribute("rel",n.join(" "))})}ym(t,i,n){this._is_bot()?e.vm(lC):"control"!==i?n.forEach(n=>{if(n.selector){var s;e.vm(`applying transform of variant ${i} for experiment ${t} `,n);const r=null===(s=document)||void 0===s?void 0:s.querySelectorAll(n.selector);if(!(null==r?void 0:r.length))return void e.km(`no element on this page matches selector ${n.selector} of variant ${i} for experiment ${t}`);const o=new Map;null==r||r.forEach(t=>{if("script"===t.localName.toLowerCase())return;const i=t;if(n.html){var s;const l="http://www.w3.org/1998/Math/MathML"===t.namespaceURI&&"annotation-xml"===t.localName&&(null===(s=t.getAttribute("encoding"))||void 0===s?void 0:s.toLowerCase())||"",a=JSON.stringify([t.namespaceURI,t.localName,l]);let u=o.get(a);if(Re(u)){var r;const i=null!==(r=uC)&&void 0!==r?r:uC=cb(),s=t.ownerDocument.implementation.createHTMLDocument(""),c=s.createElementNS(t.namespaceURI,t.localName);l&&c.setAttribute("encoding",l);const h=s.createRange();h.selectNodeContents(c);const d="http://www.w3.org/2000/svg"===t.namespaceURI&&/^(foreignObject|desc|title)$/.test(t.localName)||/^(text\/html|application\/xhtml\+xml)$/.test(l)?"http://www.w3.org/1999/xhtml":t.namespaceURI,v=h.createContextualFragment(n.html);"http://www.w3.org/1998/Math/MathML"===t.namespaceURI&&/^(mi|mo|mn|ms|mtext)$/.test(t.localName)?(c.appendChild(v),i.sanitize(c,ue(ue({},aC),{},{NAMESPACE:d||void 0,IN_PLACE:!0}))):("http://www.w3.org/1999/xhtml"===c.namespaceURI&&"template"===c.localName?c.content:c).appendChild(i.sanitize(v,ue(ue({},aC),{},{NAMESPACE:d||void 0,RETURN_DOM_FRAGMENT:!0}))),e.Sm(c),u=c.innerHTML,o.set(a,u)}i.innerHTML=u}n.css&&i.setAttribute("style",n.css)})}}):e.vm("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?y$(i,this.Yr.custom_blocked_useragents):void 0}},conversations:class{constructor(t){this._instance=t,this.xm=void 0,this._conversationsManager=null,this.$m=!1,this.ie=null,this.Cm=!1,this.Tm=0,this.Mm=null,this.Im=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return void(this.Mm=null);if(this.Em=t.ok,!t.ok)return;const e=t.config.conversations;Re(e)?this.Mm=null:(Pe(e)?this.xm=e:(this.xm=e.enabled,this.ie=e),this.xm||(this.Mm=null),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.Tm++,this.xm=void 0,this.ie=null,this.Em=void 0,this.Cm=!1,this.Mm=null}loadIfEnabled(){if(this._conversationsManager)return;if(this.$m)return;if(this._instance.config.disable_conversations)return;if(eo(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==h?void 0:h.__PosthogExtensions__;if(t&&!Ce(this.xm)&&this.xm)if(this.ie&&this.ie.token){this.$m=!0;try{const e=t.initConversations;if(e)return this.Am(e),void(this.$m=!1);const i=Ew(this._instance);if(!i)return void this.Rm(A);const n=this.Tm;i(this._instance,"conversations",e=>{if(n!==this.Tm)return this.$m=!1,void this.loadIfEnabled();e||!t.initConversations?this.Rm("Could not load conversations script",e):this.Am(t.initConversations),this.$m=!1})}catch(t){this.Rm("Error initializing conversations",t),this.$m=!1}}else hC.error("Conversations enabled but missing token in remote config.")}Am(t){if(this.ie){try{this._conversationsManager=t(this.ie,this._instance),this.Cm=!1,hC.info("Conversations loaded successfully")}catch(t){return void this.Rm("Error completing conversations initialization",t)}this.Im&&this._conversationsManager.setTheme(this.Im),this.Pm()}else hC.error("Cannot complete initialization: remote config is null")}Pm(){const t=this.Mm;this.Mm=null,this._conversationsManager&&t&&("open"===t?this._conversationsManager.open():this._conversationsManager.close())}Rm(t,e){hC.error(t,e),this._conversationsManager=null,this.$m=!1,this.Cm=!0}show(){this._conversationsManager?this._conversationsManager.show():hC.warn("Conversations not loaded yet.")}hide(){"open"===this.Mm&&(this.Mm=null),this._conversationsManager&&this._conversationsManager.hide()}open(){this._conversationsManager?(this.Mm=null,this._conversationsManager.open()):this.Mm="open"}close(){this._conversationsManager?(this.Mm=null,this._conversationsManager.close()):this.Mm="close"}setTheme(t){var e,i;this.Im=ue(ue(ue({},this.Im),t),{},{dark:ue(ue({},null===(e=this.Im)||void 0===e?void 0:e.dark),null==t?void 0:t.dark)}),null===(i=this._conversationsManager)||void 0===i||i.setTheme(t)}isAvailable(){return!0===this.xm&&!Ie(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":eo(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Em?"remote_config_failed":Ce(this.xm)?this.Em?"disabled_in_project":"remote_config_pending":this.xm?Re(this.ie)||!this.ie.token?"missing_token":(null==h?void 0:h.__PosthogExtensions__)?this.$m?"initializing":this.Cm?"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):(hC.warn(dC),null)})()}getMessages(t,e){var i=this;return re(function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(hC.warn(dC),null)})()}markAsRead(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(hC.warn(dC),null)})()}getTickets(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(hC.warn(dC),null)})()}requestRestoreLink(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(hC.warn(dC),null)})()}restoreFromToken(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(hC.warn(dC),null)})()}restoreFromUrlToken(){var t=this;return re(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(hC.warn(dC),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}rv(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}ov(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}},logs:class extends bC{constructor(t){super({get(){var e;return null==t||null===(e=t.config)||void 0===e?void 0:e.logs},captureHintKey:tt,get remoteConfigWillArrive(){var e,i;return!(null===(e=t.Fc)||void 0===e?void 0:e.call(t))||!!(null===(i=h._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[t.config.token])||void 0===i?void 0:i.config)}},()=>function(t){var e;const i={};if(i.distinctId=t.get_distinct_id(),t.sessionManager){const{sessionId:e,windowId:n,sessionStartTimestamp:s,lastActivityTimestamp:r}=t.sessionManager.checkAndGetSessionAndWindowId(!0);i.sessionId=e,i.windowId=n,Re(s)||(i.sessionStartTimestamp=s),Re(r)||(i.lastActivityTimestamp=r)}if((null==h||null===(e=h.location)||void 0===e?void 0:e.href)&&(i.currentUrl=t.config.disable_capture_url_hashes?un(h.location.href):h.location.href),t.featureFlags){const e=t.featureFlags.getFlags();e&&e.length>0&&(i.activeFeatureFlags=e)}return i}(t)),this._instance=t,this.name=tw,this.Kf()}get Qf(){return this._instance.__loaded}Zf(){const t=Hr("[logs]"),e=null==h?void 0:h.__PosthogExtensions__;if(!e)return void t.error("PostHog Extensions not found.");const i=Ew(this._instance);if(i)return t=>{i(this._instance,"logs",i=>{const n=e.logs;t(i,(null==n?void 0:n.initializeLogs)?{initialize:t=>n.initializeLogs(t),replay(t,e){var i;return null===(i=n.replayConsoleBuffer)||void 0===i?void 0:i.call(n,t,e)}}:void 0)})};t.error(A)}},metrics:class{constructor(t){this._instance=t,this.R=Hr("[metrics]"),this.qi=!1,this.Om=!1,this.gn=()=>{"hidden"===(null==n?void 0:n.visibilityState)&&this.flush()}}initialize(){this.onConfigChange(),this.qi||this.Om||!(null==n?void 0:n.addEventListener)||(to(n,"visibilitychange",this.gn),this.Om=!0)}onConfigChange(){var t;if(this.qi)return;const e=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);e&&!this.Fm?this.Fm=(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=EC(t,i),s=MC(t,i);return()=>{e=!1,n(),s()}})(this._instance):!e&&this.Fm&&(this.Fm(),this.Fm=void 0)}tp(){var t;if(this.qi)return;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;if(!this.Gf||this.ep!==e){var i;null===(i=this.Gf)||void 0===i||i.reset(),this.ep=e;const t=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);Ce(null==e?void 0:e.flushIntervalMs)&&(t.flushIntervalMs=6e4),this.Gf=new Fr(this.Xf(),t,this.R)}return this.Gf}count(t,e=1,i){var n;null===(n=this.tp())||void 0===n||n.count(t,e,i)}gauge(t,e,i){var n;null===(n=this.tp())||void 0===n||n.gauge(t,e,i)}histogram(t,e,i){var n;null===(n=this.tp())||void 0===n||n.histogram(t,e,i)}flush(t){if(!this.Gf)return Promise.resolve();if(t){const e=this.Gf.drainWindow();return e&&this.Go(e,t),Promise.resolve()}return this.Gf.flush().catch(t=>this.R.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.Gf)||void 0===t||t.reset()}dispose(){var t,e,i;this.qi=!0,null==n||null===(t=n.removeEventListener)||void 0===t||t.call(n,"visibilitychange",this.gn),this.Om=!1,null===(e=this.Fm)||void 0===e||e.call(this),this.Fm=void 0,null===(i=this.Gf)||void 0===i||i.reset()}Xf(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Go:t=>e.Go(t),getLibraryId:()=>su.LIB_NAME,getLibraryVersion:()=>su.LIB_VERSION}}Go(t,e){return new Promise(i=>{let s=!1;const r=t=>{s||(s=!0,clearTimeout(o),i(t))},o=setTimeout(()=>r({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(ue(ue(ue({method:"POST",url:this.Lm(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e}),"hidden"===(null==n?void 0:n.visibilityState)&&{preferSyncCompression:!0}),{},{fireCallbackOnDrop:!0,callback(t){const e=t.statusCode;if(e>=200&&300>e)r({kind:"ok"});else if(413===e)r({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)r({kind:"fatal",error:new Error(`metrics request failed with status ${e}`)});else{var i;r({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`metrics request failed with status ${e}`)})}}}))})}Lm(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}},webMCP:class{constructor(t){this._instance=t,this.Dm=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.Dm)return;const t=null==n?void 0:n.modelContext;if(!t||!xe(t.registerTool))return;const e=IC.get(t);if(e)return e.instances.add(this._instance),void(this.Dm=!0);const i={instances:new Set([this._instance])},s=t.registerTool,r=this;wp(t,"registerTool",t=>{const e=t;return function(t,...n){let s=t;try{s=r.Nm(t,i)}catch(i){return e.call(this,t,...n)}return e.call(this,s,...n)}}),t.registerTool!==s&&(IC.set(t,i),this.Dm=!0)}Nm(t,e){if(!t||!xe(t.execute))return t;const i=t.execute,n=this,{tool:s,injected:r}=function(t,e){const i={intent:!1,model:!1},n=t.inputSchema;if(!function(t){return!!Ce(t)||$e(t)&&Object.keys(t).every(t=>RC.has(t)||t.startsWith("x-"))&&!0!==t.additionalProperties&&!$e(t.additionalProperties)&&(!t.type||"object"===t.type)&&(!t.properties||$e(t.properties))&&(!t.required||Se(t.required))}(n))return{tool:LC(t),injected:i};const s=(null==n?void 0:n.properties)||{},r=t=>FC(s,t)||Se(null==n?void 0:n.required)&&n.required.includes(t);if(i.intent=e.intent&&!r("context"),i.model=e.model&&!r("llm_model"),!i.intent&&!i.model)return{tool:LC(t),injected:i};const o=ue({},s),l=Se(null==n?void 0:n.required)?[...n.required]:[];return i.intent&&(o.context={type:"string",description:'Explain why this tool is called and how it supports the user\'s goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".'},l.includes("context")||l.push("context")),i.model&&(o.llm_model={type:"string",description:'The model identifier you are running as, for example "claude-opus-4-8" or "gpt-5.2". Pass "unknown" if you are not certain. Recorded for the site developer\'s analytics.'},l.includes("llm_model")||l.push("llm_model")),{tool:LC(t,ue(ue({},n),{},{type:(null==n?void 0:n.type)||"object",properties:o,required:l})),injected:i}}(t,function(t){const e={intent:!1,model:!1};for(const i of t.instances){const t=PC(i.config.capture_webmcp);e.intent||(e.intent=!0===(null==t?void 0:t.intent)),e.model||(e.model=!0===(null==t?void 0:t.model))}return e}(e));return Object.defineProperty(s,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...o){const l=new Date,a=function(t,e){if(!$e(t))return{};try{const i=e.intent?DC(t.context,2048,!0):void 0,n=e.model?DC(t.llm_model,256):void 0;return ue(ue({},i&&"{}"!==i?{intent:i}:{}),n&&"unknown"!==n.toLowerCase()?{model:n}:{})}catch(t){return{}}}(o[0],r),u=function(t,e){const i=t[0];if(!$e(i))return t;try{const n=e.intent&&FC(i,"context"),s=e.model&&FC(i,"llm_model");if(!n&&!s)return t;const r=ue({},i);return n&&delete r.context,s&&delete r.llm_model,[r,...t.slice(1)]}catch(e){return t}}(o,r);let c;try{c=i.apply(this===s?t:this,u)}catch(t){throw n.jm(e,s,l,{error:t,errorResult:!1},a),t}if((h=c)&&"function"==typeof h.then)return Promise.resolve(c).then(t=>{const i=NC(t)?{error:t,errorResult:!0}:void 0;return n.jm(e,s,l,i,a),t},t=>{throw n.jm(e,s,l,{error:t,errorResult:!1},a),t});var h;const d=NC(c)?{error:c,errorResult:!0}:void 0;return n.jm(e,s,l,d,a),c}}),s}jm(t,e,i,n,r){const o=Date.now()-i.getTime();let l;for(const u of t.instances){var a;const t=PC(u.config.capture_webmcp);if(t){n&&!l&&(l=UC(n.error,n.errorResult));try{u.capture("$mcp_tool_call",ue(ue(ue({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:e.name,$mcp_resource_name:e.name,$mcp_tool_description:e.description,$mcp_server_name:null==s?void 0:s.hostname,$mcp_duration_ms:o,$mcp_is_error:!!n},l?{$mcp_error_type:l.type,$mcp_error_message:l.message}:{}),t.intent&&r.intent?{$mcp_intent:r.intent,$mcp_intent_source:"context_parameter"}:{}),t.model&&r.model?{$mcp_llm_model:r.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:i})}catch(t){continue}if(n&&l&&u.exceptions&&(null===(a=u.exceptionObserver)||void 0===a?void 0:a.isEnabled))try{const t={$exception_list:BC(u.exceptions,n,l.message),$exception_level:"error",$exception_source:"mcp.tool_call",$mcp_interface:"webmcp",$mcp_tool_name:e.name,$mcp_resource_name:e.name,$mcp_tool_description:e.description,$mcp_server_name:null==s?void 0:s.hostname};u.exceptionObserver.captureException(t)}catch(t){}}}}}});const HC=function(){su.SDK_DIST_CHANNEL="npm";const e=E$[z$]=new Q$;return function(){function e(){e.done||(e.done=!0,o$=!1,Vr(E$,function(t){t._dom_loaded()}))}(null==n?void 0:n.addEventListener)?"complete"===n.readyState?e():to(n,"DOMContentLoaded",e,{capture:!1}):t&&Ur.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();var WC=HC;exports.Compression=R_,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=Em,exports.PostHog=Q$,exports.ProductTourEventName=t$,exports.ProductTourEventProperties=e$,exports.SurveyEventName=Tm,exports.SurveyEventProperties=Cm,exports.SurveyEventType=ym,exports.SurveyPosition=_m,exports.SurveyQuestionBranchingType=xm,exports.SurveyQuestionType=Sm,exports.SurveySchedule=$m,exports.SurveyTabPosition=wm,exports.SurveyType=km,exports.SurveyWidgetType=bm,exports.default=WC,exports.posthog=HC,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,c="undefined"!=typeof globalThis?globalThis:t;c&&"undefined"==typeof self&&(c.self=c),c&&"undefined"==typeof File&&(c.File=function(){});const h=null!=t?t:{},d="$early_access_features",v="$active_feature_flags",f="$feature_flag_details",p="$feature_flag_errors",g="$feature_flag_evaluated_at",m="$feature_flag_request_id",y="$minimal_flag_called_events",b="$enabled_feature_flags",_="$stored_group_properties",w="$stored_person_properties",k="$flag_call_reported",S="$flag_call_reported_session_id",x="$feature_flag_payloads",T="$override_feature_flags",C="$override_feature_flag_payloads",E="visibilitychange",M="$autocapture_disabled_server_side",I="$surveys",R="$surveys_loaded_at",A="PostHog loadExternalDependency extension not found.",O="$surveys_activated",P="$surveys_activated_session",F="$surveys_activated_timestamps",L="$people_distinct_id",D="distinct_id",N="$device_id",j="$device_model",q="__alias",B="__cmpns",z="$fbc",U="$fbc_persistence",H="$fbp",W="$fbp_persistence",V="__timers",G="$heatmaps_enabled_server_side",J="$exception_capture_enabled_server_side",Q="$error_tracking_suppression_rules",Z="$error_tracking_capture_extension_exceptions",K="$web_vitals_enabled_server_side",Y="$dead_clicks_enabled_server_side",X="$product_tours_enabled_server_side",tt="$logs_capture_enabled_server_side",et="$web_vitals_allowed_metrics",it="$session_recording_remote_config",nt="$session_recording_enabled_server_side",st="$replay_sample_rate",rt="$replay_override_sampling",ot="$replay_override_linked_flag",lt="$replay_override_url_trigger",at="$replay_override_event_trigger",ut="$sesid",ct="$session_is_sampled",ht="$session_past_minimum_duration",dt="$session_recording_url_trigger_activated_session",vt="$session_recording_event_trigger_activated_session",ft="$posthog_sr_group_event_trigger_",pt="$posthog_sr_group_url_trigger_",gt="$posthog_sr_group_sampling_",mt="$debug_first_full_snapshot_timestamp",yt="$sess_rec_flush_size",bt="$groups",_t="ph_product_tours",wt="$product_tours_activated",kt="$product_tours_activated_session",St="$conversations_widget_session_id",xt="$conversations_ticket_id",$t="$conversations_widget_state",Tt="$conversations_user_traits",Ct="$user_state",Et="$client_session_props",Mt="$capture_rate_limit",It="$initial_campaign_params",Rt="$initial_referrer_info",At="$initial_person_info",Ot="$epp",Pt="$posthog_cookieless",Ft="$cookieless_mode",Lt="$sdk_debug_extensions_init_method",Dt="$sdk_debug_extensions_init_time_ms",Nt="$sdk_debug_recording_script_not_loaded",jt="$sdk_debug_replay_stale_config",qt="$sdk_debug_replay_event_trigger_status",Bt="$sdk_debug_replay_linked_flag_trigger_status",zt="$sdk_debug_replay_matched_recording_trigger_groups",Ut="$sdk_debug_replay_pending_trigger_conditions",Ht="$sdk_debug_replay_remote_trigger_matching_config",Wt="$sdk_debug_replay_trigger_groups_count",Vt="$sdk_debug_replay_url_trigger_status",Gt="$sdk_debug_rrweb_attached",Jt="$sdk_debug_rrweb_start_attempted",Qt="$session_recording_start_reason",Zt="anonymous",Kt="identified",Yt="identified_only",Xt="beforeunload",te="$pageview",ee="$pageleave",ie="$identify",ne="$groupidentify";function se(t,e,i,n,s,r,o){try{var 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 ce=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),he=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const de="min_length",ve="max_length",fe=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],pe=["token"];function ge(t,e){return-1!==t.indexOf(e)}const me=function(t){return t.trim()},ye=function(t){return t.replace(/^\$/,"")};function be(t){var e;const i=[];return null!==(e=JSON.stringify(t,function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(e))return"[Circular]";i.push(e)}return e}}))&&void 0!==e?e:"null"}const _e=Object.prototype,we=_e.hasOwnProperty,ke=_e.toString,Se=Array.isArray||function(t){return"[object Array]"===ke.call(t)},xe=t=>"function"==typeof t,$e=t=>t===Object(t)&&!Se(t),Te=t=>{if($e(t)){for(const e in t)if(we.call(t,e))return!1;return!0}return!1},Ce=t=>void 0===t,Ee=t=>"[object String]"==ke.call(t),Me=t=>Ee(t)&&0===t.trim().length,Ie=t=>null===t,Re=t=>Ce(t)||Ie(t),Ae=t=>"[object Number]"==ke.call(t)&&t==t,Oe=t=>Ae(t)&&t>0,Pe=t=>"[object Boolean]"===ke.call(t),Fe=t=>t instanceof FormData,Le=t=>ge(fe,t),De=t=>ge(pe,t);function Ne(t){return null===t||"object"!=typeof t}function je(t,e){return{}.toString.call(t)===`[object ${e}]`}function qe(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return ze(t,Error)}}function Be(t){return"u">typeof Event&&ze(t,Event)}function ze(t,e){try{return t instanceof e}catch(t){return!1}}const Ue=[!0,"true",1,"1","yes"],He=t=>ge(Ue,t),We=[!1,"false",0,"0","no"],Ve=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","lightpanda","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Ge=new Map,Je=function(t,e=[]){if(!t)return!1;const i=function(t,e){let i="";for(let t=0;e.length>t;t++){const n=e[t];i+=n.length+":"+n}return t.length+":"+t+"|"+e.length+":"+i}(t,e),n=Ge.get(i);if(void 0!==n)return n;const s=t.toLowerCase(),r=Ve.concat(e).some(t=>-1!==s.indexOf(t.toLowerCase()));return 256>Ge.size||Ge.clear(),Ge.set(i,r),r};function Qe(t,e,i,n,s){return e>i&&(n.warn("min cannot be greater than max."),e=i),Ae(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),Qe(null!=s?s:i,e,i,n))}var Ze=class{constructor(t){this.C={},this.I=t.I,this.A=Qe(t.bucketSize,0,100,t.R),this.O=Qe(t.refillRate,0,this.A,t.R),this.$=Qe(t.refillInterval,0,864e5,t.R)}F(t,e){const i=Math.floor((e-t.lastAccess)/this.$);i>0&&(t.tokens=Math.min(t.tokens+i*this.O,this.A),t.lastAccess=t.lastAccess+i*this.$)}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.A,lastAccess:i},this.C[n]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null===(e=this.I)||void 0===e||e.call(this,t)),0===s.tokens)}stop(){this.C={}}};const Ke="Mobile",Ye="Android",Xe="Tablet",ti="Android Tablet",ei="iPad",ii="Apple Watch",ni="Safari",si="BlackBerry",ri="Samsung Internet",oi="Chrome",li="Chrome iOS",ai="Internet Explorer",ui="Internet Explorer Mobile",ci="Opera",hi="Microsoft Edge",di="Firefox",vi="Firefox iOS",fi="Nintendo",pi="PlayStation",gi="Xbox",mi="Android Mobile",yi="Mobile Safari",bi="Windows",_i="Windows Phone",wi="Nokia",ki="Ouya",Si="Generic tablet",xi="Konqueror",$i="Oculus Browser",Ti="Vivaldi",Ci="Yandex",Ei="Whale",Mi="DuckDuckGo",Ii="Pale Moon",Ri="Waterfox",Ai="Brave",Oi="Claude",Pi="Codex",Fi="ChatGPT",Li="Google Search App",Di=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ni=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),ji=new RegExp(gi,"i"),qi=new RegExp("PlayStation \\w+","i"),Bi=new RegExp("Nintendo \\w+","i"),zi=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"},Hi=function(t,e,i,n){e=e||"";const s=function(t){return(null==t?void 0:t.brave)?Ai:null}(i);return s||((null==n?void 0:n.detectGoogleSearchApp)&&ge(t,"GSA/")?Li:ge(t," OPR/")&&ge(t,"Mini")?"Opera Mini":ge(t," OPR/")?ci:zi.test(t)?si:ge(t,"IEMobile")||ge(t,"WPDesktop")?ui:ge(t,"OculusBrowser")?$i:ge(t,"SamsungBrowser")?ri:ge(t,"Edge")||ge(t,"Edg/")?hi:ge(t,"Vivaldi/")?Ti:ge(t,"YaBrowser/")?Ci:ge(t,"Whale/")?Ei:ge(t,"DuckDuckGo/")||ge(t,"Ddg/")?Mi:ge(t,"Claude/")?Oi:ge(t,"Codex/")?Pi:ge(t,"ChatGPT/")?Fi:ge(t,"FBIOS")?"Facebook Mobile":ge(t,"UCWEB")||ge(t,"UCBrowser")?"UC Browser":ge(t,"CriOS")?li:ge(t,"CrMo")||ge(t,oi)?oi:ge(t,Ye)&&ge(t,ni)?mi:ge(t,"FxiOS")?vi:ge(t.toLowerCase(),xi.toLowerCase())?xi:ge(t,"Brave/")?Ai:((t,e)=>e&&ge(e,"Apple")||function(t){return ge(t,ni)&&!ge(t,oi)&&!ge(t,Ye)}(t))(t,e)?ge(t,Ke)?yi:ni:ge(t,"PaleMoon/")?Ii:ge(t,"Waterfox/")?Ri:ge(t,di)?di:ge(t,"MSIE")||ge(t,"Trident/")?ai:ge(t,"Gecko")?di:"")},Wi={[ui]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[hi]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[oi]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[li]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[ni]:[Di],[yi]:[Di],[ci]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[di]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[vi]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[xi]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[si]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Di],[mi]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ri]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[$i]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Ti]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ci]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Ei]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ai]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Oi]:[Ni],[Pi]:[Ni],[Fi]:[Ni],[Mi]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Ri]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Li]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ai]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Vi=function(t,e,i,n){const s=Hi(t,e,i,n),r=Wi[s];if(Ce(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=>[gi,t&&t[1]||""]],[new RegExp(fi,"i"),[fi,""]],[new RegExp(pi,"i"),[pi,""]],[zi,[si,""]],[new RegExp(bi,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[_i,""];if(new RegExp(Ke).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){let t=Ui[i[1]]||"";return/arm/i.test(e)&&(t="RT"),[bi,t]}return[bi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let e="";return t&&t.length>=3&&(e=Ce(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Ye,[t[2],t[3],t[4]||"0"].join(".")]:[Ye,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Ji=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 Bi.test(t)?fi:qi.test(t)?pi:ji.test(t)?gi:new RegExp(ki,"i").test(t)?ki:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?_i:/iPad/.test(t)?ei:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ii:zi.test(t)?si:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(wi,"i").test(t)?wi:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Ke).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Ye:ti:new RegExp("(pda|Mobile)","i").test(t)?"Generic mobile":new RegExp(Xe,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?Si:""},Zi=function(t,e){var i;const n=Qi(t);return n===ei||n===ti||"Kobo"===n||"Kindle Fire"===n||n===Si?Xe:n===fi||n===gi||n===pi||n===ki?"Console":n===ii?"Wearable":n?Ke:"Android"===(null==e?void 0:e.userAgentDataPlatform)&&(null!==(i=null==e?void 0:e.maxTouchPoints)&&void 0!==i?i:0)>0?600>Math.min(null!==(s=null==e?void 0:e.screenWidth)&&void 0!==s?s:0,null!==(r=null==e?void 0:e.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==e?void 0:e.devicePixelRatio)&&void 0!==o?o:1)?Ke:Xe:"Desktop";var s,r,o},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 cn(t){try{return t()}catch(t){return}}function hn(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=hn(()=>{try{null==i||i(),t()}catch(t){s(t)}},e)})])}finally{clearTimeout(n)}})).apply(this,arguments)}let fn,pn,gn,mn;function yn(t){var e;const i=globalThis._posthogChunkIds,n=globalThis._debugIds;if(!i&&!n)return;const s=i?Object.keys(i):[],r=n?Object.keys(n):[];if(mn&&bn(i,s,pn)&&bn(n,r,gn))return mn;pn=i?ue({},i):void 0,gn=n?ue({},n):void 0,mn={},null!==(e=fn)&&void 0!==e||(fn={});const o=(e,i)=>{for(const s of e){const e=i[s];if(!e)continue;const r=null==fn?void 0:fn[s];if(r){mn[r]=e;continue}const o=t(s);for(let t=o.length-1;t>=0;t--){var n;const i=null===(n=o[t])||void 0===n?void 0:n.filename;if(i){mn[i]=e,fn[s]=i;break}}}};return n&&o(r,n),i&&o(s,i),mn}function bn(t,e,i){return t&&i?e.length===Object.keys(i).length&&e.every(e=>t[e]===i[e]):t===i}var _n=class{constructor(t,e,i=[]){this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e={}){const i=e&&e.mechanism||{handled:!0,type:"generic"},n=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),r=this.parseStacktrace(n,s);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(t){var e=this;return re(function*(){for(const i of t)i.stacktrace&&i.stacktrace.frames&&Se(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t})()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null===(e=t.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var i;let n,s;if(null!=t.cause&&(n=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack)try{s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)}catch(t){}return ue(ue({},t),{},{cause:n,stack:s,errors:null===(i=t.errors)||void 0===i?void 0:i.map(t=>this.parseStacktrace(t,e))})}applyChunkIds(t,e){return t.map(t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t))}applyCoercers(t,e){for(const i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return re(function*(){let i=t;for(const t of e.modifiers)i=yield t(i);return i})()}convertToExceptionList(t,e){const i=[],n=(t,s,r)=>{var o;const l=i.length,a=void 0===s?ue(ue({type:"string"==typeof e.type&&e.type.length>0?e.type:"generic"},"boolean"==typeof e.handled?{handled:e.handled}:void 0===e.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof e.synthetic?e.synthetic:t.synthetic,exception_id:l}):{type:"chained",source:r,synthetic:t.synthetic,exception_id:l,parent_id:s},u={type:t.type,value:t.value,mechanism:a};t.stack&&(u.stacktrace={type:"raw",frames:t.stack}),i.push(u),t.cause&&n(t.cause,l,"cause");for(const e of null!==(o=t.errors)&&void 0!==o?o:[])n(e,l,"member")};return n(t),i}buildParsingContext(t){var e;return{chunkIdMap:yn(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}getAggregateErrors(t){try{if(qe(t)){let i=Object.getPrototypeOf(t);for(let n=0;i&&100>n;n++){var e;const n=null===(e=Object.getOwnPropertyDescriptor(i,"constructor"))||void 0===e?void 0:e.value;if("function"==typeof n&&"AggregateError"===n.name){const e=t.errors;return Se(e)?e:void 0}i=Object.getPrototypeOf(i)}}}catch(t){}}buildCoercingContext(t,e,i=0){let n=0,s=0,r=!1;const o=new Set,l=[],a={},u=(t,e,i=0)=>{const u=c(e,i),h=u.apply;if(u.apply=e=>{l.push(t);try{return h(e)}finally{l.pop()}},i>4||i>0&&-1!==l.indexOf(t))return this.coerceFallback(u);const d="object"==typeof t&&null!==t||"function"==typeof t;if(0===i&&n>=50||d&&o.has(t))return;d&&o.add(t),0===i&&n++;const v=this.getAggregateErrors(t);let f,p;r||(r=!!v);try{if(f=this.applyCoercers(t,u),!f)throw a}catch(t){if(t===a)return void(0===i&&n--);if(!r)throw t;f=this.coerceFallback(u)}if(!v||n>=50)return f;try{p=v.length}catch(t){return f}if(!Number.isInteger(p)||0>p||p>4294967295)return f;const g=[];for(let t=0;50>n&&1e3>s&&p>t;t++){let i;s++;try{i=u.next(v[t])}catch(t){n++,i=this.coerceFallback(c(e+1))}i&&g.push(i)}return ue(ue({},f),{},{errors:g})},c=(i,n=0)=>ue(ue({},e),{},{syntheticException:0==i?e.syntheticException:void 0,mechanism:0==i?t:{},apply(t){const e=u(t,i,n+1);if(!e)throw a;return e},next:t=>u(t,i+1)}),h=c(i);return ue(ue({},h),{},{apply:t=>{var e;return null!==(e=u(t,i))&&void 0!==e?e:this.coerceFallback(h)}})}};const wn=/^([a-z][a-z0-9.+-]+):/i,kn=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function Sn(t){if(!t||"<anonymous>"===t)return!1;const e=wn.exec(t);return!e||kn.includes(e[1].toLowerCase())}function xn(t,e,i,n,s){const r={platform:t,filename:e,function:"<anonymous>"===i?"?":i,in_app:Sn(e)};return Ce(n)||(r.lineno=n),Ce(s)||(r.colno=s),r}const $n=(t,e)=>{const i=-1!==t.indexOf("safari-extension"),n=-1!==t.indexOf("safari-web-extension");return i||n?[-1!==t.indexOf("@")?t.split("@")[0]:"?",i?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Tn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Cn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,En=/\((\S*)(?::(\d+))(?::(\d+))\)/,Mn=(t,e)=>{const i=Tn.exec(t);if(i){const[,t,n,s]=i;return xn(e,t,"?",+n,+s)}const n=Cn.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){const t=En.exec(n[2]);t&&(n[2]=t[1],n[3]=t[2],n[4]=t[3])}const[t,i]=$n(n[1]||"?",n[2]);return xn(e,i,t,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},In=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Rn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,An=(t,e)=>{const i=In.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const t=Rn.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]=$n(n,t),xn(e,t,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},On=/\(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 Fn(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 Ln(t,e){const i=e.start+e.length,n=Nn(t,e);n&&t.splice(i+n===t.length?i:e.start,n)}function Dn(t,e){let i=e.start;for(;i>0&&Pn(t[i-1],t[i-1+e.length]);)i--;return e.start-i}function Nn(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 jn(t,e){const i=e[0];let n=t.length-(i?Dn(t,i):0);for(const i of e)n-=Nn(t,i);return n}function qn(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 Bn=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 je(t,"DOMException")}isDOMError(t){return je(t,"DOMError")}},zn=class{match(t){return qe(t)}coerce(t,e){var i;const n=this.getStack(t),s=void 0===n?null===(i=e.syntheticException)||void 0===i?void 0:i.stack:void 0,r=!!s;return{type:this.getType(t),value:this.getMessage(t,e),stack:null!=n?n:s,cause:t.cause?e.next(t.cause):void 0,synthetic:r}}getType(t){return t.name||t.constructor.name}getMessage(t,e){const i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){try{const e=t.stacktrace;if("string"==typeof e&&e.length>0)return e;const i=t.stack;return"string"==typeof i&&i.length>0?i:void 0}catch(t){return}}},Un=class{match(t){return!!je(t,"ErrorEvent")&&(null!=t.error||this.$r(t))}coerce(t,e){var i;if(null!=t.error)return e.apply(t.error);const n=e.apply(t.message);return ue(ue({},n),{},{stack:null!==(i=this.Lr(t))&&void 0!==i?i:n.stack,synthetic:!0})}$r(t){return Ee(t.message)&&t.message.length>0}Lr(t){var e,i;const n=t,s=null!==(e=n.lineno)&&void 0!==e?e:0,r=null!==(i=n.colno)&&void 0!==i?i:0;if(Ee(n.filename)&&0!==n.filename.length&&0!==s)return`Error\n at ${n.filename}:${s}:${r}`}};const Hn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Wn=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 Vn=["fatal","error","warning","log","info","debug"];function Gn(t,e=40){const i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";let n="";for(const t of i){const i=n?`${n}, ${t}`:t;if(i.length>e)break;n=i}return n}var Jn=class{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,n;const s=this.getErrorPropertyFromObject(t);return s?e.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(i=this.getStack(t))&&void 0!==i?i:null===(n=e.syntheticException)||void 0===n?void 0:n.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Be(t))return t.constructor.name;const e="name"in t?t.name:void 0;return Ee(e)&&!Me(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: ${Gn(t)}`}isSeverityLevel(t){return Ee(t)&&!Me(t)&&Vn.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(qe(i))return i}}getObjectClassName(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}},Qn=class{match(t){return Be(t)}coerce(t,e){var i;const n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${Gn(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}}},Kn=class{match(t){return je(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Be(t))return!1;try{const e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i;const n=this.getUnhandledRejectionReason(t);return Ne(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}:e.apply(n)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}};const Yn="$message",Xn="$timestamp",ts=new Set([Yn,Xn]),es={enabled:!0,max_bytes:32768};function is(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:es.enabled,max_bytes:ss(t.max_bytes,es.max_bytes)}:ue({},es)}var ns=class{constructor(t){this.ns=[],this.ss=0,this.Yr=is(t)}setConfig(t){this.Yr=is(t),this.rs()}add(t){const e=function(t){let e;try{e=be(t)}catch(t){return}try{const t=JSON.parse(e);if(!$e(t))return;const i=t,n=i[Yn],s=i[Xn];if(!Ee(n)||0===n.trim().length)return;if(!Ee(s)&&!Ae(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.Yr.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.Yr.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function ss(t,e){if(!Ae(t)||1/0===t||-1/0===t)return e;const i=Math.floor(t);return 0>i?e:i}const rs=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function os(t){return"string"==typeof t||t}function ls(t){return"string"==typeof t?t:void 0}const as=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],us="NativeGzipValidationError",cs=t=>t.length>=2&&31===t[0]&&139===t[1],hs=(t,e)=>t===he.GZipJS||e===he.GZipJS||"gzip"===e,ds=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),vs=t=>{if(!t||"object"!=typeof t)return!1;const e="name"in t?String(t.name):"";return ds(t)||e===us};let fs;const ps=t=>{throw an(us,`Native gzip produced invalid output: ${t}`)};let gs=0,ms=!1;const ys=function(){var t=re(function*(t,e){18>t.size&&ps("too-short");const i=new Uint8Array(yield t.slice(0,10).arrayBuffer());cs(i)&&8===i[2]||ps("invalid-header");const n=new DataView(yield t.slice(t.size-8).arrayBuffer()),s=e.length>>>0;n.getUint32(4,!0)!==s&&ps("invalid-size"),(ms||3>gs)&&(n.getUint32(0,!0)!==(t=>{const e=(()=>{if(fs)return fs;fs=[];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;fs[t]=e>>>0}return fs})();let i=4294967295;for(let n=0;t.length>n;n++)i=e[255&(i^t[n])]^i>>>8;return(4294967295^i)>>>0})(e)&&(ms=!0,ps("invalid-crc")),gs++)});return function(e,i){return t.apply(this,arguments)}}();function bs(t){return _s.apply(this,arguments)}function _s(){return _s=re(function*(t,e=!0,i){try{const e=(new TextEncoder).encode(t),i=new globalThis.CompressionStream("gzip"),s=i.writable.getWriter(),r=s.write(e).then(()=>s.close()).catch((n=re(function*(t){try{yield s.abort(t)}catch(t){}throw t}),function(t){return n.apply(this,arguments)})),o=new Response(i.readable).blob(),[l]=yield Promise.all([o,r]);return yield ys(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}),_s.apply(this,arguments)}function ws(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;r.length>n;n++)e.includes(i=r[n])||{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}const ks="[redacted]",Ss=/^[A-Za-z0-9+/\n\r]+=*$/,xs=/^[A-Za-z0-9_-]+={0,2}$/,$s=/[-_]/,Ts=/^data:[^,\s]*;base64,/i,Cs=/^[A-Za-z0-9+/_-]+={0,2}$/,Es=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,Ms=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,Is=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,Rs=/[\s<>"]/,As=(()=>new RegExp(Is.source,"i"))(),Os=/[a-z][a-z0-9+.-]{0,63}:\/\//i,Ps=(()=>new RegExp(`^${Os.source}`,"i"))(),Fs=(()=>new RegExp(Os.source,"gi"))(),Ls=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,Ds=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,Ns=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,js=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,qs=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,Bs=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,zs=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,Us=/\d+/g,Hs=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,Ws=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function Vs(t){return function(t){return Ms.test(t)}(t)||Ls.test(t)||Ds.test(t)}function Gs(t){return t.split("&",129).length>128}function Js(t,e,i){return Vs(t)||e.includes(";")&&function(t){return t.split(";").some(t=>Vs(t.split("=",1)[0]))}(e)?ks:As.test(e)?i?tr(e,{allowNestedUrls:!1,stripPunctuation:!0}):ks:e}function Qs(t,e){const i=new URLSearchParams;let n=!1,s=!1;for(const[r,o]of new URLSearchParams(t)){const t=er(r),l=er(o);n||(n=t!==r||l!==o);const a=Js(t,l,e);n||(n=a!==l),s=Vs(t)||a!==l,i.append(t,a)}return{changed:n,lastFieldSensitive:s,serialized:i.toString()}}function Zs(t,e){if(!t.includes("="))return{value:Ks(t,e),lastFieldSensitive:!1};const i=Qs(t,e);return{value:i.changed?i.serialized:t,lastFieldSensitive:i.lastFieldSensitive}}function Ks(t,e){return e?tr(t,{allowNestedUrls:!1,stripPunctuation:!0}):As.test(t)?ks:t}function Ys(t,e,i){return"#"===t?!e.fragment&&(e.fragment=!0):"?"===t&&(e.fragment?"="!==i&&!e.fragmentQuery&&(e.fragmentQuery=!0):!e.query&&(e.query=!0))}function Xs(t,e){var i;if(t.length>8192&&Ps.test(t))return ks;const{address:n,suffix:s}=e.stripPunctuation?function(t){let e=t.length;for(;e>0&&".,;:!?)]}'".includes(t[e-1]);)e--;return{address:t.slice(0,e),suffix:t.slice(e)}}(t):{address:t,suffix:""};let r;try{r=new URL(n)}catch(t){return ks+s}const o=r.search.slice(1),l=""!==r.hash,a=function(t){const e=t.slice(1),i=e.indexOf("?");return 0>i?{head:e,tail:null}:{head:e.slice(0,i),tail:e.slice(i+1)}}(r.hash);if(Gs(o)||Gs(a.head)||Gs(null!==(i=a.tail)&&void 0!==i?i:""))return ks+s;let u=!1;(r.username||r.password)&&(r.username=ks,r.password="",u=!0);const c=Qs(o,e.allowNestedUrls);c.changed&&(r.search=c.serialized,u=!0);const h=Zs(a.head,e.allowNestedUrls),d=null===a.tail?null:(v=a.tail,h.lastFieldSensitive?{value:""===v?"":ks,lastFieldSensitive:!0}:Zs(v,e.allowNestedUrls));var v;const f=null===d?h.value:`${h.value}?${d.value}`;f!==r.hash.slice(1)&&(r.hash=f,u=!0);const p=l?null!=d?d:h:c;return(u?er(r.toString()):n)+(p.lastFieldSensitive?"":s)}function tr(t,e){return t.replace(Is,i=>function(t,e){const i=function(t){if(!t.includes("://"))return[];const e=[...t.matchAll(Fs)].map(t=>t.index),i=[],n={query:!1,fragment:!1,fragmentQuery:!1};let s=0,r=!1,o="";for(let l=0;t.length>l&&e.length>s;l++){e[s]===l&&(l>0&&"="!==o&&i.push(l),s++);const a=t[l];Ys(a,n,o)?(o=a,r=!0):r&&"=&".includes(a)&&(o=a)}return i}(t);if(0===i.length)return Xs(t,e);let n="",s=0;for(const r of i)n+=Xs(t.slice(s,r),ue(ue({},e),{},{stripPunctuation:!1})),s=r;return n+Xs(t.slice(s),e)}(i,ue(ue({},e),{},{stripPunctuation:e.stripPunctuation&&i.length!==t.length})))}function er(t){return t.replace(Es,ks)}function ir(t,e){return function(t){return t.length>=10240&&(Ss.test(t)||function(t){const e=Ts.exec(t);if(!e)return!1;let i;try{i=decodeURIComponent(t.slice(e[0].length))}catch(t){return!1}return Cs.test(i.replace(/[\r\n]/g,""))}(t)||$s.test(t)&&xs.test(t))}(t)?"[binary data redacted - not supported by PostHog MCP analytics]":function(t,e,i){const n=4*i.maxStringLength;if(t.length>n){const s=e(t.slice(0,function(t,e){let i=e;for(;i>0&&!Rs.test(t[i-1]);)i--;return i}(t,n)));if(s.length>=2*i.maxStringLength)return s+i.truncationSuffix}return e(t)}(t,t=>function(t){return tr(t,{allowNestedUrls:!0,stripPunctuation:!0})}(function(t){let e=t.replace(Ns," ");return e=e.replace(js,ks),e=e.replace(qs,ks),e=e.replace(Bs,`$1${ks}`),e=function(t){let e="",i=0;for(let n=lr(t,0);null!==n;n=lr(t,n[1]))e+=t.slice(i,n[0])+ar(t.slice(n[0],n[1])),i=n[1];return e+t.slice(i)}(e),e=e.replace(zs,ks),e=e.replace(Hs,`$1${ks}`),e=e.replace(Ws,`$1${ks}`),e}(er(t))),e)}function nr(t){let e=0,i=!1;for(let n=t.length-1;n>=0;n--){let s=t.charCodeAt(n)-48;if(0>s||s>9)return!1;i&&(s*=2,s>9&&(s-=9)),e+=s,i=!i}return e%10==0}function sr(t,e){const i=t.charCodeAt(e);return i>=48&&57>=i}function rr(t,e){const i=t.charCodeAt(e);return sr(t,e)||95===i||i>=65&&90>=i||i>=97&&122>=i}function or(t,e){let i=e;for(;sr(t,i);)i++;return i}function lr(t,e){for(let i=e;t.length>i;i++){if(!sr(t,i)||rr(t,i-1))continue;let e=0,n=-1,s=i;for(;;){const i=or(t,s);if(e+=i-s,13>e||rr(t,i)||(n=i),s=i+1,!" ./-".includes(t.charAt(i))||!sr(t,s))break}if(n>=0)return[i,n];i=s-1}return null}function ar(t){const e=[];for(let i=Us.exec(t);null!==i;i=Us.exec(t))e.push({digits:i[0],start:i.index,end:i.index+i[0].length});let i="",n=0,s=0;for(;e.length>s;){let r="",o=-1;for(let t=s;e.length>t&&(r+=e[t].digits,19>=r.length);t++)r.length>=13&&nr(r)&&(o=t);0>o?s++:(i+=t.slice(n,e[s].start)+ks,n=e[o].end,s=o+1)}return i+t.slice(n)}const ur={}.propertyIsEnumerable;function cr(t,e){try{return vr(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function hr(t,e,i,n){if(0>=i.remainingNodes)return{stringValue:Xi};if(i.remainingNodes--,Pe(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 hr(s.call(t),e,i,n+1)}catch(t){}return Se(t)?{arrayValue:{values:dr(t,e,i,n+1)}}:{kvlistValue:{values:vr(t,e,i,n+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:en(String(t))}}function dr(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(hr(r,e,i,n))}catch(t){s.push({stringValue:tn})}return t.length>o&&s.push({stringValue:Xi}),s}function vr(t,e,i,n){const s=[];for(const r in t)if(ur.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(Ie(o)||Ce(o))continue;s.push({key:en(r),value:hr(o,e,i,n)})}catch(t){s.push({key:en(r),value:{stringValue:tn}})}}return s}function fr(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 pr=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function gr(t,e){const i=nn({},t),n={};for(const t of pr)({}).hasOwnProperty.call(i,t)&&(n[t]=i[t],delete i[t]);return[...cr(i,e),...cr(n,e)]}const mr={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 yr={text:"INFO",number:9},br={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:yr,warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}};function _r(t){try{return en(String(t))}catch(t){return tn}}function wr(t,e,i,n){const s=t.level||"info",{text:r,number:o}=br[s]||yr,l=function(t=Date.now()){return String(t)+"000000"}(Ae(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),c=t.attributes;if(c){let t=[];try{t=Object.keys(c)}catch(e){t=[]}for(const e of t){let t;try{t=c[e]}catch(e){t=tn}Object.defineProperty(u,e,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const h={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:r,body:{stringValue:_r(t.body)},attributes:cr(u,i)};return t.trace_id&&(h.traceId=t.trace_id),t.span_id&&(h.spanId=t.span_id),Ce(t.trace_flags)||(h.flags=t.trace_flags),h}function kr(t,e,i){return fr(t,e,i)}function Sr(t,e,i,n){return{resourceLogs:[{resource:{attributes:gr(e)},scopeLogs:[{scope:{name:i,version:n},logRecords:t}]}]}}var xr=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.cs}arm(t){this.clear(),this.us=Date.now()+t,this.cs=hn(()=>{this.cs=void 0,this.ls()},t)}armNoEarlierThan(t){this.cs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function $r(){return.75+.5*Math.random()}function Tr(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 Cr=class{constructor(t,e,i,n,s,r=()=>Promise.resolve(),o,l=()=>!1){var a;this._instance=t,this.Yr=e,this.R=i,this.hs=n,this.ds=s,this.vs=r,this.fs=o,this.ps=l,this.gs=new xr(()=>this.ys()),this.bs=null,this._s=0,this.ws=0,this.ks=null,this.Ss=new rn,this.xs=0,this.$s=1,this.Cs=0,this.Ts=0,this.Ms=!1,this.Is=e.maxBufferSize,this.Es=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.As=e.flushIntervalMs,this.Rs=e.maxBatchRecordsPerPost,this.Ps=e.rateCapWindowMs,this.Os=e.maxLogsPerInterval}clearQueue(){this.ws++,this._instance.setPersistedProperty(ce.LogsQueue,[])}get throttled(){return this.Ss.isOpen()}reset(){this.gs.clear(),this.Cs=0,this.Ts=0,this.Ms=!1,this.xs=0,this.$s=1,this.Ss.reset(),this.Rs=this.Yr.maxBatchRecordsPerPost}onReconnect(){this.xs=0,this.$s=1,this.Ss.isOpen()?this.Fs()&&this.Ls():this.ys()}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.Ds(t);if(null===n)return;if(!n.body)return void this.R.info("Log was rejected in beforeSend function");if(!this.Ns())return;const s={record:wr(n,null!==(i=null==e?void 0:e.context)&&void 0!==i?i:this.hs(),this.R,null==e?void 0:e.occurredAtMs)};this.ds(()=>this.js(s))}Ds(t){const e=this.Yr.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.R.info("Log was rejected in beforeSend function"),null;n=e}catch(t){return this.R.error("Error in beforeSend function for log:",t),null}return n}Ns(){if(void 0===this.Os)return!0;const t=Date.now(),e=t-this.Cs;return this.Ps>e&&e>=0||(this.Cs=t,this.Ts=0,this.Ms=!1),this.Os>this.Ts?(this.Ts++,!0):(this.Ms||(this.R.warn(`captureLog dropping logs: exceeded ${this.Os} logs per ${this.Ps}ms`),this.Ms=!0),!1)}flush(){var t=this;return re(function*(){if(!t._instance.isDisabled)return t.bs||(t.bs=t.qs().finally(()=>{t.bs=null})),t.bs})()}qs(){var t=this;return re(function*(){var e;if(t.gs.clear(),t.Bs())return;let i=null!==(e=t._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==e?e:[];if(0===i.length)return;const n=i.length;let s=0;for(;i.length>0&&n>s;){var r,o;if(t.Bs())return;const e=t.ws;t._s=0;const n=Math.min(i.length,t.Rs),l=i.slice(0,n),a=Sr(l.map(t=>t.record),t.zs(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.Hs(a);if(t.ws!==e)return;if("too-large"===u.kind&&l.length>1)t.Rs=Math.max(1,Math.floor(l.length/2)),t.R.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${t.Rs}`);else{if(t.Ss.record(u),t.gs.pending&&t.gs.arm(Math.max(t.As,t.Ss.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.R.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.Yr.maxBatchRecordsPerPost>t.Rs&&(t.Rs=Math.min(t.Yr.maxBatchRecordsPerPost,t.Rs+1)),yield t.Us(l.length),i=null!==(o=t._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===u.kind)throw u.error}}})()}Bs(){return!!this.ps()&&(this.Fs()&&this.clearQueue(),!0)}Us(t){var e=this;return re(function*(){var i;const n=Math.max(0,t-e._s),s=null!==(i=e._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(ce.LogsQueue,s.slice(n)),yield e.vs()})()}zs(){return kr(this.Yr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}js(t){var e;if(this._instance.optedOut)return;const i=null!==(e=this._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==e?e:[];this.Es>i.length||(i.shift(),this._s++,this.R.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(ce.LogsQueue,i),this.Is>i.length||this.Ss.isOpen()?this.Ls():this.ys()}Ls(){this.gs.pending||this.gs.arm(Math.max(this.As,this.Ss.remainingMs()))}Ws(){return Math.max(Tr(this.As,this.xs,this.$s,3e4),this.Ss.remainingMs())}Fs(){const t=this._instance.getPersistedProperty(ce.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return re(function*(){e.gs.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(()=>{})})})()}flushInBackground(){if(this.ks)return this.ks;const t=this.flush().then(()=>{this.xs=0,this.$s=1},t=>{this.xs++,this.$s=$r(),this.R.error("PostHog logs flush failed:",t)}).finally(()=>{this.ks===t&&(this.ks=null),!this._instance.isDisabled&&this.Fs()&&this.gs.armNoEarlierThan(this.Ws())});return this.ks=t,t}ys(){this.flushInBackground()}};const Er=/^[0-9a-f]+$/;function Mr(t,e,i){return"string"==typeof t&&t.length===e&&t!==i&&Er.test(t)}const Ir=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;const Rr="00",Ar=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Or(t){return String(t)+"000000"}function Pr(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 Fr=class{constructor(t,e,i){this._instance=t,this.Yr=e,this.R=i,this.Vs=new Map,this.gs=new xr(()=>this.flush().catch(t=>{this.R.error("Metrics flush failed:",t)})),this.bs=null,this.Gs=null,this.Js=!1,this.Qs=new Map,this.Zs=new Set,this.Ks=new Map,this.Ys=new Set,this.Xs=!1,this.Ss=new rn,this.xs=0,this.$s=1,this.Po=0}count(t,e=1,i){this.Fo({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.Fo({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.Fo({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes,bounds:Se(null==i?void 0:i.bounds)?i.bounds.slice():null==i?void 0:i.bounds})}flush(){var t=this;const e=this.bs,i=function(){var i=re(function*(){e&&(yield e.catch(()=>{})),yield t.No()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this.bs===i&&(this.bs=null)});return this.bs=i,i}flushCoalesced(){var t,e;return this.jo()?null!==(t=this.bs)&&void 0!==t?t:Promise.resolve():(this.Gs||(this.Gs=(null!==(e=this.bs)&&void 0!==e?e:Promise.resolve()).catch(()=>{}).then(()=>(this.Gs=null,this.jo()?void 0:this.flush()))),this.Gs)}jo(){return this.xs>0||this.Ss.remainingMs()>0}drainWindow(){if(0===this.Vs.size)return null;const t=this.Vs;return this.qo(),this.Bo(t)}reset(){this.Po++,this.Ss.reset(),this.xs=0,this.$s=1,this.gs.clear(),this.bs=null,this.Gs=null,this.qo(),this.Ks=new Map,this.Xs=!1}qo(){this.Vs=new Map,this.Js=!1,this.Qs=new Map,this.Zs=new Set,this.Ys=new Set}Fo(t){if(this._instance.isDisabled||this._instance.optedOut)return;const e=this.Ds(t);if(null===e)return;if(!e.name||"string"!=typeof e.name)return void this.R.warn("Dropping metric with empty name");if("number"!=typeof e.value||!Number.isFinite(e.value))return void this.R.warn(`Dropping metric '${e.name}': value must be a finite number`);if("count"!==e.type&&"gauge"!==e.type&&"histogram"!==e.type)return void this.R.warn(`Dropping metric '${e.name}': unknown type '${String(e.type)}'`);if("count"===e.type&&0>e.value)return void this.R.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=Pr(e.type,e.name,e.unit,i)}catch(t){return void this.R.warn(`Dropping metric '${e.name}': attributes could not be serialized`,t)}let s,r=this.Vs.get(n);if(!r&&!this.zo())return;if("histogram"===e.type&&(s=this.Ho(e.name,e.unit,e.bounds),!s))return;r||(r={name:e.name,type:e.type,unit:e.unit,attributes:i,windowStartMs:Date.now(),hist:s&&Dr(s)},this.Vs.set(n,r));const o=this.Qs.get(e.name);void 0===o?this.Qs.set(e.name,e.type):o===e.type||this.Zs.has(e.name)||(this.Zs.add(e.name),this.R.warn(`Metric name '${e.name}' is already used as a ${o}; recording it as a ${e.type} too will blend both series in charts. Use a distinct name.`)),this.Uo(r,e.value);const l=this.Wo();l&&(r.exemplar=ue(ue({},l),{},{value:e.value,timeMs:Date.now()})),this.Ls()}Wo(){try{var t,e;const i=function(t){const e=function(t){if("string"!=typeof t)return;const e=Ir.exec(t.trim());if(!e)return;const[,i,n,s,r,o]=e;return"ff"===i||"00"===i&&o||!function(t){return Mr(t,32,"00000000000000000000000000000000")}(n)||!function(t){return Mr(t,16,"0000000000000000")}(s)?void 0:{version:i,traceId:n,spanId:s,flags:r}}(t);return e&&{traceId:e.traceId,spanId:e.spanId,flags:(i=e.flags,1&parseInt(i,16)?"01":Rr)};var i}(null===(t=(e=this._instance).getActiveSpan)||void 0===t||null===(t=t.call(e))||void 0===t?void 0:t.traceparent());if(i&&"01"===i.flags)return{traceId:i.traceId,spanId:i.spanId}}catch(t){}}zo(){return this.Yr.maxSeriesPerFlush>this.Vs.size||(this.Js||(this.Js=!0,this.R.warn(`Metric series cap reached (${this.Yr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Ho(t,e,i){if(void 0!==i&&!function(t){if(!Se(t)||0===t.length)return!1;for(let e=0;t.length>e;e++)if(!Number.isFinite(t[e])||e>0&&t[e-1]>=t[e])return!1;return!0}(i))return void this.R.warn(`Dropping histogram '${t}': bounds must be a non-empty array of finite, strictly increasing numbers`);const n=Pr("histogram",t,e,void 0),s=this.Ks.get(n);if(s)return this.Vo(t,n,s,i),s;if(this.Ks.size>=this.Yr.maxSeriesPerFlush){if(this.Xs||(this.Xs=!0,this.R.warn(`Histogram bounds limit reached (${this.Yr.maxSeriesPerFlush} distinct histograms); new histograms that pass custom bounds are dropped. Reduce histogram name cardinality.`)),i&&!Lr(i,Ar))return;return Ar}const r=i?i.slice():Ar;return this.Ks.set(n,r),r}Vo(t,e,i,n){Lr(i,null!=n?n:Ar)||this.Ys.has(e)||(this.Ys.add(e),this.R.warn(`Histogram '${t}' already uses the bounds [${i.join(", ")}]; samples that pass different bounds are recorded in those buckets.`))}Uo(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":{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,i.bounds)]+=1;break}}}Ds(t){const e=this.Yr.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.R.info("Metric was rejected in beforeSend function"),null;n=e}catch(t){return this.R.error("Error in beforeSend function for metric:",t),null}return n}Ls(){this.gs.pending||this.gs.arm(this.Ws())}Ws(){return Math.max(Tr(this.Yr.flushIntervalMs,this.xs,this.$s,3e4),this.Ss.remainingMs())}No(){var t=this;return re(function*(){if(t.gs.clear(),0===t.Vs.size)return;const e=t.Vs;t.qo();const i=t.Po,n=yield t._instance.Go(t.Bo(e));if(i===t.Po)switch(t.Ss.record(n),"retry-later"===n.kind?(t.xs++,t.$s=$r()):(t.xs=0,t.$s=1),t.gs.pending&&t.gs.arm(t.Ws()),n.kind){case"ok":return;case"retry-later":return t.Jo(e),void t.gs.armNoEarlierThan(t.Ws());case"too-large":return void t.R.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.R.error("Failed to send metrics batch:",n.error)}})()}Bo(t){return e=this.Qo(t),i=function(t,e,i){return fr(t,e,i)}(this.Yr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:gr(i)},scopeMetrics:[{scope:{name:n,version:s},metrics:e}]}]};var e,i,n,s}Qo(t){const e=Or(Date.now()),i=new Map;for(const o of t.values()){var n;const t=Pr(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=cr(null!==(n=o.attributes)&&void 0!==n?n:{},this.R),u=Or(o.windowStartMs),c=Nr(o.exemplar);if("count"===o.type){var s;const t=ue({attributes:a,startTimeUnixNano:u,timeUnixNano:e,asDouble:null!==(s=o.total)&&void 0!==s?s:0},c);l.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t=ue({attributes:a,timeUnixNano:e,asDouble:null!==(r=o.last)&&void 0!==r?r:0},c);l.gauge.dataPoints.push(t)}else{const t=o.hist,i=ue({attributes:a,startTimeUnixNano:u,timeUnixNano:e,count:t.count,sum:t.sum,min:t.min,max:t.max,bucketCounts:t.bucketCounts,explicitBounds:t.bounds},c);l.histogram.dataPoints.push(i)}}return Array.from(i.values())}Jo(t){for(const[s,r]of t){var e;const t=this.Vs.get(s);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,r.windowStartMs),t.exemplar=null!==(e=t.exemplar)&&void 0!==e?e:r.exemplar,t.type){case"count":var i,n;t.total=(null!==(i=t.total)&&void 0!==i?i:0)+(null!==(n=r.total)&&void 0!==n?n:0);break;case"gauge":break;case"histogram":{const e=t.hist,i=r.hist;e.count+=i.count,e.sum+=i.sum,e.min=Math.min(e.min,i.min),e.max=Math.max(e.max,i.max);for(let t=0;e.bucketCounts.length>t;t++)e.bucketCounts[t]+=i.bucketCounts[t];break}}else this.zo()&&this.Vs.set(s,r)}}};function Lr(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let i=0;t.length>i;i++)if(t[i]!==e[i])return!1;return!0}function Dr(t){return{bounds:t,count:0,sum:0,min:1/0,max:-1/0,bucketCounts:new Array(t.length+1).fill(0)}}function Nr(t){return t?{exemplars:[{filteredAttributes:[],timeUnixNano:Or(t.timeMs),asDouble:t.value,traceId:t.traceId,spanId:t.spanId}]}:{}}function jr(t,e){if(!t)return;const i=t.find(t=>t.type===e);return null==i?void 0:i.value}const qr="0.14.1",Br={DEBUG:!1,LIB_VERSION:qr,LIB_NAME:"browser-common",JS_SDK_VERSION:qr},zr=(t,{debugEnabled:e}={})=>{const i={N(i,...n){let s;try{s=typeof window>"u"?void 0:window}catch(t){return}s&&(Br.DEBUG||s.POSTHOG_DEBUG||e)&&!Ce(s.console)&&s.console&&("__rrweb_original__"in s.console[i]?s.console[i].__rrweb_original__:s.console[i])(t,...n)},debug(...t){i.N("debug",...t)},info(...t){i.N("log",...t)},warn(...t){i.N("warn",...t)},error(...t){i.N("error",...t)},critical(...e){console.error(t,...e)},uninitializedWarning(t){i.error(`You must initialize PostHog before calling ${t}`)},createLogger:(e,i)=>zr(`${t} ${e}`,i)};return i},Ur=zr("[PostHog.js]"),Hr=(t,e)=>Ur.createLogger(t,e);function Wr(t,e){Se(t)&&t.forEach(e)}function Vr(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 Gr=function(t,...e){for(const i of e)for(const e in i)void 0!==i[e]&&(t[e]=i[e]);return t};function Jr(t){const e=Object.keys(t);let i=e.length;const n=new Array(i);for(;i--;)n[i]=[e[i],t[e[i]]];return n}const Qr=function(t){return function(...e){try{return t.apply(this,e)}catch(t){Ur.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ur.critical(t)}}},Zr=function(t){const e={};return Vr(t,function(t,i){(Ee(t)&&t.length>0||Ae(t))&&(e[i]=t)}),e};function Kr(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 Yr=["herokuapp.com","vercel.app","netlify.app"];function Xr(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 Yr)if(i===t)return!1;return!0}function to(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 eo(t){return"ph_toolbar_internal"===t.name}const io=t=>{const e=typeof document>"u"?void 0:document,i=null==e?void 0:e.createElement("a");return Ce(i)?null:(i.href=t,i)},no=()=>{try{return"u">typeof window&&!1!==window.navigator.onLine}catch(t){return!1}},so=(t,e)=>t>=e&&no(),ro=(t,e,i,n)=>{if(0===t){if(no()){const t=e+1;return t===i&&n(),t}return e}return 0},oo=["localhost","127.0.0.1"],lo=(t,e)=>{try{let i;return JSON.stringify(t,(t,e)=>{var n;return qe(e)?(null!==(n=i)&&void 0!==n||(i=new WeakMap),i.has(e)||i.set(e,Kr(e)),i.get(e)):"bigint"==typeof e?e.toString():e},e)}catch(e){return be(t)}},ao=function(t,e="&"){let i,n;const s=[];return Vr(t,function(t,e){Ce(t)||Ce(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)},uo=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].replace(/\+/g," ");try{t=decodeURIComponent(t)}catch(e){Ur.error("Skipping decoding for malformed query param: "+t)}return t}},co=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("?");let s=0;for(;n.length>s&&!e.includes(n[s].split("=")[0]);)s++;u.push(n.length>s?n.slice(0,s).concat(n[s].split("=")[0]+"="+i).join("?"):a[t])}let c=l;return null!=o&&(c+="?"+u.join("&")),null!=s&&(c+="#"+s),c},ho=function(t,e){const i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null};function vo(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 Ur.error("Error in get_current_url, falling back to window.location.href",t),e}}function fo(t){var e;const i=typeof window>"u"?void 0:window,n=null==i||null===(e=i.location)||void 0===e?void 0:e.href;return Ce(n)?void 0:vo(t,n)}function po(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 go(t){return!!t&&1===t.nodeType}function mo(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function yo(t){return!!t&&3===t.nodeType}function bo(t){return!!t&&11===t.nodeType&&go(t.host)}function _o(t){return t?me(t).split(/\s+/):[]}function wo(t,e){const i=fo(e);return!!(i&&t&&t.some(t=>i.match(t)))}function ko(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 _o(e)}function So(t){return Re(t)?null:me(t).split(/(\s+)/).filter(t=>il(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function xo(t){let e="";return Go(t)&&!Jo(t)&&t.childNodes&&t.childNodes.length&&Vr(t.childNodes,function(t){var i;yo(t)&&t.textContent&&(e+=null!==(i=So(t.textContent))&&void 0!==i?i:"")}),me(e)}function $o(t){var e;return Ce(t.target)?t.srcElement||null:(null===(e=t.target)||void 0===e?void 0:e.shadowRoot)?t.composedPath()[0]||null:t.target||null}const To=["a","button","form","input","select","textarea","label"];function Co(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 Eo(t,e){if(Ce(e))return!0;for(const i of t)if(e.some(t=>Co(i,t)))return!0;return!1}function Mo(t){const e=t.parentNode;return!(!e||!go(e))&&e}const Io=[".ph-no-autocapture","[data-ph-no-autocapture]"],Ro=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],Ao=(()=>[...Ro,"+","-","−","–"])(),Oo=(()=>Ao.length+10)(),Po=["button","a","input","select","textarea","label"],Fo=["button","link","tab","menuitem","option"],Lo=(t,e)=>/[a-z0-9]/i.test(e)?ge(Ao,e)?new RegExp(`\\b${e}\\b`).test(t):t.includes(e):t===e,Do=t=>ge(Po,t.tagName.toLowerCase())||ge(Fo,(t.getAttribute("role")||"").toLowerCase());function No(t){let e="",i="";const n=t=>{go(t)&&Go(t)&&!Jo(t)&&(e+=` ${xo(t)}`,i=i||t.getAttribute("aria-label")||"",Vr(t.childNodes,n))};n(t),e=me(e.replace(/\s+/g," "));const s=(il(e)?e:"").toLowerCase(),r=t.getAttribute("aria-label")||(s?"":i);return{safeText:s,ariaLabel:me(r).toLowerCase()}}const jo=[".ph-no-deadclick",".ph-no-capture"],qo=[".ph-no-rageclick",".ph-no-capture"],Bo=["","text","search","email","password","url","tel","number"];function zo(t){return!(!t||!go(t))&&(!!mo(t,"textarea")||(mo(t,"input")?ge(Bo,(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 Uo(t,e){if(!(typeof window>"u"?void 0:window)||Ho(t))return!1;let i,n,s;var r,o;if(Pe(e)?(i=!!e&&qo,n=void 0,s=!1):(i=null!==(r=null==e?void 0:e.css_selector_ignorelist)&&void 0!==r?r:qo,n=null==e?void 0:e.content_ignorelist,s=null!==(o=null==e?void 0:e.ignore_text_selection)&&void 0!==o&&o),!1===i)return!1;if(s&&zo(t))return!1;const{targetElementList:l,isComplete:a}=Wo(t,!1);return!(!a||n&&function(t,{safeText:e,ariaLabel:i}){let n;if(!0===t)n=Ro;else{if(!Se(t))return!1;if(t.length>Oo)return Ur.error(`[PostHog] content_ignorelist array cannot exceed ${Oo} items. Use css_selector_ignorelist for more complex matching.`),!1;n=t.map(t=>t.toLowerCase())}return n.some(t=>Lo(e,t)||Lo(i,t))}(n,function(t,e){for(const t of e)if(Do(t))return No(t);for(const t of e){try{var i;if("pointer"!==(null===(i=window)||void 0===i?void 0:i.getComputedStyle(t).getPropertyValue("cursor")))break}catch(t){break}const e=No(t);if(e.safeText||e.ariaLabel)return e}return No(t)}(t,l))||Eo(l,i))}const Ho=t=>!t||mo(t,"html")||!go(t),Wo=(t,e)=>{const i=typeof window>"u"?void 0:window;if(!i||Ho(t))return{parentIsUsefulElement:!1,targetElementList:[],isComplete:!1};let n=!1;const s=[t];let r=t;const o=new Set([t]);for(;!mo(r,"body");){const t=r.assignedSlot||r.parentNode,l=bo(t)?t.host:t&&go(t)?t:null;if(!l)break;if(o.has(l)||o.size>=1e3)return{parentIsUsefulElement:n,targetElementList:s,isComplete:!1};if(o.add(l),bo(t))s.push(l),r=l;else{if(e||To.indexOf(l.tagName.toLowerCase())>-1)n=!0;else try{const t=i.getComputedStyle(l);t&&"pointer"===t.getPropertyValue("cursor")&&(n=!0)}catch(t){}s.push(l),r=l}}return{parentIsUsefulElement:n,targetElementList:s,isComplete:!0}};function Vo(t){const e=new Set;let i=0,n=t;for(;n;){if(i++>=1e3||e.has(n))return!0;e.add(n);const t=ko(n);if(ge(t,"ph-sensitive")||ge(t,"ph-no-capture"))return!0;const s=n.assignedSlot||n.parentNode;n=bo(s)?s.host:s&&go(s)?s:null}return!1}function Go(t){if(Vo(t))return!1;if(ge(ko(t),"ph-include"))return!0;const e=t.type||"";if(Ee(e))switch(e.toLowerCase()){case"hidden":case"password":return!1}const i=t.name||t.id||"";return!Ee(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,""))}function Jo(t){return!!(mo(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||mo(t,"select")||mo(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const Qo=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}))$"),Zo=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Ko=[16,15,14,13],Yo=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Xo=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),tl=/[0-9A-Za-z_]/;function el(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 il(t,e=!0){if(Re(t))return!1;if(Ee(t)){if(t=me(t),e?Qo.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(Zo.lastIndex=0;e=Zo.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 Ko){const n=t+e;if(i.length>=n){const e=i.slice(t,n);if(Qo.test(e)&&el(e))return!0}}}return!1}(t))return!1;if(e?Yo.test(t):function(t){let e;for(Xo.lastIndex=0;e=Xo.exec(t);){const t=e[1],i=e[3];if(!(t&&i&&tl.test(t)&&tl.test(i)))return!0}return!1}(t))return!1}return!0}function nl(t){let e=xo(t);return e=`${e} ${sl(t)}`.trim(),il(e)?e:""}function sl(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Vr(t.childNodes,function(t){var i;if(t&&"span"===(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=xo(t);e=`${e} ${i}`.trim(),t.childNodes&&t.childNodes.length&&(e=`${e} ${sl(t)}`.trim())}catch(t){Ur.error("[AutoCapture]",t)}}),e}function rl(t){return t.replace(/"|\\"/g,'\\"')}function ol(t){const e=t.attr__class;if(e)return Se(e)?e:_o(e)}const ll=1e6;function al(t){var e;return Math.min(ll,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:ll)}const ul={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:ll,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},cl=["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"],hl=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],dl=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],vl=t=>{Re(t)||Vr(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return cl.includes(e)||dl.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},fl=["/s/","/e/","/i/"];function pl(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 gl(t,e){if(Re(t))return t;let i=t;return il(i,!1)||(i="[SessionRecording] "+e+" body redacted"),Vr(hl,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 ml=new WeakSet,yl="disabled",bl="sampled",_l="active",wl="buffering",kl="paused",Sl="lazy_loading",xl="rrweb_error",$l="trigger_activated",Tl="trigger_pending",Cl="trigger_disabled";function El(t,e,i,n,s,r){return 0===e?Cl:(null==t?void 0:t.get_property(i?n+i:s))===r?$l:Tl}function Ml(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 Il(t){return t.includes("trigger_activated")?$l:t.includes("trigger_pending")?Tl:Cl}function Rl(t){const e=new Set(t);switch(e.delete(Cl),e.size){case 0:return Cl;case 1:return Array.from(e)[0];default:return Tl}}var Al=class{constructor(t){this.j=t}triggerStatus(t){return Il(this.j.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return Il(this.j.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.j.forEach(t=>t.stop())}},Ol=class{constructor(t){this.j=t}triggerStatus(t){return Rl(this.j.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return Rl(this.j.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.j.forEach(t=>t.stop())}},Pl=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return $l}stop(){}};const Fl=t=>"sessionRecording"in t;var Ll=class{constructor(t,e){this._instance=t,this.B=[],this.U=[],this.W=new Map,this.H=new Map,this.G="",this.urlBlocked=!1,this.V=e}onConfig(t){var e,i;this.B=(Fl(t)?$e(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.U=(Fl(t)?$e(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.Z()}Z(){this.W.clear(),this.H.clear();for(const t of this.B)if("regex"===t.matching&&!this.W.has(t.url))try{this.W.set(t.url,new RegExp(t.url))}catch(e){Ur.error("Invalid URL trigger regex pattern:",t.url,e)}for(const t of this.U)if("regex"===t.matching&&!this.H.has(t.url))try{this.H.set(t.url,new RegExp(t.url))}catch(e){Ur.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}J(t){return El(this._instance,this.B.length,this.V,pt,dt,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Vt]:e}),e}triggerStatusNoSideEffects(t){return this.J(t)}isCurrentUrlBlocked(){const t=fo(this._instance);if(!t)return!1;try{return Ml(t,this.U,this.H)}catch(t){return!0}}checkUrlBlocklist(t,e){const i=fo(this._instance);if(!i)return;if(i===this.G)return;this.G=i;const n=this.urlBlocked,s=Ml(i,this.U,this.H);n&&s||(s&&!n?t():!s&&n&&e())}checkUrlTriggerConditions(t,e,i,n){const s=fo(this._instance);if(!s)return;if(s===this.G)return;this.G=s;const r=this.urlBlocked,o=Ml(s,this.U,this.H);o&&!r?t():!o&&r&&e();const l=this.J(n)===$l,a=Ml(s,this.B,this.W);!l&&a&&i("url",s)}stop(){this.G=""}},Dl=class{constructor(t){this._instance=t,this.linkedFlag=null,this.linkedFlagSeen=!1,this.Y=()=>{}}triggerStatus(){const t=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[Bt]:t}),t}triggerStatusNoSideEffects(){let t=Tl;return Re(this.linkedFlag)&&(t=Cl),this.linkedFlagSeen&&(t=$l),t}onConfig(t,e){var i;if(this.linkedFlag=(Fl(t)?$e(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!Re(this.linkedFlag)&&!this.linkedFlagSeen){const t=Ee(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=Ee(this.linkedFlag)?null:this.linkedFlag.variant;this.Y=this._instance.onFeatureFlags((n,s)=>{let r=!1;if($e(s)&&t in s){const e=s[t];r=Pe(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.Y()}},Nl=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(Fl(t)?$e(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}X(t){return El(this._instance,this.K.length,this.V,ft,vt,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[qt]:e}),e}triggerStatusNoSideEffects(t){return this.X(t)}checkEventTriggerConditions(t,e,i){if(0===this.K.length)return;const n=this.X(i)===$l,s=this.K.includes(t);!n&&s&&e("event",t)}stop(){}},jl=class{constructor(t,e,i){if(this._instance=t,this.group=e,this.tt=new Ll(t,e.id),this.et=new Nl(t,e.id),this.nt=new Dl(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.tt.onConfig(n),this.et.onConfig(n),this.nt.onConfig(n,i);const s=[this.et,this.tt,this.nt];this.it="any"===e.conditions.matchType?new Al(s):new Ol(s)}else this.it=new Pl}triggerStatus(t){return this.it.triggerStatus(t)}triggerStatusNoSideEffects(t){return this.it.triggerStatusNoSideEffects(t)}getPendingTriggerConditions(t){return"trigger_pending"!==this.triggerStatusNoSideEffects(t)?[]:[{label:"URL condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.et.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.nt.triggerStatusNoSideEffects()}].filter(({status:t})=>t===Tl).map(({label:t})=>t)}checkEventTriggerConditions(t,e,i){this.et.checkEventTriggerConditions(t,e,i)}checkUrlTriggerConditions(t,e,i,n){this.tt.checkUrlTriggerConditions(t,e,i,n)}activateTrigger(t,e){var i;const n="url"===t?pt+this.group.id:ft+this.group.id;null===(i=this._instance.persistence)||void 0===i||i.register({[n]:e})}stop(){this.tt.stop(),this.et.stop(),this.nt.stop()}};function ql(t){if(t.rrwebError)return xl;if(!t.receivedFlags)return wl;if(!t.isRecordingEnabled)return yl;if(t.urlTriggerMatching.urlBlocked)return kl;const e=!0===t.isSampled,i=new Al([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?bl:"trigger_activated"===i?_l:"trigger_pending"===i?wl:!1===t.isSampled?yl:_l}function Bl(t){if(t.rrwebError)return xl;if(!t.receivedFlags)return wl;if(!t.isRecordingEnabled)return yl;if(t.urlTriggerMatching.urlBlocked)return kl;const e=new Ol([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),i=e!==Cl,n=Pe(t.isSampled);return i&&"trigger_pending"===e?wl:i&&"trigger_disabled"===e||n&&!t.isSampled?yl:!0===t.isSampled?bl:_l}function zl(t){return"ph_replay_pending_buffer_"+JSON.stringify([t.persistence_name||t.token,t.token])}function Ul(){const t=[];return function(e,i){if($e(i)||Se(i)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(i)?"[Circular]":(t.push(i),i)}return i}}function Hl(t){try{const e=JSON.stringify(t,Ul());return e?new Blob([e]).size:0}catch(t){return-1}}function Wl(t){if(Ie(t))return 4;if(Ce(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+=Ce(n)||Ie(n)?4:Wl(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];Ce(s)||(n||(i+=1),n=!1,i+=t.length+3+Wl(s))}return i}default:return 0}}function Vl(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[Vl({size:i.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),Vl({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 Gl=Uint8Array,Jl=Uint16Array,Ql=Uint32Array,Zl=new Gl([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]),Kl=new Gl([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]),Yl=new Gl([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xl=function(t,e){for(var i=new Jl(31),n=0;31>n;++n)i[n]=e+=1<<t[n-1];var s=new Ql(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]},ta=Xl(Zl,2),ea=ta[1];ta[0][28]=258,ea[258]=28;for(var ia=Xl(Kl,0)[1],na=new Jl(32768),sa=0;32768>sa;++sa){var ra=(43690&sa)>>>1|(21845&sa)<<1;na[sa]=((65280&(ra=(61680&(ra=(52428&ra)>>>2|(13107&ra)<<2))>>>4|(3855&ra)<<4))>>>8|(255&ra)<<8)>>>1}var oa=function(t,e,i){for(var n=t.length,s=0,r=new Jl(e);n>s;++s)++r[t[s]-1];var o,l=new Jl(e);for(s=0;e>s;++s)l[s]=l[s-1]+r[s-1]<<1;if(i){o=new Jl(1<<e);var a=15-e;for(s=0;n>s;++s)if(t[s])for(var u=s<<4|t[s],c=e-t[s],h=l[t[s]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[na[h]>>>a]=u}else for(o=new Jl(n),s=0;n>s;++s)o[s]=na[l[t[s]-1]++]>>>15-t[s];return o},la=new Gl(288);for(sa=0;144>sa;++sa)la[sa]=8;for(sa=144;256>sa;++sa)la[sa]=9;for(sa=256;280>sa;++sa)la[sa]=7;for(sa=280;288>sa;++sa)la[sa]=8;var aa=new Gl(32);for(sa=0;32>sa;++sa)aa[sa]=5;var ua=oa(la,9,0),ca=oa(aa,5,0),ha=function(t){return(t/8|0)+(7&t&&1)},da=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var n=new(t instanceof Jl?Jl:t instanceof Ql?Ql:Gl)(i-e);return n.set(t.subarray(e,i)),n},va=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8},fa=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8,t[n+2]|=i>>>16},pa=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 Gl(0),0];if(1==s){var o=new Gl(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,c=1,h=2;for(i[0]={s:-1,f:l.f+a.f,l:l,r:a};c!=s-1;)l=i[i[h].f>i[u].f?u++:h++],a=i[u!=c&&i[h].f>i[u].f?u++:h++],i[c++]={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 Jl(d+1),f=ga(i[c-1],v,0);if(f>e){n=0;var p=0,g=f-e,m=1<<g;for(r.sort(function(t,e){return v[e.s]-v[t.s]||t.f-e.f});s>n;++n){var y=r[n].s;if(e>=v[y])break;p+=m-(1<<f-v[y]),v[y]=e}for(p>>>=g;p>0;){var b=r[n].s;e>v[b]?p-=1<<e-v[b]++-1:++n}for(;n>=0&&p;--n){var _=r[n].s;v[_]==e&&(--v[_],++p)}f=e}return[new Gl(v),f]},ga=function(t,e,i){return-1==t.s?Math.max(ga(t.l,e,i+1),ga(t.r,e,i+1)):e[t.s]=i},ma=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Jl(++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]},ya=function(t,e){for(var i=0,n=0;e.length>n;++n)i+=t[n]*e[n];return i},ba=function(t,e,i){var n=i.length,s=ha(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)},_a=function(t,e,i,n,s,r,o,l,a,u,c){va(e,c++,i),++s[256];for(var h=pa(s,15),d=h[0],v=h[1],f=pa(r,15),p=f[0],g=f[1],m=ma(d),y=m[0],b=m[1],_=ma(p),w=_[0],k=_[1],S=new Jl(19),x=0;y.length>x;++x)S[31&y[x]]++;for(x=0;w.length>x;++x)S[31&w[x]]++;for(var T=pa(S,7),C=T[0],E=T[1],M=19;M>4&&!C[Yl[M-1]];--M);var I,R,A,O,P=u+5<<3,F=ya(s,la)+ya(r,aa)+o,L=ya(s,d)+ya(r,p)+o+14+3*M+ya(S,C)+(2*S[16]+3*S[17]+7*S[18]);if(F>=P&&L>=P)return ba(e,c,t.subarray(a,a+u));if(va(e,c,1+(F>L)),c+=2,F>L){I=oa(d,v,0),R=d,A=oa(p,g,0),O=p;var D=oa(C,E,0);for(va(e,c,b-257),va(e,c+5,k-1),va(e,c+10,M-4),c+=14,x=0;M>x;++x)va(e,c+3*x,C[Yl[x]]);c+=3*M;for(var N=[y,w],j=0;2>j;++j){var q=N[j];for(x=0;q.length>x;++x)va(e,c,D[B=31&q[x]]),c+=C[B],B>15&&(va(e,c,q[x]>>>5&127),c+=q[x]>>>12)}}else I=ua,R=la,A=ca,O=aa;for(x=0;l>x;++x)if(n[x]>255){var B;fa(e,c,I[257+(B=n[x]>>>18&31)]),c+=R[B+257],B>7&&(va(e,c,n[x]>>>23&31),c+=Zl[B]);var z=31&n[x];fa(e,c,A[z]),c+=O[z],z>3&&(fa(e,c,n[x]>>>5&8191),c+=Kl[z])}else fa(e,c,I[n[x]]),c+=R[n[x]];return fa(e,c,I[256]),c+R[256]},wa=new Ql([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ka=new Gl(0),Sa=function(){for(var t=new Ql(256),e=0;256>e;++e){for(var i=e,n=9;--n;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),xa=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function $a(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=Sa[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 Gl(n+o+5*(1+Math.floor(o/7e3))+s),a=l.subarray(n,l.length-s),u=0;if(!e||8>o)for(var c=0;o>=c;c+=65535){var h=c+65535;o>h?u=ba(a,u,t.subarray(c,h)):(a[c]=r,u=ba(a,u,t.subarray(c,o)))}else{for(var d=wa[e-1],v=d>>>13,f=8191&d,p=(1<<i)-1,g=new Jl(32768),m=new Jl(p+1),y=Math.ceil(i/3),b=2*y,_=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<b)&p},w=new Ql(25e3),k=new Jl(288),S=new Jl(32),x=0,T=0,C=(c=0,0),E=0,M=0;o>c;++c){var I=_(c),R=32767&c,A=m[I];if(g[R]=A,m[I]=R,c>=E){var O=o-c;if((x>7e3||C>24576)&&O>423){u=_a(t,a,0,w,k,S,T,C,M,c-M,u),C=x=T=0,M=c;for(var P=0;286>P;++P)k[P]=0;for(P=0;30>P;++P)S[P]=0}var F=2,L=0,D=f,N=R-A&32767;if(O>2&&I==_(c-N))for(var j=Math.min(v,O)-1,q=Math.min(32767,c),B=Math.min(258,O);q>=N&&--D&&R!=A;){if(t[c+F]==t[c+F-N]){for(var z=0;B>z&&t[c+z]==t[c+z-N];++z);if(z>F){if(F=z,L=N,z>j)break;var U=Math.min(N,z-2),H=0;for(P=0;U>P;++P){var W=c-N+P+32768&32767,V=W-g[W]+32768&32767;V>H&&(H=V,A=W)}}}N+=(R=A)-(A=g[R])+32768&32767}if(L){w[C++]=268435456|ea[F]<<18|ia[L];var G=31&ea[F],J=31&ia[L];T+=Zl[G]+Kl[J],++k[257+G],++S[J],E=c+F,++x}else w[C++]=t[c],++k[t[c]]}}u=_a(t,a,r,w,k,S,T,C,M,c-M,u),r||(u=ba(a,u,ka))}return da(l,0,n+ha(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)),c=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&xa(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),xa(u,c-8,i.d()),xa(u,c-4,n),u}function Ta(t,e){var i=t.length;if(!e&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new Gl(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 Gl(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 da(n,0,s)}function Ca(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 Ea=class{constructor(t,e={}){var i,n,s,r;this._rrweb=t,this.rt=e,this.ot={},this.st=Date.now(),this.ut=-1/0,this.ct=()=>{const t=Date.now(),e=t-this.st;e>0?(this.dt=Math.min(this.ht,this.dt+e/1e3*this.ft),this.st=t):this.st=t},this.vt=t=>{if(!this.ot[t]){var e,i;this.ot[t]=!0;const n=this.yt(t);null===(e=(i=this.rt).onBlockedNode)||void 0===e||e.call(i,t,n)}},this.bt=t=>{const e=this.yt(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.yt=t=>this._rrweb.mirror.getNode(t),this.wt=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.wt(e);if(e.attributes){const t=e.attributes.length;e.attributes=e.attributes.filter(t=>{const[e]=this.bt(t.id);return!this.kt.consumeRateLimit(e)&&t});const i=t-e.attributes.length;var n,s;i>0&&(null===(n=(s=this.rt).onDroppedAttributeMutations)||void 0===n||n.call(s,i))}const r=this.wt(e);if(0===r&&i!==r)return;if(this.St)return t;this.ct();const o=Wl(t);var l,a;return o>this.dt?(null===(l=(a=this.rt).onDroppedOversizedMutation)||void 0===l||l.call(a,o),void this._t()):(this.dt-=o,t)},this._t=()=>{if(this.xt)return;const t=Math.max(0,this.Ct-(Date.now()-this.ut));this.xt=setTimeout(()=>{var t,e;this.xt=void 0,this.ut=Date.now(),null===(t=(e=this.rt).requestFullSnapshot)||void 0===t||t.call(e)},t)},this.kt=new Ze({bucketSize:null!==(i=this.rt.bucketSize)&&void 0!==i?i:100,refillRate:null!==(n=this.rt.refillRate)&&void 0!==n?n:10,refillInterval:1e3,I:this.vt,R:Ur}),this.ht=null!==(s=this.rt.bytesBucketSize)&&void 0!==s?s:0,this.ft=null!==(r=this.rt.bytesRefillRate)&&void 0!==r?r:25600,this.St=!Number.isFinite(this.ht)||0>=this.ht,this.dt=this.ht;const o=this.rt.resyncIntervalMs;this.Ct=Ae(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this.ot={},this.xt&&(clearTimeout(this.xt),this.xt=void 0),this.ut=Date.now()}stop(){this.kt.stop(),this.reset(),this.dt=this.ht,this.st=Date.now(),this.ut=-1/0}};const Ma=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}};var Ia=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}},Ra=class{generate(){const t=this.generateOrAbort();if(!Ce(t))return t;{this.Mt=0;const t=this.generateOrAbort();if(Ce(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return Ae(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Mt)this.Mt=t,this.Tt();else{if(this.Mt>=t+1e4)return;this.It++,this.It>4398046511103&&(this.Mt++,this.Tt())}return Ia.fromFieldsV7(this.Mt,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.At.nextUint32())}Tt(){this.It=1024*this.At.nextUint32()+(1023&this.At.nextUint32())}constructor(){this.Mt=0,this.It=0,this.At=new Pa}};const Aa=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};let Oa;var Pa=class{nextUint32(){var t;return this.Rt.length>this.Et||((null!==(t=Oa)&&void 0!==t?t:Oa="u">typeof window&&!Ce(window.crypto)&&crypto.getRandomValues?t=>{try{return crypto.getRandomValues(t)}catch(e){return Aa(t)}}:Aa)(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}};let Fa;const La=()=>Da().toString(),Da=()=>(Fa||(Fa=new Ra)).generate();let Na="";const ja=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let qa=null;const Ba={Ot(){if(!Ie(qa))return qa;if(qa=!1,n)try{const t=`__ph_cookie_support_${La()}`;Ba.$t(t,"xyz"),qa='"xyz"'===Ma(t),Ba.Dt(t)}catch(t){qa=!1}return qa},Ft(t){Ur.error("cookieStore error: "+t)},Lt:Ma,Pt(t){let e;try{e=JSON.parse(Ba.Lt(t))||{}}catch(t){}return e},$t(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(Na)return Na;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_"+La();for(;!Na&&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",Na=t)}return Na}(t);if(!e){const i=(t=>{const e=t.match(ja);return e?e[0]:""})(t);i!==e&&Ur.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&&Ur.warn("cookieStore warning: large cookie, len="+u.length),n.cookie=u,!0}catch(t){return!1}},Dt(t,e){if((null==n?void 0:n.cookie)&&(!e||!Ie(Ma(t))))try{Ba.$t(t,"",-1,e)}catch(t){return}}};let za=null;const Ua={Ot(){if(!Ie(za))return za;let e=!0;if(Ce(t))e=!1;else try{const t="__mplssupport__";Ua.$t(t,"xyz"),'"xyz"'!==Ua.Lt(t)&&(e=!1),Ua.Dt(t)}catch(t){e=!1}return e||Ur.error("localStorage unsupported; falling back to cookie store"),za=e,e},Ft(t){Ur.error("localStorage error: "+t)},Lt(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Ua.Ft(t)}return null},Pt(t){try{return JSON.parse(Ua.Lt(t))||{}}catch(t){}return null},$t(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Ua.Ft(t)}return!1},Dt(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Ua.Ft(t)}}},Ha=[w,v,b,f,x,m,g,p,k],Wa=[N,D,ut,ct,Ot,At,U,Ct],Va=t=>t+"_cpm",Ga=["__proto__","constructor","prototype"],Ja=t=>{if(!$e(t))return{};const e={};return Object.keys(t).forEach(i=>{-1===Ga.indexOf(i)&&(e[i]=t[i])}),e},Qa=(t,e=[])=>{const i={};return[...Wa,...e].forEach(e=>{const n=t[e];Ce(n)||Ie(n)||""===n||(i[e]=n)}),i},Za=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)},Ka=(t,e)=>({p:e,f:Za(JSON.stringify(t))}),Ya=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const i=Ba.Pt(Va(t)),n=(null==i?void 0:i.f)===Za(e)&&Se(i.p);return{properties:n?i.p:[],isValid:n}}catch(t){return{properties:[],isValid:!1}}},Xa=(t,e)=>e+"|"+(Ba.Lt(Va(t))||""),tu={},eu={Ot:()=>!0,Ft(t){Ur.error("memoryStorage error: "+t)},Lt:t=>t in tu?tu[t]:null,Pt:t=>t in tu?tu[t]:null,$t:(t,e)=>(tu[t]=e,!0),Dt(t){delete tu[t]}};let iu=null;const nu={Ot(){if(!Ie(iu))return iu;if(iu=!0,Ce(t))iu=!1;else try{const t="__support__";nu.$t(t,"xyz"),'"xyz"'!==nu.Lt(t)&&(iu=!1),nu.Dt(t)}catch(t){iu=!1}return iu},Ft(t){Ur.error("sessionStorage error: ",t)},Lt(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){nu.Ft(t)}return null},Pt(t){try{return JSON.parse(nu.Lt(t))||null}catch(t){}return null},$t(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){nu.Ft(t)}return!1},Dt(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){nu.Ft(t)}}};Br.DEBUG=!1,Br.LIB_VERSION="1.455.1",Br.LIB_NAME="web";var su=Br,ru=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.Nt=t.get_property.bind(t),this.qt=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.qt(yt,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){const e=this.Nt(yt);return $e(i=e)&&Ee(i.sessionId)&&Ae(i.size)&&e.sessionId===t?e.size:0;var i}};function ou(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<Qe(100*e,0,100,Ur)}function lu(t){return`$survey_response_${t}`}function au(t,e){if(!e)return null;const i=t[lu(e)];return Se(i)?[...i]:i}function uu({event:t,survey:e,responses:i={},submissionId:n,completed:s,surveyLanguage:r,questionSnapshots:o}){return ue(ue(ue(ue({},!Ce(n)&&{$survey_submission_id:n}),"sent"===t?!Ce(s)&&{$survey_completed:s}:{$survey_partially_completed:cu(i)}),r&&{$survey_language:r}),function(t={},e,i){const n={};return e.questions.forEach(e=>{if(Ce(e.originalQuestionIndex))return;const i=0===(s=e.originalQuestionIndex)?"$survey_response":`$survey_response_${s}`;var s;const r=au(t,e.id);Ce(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:au(t,e.id)}})},t),n)}(i,e,o))}function cu(t={}){return Object.values(t).some(t=>!Re(t))}function hu(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 du(t){return"string"==typeof t&&t.trim()?t.trim():null}function vu(t){return t.toLowerCase()}function fu(t,e,i){if(!t||!e)return null;const n=vu(e),s=Object.keys(t).find(t=>vu(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=>vu(t)===s);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${e})`),r}return null}const pu=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function gu(t,e,i){var n;const s=fu(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}`),Ce(e.name)||(r.name=e.name,o=!0),r.appearance){const t=ue({},r.appearance);for(const i of pu){const n=e[i];Ce(n)||(t[i]=n,o=!0)}r.appearance=t}else(function(t){return pu.some(e=>!Ce(t[e]))})(e)&&(o=!0)}const a=t.questions.map(t=>function(t,e,i){var n;const s=fu(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 Ce(r.question)||(o.question=r.question,l=!0),Ce(r.description)||(o.description=r.description,l=!0),Ce(r.buttonText)||(o.buttonText=r.buttonText,l=!0),"link"in o&&!Ce(r.link)&&(o.link=r.link,l=!0),"lowerBoundLabel"in o&&!Ce(r.lowerBoundLabel)&&(o.lowerBoundLabel=r.lowerBoundLabel,l=!0),"upperBoundLabel"in o&&!Ce(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),c=a.some(t=>t.hasChanges);let h=null;return s||(h=(null===(n=a.find(t=>t.matchedKey))||void 0===n?void 0:n.matchedKey)||null),c&&(r.questions=u,o=!0,null==i||i.info(`Applied question-level translations for language: ${e}`)),{survey:r,matchedKey:o?s||h:null}}function mu(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 yu(t){var e;return mu(t)&&!!(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e?void 0:e.repeatedActivation)||"always"===t.schedule}const bu=(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}},_u=t=>t.toLowerCase(),wu={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=>bu(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!bu(e,t))),icontains:(t,e)=>e.map(_u).some(e=>t.map(_u).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(_u).every(e=>t.map(_u).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 ku(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=wu[i.operator];return!!s&&s(i.values.map(String),[String(n)])})}const Su=t=>{const e=[...t];for(let t=e.length-1;t>0;t--){const i=Math.floor(Math.random()*(t+1));[e[t],e[i]]=[e[i],e[t]]}return e};function xu(t,e,i){return lo({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}const $u=new Set(["is_not","not_icontains","not_regex"]);function Tu(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(Ce(s)||Ie(s))return $u.has(r);const o=wu[r];return!!o&&!Ce(t.value)&&!Ie(t.value)&&o(Se(t.value)?t.value.map(String):[String(t.value)],Se(s)?s.map(String):[String(s)])})}const Cu=Hr("[SessionRecording]");function Eu(t,e){return e?t:"x"+t}function Mu(t,e){return t===e||t!=="x"+e&&null}var Iu=class{constructor(t,e,i,n,s,r,o){this._instance=t,this.tt=e,this.et=i,this.nt=n,this.jt=s,this.Bt=r,this.zt=o,this.Ut=null,this.Wt=Bl}onRemoteConfig(t){this.Ut=Ae(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ht=new Al([this.et,this.tt]),this.Wt=ql):(this.Ht=new Ol([this.et,this.tt]),this.Wt=Bl),this._instance.register_for_session({[Ht]:t.triggerMatchType}),this.tt.onConfig(t),this.et.onConfig(t),this.nt.onConfig(t,(t,e)=>{this.jt("linked_flag_matched",{flag:t,variant:e}),this.zt()})}getStatus(t){return this.Wt({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 Ae(i)?i:null}checkUrlTriggers(t,e,i,n){this.tt.checkUrlTriggerConditions(e,i,n,t)}setupEventTriggerListeners(t,e,i){if(0!==this.et.K.length&&Re(this.Gt))return this.Gt=t(t=>{try{this.et.checkEventTriggerConditions(t.event,i,e)}catch(t){Cu.error("Could not activate event trigger",t)}}),this.Gt}makeSamplingDecisions(t){var e;const i=this.Ut;var n,s;if(!Ae(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(ct),o=this._instance.get_property(st),l=Mu(r,t),a=Ae(o)&&o!==i,u=Ce(o)&&r===t,c=a||u||!Pe(l),h=c?ou(t,i):l;c&&(h?this.jt("sampled"):Cu.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:Eu(t,h),$replay_sample_rate:Ie(o)&&r===t?null:i})}ensureSamplingDecision(t){if(!Ae(this.Ut))return;const e=this._instance.get_property(ct);Pe(Mu(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.Ht)||void 0===e?void 0:e.triggerStatus(t))===Tl}getPendingTriggerConditions(t){return[{label:"URL condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.et.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.nt.triggerStatusNoSideEffects()}].filter(({status:t})=>t===Tl).map(({label:t})=>t)}stop(){var t;null===(t=this.Gt)||void 0===t||t.call(this),this.Gt=void 0,this.et.stop(),this.tt.stop(),this.nt.stop()}},Ru=class{constructor(t,e,i,n,s){this._instance=t,this.tt=e,this.jt=i,this.Vt=n,this.zt=s,this.Qt=[],this.Zt=new Map,this.Jt=!1}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Yt(t.triggerGroups),this._instance.register_for_session({[Ht]:"v2_trigger_groups",[Wt]:t.triggerGroups.length}),this.tt.onConfig(t)):Cu.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return xl;if(!t.receivedFlags)return wl;if(!t.isRecordingEnabled)return yl;if(t.urlTriggerMatching.urlBlocked)return kl;const e=t.triggerGroupMatchers,i=t.triggerGroupSamplingResults;if(0===e.length)return yl;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);Ce(e)?Ur.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(s=!0)}else"trigger_pending"===e&&(n=!0)}return s?bl:n?wl:yl}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Qt,triggerGroupSamplingResults:this.Zt,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){let e=null;for(const i of this.Qt)if("trigger_activated"===i.triggerStatus(t)){const t=i.group.minDurationMs;Ae(t)&&(Ie(e)||e>t)&&(e=t)}return e}checkUrlTriggers(t,e,i,n){this.tt.checkUrlBlocklist(e,i);for(const n of this.Qt)n.checkUrlTriggerConditions(e,i,e=>{this.Kt(n,void 0)&&(n.activateTrigger(e,t),this.updateActiveTriggers(t),this.zt(e))},t)}setupEventTriggerListeners(t,e,i){return this.Gt=t(t=>{var i;if(this.Jt)return Cu.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(i=this.Gt)||void 0===i||i.call(this),void(this.Gt=void 0);try{for(const i of this.Qt)i.checkEventTriggerConditions(t.event,n=>{if(!this.Kt(i,t.properties))return;const s=(i.group.conditions.events||[]).filter(e=>e.name===t.event),r=this._instance.get_property(w);s.some(e=>!e.properties||0===e.properties.length||Tu(e.properties,t.properties,r))&&(i.activateTrigger(n,e),this.updateActiveTriggers(e),this.zt(n))},e)}catch(t){Cu.error("Could not activate event trigger for trigger groups",t)}}),this.Gt}makeSamplingDecisions(t){for(const i of this.Qt){var e;const n=i.group,s=n.id,r=n.sampleRate,o=gt+s,l=this._instance.get_property(o);let a=null,u=!1,c=!1,h=!1;if($e(l)){const e=l.sessionId,i=l.sampleRate,n=l.sampled;u="string"==typeof e&&e!==t,c=Ae(i)&&i!==r,a=e===t&&Ae(i)&&i===r&&Pe(n)?n:null}else a=l===t||null,u="string"==typeof l&&l!==t,h=l===t;const d=u||c||h||!Pe(a),v=d?ou(t+s,r):a;d&&this.Vt("triggerGroupSamplingDecisionMade",{group_id:s,group_name:n.name,sampleRate:r,isSampled:v}),this.Zt.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.Jt=!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.Qt){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.Qt){const n=i.group,s=n.id,r="trigger_activated"===i.triggerStatus(t),o=!0===this.Zt.get(s);r&&e.push({id:s,name:n.name,matched:!0,sampled:o})}this._instance.register_for_session({[zt]:e})}hasPendingTriggers(t){for(const e of this.Qt)if("trigger_pending"===e.triggerStatus(t))return!0;return!1}getPendingTriggerConditions(t){return this.Qt.flatMap(e=>"trigger_pending"!==e.triggerStatusNoSideEffects(t)?[]:e.getPendingTriggerConditions(t).map(t=>`trigger group "${e.group.name}": ${t}`))}stop(){var t;null===(t=this.Gt)||void 0===t||t.call(this),this.Gt=void 0,this.Qt.forEach(t=>t.stop()),this.Qt=[],this.Zt.clear(),this.tt.stop()}Kt(t,e){const i=t.group.conditions.properties;return!i||0===i.length||Tu(i,e,this._instance.get_property(w))}Yt(t){this.Qt.forEach(t=>t.stop()),this.Qt=[],this.Zt.clear();for(const e of t){const t=new jl(this._instance,e,(t,i)=>{this.jt("linked_flag_matched",{flag:t,variant:i,group_id:e.id,group_name:e.name}),this.zt()});this.Qt.push(t)}}};function Au(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}const Ou=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],Pu=["ScCid","SsCid"],Fu={sccid:Pu},Lu=(()=>[...Ou,...Pu,"sscid"])(),Du=(()=>["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ou])(),Nu="<masked>",ju=["li_fat_id"];function qu(t,e,i){if(!n)return{};const s=e?[...Lu,...i||[]]:[],r=Bu(co(n.URL,s,Nu),t),o=function(){const t={};return Vr(ju,function(e){const i=Ma(e);t[e]=i||null}),t}();return Gr(o,r)}function Bu(t,e){const i=Du.concat(e||[]),n={};return Vr(i,function(e){let i=uo(t,e);!i&&we.call(Fu,e)&&Wr(Fu[e],function(e){i=i||uo(t,e)}),n[e]=i||null}),n}function zu(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(!Ie(e)){s.$search_engine=e;const t=n?uo(n.referrer,i):"";t.length&&(s.ph_keyword=t)}return s}function Uu(){return navigator.language||navigator.userLanguage}function Hu(){const t=Uu();return"string"==typeof t?t.split("-")[0]:void 0}const Wu="$direct";function Vu(){return(null==n?void 0:n.referrer)||Wu}function Gu(t,e,i=!1){const n=t?[...Lu,...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:Vu().substring(0,1e3),u:o?co(o,n,Nu):void 0}}function Ju(t,e=!1,i,n){var s;const{r:r,u:o}=t,l=e?un(o):o,a=l&&i?co(l,[...Lu,...n||[]],Nu):l,u={$referrer:r,$referring_domain:null==r?void 0:r==Wu?Wu:null===(s=io(r))||void 0===s?void 0:s.host};if(a){u.$current_url=a;const t=io(a);u.$host=null==t?void 0:t.host,u.$pathname=null==t?void 0:t.pathname,Gr(u,Bu(a))}if(r){const t=zu(r);Gr(u,t)}return u}function Qu(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const Zu=1e5,Ku=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Yu=[],Xu=()=>!1,tc="@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(" "),ec="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),ic="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(" "),nc="Accommodation AdministrativeArea Country Place State".split(" "),sc={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:ec,publisher:ic},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Yu},Offer:{seller:ic},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:ic,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:ic,areaServed:nc,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Yu}},rc=[["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(" "),sc.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),sc.Event],[ic,sc.Organization],[nc,sc.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),sc.Product]];function oc(t,e){return we.call(t,e)?t[e]:void 0}function lc(t){const e=typeof t;return Ie(t)||"string"===e||"number"===e||"boolean"===e}function ac(t,e){return e&&function(t){return Ee(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function uc(t,e){return Se(t)&&t.every(lc)?t.map(t=>ac(t,e)).filter(t=>!Ce(t)):lc(t)?ac(t,e):void 0}function cc(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 hc(t){if(we.call(sc,t))return sc[t];for(const[e,i]of rc)if(e.includes(t))return i}function dc(t,e,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0})}function vc(t,e,i,n){if(Se(t)){const s=t.map(t=>vc(t,e,i,n)).filter(t=>!Ce(t));return s.length?s:void 0}return fc(t,e,i,n)||void 0}function fc(t,e,i,n){if(!$e(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(i))return null;const s=oc(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&&Ku.test(i)&&!e.has(i)&&(e.add(i),n.push(i),20===n.length))break}return n}(s),o=r.filter(t=>!!hc(t)&&(!n||!n.length||n.includes(t))),l={};for(const n of tc){const o="@type"===n?r.length?"string"==typeof s?r[0]:r:void 0:"@id"===n?cc(oc(t,n),e):uc(oc(t,n),i.maskUrl);Ce(o)||dc(l,n,o)}for(const n of o){const s=hc(n);for(const n of Object.keys(s)){const r=oc(t,n),o=s[n];if(!0===o){const t=uc(r,i.maskUrl);Ce(t)||dc(l,n,t)}else{const t=vc(r,e,i,o);Ce(t)||dc(l,n,t)}}}const a=vc(oc(t,"@graph"),e,i);return Ce(a)||dc(l,"@graph",a),Object.keys(l).length?l:null}function pc(t,e,i){if(!$e(t))return null;const n=oc(t,"@context");if("string"!=typeof n||!/^https?:\/\/schema\.org\/?$/.test(n))return null;const s=fc(t,e,i);return s?ue({"@context":"https://schema.org"},s):null}function gc(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function mc(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 yc(t,e,i){for(let n=t;n;){if(mc(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 bc(t){return gc(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(gc)}const _c=3e5;function wc(t){return $e(t)?t.network_timing:t}const kc=/^please (take full snapshot|add custom event) after start recording$/,Sc=Hr("[SessionRecording]"),xc=[1,2,3,4,5,6,7,12],$c=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function Tc(){var t;return null==h||null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function Cc(){var t;return null===(t=Tc())||void 0===t?void 0:t.record}function Ec(t){try{return JSON.stringify(t)}catch(e){if(e instanceof RangeError)throw e;return JSON.stringify(t,Ul())}}function Mc(t){return Ca($a(Ta(Ec(t))),!0)}function Ic(t){return Rc.apply(this,arguments)}function Rc(){return(Rc=re(function*(t){const e=yield bs(Ec(t),su.DEBUG,{rethrow:!0});return Ca(new Uint8Array(yield e.arrayBuffer()),!0)})).apply(this,arguments)}let Ac,Oc;const Pc="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let Fc=!1;function Lc(t){var e;return Se(t)&&0===t.length?(Ac=null!==(e=Ac)&&void 0!==e?e:Mc([]),Ac):Mc(t)}function Dc(t){return Nc.apply(this,arguments)}function Nc(){return(Nc=re(function*(t){var e;return Se(t)&&0===t.length?Ac||(Oc=null!==(e=Oc)&&void 0!==e?e:Ic([]).then(t=>(Ac=t,t)).catch(t=>{throw Ac=void 0,Oc=void 0,t}),Oc):Ic(t)})).apply(this,arguments)}function jc(t){return Pc&&!Fc&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function qc(t){return{event:t,size:Wl(t)}}function Bc(t,e){return ue(ue({},t),{},{data:e,cv:"2024-10"})}function zc(t,e){return ue(ue({},t),{},{cv:"2024-10",data:ue(ue({},t.data),e)})}function Uc(t){try{if(2===t.type)return qc(Bc(t,Mc(t.data)));if(3===t.type&&0===t.data.source)return qc(zc(t,{texts:Lc(t.data.texts),attributes:Lc(t.data.attributes),removes:Lc(t.data.removes),adds:Lc(t.data.adds)}));if(3===t.type&&8===t.data.source)return qc(zc(t,{adds:t.data.adds?Mc(t.data.adds):void 0,removes:t.data.removes?Mc(t.data.removes):void 0}))}catch(t){Sc.warn("could not compress event - will use uncompressed event",t)}return{event:t,size:Hl(t)}}function Hc(){return Hc=re(function*(t){try{if(2===t.type)return qc(Bc(t,yield Ic(t.data)));if(3===t.type&&0===t.data.source){const[e,i,n,s]=yield Promise.all([Dc(t.data.texts),Dc(t.data.attributes),Dc(t.data.removes),Dc(t.data.adds)]);return qc(zc(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?Ic(t.data.adds):void 0,t.data.removes?Ic(t.data.removes):void 0]);return qc(zc(t,{adds:e,removes:i}))}}catch(e){return vs(e)&&(Fc=!0),Sc.warn("could not compress event asynchronously - trying synchronous compression",e),Uc(t)}return{event:t,size:Hl(t)}}),Hc.apply(this,arguments)}function Wc(t,e){return 5===t.type&&t.data.tag===e}function Vc(t){return Wc(t,"sessionIdle")}function Gc(t){return Wc(t,"$session_ending")}function Jc(t){return Wc(t,"$session_starting")}var Qc=class{get sessionId(){return this.Xt}get te(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get ee(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get ne(){return Mu(this._instance.get_property(ct),this.sessionId)}get Ut(){var t;const e=null===(t=this.ie)||void 0===t?void 0:t.sampleRate;return Ae(e)?e:null}get re(){var t,e;return null!==(t=null===(e=this.oe)||void 0===e?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t,e){this._instance=t,this.supportsSelectMasking=!0,this.se="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.ae=void 0,this.le=void 0,this.ue=!1,this.ce=Date.now(),this.de=!1,this.he=[],this.fe="unknown",this.ve=0,this.pe=0,this.me=0,this.ge=0,this.ye=0,this.be=!1,this.we=!1,this.ke=!1,this.Se=!1,this._e=!1,this.xe=!1,this.Ce=0,this.Me=void 0,this.Te=void 0,this.Ie=0,this.Ae=void 0,this.Re=void 0,this.Ee=0,this.Oe=!1,this.$e=!1,this.Le=!1,this.De=!1,this.Fe=!1,this.Pe=!1,this.Ne=!1,this.qe=void 0,this.je=void 0,this.Be=!1,this.ze=[],this.Ue=0,this.We=0,this.He=!1,this.Ge=void 0,this.Gt=void 0,this.Ve=void 0,this.Qe=void 0,this.Ze=void 0,this.Je=(t,e,i)=>{var n,s,r,o;if(!i)return;if(t===this.Xt&&e===this.Ye)return;const l=!i.noSessionId&&(i.activityTimeout||i.sessionPastMaximumLength),a=this.Xt,u=this.Ye;var c;if(l&&this.Vt("$session_ending",{currentSessionId:a,currentWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.ce,flushed_size:null===(c=this.Ke)||void 0===c?void 0:c.currentTrackedSize(a)}),null===(n=this._instance.persistence)||void 0===n||n.unregister("$debug_first_full_snapshot_timestamp"),null===(s=Tc())||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.Xe(),!(!1===this.fe&&this.isStarted||this.Xt===t&&this.Ye===e)){const e=this.Xt!==t&&!1!==this.fe;this.fe="unknown",this.tn(e)}l&&this.Vt("$session_starting",{previousSessionId:a,previousWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.ce}),null===(o=this.oe)||void 0===o||o.makeSamplingDecisions(t)},this.en=!1,this.nn=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[ht])===this.Xt},this.rn=()=>{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 Ae(i)&&Ae(n)?n-i:null},this.sn=()=>{var t,e;const i=this.re;if(!Ae(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.an;return Ae(t)&&t>=0&&i>t}if(this.nn())return!1;const n=this.rn();return!!Ie(n)||i>n||(null===(s=this._instance.persistence)||void 0===s||s.register({$session_past_minimum_duration:this.Xt}),!1);var s},this.ln=()=>{"buffering"!==this.status?(this.be&&this.we&&this.un&&(this.cn(void 0),this.ke&&(this.ke=!1,this.Bt())),this.dn(),this.hn(!0)):this.fn()},this.vn=()=>{this.ln()},this.pn=()=>{this.Vt("browser offline",{})},this.mn=()=>{this.Vt("browser online",{})},this.gn=()=>{(null==n?void 0:n.visibilityState)&&("visible"===n.visibilityState&&(this.un=!0),this.Vt("window "+n.visibilityState,{}))},this.un=null==e||e;const{sessionId:i,windowId:s,sessionStartTimestamp:r}=this.te.checkAndGetSessionAndWindowId();this.Xt=i,this.Ye=s,this._sessionStartTimestamp=r,this.nt=new Dl(this._instance),this.tt=new Ll(this._instance),this.et=new Nl(this._instance),this.Rt=this.fn(),this.yn=zl(this._instance.config),this.te.sessionTimeoutMs>this.ee||Sc.warn(`session_idle_threshold_ms (${this.ee}) is greater than the session timeout (${this.te.sessionTimeoutMs}). Session will never be detected as idle`),this.Ke=new ru(this._instance)}setDocumentWasEverVisible(t){t&&(this.un=!0)}get bn(){var t,e,i,n,s,r,o,l,a;const u=null===(t=this.ie)||void 0===t?void 0:t.masking,c={maskAllInputs:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.maskAllInputs,maskTextSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.maskTextSelector,blockSelector:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.blockSelector,maskAllElementAttributes:null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.maskAllElementAttributes},h=null!==(r=null==c?void 0:c.maskAllInputs)&&void 0!==r?r:null==u?void 0:u.maskAllInputs,d=null!==(o=null==c?void 0:c.maskTextSelector)&&void 0!==o?o:null==u?void 0:u.maskTextSelector,v=null!==(l=null==c?void 0:c.blockSelector)&&void 0!==l?l:null==u?void 0:u.blockSelector,f=null!==(a=null==c?void 0:c.maskAllElementAttributes)&&void 0!==a?a:null==u?void 0:u.maskAllElementAttributes;return Ce(h)&&Ce(d)&&Ce(v)&&Ce(f)?void 0:{maskAllInputs:null==h||h,maskTextSelector:d,blockSelector:v,maskAllElementAttributes:f}}wn(){var t;if(this.Le)return;const e=null===(t=this.ie)||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!Ce(n)&&n!==s});0!==n.length&&(this.Le=!0,Sc.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 kn(){var t;return Qe(null===(t=this._instance.config.session_recording.canvasCapture)||void 0===t?void 0:t.resolutionScale,.1,1,Hr("canvas recording resolution scale"),1)}get Sn(){var t,e,i,n,s,r,o;const l=this._instance.config.session_recording.captureCanvas,a=null===(t=this.ie)||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,c=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 h=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 h){const t=parseFloat(h);h=isNaN(t)?.4:t}return{enabled:u,fps:Qe(c,0,12,Hr("canvas recording fps"),4),quality:Qe(h,0,1,Hr("canvas recording quality"),.4)}}get _n(){var t;const e=!!(null===(t=this.ie)||void 0===t?void 0:t.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return null!=i?i:e}get xn(){var t,e,i;const n=null===(t=this.ie)||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=!1!==s.recordHeaders&&(s.recordHeaders||(null==n?void 0:n.recordHeaders)),o=!1!==s.recordBody&&(s.recordBody||(null==n?void 0:n.recordBody)),l=wc(this._instance.config.capture_performance),a=wc(null==n?void 0:n.capturePerformance),u=!!(Pe(l)?l:a);return r||o||u?{recordHeaders:r,recordBody:o,recordPerformance:u}:void 0}Cn(){var t,e;const i=[],n=null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;n&&this._n&&i.push(n());const r=null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordNetworkPlugin;if(this.xn&&xe(r))if(!oo.includes(s.hostname)||this._forceAllowLocalhostNetworkCapture){const t=xe(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(r(ue(ue({},((t,e,i)=>{const n={payloadSizeLimitBytes:ul.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...ul.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...ul.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=al(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=pl(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=pl(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=io(t.name);let r=0===e.indexOf("http")?null===(n=io(e))||void 0===n?void 0:n.pathname:e;"/"===r&&(r="");const o=null==s?void 0:s.pathname.replace(r||"","");return s&&o&&fl.some(t=>0===o.indexOf(t))?void 0:t})((vl((n=e).requestHeaders),vl(n.responseHeaders),n),t.api_host,i));var n},u=xe(t.session_recording.maskNetworkRequestFn);return u&&xe(t.session_recording.maskCapturedNetworkRequestFn)?Ur.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});if(i||!e.isInitial)return 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?(ml.add(r),r):null!=o?o:void 0}:t=>function(t){if(!Ce(t))return t.requestBody=gl(t.requestBody,"Request"),t.responseBody=gl(t.responseBody,"Response"),t}(a(t)),ue(ue(ue({},ul),n),{},{recordHeaders:s,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.xn,t)),{},{captureFetchSynchronously:!0===this._instance.config.__preview_replay_sync_fetch,returnFetchResponseEarly:!0===this._instance.config.__preview_replay_early_fetch_response})))}else Sc.info("NetworkCapture not started because we are on localhost.");return i}Mn(t){return this._instance.config.disable_capture_url_hashes?un(t):t}Tn(t,e=!1){const i=e?un(t):this.Mn(t),n=this._instance.config.mask_personal_data_properties?[...Lu,...this._instance.config.custom_personal_data_properties||[]]:[];return this.In(co(i,n,Nu))}In(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}An(t){try{return t.rrwebMethod(),!0}catch(s){var e,i,n;this.Ce+=1;const r=String(null!==(e=null==s?void 0:s.message)&&void 0!==e?e:s);return this.Me=kc.test(r)?r:"other",this.Te=null===(i=Cc())||void 0===i||null===(n=i.isRecording)||void 0===n?void 0:n.call(i),10>this.he.length?this.he.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):Sc.warn("could not emit queued rrweb event.",s,t),!1}}Vt(t,e){return this.An($c(()=>Cc().addCustomEvent(t,e)))}Rn(){var t;return this.ue&&!0===(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)&&!this.tt.urlBlocked&&!0!==this.fe}En(t){if(!this.Rn())return!1;try{const e=Cc();return!!e&&(e.addCustomEvent("$json_ld",t),this.Rn())}catch(t){return!1}}On(t=!1){Promise.resolve().then(()=>{var e;return null===(e=this.$n)||void 0===e?void 0:e.scan(t)})}Ln(){try{if(this._instance.config.capture_pageview||!t)return;const e=new URL(t.location.href),i=this.Tn(e.origin+e.pathname+e.search);this.Dn!==i&&(this.Dn=i,this.Vt("$url_changed",{href:i}))}catch(t){}}Fn(){if(this.he.length){const t=[...this.he];this.he=[],t.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this.An(t)})}}Bt(){const t=this.An($c(()=>Cc().takeFullSnapshot())),e=this.ae;return!t&&e&&setTimeout(()=>this.Pn(e),0),t}Pn(t){var e,i;const s=Date.now();if(this.ae!==t||this.Ae||Ce(this.qe)||this.Nn||!["interactive","complete"].includes(null!==(e=null==n?void 0:n.readyState)&&void 0!==e?e:"")||!Ce(this.Re)&&_c>s-this.Re)return;this.Re=s,this.Ee+=1,Sc.warn("rrweb stopped recording while replay was started, restarting it");const r=()=>{this.ae=void 0;const e={stopRequested:!1,startRequested:!1};this.Ae=e;try{this.qn(t)}finally{this.Ae=void 0}this.he=[],e.stopRequested&&!e.startRequested||this._instance.config.disable_session_recording||this._instance.has_opted_out_capturing()||this.jn()},o=null===(i=Cc())||void 0===i?void 0:i.withStyleRuleSourceHandoff;this.Oe=!0;try{o?o(t,r):r()}finally{this.Oe=!1}this.isStarted&&this.Vt("$replay_recorder_restarted",{reason:"rrweb_not_recording"})}get Bn(){var t,e,i;if((null===(t=this.oe)||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 Ae(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:_c}zn(){if(this.Un&&clearInterval(this.Un),!0===this.fe)return;const t=this.Bn;t&&(this.Un=setInterval(()=>{this.Bt()},t))}zt(t){"event"===t&&this.Wn(),!this.tt.urlBlocked&&["sampled","active"].includes(this.status)&&this.zn()}Hn(){var t;this.tt.urlBlocked||(this.tt.urlBlocked=!0,null===(t=this.$n)||void 0===t||t.scan(),clearInterval(this.Un),Sc.info("recording paused due to URL blocker"),this.Vt("recording paused",{reason:"url blocker"}))}Gn(){var t;this.tt.urlBlocked&&(null===(t=this.$n)||void 0===t||t.scan(),this.tt.urlBlocked=!1,this.Bt(),this.On(),this.zn(),this.Vt("recording resumed",{reason:"left blocked url"}),Sc.info("recording resumed"))}Vn(t,e){var i;if("event"===t&&this.Wn(),!this.de&&(null===(i=this.oe)||void 0===i?void 0:i.hasPendingTriggers(this.sessionId))){this.de=!0;try{var n,s;const i="url"===t?dt:vt;null===(n=this._instance.persistence)||void 0===n||n.register({[i]:this.sessionId}),null===(s=this.oe)||void 0===s||s.updateActiveTriggers(this.sessionId),this.zt(),this.hn(),this.jt(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.de=!1}}}get isStarted(){return!!this.ae}get ie(){const t=this._instance.get_property(it);if(!t)return;let e;try{e=$e(t)?t:JSON.parse(t)}catch(t){return void Sc.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.en&&!this.Oe){var i;const n=null!==(i=e.cache_timestamp)&&void 0!==i?i:Date.now();if(Date.now()-n>36e5)return void Sc.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t})}return e}Qn(t,e,i){this._instance.get_property(t)&&(e(),i())}start(e){var i,s;const r=this.ie;if(!r)return void Sc.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const t=!1!==this.fe&&!this.Se;this.cn(t?"no_interaction_since_recording_started":void 0),this.Se=!1,this.we=t,this.ke=!1}this.He&&(this.Zn(),this.fn());const{sessionId:o,windowId:l,sessionStartTimestamp:a}=this.te.checkAndGetSessionAndWindowId();this.Xt=o,this.Ye=l,this._sessionStartTimestamp=a,this.Jn(),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),(null==r?void 0:r.endpoint)&&(this.se=null==r?void 0:r.endpoint),this.oe=2===(null==r?void 0:r.version)&&(null==r?void 0:r.triggerGroups)&&r.triggerGroups.length>0?new Ru(this._instance,this.tt,this.jt.bind(this),this.Vt.bind(this),this.zt.bind(this)):new Iu(this._instance,this.tt,this.et,this.nt,this.jt.bind(this),this.Bt.bind(this),this.zt.bind(this)),this.oe.onRemoteConfig(r),null===(s=this.Gt)||void 0===s||s.call(this),this.Gt=this.oe.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(t,e)=>this.Vn(t,e)),this.Qn(rt,()=>{this.overrideSampling()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(rt)}),this.Qn(ot,()=>{this.overrideLinkedFlag()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(ot)}),this.Qn(at,()=>{this.overrideTrigger("event")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(at)}),this.Qn(lt,()=>{this.overrideTrigger("url")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(lt)}),this.oe.makeSamplingDecisions(this.sessionId),this.jn(),!this._e&&this.isStarted&&(to(t,"beforeunload",this.ln),to(t,"pagehide",this.vn),to(t,"offline",this.pn),to(t,"online",this.mn),to(n,"visibilitychange",this.gn),!this.Ve&&xe(this.te.onSessionId)&&(this.Ve=this.te.onSessionId(this.Je)),!this.Qe&&xe(this.te.on)?this.Qe=this.te.on("forcedIdleReset",()=>{this.Xe(),this.fe="unknown",this.stop(),this.Ze=this.te.onSessionId((t,e,i)=>{var n;null===(n=this.Ze)||void 0===n||n.call(this),this.Ze=void 0,this.Je(t,e,i)})}):xe(this.te.on)||Sc.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Re(this.Ge)&&(this.Ge=this._instance.on("eventCaptured",t=>{try{if("$pageview"===t.event){const e=(null==t?void 0:t.properties.$current_url)?this.Tn(t.properties.$current_url):"";if(!e)return;this.Vt("$pageview",{href:e})}}catch(t){Sc.error("Could not add $pageview to rrweb session",t)}})),"active"===this.status&&this.jt(e||"recording_initialized"))}Yn(e=!1){var i,s,r,o,l,a;null==t||t.removeEventListener("beforeunload",this.ln),null==t||t.removeEventListener("pagehide",this.vn),null==t||t.removeEventListener("offline",this.pn),null==t||t.removeEventListener("online",this.mn),null==n||n.removeEventListener("visibilitychange",this.gn),clearInterval(this.Un),this.Kn(),null===(i=this.Ge)||void 0===i||i.call(this),this.Ge=void 0,null===(s=this.Gt)||void 0===s||s.call(this),this.Gt=void 0,null===(r=this.Ve)||void 0===r||r.call(this),this.Ve=void 0,null===(o=this.Qe)||void 0===o||o.call(this),this.Qe=void 0,null===(l=this.Ze)||void 0===l||l.call(this),this.Ze=void 0,null===(a=this.oe)||void 0===a||a.stop(),this.Xn(e),this.Zn()}Zn(){this.We+=1,this.ze=[],this.Ue=0,this.ti=void 0,this.He=!1}Xn(t=!1){var e,i,n;t||null===(n=this.le)||void 0===n||n.cancel(),null===(e=this.ei)||void 0===e||e.stop(),this.he=[],null===(i=this.$n)||void 0===i||i.stop(),this.$n=void 0,this.ue=!1,this.Ae&&(this.Ae.stopRequested=!0,this.Ae.startRequested=!1),this.ae&&this.qn(this.ae),this.ae=void 0}qn(t){this.Ie-=1;try{t()}catch(t){Sc.warn("could not stop rrweb",t)}}ni(){if(!this.ti||0===this.Ue)return!1;if(this.He)return!0;this.He=!0,this.ii=void 0;const t=this.We;return this.Kn(),this.Xn(),this.ti.catch(()=>{}).then(()=>{t===this.We&&(this.He=!1,this.hn(),this.fn(),this.ri(),this.Yn(),Sc.info("stopped"))}).catch(()=>{this.He=!1,this.ri(),this.Yn(),Sc.info("stopped")}),!0}stop(t=!1){if(this.Xn(t),this.en)this.dn();else if(this.ni())return;this.hn(),this.fn(),this.ri(),this.Yn(t),Sc.info("stopped")}ri(){this.cn(void 0,{preserveLogDedup:this.en}),this.we=!1}flushBeforeIdentityReset(){(this.isStarted||this.He)&&(this.dn(),this.hn())}tn(t){const e=this.le,i=this.en;let n;this.en=!0,this.ce=Date.now();const s={cancelled:!1,cancel(){s.cancelled=!0,null==e||e.cancel(),null==n||n()}};this.le=s;const r=()=>{var t,e;this.stop(!0),s.cancelled||this._instance.config.disable_session_recording||this._instance.has_opted_out_capturing()?s.cancel():(this.oi=void 0,this.ye=0,this.pe=0,this.me=0,this.ge=0,this.Ce=0,this.Me=void 0,this.Te=void 0,null===(t=Tc())||void 0===t||null===(e=t.resetSnapshotCostState)||void 0===e||e.call(t),this.start("session_id_changed"),(s.cancelled&&!this.isStarted||this._instance.config.disable_session_recording||this._instance.has_opted_out_capturing())&&(s.cancel(),this.discard({discardProducerEvents:!0})))};try{var o;const t=null===(o=Cc())||void 0===o?void 0:o.withStyleRuleSourceHandoff;t&&this.ae?t(this.ae,t=>{n=t,r()}):r()}finally{this.le=e,this.en=i}s.cancelled||(this.cn(t?"no_interaction_since_session_rotated":void 0),this.we=!1)}cn(t,{preserveLogDedup:e=!1}={}){if(this.be=!Ce(t),this.ii=t,Ce(t))return void(e||(this.si=void 0));if(this.en)return;const i=`${this.sessionId}:${t}`;i!==this.si&&(this.si=i,Sc.info(`holding buffer: ${t}. nothing is uploaded until the user interacts with the page`))}Wn(){this.isStarted||(this.Se=!0),this.be&&(this.cn(void 0),this.we=!1,this.ke&&(this.ke=!1,this.Bt()),this.ai())}discard({discardProducerEvents:t=!1}={}){t&&(this.li||this._instance.config.session_recording.selectMaskingFn)&&nu.Dt(this.yn),this.be=!0,t&&(this.fn(),this.Xn()),this.fn(),this.Yn(),this.fn(),this.ri(),Sc.info("discarded")}ui(t,e,i,n,s){if(-1===i)return this.ye+=1,void Sc.warn("could not stringify event - dropping it to keep the rest of the recording");const r={$snapshot_bytes:i,$snapshot_data:e,$session_id:n,$window_id:s};"disabled"!==this.status?(this.ci(t,n),this.di(r)):this.fn()}hi(){try{this.fi()}catch(t){this.$e||(this.$e=!0,Sc.error("could not track full snapshot cost",t))}}fi(){var t,e;const i=null===(t=Tc())||void 0===t||null===(e=t.getLastSnapshotCost)||void 0===e?void 0:e.call(t);i&&i!==this.oi&&(this.oi=i,500>i.durationMs||Sc.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}))}ci(t,e){2!==t.type?3===t.type&&(Ce(this.qe)||this.qe===e||this.je===e||(this.je=e,Sc.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.Bt())):this.qe=e}pi(t){t.counted&&t.generation===this.We&&(this.Ue=Math.max(0,this.Ue-1)),t.counted=!1,this.ze=this.ze.filter(e=>e!==t)}mi(t,e,i){t.processed||t.generation!==this.We||(t.processed=!0,this.ui(t.event,e,i,t.targetSessionId,t.targetWindowId))}gi(t){try{let e,i=t.event;if(t.compressionEnabled)try{({event:i,size:e}=Uc(t.event))}catch(t){Sc.warn("could not process queued compression event - will use uncompressed event",t)}Ce(e)&&(e=Hl(t.event));try{this.mi(t,i,e)}catch(t){Sc.warn("could not capture queued compression event",t)}}finally{this.pi(t)}}dn(){[...this.ze].forEach(t=>{try{this.gi(t)}catch(t){Sc.warn("could not drain queued compression event",t)}})}yi(t,e,i,n){var s=this;const r={event:t,compressionEnabled:e,targetSessionId:i,targetWindowId:n,generation:this.We,processed:!1,counted:!0};this.ze.push(r),this.Ue+=1;const o=(l=re(function*(){try{if(r.processed)return;let i,n;try{const s=e?jc(t)?yield function(t){return Hc.apply(this,arguments)}(t):Uc(t):{event:t,size:Hl(t)};i=s.event,n=s.size}catch(e){Sc.warn("could not process queued compression event - will use uncompressed event",e),i=t,n=Hl(t)}s.mi(r,i,n)}finally{s.pi(r)}}),function(){return l.apply(this,arguments)});var l;this.ti=this.ti?this.ti.catch(()=>{}).then(o):o()}onRRwebEmit(e,i){var n,s,r,o,l,a,u,c,h,d,v;if(!this._instance.sessionManager)return;if(this.Fn(),!e||!$e(e))return;if(4===e.type){const t=this.Tn(e.data.href);if(this.Dn=t,!t)return;e.data.href=t}else this.Ln();if(null===(n=this.oe)||void 0===n||n.checkUrlTriggers(this.sessionId,()=>this.Hn(),()=>this.Gn(),(t,e)=>this.Vn(t,e)),this.tt.urlBlocked&&!function(t){return 5===t.type&&"recording paused"===t.data.tag}(e))return;2===e.type&&(this.hi(),Promise.resolve().then(()=>this.hi()),this.zn(),null===(d=this.ei)||void 0===d||d.reset(),null===(v=this._instance.persistence)||void 0===v||v.register_once({$debug_first_full_snapshot_timestamp:e.timestamp},void 0));const f=2===e.type&&(null===(s=this.oe)||void 0===s?void 0:s.hasPendingTriggers(this.sessionId));f&&this.bi();const p=this.ei?this.ei.throttleMutations(e):e;if(!p)return void(!0===this.fe&&this.ve++);const g=function(t){const e=t;if(e&&$e(e)&&6===e.type&&$e(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));const i=[];for(let t=0;e.data.payload.payload.length>t;t++)i.push(e.data.payload.payload[t]&&e.data.payload.payload[t].length>2e3?e.data.payload.payload[t].slice(0,2e3)+"...[truncated]":e.data.payload.payload[t]);return e.data.payload.payload=i,t}return t}(p),m=function(t){return Gc(t)?t.data.payload:null}(g),y=function(t){return Jc(t)?t.data.payload:null}(g),b=function(t){return Vc(t)?t.data.payload:null}(g);m||y?(null==m?void 0:m.lastActivityTimestamp)&&(g.timestamp=m.lastActivityTimestamp):(null==b?void 0:b.sessionId)||this.wi(g,i);const _=null!==(r=null!==(o=null!==(l=null==m?void 0:m.currentSessionId)&&void 0!==l?l:null==y?void 0:y.nextSessionId)&&void 0!==o?o:null==b?void 0:b.sessionId)&&void 0!==r?r:this.Xt,w=null!==(a=null!==(u=null!==(c=null==m?void 0:m.currentWindowId)&&void 0!==c?c:null==y?void 0:y.nextWindowId)&&void 0!==u?u:null==b?void 0:b.windowId)&&void 0!==a?a:this.Ye;if(!0===this.fe&&!function(t){return Vc(t)||Gc(t)||Jc(t)}(g))return void(function(t){return 2===t.type||4===t.type||3===t.type&&9!==t.data.source}(g)&&this.ve++);2===g.type&&(this.ve=0),b&&(g.timestamp=b.lastActivityTimestamp+b.threshold);const k=this.ue;this.ue=!0,f?this.On(!0):k||this.On();const S=null===(h=this._instance.config.session_recording.compress_events)||void 0===h||h;if(5===g.type&&"$json_ld"===g.data.tag){let e;try{e=t?this.Tn(t.location.href):void 0}catch(t){}g.data.href=e}if(this.Ue>0||S&&jc(g))return void this.yi(g,S,_,w);const{event:x,size:T}=S?Uc(g):{event:g,size:Hl(g)};this.ui(g,x,T,_,w)}get status(){return this.oe?this.oe.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.ne,rrwebError:this._e,urlTriggerMatching:this.tt,eventTriggerMatching:this.et,linkedFlagMatching:this.nt,remoteConfig:this.ie}):yl}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.nt.linkedFlagSeen=!0,this.Bt(),this.Wn(),this.jt("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.Bt(),this.Wn(),this.jt("sampling_overridden")}overrideTrigger(t){this.Vn(t),this.Wn()}ki(){try{var e;const i=null==t||null===(e=t.location)||void 0===e?void 0:e.href;if(!i)return;const n=this.Tn(i);if(!n)return;return new URL(n).hostname||void 0}catch(t){return}}Kn(){this.Si&&(clearTimeout(this.Si),this.Si=void 0)}ai(){this.Si||(this.Si=setTimeout(()=>{this.hn()},2e3))}xi(){return this.qe!==this.Rt.sessionId&&0!==this.Rt.data.length&&this.Rt.data.every(t=>5===(null==t?void 0:t.type)&&!Gc(t)&&!Jc(t))}Ci(){var t,e;return null!==(t=null===(e=this.oe)||void 0===e?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}Mi(t){if("buffering"!==t)return Ce(this.Ti)||this._instance.register_for_session({[Ut]:[]}),void(this.Ti=void 0);const e=this.Ci();if(0===e.length)return Ce(this.Ti)||this._instance.register_for_session({[Ut]:[]}),void(this.Ti=void 0);const i=e.join(", "),n=`${this.sessionId}:${i}`;n!==this.Ti&&(this.Ti=n,this._instance.register_for_session({[Ut]:e}),Sc.info(`buffering: ${i}`))}Ii(){var t;return"memory"!==this._instance.config.persistence&&!0!==(null===(t=this._instance.persistence)||void 0===t?void 0:t.Ai)&&nu.Ot()}Ri(){this.li||this._instance.config.session_recording.selectMaskingFn||0!==this.Rt.data.length&&this.Rt.size!==this.Ei&&943718.4>=this.Rt.size&&this.Ii()&&(this.Ei=this.Rt.size,nu.$t(this.yn,this.Rt))}Jn(){if(this.Be||!this.Ii())return;this.Be=!0;const t=nu.Pt(this.yn);nu.Dt(this.yn),!this._instance.config.session_recording.selectMaskingFn&&$e(t)&&Se(t.data)&&0!==t.data.length&&Se(t.sizes)&&t.sizes.length===t.data.length&&Ae(t.size)&&t.sessionId===this.Xt&&t.windowId===this.Ye&&(this.Rt.data.length>0||(this.Rt=t))}hn(t=!1){var e;if(this.Kn(),this.be)return this.Rt;if(this.xi())return this.Rt.size>943718.4?this.fn():(t&&this.Ri(),this.Rt);const i=this.Rt;null===(e=this.oe)||void 0===e||e.ensureSamplingDecision(this.sessionId);const n=this.sn(),s=this.status;if(this.Mi(s),"buffering"===s||"paused"===s||"disabled"===s||n)return!t||"active"!==s&&"sampled"!==s||this.Ri(),this.ai(),this.Rt;if(this.Rt!==i)return this.Rt;if(i.data.length>0){var r;const t=this.ki();Vl(i).forEach(e=>{try{var i;null===(i=this.Ke)||void 0===i||i.trackSize(e.sessionId,e.size),this.Oi(ue(ue(ue(ue({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:su.LIB_NAME,$lib_version:su.LIB_VERSION,$snapshot_host:t},this.pe>0?{$sdk_debug_replay_throttled_mutations_dropped:this.pe}:{}),this.me>0?{$sdk_debug_replay_oversized_mutations_dropped:this.me}:{}),this.ge>0?{$sdk_debug_replay_oversized_mutation_bytes_dropped:this.ge}:{}),this.ye>0?{$sdk_debug_replay_unstringifiable_events_dropped:this.ye}:{}))}catch(t){Sc.warn("could not capture snapshot chunk - skipping it",t)}}),Ce(this.Ei)||(nu.Dt(this.yn),this.Ei=void 0),null===(r=this.oe)||void 0===r||r.onFlushComplete()}return this.fn()}di(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.fe&&!this.be&&this.Rt.size+t.$snapshot_bytes+i>943718.4){const e=this.Xt;if(this.Rt=this.hn(),this.Xt!==e)return;s&&this.Rt.data.length>0&&(this.Rt=this.fn()),this.Rt.sessionId=n,this.Rt.windowId=t.$window_id}this.be&&(this.ke||this.Rt.size+t.$snapshot_bytes+i>943718.4)?this.ke=!0:(this.Rt.size+=t.$snapshot_bytes,this.Rt.data.push(t.$snapshot_data),this.Rt.sizes.push(t.$snapshot_bytes),!0===this.fe||this.be||this.ai())}Oi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.se),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get an(){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}bi(){if(!this.Rt||0===this.Rt.data.length)return this.fn();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.fn():(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)}fn(){return this.Rt={size:0,data:[],sizes:[],sessionId:this.Xt,windowId:this.Ye},this.Rt}jt(t,e){this._instance.register_for_session({[Qt]:t}),Sc.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Vt("$recording_started",ue({reason:t},e))}$i(t,e){var i;return!e&&3===t.type&&-1!==xc.indexOf(null===(i=t.data)||void 0===i?void 0:i.source)}wi(t,e){const i=this.$i(t,e);i||!0===this.fe||t.timestamp-this.ce>this.ee&&(this.fe=!0,clearInterval(this.Un),this.Vt("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.ce,threshold:this.ee,bufferLength:this.Rt.data.length,bufferSize:this.Rt.size,sessionId:this.Xt,windowId:this.Ye}),this.hn());const{windowId:n,sessionId:s}=this.te.checkAndGetSessionAndWindowId(!i,t.timestamp);let r=!1;if(i&&(this.ce=t.timestamp,this.fe)){const e="unknown"===this.fe;this.fe=!1,e||(this.Vt("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}const o=this.Xt!==s,l=this.Ye!==n;if(this.Ye=n,this.Xt=s,o||l){const t=o&&!1!==this.fe;t&&(this.fe="unknown"),this.tn(t)}else if(i&&this.Wn(),r){var a;const t=["sampled","active"].includes(this.status)||(null===(a=this.oe)||void 0===a?void 0:a.hasPendingTriggers(this.sessionId));this.ve>0&&t&&this.Bt(),this.On(),this.zn()}}Xe(){var t;null===(t=this.oe)||void 0===t||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t;return ue(ue({$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this.ii,$sdk_debug_replay_internal_buffer_length:this.Rt.data.length,$sdk_debug_replay_internal_buffer_size:this.Rt.size,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(t=this.Ke)||void 0===t?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_rrweb_error:this._e,[Gt]:this.Nn,[Jt]:this.xe},this.Ce>0?{$sdk_debug_replay_rrweb_method_failures:this.Ce,$sdk_debug_replay_rrweb_last_method_error:this.Me,$sdk_debug_replay_rrweb_recording_at_failure:this.Te,$sdk_debug_replay_rrweb_live_recorders:this.Ie}:{}),this.Ee>0?{$sdk_debug_replay_rrweb_restarts:this.Ee}:{})}get Nn(){var t,e,i;return!!this.ae&&(null===(t=null===(e=Cc())||void 0===e||null===(i=e.isRecording)||void 0===i?void 0:i.call(e))||void 0===t||t)}jn(){var e;if(this.ae)return;if(this.Ae)return void(this.Ae.startRequested=this.Ae.stopRequested);this.xe=!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,selectMaskingFn: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={};Ce(t.mousemove)||(n.mousemove=t.mousemove),Ce(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.Sn&&this.Sn.enabled&&(i.recordCanvas=!0,i.sampling=ue(ue({},i.sampling),{},{canvas:this.Sn.fps}),i.dataURLOptions={type:"image/webp",quality:this.Sn.quality},i.canvasResolutionScale=this.kn,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.Fe||(this.Fe=!0,Sc.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.bn&&(i.maskAllInputs=null===(r=this.bn.maskAllInputs)||void 0===r||r,i.maskTextSelector=null!==(o=this.bn.maskTextSelector)&&void 0!==o?o:void 0,i.blockSelector=null!==(l=this.bn.blockSelector)&&void 0!==l?l:void 0,i.maskAllElementAttributes=null!==(a=this.bn.maskAllElementAttributes)&&void 0!==a&&a),i.maskAllElementAttributes&&i.maskAttributeFn&&(i.maskAttributeFn=void 0,this.De||(this.De=!0,Sc.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.wn();const u=Cc();if(!u)return void Sc.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");if(i.selectMaskingFn&&!0!==u.supportsSelectMasking)return void Sc.error("Session recording has not started: the recorder does not support selectMaskingFn.");this.ei=null!==(e=this.ei)&&void 0!==e?e:new Ea(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`;Sc.info(i,{node:e}),this.log("[SessionRecording] "+i,"warn")},onDroppedAttributeMutations:t=>this.pe+=t,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this.Bn,onDroppedOversizedMutation:t=>{0===this.me&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this.me+=1,this.ge+=t},requestFullSnapshot:()=>this.Bt()});const c=i.selectMaskingFn;this.li=c,c&&(i.selectMaskingFn=t=>{try{return c(t)}catch(t){throw this.Ne||(this.Ne=!0,Sc.warn("selectMaskingFn threw; affected selects are recorded as masked.",t)),t}});const h=this.Cn(),d=this.le,v={stopRequested:!1,startRequested:!1};let f;this.Ae=v;try{f=u(ue(ue({emit:(t,e,i)=>{(null==d?void 0:d.cancelled)||v.stopRequested||(d&&this.le===d&&(this._instance.config.disable_session_recording||this._instance.has_opted_out_capturing())?d.cancel():this.onRRwebEmit(t,i))},plugins:h,errorHandler:(t,e)=>"rrweb"===e&&(this.Pe||(this.Pe=!0,Sc.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},i),{},{recordAfter:"DOMContentLoaded"}))}finally{this.Ae=void 0}if(f&&(this.Ie+=1),v.stopRequested){if(f&&this.qn(f),v.startRequested){const t=this.le;(null==t?void 0:t.cancelled)&&(this.le=void 0),this.jn(),this.le=t}}else{if(this.ae=f,!this.ae)return this._e=!0,void Sc.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this._e=!1,!0===(null==s?void 0:s.captureJsonLd)&&n&&(null==t?void 0:t.MutationObserver)&&!this.$n&&(this.$n=function(t,e,i){const n=new WeakMap,s=i.getCaptureState||(()=>!0);let r=Zu;const o=function(t,e){const i=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?Xu:i=>{const n=t.getElementById(i);return!!n&&"SCRIPT"!==n.nodeName&&(!e.isRecordedElement||e.isRecordedElement(n))&&!yc(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 yc(t,e.blockClass,e.blockSelector)||yc(t,e.maskTextClass,e.maskTextSelector)}(e,i))return;const a=function(t,e=Xu,i){if(!t||t.length>Zu)return null;try{const n=JSON.parse(t),s={maskUrl:i,remainingNodes:2048,exceeded:!1},r=Se(n)?n.map(t=>pc(t,e,s)):pc(n,e,s);if(s.exceeded||Ie(r)||Se(r)&&(!r.length||r.some(Ie)))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,c]=a;if(Ie(l))return void n.set(e,c);if(n.get(e)!==c){if(c.length>r)return void(r=0);i.emit(u)&&(n.set(e,c),r-=c.length)}}catch(t){return}};try{const i=new e(t=>{try{if(!r||!1===s())return;const e=t=>{for(const e of bc(t))l(e)};for(const i of t)if("childList"===i.type)gc(i.target)&&l(i.target),i.addedNodes.forEach(e);else if("characterData"===i.type){const t=i.target.parentNode;t&&gc(t)&&l(t)}else"attributes"===i.type&&gc(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()&&bc(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.Tn(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.tt.urlBlocked||this.tt.isCurrentUrlBlocked()?null:this.Rn()},emit:t=>this.En(t)}),this.tt.isCurrentUrlBlocked()&&this.$n.scan()),this.ce=Date.now(),this.fe=Pe(this.fe)?this.fe:"unknown",this.tryAddCustomEvent("$remote_config_received",this.ie),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 Zc=["type"];var Kc=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}({}),Yc=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}({}),Xc=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}({}),th=function(t){return t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t}({}),eh=function(t){return t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t}({}),ih=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}({}),nh=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 sh(t,e){return-1!==t.indexOf(e)}Date,Date;var rh={Node:["childNodes","parentNode","parentElement","textContent","previousSibling","nextSibling","lastChild"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},oh={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},lh={};function ah(t){if(lh[t])return lh[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 rh?rh[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 oh?oh[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 lh[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 sh(t,"AppleWebKit")&&!sh(t,"Chrome")}(navigator.userAgent)&&(l.classList.add("rr-block","ph-no-capture"),l.setAttribute("__rrwebUntaintedPrototype",t),a=!0),lh[t]=s):i}catch(t){return i}finally{!a&&l.parentNode&&document.body.removeChild(l)}}var uh=Object.create(null);function ch(t,e,i){var n;const s=uh[t],r=s[i];if(r)return r.call(e);const o=ah(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]}uh.Node=Object.create(null),uh.ShadowRoot=Object.create(null),uh.MutationObserver=Object.create(null),uh.Element=Object.create(null);var hh,dh={};function vh(t,e,i){const n=`${t}.${String(i)}`;if(dh[n])return dh[n].bind(e);const s=ah(t)[i];return"function"!=typeof s?e[i]:(dh[n]=s,s.bind(e))}function fh(){return ah("MutationObserver").constructor}function ph(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 gh={childNodes:t=>ch("Node",t,"childNodes"),parentNode:t=>ch("Node",t,"parentNode"),parentElement:t=>ch("Node",t,"parentElement"),textContent:t=>ch("Node",t,"textContent"),previousSibling:t=>ch("Node",t,"previousSibling"),nextSibling:t=>ch("Node",t,"nextSibling"),lastChild:t=>ch("Node",t,"lastChild"),isConnected(t){if(void 0===hh){var e;const t=null===(e=Object.getOwnPropertyDescriptor(ah("Node"),"isConnected"))||void 0===e?void 0:e.get;hh=(null==t?void 0:t.toString().includes("[native code]"))?t:null}return null==hh?void 0:hh.call(t)},contains:(t,e)=>vh("Node",t,"contains")(e),getRootNode:t=>vh("Node",t,"getRootNode")(),host:t=>t&&"host"in t?ch("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?ch("Element",t,"shadowRoot"):null,querySelector:(t,e)=>vh("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>vh("Element",t,"querySelectorAll")(e),mutationObserver:fh,patch:ph},mh=new WeakMap;function yh(t){let e=Object.getPrototypeOf(t);for(;e;){const t=mh.get(e);if(t)return t;e=Object.getPrototypeOf(e)}}var bh=new WeakMap,_h=new WeakSet,wh=new WeakSet,kh=!1;function Sh(t){return/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(t)}function xh(t){return!!t.includes("var(")&&(!!/["'\\]|\/\*|url\(/i.test(t)||t.replace(/\{[^{};]*(?:;\s*)?\}/g,"{}").replace(/(^|[;{])\s*(?:--[\w-]+|color|background-color|width|height|min-width|max-width|min-height|max-height|font-size|font-weight|line-height|opacity|z-index|top|right|bottom|left)\s*:[^;{}]*/gi,"$1").includes("var("))}function $h(t){try{for(;t;)bh.delete(t),t=t.parentRule}catch(t){Rh()}}function Th(t,e){try{if($h(t),kh||wh.has(t)||"string"!=typeof e||!xh(e))return;if("cssRules"in t&&t.cssRules.length>0){var i;let e=t.parentStyleSheet;for(;null==e?void 0:e.ownerRule;)e=e.ownerRule.parentStyleSheet;if("LINK"===(null==e||null===(i=e.ownerNode)||void 0===i?void 0:i.nodeName))return}const n=t.cssText;if(Sh(n)){bh.set(t,{text:e,cssText:n,realm:yh(t)});let i=t.parentRule;for(;i;)_h.add(i),i=i.parentRule}}catch(t){}}function Ch(t,e){try{if(kh||"string"!=typeof e||!xh(e))return;const i=Array.from(t.cssRules);if(!i.some(t=>Sh(t.cssText)))return;const n=function(t){const e=[];let i=0,n=0,s=0,r=0,o="",l=!1,a=!1;for(let u=0;t.length>u;u++){const c=t[u];if(l)"*"===c&&"/"===t[u+1]&&(l=!1,u++);else if("\\"!==c)if(o)c===o&&(o="");else if("/"!==c||"*"!==t[u+1]){if(!a){const e=t.startsWith("\x3c!--",u)?4:t.startsWith("--\x3e",u)?3:0;if(e){u+=e-1,i=u+1;continue}}-1===" \t\n\r\f".indexOf(c)&&(a=!0),'"'!==c&&"'"!==c?("("===c?s++:")"===c?s--:"["===c?r++:"]"===c&&r--,s||r||("{"===c?n++:"}"===c&&n--,("}"===c&&0===n||";"===c&&0===n)&&(e.push(t.slice(i,u+1).trim()),i=u+1,a=!1))):o=c}else l=!0,u++;else a=!0,u++}return n||s||r||o||l?[]:e}(e);if(n.length!==i.length)return;i.forEach((t,e)=>Th(t,n[e]))}catch(t){}}function Eh(t){var e;const i=bh.get(t);if(i){if(!1!==(null===(e=i.realm)||void 0===e?void 0:e.active)&&i.cssText===t.cssText)return i.text;bh.delete(t)}}function Mh(t){$h(t);try{let e=t;for(;e;)wh.add(e),e=e.parentRule}catch(t){Rh()}}function Ih(){bh=new WeakMap,_h=new WeakSet}function Rh(){Ih(),kh=!0}function Ah(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var Oh=0;function Ph(){Oh+=1}function Fh(){return Oh}function Lh(t,e){return(e!==Oh||t>6e4)&&!0}var Dh=0,Nh=0,jh=0,qh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},Bh=null,zh=null,Uh=[],Hh=0,Wh=0,Vh={slowestBatchMs:0},Gh={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function Jh(t){(Dh+=1)>1||(qh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},Uh=[],Hh=0,zh=(t=>t&&t>0?t:null)(t),Nh=Ah(),jh=Oh)}function Qh(){return 0===Dh?Bh||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(Dh-=1)>0?qh:(qh.durationMs=Ah()-Nh,qh.deferredStylesheetCount=Hh,Gh.deferredCount+=Hh,zh=null,Lh(qh.durationMs,jh)?qh:Bh=qh)}function Zh(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+=Zh(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+=Zh(s,e,i+1))}}}catch(t){}}return n}function Kh(t){if(0===Dh)return;const e=Zh(t,null,0);qh.cssRuleCount+=e,Wh>0&&(qh.nonDeferrableCssRuleCount+=e)}function Yh(t){Wh+=1;try{return t()}finally{Wh-=1}}function Xh(t){Dh>0&&(qh.stylesheetMs+=t)}function td(t){if(0===Dh||null===zh)return!1;const e=qh.cssRuleCount-qh.nonDeferrableCssRuleCount;return e>=zh||e+function(t){try{const e=t&&(t.rules||t.cssRules);if(!e)return 0;const i=new WeakSet;return i.add(t),Zh(e,i,0)}catch(t){return 0}}(t)>zh}function ed(){const t=Uh;return Uh=[],t}function id(){Gh.failedCount+=1}function nd(t){t>0&&(Gh.abandonedCount+=t)}function sd(t){return sd="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},sd(t)}function rd(t,e,i){return(e=function(t){var e=function(t){if("object"!=sd(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=sd(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==sd(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function od(t){return t.nodeType===t.ELEMENT_NODE}function ld(t){const e=t&&"host"in t&&"mode"in t&&gh.host(t)||null;return Boolean(e&&"shadowRoot"in e&&gh.shadowRoot(e)===t)}function ad(t){return"[object ShadowRoot]"==={}.toString.call(t)}function ud(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 cd(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 hd=0;function dd(t){const e=0===hd,i=e?Ah():0;hd+=1;try{const e=t.rules||t.cssRules;if(!e)return null;Kh(e);let i=t.href;return!i&&t.ownerNode&&(i=t.ownerNode.baseURI),ud(Array.from(e,t=>vd(t,i)).join(""))}catch(t){return null}finally{hd-=1,e&&Xh(Ah()-i)}}function vd(t,e){if(pd(t)){let e;try{e=dd(t.styleSheet)||cd(t)}catch(i){e=t.cssText}try{var i;if(e&&(null===(i=t.styleSheet)||void 0===i?void 0:i.href))return Rd(e,t.styleSheet.href)}catch(t){}return e}{var n;let i=Eh(t);if(void 0===i&&function(t){return _h.has(t)}(t)){const e=bd(t);null!==e&&(i=e+Array.from(t.cssRules,t=>vd(t,null)).join("")+"}")}return null!==(n=i)&&void 0!==n||(i=t.cssText),gd(t)&&t.selectorText.includes(":")&&(i=fd(i)),e?Rd(i,e):i}}function fd(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function pd(t){return"styleSheet"in t}function gd(t){return"selectorText"in t}var md=/^-?[A-Za-z_][\w-]*$/,yd=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function bd(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(gd(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&&!md.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]?md.test(e.name)?`@keyframes ${e.name} {`:null:""===e.name?"@layer {":yd.test(e.name)?`@layer ${e.name} {`:null:null}var _d=class{constructor(){rd(this,"idNodeMap",new Map),rd(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)),od(t)){const e=gh.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 wd({element:t,maskInputOptions:e,tagName:i,type:n,value:s,maskInputFn:r}){let o=s||"";const l=n&&kd(n);return(e[i.toLowerCase()]||l&&e[l])&&(o=r?r(o,t):"*".repeat(o.length)),o}function kd(t){return t.toLowerCase()}var Sd=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 xd({element:t,name:e,value:i,maskAllElementAttributes:n,maskAttributeFn:s,isGenerated:r=!1}){return i?n?r&&Sd.has(kd(e))?i:"*".repeat(i.length):s?s(e,i,t):i:i}var $d="__rrweb_original__";function Td(t){try{const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?kd(e):null}catch(t){return null}}var Cd=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Ed=/^(?:[a-z+]+:)?\/\//i,Md=/^www\..*/i,Id=/^(data:)([^,]*),(.*)/i;function Rd(t,e){return(t||"").replace(Cd,(t,i,n,s,r,o)=>{const l=n||r||o,a=i||s||"";if(!l)return t;if(Ed.test(l)||Md.test(l))return`url(${a}${l}${a})`;if(Id.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=l.split("#")[0],c=l.substring(u.length),h=e.split("#")[0].split("/"),d=u.split("/");h.pop();for(const t of d)"."!==t&&(".."===t?h.pop():h.push(t));return`url(${a}${h.join("/")}${c}${a})`})}var Ad=new Map;function Od(t){return"http://www.w3.org/1999/xhtml"===t.namespaceURI?t.localName:void 0}function Pd(t,e,i,n=void 0){if(!i||"select"!==Od(t))return e;const s=null==n?void 0:n.input.get(t);if(s)return s;let r;try{r="unmasked"!==i(t)}catch(t){r=!0}const o=ue(ue({},e),{},{select:r});return null==n||n.input.set(t,o),o}function Fd(t,e,i,n){if(!i)return!1;let s=gh.parentNode(t);const r=[];let o=!1;for(;s;){const t=null==n?void 0:n.content.get(s);if(void 0!==t){o=t;break}if(r.push(s),od(s)&&"selectedcontent"===Od(s)){let t=gh.parentElement(s);for(;t;){const s=t.localName;if("option"===s)break;if("select"===s){"select"===Od(t)&&Pd(t,e,i,n).select&&(o=!0);break}t=gh.parentElement(t)}if(o)break}s=ld(s)?gh.host(s):gh.parentNode(s)}for(const t of r)null==n||n.content.set(t,o);return o}var Ld,Dd,Nd=1,jd=new RegExp("[^a-z0-9-_:]");function qd(){return Nd++}var Bd=!1,zd=/^[^ \t\n\r\u000c]+/,Ud=/^[, \t\n\r\u000c]+/,Hd=new WeakMap;function Wd(t,e){return e&&""!==e.trim()?Vd(t,e):e}function Vd(t,e){let i=Hd.get(t);if(i||(i=t.createElement("a"),Hd.set(t,i)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return i.setAttribute("href",e),i.href}function Gd(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 Jd(t,e,i,n,s,r){if(!n)return n;if("src"===i||"href"===i&&("use"!==e||"#"!==n[0])){const i=Wd(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=Ad.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(Ad.size>=10){const t=Ad.keys().next().value;void 0!==t&&Ad.delete(t)}return Ad.set(e,{type:i,quality:n,result:l}),l}catch(t){return e}}(s,i,r.type,r.quality)),Gd(t,r)}if("image"===e)return Gd(i,r)}return i}if("xlink:href"===i&&"#"!==n[0]){const i=Wd(t,n);return"image"===e&&i.startsWith("data:")?Gd(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(Ud),e.length>i;){let r=n(zd);if(","===r.slice(-1))r=Wd(t,r.substring(0,r.length-1)),s.push(r);else{let n="";r=Wd(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?Rd(n,Vd(t)):"object"===e&&"data"===i?Wd(t,n):n:Wd(t,n)}function Qd(t,e,i){return("video"===t||"audio"===t)&&"autoplay"===kd(e)}function Zd(t){return"string"==typeof t&&kd(t).split(/\s+/).includes("stylesheet")}function Kd(t,e,i){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else if(Yd(t,e,!1))return!0;if(i)return t.matches(i)}catch(t){}return!1}function Yd(t,e,i){if(!t||!e)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!i&&Yd(gh.parentNode(t),e,i);const n=e.global||e.sticky?new RegExp(e):e;for(let e=t.classList.length;e--;)if(n.test(t.classList[e]))return!0;return!!i&&Yd(gh.parentNode(t),e,i)}function Xd(t,e,i,n){let s;if(od(t)){if(s=t,!gh.childNodes(s).length)return!1}else{if(null===gh.parentElement(t))return!1;s=gh.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(Yd(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 tv(t,e,i){const n=t.removeEventListener;"function"==typeof n&&n.call(t,e,i)}var ev=new Map;function iv(t={}){ev.forEach((e,i)=>{t.keepChangedLinks&&e.changedLinkBaseline||(e.controller.abort(),ev.delete(i))})}function nv(t){try{return t.sheet}catch(t){return null}}function sv(t,e,i,n,s){const r=new AbortController,o=()=>{var e;(null===(e=ev.get(t))||void 0===e?void 0:e.controller)===r&&ev.delete(t),r.abort()};let l=!1;const a=()=>{if(!l){l=!0;try{e()}finally{o()}}};t.addEventListener("load",a,{signal:r.signal,once:!0}),t.addEventListener("error",o,{signal:r.signal,once:!0});const u=Date.now()+6e4;let c;const h=e=>{const s=n.length>e?n[e]:Math.max(n[n.length-1],1e3);c=setTimeout(()=>{t.isConnected?i()?a():Date.now()<u?h(e+1):o():o()},s)};r.signal.addEventListener("abort",()=>clearTimeout(c),{once:!0}),h(0),ev.set(t,{controller:r,changedLinkBaseline:s})}var rv=[100,200,400,800,1600,3200,6400,12800,25600];function ov(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function lv(t){return null==t?"":t.toLowerCase()}var av=!1,uv=!1;function cv(t,e,i=void 0){const{doc:n,mirror:s,blockClass:r,blockSelector:o,maskTextClass:l,maskTextSelector:a,skipChild:u=!1,inlineStylesheet:c=!0,maskInputOptions:h={},maskTextFn:d,maskInputFn:v,selectMaskingFn:f,maskAllElementAttributes:p=!1,maskAttributeFn:g,slimDOMOptions:m,dataURLOptions:y={},inlineImages:b=!1,recordCanvas:_=!1,canvasMaskingConfigured:w,onSerialize:k,onIframeLoad:S,iframeLoadTimeout:x=5e3,onIframeListenerRegistered:T,onStylesheetLoad:C,stylesheetLoadTimeout:E=5e3,keepIframeSrcFn:M=()=>!1,newlyAddedElement:I=!1,depth:R=0,maxDepth:A=50}=e;let{needsMask:O}=e,{preserveWhiteSpace:P=!0}=e;if(f&&!i&&(i={input:new WeakMap,content:new WeakMap,owner:new WeakMap}),f&&Fd(t,h,f,i))return null;if(R>=A)return uv=!0,av||(av=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${A}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;O||(O=Xd(t,l,a,void 0===O)),Dh>0&&(qh.nodeCount+=1);const F=function(t,e,i){const{doc:n,mirror:s,blockClass:r,blockSelector:o,needsMask:l,inlineStylesheet:a,maskInputOptions:u={},maskTextFn:c,maskInputFn:h,selectMaskingFn:d,maskAllElementAttributes:v=!1,maskAttributeFn:f,dataURLOptions:p={},inlineImages:g,recordCanvas:m,canvasMaskingConfigured:y,keepIframeSrcFn:b,newlyAddedElement:_=!1}=e,w=function(t,e){if(!e.hasNode(t))return;const i=e.getId(t);return 1===i?void 0:i}(n,s);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:nh.Document,childNodes:[],compatMode:t.compatMode}:{type:nh.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:nh.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:w};case t.ELEMENT_NODE:return function(t,e,i){const{doc:n,blockClass:s,blockSelector:r,inlineStylesheet:o,maskInputOptions:l={},maskInputFn:a,selectMaskingFn:u,maskAllElementAttributes:c=!1,maskAttributeFn:h,dataURLOptions:d={},inlineImages:v,recordCanvas:f,canvasMaskingConfigured:p,keepIframeSrcFn:g,newlyAddedElement:m=!1,rootId:y}=e,b=Kd(t,s,r),_=u&&Od(t),w="select"===_||"option"===_||"selectedcontent"===_?_:function(t){if(t instanceof HTMLFormElement)return"form";const e=kd(t.tagName);return jd.test(e)?"div":e}(t);let k=l;if(u&&!b&&("select"===w||"option"===w)){const e="option"===w?function(t,e){let i=gh.parentElement(t);const n=[];for(;i&&"select"!==Od(i);){const t=null==e?void 0:e.owner.get(i);if(void 0!==t){i=t;break}n.push(i),i=gh.parentElement(i)}for(const t of n)null==e||e.owner.set(t,i);return i}(t,i):t;e&&(k=Pd(e,l,u,i))}const S=new Set;let x={};const T=t.attributes.length;for(let e=0;T>e;e++){const i=t.attributes[e];Qd(w,i.name)||(x[i.name]=Jd(n,w,kd(i.name),i.value,t,d))}if("link"===w&&"string"==typeof x.href){var C;const e=null===(C=nv(t))||void 0===C?void 0:C.href;e&&(x.href=e)}if("link"===w&&o&&!b&&Zd(x.rel)){let e=t.sheet;if(!e){const i=function(t){return t.href}(t);i&&(e=ov(n,i),!e&&i.includes(".css"))&&(e=ov(n,window.location.origin+"/"+i.replace(window.location.href,"")))}let i=null;e&&(td(e)?Dh>0&&(Uh.push(t),Hh+=1):i=dd(e)),i&&(delete x.rel,delete x.href,x._cssText=i)}var E;if("style"===w&&t.sheet&&!(t.innerText||gh.textContent(t)||"").trim().length){const e=Yh(()=>dd(t.sheet));e&&(x._cssText=e)}if("input"===w||"textarea"===w||"select"===w){var M;const e="select"===w?t.selectedOptions:void 0,i=e?(null===(M=Array.from(e).find(e=>{let i=e;for(;i&&i!==t;){if(Kd(i,s,r))return!1;i=gh.parentElement(i)}return!0}))||void 0===M?void 0:M.value)||"":t.value,n=t.checked;"radio"!==x.type&&"checkbox"!==x.type&&"submit"!==x.type&&"button"!==x.type&&(e||i)?x.value=i?wd({element:t,type:Td(t),tagName:w,value:i,maskInputOptions:k,maskInputFn:a}):"":n&&(x.checked=n)}if("select"===w&&(u||k.select&&!a)&&(x.rr_maskedSelect=!!k.select||null,S.add("rr_maskedSelect")),"option"===w&&(t.selected&&!k.select?x.selected=!0:delete x.selected),"dialog"===w&&t.open){try{x.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){x.rr_open_mode="modal",x.ph_rr_could_not_detect_modal=!0}S.add("rr_open_mode")}if("canvas"===w&&f&&!(null==p?void 0:p()))try{if("2d"===t.__context)(function(t){const e=t.getContext("2d");if(!e)return!0;for(let i=0;t.width>i;i+=50)for(let n=0;t.height>n;n+=50){const s=e.getImageData,r=$d in s?s[$d]:s;let o;try{o=r.call(e,i,n,Math.min(50,t.width-i),Math.min(50,t.height-n))}catch(t){return!1}if(new Uint32Array(o.data.buffer).some(t=>0!==t))return!1}return!0})(t)||(x.rr_dataURL=t.toDataURL(d.type,d.quality));else if(!("__context"in t)){const e=t.toDataURL(d.type,d.quality),i=n.createElement("canvas");i.width=t.width,i.height=t.height,e!==i.toDataURL(d.type,d.quality)&&(x.rr_dataURL=e)}}catch(t){"SecurityError"===(null==(E=t)?void 0:E.name)?Bd||(Bd=!0,console.warn("Cannot read canvas pixels, so this canvas is left out of the recording. A cross-origin image or video drawn into it taints it.",E)):console.warn("Cannot read canvas pixels, so this canvas is left out of the recording.",E)}let I,R=!1;if("img"===w&&v){Ld||(Ld=n.createElement("canvas"),Dd=Ld.getContext("2d"));const e=t,i=e.currentSrc||e.getAttribute("src")||"<unknown-src>",s=e.crossOrigin,r=(e,i)=>R?xd({element:t,name:e,value:i,maskAllElementAttributes:c,maskAttributeFn:h}):i,o=()=>{tv(e,"load",o);try{Ld.width=e.naturalWidth,Ld.height=e.naturalHeight,Dd.drawImage(e,0,0);const t=Ld.toDataURL(d.type,d.quality);x.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=${i}! Error: ${t}`)}"anonymous"===e.crossOrigin&&(s?x.crossOrigin=r("crossOrigin",s):e.removeAttribute("crossorigin"))};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if("audio"===w||"video"===w){const e=x;e.rr_mediaState=t.paused?"paused":"played",S.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(m||function(t){return"function"!=typeof t.checkVisibility||t.checkVisibility({contentVisibilityAuto:!0})}(t)&&(t.scrollLeft&&(x.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(x.rr_scrollTop=t.scrollTop)),b){var A,O,P;const{width:e,height:i,left:s,top:r}=t.getBoundingClientRect(),o=null===(A=n.defaultView)||void 0===A?void 0:A.getComputedStyle(t);x={class:x.class,rr_width:`${e}px`,rr_height:`${i}px`,rr_left:`${Math.floor(s+((null===(O=n.defaultView)||void 0===O?void 0:O.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(P=n.defaultView)||void 0===P?void 0:P.scrollY)||0))}px`},S.add("rr_width"),S.add("rr_height"),S.add("rr_left"),S.add("rr_top"),o&&(x.rr_position=o.position||"static",S.add("rr_position"),o.transform&&"none"!==o.transform&&(x.rr_transform=o.transform,S.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(x.rr_display=o.display,S.add("rr_display")))}if("iframe"!==w||g(x.src)||(t.contentDocument||(x.rr_src=x.src),delete x.src),c||h)for(const[e,i]of Object.entries(x))"string"!=typeof i&&null!==i||(x[e]=xd({element:t,name:e,value:i,maskAllElementAttributes:c,maskAttributeFn:h,isGenerated:S.has(e)}));R=!0;try{customElements.get(w)&&(I=!0)}catch(t){}return{type:nh.Element,tagName:w,attributes:x,childNodes:[],isSVG:(F=t,Boolean("svg"===F.tagName||F.ownerSVGElement)||void 0),needBlock:b,rootId:y,isCustom:I};var F}(t,{doc:n,blockClass:r,blockSelector:o,inlineStylesheet:a,maskInputOptions:u,maskInputFn:h,selectMaskingFn:d,maskAllElementAttributes:v,maskAttributeFn:f,dataURLOptions:p,inlineImages:g,recordCanvas:m,canvasMaskingConfigured:y,keepIframeSrcFn:b,newlyAddedElement:_,rootId:w},i);case t.TEXT_NODE:case t.CDATA_SECTION_NODE:return function(t,e){const{needsMask:i,maskTextFn:n,rootId:s}=e,r=gh.parentNode(t),o=r&&r.tagName;let l=gh.textContent(t);const a="STYLE"===o||void 0,u="string"==typeof o&&"SCRIPT"===o.toUpperCase();if(a&&l){try{var c;if(t.nextSibling||t.previousSibling);else if(td(r.sheet));else if(null===(c=r.sheet)||void 0===c?void 0:c.cssRules){const t=dd(r.sheet);t&&!Sh(t)&&(l=t)}}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}l=Rd(l,Vd(e.doc))}return u&&(l="SCRIPT_PLACEHOLDER"),!a&&!u&&l&&i&&(l=n?n(l,gh.parentElement(t)):l.replace(/[\S]/g,"*")),{type:nh.Text,textContent:l||"",isStyle:a,rootId:s}}(t,{doc:n,needsMask:l,maskTextFn:c,rootId:w});case t.COMMENT_NODE:return{type:nh.Comment,textContent:gh.textContent(t)||"",rootId:w};default:return!1}}(t,{doc:n,mirror:s,blockClass:r,blockSelector:o,needsMask:O,inlineStylesheet:c,maskInputOptions:h,maskTextFn:d,maskInputFn:v,selectMaskingFn:f,maskAllElementAttributes:p,maskAttributeFn:g,dataURLOptions:y,inlineImages:b,recordCanvas:_,canvasMaskingConfigured:w,keepIframeSrcFn:M,newlyAddedElement:I},i);if(!F)return console.warn(t,"not serialized"),null;let L;L=s.hasNode(t)?s.getId(t):function(t,e){if(e.comment&&t.type===nh.Comment)return!0;if(t.type===nh.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&&(lv(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===lv(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(lv(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&lv(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(lv(t.attributes.property).match(/^(og|twitter|fb):/)||lv(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===lv(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(lv(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(lv(t.attributes.name))||lv(t.attributes.property).match(/^article:/)||lv(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(lv(t.attributes.name)))return!0}}return!1}(F,m)||!P&&F.type===nh.Text&&!F.isStyle&&!F.textContent.replace(/^\s+|\s+$/gm,"").length?-2:qd();const D=Object.assign(F,{id:L});if(s.add(t,D),-2===L)return null;k&&k(t);let N=!u;if(D.type===nh.Element){N=N&&!D.needBlock,delete D.needBlock;const e=gh.shadowRoot(t);e&&ad(e)&&(D.isShadowHost=!0)}if((D.type===nh.Document||D.type===nh.Element)&&N){m.headWhitespace&&D.type===nh.Element&&"head"===D.tagName&&(P=!1);const e={doc:n,mirror:s,blockClass:r,blockSelector:o,needsMask:O,maskTextClass:l,maskTextSelector:a,skipChild:u,inlineStylesheet:c,maskInputOptions:h,maskTextFn:d,maskInputFn:v,selectMaskingFn:f,maskAllElementAttributes:p,maskAttributeFn:g,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,canvasMaskingConfigured:w,preserveWhiteSpace:P,onSerialize:k,onIframeLoad:S,iframeLoadTimeout:x,onIframeListenerRegistered:T,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:M,depth:R+1,maxDepth:A};if(D.type===nh.Element&&"textarea"===D.tagName&&void 0!==D.attributes.value);else for(const n of Array.from(gh.childNodes(t))){const t=cv(n,e,i);t&&D.childNodes.push(t)}let I=null;if(od(t)&&(I=gh.shadowRoot(t)))for(const t of Array.from(gh.childNodes(I))){const n=cv(t,e,i);n&&(ad(I)&&(n.isShadow=!0),D.childNodes.push(n))}}const j=gh.parentNode(t);if(j&&ld(j)&&ad(j)&&(D.isShadow=!0),D.type===nh.Element&&"iframe"===D.tagName&&!Kd(t,r,o)){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),tv(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?tv(t,"load",o):(n=!0,tv(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),tv(t,"load",o)}}return t.addEventListener("load",o),()=>{tv(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&S){const i=cv(e,{doc:e,mirror:s,blockClass:r,blockSelector:o,needsMask:O,maskTextClass:l,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:h,maskTextFn:d,maskInputFn:v,selectMaskingFn:f,maskAllElementAttributes:p,maskAttributeFn:g,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,canvasMaskingConfigured:w,preserveWhiteSpace:P,onSerialize:k,onIframeLoad:S,iframeLoadTimeout:x,onIframeListenerRegistered:T,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:M,depth:R+1,maxDepth:A});i&&S(t,i)}},x);null==T||T(t,e)}var q,B,z;return D.type===nh.Element&&"link"===D.tagName&&Zd(D.attributes.rel)&&(B=()=>{if(C){const e=s.getMeta(t),i=cv(t,{doc:n,mirror:s,blockClass:r,blockSelector:o,needsMask:O,maskTextClass:l,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:h,maskTextFn:d,maskInputFn:v,selectMaskingFn:f,maskAllElementAttributes:p,maskAttributeFn:g,slimDOMOptions:m,dataURLOptions:y,inlineImages:b,recordCanvas:_,canvasMaskingConfigured:w,preserveWhiteSpace:P,onSerialize:k,onIframeLoad:S,iframeLoadTimeout:x,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:M,depth:R,maxDepth:A});i&&C(t,i,e)}},z=E,ev.has(q=t)||nv(q)||sv(q,B,()=>Boolean(nv(q)),[z])),D}function hv(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 dv=class t{constructor(...t){rd(this,"parentElement",null),rd(this,"parentNode",null),rd(this,"ownerDocument",void 0),rd(this,"firstChild",null),rd(this,"lastChild",null),rd(this,"previousSibling",null),rd(this,"nextSibling",null),rd(this,"ELEMENT_NODE",1),rd(this,"TEXT_NODE",3),rd(this,"nodeType",void 0),rd(this,"nodeName",void 0),rd(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 vv(t,e,i=document){const n={capture:!0,passive:!0};return i.addEventListener(t,e,n),()=>fv(i,t,e,n)}function fv(t,e,i,n){pv(()=>{const s=t.removeEventListener;"function"==typeof s&&(void 0!==n?s.call(t,e,i,n):s.call(t,e,i))})}function pv(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function gv(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var mv="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.",yv={map:{},getId(){return console.warn(mv),-1},getNode(){return console.warn(mv),null},removeNodeFromMap(){console.warn(mv)},has(){return console.warn(mv),!1},reset(){console.warn(mv)}};function bv(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 _v(t){let e="function"==typeof t.setTimeout?t.setTimeout:void 0;try{var i,n;const s=null===(i=t.Zone)||void 0===i||null===(n=i.__symbol__)||void 0===n?void 0:n.call(i,"setTimeout"),r=s?t[s]:void 0;"function"==typeof r&&(e=r)}catch(t){}if(!e)return()=>{};const s=e;return e=>{try{s.call(t,e,0)}catch(t){}}}function wv(t,e,i,n,s=window){const r=s.Object.getOwnPropertyDescriptor(t,e),o=()=>wv(t,e,r||{},!0);if(n)return s.Object.defineProperty(t,e,i),o;const l=_v(s);return s.Object.defineProperty(t,e,{set(t){if(l(()=>{try{i.set.call(this,t)}catch(t){}}),r&&r.set){if(r.get)try{r.get.call(this)}catch(t){return}r.set.call(this,t)}}}),o}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(yv=new Proxy(yv,{get(t,e,i){return"map"===e&&console.warn(mv),Reflect.get(t,e,i)}}));var kv=Date.now;function Sv(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=gh.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=gh.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 xv(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function $v(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Tv(t){return t?t.nodeType===t.ELEMENT_NODE?t:gh.parentElement(t):null}function Cv(t,e,i,n){if(!t)return!1;const s=Tv(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(Yd(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 Ev(t,e,i){const n=e&&"string"!=typeof e&&(e.global||e.sticky)?new RegExp(e):null;for(;t;){if(n&&(n.lastIndex=0),Cv(t,n||e,i,!0))return!0;const s="getRootNode"in t?gh.getRootNode(t):null;t=(null==s?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?gh.host(s):null}return!1}function Mv(t,e,i){return!("TITLE"!==t.tagName||!i.headTitleMutations)||-2===e.getId(t)}function Iv(t,e){if(ld(t))return!1;const i=e.getId(t);if(!e.has(i))return!0;const n=gh.parentNode(t);return(!n||n.nodeType!==t.DOCUMENT_NODE)&&(!n||Iv(n,e))}function Rv(t){return Boolean(t.changedTouches)}function Av(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Ov(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Pv(t){return!!t&&(t instanceof dv&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(gh.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(kv=()=>(new Date).getTime());var Fv=class{constructor(){rd(this,"id",1),rd(this,"styleIDMap",new WeakMap),rd(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 Lv(t){var e;let i=null;return"getRootNode"in t&&(null===(e=gh.getRootNode(t))||void 0===e?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&gh.host(gh.getRootNode(t))&&(i=gh.host(gh.getRootNode(t))),i}function Dv(t){const e=t.ownerDocument;if(!e)return!1;if(gh.contains(e,t))return!0;const i=gh.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=Lv(i);)i=e;return i}(t);return gh.contains(e,i)}(t)}var Nv,jv=new WeakMap,qv=(t,e)=>`${t}@${e}`,Bv=class{constructor(){rd(this,"frozen",!1),rd(this,"locked",!1),rd(this,"takePendingRecords",void 0),rd(this,"texts",new Map),rd(this,"attributes",new Map),rd(this,"generatedAttributes",new WeakMap),rd(this,"selectedAttributeChanges",new Set),rd(this,"removes",[]),rd(this,"mapRemoves",new Set),rd(this,"movedMap",{}),rd(this,"addedSet",new Set),rd(this,"movedSet",new Set),rd(this,"droppedSet",new Set),rd(this,"removesSubTreeCache",new Set),rd(this,"mutationCb",void 0),rd(this,"blockClass",void 0),rd(this,"blockSelector",void 0),rd(this,"maskTextClass",void 0),rd(this,"maskTextSelector",void 0),rd(this,"inlineStylesheet",void 0),rd(this,"maskInputOptions",void 0),rd(this,"maskTextFn",void 0),rd(this,"maskInputFn",void 0),rd(this,"selectMaskingFn",void 0),rd(this,"maskAllElementAttributes",void 0),rd(this,"maskAttributeFn",void 0),rd(this,"keepIframeSrcFn",void 0),rd(this,"recordCanvas",void 0),rd(this,"canvasMaskingConfigured",void 0),rd(this,"inlineImages",void 0),rd(this,"slimDOMOptions",void 0),rd(this,"dataURLOptions",void 0),rd(this,"doc",void 0),rd(this,"mirror",void 0),rd(this,"iframeManager",void 0),rd(this,"stylesheetManager",void 0),rd(this,"shadowDomManager",void 0),rd(this,"canvasManager",void 0),rd(this,"processedNodeManager",void 0),rd(this,"unattachedDoc",void 0),rd(this,"canvasManagerReleased",!1),rd(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),rd(this,"emit",()=>{if(this.frozen||this.locked)return;const t=Ah(),e=Fh();try{this.processBufferedMutations()}finally{i=Ah()-t,n=e,Dh>0||Lh(i,null!=n?n:Oh)||i>Vh.slowestBatchMs&&(Vh.slowestBatchMs=i)}var i,n}),rd(this,"processBufferedMutations",()=>{const t=[],e=new Set,i=this.selectMaskingFn?{input:new WeakMap,content:new WeakMap,owner:new WeakMap}:void 0,n=t=>{let e=t,i=-2;for(;-2===i;)e=e&&gh.nextSibling(e),i=e&&this.mirror.getId(e);return i};let s;const r=r=>{var o;const l=gh.parentNode(r);if(!l||!Dv(r)||"TEXTAREA"===l.tagName)return!0;if(this.isBlockedAtEmission(l,i))return!0;if(this.selectMaskingFn&&Fd(r,this.maskInputOptions,this.selectMaskingFn,i))return!0;const a=ld(l)?this.mirror.getId(Lv(r)):this.mirror.getId(l),u=n(r);if(-1===a||-1===u)return!1;null!==(o=s)&&void 0!==o||(s=this.buildSerializationOptions());const c=cv(r,s,i);return c&&(t.push({parentId:a,nextId:u,node:c}),e.add(c.id)),!0};for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t);for(const t of this.movedSet)Uv(this.removesSubTreeCache,t)&&!this.movedSet.has(gh.parentNode(t))||this.addedSet.add(t);for(const t of Array.from(this.addedSet)){const e=Hv(this.droppedSet,t),i=Uv(this.removesSubTreeCache,t),n=this.movedSet.has(t)||Hv(this.movedSet,t);!e&&!i||n||(this.droppedSet.add(t),this.addedSet.delete(t))}const o=new Set;let l=null;const a=this.addedSet.values();let u=a.next();for(;this.addedSet.size;){let t=null;if(null!==l)for(t=gh.previousSibling(l);t&&-2===this.mirror.getId(t);)t=gh.previousSibling(t);if(t&&this.addedSet.has(t))l=t;else{for(this.addedSet.has(u.value)||(u=a.next()),l=u.value;;){const t=gh.parentNode(l),e=t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?gh.host(t):t;if(!e||!this.addedSet.has(e))break;l=e}const t=gh.parentNode(l);if(t&&this.addedSet.has(gh.lastChild(t)))l=gh.lastChild(t);else if(t)for(;;){let t=gh.nextSibling(l);for(;t&&-2===this.mirror.getId(t);)t=gh.nextSibling(t);if(!t||!this.addedSet.has(t))break;l=t}}this.addedSet.delete(l);const e=gh.parentNode(l),i=e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE?gh.host(e):e;i&&o.has(i)?o.add(l):r(l)||o.add(l)}o.size>0&&console.warn(`[rrweb] dropped ${o.size} node(s) with unresolved parent at emit`);const c={texts:Array.from(this.texts,([t,e])=>({node:t,value:e})).filter(t=>!this.isBlockedAtEmission(t.node,i)).map(t=>{const e=t.node,i=gh.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:Array.from(this.attributes.values()).filter(t=>!this.isBlockedAtEmission(t.node,i)).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]=xd({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},h=[];if(this.inlineStylesheet)for(const{id:t,attributes:e}of c.attributes){if(!("rel"in e)&&!("href"in e))continue;const i=this.mirror.getNode(t);i&&"link"===kd(i.nodeName)&&Zd(i.getAttribute("rel"))&&i.getAttribute("href")&&!i.disabled&&h.push(i)}this.texts.clear(),this.attributes.clear(),this.generatedAttributes=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={};const d=this.selectedAttributeChanges;this.selectedAttributeChanges=new Set,(c.texts.length||c.attributes.length||c.removes.length||c.adds.length)&&this.mutationCb(c);for(const t of d){var v;null===(v=jv.get(t.ownerDocument))||void 0===v||v.forEach(e=>e(t))}for(const t of h)this.stylesheetManager.inlineLinkStylesheetAfterChange(t,{currentId:()=>this.mirror.getId(t),reserializeWithoutCss:()=>({previous:this.mirror.getMeta(t),current:cv(t,ue(ue({},this.buildSerializationOptions()),{},{inlineStylesheet:!1}))}),lastSerialization:()=>this.mirror.getMeta(t),readdAsMove:()=>this.recordReinsertion(t)})}),rd(this,"bufferBelongsToIframe",t=>this.doc===t.contentDocument),rd(this,"genTextAreaValueMutation",t=>{let e=this.attributes.get(t);e||(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.set(t,e));const i=Array.from(gh.childNodes(t),t=>gh.textContent(t)||"").join("");e.attributes.value=wd({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Td(t),value:i,maskInputFn:this.maskInputFn})}),rd(this,"processMutation",t=>{if(!Mv(t.target,this.mirror,this.slimDOMOptions)){if(this.selectMaskingFn){var e;const i=null===(e=Tv(t.target))||void 0===e?void 0:e.closest("select");i&&this.selectedAttributeChanges.add(i)}switch(t.type){case"characterData":{const e=gh.textContent(t.target);Cv(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.set(t.target,Xd(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,Tv(t.target)):e.replace(/[\S]/g,"*"):e);break}case"attributes":{var i;const e=t.target,s=!this.selectMaskingFn||"http://www.w3.org/1999/xhtml"!==e.namespaceURI||"select"!==e.localName&&"option"!==e.localName?kd(e.tagName):e.localName,r=t.attributeName,o=null!==(i=t.attributeNamespace)&&void 0!==i?i: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}(e,r,o),a=o?e.getAttributeNS(o,r):t.target.getAttribute(r);if("option"===s&&"selected"===l&&(this.selectMaskingFn||this.maskInputOptions.select)){let i=gh.parentElement(e);if("OPTGROUP"===(null==i?void 0:i.tagName)&&(i=gh.parentElement(i)),this.selectMaskingFn||!this.maskInputFn||"SELECT"!==(null==i?void 0:i.tagName)||!i.multiple)return void(a!==t.oldValue&&"SELECT"===(null==i?void 0:i.tagName)&&this.selectedAttributeChanges.add(i))}if("value"===l){const t=e,i=Td(t);a=wd({element:t,maskInputOptions:Pd(t,this.maskInputOptions,this.selectMaskingFn),tagName:this.selectMaskingFn&&"select"===s?"select":e.tagName,type:i,value:a,maskInputFn:this.maskInputFn})}if(Cv(t.target,this.blockClass,this.blockSelector,!1)||a===t.oldValue)return;let u=this.attributes.get(t.target);const c="iframe"===s&&"src"===l;if(c&&!this.keepIframeSrcFn(a)&&e.contentDocument)return;if("type"===l&&"input"===s&&"password"===(t.oldValue||"").toLowerCase()&&e.setAttribute("data-rr-is-password","true"),!Qd(s,l)){var n;u||(u={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.set(t.target,u));const i=Jd(this.doc,s,kd(l),a,e,this.dataURLOptions);if(c&&!this.keepIframeSrcFn(a)&&(l="rr_src"),u.attributes[l]=i,null===(n=this.generatedAttributes.get(t.target))||void 0===n||n.delete(l),"style"===l){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const i=this.unattachedDoc.createElement("span"),n=e.style;t.oldValue&&(i.style.cssText=t.oldValue);for(const t of Array.from(n)){const e=n.getPropertyValue(t),s=n.getPropertyPriority(t);e!==i.style.getPropertyValue(t)||s!==i.style.getPropertyPriority(t)?u.styleDiff[t]=""===s?e:[e,s]:u._unchangedStyles[t]=[e,s]}for(const t of Array.from(i.style))""===n.getPropertyValue(t)&&(u.styleDiff[t]=!1)}else if("open"===l&&"dialog"===s){u.attributes.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal";let i=this.generatedAttributes.get(t.target);i||(i=new Set,this.generatedAttributes.set(t.target,i)),i.add("rr_open_mode")}}break}case"childList":if(t.removedNodes.forEach(t=>{Dv(t)||this.shadowDomManager.removeShadowRootsIn(t)}),Cv(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=ld(t.target)?this.mirror.getId(gh.host(t.target)):this.mirror.getId(t.target);Cv(t.target,this.blockClass,this.blockSelector,!1)||Mv(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(zv(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===i||Iv(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[qv(i,n)]?zv(this.movedSet,e):(this.removes.push({parentId:n,id:i,isShadow:!(!ld(t.target)||!ad(t.target))||void 0}),function(t,e){const i=[t];for(;i.length;){const t=i.pop();e.has(t)||(e.add(t),gh.childNodes(t).forEach(t=>i.push(t)))}}(e,this.removesSubTreeCache))),this.mapRemoves.add(e))})}}}),rd(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(Mv(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[qv(this.mirror.getId(t),i)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!Cv(t,this.blockClass,this.blockSelector,!1)){if(t.nodeType===t.TEXT_NODE)return;const e=gh.childNodes(t);for(let t=0,i=e.length;i>t;t++){const i=e[t];i&&this.genAdds(i)}if(Pv(t)){const e=gh.childNodes(gh.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","selectMaskingFn","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()}readPendingRecordsFrom(t){this.takePendingRecords=()=>t.takeRecords()}reset(){this.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){this.selectedAttributeChanges.clear();for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t)}isBlockedAtEmission(t,e){return Ev(t,this.blockClass,this.blockSelector)||!!this.selectMaskingFn&&!!t&&Fd(t,this.maskInputOptions,this.selectMaskingFn,e)}recordReinsertion(t){var e;const i=gh.parentNode(t);if(!i)return;null===(e=this.takePendingRecords)||void 0===e||e.call(this).forEach(this.processMutation);const n=(t,e)=>({type:"childList",target:i,removedNodes:t,addedNodes:e,oldValue:null,attributeName:null});this.processMutation(n([t],[])),this.processMutation(n([],[t])),this.emit()}buildSerializationOptions(){return{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,selectMaskingFn:this.selectMaskingFn,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:t=>{Av(t,this.mirror)&&this.iframeManager.addIframe(t),Ov(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Pv(t)&&!Cv(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(gh.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,i)=>{this.stylesheetManager.attachLinkElement(t,e,i)}}}};function zv(t,e){const i=[e];for(;i.length;){const e=i.pop();if(t.delete(e),e.nodeType===e.TEXT_NODE)continue;const n=gh.childNodes(e);for(let t=0,e=n.length;e>t;t++){const e=n[t];e&&i.push(e)}}}function Uv(t,e,i){return 0!==t.size&&function(t,e){const i=gh.parentNode(e);return!!i&&t.has(i)}(t,e)}function Hv(t,e){if(0===t.size)return!1;let i=gh.parentNode(e);for(;i;){if(t.has(i))return!0;i=gh.parentNode(i)}return!1}function Wv(t){Nv=t}function Vv(){Nv=void 0}var Gv=(t,e="rrweb")=>Nv?(...i)=>{try{return t(...i)}catch(t){if(Nv&&!0===Nv(t,e))return;throw t}}:t,Jv=[];function Qv(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 Zv(t,e){const i=new Bv;let n;i.init(t);try{n=new(fh())(Gv(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),i.readPendingRecordsFrom(n),Jv.push(i),{observer:n,buffer:i}}catch(t){try{null==n||n.disconnect(),i.destroy(),i.reset()}catch(t){}throw t}}function Kv({scrollCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){const o=new Map,l=r=>{const l=Qv(r);if(!l||Cv(l,n,s,!0))return;const a=i.getId(l);let u,c;if(l===e&&e.defaultView){const t=Sv(e.defaultView);u=t.left,c=t.top}else u=l.scrollLeft,c=l.scrollTop;const h=`${u},${c}`;o.get(a)!==h&&(o.set(a,h),t({id:a,x:u,y:c}))},a=Gv(l),u=new WeakMap,c=[vv("scroll",Gv(t=>{const e=t.target;if(!e)return;let i=u.get(e);i||(i=bv(a,r.scroll||100),u.set(e,i)),i(t)}),e)];return"onscrollend"in e&&c.push(vv("scrollend",Gv(l),e)),()=>c.forEach(t=>t())}function Yv(t,e){for(let i=Jv.length-1;i>=0;i--){const n=Jv[i];if(!n)continue;let s=n.bufferBelongsToIframe(t);!s&&e&&e.has(n.bufferDoc())&&(s=!0),s&&(n.reset(),Jv.splice(i,1))}}var Xv=["INPUT","TEXTAREA","SELECT"],tf=new WeakMap,ef=new WeakMap;function nf(t){return function t(e,i){if(cf("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||cf("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||cf("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||cf("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 sf(t,e,i){let n,s;return t?(t.ownerNode?n=e.getId(t.ownerNode):s=i.getId(t),{styleId:s,id:n}):{}}var rf=Symbol.for("rrweb.adoptedStyleSheets.rejected"),of=new WeakMap;function lf({mirror:t,stylesheetManager:e},i){var n,s;let r=null;r=t.getId("#document"===i.nodeName?i:gh.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=Object.getOwnPropertyDescriptor(i,"adoptedStyleSheets"),a=null!=l?l:(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(o.prototype,"adoptedStyleSheets"):void 0;if(null===r||-1===r||!o||!1===(null==l?void 0:l.configurable)||!(null==a?void 0:a.get)||!(null==a?void 0:a.set))return()=>{};const u={stylesheetManager:e,previousDescriptor:l,get:void 0},c={configurable:!0,enumerable:a.enumerable,get(){var t;return null===(t=a.get)||void 0===t?void 0:t.call(this)},set(t){let e;try{var i;e=null===(i=a.set)||void 0===i?void 0:i.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return rf;throw t}if(e===rf)return e;if(u.stylesheetManager&&null!==r&&-1!==r)try{u.stylesheetManager.adoptStyleSheets(t,r)}catch(t){}return e}};try{Object.defineProperty(i,"adoptedStyleSheets",c)}catch(t){return()=>{}}return u.get=c.get,of.set(c.set,u),Gv(()=>{u.stylesheetManager=void 0;const t=Object.getOwnPropertyDescriptor(i,"adoptedStyleSheets");if(!(null==t?void 0:t.configurable)||t.get!==c.get||t.set!==c.set)return;let e=l;for(;null==e?void 0:e.set;){const t=of.get(e.set);if(!t||t.stylesheetManager||t.get!==e.get)break;e=t.previousDescriptor}e?Object.defineProperty(i,"adoptedStyleSheets",e):delete i.adoptedStyleSheets})}var af=new Set;function uf(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:c,canvasMutationCb:h,fontCb:d,selectionCb:v,customElementCb:f}=t;t.mutationCb=(...t)=>{e.mutation&&e.mutation(...t),i(...t)},t.mousemoveCb=(...t)=>{e.mousemove&&e.mousemove(...t),n(...t)},t.mouseInteractionCb=(...t)=>{e.mouseInteraction&&e.mouseInteraction(...t),s(...t)},t.scrollCb=(...t)=>{e.scroll&&e.scroll(...t),r(...t)},t.viewportResizeCb=(...t)=>{e.viewportResize&&e.viewportResize(...t),o(...t)},t.inputCb=(...t)=>{e.input&&e.input(...t),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),c(...t)},t.canvasMutationCb=(...t)=>{e.canvasMutation&&e.canvasMutation(...t),h(...t)},t.fontCb=(...t)=>{e.font&&e.font(...t),d(...t)},t.selectionCb=(...t)=>{e.selection&&e.selection(...t),v(...t)},t.customElementCb=(...t)=>{e.customElement&&e.customElement(...t),f(...t)}}(t,e);const r=[],o=Gv(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=Jv.indexOf(s);-1!==t&&Jv.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==n||n.disconnect()}finally{gv(r)}}),l=(t,e)=>{const i=Gv(()=>{try{return e()}catch(e){throw af.add(t),e}})();"function"==typeof i&&r.push(i)};try{if(t.recordDOM&&l("mutation",()=>{const e=Zv(t,t.doc);n=e.observer,s=e.buffer}),l("move",()=>function({mousemoveCb:t,sampling:e,doc:i,mirror:n}){if(!1===e.mousemove)return()=>{};const s="number"==typeof e.mousemove?e.mousemove:50,r="number"==typeof e.mousemoveCallback?e.mousemoveCallback:500;let o,l=[];const a=bv(Gv(e=>{const i=Date.now()-o;t(l.map(t=>(t.timeOffset-=i,t)),e),l=[],o=null}),r),u=Gv(bv(Gv(t=>{const e=Qv(t),{clientX:i,clientY:s}=Rv(t)?t.changedTouches[0]:t;o||(o=kv()),l.push({x:i,y:s,id:n.getId(e),timeOffset:kv()-o}),a("drag"===t.type?Yc.Drag:"touchmove"===t.type?Yc.TouchMove:Yc.MouseMove)}),s,{trailing:!1})),c=[vv("mousemove",u,i),vv("touchmove",u,i),vv("drag",u,i)];return Gv(()=>{c.forEach(t=>t())})}(t)),l("mouseInteraction",()=>function({mouseInteractionCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){if(!1===r.mouseInteraction)return()=>{};const o=!0===r.mouseInteraction||void 0===r.mouseInteraction?{}:r.mouseInteraction,l=[];let a=null;return Object.keys(Xc).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t]).forEach(r=>{let o=kd(r);const u=(e=>r=>{const o=Qv(r);if(Cv(o,n,s,!0))return;let l=null,u=e;if("pointerType"in r){switch(r.pointerType){case"mouse":l=th.Mouse;break;case"touch":l=th.Touch;break;case"pen":l=th.Pen}l===th.Touch&&(Xc[e]===Xc.MouseDown?u="TouchStart":Xc[e]===Xc.MouseUp&&(u="TouchEnd"))}else Rv(r)&&(l=th.Touch);null!==l?(a=l,(u.startsWith("Touch")&&l===th.Touch||u.startsWith("Mouse")&&l===th.Mouse)&&(l=null)):Xc[e]===Xc.Click&&(l=a,a=null);const c=Rv(r)?r.changedTouches[0]:r;if(!c)return;const h=i.getId(o),{clientX:d,clientY:v}=c;Gv(t)(ue({type:Xc[u],id:h,x:d,y:v},null!==l&&{pointerType:l}))})(r);if(window.PointerEvent)switch(Xc[r]){case Xc.MouseDown:case Xc.MouseUp:o=o.replace("mouse","pointer");break;case Xc.TouchStart:case Xc.TouchEnd:return}l.push(vv(o,u,e))}),Gv(()=>{l.forEach(t=>t())})}(t)),l("scroll",()=>Kv(t)),l("viewportResize",()=>function({viewportResizeCb:t},{win:e}){let i=-1,n=-1;return vv("resize",Gv(bv(Gv(()=>{const e=xv(),s=$v();i===e&&n===s||(t({width:Number(s),height:Number(e)}),i=e,n=s)}),200)),e)}(t,{win:i})),l("input",()=>function({inputCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,ignoreClass:r,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,selectMaskingFn:u,sampling:c,userTriggeredOnInput:h}){let d=!0;const v=new Map;let f=!1;function p(t){return"SELECT"===t.tagName||!!u&&"select"===t.localName&&"http://www.w3.org/1999/xhtml"===t.namespaceURI}function g(t){const i=e.defaultView;if(t&&i&&!(t instanceof i.HTMLElement))return null;if(u&&"option"===(null==t?void 0:t.localName)&&"http://www.w3.org/1999/xhtml"===t.namespaceURI){let e=gh.parentElement(t);for(;e&&("select"!==e.localName||"http://www.w3.org/1999/xhtml"!==e.namespaceURI);)e=gh.parentElement(e);return e}return t&&"OPTION"===t.tagName&&(t=gh.parentElement(t))&&"OPTGROUP"===t.tagName&&(t=gh.parentElement(t)),t}function m(t){b(g(Qv(t)),t.isTrusted)}function y(t){return Array.from(t.selectedOptions).filter(t=>!Cv(t,n,s,!0))}function b(t,c,v=!1,f=!1){var g;const m=t&&(p(t)?"SELECT":t.tagName);var b;if(u&&"SELECT"===m&&((null===(b=Jv[0])||void 0===b?void 0:b.isFrozen())&&Jv.forEach(t=>t.unfreeze()),!d))return;if(!t||!m||0>Xv.indexOf(m)||Cv(t,n,s,!0))return;if(t.classList.contains(r)||o&&t.matches(o))return;const w=Td(t)||"",S=Pd(t,l,u);if(u&&(!d||Cv(t,n,s,!0)))return;const x=S[m.toLowerCase()]||S[w];let T="SELECT"===m?y(t):void 0;if(T&&(0>=i.getId(t)||T.some(t=>0>=i.getId(t)))){var C;if(null===(C=Jv[0])||void 0===C?void 0:C.isFrozen()){if(Jv.forEach(t=>t.unfreeze()),!d)return;T=y(t)}if(!v)return void _(t,c,f);if(0>=i.getId(t)||!x&&T.some(t=>0>=i.getId(t)))return}let E,M=T?(null===(g=T[0])||void 0===g?void 0:g.value)||"":t.value,I=!1;"radio"===w||"checkbox"===w?I=t.checked:x?M=wd({element:t,maskInputOptions:S,tagName:m,type:w,value:M,maskInputFn:a}):T&&(E=T.map(t=>i.getId(t)));const R={text:M,isChecked:I};E&&(R.selectedOptionIds=E),u&&T&&function(t,e,i){if("SELECT"!==t.nodeName)return;const n=e.getMeta(t),s=!!i||null;(null==n?void 0:n.type)!==nh.Element||!0!==n.attributes.rr_maskedSelect&&null!==n.attributes.rr_maskedSelect||n.attributes.rr_maskedSelect===s||e.add(t,ue(ue({},n),{},{attributes:ue(ue({},n.attributes),{},{rr_maskedSelect:s})}))}(t,i,!!x),h&&(R.userTriggered=c),k(t,R,f);const A=t.name;"radio"===w&&A&&I&&e.querySelectorAll(`input[type="radio"][name="${A}"]`).forEach(e=>{if(e!==t){const t=e.value;k(e,h?{text:t,isChecked:!I,userTriggered:!1}:{text:t,isChecked:!I})}})}function _(t,e,i=!1){var n;const s=v.get(t);v.set(t,{userTriggered:e||(null==s?void 0:s.userTriggered)||!1,fromMutation:i&&(null===(n=null==s?void 0:s.fromMutation)||void 0===n||n)}),f||(f=!0,T(w))}function w(){f=!1;const t=Array.from(v);v.clear(),gv(t.map(([t,{userTriggered:e,fromMutation:i}])=>()=>{d&&Gv(b)(t,e,!0,i)}))}function k(e,n,s=!1){var r,o,l;const a=p(e)?ef:tf,u=a.get(e);if(!u||u.text!==n.text||u.isChecked!==n.isChecked||(null===(r=u.selectedOptionIds)||void 0===r?void 0:r.length)!==(null===(o=n.selectedOptionIds)||void 0===o?void 0:o.length)||(null===(l=n.selectedOptionIds)||void 0===l?void 0:l.some((t,e)=>{var i;return t!==(null===(i=u.selectedOptionIds)||void 0===i?void 0:i[e])}))){a.set(e,n);const r=i.getId(e);Gv(t)(ue(ue({},n),{},{id:r}),s)}}const S=("last"===c.input?["change"]:["input","change"]).map(t=>vv(t,Gv(m),e)),x=e.defaultView;if(!x)return()=>{S.forEach(t=>t())};const T=_v(x),C=x.Object.getOwnPropertyDescriptor(x.HTMLInputElement.prototype,"value");return C&&C.set&&S.push(...[[x.HTMLInputElement.prototype,"value"],[x.HTMLInputElement.prototype,"checked"],[x.HTMLSelectElement.prototype,"value"],[x.HTMLTextAreaElement.prototype,"value"],[x.HTMLSelectElement.prototype,"selectedIndex"],[x.HTMLOptionElement.prototype,"selected"]].map(t=>wv(t[0],t[1],{set(){if(!d)return;const t=Gv(g)(this);t&&(p(t)?_(t,!1):Gv(b)(t,!1))}},!1,x))),S.unshift(function(t,e){const i=jv.get(t)||new Set;return jv.set(t,i),i.add(e),()=>{i.delete(e),i.size||jv.get(t)!==i||jv.delete(t)}}(e,Gv(t=>{i.getId(t)>0&&Dv(t)&&!Ev(t,n,s)&&b(t,!1,!1,!!u)}))),Gv(()=>{gv([w]),d=!1,v.clear(),gv(S)})}(t)),l("mediaInteraction",()=>function({mediaInteractionCb:t,blockClass:e,blockSelector:i,mirror:n,sampling:s,doc:r}){const o=Gv(r=>bv(Gv(s=>{const o=Qv(s);if(!function(t){const e=null==t?void 0:t.tagName;if("string"!=typeof e)return!1;const i=kd(e);return"video"===i||"audio"===i}(o)||Cv(o,e,i,!0))return;const{currentTime:l,volume:a,muted:u,playbackRate:c,loop:h}=o;t({type:r,id:n.getId(o),currentTime:l,volume:a,muted:u,playbackRate:c,loop:h})}),s.media||500)),l=[vv("play",o(ih.Play),r),vv("pause",o(ih.Pause),r),vv("seeked",o(ih.Seeked),r),vv("volumechange",o(ih.VolumeChange),r),vv("ratechange",o(ih.RateChange),r)];return Gv(()=>{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 c={emit:l,ready:!1};u.push(c);let h,d=!1,v=!1;const f=()=>{d||v||(d=!0,void 0!==h&&i.delete(h),c.ready=!0,c.emit=void 0,r(o))};try{h=t.setTimeout(f,5e3),d||v?t.clearTimeout(h):i.add(h)}catch(t){f()}return e=>{!v&&n&&(v=!0,void 0!==h&&(t.clearTimeout(h),i.delete(h)),d?e&&s(a):(c.ready=!0,e||(c.emit=void 0),r(o)))}},reset(){n=!1,i.forEach(e=>t.clearTimeout(e)),i.clear(),e.clear()}}}(i);r.push(e.reset),l("styleSheet",()=>function({styleSheetRuleCb:t,mirror:e,stylesheetManager:i},{win:n,mutationQueue:s}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const r=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:Gv((n,r,o)=>{const[l]=o,a=n.apply(r,o);Th(r.cssRules[a],l),i.onCssomSheetMutation(r);const{id:u,styleId:c}=sf(r,e,i.styleMirror);return(u&&-1!==u||c&&-1!==c)&&s.queueMutation(r,()=>t({id:u,styleId:c,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:Gv((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:c}=sf(r,e,i.styleMirror);return(u&&-1!==u||c&&-1!==c)&&s.queueMutation(r,()=>t({id:u,styleId:c,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:Gv((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;const o=i.onCssomSheetMutation(r),{id:u,styleId:c}=sf(r,e,i.styleMirror),h=u&&-1!==u||c&&-1!==c?s.queuePendingMutation(r,()=>t({id:u,styleId:c,replace:l}),()=>{const e=dd(r);null!==e&&t({id:u,styleId:c,replace:e})}):void 0;try{n.call(a,()=>{i.isCurrentCssomMutation(r,o)&&Ch(r,l),null==h||h(!0)},()=>null==h?void 0:h(!1))}catch(t){null==h||h(!1)}}catch(t){}return a},"host")})),n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Gv((n,r,o)=>{const[l]=o,a=n.apply(r,o);Ch(r,l),i.onCssomSheetMutation(r);const{id:u,styleId:c}=sf(r,e,i.styleMirror);return(u&&-1!==u||c&&-1!==c)&&s.queueMutation(r,()=>t({id:u,styleId:c,replaceSync:l})),a},"host")}));const u={};hf("CSSGroupingRule")?u.CSSGroupingRule=n.CSSGroupingRule:(hf("CSSMediaRule")&&(u.CSSMediaRule=n.CSSMediaRule),hf("CSSConditionRule")&&(u.CSSConditionRule=n.CSSConditionRule),hf("CSSSupportsRule")&&(u.CSSSupportsRule=n.CSSSupportsRule));const c={};return Object.entries(u).forEach(([n,r])=>{c[n]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(c[n].insertRule,{apply:Gv((n,r,o)=>{const[l]=o,a=n.apply(r,o);Th(r.cssRules[a],l),i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:c}=sf(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||c&&-1!==c)){const e=[...nf(r),a];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:c,adds:[{rule:l,index:e}]}))}return a},"host")}),r.prototype.deleteRule=new Proxy(c[n].deleteRule,{apply:Gv((n,r,o)=>{const[l]=o,a=n.apply(r,o);$h(r),i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:c}=sf(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||c&&-1!==c)){const e=[...nf(r),l];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:c,removes:[{index:e}]}))}return a},"host")})}),Gv(()=>{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=c[t].insertRule,e.prototype.deleteRule=c[t].deleteRule})})}(t,{win:i,mutationQueue:e})),l("adoptedStyleSheet",()=>lf(t,t.doc)),l("styleDeclaration",()=>function({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:i,stylesheetManager:n},{win:s,mutationQueue:r}){const o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Gv((s,o,l)=>{var a;const[u,c,h]=l,d=s.apply(o,l);if($h(o.parentRule),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}=sf(v,e,n.styleMirror);if(f&&-1!==f||p&&-1!==p){const e=nf(o.parentRule);r.queueMutation(v,()=>t({id:f,styleId:p,set:{property:u,value:c,priority:h},index:e}))}return d},"host")});const l=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:Gv((s,o,l)=>{var a;const[u]=l,c=s.apply(o,l);if($h(o.parentRule),i.has(u))return c;const h=null===(a=o.parentRule)||void 0===a?void 0:a.parentStyleSheet;n.onCssomSheetMutation(h);const{id:d,styleId:v}=sf(h,e,n.styleMirror);if(d&&-1!==d||v&&-1!==v){const e=nf(o.parentRule);r.queueMutation(h,()=>t({id:d,styleId:v,remove:{property:u},index:e}))}return c},"host")}),Gv(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=l})}(t,{win:i,mutationQueue:e})),t.collectFonts&&l("font",()=>function({fontCb:t,doc:e}){const i=e.defaultView;if(!i)return()=>{};const n=[],s=new WeakMap,r=i.FontFace;i.FontFace=function(t,e,i){const n=new r(t,e,i);return s.set(n,{family:t,buffer:"string"!=typeof e,descriptors:i,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),n};const o=ph(e.fonts,"add",function(e){return function(i){return setTimeout(Gv(()=>{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),Gv(()=>{n.forEach(t=>t())})}(t))}l("selection",()=>function(t){const{doc:e,mirror:i,blockClass:n,blockSelector:s,selectionCb:r}=t;let o=!0;const l=Gv(()=>{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);Cv(r,n,s,!0)||Cv(a,n,s,!0)||l.push({start:i.getId(r),startOffset:o,end:i.getId(a),endOffset:u})}r({ranges:l})});return l(),vv("selectionchange",l)}(t)),l("customElement",()=>function({doc:t,customElementCb:e}){const i=t.defaultView;return i&&i.customElements?ph(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)l(`plugin:${e.name}`,()=>e.observer(e.callback,i,e.options))}catch(t){try{o()}catch(t){}throw t}return o}function cf(t){return void 0!==window[t]}function hf(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}function df(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)}}var vf,ff,pf=class{constructor(t){rd(this,"generateIdFn",void 0),rd(this,"iframeRemoteIdToLocalIdMap",new WeakMap),rd(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}},gf=class{constructor(t){rd(this,"iframes",new WeakMap),rd(this,"crossOriginIframeMap",new WeakMap),rd(this,"crossOriginIframeMirror",new pf(qd)),rd(this,"crossOriginIframeStyleMirror",void 0),rd(this,"crossOriginIframeRootIdMap",new WeakMap),rd(this,"mirror",void 0),rd(this,"mutationCb",void 0),rd(this,"wrappedEmit",void 0),rd(this,"loadListener",void 0),rd(this,"pageHideListener",void 0),rd(this,"stylesheetManager",void 0),rd(this,"recordCrossOriginIframes",void 0),rd(this,"blockClass",void 0),rd(this,"blockSelector",void 0),rd(this,"messageHandler",void 0),rd(this,"nestedIframeListeners",new Map),rd(this,"attachedWindows",new WeakMap),rd(this,"attachedDocuments",new WeakMap),rd(this,"attachedIframes",new Map),rd(this,"loadListenerDisposers",new WeakMap),rd(this,"iframeElementsById",new Map),rd(this,"pageHideHandlers",new WeakMap),this.blockClass=t.blockClass,this.blockSelector=t.blockSelector,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new pf(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){Kd(t,this.blockClass,this.blockSelector)||(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=>pv(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{fv(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);pv(()=>{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)})}pv(()=>{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,!0===e.data.nonInteractive)}transformCrossOriginEvent(t,e){switch(e.type){case Kc.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:Kc.IncrementalSnapshot,data:{source:Yc.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Kc.Meta:case Kc.Load:case Kc.DomContentLoaded:return!1;case Kc.Plugin:return e;case Kc.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case Kc.IncrementalSnapshot:switch(e.data.source){case Yc.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 Yc.Drag:case Yc.TouchMove:case Yc.MouseMove:return e.data.positions.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case Yc.ViewportResize:return!1;case Yc.MediaInteraction:case Yc.MouseInteraction:case Yc.Scroll:case Yc.CanvasMutation:return this.replaceIds(e.data,t,["id"]),e;case Yc.Input:return this.replaceIds(e.data,t,["id","selectedOptionIds"]),e;case Yc.StyleSheetRule:case Yc.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case Yc.Font:return e;case Yc.Selection:return e.data.ranges.forEach(e=>{this.replaceIds(e,t,["start","end"])}),e;case Yc.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===nh.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&&(fv(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(i)),t&&this.nestedIframeListeners.has(t)&&(fv(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=>{pv(()=>this.mirror.removeNodeFromMap(t))}),pv(()=>Yv(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&&fv(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{fv(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}},mf=new Map,yf=new WeakMap;function bf(t){t.dispose(),mf.get(t.win)===t&&mf.delete(t.win)}function _f(){(null==ff?void 0:ff.valid)&&(ff.valid=!1,(null==vf?void 0:vf.stopped)?Rh():Ih())}var wf=class{constructor(t,e){rd(this,"win",void 0),rd(this,"owned",new Map),rd(this,"pending",new Set),rd(this,"stopped",!1),rd(this,"ready",!1),this.win=t;try{const n=ff;if(e&&(null==n?void 0:n.valid)&&n.stopCompleted&&!n.next&&["interactive","complete"].includes(t.document.readyState)){n.next=this;for(const e of n.retained)try{var i;e.win.CSSRule.prototype!==e.prototype||e.win!==t&&!(null===(i=e.win.frameElement)||void 0===i?void 0:i.isConnected)||(this.acquire(e.win),e.win!==t&&this.pending.add(e.win))}catch(t){}}else{if(_f(),n){for(const t of n.retained)0===t.owners&&bf(t);n.retained.clear()}Ih(),wh=new WeakSet,kh=!1}vf=this,e&&this.acquire(t)}catch(t){throw this.stop(),t}}acquire(t){if(!t.CSSRule)return Rh(),()=>{};const e=this.owned.get(t);if(e)return e;let i=mf.get(t);if(!i){const e=function(t){const e={active:!0};return mh.set(t,e),()=>{e.active=!1,mh.get(t)===e&&mh.delete(t)}}(t.CSSRule.prototype);let n;try{n=function(t){const e=[],i=(t,i)=>{const n="appendRule"===i||"deleteRule"===i||"insertRule"===i,s=Object.getOwnPropertyDescriptor(t,i);if(!s)return void(("style"===i||n)&&Rh());const r="style"===i||"styleMap"===i||"media"===i;if(!s.configurable||r&&!s.get||n&&"function"!=typeof s.value)return void Rh();const o=ue({},s);if(n&&(o.value=new Proxy(s.value,{apply(t,e,i){const n=t.apply(e,i);return Mh(e),n}})),s.get&&r){const t=s.get;o.get=function(){const e=t.call(this);return Mh(this),e}}if(s.set){const t=s.set;o.set=function(e){const i=t.call(this,e);return Mh(this),i}}try{Object.defineProperty(t,i,o),e.push(()=>{const e=Object.getOwnPropertyDescriptor(t,i);(null==e?void 0:e.get)===o.get&&(null==e?void 0:e.set)===o.set&&(null==e?void 0:e.value)===o.value&&Object.defineProperty(t,i,s)})}catch(t){Rh()}};try{var n,s,r;const o=t;for(const e of[t.CSSStyleRule,t.CSSKeyframeRule,t.CSSPageRule,t.CSSFontFaceRule,o.CSSNestedDeclarations,o.CSSMarginRule,o.CSSPositionTryRule])e&&(i(e.prototype,"style"),i(e.prototype,"styleMap"));for(const e of[t.CSSMediaRule,t.CSSImportRule])e&&i(e.prototype,"media");t.CSSStyleRule&&i(t.CSSStyleRule.prototype,"selectorText"),t.CSSKeyframeRule&&i(t.CSSKeyframeRule.prototype,"keyText"),t.CSSKeyframesRule&&(i(t.CSSKeyframesRule.prototype,"name"),i(t.CSSKeyframesRule.prototype,"appendRule"),i(t.CSSKeyframesRule.prototype,"deleteRule"));const l=t.CSSGroupingRule?[t.CSSGroupingRule]:[t.CSSMediaRule,t.CSSConditionRule,t.CSSSupportsRule];for(const t of l)t&&(i(t.prototype,"insertRule"),i(t.prototype,"deleteRule"));const a=null===(n=t.CSSStyleRule)||void 0===n?void 0:n.prototype;for(const t of["insertRule","deleteRule"])a&&{}.hasOwnProperty.call(a,t)&&i(a,t);const u=null===(s=t.CSSRule)||void 0===s?void 0:s.prototype;return u&&(null===(r=Object.getOwnPropertyDescriptor(u,"cssText"))||void 0===r?void 0:r.set)&&i(u,"cssText"),()=>gv(e)}catch(t){throw gv(e),Rh(),t}}(t)}catch(t){throw e(),t}i={win:t,prototype:t.CSSRule.prototype,owners:0,dispose:()=>gv([e,n])},mf.set(t,i)}const n=i;n.owners++;const s=()=>{this.owned.get(t)===s&&(this.owned.delete(t),this.pending.delete(t),n.owners--,0===n.owners&&((null==ff?void 0:ff.valid)&&ff.previous===this&&ff.stopStarted?ff.retained.add(n):bf(n)))};return this.owned.set(t,s),s}observe(t){return this.prune(),this.pending.delete(t),t===this.win?()=>{}:this.acquire(t)}prune(){for(const i of this.pending){var t;try{var e;const t=mf.get(i);if((null===(e=i.frameElement)||void 0===e?void 0:e.isConnected)&&i.CSSRule.prototype===(null==t?void 0:t.prototype))continue}catch(t){}null===(t=this.owned.get(i))||void 0===t||t()}}beforeStop(){(null==ff?void 0:ff.previous)===this&&ff.valid&&!ff.stopStarted?ff.stopStarted=!0:_f()}stop(){if(!this.stopped){for(const t of[...this.owned.values()])t();this.stopped=!0,(null==ff?void 0:ff.valid)&&ff.previous===this?ff.stopCompleted=!0:vf===this&&(Rh(),vf=void 0)}}},kf=class{constructor(t){rd(this,"shadowDoms",new Map),rd(this,"mutationCb",void 0),rd(this,"scrollCb",void 0),rd(this,"bypassOptions",void 0),rd(this,"mirror",void 0),rd(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(!ad(t))return;if(this.shadowDoms.has(t))return;const s=null!==(i=null===(n=gh.host(t))||void 0===n?void 0:n.ownerDocument)&&void 0!==i?i:e,r={doc:s,handlers:[]};this.shadowDoms.set(t,r);const{observer:o,buffer:l}=Zv(ue(ue({},this.bypassOptions),{},{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);r.handlers.push(()=>{o.disconnect(),l.destroy(),l.releaseCanvasManager();const t=Jv.indexOf(l);-1!==t&&Jv.splice(t,1)}),r.handlers.push(Kv(ue(ue({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))),setTimeout(()=>{this.shadowDoms.get(t)===r&&(t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(gh.host(t))),r.handlers.push(lf({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)))},0)}removeShadowRootsIn(t){if(0===this.shadowDoms.size)return;const e=gh.shadowRoot(t);e&&(this.shadowDoms.has(e)&&this.removeShadowRoot(e),this.removeShadowRootsIn(e)),gh.childNodes(t).forEach(t=>this.removeShadowRootsIn(t))}removeShadowRoot(t){const e=this.shadowDoms.get(t);this.shadowDoms.delete(t),null==e||e.handlers.forEach(Sf)}observeAttachShadow(t){pv(()=>{const e=t.contentWindow,i=t.contentDocument;e&&i&&this.patchAttachShadow(e.Element,i)})}patchAttachShadow(t,e){const i=this;this.restoreHandlers.push({doc:e,handler:ph(t.prototype,"attachShadow",function(t){return function(n){const s=t.call(this,n),r=gh.shadowRoot(this);return r&&Dv(this)&&i.addShadowRoot(r,e),s}})})}reset(){this.restoreHandlers.forEach(({handler:t})=>Sf(t)),this.restoreHandlers=[];const t=this.shadowDoms;this.shadowDoms=new Map,t.forEach(({handlers:t})=>t.forEach(Sf))}resetForDoc(t){const e=[];for(const i of this.restoreHandlers)i.doc===t?Sf(i.handler):e.push(i);this.restoreHandlers=e,this.shadowDoms.forEach((e,i)=>{e.doc===t&&this.removeShadowRoot(i)})}};function Sf(t){try{t()}catch(t){}}var xf="skip-frame";function $f(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 Tf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cf="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Ef=0;64>Ef;Ef++)Cf[Tf.charCodeAt(Ef)]=Ef;var Mf=function(t){var e,i=new Uint8Array(t),n=i.length,s="";for(e=0;n>e;e+=3)s+=Tf[i[e]>>2],s+=Tf[(3&i[e])<<4|i[e+1]>>4],s+=Tf[(15&i[e+1])<<2|i[e+2]>>6],s+=Tf[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},If=!1,Rf=new Map,Af=(t,e,i)=>{if(!t||!Ff(t,e)&&"object"!=typeof t)return;const n=function(t,e){let i=Rf.get(t);return i||(i=new Map,Rf.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 Of(t,e,i,n){if(t instanceof Array)return t.map(t=>Of(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:Mf(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Of(t.buffer,e,i,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const e=t.constructor.name,{src:i}=t;return{rr_type:e,src:i}}if(t instanceof HTMLCanvasElement){const e="HTMLImageElement";let i;try{i=t.toDataURL(n.type,n.quality)}catch(t){throw function(t){"SecurityError"===(null==t?void 0:t.name)?If||(If=!0,console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read. A cross-origin image or video drawn into it taints it.",t)):console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read.",t)}(t),t}return{rr_type:e,src:i}}return t instanceof ImageData?{rr_type:t.constructor.name,args:[Of(t.data,e,i,n),t.width,t.height]}:Ff(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:Af(t,e,i)}:t}var Pf=(t,e,i,n)=>t.map(t=>Of(t,e,i,n)),Ff=(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]))},Lf=["webgl","webgl2"];function Df(t){return"nodeType"in t}function Nf(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 ph(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||Df(r)&&Cv(r,e,i,!0))return n.call(this,s);Df(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=ph(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(s,...r){const o=function(t){return"experimental-webgl"===t?"webgl":t}(s);if(!Cv(this,e,i,!0)&&("__context"in this||(this.__context=o),n&&Lf.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 jf(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=ph(t,u,function(t){return function(...l){const a=t.apply(this,l);if(Af(a,r,this),this.canvas&&"tagName"in this.canvas&&!Cv(this.canvas,n,s,!0)){let t;try{t=Pf(l,r,this,o)}catch(t){}t&&i(this.canvas,{type:e,property:u,args:t})}return a}});l.push(a)}catch(r){const o=wv(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!Cv(this.canvas,n,s,!0)&&i(this.canvas,{type:e,property:u,args:[t],setter:!0})}});l.push(o)}return l}var qf='(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\tlet webpProbeStarted = false;\n\tlet noWebpEncoder = false;\n\tfunction probeWebpEncoder() {\n\t\twebpProbeStarted = true;\n\t\tnew OffscreenCanvas(1, 1).convertToBlob({ type: "image/webp" }).then((blob) => {\n\t\t\tnoWebpEncoder = blob.type !== "image/webp";\n\t\t}).catch(() => void 0);\n\t}\n\tfunction isOpaque(pixels) {\n\t\tfor (let i = 3; i < pixels.length; i += 4) if (pixels[i] !== 255) return false;\n\t\treturn true;\n\t}\n\tfunction encodeOptions(options, pixels) {\n\t\tif (options.type !== "image/webp") return options;\n\t\tif (!webpProbeStarted) probeWebpEncoder();\n\t\treturn noWebpEncoder && isOpaque(pixels) ? {\n\t\t\t...options,\n\t\t\ttype: "image/jpeg"\n\t\t} : options;\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 pixels = ctx.getImageData(0, 0, width, height).data;\n\t\t\t\tconst fingerprint = frameFingerprint(width, height, pixels);\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(encodeOptions(dataURLOptions, pixels));\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',Bf="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",qf],{type:"text/javascript;charset=utf-8"});function zf(t){let e;try{if(e=Bf&&(self.URL||self.webkitURL).createObjectURL(Bf),!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(qf),{name:null==t?void 0:t.name})}}var Uf="A page CSP that omits blob: from worker-src or script-src blocks it";function Hf(t,...e){console.warn(`[replay] canvas capture: ${t}`,...e)}var Wf=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){rd(this,"pendingCanvasMutations",new Map),rd(this,"rafStamps",{latestId:0,invokeId:null}),rd(this,"mirror",void 0),rd(this,"mutationCb",void 0),rd(this,"resetObservers",void 0),rd(this,"frozen",!1),rd(this,"locked",!1),rd(this,"rafIdTimestamp",null),rd(this,"rafIdFlush",null),rd(this,"refCount",0),rd(this,"torndown",!1),rd(this,"resetFrameDedup",null),rd(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 void Hf("disabled because this browser does not support OffscreenCanvas");const o="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,l=Nf(e,i,n,!0),a=new Map;let u;try{u=new zf}catch(t){return Hf(`disabled because the encode worker did not start. ${Uf}`,t),void l()}let c=!1;u.onerror=t=>{var e;c=!0,Hf(`stopped because the encode worker failed. ${Uf}`,t),cancelAnimationFrame(f),null===(e=u.terminate)||void 0===e||e.call(u),this.resetFrameDedup=null},this.resetFrameDedup=()=>{u.postMessage({resetFrameDedup:!0})},u.onmessage=t=>{const{id:e}=t.data;if(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:eh["2D"],commands:[{property:"clearRect",args:[0,0,s,r]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:n}]},0,0,s,r]}],displayWidth:s,displayHeight:r})};let h=!1,d=!1;const v=1e3/t;let f,p=0;const g=t=>{var l;c||(p&&v>t-p||(p=t,(()=>{const t=[],s=e=>{try{e.querySelectorAll("canvas").forEach(e=>{Cv(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(-1!==e&&!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,c=Math.max(1,Math.round(r*o)),d=Math.max(1,Math.round(l*o)),v=function(t,e,i,n,s,r){if(!t||"function"!=typeof t.regionsFn)return;let o;try{o=t.regionsFn(e)}catch(t){return xf}if(void 0===o)return;if(!Array.isArray(o)||!o.every($f))return xf;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,c,d,r,l);if("skip-frame"===v)return h||(h=!0,Hf("dropped a frame because the mask provider did not return valid regions. A provider that always fails records no canvas frames at all")),void a.set(e,!1);const f=yield createImageBitmap(t,1>o?{resizeWidth:c,resizeHeight:d,resizeQuality:"medium"}:{resizeWidth:c,resizeHeight:d});u.postMessage({id:e,bitmap:f,width:c,height:d,displayWidth:r,displayHeight:l,dataURLOptions:s.dataURLOptions,maskRegions:v},[f])}catch(t){d||(d=!0,Hf("dropped a frame because the snapshot failed. A canvas that fails every frame records no canvas frames at all",t)),a.set(e,!1)}}}),function(t){return l.apply(this,arguments)}))),f=requestAnimationFrame(g))};f=requestAnimationFrame(g),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(f),null===(t=u.terminate)||void 0===t||t.call(u),this.resetFrameDedup=null}}initCanvasMutationObserver(t,e,i,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=Nf(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=ph(e.CanvasRenderingContext2D.prototype,l,function(r){return function(...o){return Cv(this.canvas,i,n,!0)||setTimeout(()=>{let i;try{i=Pf(o,e,this,s)}catch(t){return}t(this.canvas,{type:eh["2D"],property:l,args:i})},0),r.apply(this,o)}});r.push(o)}catch(s){const o=wv(e.CanvasRenderingContext2D.prototype,l,{set(e){Cv(this.canvas,i,n,!0)||t(this.canvas,{type:eh["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(...jf(e.WebGLRenderingContext.prototype,eh.WebGL,t,i,n,e,s)),void 0!==e.WebGL2RenderingContext&&r.push(...jf(e.WebGL2RenderingContext.prototype,eh.WebGL2,t,i,n,e,s)),()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,i,n);this.resetObservers=()=>{s(),r(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,e)=>{const i=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,i)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,e){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(t);if(!i||-1===e)return;const n=i.map(t=>ws(t,Zc)),{type:s}=i[0];this.mutationCb({id:e,type:s,commands:n}),this.pendingCanvasMutations.delete(t)}};function Vf(t){var e,i,n;const s={};for(const n of Object.keys(null!==(e=null===(i=t.previous)||void 0===i?void 0:i.attributes)&&void 0!==e?e:{}))s[n]=null;return Object.assign(s,null===(n=t.current)||void 0===n?void 0:n.attributes),delete s.rel,delete s.href,s}var Gf,Jf,Qf,Zf=class{constructor(t){var e,i,n;rd(this,"trackedLinkElements",new WeakSet),rd(this,"pendingDeferredSheets",new Set),rd(this,"cssomRevisions",new WeakMap),rd(this,"stopped",!1),rd(this,"changedLinkJobs",new Map),rd(this,"linksInlinedSinceSnapshot",new WeakSet),rd(this,"mutationCb",void 0),rd(this,"adoptedStyleSheetCb",void 0),rd(this,"maskAllElementAttributes",void 0),rd(this,"maskAttributeFn",void 0),rd(this,"blockClass",void 0),rd(this,"blockSelector",void 0),rd(this,"styleMirror",new Fv),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(e=t.maskAllElementAttributes)&&void 0!==e&&e,this.maskAttributeFn=t.maskAttributeFn,this.blockClass=null!==(i=t.blockClass)&&void 0!==i?i:"rr-block",this.blockSelector=null!==(n=t.blockSelector)&&void 0!==n?n:null}isLinkBlocked(t){return Ev(t,this.blockClass,this.blockSelector)}attachLinkElement(t,e,i=null){this.stopped||!("_cssText"in e.attributes)||this.isLinkBlocked(t)||(this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:Vf({previous:i,current:e})}]}),this.linksInlinedSinceSnapshot.add(t)),this.trackLinkElement(t)}beginDeferredLinkInlining(t,e,i={}){var n;const s=null!==(n=i.emitCssText)&&void 0!==n?n:i=>this.emitCssTextMutation(t,e,i);if(-1===e||!t.isConnected)return null;let r=null,o=null;try{o=t.sheet,o&&(r=function(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||cd(e)}catch(t){s=e.cssText}try{var n;s&&(null===(n=e.styleSheet)||void 0===n?void 0:n.href)&&(s=Rd(s,e.styleSheet.href))}catch(t){}s&&t.parts.push(s),t.index+=1}catch(t){r(null)}}function l(t){var i;const n=t.rules[t.index];if("sheet"===t.kind&&pd(n)){const i=s.get(n);return null===i?(t.parts.push(n.cssText),void(t.index+=1)):i?void e.push({kind:"sheet",sheet:i.sheet,rules:i.rules,sheetHref:i.sheetHref,index:0,parts:[],importRule:n}):void o(t,n,null)}if(function(t,i){try{if(void 0!==Eh(t))return!1;const n=bd(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?Rd(n,s):n,fixColons:"sheet"===i.kind&&gd(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(n,t))return;let r=null!==(i=Eh(n))&&void 0!==i?i:n.cssText;"sheet"===t.kind&&gd(n)&&n.selectorText.includes(":")&&(r=fd(r)),t.parts.push(t.sheetHref?Rd(r,t.sheetHref):r),t.index+=1}return function(t){try{const i=t.rules||t.cssRules;if(!i)return!1;Kh(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,!pd(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;Kh(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=Ah();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?fd(i):i}else e=ud(t.parts.join(""))}catch(t){}r(e);continue}o-=1;try{l(t)}catch(t){r(null)}}}catch(t){i=!0,n=null}finally{Xh(Ah()-s)}return i},text(){return i?n:null},remainingRules(){if(i)return 0;let t=0;for(const i of e)t+=i.rules.length-i.index;return t}}}(o))}catch(t){}var l;if(!r||!o)return id(),null===(l=i.onUninlinable)||void 0===l||l.call(i),null;const a=r;let u=!1;const c={sheet:o,invalidate(){u=!0}};this.pendingDeferredSheets.add(c);let h=!1;return{advance:e=>{if(h)return!0;const n=Ah(),r=Fh();let l=!0;try{if(u)return h=!0,i.onInvalidatedBySheetMutation?i.onInvalidatedBySheetMutation():id(),!0;if(!a.advance(e))return l=!1,!1;h=!0;const n=a.text();if(!t.isConnected)return!0;let r=null;try{r=t.sheet}catch(t){}return r!==o?(id(),!0):n?(this.isLinkBlocked(t)||s(n),!0):(id(),null===(d=i.onUninlinable)||void 0===d||d.call(i),!0);var d}finally{l&&this.pendingDeferredSheets.delete(c),Lh(v=Ah()-n,null!=(f=r)?f:Oh)||(Gh.totalMs+=v,v>Gh.slowestSliceMs&&(Gh.slowestSliceMs=v))}var v,f},remainingRules:()=>a.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(c)}}}onCssomSheetMutation(t){var e;if(!t)return;const i=(null!==(e=this.cssomRevisions.get(t))&&void 0!==e?e:0)+1;this.cssomRevisions.set(t,i);for(const e of this.pendingDeferredSheets)e.sheet===t&&(this.pendingDeferredSheets.delete(e),e.invalidate());return i}isCurrentCssomMutation(t,e){return!this.stopped&&this.cssomRevisions.get(t)===e}inlineLinkStylesheetAfterChange(t,e){this.stopped||-1===e.currentId()||function(t,e){const i=nv(t),n=ev.get(t);if(n)return void(n.changedLinkBaseline&&(n.changedLinkBaseline.sheetAtLatestChange=i));const s={sheetAtLatestChange:i},r=()=>{const e=nv(t);return Boolean(e&&(e!==s.sheetAtLatestChange||e.href===t.href))};r()?e():sv(t,e,r,rv,s)}(t,()=>this.inlineChangedLinkStylesheet(t,e,3))}inlineChangedLinkStylesheet(t,e,i){var n;const s=e.currentId();if(this.stopped||!t.isConnected||-1===s||this.isLinkBlocked(t))return;null===(n=this.changedLinkJobs.get(t))||void 0===n||n.drop();let r=!1;const o=this.beginDeferredLinkInlining(t,s,{emitCssText:i=>this.emitCssTextMutation(t,s,i,Vf(e.reserializeWithoutCss())),onInvalidatedBySheetMutation(){r=!0},onUninlinable:()=>this.readdAsPlainLink(t,e)});if(!o)return;let l=null;const a=()=>{o.discard(),null==l||l.cancel(),l=null,this.changedLinkJobs.get(t)===u&&this.changedLinkJobs.delete(t)},u={remainingRules:()=>o.remainingRules(),runSlice:()=>{try{return this.stopped||this.changedLinkJobs.get(t)!==u||-1===e.currentId()||this.isLinkBlocked(t)?(a(),!0):!!o.advance(200)&&(a(),!r||(i>0?this.inlineChangedLinkStylesheet(t,e,i-1):id(),!0))}catch(t){return a(),!0}},drop:a};this.changedLinkJobs.set(t,u);const c=t=>{l=null;let e,i=0;do{e=u.runSlice(),i+=1}while(!e&&(t?!t.didTimeout&&t.timeRemaining()>5:10>i));e||(l=df(c))};l=df(c)}flushChangedLinkInlining(t){let e=0;for(const i of this.changedLinkJobs.values()){let n=!1;for(;!n;){if(Math.floor(i.remainingRules()/200)+1>t-e){i.drop(),nd(1);break}n=i.runSlice(),e+=1}}return e}inlineDeferredLinkElement(t,e){var i;null===(i=this.beginDeferredLinkInlining(t,e))||void 0===i||i.advance(1/0)}emitCssTextMutation(t,e,i,n={}){this.stopped||(this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e,attributes:ue(ue({},n),{},{_cssText:xd({element:t,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})})}]}),this.linksInlinedSinceSnapshot.add(t))}readdAsPlainLink(t,e){try{var i,n;if(this.stopped||!t.isConnected||this.isLinkBlocked(t))return;if(!this.linksInlinedSinceSnapshot.has(t)&&!("_cssText"in(null!==(i=null===(n=e.lastSerialization())||void 0===n?void 0:n.attributes)&&void 0!==i?i:{})))return;this.linksInlinedSinceSnapshot.delete(t),e.readdAsMove()}catch(t){}}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=Ah();try{Yh(()=>{try{const t=e.rules||e.cssRules;t&&Kh(t)}catch(t){}n.push({styleId:i,rules:Array.from(e.rules||CSSRule,(t,i)=>({rule:vd(t,e.href),index:i}))})})}finally{Xh(Ah()-s)}}i.styleIds.push(t)}n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}stop(){this.stopped=!0,this.dropChangedLinkJobs(),iv()}dropChangedLinkJobs(){Array.from(this.changedLinkJobs.values()).forEach(t=>t.drop())}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),this.dropChangedLinkJobs(),this.linksInlinedSinceSnapshot=new WeakSet,iv({keepChangedLinks:!0})}trackStylesheetInLinkElement(t){}},Kf=class{constructor(){rd(this,"nodeMap",new WeakMap),rd(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(){}},Yf=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var Xf;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(Xf=t.contentWindow)||void 0===Xf?void 0:Xf.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var tp=new _d,ep=new Set([Yc.Mutation,Yc.MediaInteraction,Yc.StyleSheetRule,Yc.CanvasMutation,Yc.Font,Yc.Log,Yc.StyleDeclaration,Yc.AdoptedStyleSheet]);function ip(t={}){let e,i=!1,n=!1;const{emit:s,checkoutEveryNms:r,checkoutEveryNth:o,blockClass:l="rr-block",blockSelector:a=null,ignoreClass:u="rr-ignore",ignoreSelector:c=null,maskTextClass:h="rr-mask",maskTextSelector:d=null,inlineStylesheet:v=!0,inlineStylesheetBudgetRules:f,maskAllInputs:p,maskInputOptions:g,slimDOMOptions:m,maskInputFn:y,selectMaskingFn:b,maskTextFn:_,maskAllElementAttributes:w=!1,maskAttributeFn:k,hooks:S,packFn:x,sampling:T={},dataURLOptions:C={},canvasResolutionScale:E,canvasMasking:M,mousemoveWait:I,recordDOM:R=!0,recordCanvas:A=!1,recordCrossOriginIframes:O=!1,recordAfter:P=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:F=!1,collectFonts:L=!1,inlineImages:D=!1,plugins:N,keepIframeSrcFn:j=()=>!1,ignoreCSSAttributes:q=new Set([]),attributeFilter:B,errorHandler:z}=t;Wv(z);const U=ue({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},C),H=!O||window.parent===window;let W=!1;if(!H)try{window.parent.document&&(W=!1)}catch(t){W=!0}if(H&&!s)throw new Error("emit function is required");if(!H&&!W)return()=>{};void 0!==I&&void 0===T.mousemove&&(T.mousemove=I),tp.reset(),iv();const V=!0===p?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0,hidden:!0}:void 0!==g?g:{password:!0},G=hv(void 0!==m&&m);let J;!function(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();let Q=0;const Z=new Map;let K,Y;const X=t=>{for(const e of N||[])e.eventProcessor&&(t=e.eventProcessor(t));return x&&!W&&(t=x(t)),t};Gf=(t,e,i)=>{var n;const l=t;if(l.timestamp=kv(),!(null===(n=Jv[0])||void 0===n?void 0:n.isFrozen())||l.type===Kc.FullSnapshot||l.type===Kc.IncrementalSnapshot&&ep.has(l.data.source)||Jv.forEach(t=>t.unfreeze()),H)i?null==s||s(X(l),e,!0):null==s||s(X(l),e);else if(W){const t={type:"rrweb",event:X(l),origin:window.location.origin,isCheckout:e};i&&(t.nonInteractive=!0),window.parent.postMessage(t,"*")}if(l.type===Kc.FullSnapshot)J=l,Q=0;else if(l.type===Kc.IncrementalSnapshot){if(l.data.source===Yc.Mutation&&l.data.isAttachIframe)return;Q++,(o&&Q>=o||r&&l.timestamp-J.timestamp>r)&&Jf(!0)}};const tt=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=tp.getNode(e.node.id);t&&"IFRAME"===t.nodeName&&i.add(t)}t.removes.forEach(({id:t})=>{if(e&&e.has(t))return;const n=ot.getIframeElementById(t);n&&i.has(n)?ot.forgetIframeId(t):(null==K||K(t),ot.removeIframeById(t))}),null==Y||Y(),ot.cleanupDetachedIframes()}Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.Mutation},t)})},et=t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.Scroll},t)}),it=t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.CanvasMutation},t)}),nt=new Zf({mutationCb:tt,adoptedStyleSheetCb:t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.AdoptedStyleSheet},t)}),maskAllElementAttributes:w,maskAttributeFn:k,blockClass:l,blockSelector:a});let st=!1;const rt=()=>{if(!st){st=!0;try{var t;const i=null!==(t=null==e?void 0:e.flush())&&void 0!==t?t:0;nt.flushChangedLinkInlining(50-i)}finally{st=!1}}},ot=new gf({mirror:tp,mutationCb:tt,stylesheetManager:nt,recordCrossOriginIframes:O,wrappedEmit:Gf,blockClass:l,blockSelector:a});for(const t of N||[])t.getMirror&&t.getMirror({nodeMirror:tp,crossOriginIframeMirror:ot.crossOriginIframeMirror,crossOriginIframeStyleMirror:ot.crossOriginIframeStyleMirror});const lt=new Kf,at=null==M?void 0:M.configured;Qf=new Wf({recordCanvas:A,mutationCb:it,win:window,blockClass:l,blockSelector:a,mirror:tp,sampling:T.canvas,dataURLOptions:U,resolutionScale:E,canvasMasking:M});const ut=new kf({mutationCb:tt,scrollCb:et,bypassOptions:{blockClass:l,blockSelector:a,maskTextClass:h,maskTextSelector:d,inlineStylesheet:v,maskInputOptions:V,dataURLOptions:U,maskTextFn:_,maskInputFn:y,selectMaskingFn:b,maskAllElementAttributes:w,maskAttributeFn:k,recordCanvas:A,canvasMaskingConfigured:at,inlineImages:D,sampling:T,slimDOMOptions:G,iframeManager:ot,stylesheetManager:nt,canvasManager:Qf,keepIframeSrcFn:j,processedNodeManager:lt,attributeFilter:B},mirror:tp});Jf=(t=!1)=>{if(R){Jh(f);try{if(Gf({type:Kc.Meta,data:{href:window.location.href,width:$v(),height:xv()}},t),i)return;null==e||e.cancel(),e=void 0,nt.reset(),ut.init(),Jv.forEach(t=>t.lock());let n=null,s=[];try{n=function(t,e){const{mirror:i=new _d,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:u=!1,canvasMaskingConfigured:c,maskAllInputs:h=!1,maskTextFn:d,maskInputFn:v,selectMaskingFn:f,maskAllElementAttributes:p=!1,maskAttributeFn:g,slimDOM:m=!1,dataURLOptions:y,preserveWhiteSpace:b,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:T,keepIframeSrcFn:C=()=>!1,maxDepth:E,inlineStylesheetBudgetRules:M}=e||{},I=!0===h?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0,hidden:!0}:!1===h?{password:!0}:h,R=hv(m);Jh(M);try{return cv(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:I,maskTextFn:d,maskInputFn:v,selectMaskingFn:f,maskAllElementAttributes:p,maskAttributeFn:g,slimDOMOptions:R,dataURLOptions:y,inlineImages:a,recordCanvas:u,canvasMaskingConfigured:c,preserveWhiteSpace:b,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:T,keepIframeSrcFn:C,newlyAddedElement:!1,maxDepth:E})}finally{Qh()}}(document,{mirror:tp,blockClass:l,blockSelector:a,maskTextClass:h,maskTextSelector:d,inlineStylesheet:v,maskAllInputs:V,inlineStylesheetBudgetRules:f,maskTextFn:_,maskInputFn:y,selectMaskingFn:b,maskAllElementAttributes:w,maskAttributeFn:k,slimDOM:G,dataURLOptions:U,recordCanvas:A,canvasMaskingConfigured:at,inlineImages:D,onSerialize(t){Av(t,tp)&&ot.addIframe(t),Ov(t,tp)&&nt.trackLinkElement(t),Pv(t)&&ut.addShadowRoot(gh.shadowRoot(t),document)},onIframeLoad(t,e){ot.attachIframe(t,e),ut.observeAttachShadow(t)},onIframeListenerRegistered(t,e){ot.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e,i){nt.attachLinkElement(t,e,i)},keepIframeSrcFn:j})}finally{s=ed()}if(i)return;if(!n)return console.warn("Failed to snapshot the document");if(ef=new WeakMap,Gf({type:Kc.FullSnapshot,data:{node:n,initialOffset:Sv(window)}},t),i)return;if(Jv.forEach(t=>t.unlock()),Qf.onFullSnapshot(),s.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&&pv(()=>{o=e.beginDeferredLinkInlining(i,tp.getId(i))})},u=()=>{if(!o)return;const t=o;let e=!0;pv(()=>{e=t.advance(200)}),e&&(o=null)},c=()=>{o||a(),u()},h=t=>{if(s=null,n)return;let e=0;do{try{c()}catch(t){null==o||o.discard(),o=null,nd(1)}e+=1}while(!n&&l()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));n||(l()?s=df(h):i())};return s=df(h),{cancel(){n=!0,null==o||o.discard(),o=null,null==s||s.cancel(),s=null},flush(){if(n)return 0;n=!0,null==s||s.cancel(),s=null;let e=0,c=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,c+=1;else{try{u()}catch(t){null==o||o.discard(),o=null,c+=1}e+=1}}if(l()||c>0){let e=c+(null!==o?1:0);for(let i=r;t.length>i;i++)null!==t[i]&&(e+=1);nd(e),null==o||o.discard(),o=null}return i(),e}}}(s,nt,()=>{e===t&&(e=void 0)});e=t}O&&ot.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&nt.adoptStyleSheets(document.adoptedStyleSheets,tp.getId(document))}finally{Qh()}}};const ct=[];let ht;try{ht=new wf(window,R),ct.push(vv("pagehide",()=>{try{rt()}catch(t){}e=void 0},window));for(const t of["visibilitychange","freeze","resume"])ct.push(vv(t,Ph,document));K=t=>{const e=Z.get(t);e&&(e.forEach(t=>{pv(t);const e=ct.indexOf(t);-1!==e&&ct.splice(e,1)}),Z.delete(t))},Y=()=>{null==ht||ht.prune();for(const[t]of Z){const e=tp.getNode(t);if(e)try{e.contentDocument&&e.contentDocument.defaultView||null==K||K(t)}catch(e){null==K||K(t)}else null==K||K(t)}};const t=t=>{var e;return Gv(uf)({mutationCb:tt,mousemoveCb:(t,e)=>Gf({type:Kc.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.MouseInteraction},t)}),scrollCb:et,viewportResizeCb:t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.ViewportResize},t)}),inputCb:(t,e)=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.Input},t)},void 0,e),mediaInteractionCb:t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.MediaInteraction},t)}),styleSheetRuleCb:t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.StyleSheetRule},t)}),styleDeclarationCb:t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.StyleDeclaration},t)}),canvasMutationCb:it,fontCb:t=>Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.Font},t)}),selectionCb(t){Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.Selection},t)})},customElementCb(t){Gf({type:Kc.IncrementalSnapshot,data:ue({source:Yc.CustomElement},t)})},blockClass:l,ignoreClass:u,ignoreSelector:c,maskTextClass:h,maskTextSelector:d,maskInputOptions:V,inlineStylesheet:v,sampling:T,recordDOM:R,recordCanvas:A,canvasMaskingConfigured:at,inlineImages:D,userTriggeredOnInput:F,collectFonts:L,doc:t,maskInputFn:y,selectMaskingFn:b,maskTextFn:_,maskAllElementAttributes:w,maskAttributeFn:k,keepIframeSrcFn:j,blockSelector:a,slimDOMOptions:G,dataURLOptions:U,mirror:tp,iframeManager:ot,stylesheetManager:nt,shadowDomManager:ut,processedNodeManager:lt,canvasManager:Qf,ignoreCSSAttributes:q,attributeFilter:B,plugins:(null==N||null===(e=N.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({name:t.name,observer:t.observer,options:t.options,callback:e=>Gf({type:Kc.Plugin,data:{plugin:t.name,payload:e}})})))||[]},S)},s=e=>{const i=e.defaultView?null==ht?void 0:ht.observe(e.defaultView):void 0;try{const n=t(e);return()=>gv([()=>null==n?void 0:n(),()=>null==i?void 0:i()])}catch(t){throw null==i||i(),t}},r=new WeakMap,o=new WeakMap;ot.addLoadListener(t=>{null==ht||ht.prune();try{const e=t.contentDocument,i=tp.getId(t);if(!e)return;const n=o.get(t);if(n){o.delete(t),pv(n);const e=ct.indexOf(n);-1!==e&&ct.splice(e,1)}const l=r.get(e);if(-1!==i&&l){if(l())return;null==K||K(i)}const a=s(e);if("function"==typeof a){let n=!1;const s=vv("rrweb-check-iframe-observers",()=>{n=!0},e);-1!==i&&r.set(e,()=>{n=!1;const t=e.createEvent("Event");return t.initEvent("rrweb-check-iframe-observers",!1,!1),e.dispatchEvent(t),n});const l=()=>{r.delete(e),s(),a()};if(ct.push(l),-1!==i){let t=Z.get(i);t||(t=new Set,Z.set(i,t)),t.add(l)}else o.set(t,l)}}catch(t){console.warn(t)}}),ot.addPageHideListener(t=>{const e=tp.getId(t);null==K||K(e),Yv(t)});let f=-1;const p=t=>Gf({type:Kc.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),g=()=>{var t,e,i,n;const s=document,r=null!==(t=null!==(e=null!==(i=null!==(n=s.fullscreenElement)&&void 0!==n?n:s.webkitFullscreenElement)&&void 0!==i?i:s.mozFullScreenElement)&&void 0!==e?e:s.msFullscreenElement)&&void 0!==t?t:null,o=r?tp.getId(r):-1;o!==f&&(-1!==f&&p({id:f,enter:!1}),f=o,-1!==o&&p({id:o,enter:!0}))},m=()=>{if(i||n)return;if(n=!0,Jf(),i)return;const t=s(document);i?"function"==typeof t&&gv([t]):("function"==typeof t&&ct.push(t),ct.push(vv("fullscreenchange",g)),ct.push(vv("webkitfullscreenchange",g)),ct.push(vv("mozfullscreenchange",g)),ct.push(vv("MSFullscreenChange",g)),Yf=!0,ht&&(ht.ready=!0))};["interactive","complete"].includes(document.readyState)?m():(ct.push(vv("DOMContentLoaded",()=>{Gf({type:Kc.DomContentLoaded,data:{}}),"DOMContentLoaded"===P&&setTimeout(m,0)})),ct.push(vv("load",()=>{Gf({type:Kc.Load,data:{}}),"load"===P&&m()},window)));const x=()=>{if(null==ht||ht.beforeStop(),!i){i=!0;try{rt()}catch(t){}e=void 0,nt.stop(),gv(ct),lt.destroy(),ot.removeLoadListener(),ot.destroy(),Z.clear(),ut.reset(),tp.reset(),Yf=!1,Vv(),null==ht||ht.stop()}};return ht&&function(t,e){yf.set(t,e)}(x,ht),x}catch(t){i=!0,gv(ct),null==ht||ht.stop(),console.warn(t)}}ip.withStyleRuleSourceHandoff=function(t,e){const i=yf.get(t);if(!i||i.stopped||vf!==i||ff)return _f(),void e(()=>{});const n={previous:i,next:void 0,valid:!0,stopStarted:!1,stopCompleted:!1,retained:new Set};ff=n;try{e(()=>{ff===n&&_f()})}finally{var s;(null===(s=n.next)||void 0===s?void 0:s.ready)||_f();for(const t of n.retained)0===t.owners&&bf(t);n.retained.clear(),ff===n&&(ff=void 0)}},ip.addCustomEvent=(t,e)=>{if(!Yf)throw new Error("please add custom event after start recording");Gf({type:Kc.Custom,data:{tag:t,payload:e}})},ip.freezePage=()=>{Jv.forEach(t=>t.freeze())},ip.takeFullSnapshot=t=>{if(!Yf)throw new Error("please take full snapshot after start recording");Jf(t)},ip.isRecording=()=>Yf,ip.supportsSelectMasking=!0,ip.mirror=tp,Date,Date;var np=Object.create(null);function sp(t){return sp="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},sp(t)}function rp(t,e,i){return(e=function(t){var e=function(t){if("object"!=sp(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=sp(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==sp(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}np.Node=Object.create(null),np.ShadowRoot=Object.create(null),np.MutationObserver=Object.create(null),np.Element=Object.create(null);var op=class{constructor(t){rp(this,"fileName",void 0),rp(this,"functionName",void 0),rp(this,"lineNumber",void 0),rp(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}`}},lp=/(^|@)\S+:\d+/,ap=/^\s*at .*(\S+:\d+|\(native\))/m,up=/^(eval@)?(\[native code])?$/,cp={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(ap)?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(ap)},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 op({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(up)},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 op({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(e),n=i&&i[1]?i[1]:void 0,s=this.extractLocation(t.replace(e,""));return new op({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 op({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 op({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(lp)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),i=this.extractLocation(e.pop());return new op({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function hp(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 dp(t){return Array.isArray(t)}function vp(t){return"object"==typeof t&&null!==t&&!dp(t)}function fp(t,e){if(0===e)return!0;const i=Object.keys(t);for(const n of i)if(vp(t[n])&&fp(t[n],e-1))return!0;return!1}function pp(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(vp(r=e)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||vp(r)&&fp(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]=dp(n)?hp(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 gp={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function mp(t,e,i){const n=i?Object.assign({},gp,i):gp,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:cp.parse(e.error).map(t=>t.toString()),payload:[pp(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=[pp(`Uncaught (in promise) ${i.name}: ${i.message}`,n.stringifyOptions)]):(i=new Error,s=[pp("Uncaught (in promise)",n.stringifyOptions),pp(e.reason,n.stringifyOptions)]),t({level:"error",trace:cp.parse(i).map(t=>t.toString()),payload:s})};e.addEventListener("unhandledrejection",s),u.push(()=>{e.removeEventListener("unhandledrejection",s)})}for(const t of n.level)u.push(c(r,t));return()=>{a=!1,u.forEach(t=>t())};function c(e,i){return e[i]?function(s,r){try{if(!(r in s))return()=>{};const u=s[r],c={next:u},h=(s=>(...r)=>{if(s.apply(e,r),a&&!("assert"===i&&r[0]||l)){l=!0;try{const e=cp.parse(new Error).map(t=>t.toString()).splice(1),s=("assert"===i?r.slice(1):r).map(t=>pp(t,n.stringifyOptions));o++,n.lengthThreshold>o?t({level:i,trace:e,payload:s}):o===n.lengthThreshold&&t({level:"warn",trace:[],payload:[pp("The number of log records reached the threshold.")]})}catch(t){s.apply(e,["rrweb logger error:",t,...r])}finally{l=!1}}})(function(...t){return c.next.apply(this,t)});return"function"==typeof h&&(h.prototype=h.prototype||{},Object.defineProperties(h,{__rrweb_original__:{enumerable:!1,value:u},__rrweb_layer__:{enumerable:!1,value:c}})),s[r]=h,()=>{if(s[r]===h)return void(s[r]=c.next);const t=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let e=s[r],i=t(e);for(;i;){if(i.next===h)return void(i.next=c.next);e=i.next,i=t(e)}}}catch(t){return()=>{}}}(e,i):()=>{}}}var yp=t=>({name:"rrweb/console@1",observer:mp,options:t});const bp=()=>{},_p=t=>{var e;if(xe(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function wp(t,e,i){try{if(!(e in t))return bp;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=_p(i);for(;r;){if(r.next===s)return void(r.next=n.next);i=r.next,r=_p(i)}}}catch(t){return bp}}function kp(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 Sp=Hr("[Recorder]"),xp=t=>"navigation"===t.entryType,$p=t=>"resource"===t.entryType,Tp=()=>{};function Cp(t,e){var i;return xp(e)&&"complete"===(null===(i=t.document)||void 0===i?void 0:i.readyState)&&e.loadEventEnd>0}function Ep(t,e){return e.recordInitialRequests?t.performance.getEntries().filter(i=>Cp(t,i)||$p(i)&&e.initiatorTypes.includes(i.initiatorType)):e.performanceEntryTypeToObserve.includes("navigation")?function(t){var e;return"complete"!==(null===(e=t.document)||void 0===e?void 0:e.readyState)?[]:t.performance.getEntriesByType("navigation").filter(e=>Cp(t,e))}(t):[]}function Mp(t,e){return!!e&&(Pe(e)||e[t])}function Ip(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 Rp=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function Ap({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:!!Ip(e)&&t(e.url)}catch(t){return!1}}(n))return!1;if(s(Rp))return!1;if(Pe(e))return!0;if(Se(e))return s(e);const r=e[t];return Pe(r)?r:s(r)}function Op(t,e,i,n,s){return Pp.apply(this,arguments)}function Pp(){return Pp=re(function*(t,e,i,n,s,r=0){if(r>10)return Sp.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=>$p(t)&&t.initiatorType===e&&(Ce(n)||t.startTime>=n)&&(Ce(s)||s>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*r)),Op(t,e,i,n,s,r+1))}),Pp.apply(this,arguments)}function Fp({body:t,options:e,url:i}){if(Re(t))return null;const{hostname:n,isHostDenied:s}=kp(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 ao(t);if($e(t))try{return JSON.stringify(t)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}const Lp=t=>!Ie(t)&&("navigation"===t.entryType||"resource"===t.entryType);function Dp(t,{entry:e,method:i,status:n,networkRequest:s,isInitial:r,start:o,end:l,url:a,initiatorType:u}){o=e?e.startTime:o,l=e?e.responseEnd:l;const c=Math.floor(Date.now()-t.performance.now()),h=Math.floor(c+(o||0)),d=[ue(ue({},e?JSON.parse(JSON.stringify(e.toJSON())):{name:a}),{},{startTime:Ce(o)?void 0:Math.round(o),endTime:Ce(l)?void 0:Math.round(l),timeOrigin:c,timestamp:h,method:i,initiatorType:u||(e?e.initiatorType:void 0),status:n,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:r})];if(Lp(e))for(const t of e.serverTiming||[])d.push({timeOrigin:c,timestamp:h,startTime:Math.round(e.startTime),name:t.name,duration:t.duration,entryType:"serverTiming"});return d}const Np=["video/","audio/"];function jp(t){return $e(t)&&xe(t.getReader)&&xe(t.tee)}const qp="[SessionReplay] Timeout while trying to read body",Bp="[SessionReplay] Failed to read body";function zp(t){return`${Bp}: ${t}`}function Up(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function Hp(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const i=setTimeout(()=>e(qp),500);try{t.clone().text().then(t=>e(t),t=>e(zp(t))).finally(()=>clearTimeout(i))}catch(t){clearTimeout(i),e(Bp)}})}(t);const i=al(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(Up(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(qp),500);let a;try{a=t.clone()}catch(t){return void o(Bp)}const u=a.body;if(!jp(u)||"undefined"==typeof TextDecoder){try{a.text().then(t=>o(t),t=>o(zp(t)))}catch(t){o(Bp)}return}try{n=u.getReader()}catch(t){return void o(Bp)}const c=[];let h=0;!function t(){n.read().then(({done:i,value:n})=>{if(s)r();else if(i)o((new TextDecoder).decode(function(t,e){const i=new Uint8Array(e);let n=0;for(const e of t)i.set(e,n),n+=e.byteLength;return i}(c,h)));else{if(n){if(h+n.byteLength>e)return void o(Up(e));h+=n.byteLength,c.push(n)}t()}},t=>o(zp(t)))}()})}(t,i)}function Wp(t){return Vp.apply(this,arguments)}function Vp(){return Vp=re(function*({r:t,options:e,url:i}){const{hostname:n,isHostDenied:s}=kp(i,e);return s?Promise.resolve(n+" is in deny list"):Hp(t,e)}),Vp.apply(this,arguments)}function Gp(t){return Jp.apply(this,arguments)}function Jp(){return Jp=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=Np.some(t=>null==s?void 0:s.startsWith(t));if(s&&r)return`Content-Type ${s} is not supported`;const{hostname:o,isHostDenied:l}=kp(i,e);return l?o+" is in deny list":null}({r:t,options:e,url:i});return Ie(n)?Hp(t,e):Promise.resolve(n)}),Jp.apply(this,arguments)}let Qp=null;function Zp(t,e,i){if(!("performance"in e))return()=>{};if(Qp)return Sp.warn("Network observer already initialised, doing nothing"),()=>{};const n=i?Object.assign({},ul,i):ul;let s=!0,r=!1;const o=e=>{if(!s)return;const i=[];let o=!1;e.requests.forEach(t=>{const e="serverTiming"===t.entryType;if(e&&o)return;let s;try{s=n.maskRequestFn(t)}catch(t){return r||(r=!0,Sp.warn("Network capture masking callback failed; dropping the record. Further masking failures will not be logged for this observer.")),void(e||(o=!0))}e||(o=!s||(t=>!!t&&ml.has(t))(s)),s&&i.push(s)}),i.length>0&&t(ue(ue({},e),{},{requests:i}))},l=function(t,e,i){try{t({requests:Ep(e,i).flatMap(t=>Dp(e,{entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}catch(t){Sp.error("Failed to capture initial performance entries for network capture",t)}const n=e.PerformanceObserver,s=null==n?void 0:n.supportedEntryTypes;if(!n||!Se(s))return;const r=s.filter(t=>i.performanceEntryTypeToObserve.includes(t));if(!r.length)return;const o=new n(n=>{t({requests:n.getEntries().filter(t=>xp(t)||$p(t)&&i.initiatorTypes.includes(t.initiatorType)&&(t=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>Dp(e,{entry:t,method:void 0,status:void 0,networkRequest:{}}))})});return o.observe({entryTypes:r}),()=>{o.disconnect()}}(o,e,n),a=n.recordHeaders||n.recordBody;if(!l&&!a)return s=!1,Tp;let u=()=>{},c=()=>{};return a&&(u=function(t,e,i){if(!i.initiatorTypes.includes("xmlhttprequest"))return()=>{};const n=Mp("request",i.recordHeaders),s=Mp("response",i.recordHeaders),r=wp(e.XMLHttpRequest.prototype,"open",r=>function(o,l,a=!0,u,c){const h=this;try{const r=new Request(l),a={};let u,c;const d={},v=h.setRequestHeader.bind(h);h.setRequestHeader=(t,e)=>(d[t]=e,v(t,e)),n&&(a.requestHeaders=d);const f=h.send.bind(h);h.send=t=>(Ap({type:"request",headers:d,url:l,recordBody:i.recordBody})&&(a.requestBody=Fp({body:t,options:i,url:l})),u=e.performance.now(),f(t));const p=()=>{h.removeEventListener("readystatechange",g),h.removeEventListener("error",p),h.removeEventListener("abort",p),h.removeEventListener("timeout",p)},g=()=>{if(h.readyState!==h.DONE)return;p(),c=e.performance.now();const n={};h.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(t=>{const e=t.split(": "),i=e.shift(),s=e.join(": ");i&&(n[i]=s)}),s&&(a.responseHeaders=n),Ap({type:"response",headers:n,url:l,recordBody:i.recordBody})&&(a.responseBody=Fp({body:h.response,options:i,url:l})),Op(e,"xmlhttprequest",r.url,u,c).then(i=>{t({requests:Dp(e,{entry:i,method:o,status:null==h?void 0:h.status,networkRequest:a,start:u,end:c,url:l.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};h.addEventListener("readystatechange",g),h.addEventListener("error",p),h.addEventListener("abort",p),h.addEventListener("timeout",p)}catch(t){Sp.error("Failed to instrument XHR for network capture",t)}r.call(h,o,l.toString(),a,u,c)});return()=>{r()}}(o,e,n),c=!0===n.captureFetchSynchronously?function(t,e,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=Mp("request",i.recordHeaders),s=Mp("response",i.recordHeaders),r=wp(e,"fetch",r=>function(o,l){let a;try{a=new Request(o,l)}catch(t){Sp.error("Failed to instrument fetch for network capture",t);try{return Promise.resolve(r(o,l))}catch(t){return new Promise((e,i)=>i(t))}}const u={};let c,h;const d=re(function*(){try{const t={};a.headers.forEach((e,i)=>{t[i]=e}),n&&(u.requestHeaders=t),!jp(null==l?void 0:l.body)&&Ap({type:"request",headers:t,url:o,recordBody:i.recordBody})&&(u.requestBody=yield Wp({r:a,options:i,url:o}))}catch(t){Sp.error("Failed to record fetch request for network capture",t)}})(),v=(f=re(function*(t){try{const e={};t.headers.forEach((t,i)=>{e[i]=t}),s&&(u.responseHeaders=e),Ap({type:"response",headers:e,url:o,recordBody:i.recordBody})&&(u.responseBody=yield Gp({r:t,options:i,url:o}))}catch(t){Sp.error("Failed to record fetch response for network capture",t)}}),function(t){return f.apply(this,arguments)});var f;try{c=e.performance.now()}catch(t){}let p;try{p=Ip(o)?r(a):r(o,l)}catch(t){p=new Promise((e,i)=>i(t))}const g=Promise.resolve(p).then(t=>{try{h=e.performance.now()}catch(t){}return{status:"fulfilled",response:t}},t=>({status:"rejected",error:t})),m=i=>{(i=>Op(e,"fetch",a.url,c,h).then(n=>{t({requests:Dp(e,{entry:n,method:a.method,status:null==i?void 0:i.status,networkRequest:u,start:c,end:h,url:a.url,initiatorType:"fetch"})})}))(i).catch(()=>{})};return re(function*(){let t,e=!1;try{yield d;const n=yield g;if("rejected"===n.status)throw n.error;if(t=n.response,!0===i.returnFetchResponseEarly){const i=t;e=!0;const n=()=>m(i);return v(i).then(n,n),i}return yield v(t),t}finally{e||m(t)}})()});return()=>{r()}}(o,e,n):function(t,e,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=Mp("request",i.recordHeaders),s=Mp("response",i.recordHeaders),r=wp(e,"fetch",r=>function(){var o=re(function*(o,l){let a,u;try{a=new Request(o,l)}catch(t){return Sp.error("Failed to instrument fetch for network capture",t),r(o,l)}const c={};let h,d;try{try{const t={};a.headers.forEach((e,i)=>{t[i]=e}),n&&(c.requestHeaders=t),!jp(null==l?void 0:l.body)&&Ap({type:"request",headers:t,url:o,recordBody:i.recordBody})&&(c.requestBody=yield Wp({r:a,options:i,url:o}))}catch(t){Sp.error("Failed to record fetch request for network capture",t)}h=e.performance.now(),u=Ip(o)?yield r(a):yield r(o,l),d=e.performance.now();try{const t={};u.headers.forEach((e,i)=>{t[i]=e}),s&&(c.responseHeaders=t),Ap({type:"response",headers:t,url:o,recordBody:i.recordBody})&&(c.responseBody=yield Gp({r:u,options:i,url:o}))}catch(t){Sp.error("Failed to record fetch response for network capture",t)}return u}finally{Op(e,"fetch",a.url,h,d).then(i=>{t({requests:Dp(e,{entry:i,method:a.method,status:null==u?void 0:u.status,networkRequest:c,start:h,end:d,url:a.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(t,e){return o.apply(this,arguments)}}());return()=>{r()}}(o,e,n)),Qp=()=>{s=!1,null==l||l(),u(),c(),Qp=null},Qp}const Kp=t=>({name:"rrweb/network@1",observer:Zp,options:t});var Yp,Xp,tg,eg,ig,ng,sg,rg,og,lg,ag,ug,cg,hg,dg;h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:yp,getRecordNetworkPlugin:Kp},h.__PosthogExtensions__.rrweb={record:ip,version:"v2",wasMaxDepthReached:()=>uv,resetMaxDepthState(){uv=!1,av=!1},getLastSnapshotCost:()=>Bh,getMutationCost:()=>ue({},Vh),getObserverInitFailures:()=>af.size?Array.from(af):void 0,resetSnapshotCostState(){Dh=0,Nh=0,jh=0,Oh=0,qh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},Bh=null,zh=null,Uh=[],Hh=0,Wh=0,Vh={slowestBatchMs:0},Gh={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},h.rrweb={record:ip,version:"v2"},h.rrwebConsoleRecord={getRecordConsolePlugin:yp},h.getRecordNetworkPlugin=Kp,h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initSessionRecording=(t,e)=>new Qc(t,e),h.__PosthogExtensions__.initSessionRecording.supportsSelectMasking=!0;var vg={},fg=[],pg=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,gg=Array.isArray;function mg(t,e){for(var i in e)t[i]=e[i];return t}function yg(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function bg(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?Yp.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 _g(t,o,n,s,null)}function _g(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?++tg:s,__i:-1,__u:0};return null==s&&null!=Xp.vnode&&Xp.vnode(r),r}function wg(t){return t.children}function kg(t,e){this.props=t,this.context=e}function Sg(t,e){if(null==e)return t.__?Sg(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?Sg(t):null}function xg(t){if(t.__P&&t.__d){var e=t.__v,i=e.__e,n=[],s=[],r=mg({},e);r.__v=e.__v+1,Xp.vnode&&Xp.vnode(r),Pg(t.__P,r,e,t.__n,t.__P.namespaceURI,32&e.__u?[i]:null,n,null==i?Sg(e):i,!!(32&e.__u),s),r.__v=e.__v,r.__.__k[r.__i]=r,Lg(n,r,s),e.__e=e.__=null,r.__e!=i&&$g(r)}}function $g(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}),$g(t)}function Tg(t){(!t.__d&&(t.__d=!0)&&eg.push(t)&&!Cg.__r++||ig!=Xp.debounceRendering)&&((ig=Xp.debounceRendering)||ng)(Cg)}function Cg(){try{for(var t,e=1;eg.length;)eg.length>e&&eg.sort(sg),t=eg.shift(),e=eg.length,xg(t)}finally{eg.length=Cg.__r=0}}function Eg(t,e,i,n,s,r,o,l,a,u,c){var h,d,v,f,p,g,m,y=n&&n.__k||fg,b=e.length;for(a=function(t,e,i,n,s){var r,o,l,a,u,c=i.length,h=c,d=0;for(t.__k=new Array(s),r=0;s>r;r++)null!=(o=e[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=t.__k[r]=_g(null,o,null,null,null):gg(o)?o=t.__k[r]=_g(wg,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=t.__k[r]=_g(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=Ig(o,i,a,h))&&(h--,(l=i[u])&&(l.__u|=2)),null==l||null==l.__v?(-1==u&&(s>c?d--:c>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(h)for(r=0;c>r;r++)null!=(l=i[r])&&!(2&l.__u)&&(l.__e==n&&(n=Sg(l)),jg(l,l));return n}(i,e,y,a,b),h=0;b>h;h++)null!=(v=i.__k[h])&&(d=-1!=v.__i&&y[v.__i]||vg,v.__i=h,g=Pg(t,v,d,s,r,o,l,a,u,c),f=v.__e,v.ref&&d.ref!=v.ref&&(d.ref&&Ng(d.ref,null,v),c.push(v.ref,v.__c||f,v)),null==p&&null!=f&&(p=f),(m=!!(4&v.__u))||d.__k===v.__k?(a=Mg(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 Mg(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=Mg(s[r],e,i,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=Sg(t)),i.insertBefore(t.__e,e||null)),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function Ig(t,e,i,n){var s,r,o,l=t.key,a=t.type,u=e[i],c=null!=u&&!(2&u.__u);if(null===u&&null==l||c&&l==u.key&&a==u.type)return i;if(n>(c?1:0))for(s=i-1,r=i+1;s>=0||e.length>r;)if(null!=(u=e[o=0>s?r++:s--])&&!(2&u.__u)&&l==u.key&&a==u.type)return o;return-1}function Rg(t,e,i){"-"==e[0]?t.setProperty(e,null==i?"":i):t[e]=null==i?"":"number"!=typeof i||pg.test(e)?i:i+"px"}function Ag(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||Rg(t.style,e,"");if(i)for(e in i)n&&i[e]==n[e]||Rg(t.style,e,i[e])}else if("o"==e[0]&&"n"==e[1])r=e!=(e=e.replace(ag,"$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[lg]=n[lg]:(i[lg]=ug,t.addEventListener(e,r?hg:cg,r)):t.removeEventListener(e,r?hg:cg,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 Og(t){return function(e){if(this.l){var i=this.l[e.type+t];if(null==e[og])e[og]=ug++;else if(i[lg]>e[og])return;return i(Xp.event?Xp.event(e):e)}}}function Pg(t,e,i,n,s,r,o,l,a,u){var c,h,d,v,f,p,g,m,y,b,$,_,w,k,S,x,T=e.type;if(void 0!==e.constructor)return null;128&i.__u&&(a=!!(32&i.__u),r=[l=e.__e=i.__e]),(c=Xp.__b)&&c(e);t:if("function"==typeof T){h=o.length;try{if(y=e.props,b=T.prototype&&T.prototype.render,$=(c=T.contextType)&&n[c.__c],_=c?$?$.props.value:c.__:n,i.__c?m=(d=e.__c=i.__c).__=d.__E:(b?e.__c=d=new T(y,_):(e.__c=d=new kg(y,_),d.constructor=T,d.render=qg),$&&$.sub(d),d.state||(d.state={}),d.__n=n,v=d.__d=!0,d.__h=[],d._sb=[]),b&&null==d.__s&&(d.__s=d.state),b&&null!=T.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=mg({},d.__s)),mg(d.__s,T.getDerivedStateFromProps(y,d.__s))),f=d.props,p=d.state,d.__v=e,v)b&&null==T.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),b&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(b&&null==T.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,_),e.__v==i.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,_)){e.__v!=i.__v&&(d.props=y,d.state=d.__s,d.__d=!1),e.__e=i.__e,e.__k=i.__k,e.__k.some(function(t){t&&(t.__=e)}),fg.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break t}null!=d.componentWillUpdate&&d.componentWillUpdate(y,d.__s,_),b&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(f,p,g)})}if(d.context=_,d.props=y,d.__P=t,d.__e=!1,w=Xp.__r,k=0,b)d.state=d.__s,d.__d=!1,w&&w(e),c=d.render(d.props,d.state,d.context),fg.push.apply(d.__h,d._sb),d._sb=[];else do{d.__d=!1,w&&w(e),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&25>++k);d.state=d.__s,null!=d.getChildContext&&(n=mg(mg({},n),d.getChildContext())),b&&!v&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(f,p)),S=null!=c&&c.type===wg&&null==c.key?Dg(c.props.children):c,l=Eg(t,gg(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=h,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--;)yg(r[x]);Fg(e)}else e.__e=i.__e,!e.__k&&i.__k&&(e.__k=i.__k),t.then||Fg(e);Xp.__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,c,h,d,v,f,p,g=i.props||vg,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&&(Xp.__m&&Xp.__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&&Yp.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?h=v:"children"==u||u in m||"value"==u&&"defaultValue"in m||"checked"==u&&"defaultChecked"in m||Ag(t,u,null,v,s);for(u in m)v=m[u],"children"==u?d=v:"dangerouslySetInnerHTML"==u?c=v:"value"==u?f=v:"checked"==u?p=v:l&&"function"!=typeof v||g[u]===v||Ag(t,u,v,g[u],s);if(c)l||h&&(c.__html==h.__html||c.__html==t.innerHTML)||(t.innerHTML=c.__html),e.__k=[];else if(h&&(t.innerHTML=""),Eg("template"==e.type?t.content:t,gg(d)?d:[d],e,i,n,"foreignObject"==y?"http://www.w3.org/1999/xhtml":s,r,o,r?r[0]:i.__k&&Sg(i,0),l,a),null!=r)for(u=r.length;u--;)yg(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])&&Ag(t,u,f,g[u],s),u="checked",null!=p&&p!=t[u]&&Ag(t,u,p,g[u],s))}return t}(i.__e,e,i,n,s,r,o,a,u);return(c=Xp.diffed)&&c(e),128&e.__u?void 0:l}function Fg(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(Fg))}function Lg(t,e,i){for(var n=0;i.length>n;n++)Ng(i[n],i[++n],i[++n]);Xp.__c&&Xp.__c(e,t),t.some(function(e){try{t=e.__h,e.__h=[],t.some(function(t){t.call(e)})}catch(t){Xp.__e(t,e.__v)}})}function Dg(t){return"object"!=typeof t||null==t||t.__b>0?t:gg(t)?t.map(Dg):void 0!==t.constructor?null:mg({},t)}function Ng(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){Xp.__e(t,i)}}function jg(t,e,i){var n,s;if(Xp.unmount&&Xp.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Ng(n,null,e)),null!=(n=t.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(t){Xp.__e(t,e)}n.base=n.__P=n.__n=null}if(n=t.__k)for(s=0;n.length>s;s++)n[s]&&jg(n[s],e,i||"function"!=typeof t.type);i||yg(t.__e),t.__c=t.__=t.__e=void 0}function qg(t,e,i){return this.constructor(t,i)}function Bg(t,e,i){var n,s,r,o;e==document&&(e=document.documentElement),Xp.__&&Xp.__(t,e),s=(n="function"==typeof i)?null:i&&i.__k||e.__k,r=[],o=[],Pg(e,t=(!n&&i||e).__k=bg(wg,null,[t]),s||vg,vg,e.namespaceURI,!n&&i?[i]:s?null:e.firstChild?Yp.call(e.childNodes):null,r,!n&&i?i:s?s.__e:e.firstChild,n,o),Lg(r,t,o),t.props.children=null}Yp=fg.slice,Xp={__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}},tg=0,kg.prototype.setState=function(t,e){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=mg({},this.state);"function"==typeof t&&(t=t(mg({},i),this.props)),t&&mg(i,t),null!=t&&this.__v&&(e&&this._sb.push(e),Tg(this))},kg.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Tg(this))},kg.prototype.render=wg,eg=[],ng="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,sg=function(t,e){return t.__v.__b-e.__v.__b},Cg.__r=0,rg=Math.random().toString(8),og="__d"+rg,lg="__a"+rg,ag=/(PointerCapture)$|Capture$/i,ug=0,cg=Og(!1),hg=Og(!0),dg=0;var zg=0;function Ug(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:--zg,__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 Xp.vnode&&Xp.vnode(u),u}const Hg="featureFlagsCommon";function Wg({client:t,config:e}){var i;if(!t||!e.uiHost)return;const n=null===(i=t.session)||void 0===i?void 0:i.sessionId;return n?`${e.uiHost}/project/${t.projectToken}/replay/${n}`:void 0}var Vg,Gg,Jg,Qg,Zg=0,Kg=[],Yg=Xp,Xg=Yg.__b,tm=Yg.__r,em=Yg.diffed,im=Yg.__c,nm=Yg.unmount,sm=Yg.__;function rm(t,e){Yg.__h&&Yg.__h(Gg,t,Zg||e),Zg=0;var i=Gg.__H||(Gg.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function om(t){return Zg=1,function(t,e){var i=rm(Vg++,2);if(i.t=t,!i.__c&&(i.__=[mm(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=Gg,!Gg.__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};Gg.__f=!0;var s=Gg.shouldComponentUpdate,r=Gg.componentWillUpdate;Gg.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)},Gg.shouldComponentUpdate=n}return i.__N||i.__}(mm,t)}function lm(t,e){var i=rm(Vg++,3);!Yg.__s&&gm(i.__H,e)&&(i.__=t,i.u=e,Gg.__H.__h.push(i))}function am(t){return Zg=5,um(function(){return{current:t}},[])}function um(t,e){var i=rm(Vg++,7);return gm(i.__H,e)&&(i.__=t(),i.__H=e,i.__h=t),i.__}function cm(t){var e=Gg.context[t.__c],i=rm(Vg++,9);return i.c=t,e?(null==i.__&&(i.__=!0,e.sub(Gg)),e.props.value):t.__}function hm(){for(var t;t=Kg.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(fm),e.__h.some(pm),e.__h=[]}catch(i){e.__h=[],Yg.__e(i,t.__v)}}}Yg.__b=function(t){Gg=null,Xg&&Xg(t)},Yg.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),sm&&sm(t,e)},Yg.__r=function(t){tm&&tm(t),Vg=0;var e=(Gg=t.__c).__H;e&&(Jg===Gg?(e.__h=[],Gg.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.length&&hm(),Vg=0)),Jg=Gg},Yg.diffed=function(t){em&&em(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==Kg.push(e)&&Qg===Yg.requestAnimationFrame||((Qg=Yg.requestAnimationFrame)||vm)(hm)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),Jg=Gg=null},Yg.__c=function(t,e){e.some(function(t){try{t.__h.some(fm),t.__h=t.__h.filter(function(t){return!t.__||pm(t)})}catch(i){e.some(function(t){t.__h&&(t.__h=[])}),e=[],Yg.__e(i,t.__v)}}),im&&im(t,e)},Yg.unmount=function(t){nm&&nm(t);var e,i=t.__c;i&&i.__H&&(i.__H.__.some(function(t){try{fm(t)}catch(t){e=t}}),i.__H=void 0,e&&Yg.__e(e,i.__v))};var dm="function"==typeof requestAnimationFrame;function vm(t){var e,i=function(){clearTimeout(n),dm&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(i,35);dm&&(e=requestAnimationFrame(i))}function fm(t){var e=Gg,i=t.__c;"function"==typeof i&&(t.__c=void 0,i()),Gg=e}function pm(t){var e=Gg;t.__c=t.__(),Gg=e}function gm(t,e){return!t||t.length!==e.length||e.some(function(e,i){return e!==t[i]})}function mm(t,e){return"function"==typeof e?e(t):e}const ym={Activation:"events",Cancellation:"cancelEvents"},bm={Button:"button",Tab:"tab",Selector:"selector"},_m={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"},wm={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},km={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Sm={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},xm={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},$m={Once:"once",Recurring:"recurring",Always:"always"},Tm={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Cm={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"},Em={Popover:"popover",Inline:"inline"},Mm=Hr("[Surveys]"),Im="PostHog is not capturing, so a survey response cannot be recorded";function Rm(t){return!(!t.start_date||t.end_date)}function Am(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 Om=(t,e)=>`${t}${function(t){return t.current_iteration&&t.current_iteration>0?`${t.id}_${t.current_iteration}`:t.id}(e)}`,Pm=t=>Om("seenSurvey_",t),Fm=t=>{try{const e=Pm(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){Mm.error("Failed to persist survey seen state",t)}},Lm=[km.Popover,km.Widget,km.API],Dm={ignoreConditions:!1,ignoreDelay:!1,displayType:Em.Popover};function Nm(t,e){this.v=t,this.k=e}function jm(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);e>i;i++)n[i]=t[i];return n}function qm(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,s,r,o,l=[],a=!0,u=!1;try{if(r=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;a=!1}else for(;!(a=(n=r.call(i)).done)&&(l.push(n.value),l.length!==e);a=!0);}catch(t){u=!0,s=t}finally{try{if(!a&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return jm(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?jm(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Bm(t){var e,i;function n(e,i){try{var r=t[e](i),o=r.value,l=o instanceof Nm;Promise.resolve(l?o.v:o).then(function(i){if(l){var a="return"===e&&o.k?e:"next";if(!o.k||i.done)return n(a,i);i=t[a](i).value}s(!!r.done,i)},function(t){n("throw",t)})}catch(t){s(2,t)}}function s(t,s){2===t?e.reject(s):e.resolve({value:s,done:t}),(e=e.next)?n(e.key,e.arg):i=null}this._invoke=function(t,s){return new Promise(function(r,o){var l={key:t,arg:s,resolve:r,reject:o,next:null};i?i=i.next=l:(e=i=l,n(t,s))})},"function"!=typeof t.return&&(this.return=void 0)}Bm.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Bm.prototype.next=function(t){return this._invoke("next",t)},Bm.prototype.throw=function(t){return this._invoke("throw",t)},Bm.prototype.return=function(t){return this._invoke("return",t)};const zm=Object.entries,Um=Object.keys,Hm=Object.setPrototypeOf,Wm=Object.isFrozen,Vm=Object.getPrototypeOf,Gm=Object.getOwnPropertyDescriptor;let Jm=Object.freeze,Qm=Object.seal,Zm=Object.create,Km="undefined"!=typeof Reflect&&Reflect,Ym=Km.apply,Xm=Km.construct;Jm||(Jm=function(t){return t}),Qm||(Qm=function(t){return t}),Ym||(Ym=function(t,e){for(var i=arguments.length,n=new Array(i>2?i-2:0),s=2;i>s;s++)n[s-2]=arguments[s];return t.apply(e,n)}),Xm||(Xm=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;e>n;n++)i[n-1]=arguments[n];return new t(...i)});const ty=$y([].forEach),ey=$y([].lastIndexOf),iy=$y([].pop),ny=$y([].push),sy=$y([].slice),ry=$y([].splice),oy=Array.isArray,ly=Ty(Set),ay=$y(Set.prototype.add),uy=$y(Set.prototype.has),cy=$y("".toLowerCase),hy=$y("".toString),dy=$y("".match),vy=$y("".replace),fy=$y("".indexOf),py=$y("".trim),gy=$y((0).toString),my=$y(Boolean.prototype.toString),yy="undefined"==typeof BigInt?null:$y(BigInt.prototype.toString),by="undefined"==typeof Symbol?null:$y(Symbol.prototype.toString),_y=$y({}.hasOwnProperty),wy=$y({}.toString),ky=/t/.test,Sy=function(t,e){return t instanceof RegExp&&(t.lastIndex=0),Ym(ky,t,[e])},xy=Ty(TypeError);function $y(t){return function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),s=1;i>s;s++)n[s-1]=arguments[s];return Ym(t,e,n)}}function Ty(t){return function(){for(var e=arguments.length,i=new Array(e),n=0;e>n;n++)i[n]=arguments[n];return Xm(t,i)}}function Cy(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:cy;if(Hm&&Hm(t,null),!oy(e))return t;let n=e.length;for(;n--;){let s=e[n];if("string"==typeof s){const t=i(s);t!==s&&(Wm(e)||(e[n]=t),s=t)}t[s]=!0}return t}function Ey(t){for(let e=0;t.length>e;e++)_y(t,e)||(t[e]=null);return t}function My(t){const e=Zm(null);for(const n of zm(t)){var i=qm(n,2);const s=i[0],r=i[1];_y(t,s)&&(e[s]=oy(r)?Ey(r):r&&"object"==typeof r&&r.constructor===Object?My(r):r)}return e}function Iy(t){const e=Zm(null),i=Um(t);let n=i.length;for(;n--;)e[i[n]]=t[i[n]];return e}function Ry(t,e){for(;null!==t;){const i=Gm(t,e);if(i){if(i.get)return $y(i.get);if("function"==typeof i.value)return $y(i.value)}t=Vm(t)}return function(){return null}}const Ay=Jm(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Oy=Jm(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Py=Jm(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Fy=Jm(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ly=Jm(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Dy=Jm(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ny=Jm(["#text"]),jy=Jm(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),qy=Jm(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),By=Jm(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),zy=Jm(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Uy=Qm(/{{[\w\W]*|^[\w\W]*}}/g),Hy=Qm(/<%[\w\W]*|^[\w\W]*%>/g),Wy=Qm(/\${[\w\W]*/g),Vy=Qm(/{{|}}|\${|<%|%>|&lt;%|%&gt;/),Gy=Qm(/^data-[\-\w.\u00B7-\uFFFF]+$/),Jy=Qm(/^aria-[\-\w]+$/),Qy=Qm(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Zy=Qm(/^(?:\w+script|data):/i),Ky=Qm(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Yy=Qm(/^html$/i),Xy=Qm(/^[a-z][.\w]*(-[.\w]+)+$/i),tb=Qm(/<[/\w!]/g),eb=Qm(/<[/\w]/g),ib=Qm(/<\/no(script|embed|frames)/i),nb=Qm(/\/>/i),sb=Qm(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i),rb=Qm(/^[\r\n\t ]+/),ob=Jm(Cy({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),lb=function(){return"undefined"==typeof window?null:window},ab=function(t,e,i,n){return _y(t,e)&&oy(t[e])?Cy(n.base?Iy(n.base):{},t[e],n.transform):i},ub=function(t,e,i){const n=_y(t,e)?t[e]:void 0;return n&&"object"==typeof n?My(n):i};var cb=function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:lb();const i=e=>t(e);if(i.version="3.4.18",i.removed=[],!e||!e.document||9!==e.document.nodeType||!e.Element)return i.isSupported=!1,i;let n=e.document;const s=n,r=s.currentScript,o=e.HTMLTemplateElement,l=e.Node,a=e.NodeFilter,u=e.DOMParser,c=e.trustedTypes,h=e.Element.prototype,d=Ry(h,"cloneNode"),v=Ry(h,"remove"),f=Ry(h,"removeAttributeNode"),p=Ry(h,"nextSibling"),g=Ry(h,"childNodes"),m=Ry(h,"parentNode"),y=Ry(h,"shadowRoot"),b=Ry(h,"attributes"),_=l&&l.prototype?Ry(l.prototype,"nodeType"):null,w=l&&l.prototype?Ry(l.prototype,"nodeName"):null,k=l&&l.prototype?Ry(l.prototype,"ownerDocument"):null,S=function(t){return _?_(t):t.nodeType},x=function(t){return w?w(t):t.nodeName},T=function(t){for(;null!==t;){const e=Gm(t,"namespaceURI");if(e)return e.get?$y(e.get):null;t=Vm(t)}return null}(h),C=function(t){return T?T(t):t.namespaceURI};if("function"==typeof o){const t=n.createElement("template");t.content&&t.content.ownerDocument&&(n=t.content.ownerDocument)}let E,M,I="",R=!1,A=0;const O=function(){if(A>0)throw xy('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},P=function(t){O(),A++;try{return E.createHTML(t)}finally{A--}},F=function(t){return E&&yt?P(t):t},L=n.implementation,D=n.createNodeIterator,N=n.createDocumentFragment,j=n.getElementsByTagName,q=s.importNode;let B={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};i.isSupported="function"==typeof zm&&"function"==typeof m&&L&&void 0!==L.createHTMLDocument;const z=Uy,U=Hy,H=Wy,W=Gy,V=Jy,G=Zy,J=Ky,Q=Xy;let Z=Qy,K=null;const Y=Cy({},[...Ay,...Oy,...Py,...Ly,...Ny]);let X=null;const tt=Cy({},[...jy,...qy,...By,...zy]);let et=null,it=null,nt=null;const st=Object.seal(Zm(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let rt=!0,ot=!0,lt=!1,at=!0,ut=!1,ct=!0,ht=!1,dt=!1,vt=null,ft=null,pt=!1,gt=!1,mt=!1,yt=!1,bt=!0,_t=!1;const wt="user-content-";let kt=!0,St=!1,xt=null,$t=!1,Tt=null;const Ct=Cy({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Et=null;const Mt=Cy({},["audio","video","img","source","image","track"]);let It=null;const Rt=Cy({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),At="http://www.w3.org/1998/Math/MathML",Ot="http://www.w3.org/2000/svg",Pt="http://www.w3.org/1999/xhtml";let Ft=Pt,Lt=!1,Dt=null;const Nt=Cy({},[At,Ot,Pt],hy),jt=Jm(Cy({},["mi","mo","mn","ms","mtext"]));let qt=null;const Bt=Jm(Cy({},["annotation-xml"]));let zt=null;const Ut=Jm(Zm(null)),Ht=Cy({},["title","style","font","a","script"]);let Wt=null;const Vt=["application/xhtml+xml","text/html"];let Gt=null,Jt=null;const Qt=n.createElement("form"),Zt=function(t){return t instanceof RegExp||t instanceof Function},Kt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t&&"object"==typeof t||(t={}),t=My(t),Wt=-1===Vt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Gt="application/xhtml+xml"===Wt?hy:cy,K=ab(t,"ALLOWED_TAGS",Y,{transform:Gt}),X=ab(t,"ALLOWED_ATTR",tt,{transform:Gt}),Dt=ab(t,"ALLOWED_NAMESPACES",Nt,{transform:hy}),It=ab(t,"ADD_URI_SAFE_ATTR",Rt,{transform:Gt,base:Rt}),Et=ab(t,"ADD_DATA_URI_TAGS",Mt,{transform:Gt,base:Mt}),Tt=ab(t,"FORBID_CONTENTS",Ct,{transform:Gt}),it=ab(t,"FORBID_TAGS",Zm(null),{transform:Gt}),nt=ab(t,"FORBID_ATTR",Zm(null),{transform:Gt}),$t=!!_y(t,"USE_PROFILES")&&(t.USE_PROFILES&&"object"==typeof t.USE_PROFILES?My(t.USE_PROFILES):t.USE_PROFILES),rt=!1!==t.ALLOW_ARIA_ATTR,ot=!1!==t.ALLOW_DATA_ATTR,lt=t.ALLOW_UNKNOWN_PROTOCOLS||!1,at=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,ut=t.SAFE_FOR_TEMPLATES||!1,ct=!1!==t.SAFE_FOR_XML,ht=t.WHOLE_DOCUMENT||!1,gt=t.RETURN_DOM||!1,mt=t.RETURN_DOM_FRAGMENT||!1,yt=t.RETURN_TRUSTED_TYPE||!1,pt=t.FORCE_BODY||!1,bt=!1!==t.SANITIZE_DOM,_t=t.SANITIZE_NAMED_PROPS||!1,kt=!1!==t.KEEP_CONTENT,St=t.IN_PLACE||!1,Z=function(t){if(!t)return!1;try{return Sy(t,""),!0}catch(t){return!1}}(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:Qy,Ft="string"==typeof t.NAMESPACE?t.NAMESPACE:Pt,qt=ub(t,"MATHML_TEXT_INTEGRATION_POINTS",jt),zt=ub(t,"HTML_INTEGRATION_POINTS",Bt);const e=ub(t,"CUSTOM_ELEMENT_HANDLING",Ut);if(et=Zm(null),_y(e,"tagNameCheck")&&Zt(e.tagNameCheck)&&(et.tagNameCheck=e.tagNameCheck),_y(e,"attributeNameCheck")&&Zt(e.attributeNameCheck)&&(et.attributeNameCheck=e.attributeNameCheck),_y(e,"allowCustomizedBuiltInElements")&&"boolean"==typeof e.allowCustomizedBuiltInElements&&(et.allowCustomizedBuiltInElements=e.allowCustomizedBuiltInElements),Qm(et),ut&&(ot=!1),mt&&(gt=!0),$t&&((_y(t,"ALLOWED_TAGS")||_y(t,"ALLOWED_ATTR"))&&"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("DOMPurify: USE_PROFILES overrides ALLOWED_TAGS and ALLOWED_ATTR. Do not use these options together."),K=Cy({},Ny),X=Zm(null),!0===$t.html&&(Cy(K,Ay),Cy(X,jy)),!0===$t.svg&&(Cy(K,Oy),Cy(X,qy),Cy(X,zy)),!0===$t.svgFilters&&(Cy(K,Py),Cy(X,qy),Cy(X,zy)),!0===$t.mathMl&&(Cy(K,Ly),Cy(X,By),Cy(X,zy))),st.tagCheck=null,st.attributeCheck=null,_y(t,"ADD_TAGS")&&("function"==typeof t.ADD_TAGS?st.tagCheck=t.ADD_TAGS:oy(t.ADD_TAGS)&&(K===Y&&(K=Iy(K)),Cy(K,t.ADD_TAGS,Gt))),_y(t,"ADD_ATTR")&&("function"==typeof t.ADD_ATTR?st.attributeCheck=t.ADD_ATTR:oy(t.ADD_ATTR)&&(X===tt&&(X=Iy(X)),Cy(X,t.ADD_ATTR,Gt))),_y(t,"ADD_FORBID_CONTENTS")&&oy(t.ADD_FORBID_CONTENTS)&&(Tt===Ct&&(Tt=Iy(Tt)),Cy(Tt,t.ADD_FORBID_CONTENTS,Gt)),kt&&(K["#text"]=!0),ht&&Cy(K,["html","head","body"]),K.table&&(K.tbody=!0,delete it.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw xy('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw xy('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const e=E;E=t.TRUSTED_TYPES_POLICY;try{I=P("")}catch(t){throw E=e,t}}else null===t.TRUSTED_TYPES_POLICY?(E=void 0,I=""):(void 0===E&&(R||(M=function(t,e){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let i=null;const n="data-tt-policy-suffix";e&&e.hasAttribute(n)&&(i=e.getAttribute(n));const s="dompurify"+(i?"#"+i:"");try{return t.createPolicy(s,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+s+" could not be created."),null}}(c,r),R=!0),E=M),E&&"string"==typeof I&&(I=P("")));Jt=Jm(t)},Yt=Cy({},[...Oy,...Py,...Fy]),Xt=Cy({},[...Ly,...Dy]),te=function(t){ny(i.removed,{element:t});try{m(t).removeChild(t)}catch(e){if(v(t),!m(t))throw xy("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},ee=function(t,e,i){try{f(t,e)}catch(e){try{t.removeAttribute(i)}catch(t){}}},ie=function(t){oe(t);const e=g(t);e&&ty(sy(e),t=>{try{v(t)}catch(t){}}),1===S(t)&&se(t,!1)},ne=function(t,e,n){if(!n)try{n=e.getAttributeNode(t)}catch(t){n=null}if(ny(i.removed,{attribute:n||null,from:e}),n)ee(e,n,t);else try{e.removeAttribute(t)}catch(t){}if("is"===t)if(gt||mt)try{te(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},se=function(t,e){const i=b(t);if(i)for(let n=i.length-1;n>=0;--n){const s=i[n],r=s&&s.name;"string"!=typeof r||e&&X[Gt(r)]||ee(t,s,r)}},re=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=[t];for(;n.length>0;){const t=n.pop();if(!1===e(t))continue;if(i&&1===S(t)){const e=y(t);ye(e)&&n.push(e)}const s=g(t);if(s)for(let t=s.length-1;t>=0;--t)n.push(s[t])}},oe=function(t){re(t,t=>{1===S(t)&&se(t,!0)})},le=function(t){const e=[];return re(t,t=>{e.push(t)},!0),e},ae=function(t,e){let n=!1;return ty(i.removed,e=>{e.element&&(n=n||e.element===t,oe(e.element))}),function(t,e){const i=ly();ty(le(t),t=>{1===S(t)&&ay(i,t)}),ty(e,t=>{1!==S(t)||uy(i,t)||se(t,!0)})}(t,e),n},ue=function(t,e,i,n){const s=de(t);let r;for(;r=s.nextNode();)uy(n,r)&&!uy(xt,r)&&(e&&_e(B.uponSanitizeShadowNode,r,null),Re(r,i))},ce=function(t,e){return!!ct&&("patchsrc"===t||"for"===t&&"label"!==e&&"output"!==e)},he=function(t){let e=null,i=null;if(pt)t="<remove></remove>"+t;else{const e=dy(t,rb);i=e&&e[0]}"application/xhtml+xml"===Wt&&Ft===Pt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const s=E?P(t):t;if(Ft===Pt)try{e=(new u).parseFromString(s,Wt)}catch(t){}if(!e||!e.documentElement){e=L.createDocument(Ft,"template",null);try{e.documentElement.innerHTML=Lt?I:s}catch(t){}}const r=e.body||e.documentElement;return t&&i&&r.insertBefore(n.createTextNode(i),r.childNodes[0]||null),Ft===Pt?j.call(e,ht?"html":"body")[0]:ht?e.documentElement:r},de=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=k?k(t):t.ownerDocument;return D.call(i||t,t,(e?0:a.SHOW_ELEMENT)|a.SHOW_COMMENT|a.SHOW_TEXT|a.SHOW_PROCESSING_INSTRUCTION|a.SHOW_CDATA_SECTION,null)},ve=function(t){return t=vy(t,z," "),t=vy(t,U," "),vy(t,H," ")},fe=function(t){var e;pe(t);const i=null===(e=t.querySelectorAll)||void 0===e?void 0:e.call(t,"template");i&&ty(i,t=>{ye(t.content)&&fe(t.content)})},pe=function(t){t.normalize();const e=de(t,!0);let i=e.nextNode();for(;i;)i.data=ve(i.data),i=e.nextNode()},ge=function(t){const e=w?w(t):null;return"string"==typeof e&&"form"===Gt(e)&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||t.attributes!==b(t)||"function"!=typeof t.removeAttribute||"function"!=typeof t.removeAttributeNode||"function"!=typeof t.getAttributeNode||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes||t.nodeType!==_(t)||t.childNodes!==g(t))},me=function(t){if(!_||"object"!=typeof t||null===t)return null;try{const e=_(t);return"number"==typeof e?e:null}catch(t){return null}},ye=function(t){return 11===me(t)},be=function(t){return null!==me(t)};function _e(t,e,n){0!==t.length&&ty(t,t=>{t.call(i,e,n,Jt)})}const we=function(t,e){if(t instanceof RegExp)return Sy(t,e);if(t instanceof Function){for(var i=arguments.length,n=new Array(i>2?i-2:0),s=2;i>s;s++)n[s-2]=arguments[s];return Boolean(t(e,...n))}return!1},ke=function(t,e,i,n){return 0===t.length?e:e===i||e===n?Iy(e):e},Se=function(t,e){return t!==e&&null===m(t)&&(St&&oe(t),!0)},xe=function(t,e){if(xt&&ay(xt,t),_e(B.beforeSanitizeElements,t,null),Se(t,e))return!0;if(ge(t))return te(t),!0;const n=Gt(x(t)),s=S(t);if(K=ke(B.uponSanitizeElement,K,Y,vt),_e(B.uponSanitizeElement,t,{tagName:n,allowedTags:K}),Se(t,e))return!0;if(function(t,e,i){return!!(ct&&1===i&&t.hasChildNodes()&&!be(t.firstElementChild)&&Sy(tb,t.textContent)&&Sy(tb,t.innerHTML))||!!(ct&&ob[e]&&1===i&&C(t)===Pt&&(be(t.firstElementChild)||"string"==typeof t.textContent&&Sy(tb,t.textContent)))||7===i||!(!ct||8!==i||!Sy(eb,t.data))}(t,n,s))return te(t),!0;if(it[n]||!(st.tagCheck instanceof Function&&st.tagCheck(n))&&!K[n]){const i=function(t,e,i){if(!it[e]&&Ce(e)&&we(et.tagNameCheck,e))return!1;if(kt&&!Tt[e]&&!Tt[cy(e)]){const e=m(t),n=g(t);if(n&&e)for(let s=n.length-1;s>=0;--s){const r=t===i?d(n[s],!0):n[s];e.insertBefore(r,p(t))}}return te(t),!0}(t,n,e);return!(!1!==i||(_e(B.afterSanitizeElements,t,null),!Se(t,e)))||i}if(1===s&&!function(t){const e=C(t),i=cy(x(t)),n=m(t);let s=Ft,r="template";return n&&1===S(n)&&(s=C(n),r=cy(x(n))),!!Dt[e]&&(e===Ot?function(t,e,i){return e===Pt?"svg"===t:e===At?"svg"===t&&("annotation-xml"===i||qt[i]):Boolean(Yt[t])}(i,s,r):e===At?function(t,e,i){return e===Pt?"math"===t:e===Ot?"math"===t&&zt[i]:Boolean(Xt[t])}(i,s,r):e===Pt?function(t,e,i){return!(e===Ot&&!zt[i])&&!(e===At&&!qt[i])&&!Xt[t]&&(Ht[t]||!Yt[t])}(i,s,r):"application/xhtml+xml"===Wt)}(t))return te(t),!0;if(("noscript"===n||"noembed"===n||"noframes"===n)&&Sy(ib,t.innerHTML))return te(t),!0;if(ut&&3===s){const e=t.textContent,n=ve(e);e!==n&&(ny(i.removed,{element:t.cloneNode()}),t.textContent=n)}return _e(B.afterSanitizeElements,t,null),Se(t,e)},$e=function(t,e,i){if(nt[e])return!1;if(ce(e,t))return!1;if(bt&&("id"===e||"name"===e)&&(i in n||i in Qt))return!1;const s=X[e]||st.attributeCheck instanceof Function&&st.attributeCheck(e,t);if(ot&&Sy(W,e))return!0;if(rt&&Sy(V,e))return!0;if(!s)return Ce(t)&&we(et.tagNameCheck,t)&&we(et.attributeNameCheck,e,t)||"is"===e&&et.allowCustomizedBuiltInElements&&we(et.tagNameCheck,i);if(It[e])return!0;const r=vy(i,J,"");return!(!Sy(Z,r)&&("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==fy(i,"data:")||!Et[t])&&(!lt||Sy(G,r))&&i)},Te=Cy({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ce=function(t){return!Te[cy(t)]&&Sy(Q,t)},Ee=function(t,e,i,n){if(E&&"object"==typeof c&&"function"==typeof c.getAttributeType&&!i)switch(c.getAttributeType(t,e)){case"TrustedHTML":return P(n);case"TrustedScriptURL":return function(t){O(),A++;try{return E.createScriptURL(t)}finally{A--}}(n)}return n},Me=function(t,e,i,n){try{return i?t.setAttributeNS(i,e,n):t.setAttribute(e,n),!ge(t)||(te(t),!1)}catch(i){return ne(e,t),!1}},Ie=function(t,e){return!(!ct||!Sy(sb,e))||"attributename"===cy(t)&&-1!==fy(e,"href")},Re=function(t,e){xe(t,e),function(t,e){if(_e(B.beforeSanitizeAttributes,t,null),Se(t,e))return;const n=t.attributes;if(!n||ge(t))return;X=ke(B.uponSanitizeAttribute,X,tt,ft);const s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:X,forceKeepAttr:void 0};let r=n.length;const o=Gt(x(t));for(;r--;){const e=n[r],l=e.name,a=e.namespaceURI,u=e.value,c=Gt(l),h=u;let d="value"===l?h:py(h),v=!1;s.attrName=c,s.attrValue=d,s.keepAttr=!0,s.forceKeepAttr=void 0,_e(B.uponSanitizeAttribute,t,s),d=s.attrValue,!_t||"id"!==c&&"name"!==c||0===fy(d,wt)||(ne(l,t,e),d=wt+d,v=!0),Ie(l,d)?ne(l,t,e):s.forceKeepAttr||(!s.keepAttr||!at&&Sy(nb,d)?ne(l,t,e):(ut&&(d=ve(d)),$e(o,c,d)?(d=Ee(o,c,a,d),d!==h&&Me(t,l,a,d)&&v&&iy(i.removed)):ne(l,t,e)))}_e(B.afterSanitizeAttributes,t,null),Se(t,e)}(t,e),ye(t.content)&&Ae(t.content)},Ae=function(t){let e=null;const i=de(t);for(_e(B.beforeSanitizeShadowDOM,t,null);e=i.nextNode();)if(_e(B.uponSanitizeShadowNode,e,null),Re(e,t),1===S(e)){const t=y(e);ye(t)&&(Oe(t),Ae(t))}ut&&pe(t),_e(B.afterSanitizeShadowDOM,t,null)},Oe=function(t){const e=[{node:t,shadow:null}];for(;e.length>0;){const t=e.pop();if(t.shadow){Ae(t.shadow);continue}const i=t.node,n=1===S(i),s=g(i);if(s)for(let t=s.length-1;t>=0;--t)e.push({node:s[t],shadow:null});if(n){const t=w?w(i):null;if("string"==typeof t&&"template"===Gt(t)){const t=i.content;ye(t)&&e.push({node:t,shadow:null})}}if(n){const t=y(i);ye(t)&&e.push({node:null,shadow:t},{node:t,shadow:null})}}};return i.sanitize=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=null,o=null,l=null;if(Lt=!t,Lt&&(t="\x3c!--\x3e"),"string"!=typeof t&&!be(t)&&"string"!=typeof(t=function(t){switch(typeof t){case"string":return t;case"number":return gy(t);case"boolean":return my(t);case"bigint":return yy?yy(t):"0";case"symbol":return by?by(t):"Symbol()";case"undefined":default:return wy(t);case"function":case"object":{if(null===t)return wy(t);const e=t,i=Ry(e,"toString");if("function"==typeof i){const t=i(e);return"string"==typeof t?t:wy(t)}return wy(t)}}}(t)))throw xy("dirty is not a string, aborting");if(!i.isSupported)return t;dt?(K=vt,X=ft):Kt(e),i.removed=[];const a=St&&"string"!=typeof t&&be(t);let u=[];const c=xt;if(a){ct&&re(t,t=>{const e=S(t);if(7===e||8===e&&Sy(eb,t.data)){try{v(t)}catch(t){}return!1}if(1===e){const e=t,i=Gt(x(t));try{e.hasAttribute&&e.hasAttribute("patchsrc")&&e.removeAttribute("patchsrc"),e.hasAttribute&&e.hasAttribute("for")&&ce("for",i)&&e.removeAttribute("for")}catch(t){}}return!0});const e=x(t);if("string"==typeof e){const i=Gt(e);if(!K[i]||it[i])throw ie(t),xy("root node is forbidden and cannot be sanitized in-place")}if(ge(t))throw ie(t),xy("root node is clobbered and cannot be sanitized in-place");u=le(t),xt=ly()}else if(be(t))n=he("\x3c!----\x3e"),r=n.ownerDocument.importNode(t,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?n=r:n.appendChild(r),Oe(n);else{if(!gt&&!ut&&!ht&&-1===t.indexOf("<"))return F(t);if(n=he(t),!n)return gt?null:yt?I:""}n&&pt&&te(n.firstChild);const h=a?t:n;try{a&&Oe(t);const e=de(h);for(;o=e.nextNode();)Re(o,h);a&&function(t,e){const i=xt;let n=null;const s=()=>(n||(n=ly(),ty(e,t=>{ay(n,t)})),n);for(let e=0;;e++){const n=le(t),r=[t];let o=!1;if(ty(n,t=>{11===S(t)?ny(r,t):o||uy(i,t)||(o=uy(s(),t))}),!o)return;if(e>=8)throw xy("the tree kept changing during in-place sanitization; refusing to return it");ty(r,(e,i)=>{ue(e,i>0,t,s())})}}(t,u)}catch(e){throw a&&(ie(t),ae(t,u)),e}finally{xt=c}if(a){if(ae(t,u))throw xy("a node selected for removal could not be safely returned; refusing to sanitize in place");return ut&&fe(t),t}if(gt){if(ut&&fe(n),mt)for(l=N.call(n.ownerDocument);n.firstChild;)l.appendChild(n.firstChild);else l=n;return(X.shadowroot||X.shadowrootmode)&&(l=q.call(s,l,!0)),l}const d=()=>ht?n.outerHTML:n.innerHTML;let f=d();return ut&&Sy(Vy,f)&&(pe(n),f=d()),ht&&K["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&Sy(Yy,n.ownerDocument.doctype.name)&&(f="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+f),F(f)},i.setConfig=function(){Kt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),dt=!0,vt=K,ft=X},i.clearConfig=function(){Jt=null,dt=!1,vt=null,ft=null,E=M,I=""},i.isValidAttribute=function(t,e,i){Jt||Kt({});const n=Gt(t),s=Gt(e);return("string"!=typeof i||!(Ie(e,i)||!at&&Sy(nb,i)))&&$e(n,s,i)},i.addHook=function(t,e){"function"==typeof e&&_y(B,t)&&ny(B[t],e)},i.removeHook=function(t,e){if(_y(B,t)){if(void 0!==e){const i=ey(B[t],e);return-1===i?void 0:ry(B[t],i,1)[0]}return iy(B[t])}},i.removeHooks=function(t){_y(B,t)&&(B[t]=[])},i.removeAllHooks=function(){B={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},i}();const hb=["a","abbr","acronym","area","article","aside","b","bdi","bdo","blockquote","br","caption","center","cite","code","col","colgroup","data","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","footer","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","img","ins","kbd","li","map","mark","nav","ol","p","pre","q","rp","rt","rtc","ruby","s","samp","small","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","time","tr","tt","u","ul","var","wbr"],db=["style","lang","title","width","height"],vb=["abbr","align","axis","bgcolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"],fb={a:["href","hreflang","target","rel"],bdo:["dir"],blockquote:["cite"],col:["align","char","charoff","span"],colgroup:["align","char","charoff","span"],del:["cite","datetime"],hr:["align","size","width"],img:["align","alt","height","src","width"],ins:["cite","datetime"],ol:["start","type"],q:["cite"],table:["align","bgcolor","border","cellpadding","cellspacing","frame","rules","summary","width"],tbody:["align","char","charoff","valign"],td:vb,tfoot:["align","char","charoff","valign"],th:vb,thead:["align","char","charoff","valign"],tr:["align","bgcolor","char","charoff","valign"]};let pb;function gb(t){var e;const i=(null!==(e=pb)&&void 0!==e?e:pb=cb()).sanitize(t,{ALLOWED_TAGS:hb,ALLOWED_ATTR:[],ALLOW_ARIA_ATTR:!1,ALLOW_DATA_ATTR:!1,ALLOWED_NAMESPACES:["http://www.w3.org/1999/xhtml"],ADD_ATTR:(t,e)=>-1!==db.indexOf(t)||{}.hasOwnProperty.call(fb,e)&&-1!==(fb[e]||[]).indexOf(t),RETURN_DOM_FRAGMENT:!0}),n=i.querySelectorAll("a");for(let t=0;n.length>t;t++)n.item(t).relList.add("noopener");const s=document.createElement("div");return s.appendChild(i),s.innerHTML}const mb=Hr("[Stylesheet Loader]"),yb="#020617",bb={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:_m.Right,widgetType:bm.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,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:yb,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},_b=[_m.Center,_m.Left,_m.Right];function wb(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 kb(t=bb.backgroundColor){let e;"#"===t[0]&&(e=wb(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=wb(i)),!e)return yb;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?yb:"white"}return yb}const Sb=(t,e,i)=>{const n=zb(t),s=document.querySelector(`.${n}`);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};const r=document.createElement("div");((t,e,i)=>{const n=ue(ue({},bb),i),s=t.style,r=!_b.includes(n.position)||e===km.Widget&&(null==i?void 0:i.widgetType)===bm.Tab;var o;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)||kb(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",kb(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||kb(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),o=s,"white"===kb(n.backgroundColor)?o.setProperty("--ph-logo-mono","1"):o.removeProperty("--ph-logo-mono"),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",kb(n.widgetColor)),s.setProperty("--ph-widget-z-index",n.zIndex);const l=(null==i?void 0:i.inputBackground)||(null==i?void 0:i.inputBackgroundColor);let a=l||n.inputBackground;l||"white"!==n.backgroundColor||(a="#f8f8f8"),s.setProperty("--ph-survey-input-background",a);const u=(null==i?void 0:i.inputTextColor)||kb(a);s.setProperty("--ph-survey-input-text-color",u),s.setProperty("--ph-survey-rating-text-color",u),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||(mb.error("prepare_external_dependency_stylesheet returned null"),null)})(document,':host{--ph-survey-font-family:-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--ph-survey-box-padding:20px 24px;--ph-survey-max-width:300px;--ph-survey-z-index:calc(2147480000 + 3645);--ph-survey-border-color:#dcdcdc;--ph-survey-border-bottom:1.5px solid var(--ph-survey-border-color);--ph-survey-border-radius:10px;--ph-survey-background-color:#eeeded;--ph-survey-box-shadow:0 4px 12px #00000026;--ph-survey-submit-button-color:black;--ph-survey-submit-button-text-color:white;--ph-survey-rating-bg-color:white;--ph-survey-rating-text-color:#020617;--ph-survey-rating-active-bg-color:black;--ph-survey-rating-active-text-color:white;--ph-survey-text-primary-color:#020617;--ph-survey-text-subtle-color:#939393;--ph-widget-color:#e0a045;--ph-widget-text-color:white;--ph-survey-scrollbar-thumb-color:var(--ph-survey-border-color);--ph-survey-scrollbar-track-color:var(--ph-survey-background-color);--ph-survey-outline-color:#3b82f6cc;--ph-survey-input-background:white;--ph-survey-input-text-color:#020617;--ph-survey-disabled-button-opacity:.6}.ph-survey{min-width:300px;width:var(--ph-survey-max-width);max-width:85%;z-index:var(--ph-survey-z-index);height:fit-content;margin:0;position:fixed;bottom:0}.ph-survey h3,.ph-survey p{margin:0}.ph-survey *{box-sizing:border-box;font-family:var(--ph-survey-font-family);color:var(--ph-survey-text-primary-color)}.ph-survey textarea,.ph-survey input[type=text],.ph-survey .multiple-choice-options label{color:var(--ph-survey-input-text-color);background:var(--ph-survey-input-background);border:1.5px solid var(--ph-survey-border-color);border-radius:4px;padding:10px;transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey textarea,.ph-survey input[type=text]{transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input{margin:0}.ph-survey textarea:focus,.ph-survey textarea:focus-visible,.ph-survey input[type=text]:focus,.ph-survey input[type=text]:focus-visible,.ph-survey .form-submit:focus,.ph-survey .form-submit:focus-visible,.ph-survey input[type=checkbox]:focus,.ph-survey input[type=radio]:focus,.ph-survey input[type=checkbox]:focus-visible,.ph-survey input[type=radio]:focus-visible{outline:1.5px solid var(--ph-survey-outline-color);border-color:var(--ph-survey-rating-active-bg-color);outline-offset:2px}.ph-survey textarea:focus:not(:focus-visible),.ph-survey input[type=text]:focus:not(:focus-visible),.ph-survey button:focus:not(:focus-visible),.ph-survey input[type=checkbox]:focus:not(:focus-visible),.ph-survey input[type=radio]:focus:not(:focus-visible){outline:none}.ph-survey textarea:hover:not(:focus),.ph-survey input[type=text]:hover:not(:focus){border-color:var(--ph-survey-rating-active-bg-color)}@media (max-width:768px){.ph-survey textarea,.ph-survey input[type=text]{font-size:1rem}}.ph-survey .multiple-choice-options label,.ph-survey .rating-options-number,.ph-survey .form-cancel,.ph-survey input[type=checkbox],.ph-survey input[type=radio]{border:1.5px solid var(--ph-survey-border-color)}.ph-survey label,.ph-survey input[type=checkbox],.ph-survey input[type=radio],.ph-survey .ratings-emoji,.ph-survey .ratings-number,.ph-survey .footer-branding,.ph-survey .form-cancel,.ph-survey .form-submit{transition:all .2s ease-out}@media (prefers-reduced-motion:no-preference){.ph-survey button:active,.ph-survey input[type=checkbox]:active,.ph-survey input[type=radio]:active,.ph-survey label:active{transition-duration:.1s}}.ph-survey-widget-tab{background:var(--ph-widget-color);color:var(--ph-widget-text-color);text-align:center;cursor:pointer;z-index:var(--ph-survey-z-index);border:none;border-radius:3px 3px 0 0;padding:10px 12px;transition:padding .2s ease-out;position:fixed}.ph-survey-widget-tab:hover:not(.widget-tab-top){padding-bottom:16px}.ph-survey-widget-tab.widget-tab-top{border-radius:0 0 3px 3px}.ph-survey-widget-tab.widget-tab-top:hover{padding-top:16px}@keyframes ph-survey-fade-in{0%{opacity:0}to{opacity:1}}.survey-box{flex-direction:column;gap:16px;display:flex}.bottom-section{flex-direction:column;gap:8px;display:flex}.thank-you-message-header~.bottom-section,.intro-screen-header~.bottom-section{padding-top:16px}.question-container,.thank-you-message,.intro-screen{flex-direction:column;gap:8px;display:flex}.survey-question{font-size:14px;font-weight:500}.survey-question-description{opacity:.8;padding-top:4px;font-size:13px}.survey-question-description,.thank-you-message-body,.intro-screen-body{word-wrap:break-word;overflow-wrap:break-word}:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) img,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) video,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) iframe,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) embed,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) object,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) svg{max-width:100%;height:auto}.question-textarea-wrapper{flex-direction:column;display:flex}.survey-form{animation:.3s ease-out forwards ph-survey-fade-in}.survey-form,.thank-you-message,.intro-screen{text-align:left;width:100%;z-index:var(--ph-survey-z-index);border:1.5px solid var(--ph-survey-border-color);border-bottom:var(--ph-survey-border-bottom);background:var(--ph-survey-background-color);border-radius:var(--ph-survey-border-radius);box-shadow:var(--ph-survey-box-shadow);padding:var(--ph-survey-box-padding);margin:0;position:relative}.survey-form textarea,.survey-form input[type=text]{min-width:100%}.survey-form textarea:focus,.survey-form textarea:focus-visible{box-shadow:0 4px 12px #00000014}.survey-form textarea:focus:not(:focus-visible){box-shadow:none}.survey-box .question-header--empty~.multiple-choice-options,.survey-box .question-header--empty~textarea{margin-top:0}.multiple-choice-options{border:none;flex-direction:column;gap:8px;margin:0;padding:1px 0;font-size:14px;display:flex}.multiple-choice-options label,.multiple-choice-options .response-choice{color:inherit;align-items:center;gap:8px;display:flex}.multiple-choice-options label{cursor:pointer;font-size:13px}.multiple-choice-options label:hover:not(:has(input:checked)){border-color:var(--ph-survey-text-subtle-color);box-shadow:0 2px 8px #00000014}.multiple-choice-options label:has(input:checked){border-color:var(--ph-survey-rating-active-bg-color);box-shadow:0 1px 4px #0000000d}.multiple-choice-options label.choice-option-open{flex-wrap:wrap}.multiple-choice-options label span{color:inherit}.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ph-survey-input-background);cursor:pointer;z-index:1;border-radius:3px;flex-shrink:0;width:1rem;height:1rem;transition:all .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out;position:relative}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):focus{transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):hover{border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):active{transform:scale(.95)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked{background:var(--ph-survey-rating-active-bg-color);border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked:hover{transform:scale(1.05)}.multiple-choice-options input[type=checkbox]:checked:after{border:solid var(--ph-survey-rating-active-text-color);border-width:0 2px 2px 0;width:4px;height:8px;animation:.2s ease-out .1s forwards ph-survey-checkmark-reveal;left:4px;transform:rotate(45deg)scale(0)}.multiple-choice-options input[type=radio]:checked:after{background:var(--ph-survey-rating-active-text-color);border-radius:50%;width:6px;height:6px;animation:.15s ease-out 50ms forwards ph-survey-radio-reveal;top:5px;left:5px;transform:scale(0)}.multiple-choice-options input[type=checkbox]:checked:after,.multiple-choice-options input[type=radio]:checked:after{content:"";box-sizing:content-box;position:absolute}.multiple-choice-options input[type=radio]{border-radius:50%}.multiple-choice-options input[type=radio]:checked{border:none}:is(.multiple-choice-options input[type=checkbox]:checked,.multiple-choice-options input[type=radio]:checked)~*{font-weight:700}.multiple-choice-options .choice-option-open input[type=text]::placeholder{color:var(--ph-survey-text-subtle-color);font-weight:400}.rating-options-emoji{justify-content:space-between;display:flex}.rating-options-emoji-2{justify-content:space-around}.ratings-emoji{opacity:.5;background-color:#0000;border:none;padding:0;font-size:16px}.ratings-emoji:hover{cursor:pointer;opacity:1;transform:scale(1.15)}.ratings-emoji.rating-active{opacity:1}.ratings-emoji svg{fill:var(--ph-survey-text-primary-color);transition:fill .2s ease-out}.rating-options-number{border-radius:6px;grid-auto-columns:1fr;grid-auto-flow:column;display:grid;overflow:hidden}.rating-options-number .ratings-number{border-right:1px solid var(--ph-survey-border-color);text-align:center;cursor:pointer;color:var(--ph-survey-rating-text-color);border-top:none;border-bottom:none;border-left:none;font-weight:700}.rating-options-number .ratings-number:last-of-type{border-right:0}.rating-options-number .ratings-number.rating-active{background:var(--ph-survey-rating-active-bg-color);color:var(--ph-survey-rating-active-text-color)}.ratings-number{background-color:var(--ph-survey-rating-bg-color);border:none;padding:8px 0}.ratings-number .rating-active{background-color:var(--ph-survey-rating-active-bg-color)}.ratings-number{cursor:pointer}@media (hover:hover) and (pointer:fine){.ratings-number:hover:not(.rating-active){background-color:color-mix(in srgb, var(--ph-survey-rating-active-bg-color) 14%, var(--ph-survey-rating-bg-color))}}.rating-text{opacity:.7;flex-direction:row;justify-content:space-between;font-size:11px;display:flex}.form-buttons{flex-direction:row;gap:8px;width:100%;display:flex}.form-buttons-with-back>.form-submit{flex:auto;min-width:0}.form-submit{text-align:center;cursor:pointer;user-select:none;background:var(--ph-survey-submit-button-color);color:var(--ph-survey-submit-button-text-color);border:none;border-radius:6px;min-width:100%;padding:12px;font-weight:700;box-shadow:0 2px #0000000b}.form-submit:not([disabled]):hover{transform:scale(1.02);box-shadow:0 4px 8px #0000001a}.form-submit:not([disabled]):active{transform:scale(.98);box-shadow:0 1px 2px #0000000d}.form-submit[disabled]{opacity:var(--ph-survey-disabled-button-opacity);cursor:not-allowed}.form-back{text-align:center;cursor:pointer;user-select:none;color:var(--ph-survey-text-primary-color);border:1.5px solid var(--ph-survey-border-color);background:0 0;border-radius:6px;flex:none;padding:12px 16px;font-weight:600}.form-back:hover{transform:scale(1.02)}.form-back:active{transform:scale(.98)}.validation-hint{opacity:.7;margin-top:4px;font-size:12px}.form-cancel{cursor:pointer;background:#fff;border-radius:100%;padding:12px;line-height:0;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.form-cancel:hover{opacity:.7;transform:translate(50%,-50%)scale(1.1)}.footer-branding{opacity:.6;justify-content:center;align-items:center;gap:4px;font-size:11px;font-weight:500;text-decoration:none;display:flex}.footer-branding:hover{opacity:1}.footer-branding a{text-decoration:none}.thank-you-message{text-align:center}.thank-you-message-header{margin:10px 0 0}.thank-you-message-body{opacity:.8;font-size:14px}.intro-screen{text-align:center;animation:.3s ease-out forwards ph-survey-fade-in}.intro-screen-header{margin:10px 0 0}.intro-screen-body{opacity:.8;font-size:14px}.limit-height{scrollbar-width:thin;scrollbar-color:var(--ph-survey-scrollbar-thumb-color) var(--ph-survey-scrollbar-track-color);max-height:256px;overflow:hidden auto}.limit-height::-webkit-scrollbar{width:8px}.limit-height::-webkit-scrollbar-track{background:var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb{background-color:var(--ph-survey-scrollbar-thumb-color);border:2px solid var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb:hover{background-color:var(--ph-survey-text-subtle-color)}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.ph-survey *{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@keyframes ph-survey-checkmark-reveal{0%{opacity:0;transform:rotate(45deg)scale(0)}50%{opacity:1;transform:rotate(45deg)scale(1.2)}to{opacity:1;transform:rotate(45deg)scale(1)}}@keyframes ph-survey-radio-reveal{0%{opacity:0;transform:scale(0)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}',null==t?void 0:t.config.prepareStylesheet);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||document.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},xb=t=>{try{const e=Pm(t);localStorage.getItem(e)||localStorage.setItem(e,"true")}catch(t){Mm.error("Failed to persist survey seen state",t)}},$b=({responses:t,survey:e,surveySubmissionId:i,posthog:n,isSurveyCompleted:s,properties:r,surveyLanguage:o,questionSnapshots:l})=>{var a,u,c;n?(null===(a=n.client)||void 0===a?void 0:a.canCapture)&&(xb(e),s&&Bb(e),null===(u=n.client)||void 0===u||u.capture(Tm.SENT,ue(ue(ue({[Cm.SURVEY_NAME]:e.name,[Cm.SURVEY_ID]:e.id,[Cm.SURVEY_ITERATION]:e.current_iteration,[Cm.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,sessionRecordingUrl:Wg(n)},uu(ue(ue({event:"sent",survey:e,responses:t,submissionId:i,completed:s},!Ce(o)&&{surveyLanguage:o}),!Ce(l)&&{questionSnapshots:l}))),r),{},{$set:{[hu(e,"responded")]:!0}})),s&&(window.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:e.id}})),null===(c=n.client)||void 0===c||null===(c=c.getExtension("featureFlagsCommon"))||void 0===c||c.reloadFeatureFlags())):Mm.error("[survey sent] event not captured, PostHog instance not found.")},Tb=(t,e,i,n)=>ue({[Cm.SURVEY_NAME]:e.name,[Cm.SURVEY_ID]:e.id,[Cm.SURVEY_ITERATION]:e.current_iteration,[Cm.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,sessionRecordingUrl:Wg(n)},uu(ue(ue(ue(ue({event:t,survey:e},!Ce(null==i?void 0:i.responses)&&{responses:i.responses}),!Ce(null==i?void 0:i.surveySubmissionId)&&{submissionId:i.surveySubmissionId}),!Ce(null==i?void 0:i.surveyLanguage)&&{surveyLanguage:i.surveyLanguage}),!Ce(null==i?void 0:i.questionSnapshots)&&{questionSnapshots:i.questionSnapshots}))),Cb=(t,e,i,n)=>{var s;if(!e)return void Mm.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const r=jb(t),o=r?r.surveyLanguage:n,l=ue(ue(ue({},Tb("dismissed",t,r,e)),o&&{[Cm.SURVEY_LANGUAGE]:o}),{},{$set:{[hu(t,"dismissed")]:!0}});Bb(t),xb(t),null===(s=e.client)||void 0===s||s.capture(Tm.DISMISSED,l),window.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:t.id}}))},Eb=(t,e)=>{var i,n;if(!e)return void Mm.error("[survey abandoned] event not captured, PostHog instance not found.");if(!(null===(i=e.client)||void 0===i?void 0:i.canCapture))return;const s=(t=>Om("abandonedSurvey_",t))(t);try{if("true"===localStorage.getItem(s))return}catch(t){return}const r=jb(t);if(r){try{localStorage.setItem(s,"true")}catch(t){}null===(n=e.client)||void 0===n||n.capture(Tm.ABANDONED,Tb("abandoned",t,r,e),{delivery:"unload"})}},Mb=t=>{const e=t.map(t=>t.id);return e.every(t=>!!t)?e:void 0},Ib=(t,e)=>{var i,n,s;return(t=>t.questions.some(t=>{var e;return!!(null===(e=t.branching)||void 0===e?void 0:e.type)}))(t)?t.questions:e?null!==(i=((t,e)=>{if(!e||e.length!==t.questions.length)return null;const i=new Map(t.questions.map(t=>[t.id,t])),n=[];for(const t of e){const e=i.get(t);if(!e)return null;n.push(e)}return n})(t,e.questionOrder))&&void 0!==i?i:t.questions:t.appearance&&t.appearance.shuffleQuestions&&!t.enable_partial_responses?(n=t.questions,s=Su(t.questions),n.length===s.length&&n.every((t,e)=>t===s[e])?s.reverse():s):t.questions},Rb=t=>yu(t)||qb(t),Ab=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,Tg(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"+dg++,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}),Ob=()=>cm(Ab),Pb=({component:t,children:e,renderAsHtml:i,style:n})=>function(t,e,i){var n,s,r,o,l=mg({},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?Yp.call(arguments,2):i),_g(t.type,l,n||t.key,s||t.ref,null)}(t,i?{dangerouslySetInnerHTML:{__html:gb(e)},style:n}:{children:e,style:n});function Fb(t,e){var i,n,s;if(!(null===(i=t.conditions)||void 0===i?void 0:i.url))return!0;const r=null!==(n=fo(e))&&void 0!==n?n:"u">typeof window?window.location.href:void 0;if(!r)return!1;const o=[t.conditions.url],l=function(t){return null!=t?t:"icontains"}(null===(s=t.conditions)||void 0===s?void 0:s.urlMatchType);return wu[l](o,[r])}const Lb=t=>Om("inProgressSurvey_",t),Db={},Nb=(t,e)=>{const i=Lb(t);try{localStorage.setItem(i,JSON.stringify(e)),delete Db[i]}catch(t){Mm.error("Error setting in-progress survey state in localStorage",t),Db[i]=e}},jb=t=>{const e=Lb(t),i=Db[e];if(i)return i;try{const t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch(t){Mm.error("Error getting in-progress survey state from localStorage",t)}return null},qb=t=>{const e=jb(t);return!Re(null==e?void 0:e.surveySubmissionId)},Bb=t=>{const e=Lb(t);delete Db[e];try{localStorage.removeItem(e)}catch(t){Mm.error("Error clearing in-progress survey state from localStorage",t)}};function zb(t,e=!1){const i=`PostHogSurvey-${t.id}`;return e?`.${i}`:i}function Ub(t,e=_m.Right,i){if(t===km.ExternalSurvey)return{};switch(e){case _m.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case _m.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case _m.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case _m.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case _m.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case _m.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case _m.Left:return{left:"30px"};case _m.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:t===km.Widget&&i===bm.Tab?"60px":"30px"}}}const Hb=Ug("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Ug("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"})}),Wb=Ug("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Ug("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"})}),Vb=Ug("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Ug("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"})}),Gb=Ug("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Ug("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"})}),Jb=Ug("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Ug("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"})}),Qb=Ug("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Ug("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"})}),Zb=Ug("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Ug("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"})}),Kb=({fill:t="currentColor"}={})=>Ug("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:[Ug("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),Ug("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})]}),Yb=Ug("svg",{width:"80",height:"14",viewBox:"0 0 160 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Ug("g",{"clip-path":"url(#ph-survey-logo-clip)",style:"opacity: calc(1 - var(--ph-logo-mono, 0))",children:[Ug("path",{fill:"currentColor",d:"M51.66 25.22A1.9 1.9 0 0 0 50 23.33l-.34-.04c-1-.13-1.94-.6-2.65-1.33L33.28 7.75V28H49a2.66 2.66 0 0 0 2.67-2.67zM39.2 23.54h-.09a1.78 1.78 0 1 1 .1 0"}),Ug("path",{fill:"url(#ph-survey-logo-paint0)",d:"M21.96 2.67v4.96l11.3 11.6h.02V7.75L26.63.85a2.8 2.8 0 0 0-2-.85 2.67 2.67 0 0 0-2.67 2.67"}),Ug("path",{fill:"url(#ph-survey-logo-paint1)",d:"M21.96 7.63v11.05L31.03 28h2.25v-8.75z"}),Ug("path",{fill:"url(#ph-survey-logo-paint2)",d:"M21.96 28h9.07l-9.07-9.32z"}),Ug("path",{fill:"url(#ph-survey-logo-paint3)",d:"M10.74 2.66v4.5l11.22 11.52V7.63L15.3.8a2.66 2.66 0 0 0-4.56 1.86"}),Ug("path",{fill:"url(#ph-survey-logo-paint4)",d:"M10.74 28h8.96l-8.96-9.32z"}),Ug("path",{fill:"url(#ph-survey-logo-paint5)",d:"M10.74 7.16v11.52L19.7 28h2.26v-9.32z"}),Ug("path",{fill:"url(#ph-survey-logo-paint6)",d:"M10.74 7.16 4.54.8A2.66 2.66 0 0 0 0 2.66V7.5l10.74 11.18z"}),Ug("path",{fill:"url(#ph-survey-logo-paint7)",d:"M9.19 28h1.55v-9.32L0 7.5v10.73z"}),Ug("path",{fill:"url(#ph-survey-logo-paint8)",d:"M0 25.41A2.6 2.6 0 0 0 2.58 28H9.2L0 18.23z"})]}),Ug("path",{"clip-path":"url(#ph-survey-logo-clip)",fill:"currentColor",style:"opacity: var(--ph-logo-mono, 0)",d:"m50.02 23.34-.34-.04c-1-.13-1.95-.6-2.66-1.33L35.58 10.11a.5.5 0 0 0-.86.35V27.5c0 .28.22.5.5.5H49c1.48 0 2.67-1.2 2.67-2.67v-.1a1.9 1.9 0 0 0-1.66-1.9m-10.81.2a1.78 1.78 0 1 1 0-3.56 1.78 1.78 0 0 1 0 3.57M0 25.41A2.6 2.6 0 0 0 2.59 28h5.22a.5.5 0 0 0 .37-.84L.87 19.13a.5.5 0 0 0-.87.34zm18.81 1.74a.5.5 0 0 1-.36.85h-7.09a.5.5 0 0 1-.37-.17L8.94 25.5.13 15.82A.5.5 0 0 1 0 15.5V8.75a.5.5 0 0 1 .86-.34zM0 2.68C0 .28 2.92-.91 4.59.82l25.6 26.33a.5.5 0 0 1-.36.85h-7.76a.5.5 0 0 1-.37-.17l-2.1-2.33L.28 5.3A1 1 0 0 1 0 4.6zm10.74 0c0-2.4 2.92-3.59 4.59-1.87L32.5 18.48l.5.51v7.3a.5.5 0 0 1-.86.35l-1.12-1.14L11.3 5.23a2 2 0 0 1-.57-1.4zM33 7.46v7.8a.5.5 0 0 1-.85.36l-9.61-9.89a2 2 0 0 1-.57-1.4V2.69c0-2.4 2.92-3.59 4.59-1.86z"}),Ug("path",{fill:"currentColor",d:"M64.9 22.88c-.67 0-1.23-.56-1.23-1.24V5.24c0-.69.56-1.24 1.24-1.24h6.55c3.89 0 6.39 2.32 6.39 5.9 0 3.6-2.5 5.91-6.4 5.91h-3.53v5.83c0 .68-.56 1.24-1.24 1.24zm3.02-11.94c0 .68.55 1.23 1.23 1.23h1.88c1.6 0 2.58-.86 2.58-2.26s-.97-2.27-2.58-2.27h-1.88c-.68 0-1.23.55-1.23 1.23zM84.71 23.1c-4.18 0-7.14-2.97-7.14-7.02s2.96-7.01 7.14-7.01c4.14 0 7.14 2.97 7.14 7.01 0 4.05-3 7.01-7.14 7.01m-3.22-7.02c0 2.16 1.3 3.64 3.22 3.64 1.9 0 3.2-1.48 3.2-3.64s-1.3-3.64-3.2-3.64c-1.93 0-3.22 1.48-3.22 3.64m16.34 7.03a6.2 6.2 0 0 1-5.54-3.01c-.34-.57-.01-1.26.6-1.5l.77-.3c.7-.27 1.45.15 1.92.73a2.8 2.8 0 0 0 2.25 1.08c1.05 0 1.75-.51 1.75-1.27 0-2.13-7.17-.7-7.17-5.85 0-2.13 1.85-3.91 4.83-3.91 2.27 0 4.2.9 5.17 2.31.36.53.05 1.2-.54 1.44l-.85.35c-.68.29-1.45-.14-2-.63a2.5 2.5 0 0 0-1.64-.64c-.89 0-1.5.38-1.5.97 0 2.16 7.27.38 7.27 5.88 0 2.35-2.15 4.34-5.32 4.34m14.64-1.31c.04.57-.3 1.1-.86 1.2q-.6.1-1.27.11c-2.92 0-5.15-1.56-5.15-4.85v-5.66h-.91c-.69 0-1.24-.56-1.24-1.24v-.82c0-.68.55-1.23 1.24-1.23h.91v-2.7c0-.69.55-1.24 1.23-1.24h1.48c.68 0 1.24.55 1.24 1.23v2.7h2.04c.68 0 1.23.56 1.23 1.24v.82c0 .68-.55 1.24-1.23 1.24h-2.04v5.15c0 1.2.64 1.91 1.6 1.91.75 0 1.6.5 1.66 1.25zM125.5 5.23c0-.68.55-1.23 1.23-1.23h1.8c.68 0 1.23.55 1.23 1.23v16.41c0 .68-.55 1.24-1.23 1.24h-1.8c-.68 0-1.23-.56-1.23-1.24v-5.43c0-.68-.56-1.23-1.24-1.23h-5c-.67 0-1.23.55-1.23 1.23v5.43c0 .68-.55 1.24-1.23 1.24h-1.77c-.69 0-1.24-.56-1.24-1.24V5.24c0-.69.55-1.24 1.24-1.24h1.77c.68 0 1.23.55 1.23 1.23v4.87c0 .68.56 1.23 1.24 1.23h5c.67 0 1.23-.55 1.23-1.23zm12.87 17.87c-4.19 0-7.14-2.97-7.14-7.02s2.95-7.01 7.14-7.01c4.13 0 7.14 2.97 7.14 7.01 0 4.05-3 7.01-7.14 7.01m-3.22-7.02c0 2.16 1.29 3.64 3.22 3.64 1.9 0 3.2-1.48 3.2-3.64s-1.3-3.64-3.2-3.64c-1.93 0-3.22 1.48-3.22 3.64m17.17 6.37c-3.84 0-6.2-2.58-6.2-6.68s2.36-6.69 6.12-6.69c1.58 0 2.82.54 3.54 1.37 0-.64.52-1.15 1.16-1.15h1.5c.68 0 1.24.55 1.24 1.23V21.9c0 3.64-2.77 6.09-6.93 6.09-2.64 0-4.9-1.2-5.85-3.09-.31-.62.16-1.29.85-1.4l1.14-.17c.67-.11 1.29.4 1.78.85.5.46 1.26.7 2.08.7 1.85 0 3.06-1.04 3.06-2.55v-1.3c-.7.9-2.01 1.4-3.49 1.4m-2.36-6.68c0 2.02 1.18 3.31 3 3.31 1.86 0 3.04-1.29 3.04-3.31s-1.18-3.32-3.03-3.32c-1.83 0-3.01 1.3-3.01 3.32"}),Ug("defs",{children:[Ug("linearGradient",{id:"ph-survey-logo-paint0",x1:"21.96",x2:"33.28",y1:"9.62",y2:"9.62",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#ffd849"}),Ug("stop",{offset:".96","stop-color":"#fbae01"})]}),Ug("linearGradient",{id:"ph-survey-logo-paint1",x1:"21.96",x2:"33.28",y1:"17.81",y2:"17.81",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#ffb700"}),Ug("stop",{offset:"1","stop-color":"#f9aa01"})]}),Ug("linearGradient",{id:"ph-survey-logo-paint2",x1:"21.96",x2:"31.03",y1:"23.34",y2:"23.34",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#ff9500"}),Ug("stop",{offset:"1","stop-color":"#f8aa00"})]}),Ug("linearGradient",{id:"ph-survey-logo-paint3",x1:"10.74",x2:"21.96",y1:"9.34",y2:"9.34",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#ff651e"}),Ug("stop",{offset:"1","stop-color":"#e4400a"})]}),Ug("linearGradient",{id:"ph-survey-logo-paint4",x1:"10.74",x2:"19.7",y1:"23.34",y2:"23.34",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#c42c00"}),Ug("stop",{offset:"1","stop-color":"#d63600"})]}),Ug("linearGradient",{id:"ph-survey-logo-paint5",x1:"10.74",x2:"21.96",y1:"17.58",y2:"17.58",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#ef3c00"}),Ug("stop",{offset:"1","stop-color":"#d63601"})]}),Ug("linearGradient",{id:"ph-survey-logo-paint6",x1:"0",x2:"10.74",y1:"9.34",y2:"9.34",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#3f80ff"}),Ug("stop",{offset:"1","stop-color":"#084fe0"})]}),Ug("linearGradient",{id:"ph-survey-logo-paint7",x1:"0",x2:"10.74",y1:"17.75",y2:"17.75",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#0255ff"}),Ug("stop",{offset:"1","stop-color":"#0145d2"})]}),Ug("linearGradient",{id:"ph-survey-logo-paint8",x1:"0",x2:"9.19",y1:"23.11",y2:"23.11",gradientUnits:"userSpaceOnUse",children:[Ug("stop",{"stop-color":"#0041c6"}),Ug("stop",{offset:"1","stop-color":"#0045d0"})]}),Ug("clipPath",{id:"ph-survey-logo-clip",children:Ug("path",{fill:"#fff",d:"M0 0h51.67v28H0z"})})]})]});function Xb({urlParams:t}){const e=t?Object.entries(t).map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"):"";return Ug("a",{href:"https://posthog.com/surveys"+(e?`?${e}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",Yb]})}function t_({text:t,submitDisabled:e,appearance:i,onSubmit:n,link:s,onPreviewSubmit:r,skipSubmitButton:o,canGoBack:l,onBack:a}){const{isPreviewMode:u}=cm(Ab),c=!!l&&!!a,h=!o&&Ug("button",{className:"form-submit",disabled:e,type:"button",onClick(){var t;s&&(null===(t=window)||void 0===t||t.open(s)),u?null==r||r():n()},children:t});return Ug("div",{className:"bottom-section",children:[c?Ug("div",{className:"form-buttons form-buttons-with-back",children:[Ug("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:a,children:i.backButtonText||"Back"}),h]}):h,!i.whiteLabel&&Ug(Xb,{urlParams:{utm_source:"survey-footer"}})]})}function e_({question:t,forceDisableHtml:e,htmlFor:i}){return Ug("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[Ug(t.type===Sm.Open?"label":"h3",{className:"survey-question",htmlFor:i,children:t.question}),t.description&&Pb({component:bg("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!e&&"text"!==t.descriptionContentType})]})}function i_({onClick:t}){const{isPreviewMode:e}=cm(Ab);return Ug("button",{className:"form-cancel",onClick:t,disabled:e,"aria-label":"Close survey",type:"button",children:Kb({fill:"black"})})}function n_({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onClose:r}){const{isPopup:o}=cm(Ab);return lm(()=>{const t=t=>{"Enter"!==t.key&&"Escape"!==t.key||(t.preventDefault(),r())};return to(window,"keydown",t),()=>{window.removeEventListener("keydown",t)}},[r]),Ug("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&Ug(i_,{onClick:()=>r()}),Ug("h3",{className:"thank-you-message-header",children:t}),e&&Pb({component:bg("p",{className:"thank-you-message-body"}),children:e,renderAsHtml:!n&&"text"!==i}),o&&Ug(t_,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>r()})]})}function s_({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onStart:r}){const{isPopup:o,onPreviewSubmit:l,onPopupSurveyDismissed:a}=cm(Ab);return Ug("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&Ug(i_,{onClick:()=>a()}),t&&Ug("h3",{className:"intro-screen-header",children:t}),e&&Pb({component:bg("p",{className:"intro-screen-body"}),children:e,renderAsHtml:!n&&"text"!==i}),Ug(t_,{text:s.introScreenButtonText||"Get started",submitDisabled:!1,appearance:s,onSubmit:r,onPreviewSubmit:()=>l(null)})]})}const r_=t=>Se(t)&&t.every(t=>Ee(t));function o_({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,displayQuestionIndex:r,initialValue:o,canGoBack:l,onBack:a}){const{isPreviewMode:u}=Ob(),c=am(null),[h,d]=om(()=>Ee(o)?o:""),v=null==i?void 0:i.disableAutofocus;lm(()=>{v||setTimeout(()=>{var t;u||null===(t=c.current)||void 0===t||t.focus()},100)},[u,v]);const f=`surveyQuestion${r}`,p=um(()=>function(t,e,i){const n=t.trim();if(!i&&""===n)return"This field is required";if(""===n)return!1;if(e&&e.length>0)for(const t of e)switch(t.type){case de:var s;if(void 0!==t.value&&t.value>n.length)return null!==(s=t.errorMessage)&&void 0!==s?s:`Please enter at least ${t.value} characters`;break;case ve:var r;if(void 0!==t.value&&n.length>t.value)return null!==(r=t.errorMessage)&&void 0!==r?r:`Please enter no more than ${t.value} characters`}return!1}(h,t.validation,t.optional),[h,t.validation,t.optional]),g=jr(t.validation,de),m=jr(t.validation,ve),y=um(()=>function(t,e){const i=1===t?void 0:t;return i&&e?`Enter ${i}-${e} characters`:i?`Enter at least ${i} ${1===i?"character":"characters"}`:e?`Maximum ${e} ${1===e?"character":"characters"}`:void 0}(g,m),[g,m]),b=()=>{p||n(h.trim())},_=()=>{p||s(h.trim())};return Ug(wg,{children:[Ug("div",{className:"question-container",children:[Ug(e_,{question:t,forceDisableHtml:e,htmlFor:f}),Ug("textarea",{ref:c,id:f,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:g,maxLength:m,onInput(t){d(t.currentTarget.value),t.stopPropagation()},onKeyDown(t){t.stopPropagation(),"Enter"!==t.key||!t.metaKey&&!t.ctrlKey||p||(t.preventDefault(),u?_():b())},value:h}),y&&Ug("div",{className:"validation-hint",children:y})]}),Ug(t_,{text:t.buttonText||"Submit",submitDisabled:!!p,appearance:i,onSubmit:b,onPreviewSubmit:_,canGoBack:l,onBack:a})]})}function l_({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,canGoBack:r,onBack:o}){return Ug(wg,{children:[Ug("div",{className:"question-container",children:Ug(e_,{question:t,forceDisableHtml:e})}),Ug(t_,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:()=>n("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:r,onBack:o})]})}function a_({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:l,onBack:a}){var u;const c=t.scale,h=10===t.scale?0:1,[d,v]=om(()=>Ae(o)?o:Se(o)&&o.length>0&&Ae(parseInt(o[0]))?parseInt(o[0]):Ee(o)&&Ae(parseInt(o))?parseInt(o):null),f="emoji"===t.display&&2===t.scale,{isPreviewMode:p}=Ob(),g=t=>p?r(t):s(t);return Ug(wg,{children:[Ug("div",{className:"question-container",children:[Ug(e_,{question:t,forceDisableHtml:e}),Ug("div",{className:"rating-section",children:[Ug("div",{className:"rating-options",children:["emoji"===t.display&&Ug("div",{className:"rating-options-emoji"+(f?" rating-options-emoji-2":""),children:null===(u=f_[t.scale])||void 0===u?void 0:u.map((e,n)=>Ug("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&&Ug("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${c-h+1}, minmax(0, 1fr))`},children:p_(t.scale).map((e,s)=>Ug(u_,{displayQuestionIndex:i,active:d===e,appearance:n,num:e,setActiveNumber(e){v(e),t.skipSubmitButton&&g(e)}},s))})]}),!f&&Ug("div",{className:"rating-text",children:[Ug("div",{children:t.lowerBoundLabel}),Ug("div",{children:t.upperBoundLabel})]})]})]}),Ug(t_,{text:t.buttonText||(null==n?void 0:n.submitButtonText)||"Submit",submitDisabled:Ie(d)&&!t.optional,appearance:n,onSubmit:()=>s(d),onPreviewSubmit:()=>r(d),skipSubmitButton:t.skipSubmitButton,canGoBack:l,onBack:a})]})}function u_({num:t,active:e,displayQuestionIndex:i,setActiveNumber:n}){return Ug("button",{"aria-label":`Rate ${t}`,className:`ratings-number question-${i}-rating-${t} ${e?"rating-active":""}`,type:"button",onClick(){n(t)},children:t})}function c_({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:l,onBack:a}){const u=am(null),c=um(()=>(t=>{var e;if(!t.shuffleOptions)return t.choices;const i=[...t.choices],n=t.hasOpenChoice&&null!==(e=i.pop())&&void 0!==e?e:null,s=(r=i,(o=Su(i)).length>1&&r.every((t,e)=>t===o[e])?o.reverse():o);var r,o;return Ie(n)||s.push(n),s})(t),[t]),[h,d]=om(()=>((t,e)=>Ee(t)||r_(t)?t:e===Sm.SingleChoice?null:[])(o,t.type)),[v,f]=om(()=>((t,e)=>{if(Ee(t)&&!e.includes(t))return{isSelected:!0,inputValue:t};if(r_(t)){const i=t.find(t=>!e.includes(t));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,c)),{isPreviewMode:p}=Ob(),g=t.type===Sm.SingleChoice,m=t.type===Sm.MultipleChoice,y=t.skipSubmitButton&&g&&!t.hasOpenChoice,b=(t,e)=>{if(e){const t=!v.isSelected;return f(e=>ue(ue({},e),{},{isSelected:t,inputValue:t?e.inputValue:""})),g&&d(""),void(t&&setTimeout(()=>{var t;return null===(t=u.current)||void 0===t?void 0:t.focus()},75))}if(g)return d(t),f(t=>ue(ue({},t),{},{isSelected:!1,inputValue:""})),void(y&&(s(t),p&&r(t)));m&&Se(h)&&(h.includes(t)?d(h.filter(e=>e!==t)):d([...h,t]))},_=t=>{t.stopPropagation();const e=t.currentTarget.value;f(t=>ue(ue({},t),{},{inputValue:e})),g&&d(e)},w=t=>{t.stopPropagation(),"Enter"!==t.key||k()||(t.preventDefault(),S()),"Escape"===t.key&&(t.preventDefault(),f(t=>ue(ue({},t),{},{isSelected:!1,inputValue:""})),g&&d(null))},k=()=>!(t.optional||!Ie(h)&&(!Se(h)||v.isSelected||0!==h.length)&&(!v.isSelected||""!==v.inputValue.trim())),S=()=>{v.isSelected&&m?Se(h)&&(p?r([...h,v.inputValue]):s([...h,v.inputValue])):p?r(h):s(h)};return Ug(wg,{children:[Ug("div",{className:"question-container",children:[Ug(e_,{question:t,forceDisableHtml:e}),Ug("fieldset",{className:"multiple-choice-options limit-height",children:[Ug("legend",{className:"sr-only",children:m?" Select all that apply":" Select one"}),c.map((e,n)=>{const s=!!t.hasOpenChoice&&n===t.choices.length-1,r=`surveyQuestion${i}Choice${n}`,o=`${r}Open`,l=s?v.isSelected:g?h===e:Se(h)&&h.includes(e);return Ug("label",{className:s?"choice-option-open":"",children:[Ug("div",{className:"response-choice",children:[Ug("input",{type:g?"radio":"checkbox",name:r,checked:l,onChange:()=>b(e,s),id:r,"aria-controls":o}),Ug("span",{children:s?`${e}:`:e})]}),s&&Ug("input",{type:"text",ref:u,id:o,name:`question${i}Open`,value:v.inputValue,onKeyDown:w,onInput:_,onClick(t){v.isSelected||b(e,!0),t.stopPropagation()},"aria-label":`${e} - please specify`})]},n)})]})]}),Ug(t_,{text:t.buttonText||"Submit",submitDisabled:k(),appearance:n,onSubmit:S,onPreviewSubmit:S,skipSubmitButton:y,canGoBack:l,onBack:a})]})}const h_=[1,2,3,4,5],d_=[1,2,3,4,5,6,7],v_=[0,1,2,3,4,5,6,7,8,9,10],f_={2:[Qb,Zb],3:[Vb,Wb,Hb],5:[Gb,Vb,Wb,Hb,Jb]};function p_(t){switch(t){case 5:default:return h_;case 7:return d_;case 10:return v_}}const g_=Hr("[Surveys]");function m_(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?xm.End:r;if(s.branching.type===xm.End)return xm.End;if(s.branching.type===xm.SpecificQuestion){if(Number.isInteger(s.branching.index))return s.branching.index}else if(s.branching.type===xm.ResponseBased){if(s.type===Sm.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];if(Number.isInteger(e))return e;if(e===xm.End)return xm.End}}else if(s.type===Sm.Rating){var l;if(s.optional&&Re(i))return r===t.questions.length?xm.End:r;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const e=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(e)){const t=s.branching.responseValues[e];if(Number.isInteger(t))return t;if(t===xm.End)return xm.End}}return r}return g_.warn("Falling back to next question index due to unexpected branching type"),r}const y_=Hr("[SurveyTranslations]");function b_(t,e){const i=function(t){var e;return function({overrideLanguage:t,storedPersonProperties:e,locale:i},n){const s=du(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?du(t.language):null}(e);if(r)return null==n||n.info(`Using person property language: ${r}`),r;const o=du(i);return o?(null==n||n.info(`Using detected locale: ${o}`),o):(null==n||n.info("No user language detected"),null)}({overrideLanguage:t.config.overrideLanguage,storedPersonProperties:null===(e=t.client)||void 0===e?void 0:e.kv.get(w),locale:"u">typeof navigator?navigator.language||navigator.userLanguage:void 0},y_)}(e);if(!i)return y_.info("No user language detected"),{survey:t,language:null};const n=gu(t,i,y_);return{survey:n.survey,language:n.matchedKey}}const __="ph:show_survey_widget",w_="PHWidgetSurveyClickListener";function k_(t,e){try{const i=t.getBoundingClientRect(),n=window.innerHeight,s=window.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:bb.zIndex}}catch(t){return Mm.warn("Failed to calculate trigger position:",t),null}}var S_=class{constructor(t){var e,i;this.Li=new Map,this.Di=new Map,this.Fi=new Map,this.Pi=new Map,this.Ni=new Set,this.qi=!1,this.ji=null,this.Bi=!1,this.zi=null,this.Ui=null,this.Wi=null,this.Hi=!1,this.handlePageUnload=()=>{var t;const e=null===(t=this.Gi.client)||void 0===t?void 0:t.kv.get(I);if(e)for(const t of e)qb(t)&&Eb(t,this.Gi)},this.handlePopoverSurvey=(t,e,{resumeDelayFromActivation:i=!1}={})=>{var n,s,r,o,l,a,u;if(!(null===(n=this.Gi.client)||void 0===n?void 0:n.canCapture))return;const{survey:c,language:h}=this.Vi(t);this.ji=h,this.Wi=null,this.Qi=e;const d=this.Zi(c,e);this.Ji(d.id);const{properties:v,initialResponses:f}=null!=e?e:{},p=!(!f||0>=Object.keys(f).length)&&this.Yi(d,f,v,h);if(p&&!(null===(s=d.appearance)||void 0===s?void 0:s.displayThankYouMessage))return;this.Ki(d);let g={};if((null===(r=d.appearance)||void 0===r?void 0:r.position)===_m.NextToTrigger&&(null===(o=d.appearance)||void 0===o?void 0:o.widgetSelector)){var m;const t=document.querySelector(d.appearance.widgetSelector);t&&(g=k_(t,parseInt((null===(m=d.appearance)||void 0===m?void 0:m.maxWidth)||bb.maxWidth))||{})}const y=(null===(l=d.appearance)||void 0===l?void 0:l.surveyPopupDelaySeconds)||0,{shadow:b}=Sb(d,this.Gi);this.Pi.set(b,b.host);const _={posthog:this.Gi,survey:d,removeSurveyFromFocus:this.Xi,properties:v,style:g,isSurveyCompleted:p,skipShownEvent:null==e?void 0:e.skipShownEvent,surveyLanguage:h};if(this.Wi=_,0>=y)return this.Bi=!0,Bg(Ug(C_,ue({},_)),b);const w=()=>{this.Bi=!0;const{survey:i,language:n}=this.Vi(t);this.ji=n;const s=this.Zi(i,e),r=ue(ue({},_),{},{survey:s,surveyLanguage:n});this.Wi=r,Bg(Ug(C_,ue(ue({},r),{},{survey:ue(ue({},s),{},{appearance:ue(ue({},s.appearance),{},{surveyPopupDelaySeconds:0})})})),b)},k=()=>{var t;if(!(null===(t=this.Gi.client)||void 0===t?void 0:t.canCapture)||!this.er(d))return Mm.info(`Survey ${d.id} no longer eligible when its display delay elapsed; not displaying`),this.Xi(d);w()},S=i?null===(a=this.Gi.surveys)||void 0===a||null===(a=a._surveyEventReceiver)||void 0===a||null===(u=a.getActivationTimestamp)||void 0===u?void 0:u.call(a,d.id):void 0,x=Ae(S)?Math.max(0,Date.now()-S):0,T=Math.max(0,1e3*y-x);if(0>=T)return k();const C=window.setTimeout(()=>{this.Li.delete(d.id),k()},T);this.Li.set(d.id,C)},this.nr=t=>{var e;const{survey:i,language:n}=this.Vi(t),{shadow:s,isNewlyCreated:r}=Sb(i,this.Gi);this.Pi.set(s,s.host),(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===bm.Tab&&this.Fi.set(t.id,t),r&&Bg(Ug(M_,{posthog:this.Gi,survey:i,surveyLanguage:n},t.id),s)},this.ir=t=>{const e=this.Di.get(t);e&&(e.element.removeEventListener("click",e.listener),e.element.removeAttribute(w_),this.Di.delete(t),Mm.info(`Removed click listener for survey ${t}`))},this.rr=t=>{this.sr(t)||(this.ar(t),this.ir(t.id))},this.lr=t=>{this.sr(t)||(this.ar(t),this.Fi.delete(t.id))},this.sr=t=>{try{var e;const i=document.querySelector(zb(t,!0));return!!(null==i||null===(e=i.shadowRoot)||void 0===e?void 0:e.querySelector(".ph-survey"))}catch(t){return!1}},this.ur=(t,e)=>{const i=document.querySelector(e),n=this.Di.get(t.id);if(i){if(this.nr(t),n){if(i===n.element)return;Mm.info(`Selector element changed for survey ${t.id}. Re-attaching listener.`),this.ir(t.id)}if(!i.hasAttribute(w_)){const e=e=>{var i,n;e.stopPropagation();const s=(null===(i=t.appearance)||void 0===i?void 0:i.position)===_m.NextToTrigger?k_(e.currentTarget,parseInt((null===(n=t.appearance)||void 0===n?void 0:n.maxWidth)||bb.maxWidth)):{};window.dispatchEvent(new CustomEvent(__,{detail:{surveyId:t.id,position:s}}))};to(i,"click",e),i.setAttribute(w_,"true"),this.Di.set(t.id,{element:i,listener:e,survey:t}),Mm.info(`Attached click listener for feedback button survey ${t.id}`)}}else n&&this.rr(t)},this.renderPopover=t=>{var e;if(!(null===(e=this.Gi.client)||void 0===e?void 0:e.canCapture))return;const{survey:i,language:n}=this.Vi(t),{shadow:s}=Sb(i,this.Gi);this.Pi.set(s,s.host),Bg(Ug(C_,{posthog:this.Gi,survey:i,removeSurveyFromFocus:this.Xi,surveyLanguage:n}),s)},this.renderSurvey=(t,e,i)=>{var n;if(!(null===(n=this.Gi.client)||void 0===n?void 0:n.canCapture))return;const{survey:s,language:r}=this.Vi(t);let o=!1;this.Gi.config.prefillFromUrl&&(o=this.cr(s,r,i)),Bg(Ug(C_,{posthog:this.Gi,survey:s,removeSurveyFromFocus:this.Xi,isPopup:!1,properties:i,isSurveyCompleted:o,surveyLanguage:r}),e)},this.getActiveMatchingSurveys=(t,e=!1)=>{var i;null===(i=this.Gi.surveys)||void 0===i||i.getSurveys(e=>{t(e.filter(t=>this.er(t)))},e)},this.callSurveysAndEvaluateDisplayLogic=(t=!1)=>{this.getActiveMatchingSurveys(t=>{var e;const i=null===(e=this.Gi.client)||void 0===e?void 0:e.canCapture,n=t.filter(t=>i&&(t.type===km.Popover||t.type===km.Widget)),s=new Set(n.map(t=>t.id));for(const t of Array.from(this.Li.keys()))s.has(t)||this.cancelSurvey(t);const r=this.dr(n),o=new Set,l=new Set;r.forEach(t=>{if(t.type===km.Widget){var e,i,n,s;if((null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===bm.Tab)return l.add(t.id),void this.nr(t);(null===(i=t.appearance)||void 0===i?void 0:i.widgetType)===bm.Selector&&(null===(n=t.appearance)||void 0===n?void 0:n.widgetSelector)&&(o.add(t.id),this.ur(t,null===(s=t.appearance)||void 0===s?void 0:s.widgetSelector))}Ie(this.vr)&&t.type===km.Popover&&this.handlePopoverSurvey(t,void 0,{resumeDelayFromActivation:!0})}),this.Di.forEach(({survey:t})=>{o.has(t.id)||this.rr(t)}),this.Fi.forEach((t,e)=>{l.has(e)||this.lr(t)})},t)},this.Ki=t=>{Ie(this.vr)||Mm.error(`Survey ${this.vr} already in focus. Cannot add survey ${t.id}.`),this.vr=t.id},this.Xi=t=>{this.vr!==t.id&&Mm.error(`Survey ${t.id} is not in focus. Cannot remove survey ${t.id}.`),this.Ji(t.id),this.vr=null,this.ji=null,this.Bi=!1,this.Wi=null,this.Qi=void 0,this.ar(t)},this.Gi=t,this.vr=null,this.zi=()=>this.pr(),to(window,"languagechange",this.zi),this.Ui=null!==(e=null===(i=t.client)||void 0===i||null===(i=i.getExtension("featureFlagsCommon"))||void 0===i?void 0:i.onFeatureFlags(()=>this.pr()))&&void 0!==e?e:null}pr(){var t;if(Ie(this.vr))return;const e=null===(t=this.Gi.client)||void 0===t?void 0:t.kv.get(I),i=null==e?void 0:e.find(t=>t.id===this.vr);if(!i)return;const{survey:n,language:s}=this.Vi(i);if(s===this.ji)return;if(this.ji=s,!this.Bi)return;const r=this.Zi(n,this.Qi),{shadow:o}=Sb(r,this.Gi);Bg(Ug(C_,ue(ue({},this.Wi),{},{posthog:this.Gi,survey:r,removeSurveyFromFocus:this.Xi,surveyLanguage:s})),o)}Zi(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}Ji(t){const e=this.Li.get(t);e&&(clearTimeout(e),this.Li.delete(t))}cancelSurvey(t){this.Li.has(t)&&(Mm.info(`Cancelled pending survey ${t}`),this.Ji(t),this.vr===t&&(this.vr=null,this.ji=null,this.Bi=!1,this.Wi=null,this.Qi=void 0))}startAutomaticDisplay(){if(this.qi||this.mr||!1===this.Gi.config.automaticDisplay)return;this.mr=()=>{};const t=function(t){let e;t.callSurveysAndEvaluateDisplayLogic(!0);const i=()=>{Ce(e)&&(e=setInterval(()=>{t.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},n=()=>{Ce(e)||(clearInterval(e),e=void 0)};i();const s=()=>{document.hidden?n():(t.callSurveysAndEvaluateDisplayLogic(!1),i())};return to(document,"visibilitychange",s),()=>{n(),document.removeEventListener("visibilitychange",s)}}(this);this.qi?t():this.mr=t}clearInMemoryInProgressSurveyState(){(()=>{for(const t of Object.keys(Db))delete Db[t]})()}dispose(){var t;this.qi=!0,null===(t=this.mr)||void 0===t||t.call(this),this.mr=void 0,this.zi&&(window.removeEventListener("languagechange",this.zi),this.zi=null),this.Ui&&(this.Ui(),this.Ui=null),this.Li.forEach((t,e)=>this.Ji(e)),this.Di.forEach((t,e)=>this.ir(e)),this.Pi.forEach((t,e)=>{Bg(null,e),null==t||t.remove()}),this.Pi.clear(),this.Fi.clear(),this.vr=null}dr(t){return t.sort((t,e)=>{var i,n;const s=qb(t),r=qb(e);if(s&&!r)return-1;if(!s&&r)return 1;const o=t.schedule===$m.Always,l=e.schedule===$m.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)})}Vi(t){return b_(t,this.Gi)}cr(t,e,i){if(this.Ni.has(t.id))return!1;const{params:n}=function(){const t={};let e=!1;const i=window.location.search.replace(/^\?/,"");if(!i)return{params:t,autoSubmit:e};const n=i.split("&");for(const i of n){const n=i.indexOf("=");if(0>=n)continue;let s,r;try{s=decodeURIComponent(i.slice(0,n)),r=decodeURIComponent(i.slice(n+1))}catch(t){continue}if("auto_submit"===s&&"true"===r){e=!0;continue}const o=s.match(/^q(\d+)$/);if(o){const e=parseInt(o[1],10);t[e]||(t[e]=[]),t[e].push(r)}}return{params:t,autoSubmit:e}}();if(0===Object.keys(n).length)return!1;Mm.info("[Survey Prefill] Detected URL prefill parameters");const s=this.gr(t,n,e);return!!s&&(this.yr(t,s,i,e),this.Ni.add(t.id),s.isSurveyCompleted)}yr(t,e,i,n){const{responses:s,submissionId:r,isSurveyCompleted:o,skippedResponses:l}=e;(Object.keys(l).length>0&&t.enable_partial_responses||o)&&$b({responses:o?s:l,survey:t,surveySubmissionId:r,posthog:this.Gi,isSurveyCompleted:o,properties:i,surveyLanguage:n})}Yi(t,e,i,n){const s={};for(const[t,i]of Object.entries(e))s[parseInt(t)]=Se(i)?i.map(String):[String(i)];Mm.info("[Survey] Processing initial responses");const r=this.gr(t,s,n);return!!r&&(this.yr(t,r,i,n),r.isSurveyCompleted)}gr(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=lu(t.id);try{switch(t.type){case Sm.SingleChoice:{if(!t.choices||0===t.choices.length)return void Ur.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 Ur.warn(`[Survey Prefill] Invalid choice index for q${n}: ${s[0]}`);i[r]=t.choices[e];break}case Sm.MultipleChoice:{if(!t.choices||0===t.choices.length)return void Ur.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 Ur.warn(`[Survey Prefill] No valid choices for q${n}`);const o=[...new Set(e.map(e=>t.choices[e]))];e.length>o.length&&Ur.warn(`[Survey Prefill] Removed duplicate choices for q${n}`),i[r]=o;break}case Sm.Rating:{const e=parseInt(s[0],10),o=t.scale||10,l=10===o?0:1;if(isNaN(e)||l>e||e>o)return void Ur.warn(`[Survey Prefill] Invalid rating for q${n}: ${s[0]} (scale: ${l}-${o})`);i[r]=e;break}default:Ur.info(`[Survey Prefill] Question type ${t.type} does not support prefill`)}}catch(t){Ur.error(`[Survey Prefill] Error converting q${n}:`,t)}}),i}(t,e);if(0===Object.keys(n).length)return Mm.warn("[Survey Prefill] No valid responses after conversion"),null;const s=La(),{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=lu(e.id);Ce(i[t])||(s[t]=i[t])}r.push(n);const o=m_(t,n,e.id?i[lu(e.id)]:null);if(o===xm.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)).filter(e=>{const i=t.questions[e];return(null==i?void 0:i.id)&&!Ce(n[lu(i.id)])}),n),a=r>=t.questions.length;return Nb(t,{surveySubmissionId:s,responses:n,lastQuestionIndex:r,questionOrder:Mb(t.questions),visitedIndices:l,surveyLanguage:i}),Mm.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:n,submissionId:s,startQuestionIndex:r,isSurveyCompleted:a,skippedResponses:o}}catch(t){return Mm.error("[Survey Prefill] Error handling prefill:",t),null}}br(t,e){var i;if(!t)return!0;const n=null===(i=this.Gi.client)||void 0===i?void 0:i.getExtension(Hg),s=!!(null==n?void 0:n.isFeatureEnabled(t,{send_event:!t.startsWith("survey-targeting-")}));let r=!0;e&&(r=(null==n?void 0:n.getFeatureFlag(t,{send_event:!1}))===e||"any"===e);const o=s&&r;return o||this.wr(t),o}wr(t){this.Hi||!1!==this.Gi.config.featureFlagEvaluation||(this.Hi=!0,Mm.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.`))}kr(t){return!t.conditions||Fb(t,this.Gi)&&function(t){var e,i;return function(t,e){var i,n,s;if(!t||0===t.length)return!0;const r="u">typeof window?window:void 0,o="u">typeof globalThis?globalThis:r,l=null==o?void 0:o.navigator,a=null==l?void 0:l.userAgent;if(!a)return!1;const u=Zi(a,{userAgentDataPlatform:null==l||null===(i=l.userAgentData)||void 0===i?void 0:i.platform,maxTouchPoints:null==l?void 0:l.maxTouchPoints,screenWidth:null==r||null===(n=r.screen)||void 0===n?void 0:n.width,screenHeight:null==r||null===(s=r.screen)||void 0===s?void 0:s.height,devicePixelRatio:null==r?void 0:r.devicePixelRatio});return wu[null!=e?e:"icontains"](t,[u])}(null===(e=t.conditions)||void 0===e?void 0:e.deviceTypes,null===(i=t.conditions)||void 0===i?void 0:i.deviceTypesMatchType)}(t)&&function(t){var e,i;return!(null===(e=t.conditions)||void 0===e?void 0:e.selector)||!!(null===(i=document)||void 0===i?void 0:i.querySelector(t.conditions.selector))}(t)}Sr(t){var e;return Rb(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.Gi.client)||void 0===e||null===(e=e.getExtension("featureFlagsCommon"))||void 0===e?void 0:e.hasLoadedFlags)?(this.wr(t.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this.br(t.internal_targeting_flag_key)}}checkSurveyEligibility(t){var e,i;const n={eligible:!0,reason:void 0};if(!Rm(t))return n.eligible=!1,n.reason=`Survey is not running. It was completed on ${t.end_date}`,n;if(!Lm.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.br(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.br(t.targeting_flag_key))return n.eligible=!1,n.reason="Survey targeting feature flag is not enabled",n;const r=this.Sr(t);var o;return r.satisfied?(t=>{let e=null;try{e=localStorage.getItem("lastSeenSurveyDate")}catch(t){Mm.error("localStorage error: "+t)}return 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}(t,e)})(null===(i=t.conditions)||void 0===i?void 0:i.seenSurveyWaitPeriodInDays)?((t=>{let e=null;try{e=localStorage.getItem(Pm(t))}catch(t){Mm.error("localStorage error: "+t)}return!!e&&!Rb(t)})(t)&&(n.eligible=!1,n.reason="Survey has already been seen and it can't be activated again"),n):(n.eligible=!1,n.reason="Survey wait period has not passed",n):(n.eligible=!1,n.reason=null!==(o=r.reason)&&void 0!==o?o:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",n)}checkSurveyCaptureEligibility(){var t;return(null===(t=this.Gi.client)||void 0===t?void 0:t.canCapture)?{eligible:!0}:{eligible:!1,reason:Im}}checkSurveyDisplayEligibility(t){const e=this.checkSurveyCaptureEligibility();return e.eligible?this.checkSurveyEligibility(t):e}checkSurveyRenderability(t){const e=this.checkSurveyDisplayEligibility(t);return e.eligible&&!this._r(t)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:e}_r(t){var e;if(!mu(t)&&!Am(t))return!0;const i=null===(e=this.Gi.surveys)||void 0===e||null===(e=e._surveyEventReceiver)||void 0===e?void 0:e.getSurveys();return!!(null==i?void 0:i.includes(t.id))}Cr(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.br(e))}er(t){return this.checkSurveyEligibility(t).eligible&&this.kr(t)&&this._r(t)&&this.Cr(t)}ar(t){try{const e=document.querySelector(zb(t,!0));(null==e?void 0:e.shadowRoot)&&(Bg(null,e.shadowRoot),this.Pi.delete(e.shadowRoot)),null==e||e.remove()}catch(e){Mm.warn(`Failed to remove survey ${t.id} from DOM:`,e)}}getTestAPI(){return{addSurveyToFocus:this.Ki,removeSurveyFromFocus:this.Xi,surveyInFocus:this.vr,surveyTimeouts:this.Li,handleWidget:this.nr,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this.ur,sortSurveysByAppearanceDelay:this.dr.bind(this),checkFlags:this.Cr.bind(this),isSurveyFeatureFlagEnabled:this.br.bind(this),onLanguageChange:this.pr.bind(this),currentLanguage:this.ji,surveyIsRendered:this.Bi}}};function x_({survey:t,removeSurveyFromFocus:e=()=>{},setSurveyVisible:i,isPreviewMode:n=!1,posthog:s}){lm(()=>{var r;if(n||!(null===(r=t.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var n;const r=t.type===km.Widget,o=Fb(t,s),l=(null===(n=t.appearance)||void 0===n?void 0:n.widgetType)===bm.Tab&&r;if(!o)return Mm.info(`Hiding survey ${t.id} because URL does not match`),i(!1),e(t);l&&(Mm.info(`Showing survey ${t.id} because it is a feedback button tab and URL matches`),i(!0))};to(window,"popstate",o),to(window,"hashchange",o);const l=window.history.pushState,a=window.history.replaceState;return window.history.pushState=function(...t){l.apply(this,t),o()},window.history.replaceState=function(...t){a.apply(this,t),o()},()=>{window.removeEventListener("popstate",o),window.removeEventListener("hashchange",o),window.history.pushState=l,window.history.replaceState=a}},[n,t,e,i,s])}const $_=200;function T_(t=wm.Right){switch(t){case wm.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case wm.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case wm.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function C_({survey:t,forceDisableHtml:e,posthog:i,style:n={},previewPageIndex:s,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:l=()=>{},onPreviewBack:a=()=>{},onPopupSurveyDismissed:u=()=>{},onCloseConfirmationMessage:c=()=>{},properties:h,isSurveyCompleted:d,skipShownEvent:v,surveyLanguage:f}){var p,g,m,y,b,_,w,k,S,x,T,C;const E=am(null),M=Number.isInteger(s),{isPopupVisible:I,isSurveySent:R,hidePopupWithAnimation:A}=function(t,e,i,n,s,r,o,l,a){const[u,c]=om(n||0===i||t.type===km.ExternalSurvey),[h,d]=om(!1),v=am(!1),f=()=>{const e=()=>{r&&s(t),c(!1)};if(v.current)return;const i=null==o?void 0:o.current;i?(v.current=!0,i.style.transition=`opacity ${$_}ms ease-out`,i.style.opacity="0",setTimeout(()=>{v.current=!1,e()},250)):e()},p=e=>{e.detail.surveyId===t.id&&f()};return lm(()=>{if(!e)return void Mm.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=()=>{var i;if(Fb(t,e)){c(!0);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}window.dispatchEvent(new Event("PHSurveyShown")),l||null===(i=e.client)||void 0===i||i.capture(Tm.SHOWN,ue(ue({[Cm.SURVEY_NAME]:t.name,[Cm.SURVEY_ID]:t.id,[Cm.SURVEY_ITERATION]:t.current_iteration,[Cm.SURVEY_ITERATION_START_DATE]:t.current_iteration_start_date},a&&{[Cm.SURVEY_LANGUAGE]:a}),{},{sessionRecordingUrl:Wg(e)}))}};to(window,"PHSurveyClosed",p),to(window,"PHSurveySent",r);const u=i>0?setTimeout(o,i):void 0;return Ce(u)&&o(),()=>{Ce(u)||clearTimeout(u),Ce(s)||clearTimeout(s),window.removeEventListener("PHSurveyClosed",p),window.removeEventListener("PHSurveySent",r)}},[]),x_({survey:t,removeSurveyFromFocus:s,setSurveyVisible:c,isPreviewMode:n,posthog:e}),{isPopupVisible:u,isSurveySent:h,setIsPopupVisible:c,hidePopupWithAnimation:f}}(t,i,(null===(p=t.appearance)||void 0===p?void 0:p.surveyPopupDelaySeconds)?1e3*t.appearance.surveyPopupDelaySeconds:0,M,r,o,E,v,f),O=R||s===t.questions.length||!0===d,[P,F]=om(!1),L=um(()=>!!jb(t),[t]),D=!(!(null===(g=t.appearance)||void 0===g?void 0:g.introScreenHeader)&&!(null===(m=t.appearance)||void 0===m?void 0:m.introScreenDescription)),N=M?-1===s:!!(null===(y=t.appearance)||void 0===y?void 0:y.displayIntroScreen)&&D&&!P&&!L,j=um(()=>{const e=jb(t),n=(null==e?void 0:e.surveySubmissionId)||La()||"";return{isPreviewMode:M,previewPageIndex:s,onPopupSurveyDismissed(){f?Cb(t,i,M,f):Cb(t,i,M),u()},isPopup:o||!1,surveySubmissionId:n,onPreviewSubmit:l,onPreviewBack:a,posthog:i,properties:h,surveyLanguage:f}},[M,s,o,i,t,u,l,a,h,f]);return I?Ug(Ab.Provider,{value:j,children:Ug("div",{className:"ph-survey",style:ue(ue({},Ub(t.type,null===(b=t.appearance)||void 0===b?void 0:b.position,null===(_=t.appearance)||void 0===_?void 0:_.widgetType)),n),ref:E,children:O?Ug(n_,{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||bb,onClose(){A(),c()}}):N?Ug(s_,{header:(null===(x=t.appearance)||void 0===x?void 0:x.introScreenHeader)||"",description:(null===(T=t.appearance)||void 0===T?void 0:T.introScreenDescription)||"",forceDisableHtml:!!e,contentType:null===(C=t.appearance)||void 0===C?void 0:C.introScreenDescriptionContentType,appearance:t.appearance||bb,onStart:()=>F(!0)}):Ug(E_,{survey:t,forceDisableHtml:!!e,posthog:i})})}):null}function E_({survey:t,forceDisableHtml:e,posthog:i}){var n,s;const r=um(()=>{const e=jb(t);if(!e)return null;const i=Ae(e.lastQuestionIndex);return!i||i&&e.lastQuestionIndex>=0&&t.questions.length>e.lastQuestionIndex?e:(Bb(t),null)},[t]),[o,l]=om(()=>((null==r?void 0:r.responses)&&Mm.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[a,u]=om(!1),{previewPageIndex:c,onPopupSurveyDismissed:h,isPopup:d,onPreviewSubmit:v,onPreviewBack:f,surveySubmissionId:p,isPreviewMode:g,properties:m,surveyLanguage:y}=cm(Ab),[b,_]=om(()=>{const e=null==r?void 0:r.lastQuestionIndex,i=Ae(e)&&e>=0&&t.questions.length>e?e:0;return Ae(c)&&c>=0?c:i}),[w,k]=om(()=>{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]=om(()=>{var e;const i=jb(t);return null!==(e=null==i?void 0:i.questionSnapshots)&&void 0!==e?e:{}}),T=um(()=>Mb(Ib(t,r)),[t.id,r]),C=um(()=>{if(!T||new Set(T).size!==T.length)return Ib(t,r);const e=new Map(t.questions.map(t=>[t.id,t])),i=T.map(t=>e.get(t)).filter(t=>!!t);return i.length===T.length?i:t.questions},[T,t.questions,t,r]);lm(()=>{!g||Ce(c)||0>c||_(c)},[c,g]);const E=!!(null===(n=t.appearance)||void 0===n?void 0:n.allowGoBack)&&(g?(null!=c?c:0)>0:w.length>0),M=C.at(b);return M?Ug("form",{className:"survey-form",name:"surveyForm",children:[d&&!0!==(null===(s=t.appearance)||void 0===s?void 0:s.hideCancelButton)&&Ug(i_,{onClick(){h()}}),Ug("div",{className:"survey-box","data-question-index":b,children:[a&&Ug("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),I_({question:M,forceDisableHtml:e,displayQuestionIndex:b,appearance:t.appearance||bb,onSubmit:e=>(({res:e,displayQuestionIndex:n,questionId:s})=>{var r;if(!i)return void Mm.error("onNextButtonClick called without a PostHog instance.");if(!(null===(r=i.client)||void 0===r?void 0:r.canCapture))return void u(!0);if(u(!1),!s)return void Mm.error("onNextButtonClick called without a questionId.");const{responses:a,questionSnapshots:c}=function({responses:t,questionSnapshots:e={}},i,n,s){return{responses:ue(ue({},t),{},{[lu(i)]:n}),questionSnapshots:(null==s?void 0:s.id)?ue(ue({},e),{},{[s.id]:s.question}):e}}({responses:o,questionSnapshots:S},s,e,C[n]);l(a),x(c);const h=m_(t,n,e),d=h===xm.End,v=[...w,n];if(d||(k(v),_(h),Nb(t,{surveySubmissionId:p,responses:a,lastQuestionIndex:h,questionOrder:Mb(C),visitedIndices:v,surveyLanguage:y,questionSnapshots:c})),t.enable_partial_responses||d){const e=new Set(v.map(t=>{var e;return null===(e=C[t])||void 0===e?void 0:e.id}).filter(t=>!!t).map(t=>lu(t))),n=Object.fromEntries(Object.entries(a).filter(([t])=>e.has(t)));$b({responses:n,survey:t,surveySubmissionId:p,isSurveyCompleted:d,posthog:i,properties:m,surveyLanguage:y,questionSnapshots:c})}})({res:e,displayQuestionIndex:b,questionId:M.id}),onPreviewSubmit:v,initialValue:M.id?o[lu(M.id)]:void 0,canGoBack:E,onBack(){if(g)return void f();if(0===w.length)return;const e=w[w.length-1],i=w.slice(0,-1);k(i),_(e),Nb(t,{surveySubmissionId:p,responses:o,lastQuestionIndex:e,questionOrder:Mb(C),visitedIndices:i,surveyLanguage:y,questionSnapshots:S})}})]})]}):null}function M_({survey:t,forceDisableHtml:e,posthog:i,readOnly:n,surveyLanguage:s}){var r,o,l,a,u,c,h,d;const[v,f]=om(!0),[p,g]=om(!1),[m,y]=om({}),b=am(void 0),_=()=>{var t;(p||!i||n||(null===(t=i.client)||void 0===t?void 0:t.canCapture))&&g(!p)};if(lm(()=>{var e,s,r;if(!i)return void Mm.error("FeedbackWidget called without a PostHog instance.");if(n)return;"tab"===(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)&&y((r=null===(s=t.appearance)||void 0===s?void 0:s.position)&&r!==_m.Right&&r!==_m.NextToTrigger?{}:{top:"50%",bottom:"auto"});const o=e=>{var i;const n=e;(null===(i=n.detail)||void 0===i?void 0:i.surveyId)===t.id&&(Mm.info(`Received show event for feedback button survey ${t.id}`),y(n.detail.position||{}),_())};return to(window,__,o),()=>{Ce(b.current)||(clearTimeout(b.current),b.current=void 0),window.removeEventListener(__,o)}},[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.position,null===(l=t.appearance)||void 0===l?void 0:l.widgetSelector,null===(a=t.appearance)||void 0===a?void 0:a.borderColor]),x_({survey:t,setSurveyVisible:f,posthog:i}),!v)return null;const w=()=>{t.schedule!==$m.Always&&f(!1),Ce(b.current)||clearTimeout(b.current),b.current=setTimeout(()=>{b.current=void 0,g(!1)},200)};return Ug(wg,{children:["tab"===(null===(u=t.appearance)||void 0===u?void 0:u.widgetType)&&Ug("button",{className:"ph-survey-widget-tab "+((null===(c=t.appearance)||void 0===c?void 0:c.tabPosition)===wm.Top?"widget-tab-top":""),onClick:_,disabled:n,style:T_(null===(h=t.appearance)||void 0===h?void 0:h.tabPosition),children:(null===(d=t.appearance)||void 0===d?void 0:d.widgetLabel)||""}),p&&Ug(C_,{posthog:i,survey:t,forceDisableHtml:e,style:m,onPopupSurveyDismissed:w,onCloseConfirmationMessage:w,surveyLanguage:s})]})}const I_=({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 Sm.Open:return bg(o_,ue(ue({},u),{},{question:t,key:t.id}));case Sm.Link:return bg(l_,ue(ue({},u),{},{question:t,key:t.id}));case Sm.Rating:return bg(a_,ue(ue({},u),{},{question:t,key:t.id}));case Sm.SingleChoice:case Sm.MultipleChoice:return bg(c_,ue(ue({},u),{},{question:t,key:t.id}));default:return Mm.error(`Unsupported question type: ${t.type}`),null}},R_={GZipJS:"gzip-js",Base64:"base64"};function A_(t){let e=!0;return{dispose(){if(e){e=!1;const i=t();i&&xe(i.then)&&i.then(void 0,()=>{})}}}}var O_=class{on(t,e){return this.Zo[t]||(this.Zo[t]=[]),this.Zo[t].push(e),()=>{this.Zo[t]=this.Zo[t].filter(t=>t!==e)}}emit(t,e){for(const i of this.Zo[t]||[])i(e);for(const i of this.Zo["*"]||[])i(t,e)}constructor(){this.Zo={}}};function P_(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 F_=class{constructor(t){this.Gi=t,this.Ko=new Set,this.Yo=new Set,this.Xo=new O_,this.tl=(t,e)=>this.el(t,e)&&this.il(t,e)&&this.nl(t,e)&&this.sl(t,e),this.el=(t,e)=>!(null==e?void 0:e.event)||(null==t?void 0:t.event)===(null==e?void 0:e.event)}init(){var t,e;Ce(null===(t=this.Gi)||void 0===t?void 0:t.subscribeCapture)||(this.rl=null===(e=this.Gi)||void 0===e?void 0:e.subscribeCapture((t,e)=>{this.on(t,e)}))}dispose(){var t,e,i;null===(t=this.rl)||void 0===t||t.call(this),this.rl=void 0,null===(e=this.Gi)||void 0===e||null===(i=e.setElementSelectors)||void 0===i||i.call(e,new Set,this),this.Xo=new O_}register(t){var e,i;if(!Ce(null===(e=this.Gi)||void 0===e?void 0:e.subscribeCapture)&&(t.forEach(t=>{var e;this.Ko.add(t),null===(e=t.steps)||void 0===e||e.forEach(t=>{this.Yo.add((null==t?void 0:t.event)||"")})}),null===(i=this.Gi)||void 0===i?void 0:i.setElementSelectors)){const t=new Set;this.Ko.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.Gi.setElementSelectors(t,this)}}replace(t){this.Ko.clear(),this.Yo.clear(),this.register(t)}on(t,e){null!=e&&0!=t.length&&(this.Yo.has(t)||this.Yo.has(e.event))&&this.Ko.forEach(t=>{this.ll(e,t)&&this.Xo.emit("actionCaptured",t.name)})}al(t){this.onAction("actionCaptured",e=>t(e))}ll(t,e){if(null==(null==e?void 0:e.steps))return!1;for(const i of e.steps)if(this.tl(t,i))return!0;return!1}onAction(t,e){return this.Xo.on(t,e)}il(t,e){if(null==e?void 0:e.url){var i;let r=null==t||null===(i=t.properties)||void 0===i?void 0:i.$current_url;if(!(null==t?void 0:t.properties)||!("$current_url"in t.properties))try{var n,s;r=null===(n=this.Gi)||void 0===n||null===(s=n.getActionUrl)||void 0===s?void 0:s.call(n)}catch(t){return!1}if(!r||"string"!=typeof r)return!1;if(!P_(r,e.url,e.url_matching||"contains"))return!1}return!0}nl(t,e){return!!this.ul(t,e)&&!!this.cl(t,e)&&!!this.hl(t,e)}ul(t,e){var i;if(!(null==e?void 0:e.href))return!0;const n=this.dl(t);if(n.length>0)return n.some(t=>P_(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&&P_(function(t){const e=t.match(/(?::|")href="(.*?)"/);return e?e[1]:""}(s),e.href,e.href_matching||"exact")}cl(t,e){var i;if(!(null==e?void 0:e.text))return!0;const n=this.dl(t);if(n.length>0)return n.some(t=>P_(t.text,e.text,e.text_matching||"exact")||P_(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=>P_(t,o,l)));var r,o,l}hl(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}dl(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}sl(t,e){return!(null==e?void 0:e.properties)||0===e.properties.length||ku(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)}},L_=class{constructor(t,e){this.vl=e,this.fl=[],this.Gi=t,this.pl=new Map,this.gl=new Map,this.ml=new Map}yl(){var t,e;this.bl=null===(t=(e=this.Gi).subscribeSession)||void 0===t?void 0:t.call(e,t=>this._l(t))}wl(t){return!1}kl(){return null}Sl(t){}xl(){}$l(t,e){return!!t&&ku(t.propertyFilters,null==e?void 0:e.properties)}Cl(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}Tl(t,e,i){const n=(i===ym.Activation?this.pl:this.gl).get(t);let s=[];return this.Ml(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.$l(r,e)})}register(t){this.Il(t,!1)}replace(t){this.Il(t,!0)}Il(t,e){Ce(this.Gi.subscribeCapture)||(this.El(t,e),this.Al(t,e))}Al(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.ml.clear(),0===i.length)return void(e&&(null===(n=this.Rl)||void 0===n||n.replace([])));this.Rl||(this.Rl=new F_(this.Gi),this.Rl.init(),this.Rl.al(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.ml.get(e.name))&&void 0!==i?i:[];n.includes(t.id)||n.push(t.id),this.ml.set(e.name,n)}})}),e?this.Rl.replace(s):this.Rl.register(s)}Pl(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)})}El(t,e){var i,n,s;const r=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}),o=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}),l=this.Cl(t,ym.Activation),a=this.Cl(t,ym.Cancellation);e?(this.pl=l,this.gl=a):(this.Pl(this.pl,l),this.Pl(this.gl,a)),(0!==r.length||0!==o.length||t.some(t=>{var e;return null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length}))&&(null!==(i=this.rl)&&void 0!==i||(this.rl=null===(n=(s=this.Gi).subscribeCapture)||void 0===n?void 0:n.call(s,(t,e)=>{this.onEvent(t,e)})))}onEvent(t,e){var i,n;const s=this.Ol(),r=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$survey_id)||(null==e||null===(n=e.properties)||void 0===n?void 0:n.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const i=this.Fl(t,r,e);if("consume"===i)return s.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.Ll([r]);if("persist"===i)return s.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.Dl(r),void this.Nl([r])}if(this.gl.has(t)){const i=this.Tl(t,e,ym.Cancellation);i.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:i.map(t=>t.id)}),this.Ll(i.map(t=>t.id)),i.forEach(t=>this.jl(t.id)))}if(!this.pl.has(t))return;s.info("event name matched",{event:t,eventPayload:e,items:this.pl.get(t)});const o=this.Tl(t,e,ym.Activation);this.ql(o.map(t=>t.id))}onAction(t){this.ml.has(t)&&this.ql(this.ml.get(t)||[])}ql(t){if(0===t.length)return;const e=!!this.Gi.getSessionId(),i=[];for(const n of t)e&&this.wl(n)?this.Dl(n)&&this.Bl(n):i.push(n);i.length>0&&(this.fl=[...new Set([...this.fl,...i])]),this.Ol().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.zl()}Dl(t){this.fl=this.fl.filter(e=>e!==t);const e=this.Hl();return!e.includes(t)&&(this.Ul([...e,t]),this.Wl(),!0)}Ll(t){const e=new Set(t);this.fl=this.fl.filter(t=>!e.has(t));const i=this.Vl(),n=i.filter(t=>!e.has(t));n.length!==i.length&&(this.Ul(n),0===n.length&&this.Gl()),this.Nl(t),this.zl()}zl(){try{var t;null===(t=this.vl)||void 0===t||t.call(this)}catch(t){this.Ol().error("Error while handling activated items change",t)}}Jl(){const t=this.kl();if(!t)return{};const e=this.Gi.getProperty(t);return e&&"object"==typeof e?e:{}}Bl(t){if(!this.kl())return;const e=this.Jl();this.Sl(ue(ue({},e),{},{[t]:Date.now()}))}Nl(t){if(!this.kl())return;const e=this.Jl(),i={};let n=!1;for(const[s,r]of Object.entries(e))t.includes(s)?n=!0:i[s]=r;n&&(Te(i)?this.xl():this.Sl(i))}Ql(){this.kl()&&this.xl()}getActivationTimestamp(t){if(!this.Hl().includes(t))return;const e=this.Jl()[t];return Ae(e)?e:void 0}Vl(){const t=this.Zl();return this.Gi.getProperty(t)||[]}Hl(){const t=this.Vl();if(0===t.length)return[];const e=this.Gi.getProperty(this.Kl()),i=this.Gi.getSessionId();return i&&e===i?t:[]}Wl(){const t=this.Gi.getSessionId();t&&this.Yl(t)}Gl(){this.Xl()}_l(t){const e=this.Gi.getProperty(this.Kl());if(e&&e!==t){const t=this.Vl(),e=this.Jl();t.length>0&&(this.Ul([]),t.filter(t=>Ae(e[t])).forEach(t=>this.jl(t))),this.Gl(),this.Ql(),t.length>0&&this.zl()}}getActivatedIds(){return[...new Set([...this.Hl(),...this.fl])].filter(t=>!this.ta(t))}dispose(){var t,e,i;null===(t=this.bl)||void 0===t||t.call(this),this.bl=void 0,null===(e=this.rl)||void 0===e||e.call(this),this.rl=void 0,null===(i=this.Rl)||void 0===i||i.dispose(),this.Rl=void 0}reset(){this.fl=[],this.Vl().length>0&&this.Ul([]),this.Gl(),this.Ql(),this.zl()}getEventToItemsMap(){return this.pl}ea(){return this.Rl}},D_=class extends L_{constructor(t,e,i,n){var s;super({subscribeCapture(e){const i=t.onEvent(t=>e(t.event,t));return()=>i.dispose()},subscribeSession(e){const i=t.onSession(e);return()=>i.dispose()},getSessionId(){var e;return null===(e=t.session)||void 0===e?void 0:e.sessionId},getProperty:e=>t.kv.get(e),getActionUrl:null==i?void 0:i.getActionUrl,setElementSelectors:null!==(s=null==i?void 0:i.setElementSelectors)&&void 0!==s?s:(e,i)=>{var n;return null===(n=t.getExtension("autocapture"))||void 0===n?void 0:n.setElementSelectors(e,i)}},n),this.ia=t,this.na=e,this.yl()}Zl(){return O}Kl(){return P}kl(){return F}Sl(t){this.ia.kv.set({[F]:t})}xl(){this.ia.kv.remove(F)}wl(t){var e;let i;this.Ml(e=>{i=e.find(e=>e.id===t)});const n=null==i||null===(e=i.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds;return Ae(n)&&n>0}sa(){return Tm.SHOWN}Ml(t){this.na.getSurveys(t)}jl(t){this.na.cancelPendingSurvey(t)}Ol(){return Mm}Ul(t){this.ia.kv.set({[O]:t})}Yl(t){this.ia.kv.set({[P]:t})}Xl(){this.ia.kv.remove(P)}ta(){return!1}Fl(t,e,i){var n;if(t===Tm.SENT&&!1===(null==i||null===(n=i.properties)||void 0===n?void 0:n.$survey_completed))return"ignore";let s;return this.Ml(t=>{s=t.find(t=>t.id===e)}),!s||yu(s)?t===Tm.SHOWN?"consume":"ignore":t===Tm.SHOWN?"persist":t===Tm.DISMISSED||t===Tm.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}};const N_=(t,e)=>(null==t?void 0:t.then)?t.then(e):e(t),j_="SDK is not enabled or survey functionality is not yet loaded",q_="Disabled. Not loading surveys.";var B_=class{constructor(t){this.ra=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.oa=!1,this.la=!1,this.aa=[],this.ua=[],this.ca=null,this.ha=null,this.qi=!1,this.da=new Set,this.onRemoteConfig=t=>{if(this.qi)return;if(this.Yr.disableSurveys)return;if(!t.ok)return this.la=!0,this.va({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),Mm.warn("Remote config unavailable. Not loading surveys.");const e=t.config.surveys;if(Re(e))return Mm.warn("Flags not loaded yet. Not loading surveys.");this.fa=Pe(e)?e:e.length>0,Mm.info(`flags response received, isSurveysEnabled: ${this.fa}`),this.loadIfEnabled()},this.va=t=>{this.ua.slice().forEach(e=>this.pa(e,t))}}setup(t){if(!this.qi)return this.ga=t,N_(t.kv.initialize(),()=>{if(this.ga!==t||this.qi)return;this.ga=void 0,this.ia=t;const e=t.onRemoteConfig(this.onRemoteConfig);this.qi?e.dispose():(this.ma=e,this.loadIfEnabled())})}dispose(){var t,e,i,n,s;this.qi||(this.qi=!0,this.ga=void 0,this.ia=void 0,null===(t=this.ma)||void 0===t||t.dispose(),this.ma=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.aa=[],this.ua.forEach(t=>{t.active=!1}),this.ua=[],null===(s=this.ya)||void 0===s||s.call(this),this.ya=void 0,this.ca=null,this.da.forEach(t=>clearTimeout(t)),this.da.clear())}get Yr(){return this.ra.get()}getRenderContext(){if(!this.ia)return;const t=this;return{client:this.ia,get config(){return t.Yr},surveys:t}}initialize(){this.loadIfEnabled()}reset(){var t,e;null===(t=this._surveyManager)||void 0===t||null===(e=t.clearInMemoryInProgressSurveyState)||void 0===e||e.call(t);try{var i;null===(i=this._surveyEventReceiver)||void 0===i||i.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let e=0;e<localStorage.length;e++){const i=localStorage.key(e);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&t.push(i)}t.forEach(t=>localStorage.removeItem(t))}catch(t){}this.va()}loadIfEnabled(){if(this.qi||!this.ia)return;const t=this.Yr;if(this._surveyManager)return;if(this.oa)return void Mm.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Mm.info(q_);if(t.cookielessMode&&this.ia.isOptedOut)return void Mm.info("Not loading surveys in cookieless mode without consent.");const e=this.ra.getExtensions();if(!e)return void this.ba("PostHog Extensions not found.");if(Ce(this.fa)&&!t.advancedEnableSurveys)return;const i=this.fa||t.advancedEnableSurveys;this.oa=!0,this.la=!1;try{const t=e.generateSurveys;if(t)return this._a(t,i),void(this.oa=!1);const n=e.loadExternalDependency;if(!n)return this.ba(A),void(this.oa=!1);n(t=>{try{if(this.qi)return;const e=this.ra.getExtensions();t||!(null==e?void 0:e.generateSurveys)?this.ba("Could not load surveys script",t):this._a(e.generateSurveys,i)}finally{this.oa=!1}})}catch(t){throw this.oa=!1,this.ba("Error initializing surveys",t),t}}_a(t,e){var i;if(this.qi)return;this._surveyManager=t(e),this._surveyEventReceiver=this.wa(this.ia,this.va);const n=null===(i=this.ia)||void 0===i?void 0:i.kv.get(I);n&&this.ka(n),Mm.info("Surveys loaded successfully"),this.Sa(),this.va(),this.xa({isLoaded:!0})}wa(t,e){return new D_(t,this,void 0,e)}ba(t,e){this.la=!0,Mm.error(t,e),this.va({isLoaded:!1,error:t}),this.xa({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.aa.push(t),this._surveyManager&&this.xa({isLoaded:!0}),()=>{this.aa=this.aa.filter(e=>e!==t)}}getSurveys(t,e=!1){if(this.qi)return;const i=this.ia;if(!i)return t([],{isLoaded:!1,error:j_});if(this.Yr.disableSurveys)return Mm.info(q_),t([]);const n=i.kv.get(I);if(n&&!e)return t(n,{isLoaded:!0}),void(this.$a()&&this.getSurveys(()=>{},!0));if(this.ca)return void this.ca.then(({surveys:e,context:i})=>{this.qi||t(e,i)}).catch(t=>Mm.error("Error in survey callback",t));const s=i.sendRequest("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Yr.requestTimeoutMs}).then(t=>{try{return this.Ca(i,t)}catch(t){return Mm.error("Error processing surveys response",t),this.Ca(i,{statusCode:0,error:t})}},t=>this.Ca(i,{statusCode:0,error:t}));this.ca=s;const r=()=>{this.ca===s&&(this.ca=null)};s.then(e=>{r(),this.qi||(this.va(e.context),t(e.surveys,e.context))},r).catch(t=>Mm.error("Error in survey callback",t))}Ca(t,e){if(this.qi)return{surveys:[],context:{isLoaded:!1,error:j_}};const i=e.statusCode;if(200!==i||!e.json){const t=`Surveys API could not be loaded, status: ${i}`;return 0!==i?Mm.error(t):e.error||Mm.warn(t),this.ha=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.ha=null;const n=e.json.surveys||[];return t.kv.set({[I]:n,[R]:Date.now()}),this.ka(n),{surveys:n,context:{isLoaded:!0}}}ka(t){const e=t.filter(t=>Rm(t)&&(mu(t)||Am(t)));this.Ta(e)}Ta(t){var e;null===(e=this._surveyEventReceiver)||void 0===e||e.replace(t)}$a(){return this.Ma()&&!this.ca&&!this.Ia()}Ma(){var t;const e=null===(t=this.ia)||void 0===t?void 0:t.kv.get(R);return Ae(e)&&Date.now()-e>3e5}Ia(){return Ae(this.ha)&&3e5>Date.now()-this.ha}markSurveyAsSeen(t,e){var i;const n={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};Fm(n);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}this.va()}xa(t){for(const e of this.aa){if(this.qi)return;try{t.isLoaded?this.getSurveys(e):e([],t)}catch(t){Mm.error("Error in survey callback",t)}}}getActiveMatchingSurveys(t,e=!1){if(!Re(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Mm.warn("init was not called")}onActiveMatchingSurveysChanged(t){var e;if(this.qi)return()=>{};const i={callback:t,active:!0,revision:0};this.ua.push(i),this.Sa();const n=null===(e=this.ia)||void 0===e?void 0:e.kv.get(I);return this.Yr.disableSurveys||!this._surveyManager&&this.la&&!this.oa||!n&&!Re(this.ha)&&!this.ca?this.pa(i,{isLoaded:!1}):this._surveyManager&&this.pa(i),()=>{var t;i.active=!1,this.ua=this.ua.filter(t=>t!==i),0===this.ua.length&&(null===(t=this.ya)||void 0===t||t.call(this),this.ya=void 0)}}Sa(){var t,e,i;this._surveyManager&&this.ua.length>0&&(null!==(t=this.ya)&&void 0!==t||(this.ya=null===(e=(i=this.ra).onMatchingConditionsChanged)||void 0===e?void 0:e.call(i,this.va)))}pa(t,e){if(this.qi||!t.active)return;const i=++t.revision,n=n=>{if(!this.qi&&t.active&&i===t.revision)try{const i=null!=e?e:{isLoaded:!0},s=JSON.stringify([n,i]);if(s===t.lastResult)return;t.lastResult=s,t.callback(n,i)}catch(t){Mm.error("Error in active matching surveys callback",t)}};try{e&&!e.isLoaded?n([]):this.getActiveMatchingSurveys(n)}catch(t){Mm.error("Error in active matching surveys callback",t)}}Ea(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}Aa(t){if(Re(this._surveyManager))return{eligible:!1,reason:j_};const e="string"==typeof t?this.Ea(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Ra(t){var e;if(!(null===(e=this.ia)||void 0===e?void 0:e.canCapture))return{eligible:!1,reason:Im};if(Re(this._surveyManager))return{eligible:!1,reason:j_};const i="string"==typeof t?this.Ea(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Re(this._surveyManager))return Mm.warn("init was not called"),{visible:!1,disabledReason:j_};const e=this.Ra(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Re(this._surveyManager)?(Mm.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:j_})):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.Ra(s);i({visible:t.eligible,disabledReason:t.reason})}else i({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,i){var n,s,r;if(!(null===(n=this.ia)||void 0===n?void 0:n.canCapture))return;if(Re(this._surveyManager))return void Mm.warn("init was not called");const o="string"==typeof t?this.Ea(t):t;if(!(null==o?void 0:o.id))return void Mm.warn("Survey not found");if(!Lm.includes(o.type))return void Mm.warn(`Surveys of type ${o.type} cannot be rendered in the app`);const l=null===(s=typeof document>"u"?void 0:document)||void 0===s?void 0:s.querySelector(e);if(l){if(null===(r=o.appearance)||void 0===r?void 0:r.surveyPopupDelaySeconds){Mm.info(`Rendering survey ${o.id} with delay of ${o.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var e,n,s;this.da.delete(t),!this.qi&&(null===(e=this.ia)||void 0===e?void 0:e.canCapture)&&(Mm.info(`Rendering survey ${o.id} with delay of ${null===(n=o.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds} seconds`),null===(s=this._surveyManager)||void 0===s||s.renderSurvey(o,l,i),Mm.info(`Survey ${o.id} rendered`))},1e3*o.appearance.surveyPopupDelaySeconds);return void this.da.add(t)}this._surveyManager.renderSurvey(o,l,i)}else Mm.warn("Survey element not found")}displaySurvey(t,e){var i,n;if(!(null===(i=this.ia)||void 0===i?void 0:i.canCapture))return;if(Re(this._surveyManager))return void Mm.warn("init was not called");const s=this.Ea(t);if(!s)return void Mm.warn("Survey not found");let r=s;if((null===(n=s.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)&&e.ignoreDelay&&(r=ue(ue({},s),{},{appearance:ue(ue({},s.appearance),{},{surveyPopupDelaySeconds:0})})),e.displayType!==Em.Popover&&e.initialResponses&&Mm.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){const t=this.Aa(s);if(!t.eligible)return void Mm.warn("Survey is not eligible to be displayed: ",t.reason)}e.displayType!==Em.Inline?this._surveyManager.handlePopoverSurvey(r,e):this.renderSurvey(r,e.selector,e.properties)}cancelPendingSurvey(t){Re(this._surveyManager)?Mm.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)}},z_=class{constructor(t){this.disabled=!1===t;const e=$e(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;const n=this.clicks[this.clicks.length-1];if(n&&Math.abs(t-n.x)+Math.abs(e-n.y)<this.thresholdPx&&this.timeoutMs>i-n.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}};const U_=()=>typeof window>"u"?void 0:window,H_=()=>typeof document>"u"?void 0:document,W_="$copy_autocapture",V_=["password","hidden","file","checkbox","button","submit","reset","image"],G_=Hr("[AutoCapture]");function J_(t,e){return e.length>t?e.slice(0,t)+"...":e}function Q_(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do{e=e.previousSibling}while(e&&!go(e));return e}function Z_(t,{e:e,maskAllElementAttributes:i,maskAllText:n,elementAttributeIgnoreList:s,elementsChainAsString:r,disableCaptureUrlHashes:o}){var l,a;if(!go(t))return{props:{}};const u=[t],c=new Set([t]);let h=t;for(;!mo(h,"body")&&1e3>u.length;){const t=h.assignedSlot||h.parentNode,e=bo(t)?t.host:t&&go(t)?t:null;if(!e||c.has(e))break;c.add(e),u.push(e),h=e}const d="click"===e.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?u.findIndex(t=>mo(t,"button")||mo(t,"a")):-1;d>0&&(n=n||u.slice(0,d+1).some(t=>!Go(t)||Jo(t)));const v=[],f={};let p,g=!1,m=!1;if(Vr(u,t=>{const e=Go(t);if(e&&mo(t,"a")&&!i&&!(null==s?void 0:s.includes("href"))){const i=t.getAttribute("href");g=!!(e&&i&&il(i))&&(o?un(i):i)}ge(ko(t),"ph-no-capture")&&(m=!0),v.push(function(t,e,i,n,s=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};To.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?J_(1024,nl(t)):J_(1024,xo(t)));const l=ko(t);e||(null==n?void 0:n.includes("class"))||0>=l.length||(o.classes=l.filter(function(t){return""!==t})),Vr(Vo(t)?[]:t.attributes,function(i){var r;if((!Jo(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==n?void 0:n.includes(i.name))&&!e&&il(i.value)&&(!Ee(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=i.value;"class"===i.name&&(t=_o(t).join(" ")),o["attr__"+i.name]=J_(1024,"href"===i.name&&s?un(t):t)}});let a=1,u=1,c=t;for(;c=Q_(c);)a++,c.tagName===t.tagName&&u++;return o.nth_child=a,o.nth_of_type=u,o}(t,i,n,s,o)),Vr(function(t){if(!Go(t))return{};const e={};return Vr(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&&il(n)&&(e[i]=n)}}),e}(t),(t,e)=>{({}).hasOwnProperty.call(f,e)||(f[e]=t)})}),m)return{props:{},explicitNoCapture:m};if(d>0&&(t=u[d],v.splice(0,d)),n||(v[0].$el_text=mo(t,"a")||mo(t,"button")?nl(t):xo(t)),g){var y,b;v[0].attr__href=g;const t=null===(y=io(g))||void 0===y?void 0:y.host,e=null===(b=U_())||void 0===b||null===(b=b.location)||void 0===b?void 0:b.host;t&&e&&t!==e&&(p=g)}return{props:Gr((w=e.type,{$event_type:w,$ce_version:1}),r?{}:{$elements:v},{$elements_chain:(_=v,Se(_)?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 Jr(s).sort(([t],[e])=>function(t,e){return e>t?-1:t>e?1:0}(t,e)).forEach(([t,e])=>r[rl(t.toString())]=rl(e.toString())),n+=":",n+=Jr(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:ol(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Jr(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,e])=>n.attributes[t]=e),n})}(_)):"")},(null===(l=v[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(a=v[0])||void 0===a?void 0:a.$el_text}:{},p&&"click"===e.type?{$external_click_url:p}:{},f),target:t};var _,w}const K_="autocapture";var Y_=class{Pa(){this.Oa=void 0,clearTimeout(this.Fa),this.Fa=void 0}La(t){var e;if(!Go(t))return!0;const i=null!==(e=this.Da().css_selector_ignorelist)&&void 0!==e?e:Io,n=new Set;let s=t;for(;s;){if(n.size>=1e3||n.has(s))return!0;n.add(s);const t=s,e=ko(t);if(ge(e,"ph-no-capture")||ge(e,"ph-sensitive")||Jo(t)||i.some(e=>Co(t,e)))return!0;const r=s.assignedSlot||s.parentNode;s=bo(r)?r.host:r&&go(r)?r:null}return!1}Na(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.Pa();if("pointerdown"===t.type){var e;this.Pa();const i=$o(t);return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&i&&go(i)&&(this.Oa={target:i,excluded:this.La(i),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(e=this.ia)||void 0===e?void 0:e.distinctId}))}const i=this.Oa;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.Pa():"pointerup"===t.type&&(i.released=!0,this.Fa=setTimeout(()=>this.Pa(),0)))}ja(t){var e;const i=this.Oa;this.Pa();const n=$o(t);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(e=this.ia)||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)&&n&&(mo(n,"html")||mo(n,"body"))){var s,r,o;if(i.excluded)return null;const t=null!==(s=this.Da().css_selector_ignorelist)&&void 0!==s?s:Io;return[n,null===(r=H_())||void 0===r?void 0:r.documentElement,null===(o=H_())||void 0===o?void 0:o.body].some(e=>{if(!e)return!1;const i=ko(e);return ge(i,"ph-no-capture")||ge(i,"ph-sensitive")||!Go(e)||Jo(e)||t.some(t=>Co(e,t))})?null:i.target}}constructor(t){this.ra=t,this.name=K_,this.qa=!1,this.Ba=null,this.za=!1,this.Ha=new Map,this.Ua=!1,this.Yr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.qi=!1,this.ra.refresh(this.Yr),this.rageclicks=new z_(this.Yr.rageclick),this.Wa=null}setup(t){this.Va(),this.ia=t;const e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.qi?e.dispose():(this.ma=e,this.startIfEnabled())}dispose(){var t;this.qi||(this.qi=!0,this.ia=void 0,null===(t=this.ma)||void 0===t||t.dispose(),this.ma=void 0,this.Ha.clear(),this.Wa=null,this.Ga())}Da(){return this.ra.refresh(this.Yr),this.Yr}Va(){var t,e;return this.Da(),this.Yr.url_allowlist=null===(t=this.Yr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Yr.url_ignorelist=null===(e=this.Yr.url_ignorelist)||void 0===e?void 0:e.map(t=>new RegExp(t)),this.Yr}Ja(){const t=U_(),e=H_();if(!this.isBrowserSupported())return void G_.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!e)return;this.Qa=t,this.Za=e;const i=this.Ka=e=>{e=e||(null==t?void 0:t.event);try{if("blur"===e.type)return void this.Pa();if(0===e.type.indexOf("pointer"))return void this.Na(e);const t="click"===e.type?this.ja(e):void 0;if(Ie(t))return;this.Ya(e,"$autocapture",t)}catch(t){G_.error("Failed to capture event",t)}};if(to(t,"blur",i),to(e,"submit",i,{capture:!0}),to(e,"change",i,{capture:!0}),to(e,"click",i,{capture:!0}),Vr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{to(e,t,i,{capture:!0})}),this.Da().capture_copied_text){const i=this.Xa=e=>{e=e||(null==t?void 0:t.event);try{this.Ya(e,W_)}catch(t){G_.error("Failed to capture clipboard event",t)}};to(e,"copy",i,{capture:!0}),to(e,"cut",i,{capture:!0}),to(e,"paste",i,{capture:!0})}}Ga(){const t=this.Qa,e=this.Za;this.Pa(),this.Ka&&(null==t||t.removeEventListener("blur",this.Ka),Vr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==e||e.removeEventListener(t,this.Ka,!0)}),null==e||e.removeEventListener("submit",this.Ka,!0),null==e||e.removeEventListener("change",this.Ka,!0),null==e||e.removeEventListener("click",this.Ka,!0),this.Ka=void 0),this.Xa&&(null==e||e.removeEventListener("copy",this.Xa,!0),null==e||e.removeEventListener("cut",this.Xa,!0),null==e||e.removeEventListener("paste",this.Xa,!0),this.Xa=void 0),this.Qa=void 0,this.Za=void 0,this.qa=!1}startIfEnabled(){this.isEnabled||this.Pa(),!this.qi&&this.ia&&this.isEnabled&&!this.qa&&(this.Ja(),this.qa=!0)}onRemoteConfig(t){if(this.qi)return;if(this.za=!0,!t.ok)return void this.startIfEnabled();const e=t.config;e.elementsChainAsString&&(this.Ua=e.elementsChainAsString);const i=e.autocapture_opt_out;var n;Pe(i)&&(null===(n=this.ia)||void 0===n||n.kv.set("$autocapture_disabled_server_side",i),this.Ba=i),this.startIfEnabled()}setElementSelectors(t,e=this){if(this.qi)return;t.size?this.Ha.set(e,new Set(t)):this.Ha.delete(e);const i=new Set;this.Ha.forEach(t=>{t.forEach(t=>i.add(t))}),this.Wa=i}getElementSelectors(t,e){var i;const n=[];return null===(i=this.Wa)||void 0===i||i.forEach(i=>{var s;const r=null===(s=H_())||void 0===s?void 0:s.querySelectorAll(i);null==r||r.forEach(s=>{t!==s&&e!==s||ge(n,i)||n.push(i)})}),n}get isEnabled(){var t,e;if(this.qi)return!1;const i=null===(t=this.ia)||void 0===t?void 0:t.kv.get(M),n=this.Ba,s=this.Da();if(!s.remoteRequestsDisabled&&!this.za)return!1;const r=s.remoteRequestsDisabled&&!this.za;if(Ie(n)&&!Pe(i)&&!r)return!1;const o=null!==(e=this.Ba)&&void 0!==e?e:!!i;return!!s.enabled&&!o}Ya(t,e="$autocapture",i){if(!this.isEnabled)return void this.Pa();let n=i||$o(t);yo(n)&&(n=n.parentNode||null);const s=this.Va();var r;"$autocapture"===e&&"click"===t.type&&t instanceof MouseEvent&&s.rageclick&&(null===(r=this.rageclicks)||void 0===r?void 0:r.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime()))&&Uo(n,s.rageclick)&&this.Ya(t,"$rageclick",i);const o=e===W_,l=o?ue(ue({},s),{},{dom_event_allowlist:void 0}):s;if(n&&function(t,e,i,n,s,r){var o;const l=typeof window>"u"?void 0:window;if(!l||Ho(t))return!1;if((null==i?void 0:i.url_allowlist)&&!wo(i.url_allowlist,r))return!1;if((null==i?void 0:i.url_ignorelist)&&wo(i.url_ignorelist,r))return!1;if(null==i?void 0:i.dom_event_allowlist){const t=i.dom_event_allowlist;if(t&&!t.some(t=>e.type===t))return!1}const{parentIsUsefulElement:a,targetElementList:u,isComplete:c}=Wo(t,n);if(!c)return!1;if(!function(t,e){const i=null==e?void 0:e.element_allowlist;if(Ce(i))return!0;for(const e of t)if(i.some(t=>e.tagName.toLowerCase()===t))return!0;return!1}(u,i))return!1;if(!Eo(u,null==i?void 0:i.css_selector_allowlist))return!1;if(Eo(u,null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Io))return!1;try{const i=l.getComputedStyle(t);if(i&&"pointer"===i.getPropertyValue("cursor")&&"click"===e.type)return!0}catch(t){}const h=t.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return a?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(To.indexOf(h)>-1||"true"===t.getAttribute("contenteditable"))}}(n,t,l,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:s.getCurrentUrl}})){var a;const{props:i,explicitNoCapture:r,target:o}=Z_(n,{e:t,maskAllElementAttributes:s.maskAllElementAttributes,maskAllText:s.maskAllText,elementAttributeIgnoreList:s.element_attribute_ignorelist,elementsChainAsString:this.Ua,disableCaptureUrlHashes:s.disableCaptureUrlHashes});if(r)return!1;const l=this.getElementSelectors(n,o);if(l&&l.length>0&&(i.$element_selectors=l),e===W_){const e=t.type||"clipboard";if("paste"!==e){var u,c;const t=null===(u=U_())||void 0===u||null===(u=u.getSelection())||void 0===u?void 0:u.toString(),e=So(t);if(!e)return!1;i.$selected_content=e,i.$clipboard_text_length=null!==(c=null==t?void 0:t.length)&&void 0!==c?c:0}i.$copy_type=e}if("$autocapture"===e&&"change"===t.type&&s.capture_value_css_selector_allowlist&&!s.maskAllText&&(mo(h=n,"input")?!ge(V_,h.type):mo(h,"textarea")||mo(h,"select")&&!h.multiple)&&function(t,e){var i;if(!Go(t))return!1;const n=null!==(i=e.css_selector_ignorelist)&&void 0!==i?i:Io,s=new Set;let r=t;for(mo(t,"select")&&(r=t.options[t.selectedIndex]||t);r;){const t=r,e=ko(t);if(s.size>=1e3||s.has(r)||ge(e,"ph-sensitive")||ge(e,"ph-no-capture")||n.some(e=>Co(t,e)))return!1;s.add(r);const i=r.assignedSlot||r.parentNode;r=bo(i)?i.host:i&&go(i)?i:null}return!0}(n,s)&&!n.querySelector(".ph-no-capture, .ph-sensitive")){const t=s.capture_value_css_selector_allowlist;let e=!1;try{e=xe(t)?!!t(n):Se(t)&&t.some(t=>Co(n,t))}catch(t){G_.error("capture_value_css_selector_allowlist threw",t)}e&&(i.$input_value=n.value)}return null===(a=this.ia)||void 0===a||a.capture(e,i),!0}var h}isBrowserSupported(){var t;return xe(null===(t=H_())||void 0===t?void 0:t.querySelectorAll)}};const X_="featureFlags",tw="logs",ew=!!o||!!r,iw=new WeakMap,nw="text/plain";let sw=0,rw=!1;const ow=(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}`:""}`},lw=(t,e,i=!0)=>{const n=t.indexOf("#"),s=-1===n?"":t.slice(n),r=-1===n?t:t.slice(0,n),o=r.indexOf("?"),l=-1===o?r:r.slice(0,o),a=-1===o?"":r.slice(o+1),u=ue({},e),c=a.split("&").filter(t=>""!==t).map(t=>{const e=t.indexOf("="),n=-1===e?t:t.slice(0,e),s=i?u[n]:void 0;return delete u[n],Re(s)?t:`${n}=${s}`}),h=ao(u);return h&&c.push(h),`${c.length>0?`${l}?${c.join("&")}`:l}${s}`},aw=t=>{if(t.Mr)return t.Mr;const{data:e,compression:i}=t;if(!e)return;if(i===R_.GZipJS){const t=$a(Ta(lo(e)),{mtime:0});return{contentType:nw,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(i===R_.Base64){const i=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(lo(e)),n="sendBeacon"===t.transport,s=n?i:(t=>"data="+encodeURIComponent("string"==typeof t?t:lo(t)))(i);return{contentType:n?nw:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}const n=lo(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}},uw=t=>{const e=()=>"sendBeacon"===t.transport?{url:lw(t.url,{compression:R_.Base64}),encodedBody:aw(ue(ue({},t),{},{compression:R_.Base64,Mr:void 0}))}:{url:ow(t.url,"compression"),encodedBody:aw(ue(ue({},t),{},{compression:void 0,Mr:void 0}))};let i;try{i=aw(t)}catch(i){if(hs(t.compression,uo(t.url,"compression")))return Ur.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return i&&hs(t.compression,uo(t.url,"compression"))&&!((n=i.body)instanceof ArrayBuffer?cs(new Uint8Array(n)):ArrayBuffer.isView(n)&&cs(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(rw=!0,e()):{url:t.url,encodedBody:i};var n},cw=t=>{try{return uw(t)}catch(i){var e;return Ur.error(i),void(null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))}},hw=function(){var t=re(function*(t){const e=yield bs(lo(t.data),su.DEBUG,{rethrow:!0});if(!e)return t;const i=yield e.arrayBuffer();return ue(ue({},t),{},{Mr:{contentType:nw,body:i,estimatedSize:i.byteLength}})});return function(e){return t.apply(this,arguments)}}(),dw=t=>an("AbortError","PostHog request timed out"+(t?` after ${t}ms`:"")),vw=/Failed to fetch|NetworkError|Load failed/i,fw=t=>"TypeError"===(null==t?void 0:t.name)&&vw.test((null==t?void 0:t.message)||""),pw=t=>{try{const e=function(t,e=Date.now(),i=3e5){if("string"!=typeof t||!t)return;const n=t.trim(),s=/^\d+\s*,/.test(n)?n.slice(0,n.indexOf(",")).trim():n;if(/^\d+$/.test(s)){const t=1e3*Math.min(Number(s),i/1e3);return t>0?t:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(s))return;const r=/^\w{3} \w{3} /.test(s)?s+" GMT":s,o=Date.parse(r)-e;return Number.isFinite(o)&&o>0?Math.min(o,i):void 0}(t());return Ce(e)?void 0:Math.min(e,3e4)}catch(t){return}},gw=t=>{var e;const i=cw(t);if(!i)return;const n=new o;iw.set(n,!0);const{url:s,encodedBody:r}=i;n.open(t.method||"GET",s,!0);const{contentType:l,body:a}=null!=r?r:{};Vr(t.headers,function(t,e){n.setRequestHeader(e,t)}),l&&n.setRequestHeader("Content-Type",l),t.timeout&&(n.timeout=t.timeout);let u=!1;n.ontimeout=()=>{u=!0},n.onloadend=()=>{var e;if(u){var i;const e=dw(t.timeout);return Ur.warn(e),void(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))}const s={statusCode:n.status,text:n.responseText};if(200===n.status)try{s.json=JSON.parse(n.responseText)}catch(t){}null===(e=t.callback)||void 0===e||e.call(t,s,pw(()=>n.getResponseHeader("Retry-After")))},null===(e=t.onSend)||void 0===e||e.call(t,s),n.send(a)},mw=t=>{const e=cw(t);if(!e)return;const{url:i,encodedBody:n}=e,{contentType:s,body:o,estimatedSize:a}=null!=n?n:{},u=new Headers;Vr(t.headers,function(t,e){u.append(e,t)}),s&&u.append("Content-Type",s);let c=null,h=!1;if(l){const e=new l;c={signal:e.signal,timeout:setTimeout(()=>{h=!0;try{e.abort(dw(t.timeout))}catch(t){v(t)}},t.timeout)}}let d=!1;const v=e=>{var i;d||(d=!0,h&&"AbortError"===(null==e?void 0:e.name)||fw(e)?Ur.warn(e):Ur.error(e),null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))};let f=0;const p=()=>{sw-=f,f=0,c&&clearTimeout(c.timeout)};try{var g;const e=ue({method:(null==t?void 0:t.method)||"GET",headers:u,referrerPolicy:"strict-origin",body:o,signal:null==c?void 0:c.signal},t.fetchOptions);null===(g=t.onSend)||void 0===g||g.call(t,i);const n=null!=a?a:Ce(o)?0:void 0;e.keepalive="POST"===e.method&&!t.tu&&!1!==e.keepalive&&e.body===o&&!Ce(n)&&n>=0&&52428.8>sw+n,e.keepalive&&(f=n,sw+=f),r(i,e).then(e=>e.text().then(i=>{var n;if(d)return;const s={statusCode:e.status,text:i};if(200===e.status)try{s.json=JSON.parse(i)}catch(t){Ur.error(t)}d=!0,p(),null===(n=t.callback)||void 0===n||n.call(t,s,pw(()=>e.headers.get("Retry-After")))})).catch(t=>{p(),v(t)}).finally(p)}catch(t){p(),v(t)}},yw=t=>{try{var e;const{url:n,encodedBody:s}=uw(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 c=Se(t.data)?t.data:null===(e=t.data)||void 0===e?void 0:e.batch;if(Se(c)&&c.length>1&&(null!=a?a:0)>16384){const e=Math.ceil(c.length/2),i=e=>Se(t.data)?e:ue(ue({},t.data),{},{batch:e});return yw(ue(ue({},t),{},{data:i(c.slice(0,e))})),void yw(ue(ue({},t),{},{data:i(c.slice(e))}))}Ur.warn(`Beacon of ~${null!=a?a:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?mw(ue(ue({},t),{},{tu:!0})):gw(t)}catch(t){Ur.warn("Beacon send failed",t)}},bw=(t,e,i,n)=>{const s="query"===n?"POST"===e?"sent_at":"_":void 0;return lw(i===R_.GZipJS?ow(t,"compression"):t,ue(ue({},s?{[s]:Date.now().toString()}:{}),i===R_.GZipJS?{}:{compression:i}))},_w=(()=>{const t=[];return r&&t.push({transport:"fetch",method:mw}),o&&t.push({transport:"XHR",method:gw}),(null==i?void 0:i.sendBeacon)&&t.push({transport:"sendBeacon",method:yw}),t})(),ww=()=>{var e;return(null==t||null===(e=t.performance)||void 0===e?void 0:e.now)?t.performance.now():Date.now()},kw=[],Sw=[50,75,100,150,200,300,400,500,750,1e3,1500,2e3,3e3,5e3,1e4],xw=[5,10,25,...Sw];var $w=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);Ce(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)}},Tw=class{constructor(t){this.instance=t,this.R=Ur,this.kv=new $w(t),this.onSession=t=>A_(this.instance.onSessionId(e=>{try{t(e)}catch(t){this.R.error("Browser extension session listener failed",t)}})),this.onEvent=t=>A_(this.instance._addCaptureHook((e,i)=>{if(i)try{t({event:e,properties:i.properties})}catch(t){this.R.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{const e=e=>{try{t(e)}catch(t){this.R.error("Browser extension remote config listener failed",t)}},i=this.instance.Tr.on("extensionsRemoteConfig",e);return this.instance.Ir&&e(this.instance.Ir),A_(i)}}get logger(){return this.R}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(N);return"string"==typeof t?t:void 0}get library(){return{name:su.LIB_NAME,version:su.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,n,s;const r=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==r?void 0:r.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==r?void 0:r.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(n=null==r?void 0:r.sessionStartTimestamp)&&void 0!==n?n:0,lastActivityTimestamp:null!==(s=null==r?void 0:r.lastActivityTimestamp)&&void 0!==s?s:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return xe(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get isRateLimited(){var t;return!!(null===(t=this.instance.rateLimiter)||void 0===t?void 0:t.isClientRateLimited)}get projectToken(){return this.instance.config.token}getExtension(t){let e;switch(t){case X_:case Hg:e=this.instance.featureFlags;break;case tw:e=this.instance.logs;break;case"surveys":e=this.instance.surveys;break;case K_:e=this.instance.autocapture}return e}capture(t,e,i){if(!i)return this.Ar(this.instance.capture(t,e));const n=ue(ue({timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce},"unload"===i.delivery?{transport:"sendBeacon",send_instantly:!0}:{}),"immediate"===i.delivery?{send_instantly:!0}:{});return this.Ar(this.instance.capture(t,e,n))}Ar(t){var e;return!Ce(t)||!(null===(e=this.instance.rateLimiter)||void 0===e?void 0:e.lastEventRateLimited)}registerDynamicEventProperties(t){return A_(this.instance.Rr(t))}sendRequest(e){var i=this;return re(function*(e,n={}){var s;const r=null!==(s=n.target)&&void 0!==s?s:"api",o=n.query?lw(e,n.query):e,l=i.instance.requestRouter.endpointFor(r,o),a={method:n.method,url:l,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,compressionFallback:"flags"===n.target&&"best-available"===n.compression?he.Base64:void 0,timestampMode:n.sentAt};return"api"===r&&"/i/v1/logs"===e&&(a.batchKey="logs"),"sendBeacon"===n.transport?(i.instance._send_request(a),{statusCode:202}):new Promise(e=>{var n;if(a.callback=e,"flags"===r&&(null===(n=i.instance.config.metrics)||void 0===n?void 0:n.flags)){let n,s;a.onDispatch=()=>{n=ww()},a.onSend=e=>{s=(e=>{try{return(e=>{var i;const n=null==t?void 0:t.PerformanceObserver,s=null===(i=io(e))||void 0===i?void 0:i.href;if(!n||!s)return;const r=ww(),o={name:s,before:1/0,inFlight:!0};let l,a,u,c=1/0,h=!1;const d=()=>{h||(h=!0,clearTimeout(u),p.disconnect(),kw.splice(kw.indexOf(o),1))};let v=!1;const f=t=>{for(const e of t){const t=e.startTime;e.name!==s||(v?r>=t:r>t)||t>=o.before||l&&t>=l.startTime||(l=e)}if(l&&a&&c>=l.startTime){const t=a;d(),t(l)}},p=new n(t=>f(t.getEntriesByName(s,"resource")));p.observe({entryTypes:["resource"]});for(const t of kw)t.name===s&&(t.before=Math.min(t.before,r),v=v||t.inFlight);return kw.push(o),{take(t,e){h||(c=t,o.inFlight=!1,a=e,u=setTimeout(d,5e3),xe(p.takeRecords)&&f(p.takeRecords()))},stop:d}})(e)}catch(t){return}})(e)},a.callback=t=>{if(e(t),Ce(n))return;const r=n,o=ww();try{const e=((t,e)=>{var i,n;const s=e.statusCode||void 0,r={"server.address":(null!==(i=null===(n=io(t))||void 0===n?void 0:n.hostname)&&void 0!==i?i:t).replace(/^\[(.*)\]$/,"$1")};s&&(r["http.response.status_code"]=s);const o=((t,e)=>t?400>t?void 0:String(t):"AbortError"===(null==e?void 0:e.name)?"timeout":"_OTHER")(s,e.error);o&&(r["error.type"]=o);const l=Au();return l&&(r["client.timezone"]=l),r})(l,t);if(i.Er("posthog.flags.request.duration",o-r,Sw,e),t.statusCode&&s)return void s.take(o,t=>i.Or(t,r,o,e))}catch(t){Ur.error("Failed to record the /flags request timing",t)}null==s||s.stop()}}i.instance._send_request(a)})}).apply(this,arguments)}Or(t,e,i,n){if(t.responseEnd>=t.startTime)try{const s=Math.min(t.responseEnd,i);this.Er("posthog.flags.request.pre_send_duration",t.startTime-e,xw,n),this.Er("posthog.flags.request.network_duration",s-t.startTime,Sw,n),this.Er("posthog.flags.request.main_thread_duration",i-s,xw,n)}catch(t){Ur.error("Failed to record the /flags request timing split",t)}}Er(t,e,i,n){var s;null===(s=this.instance.metrics)||void 0===s||s.histogram(t,e,{unit:"ms",attributes:ue({},n),bounds:i})}};let Cw;const Ew=t=>{var e;return(null==t?void 0:t.config.require_subresource_integrity)?t.__loadExternalDependency:null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.loadExternalDependency};var Mw=class{constructor(t){this._instance=t}get(){var t,e,i,n;const s=null===(t=this._instance)||void 0===t?void 0:t.config;return{disableSurveys:!!(null==s?void 0:s.disable_surveys),cookielessMode:!!(null==s?void 0:s.cookieless_mode),advancedEnableSurveys:!!(null==s?void 0:s.advanced_enable_surveys),requestTimeoutMs:null!==(e=null==s?void 0:s.surveys_request_timeout_ms)&&void 0!==e?e:1e4,prefillFromUrl:!!(null==s||null===(i=s.surveys)||void 0===i?void 0:i.prefillFromUrl),automaticDisplay:!(null==s?void 0:s.disable_surveys_automatic_display),featureFlagEvaluation:!(null==s?void 0:s.advanced_disable_feature_flags),overrideLanguage:null==s?void 0:s.override_display_language,prepareStylesheet:null==s?void 0:s.prepare_external_dependency_stylesheet,get_current_url:null==s?void 0:s.get_current_url,uiHost:null===(n=this._instance)||void 0===n||null===(n=n.requestRouter)||void 0===n?void 0:n.endpointFor("ui","")}}getExtensions(){const t=null==h?void 0:h.__PosthogExtensions__;if(!t||!this._instance)return;const e=this._instance,{generateSurveys:i}=t,n=Ew(e);return{generateSurveys:i?t=>i(e,t):void 0,loadExternalDependency:n?t=>n(e,"surveys",t):void 0}}onMatchingConditionsChanged(e){var i,n;const s=null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook(t=>{"$pageview"!==t&&t!==Tm.SHOWN&&t!==Tm.DISMISSED&&t!==Tm.SENT||e()}),r=()=>e();to(t,"PHSurveyShown",r);let o=!1;const l=null===(n=this._instance)||void 0===n?void 0:n.onFeatureFlags(()=>{o&&e()});return o=!0,()=>{o=!1,null==s||s(),null==l||l(),null==t||t.removeEventListener("PHSurveyShown",r)}}};const Iw=new WeakMap,Rw=(t,e)=>{const i=function(t){var e;const i=new Mw(t);if(!t)return{get config(){return i.get()}};if(null===(e=t.surveys)||void 0===e?void 0:e.getRenderContext)return t.surveys.getRenderContext();let n=Iw.get(t);return n||(n={client:new Tw(t),get config(){return i.get()},surveys:t.surveys},Iw.set(t,n)),n}(t);return i?function(t,e){if(typeof document>"u"||typeof window>"u")return;const i=new S_(t);return!1===t.config.automaticDisplay?(Mm.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i):!1===e?(Mm.info("There are no surveys to load or Surveys is disabled in the project settings."),i):(i.startAutomaticDisplay(),i)}(i,e):void 0};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.generateSurveys=Rw,h.extendPostHogWithSurveys=Rw;const Aw=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},Ow=1e4,Pw=(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),Fw=(t,e,i)=>{const n=JSON.stringify(t);if(i.remaining>=n.length)return Pw(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 Pw(e,JSON.stringify(t.slice(0,s)),i)},Lw=t=>void 0!==t&&"function"!=typeof t&&"symbol"!=typeof t&&"bigint"!=typeof t,Dw=(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}},Nw=(t,e,i)=>{if(!i.truncated)if($e(t)){if(i.seen.has(t))return void Dw(e||"circular","[Circular]",i);i.seen.add(t);try{for(const n in t)try{if(!{}.hasOwnProperty.call(t,n))continue;if(Nw(t[n],e?`${e}.${n}`:n,i),i.truncated)break}catch(t){continue}}catch(t){}}else Dw(e,t,i)},jw=(t,e,i,n,s=!1,r)=>{if(!Lw(t))return!s||Pw(e,"null",i);if(Ie(t)||(t=>{try{return Ae(t)||Pe(t)}catch(t){return!1}})(t))return Pw(e,JSON.stringify(t),i);if("string"==typeof t)return Fw(t,e,i);if(!$e(t)&&!Se(t))return Pw(e,JSON.stringify(t),i);if(n.has(t))return Fw("[Circular]",e,i);n.add(t);try{const r=t.toJSON;if(xe(r))return jw(r.call(t),e,i,n,s)}catch(t){}try{const n={}.toString.call(t);if("[object String]"===n)return Fw(String(t.valueOf()),e,i);if("[object Number]"===n||"[object Boolean]"===n)return Pw(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 jw(o,e,i,n,s,r)}if(Se(t)){if(!Pw(e,"[",i))return!1;for(let s=0;t.length>s;s++){if(s>0&&!Pw(e,",",i))return!1;let r;try{r=t[s]}catch(t){r=void 0}if(!jw(r,e,i,n,!0))return!1}return Pw(e,"]",i)}if(!Pw(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{Nw(l,s,r)}catch(t){}if(!Lw(l))continue;const a=`${o?"":","}${JSON.stringify(s)}:`;if(a.length>=i.remaining)return i.truncated=!0,!1;const u=e.length,c=i.remaining,h=i.truncated;if(!Pw(e,a,i))return!1;const d=e.length,v=jw(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=c,i.truncated=v?h:f,!v)return!1}}catch(t){}return Pw(e,"}",i)},qw=(t,e)=>{const i=[],n={remaining:e,truncated:!1},s=$e(t[0])?{result:{},keysRemaining:50,sizeRemaining:Ow,truncated:!1,seen:new WeakSet([t[0]])}:void 0;for(let e=0;t.length>e&&(0>=e||Pw(i," ",n))&&jw(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)||{}}},Bw={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},zw=t=>"canCapture"in t,Uw=t=>({console:h.console,hostname:h.location.host,getCapturingLogs(){let e;return e=zw(t)?t.canCapture?t.getExtension(tw):void 0:(xe(t.is_capturing)?t.is_capturing():!t.has_opted_out_capturing())?t.logs:void 0,e?{captureConsoleLog:i=>((t,e,i)=>{if(zw(t))return void e.captureConsoleLog(i);const n=(t=>{const e=/^1\.(\d+)\.(\d+)$/.exec(t);if(!e)return;const i=Number(e[1]),n=Number(e[2]);return 392>i||i>419?void 0:410===i?n>4?n>10?void 0:"de":"le":418===i?n>3?n>10?n>14?n>17?void 0:"vi":"ci":"ui":"he":419===i?n>2?void 0:"vi":410>i?"le":"he"})(t.version),s=n?e[n]:void 0;n?xe(s)&&s.call(e,i):xe(e.captureConsoleLog)&&e.captureConsoleLog(i)})(t,e,i),captureBufferedConsoleLog(t,i,n){var s;return null===(s=e.captureBufferedConsoleLog)||void 0===s?void 0:s.call(e,t,i,n)}}:void 0}});h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.logs={initializeLogs:t=>(t=>{const e=t.console;let i=t;const n=[],s={host:t.hostname};let r=!1;const o=()=>{i=void 0;for(const t of n)try{t()}catch(t){}};try{for(const t of Object.keys(Bw)){const o=n=>(...o)=>{let l=!1;try{if(o.length>0&&!r&&i){const e=i.getCapturingLogs();if(e){r=!0,l=!0;const{body:i,truncated:n,attributes:a}=qw(o,Ow),u=ue(ue({},s),n?{body_truncated:"true"}:{}),c={level:Bw[t],body:i,attributes:ue(ue({"log.source":`console.${t}`},u),a)};e.captureConsoleLog(c)}}}catch(t){}finally{l&&(r=!1),n.apply(e,o)}},l=e[t];n.push(wp(e,t,t=>{const e=o(t);return e.__rrweb_original__=Aw(l),e}))}}catch(t){throw o(),t}return o})(Uw(t)),replayConsoleBuffer:(t,e)=>((t,e)=>{const i=t.getCapturingLogs();if(i)for(const s of e)try{var n;const{body:e,truncated:r,attributes:o}=qw(s.args,Ow);null===(n=i.captureBufferedConsoleLog)||void 0===n||n.call(i,{level:Bw[s.level],body:e,attributes:ue(ue({"log.source":`console.${s.level}`,host:t.hostname},r?{body_truncated:"true"}:{}),o)},s.context,s.occurredAtMs)}catch(t){}})(Uw(t),e)};const Hw=t=>qe(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Ww=Hr("[Error tracking]"),Vw="webkit-masked-url:",Gw=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Jw=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Vw],Qw=["__firefox__","__gCrWeb"];function Zw(){return new _n([new Bn,new Kn,new Un,new zn,new Qn,new Jn,new Wn,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=On.test(n)?n.replace(On,"$1"):n;if(!o.match(/\S*Error: /)){for(const i of e){const e=i(o,t);if(e){s.push(e);const t=Fn(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(jn(s,l)>=50)break}}const a=[...l].sort((t,e)=>e.start-t.start),u=a[a.length-1];if(u){const t=Dn(s,u);s.splice(u.start-t,t);for(const e of a)e.start-=t}for(const t of a)Ln(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++)qn(e,t,i)&&(i=t);t.push(...t.splice(0,i))}(s),function(t){if(!t.length)return[];const e=Array.from(t);return e.reverse(),e.slice(0,50).map(t=>{return ue(ue({},t),{},{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||"?"});var i})}(s)}}("web:javascript",Mn,An))}const Kw=Hr("[ExceptionAutocapture]"),Yw=Zw(),Xw=(t,e)=>{try{return t()}catch(t){return e}},tk=t=>{var e;return xe(t)?null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__:void 0},ek=(t,e)=>Xw(()=>t(e()),void 0),ik=t=>Xw(()=>xe(t)&&xe(t.call),!1),nk=(t,e)=>Xw(()=>{t.__POSTHOG_INSTRUMENTED__=!0,Object.defineProperty(t,"__posthog_layer__",{enumerable:!1,value:e})},void 0),sk=(t,e,i,n)=>{Xw(()=>{delete i.__POSTHOG_INSTRUMENTED__},void 0),Xw(()=>{const s=t[e];if(s===i)return void(t[e]=n.next);const r=[];let o=tk(s);for(;o&&-1===r.indexOf(o);){if(o.next===i)return void((o.checksNext||ik(n.next))&&(o.next=n.next));r.push(o),o=tk(o.next)}},void 0)},rk=e=>{const i=t;i||Kw.info("window not available, cannot wrap onerror");const n={next:Xw(()=>i.onerror,void 0),checksNext:!0};let s=e;const r=function(...t){var e;s&&ek(s,()=>Yw.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}}));const{next:i}=n;return!!ik(i)&&null!==(e=i(...t))&&void 0!==e&&e};return i.onerror=r,nk(r,n),()=>{s=void 0,sk(i,"onerror",r,n)}},ok=(e,i=!1)=>{const n=t;n||Kw.info("window not available, cannot wrap onUnhandledRejection");const s={next:Xw(()=>n.onunhandledrejection,void 0),checksNext:!0};let r=e;const o=function(t){var e;r&&ek(r,()=>Yw.buildFromUnknown(t,{mechanism:{handled:!1}}));const{next:n}=s;return ik(n)?null!==(e=n(t))&&void 0!==e&&e:i};return n.onunhandledrejection=o,nk(o,s),()=>{r=void 0,sk(n,"onunhandledrejection",o,s)}},lk={wrapOnError:rk,wrapUnhandledRejection:ok,wrapConsoleError(t){const e=console;e||Kw.info("console not available, cannot wrap console.error");const i={next:Xw(()=>e.error,void 0),checksNext:!0};let n=t;const s=function(...t){n&&!Xw(()=>t.length>1&&Ee(t[0])&&(/^\[PostHog\.js\](?: |$)/.test(t[0])||"rrweb logger error:"===t[0]),!1)&&ek(n,()=>{let e;e=1==t.length?t[0]:t.join(" ");const i=t.find(t=>t instanceof Error);return Yw.buildFromUnknown(i||e,{mechanism:{handled:!0,type:"onconsole"},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})});const{next:e}=i;ik(e)&&e(...t)};return e.error=s,nk(s,i),()=>{n=void 0,sk(e,"error",s,i)}}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.errorWrappingFunctions=lk,h.posthogErrorWrappingFunctions=lk;const ak=(t,e)=>{if(!xe(null==t?void 0:t.capture))return;const i=null==e?void 0:e.autocaptureExceptions,n=!Ie(i)&&"object"==typeof i&&Se(i.errors_to_ignore)?i.errors_to_ignore.reduce((t,e)=>{try{t.push(new RegExp(e))}catch(t){Kw.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){Kw.error("Failed to capture exception for a legacy client",t)}};rk(t=>{n.some(e=>t.$exception_list.some(t=>e.test(t.value||"")))||s(t)}),ok(s,!0)};h.extendPostHogWithExceptionAutoCapture=ak,h.extendPostHogWithExceptionAutocapture=ak;const uk="X-POSTHOG-SESSION-ID",ck="X-POSTHOG-WINDOW-ID",hk="X-POSTHOG-DISTINCT-ID",dk=[uk,ck,hk],vk="traceparent",fk=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],pk=(t,e)=>({}.hasOwnProperty.call(t,e)),gk=t=>"object"==typeof t&&!Ie(t)||xe(t),mk=t=>"undefined"!=typeof Request&&(t instanceof Request||"[object Request]"==={}.toString.call(t)),yk=e=>{try{var i;return mk(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}},bk=(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;const l=(t=>xe(t)?t():t)(e);if(l&&"$posthog_cookieless"!==l){try{s.set(hk,l)}catch(t){return!1}o=!0}if(i){const{sessionId:t,windowId:e}=i.checkAndGetSessionAndWindowId(!0);s.set(uk,t),s.set(ck,e),o=!0}return o},_k=e=>{const i=new Uint8Array(e),n=null==t?void 0:t.crypto;if(n&&xe(n.getRandomValues))n.getRandomValues(i);else for(let t=0;e>t;t++)i[t]=Math.floor(256*Math.random());let s="";for(let t=0;e>t;t++)s+=(16>i[t]?"0":"")+i[t].toString(16);return s},wk=t=>{let e=_k(t);for(;/^0+$/.test(e);)e=_k(t);return e},kk=()=>`00-${wk(16)}-${wk(8)}-01`,Sk=t=>{try{return new URL(t).origin}catch(t){return}},xk=(t,e)=>{if(!Se(t)||0===t.length)return!1;let i;try{i=new URL(e)}catch(t){return!1}for(let e=0;t.length>e;e++){const n=t[e];if(Ee(n))if(n.indexOf("://")>-1){if(Sk(n)===i.origin)return!0}else if(n.toLowerCase()===i.hostname)return!0}return!1},$k=(t,e,i)=>!(i.has(vk)||!xk(t,e)||(i.set(vk,kk()),0));h.__PosthogExtensions__=h.__PosthogExtensions__||{};const Tk={_patchFetch:(e,i,n,s)=>wp(t,"fetch",t=>function(r,o){const l=arguments.length>1?[r,o]:[r];let a=l;try{const t=yk(r);if(t)if(mk(r)){const t=new Request(r,o);a=[t];const l=new Headers;try{bk(e,i,n,t.url,l),l.forEach((e,i)=>t.headers.set(i,e))}catch(t){}$k(s,t.url,t.headers)}else{const l=new Headers(gk(o)?o.headers:void 0),u=bk(e,i,n,t,l),c=$k(s,t,l);if(u||c){const t=((t,e)=>{if(Ce(t)||Ie(t))return{headers:e};if(!gk(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)=>pk(t,e)?Reflect.get(t,e):Reflect.get(i,e,i),has:(t,e)=>pk(t,e)||e in i,ownKeys(t){const e=new Set(Reflect.ownKeys(t));return Reflect.ownKeys(i).forEach(t=>e.add(t)),fk.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&&fk.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)})})(o,l);t&&(a=[r,t])}}}catch(t){a=l}return t.apply(this,a)}),_patchXHR(e,i,n,s){const r=Se(s)&&"undefined"!=typeof WeakMap?new WeakMap:void 0,o=wp(t.XMLHttpRequest.prototype,"open",t=>function(s,o,l=!0,a,u){const c=this;let h=new Headers;const d=yk(o);if(d)try{bk(e,i,n,d,h)}catch(t){h=new Headers}r&&(r.delete(c),d&&r.set(c,d));const v=t.call(c,s,o,l,a,u);return dk.forEach(t=>{const e=h.get(t);if(e)try{c.setRequestHeader(t,e)}catch(t){}}),v});if(!r)return o;const l=t.XMLHttpRequest.prototype,a=wp(l,"setRequestHeader",t=>function(e,i){return(t=>{try{return String(t).toLowerCase()===vk}catch(t){return!1}})(e)&&r.delete(this),t.call(this,e,i)}),u=wp(l,"send",e=>function(){const i=r.get(this);if(i){r.delete(this);try{!xk(s,i)||(e=>{try{return!!t&&new URL(e,t.location.href).origin===t.location.origin}catch(t){return!1}})(i)&&(e=>{try{let s=e;for(let e=0;xe(s)&&20>e;e++){var i,n;const e=s;if(e.__wrapped){const e=null==t?void 0:t[Symbol.for("opentelemetry.js.api.1")];return!!(null==e?void 0:e.propagation)}s=null===(i=null!==(n=e.__posthog_layer__)&&void 0!==n?n:e.__rrweb_layer__)||void 0===i?void 0:i.next}return!1}catch(t){return!1}})(null==c?void 0:c.next)||this.setRequestHeader(vk,kk())}catch(t){}}return e.apply(this,arguments)});let c;try{var h;c=null===(h=l.send)||void 0===h?void 0:h.__posthog_layer__}catch(t){}return()=>{u(),a(),o()}}};h.__PosthogExtensions__.tracingHeadersPatchFns=Tk,h.postHogTracingHeadersPatchFns=Tk,"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 Ck=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 Ek=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Mk=t=>{if("loading"===document.readyState)return"loading";const e=Ek();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"},Ik=t=>{const e=t.nodeName;return 1===t.nodeType?e.toLowerCase():e.toUpperCase().replace(/^#/,"")},Rk=t=>{let e="";try{for(;9!==(null==t?void 0:t.nodeType);){var i;const n=t,s=n.id?"#"+n.id:[Ik(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},Ak=new WeakMap;function Ok(t,e){let i=Ak.get(e);return i||(i=new WeakMap,Ak.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}let Pk=-1;const Fk=()=>Pk,Lk=t=>{addEventListener("pageshow",e=>{e.persisted&&(Pk=e.timeStamp,t(e))},!0)},Dk=(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)))}},Nk=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},jk=()=>{var t,e;return null!==(t=null===(e=Ek())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let qk=-1;const Bk=new Set,zk=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Uk=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of Bk)t();isFinite(qk)||(qk="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",Uk,!0))}},Hk=(t=!1)=>{if(t&&(qk=1/0),0>qk){var e;const t=jk(),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;qk=null!=i?i:zk(),addEventListener("visibilitychange",Uk,!0),addEventListener("prerenderingchange",Uk,!0),Lk(()=>{setTimeout(()=>{qk=zk()})})}return{get firstHiddenTime(){return qk},onHidden(t){Bk.add(t)}}},Wk=(t,e=-1,i,n=0,s,r,o)=>{const l=Ek(),a=(null==l?void 0:l.navigationId)||0;let u="navigate";return i?u=i:0>Fk()?l&&(document.prerendering||jk()>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}},Vk=(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){}},Gk=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},Jk=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},Qk=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var Zk=class{constructor(){this.u=void 0}};const Kk=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},Yk=[1800,3e3],Xk=(t,e={})=>{const i=Gk(e);Kk(()=>{const n=Ok(e,Zk),s=Hk();let r,o=Wk("FCP");const l=Vk(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(l.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-jk(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});l&&(r=Dk(t,o,Yk,e.reportAllChanges),Lk(i=>{o=Wk("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Fk()),r=Dk(t,o,Yk,e.reportAllChanges),Nk(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Vk(["soft-navigation"],i=>{i.forEach(i=>{n.u&&i.navigationId&&Jk(n.u,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Wk("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Dk(t,o,Yk,e.reportAllChanges),r(!0)})},e)})},tS=[.1,.25],eS=t=>t.find(t=>{var e;return 1===(null===(e=t.node)||void 0===e?void 0:e.nodeType)})||t[0],iS=(t,e={})=>{const i=Ok(e=Object.assign({},e),Ck),n=new WeakMap;i.t=t=>{var i;if(null==t||null===(i=t.sources)||void 0===i?void 0:i.length){const i=eS(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:Rk(o);n.set(i,t)}}},((t,e={})=>{const i=Hk();Xk(Qk(()=>{let n,s=Wk("CLS",0);const r=Ok(e,Ck),o=(i,o,l,a,u)=>{s=Wk("CLS",0,i,o,l,a,u),r.o=0,n=Dk(t,s,tS,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()},c=["layout-shift"];Gk(e)&&c.push("soft-navigation");const h=Vk(c,u);h&&(n=Dk(t,s,tS,e.reportAllChanges),i.onHidden(()=>{u(h.takeRecords()),n(!0)}),Lk(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Fk()),Nk(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=eS(s.sources);t&&(e={largestShiftTarget:n.get(t),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:t,largestShiftEntry:s,loadState:Mk(s.startTime)})}}return Object.assign(t,{attribution:e})})(e))},e)},nS=(t,e={})=>{const i=Ok(e=Object.assign({},e),Zk);Gk(e)&&(i.u=new Map),Xk(e=>{t((t=>{let e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:Mk(Fk())};if("soft-navigation"!==t.navigationType){if(t.entries.length){const i=Ek(),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:Mk(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 sS=0,rS=1/0,oS=0;const lS=t=>{for(const e of t)e.interactionId&&(rS=Math.min(rS,e.interactionId),oS=Math.max(oS,e.interactionId),sS=oS?(oS-rS)/7+1:0)};let aS;const uS=()=>{var t;return aS?sS:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var cS=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return uS()-this.h}D(){this.h=uS(),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 hS=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=Qk(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})}},dS=[200,500],vS=(t,e={})=>{const i=Ok(e=Object.assign({},e),cS);let n=[],s=[],r=0;const o=new WeakMap,l=new WeakMap;let a=!1;const u=()=>{a||(hS(c),a=!0)},c=()=>{const t=new Set(i.v.map(t=>o.get(t.entries[0]))),e=s.length-10;s=s.filter((i,n)=>n>=e||t.has(i));const l=new Set;for(const t of s){const e=h(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:Rk(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 h=(t,e)=>{const i=[];for(const s of n)if(s.startTime+s.duration>=t){if(s.startTime>e)break;i.push(s)}return i};Vk(["long-animation-frame"],t=>{n=n.concat(t),u()},e),((t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Hk();Kk(()=>{var n;"interactionCount"in performance||aS||(aS=Vk(["event"],lS,{durationThreshold:0}));let s,r=Wk("INP");const o=Ok(e,cS),l=(i,n,l,a,u)=>{o.D(),r=Wk("INP",-1,i,n,l,a,u),s=Dk(t,r,dS,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)},c=(t,e=!1)=>{hS(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.l(e):u(e);a(),e&&s(!0)})},h=["event","first-input"];Gk(e)&&h.push("soft-navigation");const d=Vk(h,c,ue(ue({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=Dk(t,r,dS,e.reportAllChanges),d&&(i.onHidden(()=>{c(d.takeRecords(),!0)}),Lk(()=>{l("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Fk())}))})})(e=>{t((t=>{if(0===t.entries.length){const e={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:t.value,loadState:Mk(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),c=h(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:c,inputDelay:s-e.startTime,processingDuration:a-s,presentationDelay:r-a,loadState:Mk(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,c=0,h=0;for(const e of t.longAnimationFrameEntries){u=u+e.startTime+e.duration-e.styleAndLayoutStart;for(const t of e.scripts){const e=t.startTime+t.duration;if(i>e)continue;const n=e-Math.max(i,t.startTime),c=t.duration?n/t.duration*t.forcedStyleAndLayoutDuration:0;a+=n-c,u+=c,n>h&&(l=i+s>t.startTime?"input-delay":i+s+r>t.startTime?"processing-duration":"presentation-delay",o=t,h=n)}}const d=t.longAnimationFrameEntries.at(-1),v=d?d.startTime+d.duration:0;v>=i+s+r&&(c=n-v),o&&l&&(t.longestScript={entry:o,subpart:l,intersectingDuration:h}),t.totalScriptDuration=a,t.totalStyleAndLayoutDuration=u,t.totalPaintDuration=c,t.totalUnattributedDuration=n-i-a-u-c})(v),Object.assign(t,{attribution:v})})(e))},e)};var fS=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 pS=50;const gS=[];Vk(["resource"],t=>{for(const e of t)gS.push(e),gS.length>pS&&gS.shift()});const mS=(t,e={})=>{null!=(e=Object.assign({},e)).resourceBufferSize&&(pS=e.resourceBufferSize);const i=Ok(e,fS),n=new WeakMap;Gk(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:Rk(i);n.set(t,o)}else t.id&&n.set(t,`#${t.id}`)},((t,e={})=>{let i=!1;const n=Gk(e);Kk(()=>{let s,r=Hk(),o=Wk("LCP");const l=Ok(e,fS),a=(n,l,a,u,c)=>{o=Wk("LCP",-1,n,l,a,u,c),s=Dk(t,o,$,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=Hk(!0))},u=t=>{var e;l.u&&t.navigationId&&Jk(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&&c([n])},c=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],a=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-jk(),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())}},h=["largest-contentful-paint"];n&&h.push("interaction-contentful-paint","soft-navigation");const d=Vk(h,c);if(d){s=Dk(t,o,$,e.reportAllChanges);const r=["keydown","click","visibilitychange"],l=t=>{if(t.isTrusted&&!i){const t=o.id;hS(()=>{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});Lk(n=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Fk()),s=Dk(t,o,$,e.reportAllChanges),Nk(()=>{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&&(gS.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 c=0,h=0;if("soft-navigation"!==t.navigationType?(u=Ek(),c=null!==(s=null==u?void 0:u.activationStart)&&void 0!==s?s:0,h=null!==(r=null==u?void 0:u.responseStart)&&void 0!==r?r:0):(c=t.navigationStartTime||0,u=null===(o=i.u)||void 0===o?void 0:o.get(t.navigationId)),u){const i=Math.max(0,h-c),n=Math.max(i,a?(a.requestStart||a.startTime)-c:0),s=Math.min(t.value,Math.max(n,a?a.responseEnd-c:0));e=ue(ue({},e),{},{timeToFirstByte:i,resourceLoadDelay:n-i,resourceLoadDuration:s-n,elementRenderDelay:t.value-s,navigationEntry:u})}}return Object.assign(t,{attribution:e})})(e))},e)};let yS=-1;const bS=()=>yS,_S=t=>{addEventListener("pageshow",e=>{e.persisted&&(yS=e.timeStamp,t(e))},!0)},wS=(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)))}},kS=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},SS=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},xS=()=>{var t,e;return null!==(t=null===(e=SS())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let $S=-1;const TS=new Set,CS=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,ES=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of TS)t();isFinite($S)||($S="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",ES,!0))}},MS=(t=!1)=>{if(t&&($S=1/0),0>$S){var e;const t=xS(),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;$S=null!=i?i:CS(),addEventListener("visibilitychange",ES,!0),addEventListener("prerenderingchange",ES,!0),_S(()=>{setTimeout(()=>{$S=CS()})})}return{get firstHiddenTime(){return $S},onHidden(t){TS.add(t)}}},IS=(t,e=-1,i,n=0,s,r,o)=>{const l=SS(),a=(null==l?void 0:l.navigationId)||0;let u="navigate";return i?u=i:0>bS()?l&&(document.prerendering||xS()>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}},RS=new WeakMap;function AS(t,e){let i=RS.get(e);return i||(i=new WeakMap,RS.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}var OS=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 PS=(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){}},FS=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},LS=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},DS=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var NS=class{constructor(){this.l=void 0}};const jS=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},qS=[1800,3e3],BS=(t,e={})=>{const i=FS(e);jS(()=>{const n=AS(e,NS),s=MS();let r,o=IS("FCP");const l=PS(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(l.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-xS(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});l&&(r=wS(t,o,qS,e.reportAllChanges),_S(i=>{o=IS("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,bS()),r=wS(t,o,qS,e.reportAllChanges),kS(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&PS(["soft-navigation"],i=>{i.forEach(i=>{n.l&&i.navigationId&&LS(n.l,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=IS("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=wS(t,o,qS,e.reportAllChanges),r(!0)})},e)})},zS=[.1,.25],US=(t,e={})=>{const i=MS();BS(DS(()=>{let n,s=IS("CLS",0);const r=AS(e,OS),o=(i,o,l,a,u)=>{s=IS("CLS",0,i,o,l,a,u),r.i=0,n=wS(t,s,zS,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()},c=["layout-shift"];FS(e)&&c.push("soft-navigation");const h=PS(c,u);h&&(n=wS(t,s,zS,e.reportAllChanges),i.onHidden(()=>{u(h.takeRecords()),n(!0)}),_S(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,bS()),kS(n)}),setTimeout(n))}))};let HS=0,WS=1/0,VS=0;const GS=t=>{for(const e of t)e.interactionId&&(WS=Math.min(WS,e.interactionId),VS=Math.max(VS,e.interactionId),HS=VS?(VS-WS)/7+1:0)};let JS;const QS=()=>{var t;return JS?HS:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var ZS=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return QS()-this.u}M(){this.u=QS(),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 KS=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=DS(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})}},YS=[200,500],XS=(t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=MS();jS(()=>{var n;"interactionCount"in performance||JS||(JS=PS(["event"],GS,{durationThreshold:0}));let s,r=IS("INP");const o=AS(e,ZS),l=(i,n,l,a,u)=>{o.M(),r=IS("INP",-1,i,n,l,a,u),s=wS(t,r,YS,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)},c=(t,e=!1)=>{KS(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.h(e):u(e);a(),e&&s(!0)})},h=["event","first-input"];FS(e)&&h.push("soft-navigation");const d=PS(h,c,ue(ue({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=wS(t,r,YS,e.reportAllChanges),d&&(i.onHidden(()=>{c(d.takeRecords(),!0)}),_S(()=>{l("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,bS())}))})};var tx=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 ex=[2500,4e3],ix=(t,e={})=>{let i=!1;const n=FS(e);jS(()=>{let s,r=MS(),o=IS("LCP");const l=AS(e,tx),a=(n,l,a,u,c)=>{o=IS("LCP",-1,n,l,a,u,c),s=wS(t,o,ex,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=MS(!0))},u=t=>{var e;l.l&&t.navigationId&&LS(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&&c([n])},c=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],a=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-xS(),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())}},h=["largest-contentful-paint"];n&&h.push("interaction-contentful-paint","soft-navigation");const d=PS(h,c);if(d){s=wS(t,o,ex,e.reportAllChanges);const r=["keydown","click","visibilitychange"],l=t=>{if(t.isTrusted&&!i){const t=o.id;KS(()=>{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});_S(n=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,bS()),s=wS(t,o,ex,e.reportAllChanges),kS(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})},nx={onLCP:mS,onCLS:iS,onFCP:nS,onINP:vS,withoutAttribution:{onLCP:ix,onCLS:US,onFCP:BS,onINP:XS}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=nx,h.__PosthogExtensions__.postHogWebVitalsCallbacks=nx,h.postHogWebVitalsCallbacks=nx;const sx={onLCP:ix,onCLS:US,onFCP:BS,onINP:XS};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=sx,h.__PosthogExtensions__.postHogWebVitalsCallbacks=sx,h.postHogWebVitalsCallbacks=sx,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>sx;const rx={onLCP:mS,onCLS:iS,onFCP:nS,onINP:vS,withoutAttribution:{onLCP:ix,onCLS:US,onFCP:BS,onINP:XS}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=rx,h.__PosthogExtensions__.postHogWebVitalsCallbacks=rx,h.postHogWebVitalsCallbacks=rx;const ox={onLCP:ix,onCLS:US,onFCP:BS,onINP:XS};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=ox,h.__PosthogExtensions__.postHogWebVitalsCallbacks=ox,h.postHogWebVitalsCallbacks=ox,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>ox;const lx={};function ax(t,e){const i=$o(t);return i?ue({node:i,originalEvent:t,timestamp:Date.now()},e):null}function ux(t){return!!cn(()=>go(t))}function cx(t,e){return Math.abs(t)<Math.abs(e)?0>e?"up":"down":0>t?"left":"right"}function hx(t){return"swipe"===t.type?"$dead_swipe":"$dead_click"}const dx="canvas,video,audio,embed,object";function vx(t,e){return Ae(t)&&t>=e}function fx(t,e=1e3){return t>=0&&e>t?t:void 0}function px(t,e,i=1e3){return Ae(e)?fx(t-e,i):void 0}var gx=class{Dr(t){var e,i,n,s,r,o,l,a;const u=this.Fr((null==t?void 0:t.__onCapture)||this.Pr.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.Nr=new WeakSet,this.qr=!1,this.jr=[],this.Br=0,this.Fr=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.zr=()=>{clearTimeout(this.Ur),this.Ur=void 0,this.Wr=void 0},this.Hr=t=>{if(this.Gr(t),this.zr(),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.Vr(i,e),this.Wr=e}},this.Qr=t=>{Ie(t.relatedTarget)&&this.zr()},this.Zr=t=>{const e=this.Wr,i=t;if(!e||0!==i.button||t.isTrusted!==e.trusted)return;const n=t.composedPath();for(const t of e.path)if(ux(t)&&-1!==n.indexOf(t)){e.clickTarget=t;break}e.clickDetail=i.detail,this.Ur=h.setTimeout(this.zr,0)},this.Jr=t=>{this.Gr(t);const e=t,i=ax(e,{type:"click"}),n=this.Wr;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.Yr.selection_change_threshold_ms>0,this.zr()),Ie(i)||this.Kr(i)||this.Xr(i),this.eo()},this.no=()=>{const t=Date.now();this.io=t,t%50==0&&this.jr.forEach(e=>{Ce(e.scrollDelayMs)&&(e.scrollDelayMs=t-e.timestamp)})},this.ro=t=>{var e,i;const s=null==n?void 0:n.getSelection(),r=this.qr;this.qr="Range"===(null==s?void 0:s.type);const o=null==s?void 0:s.focusNode,l=o&&(go(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 c=zo($o(t))||zo(null!=l?l:null)||zo(null!==(i=u)&&void 0!==i?i:null),h="Caret"===(null==s?void 0:s.type)&&u&&!u.shadowRoot&&o&&o!==a&&o.contains(null!=a?a:null);if(!(r||this.qr||c||h))return;const d=Date.now();this.oo=d;const v=this.Wr;if(v&&(r||this.qr||c)){const e=$o(t);let i;if(zo(e))i=e;else if("Caret"===(null==s?void 0:s.type)){var f;zo(null!==(f=u)&&void 0!==f?f:null)||h?i=u:c&&(i=l)}const n=i?this.so(i,v):s&&(o||s.anchorNode)?this.Vr(s,v):r&&!this.qr&&v.selectionInitiallyRelated;v.selectionChanged=v.selectionChanged||n}this.jr.forEach(t=>{const e=d-t.timestamp;0>e||!Ce(t.selectionChangedDelayMs)&&e>=t.selectionChangedDelayMs||(t.selectionChangedDelayMs=e)})},this.gn=()=>{"hidden"===(null==n?void 0:n.visibilityState)&&this.zr();const t=Date.now();this.ao=t,this.lo("visibilityChangedDelayMs",t)},this.uo=()=>{const t=Date.now();this.co=t,this.lo("focusChangedDelayMs",t)},this.do=t=>{this.Gr(t);const e=t.touches,i=1===(null==e?void 0:e.length)?e[0]:void 0;this.ho=i&&this.fo()?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this.vo=()=>{this.ho=void 0},this.po=t=>{var e;const i=this.ho;if(this.ho=void 0,Ce(i)||this.Br>=this.Yr.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.Yr.swipe_threshold_px;if(u*u>a)return;if([this.io,this.mo,this.oo].some(t=>Ae(t)&&t>=i.timestamp))return;var c,h;if(this.yo()&&(null!==(c=null==n||null===(h=n.elementsFromPoint)||void 0===h?void 0:h.call(n,i.x,i.y))&&void 0!==c?c:[]).some(t=>{var e;return null===(e=t.matches)||void 0===e?void 0:e.call(t,dx)}))return;const d=ax(s,{type:"swipe",swipeDirection:cx(o,l),swipeDistancePx:Math.round(Math.sqrt(a))});Ie(d)||this.Kr(d)||this.Xr(d),this.eo()},this.Yr=this.Dr(e),this._onCapture=this.Yr.__onCapture}start(t){this.bo(),this.wo(),this.ko(),this.So(),this._o(),this.xo(t),this.Yr.capture_dead_swipes&&this.Co()}xo(e){if(!this.Mo){const i=function(e){return function(e,i){const n=lx[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 lx[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){Ur.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)?lx[e]=s.bind(i):s}("MutationObserver",e)}(h);this.Mo=new i(t=>{this.To(t)}),this.Io(e)}}Io(t){t&&this.Mo&&(this.Nr.has(t)||(this.Mo.observe(t,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),this.Nr.add(t),this.Ao(t)))}Ao(t,e){var i,n;go(t)&&t.shadowRoot&&this.Io(t.shadowRoot);const s=null!==(i=null===(n=t.querySelectorAll)||void 0===n?void 0:n.call(t,"*"))&&void 0!==i?i:[];for(let t=0;s.length>t;t++)null==e||e.add(s[t]),this.Io(s[t].shadowRoot)}Gr(t){var e,i;const n=null!==(e=null===(i=t.composedPath)||void 0===i?void 0:i.call(t))&&void 0!==e?e:[];for(let t=0;n.length>t;t++){const e=n[t];ux(e)&&this.Io(e.shadowRoot)}}stop(){var t;null===(t=this.Mo)||void 0===t||t.disconnect(),this.Mo=void 0,this.Nr=new WeakSet,h.removeEventListener("click",this.Jr,{capture:!0}),h.removeEventListener("mousedown",this.Hr,{capture:!0}),h.removeEventListener("mouseup",this.Zr,{capture:!0}),h.removeEventListener("mouseout",this.Qr,{capture:!0}),h.removeEventListener("dragstart",this.zr,{capture:!0}),h.removeEventListener("pointercancel",this.zr,{capture:!0}),h.removeEventListener("blur",this.zr),this.zr(),h.removeEventListener("scroll",this.no,{capture:!0}),null==n||n.removeEventListener("selectionchange",this.ro),h.removeEventListener("touchstart",this.do,{capture:!0}),h.removeEventListener("touchend",this.po,{capture:!0}),h.removeEventListener("touchcancel",this.vo,{capture:!0}),null==n||n.removeEventListener("visibilitychange",this.gn),h.removeEventListener("blur",this.uo),h.removeEventListener("focus",this.uo),this.ho=void 0}To(t){const e=new Set;for(const n of t)try{var i;if(!1===(null===(i=n.target)||void 0===i?void 0:i.isConnected))continue;this.mo=Date.now();const t=n.addedNodes;for(let i=0;t.length>i;i++){const n=t[i];ux(n)&&!e.has(n)&&this.Ao(n,e)}}catch(t){}}bo(){to(h,"click",this.Jr,{capture:!0}),to(h,"mousedown",this.Hr,{capture:!0}),to(h,"mouseup",this.Zr,{capture:!0}),to(h,"mouseout",this.Qr,{capture:!0}),to(h,"dragstart",this.zr,{capture:!0}),to(h,"pointercancel",this.zr,{capture:!0}),to(h,"blur",this.zr)}Xr(t){this.fo()&&(t.selectionChangedDelayMs=px(t.timestamp,this.oo,this.Yr.selection_change_threshold_ms),t.visibilityChangedDelayMs=px(t.timestamp,this.ao),t.focusChangedDelayMs=px(t.timestamp,this.co),this.jr.push(t))}eo(){this.jr.length&&Ce(this.Ro)&&(this.Ro=h.setTimeout(()=>{this.Eo()},1e3))}wo(){to(h,"scroll",this.no,{capture:!0})}ko(){var t;this.qr="Range"===(null==n||null===(t=n.getSelection())||void 0===t?void 0:t.type),to(n,"selectionchange",this.ro)}so(t,e){const i=e.path[0];try{for(;t;){if(-1!==e.path.indexOf(t)||go(i)&&i.contains(t))return!0;t=t.getRootNode().host}}catch(t){}return!1}Vr(t,e){const i=e.path[0],n=t.rangeCount>0?t.getRangeAt(0):void 0,s=!!n&&cn(()=>n.startContainer.getRootNode()===i.getRootNode());if(n&&s&&go(i)){var r;if(!n.collapsed)return n.intersectsNode(i);const t=go(n.startContainer)&&null!==(r=n.startContainer.childNodes[n.startOffset])&&void 0!==r?r:n.startContainer;return this.so(t,e)}return this.so(t.focusNode,e)||this.so(t.anchorNode,e)}So(){to(n,"visibilitychange",this.gn)}_o(){to(h,"blur",this.uo),to(h,"focus",this.uo)}lo(t,e){this.jr.forEach(i=>{const n=fx(e-i.timestamp);Ae(n)&&(Ce(i[t])||i[t]>n)&&(i[t]=n)})}Co(){to(h,"touchstart",this.do,{capture:!0,passive:!0}),to(h,"touchend",this.po,{capture:!0,passive:!0}),to(h,"touchcancel",this.vo,{capture:!0,passive:!0})}fo(){return xe(this.instance.is_capturing)?this.instance.is_capturing():!this.instance.has_opted_out_capturing()}yo(){const t=Ce(this.Oo)||Ae(this.mo)&&this.mo>this.Oo;return(Ce(this.$o)||t)&&(this.Oo=Date.now(),this.$o=!!(null==n?void 0:n.querySelector(dx))),!!this.$o}Kr(t){return!t||("swipe"===t.type?this.Lo(t):this.Do(t))}Lo(t){return!(!po(t.node)&&!this.jr.some(e=>e.type===t.type&&e.node===t.node&&1e3>Math.abs(e.timestamp-t.timestamp))&&!mo(t.node,"html")&&go(t.node)&&function(t,e){var i;if(!(typeof window>"u"?void 0:window)||Ho(t))return!1;const n=Pe(e)?jo:null!==(i=null==e?void 0:e.css_selector_ignorelist)&&void 0!==i?i:jo,{targetElementList:s,isComplete:r}=Wo(t,!1);return!!r&&!Eo(s,n)}(t.node,{css_selector_ignorelist:this.Yr.css_selector_ignorelist}))}Do(t){return!(this.Yr.capture_clicks_with_modifier_keys||(e=t.originalEvent,!(e.ctrlKey||e.metaKey||e.altKey||e.shiftKey)))||!!this.Lo(t)||function(t){if(!(typeof window>"u"?void 0:window)||Ho(t))return!1;const{targetElementList:e,isComplete:i}=Wo(t,!1);return!i||e.some(t=>mo(t,"a"))}(t.node);var e}Eo(){if(!this.jr.length)return;clearTimeout(this.Ro),this.Ro=void 0;const t=this.jr;this.jr=[];for(const i of t){var e;i.mutationDelayMs=null!==(e=i.mutationDelayMs)&&void 0!==e?e:this.mo&&this.mo>=i.timestamp?this.mo-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const t=vx(i.scrollDelayMs,this.Yr.scroll_threshold_ms),n=vx(i.selectionChangedDelayMs,this.Yr.selection_change_threshold_ms),s=vx(i.mutationDelayMs,this.Yr.mutation_threshold_ms),r=vx(i.absoluteDelayMs,1.1*this.Yr.mutation_threshold_ms),o=Ae(i.scrollDelayMs)&&this.Yr.scroll_threshold_ms>i.scrollDelayMs,l=Ae(i.mutationDelayMs)&&this.Yr.mutation_threshold_ms>i.mutationDelayMs,a=i.selectionChangedDuringGesture||Ae(i.selectionChangedDelayMs)&&this.Yr.selection_change_threshold_ms>i.selectionChangedDelayMs,u=Ae(i.visibilityChangedDelayMs),c=Ae(i.focusChangedDelayMs);if(!(o||l||a||u||c))if(t||s||r||n){const e=hx(i);if("$dead_swipe"===e){if(this.Br>=this.Yr.max_dead_swipes_per_page_load)continue;this.Br++}this._onCapture(i,{[`${e}_last_mutation_timestamp`]:this.mo,[`${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.Yr.mutation_threshold_ms>i.absoluteDelayMs&&this.jr.push(i)}this.eo()}Pr(t,e){const i=hx(t);this.instance.capture(i,ue(ue(ue({},e),Z_(t.node,{e:t.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Yr.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:t.scrollDelayMs,[`${i}_mutation_delay_ms`]:t.mutationDelayMs,[`${i}_absolute_delay_ms`]:t.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:t.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:t.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:t.focusChangedDelayMs,$dead_swipe_direction:t.swipeDirection,$dead_swipe_distance_px:t.swipeDistancePx}),{timestamp:new Date(t.timestamp)})}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initDeadClicksAutocapture=(t,e)=>new gx(t,e);const mx={"conversations.js":"sha384-8fPy3IASBzA8AWqnw4GisFo+FugHLE1xLpCaDmKKa+sdTroMj7fsaSQxeJdciOoP","crisp-chat-integration.js":"sha384-qVSPPiM5PHJlVNpiLPyETnf0VXOGevtCqjm2K8EmWnKpLQnY/TMu+iLJ8wWLW8iA","dead-clicks-autocapture.js":"sha384-MYefNCyD6/XLhTOKa8DavuGsgGJvAJO/X4iqoFkAqgGk7H9qgcIoysU9F2qVGMk1","exception-autocapture.js":"sha384-miJNvXEqyiBQpQrLVO7Yfby3J/doNarkjZX+a1eOKpGkF23r0WwtkxSSPyz/ngDx","intercom-integration.js":"sha384-gWEoUxf+HEPSZ4GZthxep/3LlEectgXxzj8uWkW7dnvRRV6AKkHXtZEmcb0OqOvn","lazy-recorder.js":"sha384-Ge58ONxarh9k88Xh0cuyu9EsN4wEhFQkA+e2lQbzD6COVKkGG/s1EeLkGhaXCZf1","logs.js":"sha384-HGXa+FeVH5JwY3bwubM1EJrP+LG95rh6oU9TbtzHZLs1ECpl5mCXv5FcYF8SgNjk","product-tours.js":"sha384-TlWlQfnDBI1yB3+CuhSTePe38C4bKqQwtK1m0/T6kk/EAsKbWvIya0UeuVkDmSV7","recorder.js":"sha384-t08QiFh+RHB6Jdz9IrPZ5yxf3Dzwdz92Mz0l8Ga/nox8o5+oO0I0gosm16hHDlCF","surveys.js":"sha384-voLXJFCjNwKYjWdB/DrH+XOQ4hYyH7Vi7xz/L+k8Z3WqCkKR6AnlC/ypiOR3UVIT","tracing-headers.js":"sha384-Zb7V2jbC5lJGl7yFzBe8HpCvO3xgJln/lEcqY5xAQ9Z1LLCnbi2glbsfvRPRIYcD","web-vitals-soft-navs.js":"sha384-recN8i2tLQWaeNtCAnErAmFlgg4+33FAHvs8l84aE+SHr6oqLAPwhFVZdP4SfKT6","web-vitals-with-attribution-soft-navs.js":"sha384-f9L4YQQre9lKeUzyvy2Kt4dHLIXECipeMmbr7SPQAOqLi+ZCHbh1I1g/OwsK/zrp","web-vitals-with-attribution.js":"sha384-QVSLDmgzPE1K6g6gBB8QKx/YDQbI2ot0gAcajFIAkGf34SWA3oe6m+WzcmbzpVjD","web-vitals.js":"sha384-wNvgQ2MIesvfVwpUOblaIO/5weiMjR0Ld1eSNtW14MURV24BwfW8Svo6TsBJ3Bk9"},yx=/^sha384-[A-Za-z0-9+/]{64}$/,bx=Hr("[ExternalScriptsLoader]"),_x=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]},wx=(t,e,i)=>{i?bx.critical(e):bx.warn(e),t(e)},kx=(t,e,i,s)=>{if(t.config.disable_external_dependency_loading)return bx.warn(`${e} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const r=()=>{if(null==n||n.removeEventListener("DOMContentLoaded",r),t.config.disable_external_dependency_loading)return i("Loading of external scripts is disabled");if(!n)return i("document not found");let l=n.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",s&&(l.integrity=s),l.src=e,l.onload=t=>{l.__posthog_loading_callback_fired=!0,i(void 0,t)},l.onerror=t=>{l.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(l=t.config.prepare_external_dependency_script(l)),!l)return i("prepare_external_dependency_script returned null");if(s&&(!l.src||l.integrity!==s||"anonymous"!==l.crossOrigin))return wx(i,`prepare_external_dependency_script must keep src, integrity and crossOrigin 'anonymous' for ${e}`,!0);if(t.config.disable_external_dependency_loading)return i("Loading of external scripts is disabled");const a=_x(l.src);if(a){if(a.integrity!==l.integrity||a.crossOrigin!==l.crossOrigin||a.nonce!==l.nonce)return i("Existing script conflicts with prepared script policy");if(a.__posthog_loading_callback_fired)return i();const t=a.__posthog_loading_error;return t?i(t):(a.addEventListener("load",t=>{a.__posthog_loading_callback_fired=!0,i(void 0,t)}),void a.addEventListener("error",t=>{a.__posthog_loading_error=t,i(t)}))}if(!n.body)return o();if("head"===t.config.external_scripts_inject_target)n.head.appendChild(l);else{const t=n.querySelectorAll("body > script");var u;t.length>0?null===(u=t[0].parentNode)||void 0===u||u.insertBefore(l,t[0]):n.body.appendChild(l)}},o=()=>{null==n||n.addEventListener("DOMContentLoaded",r)};(null==n?void 0:n.body)||_x(e)?r():o()},Sx={},xx=(t,e)=>{let i=`/static/${e}.js?v=${t.version}`;if("toolbar"===e){const t=3e5;i=`${i}&t=${Math.floor(Date.now()/t)*t}`}return t.requestRouter.endpointFor("assets",i)};h.__PosthogExtensions__=h.__PosthogExtensions__||{};const $x=(t,e,i)=>{if(t.config.require_subresource_integrity){if("remote-config"===e||"toolbar"===e)return wx(i,`${e} can't be integrity-verified, so it is not loaded with require_subresource_integrity`);if(!n||!("integrity"in n.createElement("script")))return wx(i,"This browser does not support Subresource Integrity",!0);const s=`${e}.js`,r=mx[s];return Ee(r)&&yx.test(r)?void kx(t,t.requestRouter.endpointFor("assets",`/static/${t.version}/${s}`),i,r):wx(i,`No integrity hash for ${s}`,!0)}if("remote-config"===e){const e=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void kx(t,e,i)}const s=t.config.strict_script_versioning;if(s){const n=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=Sx[n];if("fallback"===s&&r){if(_x(r))return void kx(t,r,i);delete Sx[n]}return void kx(t,n,"fallback"===s?(s,r)=>{if(s)if("string"==typeof s)i(s);else{var o;const s=xx(t,e);Sx[n]=s;const r=_x(n);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),kx(t,s,i)}else i(void 0,r)}:i)}kx(t,xx(t,e),i)};Cw=$x,h.__PosthogExtensions__.loadExternalDependency=$x,h.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{if(t.config.require_subresource_integrity)return wx(i,`Site apps can't be integrity-verified, so ${e} is not loaded with require_subresource_integrity`);const n=t.requestRouter.endpointFor("api",e);kx(t,n,i)};var Tx=class{constructor(t){this._instance=t}get Yr(){return this._instance.config}get consent(){return this.eu()?0:this.iu}isOptedOut(){return"always"===this.Yr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Yr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Yr.opt_out_capturing_by_default}optInOut(t){this.nu.$t(this.su,t?1:0,this.Yr.cookie_expiration,this.Yr.cross_subdomain_cookie,this.Yr.secure_cookie)}reset(){this.nu.Dt(this.su,this.Yr.cross_subdomain_cookie)}get su(){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 iu(){const t=this.nu.Lt(this.su);return He(t)?1:ge(We,t)?0:-1}get nu(){const t=this.Yr.opt_out_capturing_persistence_type,e="localStorage"===t?Ua:Ba,i=e.Ot()?e:eu;if(!this.ru||this.ru!==i){this.ru=i;const e="localStorage"===t?Ba:Ua;e.Lt(this.su)&&(this.ru.Lt(this.su)||this.optInOut(He(e.Lt(this.su))),e.Dt(this.su,this.Yr.cross_subdomain_cookie))}return this.ru}eu(){return!!this.Yr.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,h.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(t=>He(t))}};const Cx=Hr("[Dead Clicks]"),Ex=()=>!0,Mx=t=>{var e;const i=!!(null===(e=t.instance.persistence)||void 0===e?void 0:e.get_property(Y)),n=t.instance.config.capture_dead_clicks;return Pe(n)?n:!!$e(n)||i};var Ix=class{get lazyLoadedDeadClicksAutocapture(){return this.ou}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({[Y]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lu(()=>{this.au()}):this.stop()}lu(t){var e,i;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)?t():null===(i=Ew(this.instance))||void 0===i||i(this.instance,"dead-clicks-autocapture",e=>{e?Cx.error("failed to load script",e):t()})}au(){var t;if(n){if(!this.ou&&(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=$e(this.instance.config.capture_dead_clicks)?ue({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.ou=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ou.start(n),Cx.info("starting...")}}else Cx.error("`document` not found. Cannot start.")}stop(){this.ou&&(this.ou.stop(),this.ou=void 0,Cx.info("stopping..."))}};const Rx=Hr("[SegmentIntegration]");function Ax(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()||La();t.config.get_device_id=s,n&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property(Ct,Kt)),i(n?void 0:e.anonymousId()||void 0)},r=e.user();"then"in r&&xe(r.then)?r.then(s):s(r)}(t,s,i=>{s.register(((t,e,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||Rx.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()||(Rx.info("No userId set, resetting PostHog"),t.reset()),r||(e=void 0),n.event.userId&&n.event.userId!==t.get_distinct_id()&&(Rx.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 Rx.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=>{Rx.error("Failed to register the Segment integration",t),e()})},i)}const Ox="posthog-js";function Px(t,{organization:e,projectId:i,prefix:n,severityAllowList:s=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var l,a,u,c,h;if("*"!==s&&!s.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const d=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,t.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const v=(null===(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===(c=v[0])||void 0===c?void 0:c.value)||o.message,$sentry_exception_type:null===(h=v[0])||void 0===h?void 0:h.type,$sentry_tags:o.tags};var g;return e&&i&&(p.$sentry_url=(n||"https://sentry.io/organizations/")+e+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(g=t.exceptions)||void 0===g||g.sendExceptionEvent(p)),o}}var Fx=class{constructor(t,e,i,n,s,r){this.name=Ox,this.setupOnce=function(o){o(Px(t,{organization:e,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:null==r||r}))}}},Lx=class{constructor(t){this.uu=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Ur.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.cu=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.hu()}hu(){var t;this.du=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.uu)}destroy(){var t;null===(t=this.du)||void 0===t||t.call(this),this.du=void 0}doPageView(e,i){var n;const s=this.vu(e,i);return this.cu={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.vu(t,null===(e=this.cu)||void 0===e?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.cu)||void 0===t?void 0:t.pageViewId}}vu(t,e){const i=this.cu;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(!(Ce(t)||Ce(e)||Ce(i)||Ce(r)||Ce(o)||Ce(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?Qe(e/t,0,1,Ur):1,a=t>1?Qe(i/t,0,1,Ur):1,u=r>1?Qe(o/r,0,1,Ur):1,c=r>1?Qe(l/r,0,1,Ur):1;n=Gr(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:c})}}return i.pathname&&(n.$prev_pageview_pathname=i.pathname),i.timestamp&&(n.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),n}};const Dx=["flags","surveys"],Nx={[L]:{exposure:"hidden"},[q]:{exposure:"hidden"},[B]:{exposure:"hidden"},[V]:{exposure:"hidden"},[U]:{exposure:"hidden"},[W]:{exposure:"hidden"},[M]:{exposure:"event"},[G]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[J]:{exposure:"event"},[Q]:{exposure:"hidden"},[Z]:{exposure:"event"},[K]:{exposure:"event"},[Y]:{exposure:"event"},[X]:{exposure:"hidden"},[et]:{exposure:"event"},[it]:{exposure:"hidden"},[nt]:{exposure:"hidden"},[ut]:{exposure:"hidden"},[ct]:{exposure:"event"},[st]:{exposure:"event",shouldSkipFromEventProperties:t=>Ie(t)},[ht]:{exposure:"event"},[dt]:{exposure:"event"},[vt]:{exposure:"event"},[mt]:{exposure:"event"},[yt]:{exposure:"hidden"},[b]:{exposure:"hidden",storageGroup:"flags"},[v]:{exposure:"hidden",storageGroup:"flags"},[d]:{exposure:"hidden"},[f]:{exposure:"hidden",storageGroup:"flags"},[x]:{exposure:"hidden",storageGroup:"flags"},[m]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[y]:{exposure:"hidden",storageGroup:"flags"},[T]:{exposure:"hidden"},[C]:{exposure:"hidden"},[w]:{exposure:"hidden"},[_]:{exposure:"hidden"},[I]:{exposure:"hidden",storageGroup:"surveys"},[R]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[O]:{exposure:"event"},[P]:{exposure:"hidden"},[F]:{exposure:"hidden"},[_t]:{exposure:"hidden"},[wt]:{exposure:"hidden"},[kt]:{exposure:"hidden"},[St]:{exposure:"event"},[xt]:{exposure:"event"},[$t]:{exposure:"event"},[Tt]:{exposure:"event"},[k]:{exposure:"hidden"},[S]:{exposure:"hidden"},[bt]:{exposure:"event"},[p]:{exposure:"hidden"},[g]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ct]:{exposure:"hidden"},[Et]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[At]:{exposure:"hidden"},[Ot]:{exposure:"hidden"},[rt]:{exposure:"event"},[ot]:{exposure:"event"},[lt]:{exposure:"event"},[at]:{exposure:"event"},[Lt]:{exposure:"event"},[Dt]:{exposure:"event"},[Nt]:{exposure:"hidden"},[jt]:{exposure:"hidden"},[qt]:{exposure:"hidden"},[Bt]:{exposure:"hidden"},[zt]:{exposure:"hidden"},[Ut]:{exposure:"hidden"},[Ht]:{exposure:"hidden"},[Wt]:{exposure:"hidden"},[Vt]:{exposure:"hidden"},[Qt]:{exposure:"event"}},jx=[[ft,{exposure:"hidden"}],[pt,{exposure:"hidden"}],[gt,{exposure:"hidden"}]],qx=t=>{const e=Nx[t];if(e)return e;for(const[e,i]of jx)if(0===t.indexOf(e))return i},Bx={flags:g,surveys:R},zx=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ux=t=>`${t}_cookie_identity_change_pending`,Hx=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},Wx="main",Vx=[b,v,f,x,m,g,y,w],Gx=t=>-1!==Vx.indexOf(t),Jx=[U,W],Qx=t=>-1!==Jx.indexOf(t),Zx=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},Kx=t=>{if(!t)return{};const e=JSON.parse(t);return $e(e)?e:{}},Yx=t=>{const e=t[f];return $e(e)?ue(ue({},t),{},{[f]:Object.fromEntries(Object.entries(e).map(([t,e])=>{var i;if(!$e(e)||!("value"in e)||1!==(null===(i=e.metadata)||void 0===i?void 0:i.config_version))return[t,e];const n=ue(ue({},e),{},{metadata:ue({},e.metadata)});delete n.value;for(const t of["config_version","rule_type","rule_id","variant_key","forced_variant"])delete n.metadata[t];return[t,n]}))}):t},Xx=(t,e)=>{Vr(t,(i,n)=>{const s=qx(n);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,n)||delete t[n]})};var t$=class{constructor(e,i,n=!0,s=!e.cookieless_mode){if(this.fu={},this.pu=!1,this.gu=!1,this.mu=!1,this.yu=!1,this.bu=!1,this._u=new Map,this.wu=!1,this.ku=!1,this.Su=!1,this.xu=new Set,this.$u=new Set,this.Yr=e,this.Cu=n,this.props={},this.Tu=void 0,this.Mu=(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.Ai=e.disable_persistence||!!i,this.nu=this.Iu(e),this.mu=this.Eu(e),this.load(s),this.Au(),e.debug&&Ur.info("Persistence loaded",e.persistence,ue({},this.props)),this.update_config(e,e,i),this.save(),t){const e=()=>this.flush();to(t,"beforeunload",e,{capture:!1}),to(t,"pagehide",e,{capture:!1}),this.Ru=e=>{if(this.pu&&(!e.storageArea||e.storageArea===(null==t?void 0:t.localStorage))&&e.key)if(e.key!==this.Mu){if(this.mu){const t=Dx.find(t=>e.key===this.Pu(t));t&&this.Ou(e.key,t)}}else this.Ou(e.key,Wx)},to(t,"storage",this.Ru)}}reconcileFeatureFlagsBeforeMerge(){return!(this.Ai||this.bu||this.wu)&&this.Fu()}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,e])=>{const i=this._u.get(t);if(!Gx(t)||!0===i)return;if(!0===e)return void this.Lu(t,!0);const n=new Set(i||[]);e.forEach(t=>n.add(t)),n.size&&this.Lu(t,n)})}onCrossTabFeatureFlagChange(t){return this.$u.add(t),()=>this.$u.delete(t)}destroy(){this.Ru&&t&&(t.removeEventListener("storage",this.Ru),this.Ru=void 0),this.$u.clear()}Ou(t,e,i=!0){if(this.Ai)return!1;let n,s;try{if(s=Ua.Lt(t),Ie(s)){const t=this.Du(e);return t.storageValue=null,e!==Wx?t.persisted=!1:this.Nu({}),!1}n=Kx(s)}catch(t){return!1}e===Wx&&this.Nu(n);const r=e===Wx?n:Ua.Pt(this.Mu);if(r&&this.ju(r))return!1;const o=this.qu(n,e,i);return e===Wx&&this.mu&&!Zx(this.Bu().main,n)||this.zu(n,e,!0,s),o}ju(t){const e=this.props[D],i=t[D];return!Ce(e)&&!Ce(i)&&e!==i}zu(t,e,i,n){const s=this.Du(e);s.storageValue=n,e!==Wx&&(s.persisted=i);try{s.fingerprint=this.Hu(t,e)}catch(t){s.fingerprint=void 0}}qu(t,e,i){let n=!1;return Vx.forEach(i=>{var s;const r=null===(s=qx(i))||void 0===s?void 0:s.storageGroup;if(e===Wx&&this.mu&&r||e!==Wx&&r!==e)return;const o=i in t,l=this.Uu(i,o?t[i]:void 0),a=this._u.has(i)?i in this.props:o;a===i in this.props&&Zx(l,this.props[i])||(a?this.Wu(i,l,!1):this.Vu(i,!1),n=!0)}),n&&i&&this.$u.forEach(t=>t()),n}Nu(t){const e=this.gu&&this.Yr.cookieWinsOnConflict?[...Wa,...this.Yr.cookie_persisted_properties||[]]:[];Jx.forEach(i=>{this.xu.has(i)||-1!==e.indexOf(i)||(i in t?Zx(t[i],this.props[i])||this.Wu(i,t[i],!1):i in this.props&&this.Vu(i,!1))})}Gu(){return this.gu&&this.pu&&!this.Yr.cookieWinsOnConflict}Ju(){if(!this.Gu())return;let t,e;try{t=Ba.Lt(this.Mu)||void 0}catch(t){return}if(t&&t!==this.Qu){this.Qu=t;try{e=Ja(JSON.parse(t))}catch(t){return}Jx.forEach(t=>{!(t in e)||t in this.props||this.xu.has(t)||this.Wu(t,e[t],!1)})}}Zu(t){if(this.Gu())try{const e=JSON.stringify(Qa(t,this.Yr.cookie_persisted_properties||[])),i=Ba.Lt(this.Mu)||void 0;i===e&&(this.Qu=i)}catch(t){}}Fu(){if(!this.pu)return!1;try{this.Su=!1;const t=Ua.Lt(this.Mu),e=this.Du(Wx);let i,n=!1,s=!1;if(t!==e.storageValue)if(Ie(t))Ee(e.storageValue)&&this.Nu({}),e.storageValue=null;else{if(i=Kx(t),this.Nu(i),this.Su=!this.ku&&this.ju(i),this.Su)return!1;s=this.qu(i,Wx,!1),!this.mu||Zx(this.Bu().main,i)?this.zu(i,Wx,!0,t):e.storageValue=t,n=!0}return this.mu&&Dx.forEach(t=>{const e=Ua.Lt(this.Pu(t)),r=this.Du(t),o=i||{},l=n&&Vx.some(e=>{var i;return(null===(i=qx(e))||void 0===i?void 0:i.storageGroup)===t&&e in o});if(e===r.storageValue&&!l)return;if(Ie(e))return r.storageValue=null,r.persisted=!1,void(l&&(s=this.qu(o,t,!1)||s));const a=Kx(e);s=this.qu(a,t,!1)||s,this.zu(a,t,!0,e)}),s}catch(t){return!1}}Lu(t,e){this._u.set(t,e);const i=qx(t);(null==i?void 0:i.volatile)||(this.Du((this.mu?null==i?void 0:i.storageGroup:void 0)||Wx).fingerprint=void 0,this.Ku(t))}Yu(){Vx.forEach(t=>this._u.set(t,!0))}Au(){if(this.pu)try{const t=Ua.Lt(this.Mu),e=Kx(t);this.Du(Wx).storageValue=t,Vx.forEach(t=>{var i;const n=this.mu?null===(i=qx(t))||void 0===i?void 0:i.storageGroup:void 0,s=n?Ua.Lt(this.Pu(n)):null;if(n){const t=this.Du(n);t.storageValue=s,t.persisted=!Ie(s)}const r=n&&!Ie(s)?Kx(s):e;t in this.props?this.Xu(t,r[t],this.props[t]):t in r&&this.Lu(t,!0)})}catch(t){}}Uu(t,e){const i=this._u.get(t);if(!i)return e;if(!0===i)return this.props[t];if("$active_feature_flags"===t){const n=new Set(Se(e)?e:[]),s=new Set(Se(this.props[t])?this.props[t]:[]);return i.forEach(t=>s.has(t)?n.add(t):n.delete(t)),Array.from(n)}const n=$e(e)?ue({},e):{},s=$e(this.props[t])?this.props[t]:{};return i.forEach(t=>{t in s?n[t]=s[t]:delete n[t]}),n}Xu(t,e,i){if(!Gx(t))return;const n=this._u.get(t);if(!0===n)return;let s=e;if(this.pu)try{var r;const e=this.mu?null===(r=qx(t))||void 0===r?void 0:r.storageGroup:void 0,i=e?this.Pu(e):this.Mu;s=Kx(Ua.Lt(i))[t]}catch(t){}const o=new Set(n||[]);if("$active_feature_flags"===t){if(!Ce(e)&&!Se(e)||!Ce(s)&&!Se(s)||!Se(i))return void this.Lu(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(!$e(i))return void(Zx(s,i)?this._u.delete(t):this.Lu(t,!0));{if(!Ce(e)&&!$e(e)||Ce(e)&&Te(i)&&Ce(s))return void this.Lu(t,!0);const n=$e(e)?e:{},r=$e(s)?s:{};new Set([...Object.keys(n),...Object.keys(i)]).forEach(t=>{t in n==t in i&&Zx(n[t],i[t])||o.add(t)}),o.forEach(t=>{t in r==t in i&&Zx(r[t],i[t])&&o.delete(t)})}}o.size?this.Lu(t,o):this._u.delete(t)}tc(){var t;const e=null===(t=this.Yr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Ae(e)&&e>0?e:0}ec(t){if(this.Yr.cookieWinsOnConflict&&"localstorage+cookie"===this.Yr.persistence.toLowerCase())if(t)try{const e=Qa(t,this.Yr.cookie_persisted_properties||[]),i=Ka(e,this.Yr.cookie_persisted_properties||[]),n=JSON.stringify(e)+"|"+JSON.stringify(i),s=Ba.Lt(this.Mu)||void 0;s&&Xa(this.Mu,s)===n&&(this.nc=n,this.sc=s)}catch(t){}else try{const t=Ba.Lt(this.Mu)||void 0;this.nc=t?Xa(this.Mu,t):void 0,this.sc=t}catch(t){}}syncCookieProperties(){return this.rc(this.Yr)}rc(t,e=!1){if(this.Ai&&!e||this.bu||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let i;try{i=Ba.Lt(this.Mu)||void 0}catch(t){}if(!i||i===this.sc)return!1;const n=Xa(this.Mu,i);let s;try{s=Ja(JSON.parse(i))}catch(t){return!1}if((Ba.Lt(this.Mu)||void 0)!==i)return!1;this.nc=n,this.sc=i;const r=Ya(this.Mu,i),o=[...Wa,...r.properties],l={};if(Object.keys(s).forEach(t=>{const e=s[t];(Ce(e)||Ie(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e)&&(l[t]=!0,delete s[t])}),Te(s))return!1;const a="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,u=this.props,c=u[D],h=u[Ct],d=Gr({},u);[...Wa,...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===Wa.indexOf(t)||!1!==e&&0!==e)&&delete d[t]}}),this.props=Gr(d,s),Vx.forEach(t=>{const e=t in this.props;t in u===e&&Zx(u[t],this.props[t])||(e?this.Xu(t,u[t],this.props[t]):this.Lu(t,!0))}),!a||"$user_state"in s||"$user_state"in this.props||this.Wu(Ct,Zt);const y=this.props[D],S=this.props[Ct];return!a||y===c&&S===h||(this.ku=!0,this.yu=!0,nu.$t(Ux(this.Mu),!0),this.Vu(w),this.Vu(v),this.Vu(b),this.Vu(f),this.Vu(x),this.Vu(m),this.Vu(g),this.Vu(p),this.Vu(k),"anonymous"!==S||"identified"!==h&&"anonymous"!==s.$user_state&&(Ce(c)||y===c)||(Xx(this.props,s),this.Vu(_)),"identified"===S?this.props.$user_id=y:delete this.props.$user_id,this.Vu(q)),!0}consumeCookieIdentityChange(){const t=Ux(this.Mu),e=this.yu||!!nu.Lt(t);return this.yu=!1,e&&nu.Dt(t),e}oc(t=!1){return!(this.bu||this.Ai&&!t||!this.Yr.cookieWinsOnConflict||"localstorage+cookie"!==this.Yr.persistence.toLowerCase()||(this.bu=!0,0))}lc(){this.bu&&(Ce(this.ac)||(clearTimeout(this.ac),this.ac=void 0),delete this.fu[Wx],this.uc(!0))}cc(t=!0){if(this.bu)try{t?this.lc():Ce(this.ac)||(clearTimeout(this.ac),this.ac=void 0)}finally{this.bu=!1}}isDisabled(){return!!this.Ai}Iu(e){-1===zx.indexOf(e.persistence.toLowerCase())&&(Ur.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const i=((e=[],i=!1,n=()=>!1)=>{const s=[...Wa,...e];return ue(ue({},Ua),{},{Pt(t){try{let r,o={};try{r=Ba.Lt(t)||void 0,o=r?Ja(JSON.parse(r)):{}}catch(t){}const l=JSON.parse(Ua.Lt(t)||"{}");let a;if(i){const i=Ya(t,r),n=[...Wa,...i.properties],u={};Object.keys(o).forEach(t=>{const e=o[t];Ie(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e||(u[t]=e)});const c="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var e;const t=l[D],r=null!==(e=l.$user_state)&&void 0!==e?e:Zt;s.forEach(t=>{if(-1!==n.indexOf(t)&&!(t in o)&&(c||"distinct_id"!==t&&"$user_state"!==t)){const e=l[t];(i.isValid||-1===Wa.indexOf(t)||!1!==e&&0!==e)&&delete l[t]}}),!c||"$user_state"in o||"$user_state"in l||(l[Ct]=Zt),!c||("distinct_id"in u?u[D]:l[D])===t&&("$user_state"in u?u[Ct]:l[Ct])===r||(Ha.forEach(t=>delete l[t]),"identified"===u.$user_state&&"distinct_id"in u?l.$user_id=u[D]:delete l.$user_id,"identified"!==u.$user_state&&(delete l[bt],delete l[_]),delete l.__alias)}a=Gr(l,u)}else a=Gr(o,l);return n()||Ua.$t(t,a),a}catch(t){}return null},$t(t,n,s,r,o,l){const a=Ua.$t(t,n,void 0,void 0,l);try{const u=Qa(n,e);if(Object.keys(u).length){if(i){const i=Va(t),c=Ka(u,e);if(Ba.$t(i,c,s,r,o,l),Ba.Lt(i)!==JSON.stringify(c)){Ba.Dt(i,r);const e=Qa(n);return Ba.$t(t,e,s,r,o,l),a}}Ba.$t(t,u,s,r,o,l)}}catch(t){Ua.Ft(t)}return a},Dt(e,i){try{null==t||t.localStorage.removeItem(e),Ba.Dt(e,i),Ba.Dt(Va(e),i)}catch(t){Ua.Ft(t)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict,()=>!!this.Ai);let n,s=!1,r=!1;const o=e.persistence.toLowerCase();return"localstorage"===o&&Ua.Ot()?(n=Ua,r=!0):"localstorage+cookie"===o&&i.Ot()?(n=i,r=!0,s=!0):"sessionstorage"===o&&nu.Ot()?n=nu:"memory"===o?n=eu:"cookie"===o&&Ba.Ot()?(n=Ba,s=!0):i.Ot()?(n=i,r=!0,s=!0):Ba.Ot()?(n=Ba,s=!0):n=eu,this.pu=r,this.gu=s,n}Pu(t){return`${this.Mu}__${t}`}Eu(t){return this.pu&&!!t.split_storage}properties(){const t={};return Vr(this.props,(e,i)=>{const n=qx(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.Ai&&!t)return;const e=this.Yr.cookieWinsOnConflict&&"localstorage+cookie"===this.Yr.persistence.toLowerCase(),i=e?Ua.Pt(this.Mu):null;let n={};if(e)try{n=Ja(Ba.Pt(this.Mu)),Vr(n,(t,e)=>{(Ce(t)||Ie(t)||""===t)&&delete n[e]})}catch(t){}const s=this.nu.Pt(this.Mu);if(s&&(this.props=Gr({},s)),this.mu&&this.hc(),e&&s){var r,o;const t=null==i?void 0:i[D],e=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Zt,l=s[D],a=null!==(o=s.$user_state)&&void 0!==o?o:Zt,u=nu.Pt(this.Mu),c=!Ce(t)||!Ce(null==i?void 0:i.$user_state)||!!u&&!Te(u);if(l!==t||a!==e){c&&(this.yu=!0,this.Ai||nu.$t(Ux(this.Mu),!0));const i=Gr({},this.props);Ha.forEach(t=>delete i[t]),c&&"anonymous"===a&&("identified"===e||"anonymous"===n.$user_state||!Ce(t)&&l!==t)&&(Xx(i,n),delete i[_]),this.props=i;const s=new Set;Ha.forEach(t=>{var e;const i=null===(e=qx(t))||void 0===e?void 0:e.storageGroup;i&&s.add(i)}),s.forEach(t=>{if(this.Ai)return;const e={};Vr(this.props,(i,n)=>{var s;(null===(s=qx(n))||void 0===s?void 0:s.storageGroup)===t&&(e[n]=i)});const i=Yx(e);Te(e)?(Ua.Dt(this.Pu(t)),this.fu[t]={}):Ua.$t(this.Pu(t),i)&&(this.fu[t]={persisted:!0,fingerprint:this.Hu(i,t)})})}}nu.Lt(Ux(this.Mu))&&(this.yu=!0)}hc(){for(const t of Dx){const e=Ua.Pt(this.Pu(t));if(e&&!Te(e)){const i=this.Du(t);i.persisted=!0,this.dc(t)||(i.fingerprint=this.Hu(e,t)),this.vc(t,e)||Gr(this.props,e)}}}dc(t){return Object.keys(this.props).some(e=>{var i;return(null===(i=qx(e))||void 0===i?void 0:i.storageGroup)===t})}vc(t,e){const i=Bx[t];if(!i)return!1;const n=e[i],s=this.props[i];return Ae(n)&&Ae(s)&&s>n}refreshKey(t){this.fc([t])}fc(t){if(this.Ai)return;let e,i=!1;const n=()=>(i||(e=this.nu.Pt(this.Mu),i=!0),e);t.forEach(t=>{var e;if(this.xu.has(t))return;const i=this.mu?null===(e=qx(t))||void 0===e?void 0:e.storageGroup:void 0,s=i?Ua.Pt(this.Pu(i)):n();if(s&&t in s)this.Wu(t,s[t],!1);else{if(i){const e=n();if(e&&t in e)return void this.Wu(t,e[t],!1)}this.Vu(t,!1)}})}refreshMetaIdentifiers(){this.Ai||(this.gc()?this.mc():this.fc(Jx))}mc(){const t=this.yc();(Ce(t)||t!==this.bc)&&(this.fc(Jx),this._c(t))}_c(t=this.yc()){this.bc=0===this.xu.size?t:void 0}refreshMetaIdentifiersBeforeCapture(){this.Ai||this.bu||(this.gc()||this.Ju(),this.mc())}gc(){return this.nu===Ba||this.nu===nu||this.nu===eu}yc(){const t=this.nu.Lt(this.Mu);return Ee(t)?t:void 0}save(){if(this.Ai)return;const t=this.tc();t>0?Ce(this.ac)&&(this.ac=setTimeout(()=>{this.ac=void 0,this.uc()},t)):this.uc()}flush(){Ce(this.ac)||(clearTimeout(this.ac),this.ac=void 0,this.uc())}uc(t=!1){if(this.Ai||this.bu&&!t)return;t||(this.syncCookieProperties(),this.gc()&&this.refreshMetaIdentifiers());const e=!t&&!this.wu;e||(this.Su=!1);const i=!!e&&this.Fu();if(this.Su)return void(this.Yr.debug&&Ur.warn("skipping persistence write because storage belongs to a different distinct ID"));if(t||this.Ju(),this.mu)return this.wc(),void(i&&this.$u.forEach(t=>t()));const n=this.kc(this.nu,this.Mu,this.props,Wx);"written"===n&&(this.ec(this.props),this.Zu(this.props)),"failed"!==n&&(this._u.clear(),this.ku=!1,this.xu.clear()),"written"===n&&this._c(),i&&this.$u.forEach(t=>t())}wc(){const{main:t,groups:e}=this.Bu(),i=this.kc(this.nu,this.Mu,t,Wx);"written"===i&&(this.ec(t),this.Zu(t)),"failed"!==i&&(this.ku=!1,this.xu.clear(),Vx.forEach(t=>{var e;(null===(e=qx(t))||void 0===e?void 0:e.storageGroup)||this._u.delete(t)})),"written"===i&&this._c();for(const t of Dx){var n;const i=e[t];if(Te(i)&&!(null===(n=this.fu[t])||void 0===n?void 0:n.persisted)){Vx.forEach(e=>{var i;(null===(i=qx(e))||void 0===i?void 0:i.storageGroup)===t&&this._u.delete(e)});continue}const s=this.kc(Ua,this.Pu(t),i,t);"failed"!==s&&Vx.forEach(e=>{const i=qx(e);(null==i?void 0:i.storageGroup)!==t||"written"!==s&&i.volatile||this._u.delete(e)})}}Bu(){const t={},e={flags:{},surveys:{}};return Vr(this.props,(i,n)=>{var s;const r=null===(s=qx(n))||void 0===s?void 0:s.storageGroup;r?e[r][n]=i:t[n]=i}),{main:t,groups:e}}Hu(t,e){if(e===Wx)return JSON.stringify(t)+"|"+this.Sc+"|"+this.xc+"|"+this.$c;const i={};return Vr(t,(t,e)=>{var n;i[e]=(null===(n=qx(e))||void 0===n?void 0:n.volatile)?"__volatile__":t}),JSON.stringify(i)}kc(t,e,i,n){const s=this.Du(n);if(n!==Wx&&!s.dirty&&!Ce(s.fingerprint))return"skipped";let r,o=i;try{if(o=Yx(i),r=this.Hu(o,n),r===s.fingerprint)return s.dirty=!1,"skipped"}catch(t){r=void 0}return t.$t(e,o,this.Sc,this.xc,this.$c,this.Yr.debug)?(s.dirty=!1,n!==Wx&&(s.persisted=!0),Ce(r)||(s.fingerprint=r),this.pu&&(s.storageValue=Ua.Lt(e)),"written"):(this.Yr.debug&&Ur.warn(`failed to persist storage entry "${e}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.Yu(),Ce(this.ac)||(clearTimeout(this.ac),this.ac=void 0),this.nu.Dt(this.Mu,!1),this.nu.Dt(this.Mu,!0),!t&&this.Cu)for(const t of Dx)Ua.Dt(this.Pu(t));t?delete this.fu[Wx]:this.fu={},this.nc=void 0,this.sc=void 0,this.Qu=void 0}clear(){this.remove(),this.props={},this.Tu=void 0}register_once(t,e,i){if($e(t)){this.syncCookieProperties(),Ce(e)&&(e="None"),this.Sc=Ce(i)?this.Cc:i;let n=!1;if(Vr(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Wu(i,t),n=!0)}),n)return this.save(),!0}return!1}register(t,e){if($e(t)){this.syncCookieProperties(),this.Sc=Ce(e)?this.Cc:e;let i=!1;if(Vr(t,(e,n)=>{t.hasOwnProperty(n)&&(this.props[n]!==e||$e(e)||Se(e))&&(this.Wu(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.Vu(t),i=!0);i&&this.save()}update_campaign_params(){const t=null==n?void 0:n.URL;if(t===this.Tu)return;const e=qu(this.Yr.custom_campaign_params,this.Yr.mask_personal_data_properties,this.Yr.custom_personal_data_properties),i=!Te(Zr(e));return i&&this.register(e),this.Tu=t,i?e:void 0}update_search_keyword(){this.register(function(){const t=null==n?void 0:n.referrer;return t?zu(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:Vu(),$referring_domain:(null==n?void 0:n.referrer)&&(null===(t=io(n.referrer))||void 0===t?void 0:t.host)||Wu},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Gu(this.Yr.mask_personal_data_properties,this.Yr.custom_personal_data_properties,this.Yr.disable_capture_url_hashes);this.register_once({[At]:this.gu?{r:Hx(t.r),u:t.u?Hx(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Vr([Rt,It],e=>{const i=this.props[e];i&&Vr(i,function(e,i){t["$initial_"+ye(i)]=e})});const e=this.props[At];if(e){const i=function(t,e=!1,i,n){const s=Ju(t,e,i,n),r={};return Vr(s,function(t,e){r[`$initial_${ye(e)}`]=t}),r}(e,this.Yr.disable_capture_url_hashes,this.Yr.mask_personal_data_properties,this.Yr.custom_personal_data_properties);Gr(t,i)}return t}safe_merge(t){return Vr(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.Ai&&!l;l||this.rc(e,a),this.Yr=t,!l&&(n||s||o)&&(this.nc=void 0,this.sc=void 0,this.Qu=void 0,this.rc(ue(ue({},t),{},{cookie_persisted_properties:e.cookie_persisted_properties}),a));const u=r||o?this.Iu(t):this.nu;this.Tc();const c=this.Eu(t),h=r||c!==this.mu,d=!l&&(h||t.cross_subdomain_cookie!==this.xc||t.secure_cookie!==this.$c)&&this.oc(a);this.wu=h;try{if(this.Cc=this.Sc=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),h){const t=this.props;this.clear(),this.nu=u,this.mu=c,this.props=t,this.save()}else o&&(this.nu=u,l||(delete this.fu[Wx],this.uc()))}finally{this.wu=!1,d&&this.cc()}}Tc(){const t=this.props[At];if(!this.gu||!$e(t)||"string"!=typeof t.r)return;const e=Hx(t.r),i="string"==typeof t.u?Hx(t.u):t.u;e===t.r&&i===t.u||this.Wu(At,ue(ue({},t),{},{r:e,u:i}))}set_disabled(t){this.Ai=t,this.Ai?this.remove():this.save()}set_cross_subdomain(t){t!==this.xc&&(this.xc=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.$c&&(this.$c=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){const i=this.props.__timers||{};i[t]=e,this.Wu(V,i),this.save()}remove_event_timer(t){const e=this.props.__timers||{},i=e[t];return Ce(i)||(delete e[t],this.Wu(V,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Wu(t,e),this.save()}Wu(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.ku=!0),Qx(t)&&!Zx(s,e)&&this.xu.add(t),this.Xu(t,s,e),(null===(n=qx(t))||void 0===n?void 0:n.volatile)||this.Ku(t))}Vu(t,e=!0){delete this.props[t],e&&(Gx(t)&&this.Lu(t,!0),Qx(t)&&this.xu.add(t),this.Ku(t))}Ku(t){var e;const i=null===(e=qx(t))||void 0===e?void 0:e.storageGroup;i&&(this.Du(i).dirty=!0)}Du(t){return this.fu[t]||(this.fu[t]={})}};const e$={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"},i$={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"},n$=Hr("[RateLimiter]");var s$=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=>{n$.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void n$.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)}get isClientRateLimited(){return 1>this.Mc().tokens}clientRateLimitContext(t=!1){var e;const i=this.Mc(),n=1>i.tokens;if(n||t||(i.tokens=Math.max(0,i.tokens-1)),n&&!t){const t=(Ae(i.dropped)?i.dropped:0)+1;i.dropped=t,!this.lastEventRateLimited&&this.Ic(t)&&(i.dropped=0)}return this.lastEventRateLimited=n,null===(e=this.instance.persistence)||void 0===e||e.set_property("$capture_rate_limit",i),{isRateLimited:n,remainingTokens:i.tokens}}Mc(){var t;const{captureEventsBurstLimit:e,captureEventsPerSecond:i}=this,n=(new Date).getTime(),s=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_property(Mt),r=s?ue({},s):{tokens:e,last:n};return r.tokens+=Math.max(0,n-r.last)/1e3*i,r.last=Math.max(r.last,n),r.tokens>e&&(r.tokens=e),r}Ec(t){const e=this.instance.config.property_denylist;return!Se(e)||!e.includes(t)}Ac(){var t;if(this.Ec("$current_url")&&this.Ec("$pathname")&&(null==s?void 0:s.pathname))return`${null!==(t=s.origin)&&void 0!==t?t:""}${s.pathname}`}Ic(t){var e,i;const{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,r=this.Ac(),o=this.Ec("$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 r$=Hr("[RemoteConfig]");var o$=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=h._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Rc(t){const e=Ew(this._instance);e?e(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Pc(t){const e=this._instance.__pending_remote_config_callbacks;if(e)return void e.push(t);const i=[t];this._instance.__pending_remote_config_callbacks=i;try{this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),batchKey:"remote_config",fireCallbackOnDrop:!0,callback:t=>{this._instance.__pending_remote_config_callbacks=void 0,i.forEach(e=>e(t))}})}catch(t){throw this._instance.__pending_remote_config_callbacks=void 0,t}}load(){try{if(this.remoteConfig)return r$.info("Using preloaded remote config",this.remoteConfig),void this.Oc(this.remoteConfig);if(this._instance.Fc())return void r$.warn("Remote config is disabled. Falling back to local config.");if(!this._instance.config.opt_in_site_apps)return void this.Pc(t=>{this.Oc(t.json,t)});this.Rc(t=>{if(!t)return r$.info("No config found after loading remote JS config. Falling back to JSON."),void this.Pc(t=>{this.Oc(t.json,t)});this.Oc(t)})}catch(t){r$.error("Error loading remote config",t),this.Oc()}}Oc(t,e){!t&&e&&(0===e.statusCode?e.error||r$.warn("Failed to fetch remote config from PostHog."):r$.error("Failed to fetch remote config from PostHog."));try{this._instance.Oc(t?{ok:!0,config:t}:{ok:!1})}catch(t){r$.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){r$.error("Error loading feature flags",t)}}};let l$=!ew&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla"));function a$(t,e,i){var n,s,r,o;i&&(e=ue(ue({},e),{},{callback:t=>i(t)})),t.__loaded?l$?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null===(r=e.callback)||void 0===r||r.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,(Ce(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,null===(s=e.onDispatch)||void 0===s||s.call(e),((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&&Ce(r.compression)&&r.data&&(r.compression=R_.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=bw(r.url,r.method,r.compression,r.timestampMode);const l=_w.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 c=t=>{try{u(t)}catch(t){var e;fw(t)?Ur.warn(t):Ur.error(t),null===(e=r.callback)||void 0===e||e.call(r,{statusCode:0,error:t})}};"sendBeacon"!==o&&!r.preferSyncCompression&&r.data&&r.compression===R_.GZipJS&&a&&"undefined"!=typeof Promise&&!rw?hw(r).then(t=>{c(t)}).catch(e=>{if(ds(e))return rw=!0,void c(ue(ue({},r),{},{compression:void 0,url:bw(t.url,t.method,void 0,t.timestampMode)}));vs(e)&&(rw=!0),c(r)}):c(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===(o=e.callback)||void 0===o||o.call(e,{statusCode:0}))}var u$=class{constructor(t,e){this.Lc=!0,this.Dc=[],this.Nc=Qe((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,Ur.createLogger("flush interval"),3e3),this.jc=t}enqueue(t){this.Dc.push(t),this.qc||this.Bc()}unload(){this.zc();const t=this.Dc.length>0?this.Hc():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.Uc(ue(ue({},t),{},{callback:void 0}),"sendBeacon")})}enable(){this.Lc=!1,this.Bc()}Bc(){this.Lc||(this.qc=setTimeout(()=>{this.zc(),this.Wc()},this.Nc))}Wc(){if(this.Dc.length>0){const t=this.Hc();for(const e in t)this.Uc(t[e])}}Uc(t,e){try{this.jc(t,e)}catch(t){Ur.error(t)}}zc(){clearTimeout(this.qc),this.qc=void 0}Hc(){const t={},e={};Vr(this.Dc,i=>{var n;const s=i,r=((s?s.batchKey:null)||s.url)+(s.batchGroup?`:${s.batchGroup}`:"");Ce(t[r])&&(t[r]=ue(ue({},s),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),e[r]=[]),null===(n=t[r].data)||void 0===n||n.push(s.data),s.callback&&e[r].push(s.callback)});for(const i in e){const n=e[i];n.length&&(t[i].callback=t=>{for(const e of n)e(t)})}return this.Dc=[],t}};const c$=["retriesPerformedSoFar"];var h$=class{constructor(t){this._instance=t,this.Vc=!1,this.Gc=3e3,this.Dc=[],this.Dc=[],this.Jc=!0,this.resume()}resume(){if(!Ce(t)&&"onLine"in t.navigator){if(this.Jc=t.navigator.onLine,this.Qc)return;this.Qc=()=>{this.Jc=!0,this.Wc()},this.Zc=()=>{this.Jc=!1},to(t,"online",this.Qc),to(t,"offline",this.Zc)}}get length(){return this.Dc.length}retriableRequest(t,e){let{retriesPerformedSoFar:i}=t,n=ws(t,c$);Oe(i)&&(n.url=lw(n.url,{retry_count:i})),a$(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.js(ue({retriesPerformedSoFar:i},n),e);0===t.statusCode&&Ur.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)})}js(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.Dc.push({retryAt:s,requestOptions:t});let r=`Enqueued failed request for retry in ${n}`;navigator.onLine||(r+=" (Browser is offline)"),Ur.warn(r),this.Vc||(this.Vc=!0,this.Kc())}Kc(){if(this.Yc&&clearTimeout(this.Yc),0===this.Dc.length)return this.Vc=!1,void(this.Yc=void 0);this.Yc=setTimeout(()=>{this.Jc&&this.Dc.length>0&&this.Wc(),this.Kc()},this.Gc)}Wc(){const t=Date.now(),e=[],i=this.Dc.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.Dc=e,i.length>0)for(const{requestOptions:t}of i)this.retriableRequest(t)}unload(){this.Yc&&(clearTimeout(this.Yc),this.Yc=void 0),this.Vc=!1,Ce(t)||(this.Qc&&(t.removeEventListener("online",this.Qc),this.Qc=void 0),this.Zc&&(t.removeEventListener("offline",this.Zc),this.Zc=void 0));for(const{requestOptions:t}of this.Dc)try{this._instance._send_request(ue(ue({},t),{},{callback:Se(t.data)?void 0:t.callback,transport:"sendBeacon"}))}catch(t){Ur.error(t)}this.Dc=[]}},d$=class{constructor(t){this._instance=t,this.Xc=()=>{var t,e,i,n;this.eh||(this.eh={});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.eh.lastScrollY=Math.ceil(r),this.eh.maxScrollY=Math.max(r,null!==(t=this.eh.maxScrollY)&&void 0!==t?t:0),this.eh.maxScrollHeight=Math.max(o,null!==(e=this.eh.maxScrollHeight)&&void 0!==e?e:0),this.eh.lastContentY=l,this.eh.maxContentY=Math.max(l,null!==(i=this.eh.maxContentY)&&void 0!==i?i:0),this.eh.maxContentHeight=Math.max(a,null!==(n=this.eh.maxContentHeight)&&void 0!==n?n:0)}}get ih(){return this._instance.config.scroll_root_selector}getContext(){return this.eh}resetContext(){const t=this.eh;return this.eh=void 0,setTimeout(this.Xc,0),t}startMeasuringScrollPosition(){to(t,"scroll",this.Xc,{capture:!0}),to(t,"scrollend",this.Xc,{capture:!0}),to(t,"resize",this.Xc)}scrollElement(){if(this.ih){const i=Se(this.ih)?this.ih:[this.ih];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}nh(e){var i,n;const s="y"===e?"scrollTop":"scrollLeft";if(this.ih){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.nh("y")}scrollX(){return this.nh("x")}};const v$=t=>Gu(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 f$=class{constructor(t,e,i,n){this.Je=t=>{const e=this.sh();if(e&&e.sessionId===t)return;const i={sessionId:t,props:this.rh(this._instance)};this.oh.register({[Et]:i})},this._instance=t,this.ah=e,this.oh=i,this.rh=n||v$,this.ah.onSessionId(this.Je)}sh(){return this.oh.props[Et]}getSetOnceProps(){var t;const e=null===(t=this.sh())||void 0===t?void 0:t.props;return e?"r"in e?Ju(e,this._instance.config.disable_capture_url_hashes,this._instance.config.mask_personal_data_properties,this._instance.config.custom_personal_data_properties):{$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 Vr(Zr(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t[`$session_entry_${ye(i)}`]=e}),t}};const p$=Hr("[SessionId]"),g$=864e5;var m$=class{on(t,e){return this.uh.on(t,e)}constructor(t,e,i){var n;if(this.hh=null,this.dh=null,this.fh=[],this.ph=void 0,this.gh=!1,this.uh=new O_,this.mh=(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.Yr=t.config,this.oh=t.persistence,this.Ye=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.yh=void 0,this._sessionActivityTimestamp=null,this.bh=e||La,this._h=i||La;const s=this.Yr.persistence_name||this.Yr.token;if(this._sessionTimeoutMs=1e3*Qe(this.Yr.session_idle_timeout_seconds||1800,60,36e3,p$.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.wh(),this.kh="ph_"+s+"_window_id",this.Sh="ph_"+s+"_primary_window_exists",this.xh()){const t=nu.Pt(this.kh),e=nu.Pt(this.Sh);t&&!e?this.Ye=t:nu.Dt(this.kh),nu.$t(this.Sh,!0)}(null===(n=this.Yr.bootstrap)||void 0===n?void 0:n.sessionID)&&this.setBootstrapSessionId(this.Yr.bootstrap.sessionID),this.$h()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Ce(this.fh)&&(this.fh=[]),this.fh.push(t),this.Xt&&t(this.Xt,this.Ye),()=>{this.fh=this.fh.filter(e=>e!==t)}}xh(){return"memory"!==this.Yr.persistence&&!this.oh.Ai&&nu.Ot()}Ch(t){t!==this.Ye&&(this.Ye=t,this.xh()&&nu.$t(this.kh,t))}Th(){return this.Ye?this.Ye:this.xh()?nu.Pt(this.kh):null}Mh(t){const e=this.hh;return!Ie(e)&&!Ie(t)&&5e3>Math.abs(t-e)}Ih(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.Mh(e)||(this.hh=e,this.oh.register({[ut]:[e,t,i]}))}Eh(){var t;const e=null===(t=this.Yr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Oe(e)&&e>0}Ah(){this.Eh()?this.oh.refreshKey(ut):(this.oh.flush(),this.oh.load())}Rh(){var t;if(Ie(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.hh)return;this.Ah();const[,e,i]=this.Ph();e===this.Xt&&i===this._sessionStartTimestamp&&(this.hh=this._sessionActivityTimestamp,this.oh.register({[ut]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.oh.flush())}Oh(){const[t]=this.Ph(),e=Oe(t)?t:0,i=Oe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Fh(t){return this.Ah(),this.mh(t,this.Oh())}Ph(){const t=this.oh.props[ut];return Se(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.hh=null,this.yh=void 0,clearTimeout(this.Lh),this.Lh=void 0,this.Ih(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 p$.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void p$.error("Invalid sessionID in bootstrap",t)}})(t);return!Ce(i)&&(e?this.yh={sessionId:t,sessionStartTimestamp:i}:this.Ih(t,(new Date).getTime(),i),!0)}destroy(){this.gh=!0,this.Rh(),clearTimeout(this.Lh),this.Lh=void 0,this.ph&&t&&(t.removeEventListener(Xt,this.ph,{capture:!1}),this.ph=void 0),this.fh=[]}$h(){this.ph=()=>{this.Rh(),this.xh()&&nu.Dt(this.Sh)},to(t,Xt,this.ph,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,e=null,i=!1){if("always"===this.Yr.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.dh=n;else if(Ie(this.dh)||this.dh>n||n-this.dh>=1e3){var r,o;null===(r=(o=this.oh).syncCookieProperties)||void 0===r||r.call(o),this.dh=n}let[,l,a]=this.Ph();const u=!Ce(s)&&l!==s,c=this.Oh();let h=this.Th();const d=this.yh,v=!!d&&(d.sessionStartTimestamp>n+6e4||n-d.sessionStartTimestamp>g$),f=d?v:Oe(a)&&Math.abs(n-a)>g$;let p=!1,g=u,m=!l||!!d;const y=l;let b=!m&&!t&&this.mh(n,c);if(b&&(b=this.Fh(n),b||p$.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,a]=this.Ph(),b||(m=!l||!!d)),m||b||f){g=!1;const t=d&&!v;l=t?d.sessionId:this.bh(),h=this._h(),p$.info("new session ID assigned",{sessionId:l,windowId:h,bootstrapped:!!t,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:f}}),a=t?d.sessionStartTimestamp:n,this.yh=void 0,p=!0}else h||(h=this._h(),p=!0),g=g||l!==y,g&&(p$.info("adopted cross-tab session id",{sessionId:l,windowId:h}),p=!0);const _=Oe(c)&&t&&!f?c:n,w=Oe(a)?a:(new Date).getTime();this.Ch(h),this.Ih(l,_,w),t||this.wh();const k={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.fh.forEach(t=>t(l,h,k)),{sessionId:l,windowId:h,sessionStartTimestamp:w,changeReason:p?k:void 0,lastActivityTimestamp:c}}wh(){this.gh||(clearTimeout(this.Lh),this.Lh=setTimeout(()=>{if(!this.gh)if(this.Fh((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.uh.emit("forcedIdleReset",{idleSessionId:t})}else this.wh()},1.1*this.sessionTimeoutMs))}};const y$=Object.freeze(["2026-08-30","2026-08-29","2026-06-25","2026-05-30","2026-01-30","2025-11-30","2025-05-24"]),b$=function(t,e){if(!t)return!1;const i=t.userAgent;if(i&&Je(i,e))return!0;try{const i=null==t?void 0:t.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(t=>Je(null==t?void 0:t.brand,e)))return!0}catch(t){}return!!t.webdriver};function _$(){return _$=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 Ur.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}),_$.apply(this,arguments)}const w$="custom",k$="i.posthog.com",S$=/^\/static\//,x$=["/s/","/e/","/i/"];var $$=class{constructor(t){this.Dh={},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(`.${k$}`,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Dh[this.apiHost]||(this.Dh[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":w$),this.Dh[this.apiHost]}Nh(t){if(!S$.test(t))return;const e=this.instance.config.asset_host;return"string"==typeof e&&e.trim().replace(/\/$/,"")||void 0}jh(t){const e=io(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}qh(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=io(i))||void 0===r?void 0:r.href)||i;n=s(new URL(t)).toString()}if(s&&"api"===t&&x$.some(t=>0===e.indexOf(t))){const t=this.jh(n);if(t){const e=this.apiHost;let i=this.Bh;(null==i?void 0:i.apiHost)===e&&i.rewriteRequestPath===s||(i={apiHost:e,rewriteRequestPath:s,urls:new Set},this.Bh=i),i.urls.add(t)}}return n}isIngestionEndpoint(t){const e=this.Bh,i=this.jh(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.qh(t,e,this.uiHost+e);if("flags"===t)return this.qh(t,e,this.flagsApiHost+e);if("assets"===t){const i=this.Nh(e);if(i)return this.qh(t,e,`${i}${e}`)}if(this.region===w$)return this.qh(t,e,this.apiHost+e);const i=k$+e;switch(t){case"assets":return this.qh(t,e,`https://${this.region}-assets.${i}`);case"api":return this.qh(t,e,`https://${this.region}.${i}`)}}};const T$=Hr("[PostHog ExternalIntegrations]"),C$={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var E$=class{constructor(t){this._instance=t}lu(t,e){var i;null===(i=Ew(this._instance))||void 0===i||i(this._instance,t,t=>{if(t)return T$.error("failed to load script",t);e()})}startIfEnabledOrStop(){var t;for(const[s,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var e,i,n;r&&!(null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[s])&&this.lu(C$[s],()=>{var t;null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[s])||void 0===t||t.start(this._instance)}),!r&&(null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[s])&&(null===(n=h.__PosthogExtensions__)||void 0===n||null===(n=n.integrations)||void 0===n||null===(n=n[s])||void 0===n||n.stop())}}};const M$={};let I$=0;const R$=()=>{},A$='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',O$="Surveys module not available",P$="sanitize_properties is deprecated. Use before_send instead",F$="Invalid value for property_denylist config: ",L$=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],D$=["$feature_flag_called","$$heatmap","$snapshot"],N$=t=>"$"===t.charAt(0)&&!ge(D$,t),j$=/^[A-Za-z0-9_-]{1,400}$/,q$=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,B$=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,z$=["token","distinct_id",Ft],U$="posthog",H$=[...y$].sort()[y$.length-1],W$=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},V$=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:Xr(null==n?void 0:n.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:R$,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_replay_sync_fetch:!0,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&Ee(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null===(i=t.location)||void 0===i?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(t){Ur.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Yt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:R$},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Ao,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:W$(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))},G$=[["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"]],J$=t=>{const e={};for(const[i,n]of G$)Ce(t[i])||(e[n]=t[i]);const i=Gr({},e,t),n=t.__preview_external_dependency_versioned_paths;return Ce(n)||(Ce(t.strict_script_versioning)&&(i.strict_script_versioning=!!n),Ee(n)&&Ce(t.asset_host)&&(i.asset_host=n)),Se(t.property_blacklist)&&(Ce(t.property_denylist)?i.property_denylist=t.property_blacklist:Se(t.property_denylist)?i.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ur.error(F$+t.property_denylist)),i};var Q$=class{constructor(){this.__forceAllowLocalhost=!1}get zh(){return this.__forceAllowLocalhost}set zh(t){Ur.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Z$=class e{Hh(t){if(!t)return;const e=this.Uh.indexOf(t);-1!==e&&this.Uh.splice(e,1)}Wh(t,e){var i;return this.Hh(t),this.Uh.push(e),null===(i=e.initialize)||void 0===i||i.call(e),e}Vh(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}Gh(){if(this.Jh)return;if(!this.Qh||!("capture_pageview"in this.Qh))return;if(ue(ue({},e.__defaultExtensionClasses),this.config.__extensionClasses).historyAutocapture)return;const t=this.config.capture_pageview;("history_change"===t||$e(t)&&(t.path||t.search||t.hash&&!this.config.disable_capture_url_hashes))&&(this.Jh=!0,Ur.warn("capture_pageview is set to capture history changes, but the history autocapture extension is not loaded, so only the first pageview of each page load is captured. With the slim bundle, pass __extensionClasses: { historyAutocapture: AnalyticsExtensions.historyAutocapture } from 'posthog-js/dist/extension-bundles', or set capture_pageview: true to capture page loads only."))}Zh(){if(this.Kh)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.Vh())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.Yh)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.Kh=!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}`)}Xh(){const t=this.persistence;if(!t||this.ed)return;if(this.Vh())return void("on_reject"===this.config.cookieless_mode&&"$posthog_cookieless"!==this.get_distinct_id()&&(this.nd(),this.sd()));if("$posthog_cookieless"!==this.get_distinct_id())return;this.rd()||t.load(!0);const e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){const e=this.config.get_device_id(La());this.register({distinct_id:e,$device_id:e}),t.set_property(Ct,Zt)}this.nd()}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.od=!1,this.ld=!1,this.ad=!1,this.webPerformance=new Q$,this.ud=!1,this.version=su.LIB_VERSION,this.__loadExternalDependency=Cw,this.hd=new Set,this.dd="",this.Tr=new O_,this.Uh=[],this.vd=[],this.fd=!1,this.Yh=!1,this.Kh=!1,this.Jh=!1,this.ed=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=V$(),this.SentryIntegration=Fx,this.sentryIntegration=t=>function(t,e){const i=Px(t,e);return{name:Ox,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.pd=!1,this.gd=null,this.md=null,this.yd=null,this.scrollManager=new d$(this),this.pageViewManager=new Lx(this),this.rateLimiter=new s$(this),this.requestRouter=new $$(this),this.consent=new Tx(this),this.externalIntegrations=new E$(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=>Ur.info(`send "${null==t?void 0:t.event}"`,t))}init(t,i,n){if(n&&n!==U$){var s;const r=null!==(s=M$[n])&&void 0!==s?s:new e;return r._init(t,i,n),M$[n]=r,M$[U$][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 Ur.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=V$(i.defaults),i.debug=this.bd(i.debug),this.Qh=i,this._d=[],i.person_profiles?this.md=i.person_profiles:i.process_person&&(this.md=i.process_person);const u=V$(i.defaults),c=J$(i),h=Gr({},u,c,{name:n,token:l});$e(u.rageclick)&&$e(c.rageclick)&&(h.rageclick=Gr({},u.rageclick,c.rageclick)),$e(u.session_recording)&&$e(c.session_recording)&&(h.session_recording=Gr({},u.session_recording,c.session_recording)),this.set_config(h),this.config.on_xhr_error&&Ur.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:R_.GZipJS;const d=this.rd(),v=!this.Vh();if(this.persistence=new t$(this.config,d,!0,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new t$(ue(ue({},this.config),{},{persistence:"sessionStorage"}),d,!1,v),this.dd="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&nu.Ot()){const t=nu.Pt(this.dd);Se(t)&&t.forEach(t=>{Ee(t)&&this.hd.add(t)})}else nu.Dt(this.dd);const f=ue({},this.persistence.props),p=ue({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.wd=new u$((t,e)=>this.kd(t,e),this.config.request_queue_config),this.Sd=new h$(this),this.__request_queue=[];const g=this.Vh();g||(this.sessionManager=new m$(this),this.sessionPropsManager=new f$(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.xd()})),this.$d(),this.config.__preview_deferred_init_extensions?(Ur.info("Deferring extension initialization to improve startup performance"),this.Cd=setTimeout(()=>{this.Cd=void 0,this.Td(g)},0)):(Ur.info("Initializing extensions synchronously"),this.Td(g)),su.DEBUG=su.DEBUG||this.config.debug,su.DEBUG&&Ur.info("Starting in debug mode",{this:this,config:i,thisC:ue({},this.config),p:f,s:p}),this.config.identity_distinct_id&&!(null===(s=i.bootstrap)||void 0===s?void 0:s.distinctID)&&(i.bootstrap=ue(ue({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const m=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this.Yh=!!m&&!Me(m),null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID){const t=i.bootstrap.distinctID,e=this.get_distinct_id(),n=this.persistence.get_property(Ct);if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"anonymous"===n)this.identify(t);else if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"identified"===n)Ur.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(La()),n=i.bootstrap.isIdentifiedID?e:t;this.persistence.set_property(Ct,i.bootstrap.isIdentifiedID?Kt:Zt),this.register({distinct_id:t,$device_id:n})}}if(g)this.register_once({distinct_id:Pt,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(La());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(Ct,Zt)}return to(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),to(t,"pageshow",t=>{if(this.ld=!1,!this.ad){var e;if(t.persisted&&this.persistence){const t=this.persistence.get_property(D),e=this.persistence.get_property(Ct);this.persistence.load(),this.Md()||t===this.persistence.get_property("distinct_id")&&e===this.persistence.get_property("$user_state")||this.Id()}null===(e=this.Sd)||void 0===e||e.resume()}}),i.segment?Ax(this,()=>this.Ed()):this.Ed(),xe(this.config._onCapture)&&this.config._onCapture!==R$&&(Ur.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Ur.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 _$.apply(this,arguments)}().then(t=>{t&&this.register({[j]:t})}).catch(R$),this}Ad(t){const e=t;return Ee(e.name)&&xe(e.setup)}Rd(t,e){var i=this;this.Ad(t)?e.push(re(function*(){try{yield t.setup(i.Pd())}catch(i){Ur.error(`Failed to set up extension "${t.name}"`,i);try{var e;yield null===(e=t.dispose)||void 0===e?void 0:e.call(t)}catch(e){Ur.error(`Failed to dispose extension "${t.name}"`,e)}}})):this.Uh.push(t)}$d(){var t,i,n,s=this;const r=null!==(t=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:null===(n=e.__defaultExtensionClasses)||void 0===n?void 0:n.featureFlags;var o,l,a;if(r)if(this.featureFlags&&this.featureFlags instanceof r||(null===(o=this.Od)||void 0===o||o.call(this),this.Od=void 0,this.featureFlags=new r(this)),xe(this.featureFlags.onReloading)&&xe(this.featureFlags.setup)){if(!this.Od){this.Od=this.featureFlags.onReloading(()=>{this.Tr.emit("featureFlagsReloading",!0)});const t=this.featureFlags;re(function*(){try{yield t.setup(s.Pd())}catch(e){Ur.error("Failed to set up feature flags",e);const i=s.Od;s.Od=void 0;try{null==i||i()}catch(t){Ur.error("Failed to unsubscribe feature flag reloading",t)}try{yield t.dispose()}catch(t){Ur.error("Failed to dispose feature flags",t)}}})()}}else null===(l=(a=this.featureFlags).initialize)||void 0===l||l.call(a)}Td(t){const i=performance.now(),n=ue(ue({},e.__defaultExtensionClasses),this.config.__extensionClasses),s=[];var r,o,l,a,u,c,h,d;n.exceptions&&this.Uh.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new n.exceptions(this)),n.historyAutocapture&&this.Uh.push(this.historyAutocapture=new n.historyAutocapture(this)),this.Gh(),n.tracingHeaders&&this.Uh.push(this.tracingHeaders=new n.tracingHeaders(this)),n.siteApps&&this.Uh.push(this.siteApps=new n.siteApps(this)),n.sessionRecording&&!t&&this.Uh.push(this.sessionRecording=new n.sessionRecording(this)),n.autocapture&&this.Rd(this.autocapture=new n.autocapture(this),s),n.surveys&&this.Rd(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new n.surveys(this),s),n.logs&&this.Rd(this.logs=null!==(l=this.logs)&&void 0!==l?l:new n.logs(this),s),n.metrics&&this.Uh.push(this.metrics=null!==(a=this.metrics)&&void 0!==a?a:new n.metrics(this)),n.conversations&&this.Uh.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new n.conversations(this)),n.productTours&&this.Uh.push(this.productTours=new n.productTours(this)),n.heatmaps&&this.Uh.push(this.heatmaps=new n.heatmaps(this)),n.webVitalsAutocapture&&this.Uh.push(this.webVitalsAutocapture=new n.webVitalsAutocapture(this)),n.exceptionObserver&&this.Uh.push(this.exceptionObserver=new n.exceptionObserver(this)),n.deadClicksAutocapture&&this.Uh.push(this.deadClicksAutocapture=new n.deadClicksAutocapture(this,Mx)),n.toolbar&&this.Uh.push(this.toolbar=null!==(c=this.toolbar)&&void 0!==c?c:new n.toolbar(this)),n.experiments&&this.Uh.push(this.experiments=null!==(h=this.experiments)&&void 0!==h?h:new n.experiments(this)),n.webMCP&&this.Uh.push(this.webMCP=null!==(d=this.webMCP)&&void 0!==d?d:new n.webMCP(this));const v=this.Uh.length>0||s.length>0;this.config.disable_scroll_properties||s.unshift(()=>{this.scrollManager.startMeasuringScrollPosition()}),this.Uh.forEach(t=>{t.initialize&&s.push(()=>{var e;null===(e=t.initialize)||void 0===e||e.call(t)})}),s.push(()=>{if(this.Fd){const t=this.Fd;this.Fd=void 0,this.Uh.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}}),this.Ld(s,i,v)}Ld(t,e,i){for(var n,s;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void(this.Cd=setTimeout(()=>{this.Cd=void 0,this.Ld(t,e,i)},0));const n=t.shift();if(n)try{n()}catch(t){Ur.error("Error initializing extension:",t)}}const r=Math.round(performance.now()-e);i&&r>0?this.register_for_session({[Lt]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Dt]:r}):Ce(null===(n=this.sessionPersistence)||void 0===n?void 0:n.props.$sdk_debug_extensions_init_method)&&Ce(null===(s=this.sessionPersistence)||void 0===s?void 0:s.props.$sdk_debug_extensions_init_time_ms)||(this.unregister_for_session(Lt),this.unregister_for_session(Dt)),this.config.__preview_deferred_init_extensions&&Ur.info(`PostHog extensions initialized (${r}ms)`)}Oc(t){if(!n||!n.body)return Ur.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Oc(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Fd=t),this.Ir=t,this.compression=void 0,t.ok){var e;const i=t.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=ge(i.supportedCompression,R_.GZipJS)?R_.GZipJS:ge(i.supportedCompression,R_.Base64)?R_.Base64:void 0),(null===(e=i.analytics)||void 0===e?void 0:e.endpoint)&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.md?this.md:Yt}),this.Tr.emit("extensionsRemoteConfig",t),this.Uh.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}Ed(){try{this.config.loaded(this)}catch(t){Ur.critical("`loaded` function failed",t)}if(this.Dd(),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.Vh())&&this.Nd()},1),this.jd=new o$(this),this.jd.load()}Dd(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.wd)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Wr(this.__request_queue,t=>this.kd(t)),this.__request_queue=[],this.Dd()}_handle_unload(){var t,e,i,n,s,r;this.ld=!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.qd()&&this.capture(ee),null===(n=this.logs)||void 0===n||n.flushLogs("sendBeacon"),null===(s=this.wd)||void 0===s||s.unload(),null===(r=this.Sd)||void 0===r||r.unload()):this.qd()&&this.capture(ee,null,{transport:"sendBeacon"})}_send_request(t){a$(this,t)}kd(t,e){this.Sd?this.Sd.retriableRequest(t,e):this._send_request(e?ue(ue({},t),{},{transport:e}):t)}_execute_array(t){I$++;try{let e;const i=[],n=[],s=[];Wr(t,t=>{if(t)if(e=t[0],Se(e))s.push(t);else if(xe(t))try{t.call(this)}catch(e){Ur.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){Wr(t,function(t){try{if(Se(t[0])){let i=e;Vr(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){Ur.error("Error executing queued PostHog call",t,e)}})};r(i,this),r(n,this),r(s,this)}finally{I$--}}push(t){if(I$>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 Bd(){return{property:z,persistenceKey:U,cookieName:"_fbc",pattern:q$,register:(t,e)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[U]:{value:t,delivered:e}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(U)}}}get zd(){return{property:H,persistenceKey:W,cookieName:"_fbp",pattern:B$,register:(t,e)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[W]:{value:t,delivered:e}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(W)}}}Hd(t){var e;const i=null===(e=this.persistence)||void 0===e?void 0:e.get_property(t.persistenceKey);return Ee(i)&&t.pattern.test(i)?{value:i,delivered:!1}:$e(i)&&Ee(i.value)&&t.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}Ud(t,e,i){return e===(null==i?void 0:i.value)?{value:e,pending:!i.delivered}:(t.register(e,!1),{value:e,pending:!0})}Wd(t){if(!this.config.save_campaign_params||this.Vh())return;const e=Ma(t.cookieName);return Ee(e)&&t.pattern.test(e)?e:void 0}Vd(t,e,i,n){if(!this.persistence)return;const s=this.Bd,r=this.Hd(s);if(n)return void s.unregister();if(i)return Ee(e)&&q$.test(e)?this.Ud(s,e,r):void s.unregister();const o=Ee(t)&&j$.test(t)?t:void 0,l=this.Wd(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.Ud(s,l,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this.Ud(s,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}Gd(t,e,i){if(!this.persistence)return;const n=this.zd,s=this.Hd(n);if(i)return void n.unregister();if(e)return Ee(t)&&B$.test(t)?this.Ud(n,t,s):void n.unregister();const r=this.Wd(n);return r?this.Ud(n,r,s):s?{value:s.value,pending:!s.delivered}:void 0}Jd(t){if(!this.persistence)return;const e=({channel:t,value:e})=>{const i=this.Hd(t);return(null==i?void 0:i.value)===e&&!i.delivered},i=t.filter(e);i.length&&(this.persistence.refreshMetaIdentifiers(),i.filter(e).forEach(({channel:t,value:e})=>t.register(e,!0)))}capture(t,e,i){var n,s,r,o,l;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.wd))return void Ur.uninitializedWarning("posthog.capture");if(!this.is_capturing())return void Ur.info(`Event "${t}" was not captured because capturing is disabled (opted out or consent pending).`);if(Ce(t)||!Ee(t))return void Ur.error("No event name provided to posthog.capture");if(this.Xh(),"$snapshot"===t&&this.Vh())return;const a=!this.config.opt_out_useragent_filter&&this._is_bot();if(a&&!this.config.__preview_capture_bot_pageviews)return this.od||(this.od=!0,console.warn("[PostHog.js] Events are being dropped because the user agent looks like a bot. Set `opt_out_useragent_filter: true` to capture them, e.g. in end-to-end tests. Note that logs from `captureLog` are not subject to this filter.")),void Ur.info(`Event "${t}" was not captured because the user agent looks like a bot. Set \`opt_out_useragent_filter: true\` to capture it.`);const u=(null==i?void 0:i.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==u?void 0:u.isRateLimited)return void Ur.critical("This capture call is ignored due to client rate limiting.");let c;(null==e?void 0:e.$current_url)&&!Ee(null==e?void 0:e.$current_url)&&(Ur.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.Qd)||Ur.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.persistence.syncCookieProperties(),this.Md(),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(c=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const h=new Date,d=(null==i?void 0:i.timestamp)||h,v=ln(null==i?void 0:i.uuid,La);let f={uuid:v,event:t,properties:this.Zd(t,e||{},d,v,!1,!0)};const p=null===(n=this.featureFlags)||void 0===n||null===(s=n.flagEventCapture)||void 0===s?void 0:s.call(n,e);var g;if(p&&(Vr(p.omit,t=>{delete f.properties[t]}),!1===(null===(g=p.resolved)||void 0===g?void 0:g.call(p,f.properties))))return;"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&a&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),u&&(f.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens);const m="$feature_flag_called"===t&&!1===f.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!m&&(f.$set=null==i?void 0:i.$set);const y=$e(null==e?void 0:e.$set)?e.$set:void 0,b=Se(null==e?void 0:e.$unset)?e.$unset:[],_=(null==i?void 0:i.$unset)||[],w=t=>{var e;const n=!!(null==i?void 0:i.$set)&&t in i.$set;return{hasProvided:n||!!y&&t in y,provided:n?null==i||null===(e=i.$set)||void 0===e?void 0:e[t]:null==y?void 0:y[t],unset:-1!==b.indexOf(t)||-1!==_.indexOf(t)}};this.persistence.refreshMetaIdentifiersBeforeCapture();const k=w(z),S=w(H),x=[{channel:this.Bd,hasProvided:k.hasProvided,update:this.Vd(null==c?void 0:c.fbclid,k.provided,k.hasProvided,k.unset)},{channel:this.zd,hasProvided:S.hasProvided,update:this.Gd(S.provided,S.hasProvided,S.unset)}];for(const{channel:t,hasProvided:e,update:i}of x)i&&!0===f.properties.$process_person_profile&&i.pending&&!e&&!m&&(f.$set=ue({[t.property]:i.value},f.$set));const T=null==i?void 0:i.$unset;T&&(f.$unset=T);const C=m?void 0:this.Kd(null==i?void 0:i.$set_once,t!==ne,t===ie);if(C&&(f.$set_once=C),(null==i?void 0:i._noTruncate)||(E=this.config.properties_string_max_length,f=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=[],Wr(n,e=>{r.push(t(e))});else{const e={};Vr(qe(n)?Kr(n):n,(n,s)=>{i.has(n)||(e[s]=t(n,s))}),r=e}return r}(t)}(f,t=>Ee(t)?t.slice(0,E):t)),f.timestamp=d,Ce(null==i?void 0:i.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=h),m&&(f.properties=((t,e=[])=>{const i={},n=e=>{void 0!==t[e]&&(i[e]=t[e])};return as.forEach(n),e.forEach(n),i})(f.properties,p?z$.concat(p.keep):z$)),t===Tm.DISMISSED||t===Tm.SENT){const i=null==e?void 0:e[Cm.SURVEY_ID],n=null==e?void 0:e[Cm.SURVEY_ITERATION];Fm({id:i,current_iteration:n}),f.$set=ue(ue({},f.$set),{},{[hu({id:i,current_iteration:n},t===Tm.SENT?"responded":"dismissed")]:!0})}else t===Tm.SHOWN&&(f.$set=ue(ue({},f.$set),{},{[Cm.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var E;if(t===e$.SHOWN){const t=null==e?void 0:e[i$.TOUR_TYPE];t&&(f.$set=ue(ue({},f.$set),{},{[`${i$.TOUR_LAST_SEEN_DATE}/${t}`]:(new Date).toISOString()}))}const M=ue(ue({},f.properties.$set),f.$set);if(Te(M)||this.setPersonPropertiesForFlags(M),!Re(this.config.before_send)){const t=this.Ds(f,null==p?void 0:p.failed);if(!t)return;f=t,f.uuid=ln(f.uuid,La)}this.sessionRecording&&!this.sessionRecording.isReplayOff&&!this.fd&&N$(t)&&(this.fd=!0,setTimeout(()=>this.fd=!1,3e4));const I=[];x.forEach(({channel:t,update:e})=>{var i,n,s;const r=null!==(i=null===(n=f.$set)||void 0===n?void 0:n[t.property])&&void 0!==i?i:$e(null===(s=f.properties)||void 0===s?void 0:s.$set)?f.properties.$set[t.property]:void 0;(null==e?void 0:e.pending)&&r===e.value&&I.push({channel:t,value:e.value})}),this.Tr.emit("eventCaptured",f);const R=null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),A="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(R),O=ue(ue(ue({method:"POST",url:R,data:f,compression:"best-available",preferSyncCompression:null==i?void 0:i.send_instantly,timestampMode:A?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},A&&(null===(o=f.properties)||void 0===o?void 0:o.$session_id)?{batchGroup:f.properties.$session_id+(f.properties.$window_id?`-${f.properties.$window_id}`:"")}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),I.length?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.Jd(I)}}:{});if(!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)){var P;let t;!O.transport&&!O.callback&&Te(null!==(P=this.config.request_headers)&&void 0!==P?P:{})&&this.ld&&(t="sendBeacon"),this.kd(O,t)}else this.wd.enqueue(O);return null===(l=this.featureFlags)||void 0===l||l.sendFlagCallsPendingCapture(),f}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null===(e=this.Yd)||void 0===e?void 0:e.getExtension(t)}Pd(){var t;return null!==(t=this.Yd)&&void 0!==t?t:this.Yd=new Tw(this)}Rr(t){this.vd.push(t);let e=!0;return()=>{if(!e)return;e=!1;const i=this.vd.indexOf(t);-1!==i&&this.vd.splice(i,1)}}Md(t=!0){var e;return!!(null===(e=this.persistence)||void 0===e?void 0:e.consumeCookieIdentityChange())&&(this.Id(t),!0)}Id(t=!0){var e,i,n;this.yd=null,"anonymous"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property("$user_state"))&&(null===(n=this.sessionPersistence)||void 0===n||n.clear(),this.hd.clear(),this.Xd()),null===(i=this.featureFlags)||void 0===i||i.reset(),t&&this.reloadFeatureFlags()}calculateEventProperties(t,e,i,n,s){return this.Zd(t,e,i,n,s,!1)}Zd(e,i,r,o,l,a=!1){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.Xh(),a||(this.persistence.syncCookieProperties(),this.Md());const c=l?void 0:this.persistence.remove_event_timer(e);let h=ue({},i);if(h.token=this.config.token,h.$config_defaults="latest"===this.config.defaults?H$:this.config.defaults,this.Vh()&&(h[Ft]=!0),"$snapshot"===e){const t=ue(ue({},this.persistence.properties()),this.sessionPersistence.properties());return h.distinct_id=t.distinct_id,(!Ee(h.distinct_id)&&!Ae(h.distinct_id)||Me(h.distinct_id))&&Ur.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}const d=function(e,i,n,r=!1){var o,l,a,c;if(!u)return{};const h=e?[...Lu,...i||[]]:[],[d,v]=Ji(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={};Ce(n)||(m.detectGoogleSearchApp=n);const y={},b=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,_=null===(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===(c=t.screen)||void 0===c?void 0:c.height,S=null==t?void 0:t.devicePixelRatio;Ce(b)||(y.userAgentDataPlatform=b),Ce(_)||(y.maxTouchPoints=_),Ce(w)||(y.screenWidth=w),Ce(k)||(y.screenHeight=k),Ce(S)||(y.devicePixelRatio=S);const x=Gr(Zr({$os:d,$os_version:v,$browser:Hi(u,navigator.vendor,g,m),$webview_app:f,$webview_app_version:p,$device:Qi(u),$device_type:Zi(u,y),$timezone:Au(),$timezone_offset:Qu()}),{$current_url:co(r?un(null==s?void 0:s.href):null==s?void 0:s.href,h,Nu),$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:Uu(),$browser_language_prefix:Hu(),$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:Br.LIB_NAME,$lib_version:Br.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Br.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=Br.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}let v,f;this.sessionPropsManager&&Gr(h,this.sessionPropsManager.getSessionProps());try{var p;if(this.sessionRecording){const t=this.sessionRecording.sdkDebugProperties,i=!this.fd&&N$(e);for(const e in t)(i||ge(L$,e))&&(h[e]=t[e])}v=null===(p=this.Sd)||void 0===p?void 0:p.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===w$&&(h.$lib_custom_api_host=this.config.api_host),f="$pageview"!==e||l?"$pageleave"!==e||l?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),h=Gr(h,f),"$pageview"===e&&n&&(h.title=n.title),!Ce(c)){const t=r.getTime()-c;h.$duration=parseFloat((t/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");const g=this.persistence.properties(),m=this.sessionPersistence.properties(),y=h.$groups,b=g.$groups;$e(y)&&!Te(y)&&(h.$groups=ue(ue({},$e(b)?b:{}),y)),Vr(["$referrer","$referring_domain"],t=>{t in g&&delete m[t]});const _={};if(this.vd.length>0)for(const t of this.vd.slice())try{Gr(_,t())}catch(t){Ur.error("Failed to produce browser extension event properties",t)}h=Gr({},d,g,m,ue(ue({},_),h)),v?h.$sdk_debug_retry_queue_size=v:delete h.$sdk_debug_retry_queue_size,h.$is_identified=this._isIdentified(),Se(this.config.property_denylist)?Vr(this.config.property_denylist,function(t){delete h[t]}):Ur.error(F$+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const w=this.config.sanitize_properties;w&&(Ur.error(P$),h=w(h,e));const k=this.tv();return h.$process_person_profile=k,k&&!l&&this.ev("_calculate_event_properties"),h}Kd(t,e=!0,i=!1){var n;if(!this.persistence||!this.tv())return t;if(this.ud&&!i)return t;const s=this.persistence.get_initial_props(),r=null===(n=this.sessionPropsManager)||void 0===n?void 0:n.getSetOnceProps();let o=Gr({},s,r||{},t||{});const l=this.config.sanitize_properties;return l&&(Ur.error(P$),o=l(o,"$set_once")),e&&(this.ud=!0),Te(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.Md(),null===(i=this.sessionPersistence)||void 0===i||i.register(t),Object.keys(t).forEach(t=>this.hd.add(t)),this.Xd()}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.hd.delete(t),this.Xd()}iv(t,e){this.register({[t]:e})}xd(){this.hd.forEach(t=>{var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t)}),this.hd.clear(),this.Xd()}Xd(){var t;if(!this.dd)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.Ai)||!nu.Ot())return void nu.Dt(this.dd);const e=[];this.hd.forEach(t=>e.push(t)),e.length>0?nu.$t(this.dd,e):nu.Dt(this.dd)}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.Tr.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:O$}),()=>{})}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:O$})}getActiveMatchingSurveys(t,e=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:O$})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:O$}),()=>{})}renderSurvey(t,e){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(t,e)}displaySurvey(t,e=Dm){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:O$}}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:O$})}nv(t){return!t||Me(t)?(Ur.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Ur.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())||(Ur.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 Ur.uninitializedWarning("posthog.identify");if(Ae(t)&&(t=t.toString(),Ur.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.nv(t))return;if(!this.ev("posthog.identify"))return;this.Xh();const n=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,r=this.Md(!1),o=this.persistence.oc();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(q),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Zt,u=t!==n,c=!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(Ct,Kt),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.lc(),this.capture("$identify",s,{$set:e||{},$set_once:i||{}})&&(this.yd=xu(t,e,i)),null===(a=this.featureFlags)||void 0===a||a.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:n)}else if(c){this.persistence.set_property(Ct,Kt);const n=e||{},s=i||{};this.setPersonPropertiesForFlags({$set:n,$set_once:s},!1),this.config.cookieWinsOnConflict&&this.persistence.lc(),this.capture("$set",{$set:n,$set_once:s})&&(this.yd=xu(t,e,i))}else(e||i)&&this.setPersonProperties(e,i);u||s||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(k)):c&&(e||i)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.cc(l)}}setPersonProperties(t,e){if(!t&&!e)return;if(!this.ev("posthog.setPersonProperties"))return;const i=xu(this.get_distinct_id(),t,e);this.yd!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}})&&(this.yd=i)):Ur.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.ev("posthog.unsetPersonProperties")&&(null===(e=this.featureFlags)||void 0===e||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.yd=null)}group(t,e,i){var n;if(!t||!e)return void Ur.error("posthog.group requires a group type and group key");null===(n=this.persistence)||void 0===n||n.syncCookieProperties(),this.Md();const s=this.getGroups(),r=s[t]!==e;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ue(ue({},s),{},{[t]:e})}),(r||i)&&this.tv()){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.ev("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=Pe(t)?t:null==t?void 0:t.resetDeviceID,i=Pe(t)||null==t?void 0:t.bootstrap;this.sv(e,!1,i)}sv(t,e=!1,i){var n,s,r,o,l,a;if(Ur.info("reset"),!this.__loaded)return Ur.uninitializedWarning("posthog.reset");const u=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(n=this.Qh)||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.Fc());const c=this.get_property(N),h=this.get_property(j),d=this.get_property(it);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();e||this.consent.reset(),e||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const f=null===(l=this.persistence)||void 0===l||null===(a=l.oc)||void 0===a?void 0:a.call(l),p=this.ed;this.ed=p||e;let g=!1;try{var m,y,b,_,w,k,S,x,T,C,E,M,I;if(null===(m=this.persistence)||void 0===m||m.clear(),null===(y=this.sessionPersistence)||void 0===y||y.clear(),this.hd.clear(),this.Xd(),Ce(d)||null===(C=this.persistence)||void 0===C||C.register({$session_recording_remote_config:d}),null===(b=this.surveys)||void 0===b||b.reset(),null===(_=this.featureFlags)||void 0===_||_.reset(),null===(w=this.conversations)||void 0===w||w.reset(),null===(k=this.logs)||void 0===k||k.reset(),null===(S=this.metrics)||void 0===S||S.reset(),null===(x=this.persistence)||void 0===x||x.set_property("$user_state","anonymous"),null===(T=this.sessionManager)||void 0===T||T.resetSessionId(),this.yd=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Pt,$device_id:null},"");else{const e=this.config.get_device_id(La());this.register_once({distinct_id:e,$device_id:t?e:c},""),t||Ce(h)||this.register({[j]:h})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(i.distinctID&&!this.Vh()&&(null===(I=this.persistence)||void 0===I||I.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(E=this.featureFlags)||void 0===E||E.initialize(),!Re(u)&&!(null===(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,g=!0}finally{var R,A;this.ed=p,f&&(null===(R=this.persistence)||void 0===R||null===(A=R.cc)||void 0===A||A.call(R,g))}var O;this.Ir&&(null===(O=this.conversations)||void 0===O||O.onRemoteConfig(this.Ir)),this.reloadFeatureFlags()}shutdown(t){var e=this;return re(function*(){if(!e.__loaded)return void Ur.uninitializedWarning("posthog.shutdown");e.ad=!0,clearTimeout(e.Cd),e.Cd=void 0;const t=e.Od;e.Od=void 0;for(const i of[()=>{var t;return null===(t=e.sessionRecording)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=e.logs)||void 0===t?void 0:t.flushLogs("sendBeacon")},()=>{var t;return null===(t=e.metrics)||void 0===t?void 0:t.flush("sendBeacon")},()=>{var t;return null===(t=e.metrics)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=e.logs)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=e.surveys)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=e.autocapture)||void 0===t?void 0:t.dispose()},()=>null==t?void 0:t(),()=>{var t;return null===(t=e.wd)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=e.Sd)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=e.featureFlags)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=e.persistence)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=e.sessionPersistence)||void 0===t?void 0:t.destroy()}])try{const t=i();t&&xe(t.then)&&t.then(void 0,t=>{Ur.error("Error during shutdown",t)})}catch(t){Ur.error("Error during shutdown",t)}})()}setIdentity(t,e){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null===(i=this.conversations)||void 0===i||i.rv()}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.ov()}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")?(Ur.critical("Attempting to create alias for existing People user - aborting."),-2):this.ev("posthog.alias")?(Ce(e)&&(e=this.get_distinct_id()),t!==e?(this.iv(q,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Ur.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const e=ue({},this.config);if($e(t)){var i,n,s,r,o,l,a,u,c,h,d,v,f,p;Gr(this.config,J$(t));const _=this.rd();if(this.persistence){const t="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;var g,m;if(t&&this.sessionPersistence!==this.persistence&&(null===(g=this.sessionPersistence)||void 0===g||g.remove(),null===(m=this.sessionPersistence)||void 0===m||m.destroy()),this.persistence.update_config(this.config,e,_),t)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new t$(ue(ue({},this.config),{},{persistence:"sessionStorage"}),_,!1);else{var y;null===(y=this.sessionPersistence)||void 0===y||y.update_config(ue(ue({},this.config),{},{persistence:"sessionStorage"}),ue(ue({},e),{},{persistence:"sessionStorage"}),_)}}const w=this.bd(this.config.debug);var b;Pe(w)&&(this.config.debug=w),Pe(this.config.debug)&&(this.config.debug?(su.DEBUG=!0,Ua.Ot()&&Ua.$t("ph_debug",!0),Ur.info("set_config",{config:t,oldConfig:e,newConfig:ue({},this.config)})):(su.DEBUG=!1,Ua.Ot()&&Ua.Dt("ph_debug"))),null===(i=this.featureFlags)||void 0===i||null===(n=i.updateConfig)||void 0===n||n.call(i,this.config,this.Fc()),null===(s=this.exceptionObserver)||void 0===s||s.onConfigChange(),null===(r=this.exceptions)||void 0===r||r.onConfigChange(),null===(o=this.metrics)||void 0===o||o.onConfigChange(),null===(l=this.webMCP)||void 0===l||l.startIfEnabled(),null===(a=this.sessionRecording)||void 0===a||a.startIfEnabledOrStop(),null===(u=this.tracingHeaders)||void 0===u||u.startIfEnabledOrStop(),null===(c=this.autocapture)||void 0===c||c.startIfEnabled(),null===(h=this.heatmaps)||void 0===h||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(b=this.historyAutocapture)||void 0===b||b.startIfEnabledOrStop()),null===(d=this.exceptionObserver)||void 0===d||d.startIfEnabledOrStop(),null===(v=this.deadClicksAutocapture)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.surveys)||void 0===f||f.loadIfEnabled(),this.nd(),null===(p=this.externalIntegrations)||void 0===p||p.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&Ax(this,R$,!1)}}_overrideSDKInfo(t,e){su.LIB_NAME=t,su.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.lv}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:U$;return e!==U$&&(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"))}tv(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&Te(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))}qd(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.tv()||this.ev("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ev("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ev(t){return"never"===this.config.person_profiles?(Ur.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Zh(),this.iv(Ot,!0),!0)}rd(){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)}nd(){var t,e;const i=this.rd();var n,s,r,o;return this.is_capturing()||(null===(n=this.logs)||void 0===n||n.av(),null===(s=this.heatmaps)||void 0===s||s.discardPending()),(null===(t=this.persistence)||void 0===t?void 0:t.Ai)!==i&&(null===(r=this.persistence)||void 0===r||r.set_disabled(i)),(null===(e=this.sessionPersistence)||void 0===e?void 0:e.Ai)!==i&&(null===(o=this.sessionPersistence)||void 0===o||o.set_disabled(i)),this.Xd(),i}opt_in_capturing(t){var i,n,s;if("always"===this.config.cookieless_mode)return void Ur.warn(A$);if(this.Vh()){var r,o,l,a,u,c;null===(r=this.sessionRecording)||void 0===r||r.dispose({discardBufferedEvents:!0}),this.sv(!0,!0),null===(o=this.sessionManager)||void 0===o||o.destroy(),null===(l=this.pageViewManager)||void 0===l||l.destroy(),this.sessionManager=new m$(this),this.pageViewManager=new Lx(this),this.persistence&&(this.sessionPropsManager=new f$(this,this.sessionManager,this.persistence));const t=null!==(a=null===(u=this.config.__extensionClasses)||void 0===u?void 0:u.sessionRecording)&&void 0!==a?a:null===(c=e.__defaultExtensionClasses)||void 0===c?void 0:c.sessionRecording;var h,d;t&&(this.sessionRecording=this.Wh(this.sessionRecording,new t(this)),this.Ir&&(null===(h=this.sessionRecording)||void 0===h||null===(d=h.onRemoteConfig)||void 0===d||d.call(h,this.Ir)))}const v=1===this.consent.consent;var f,p,g,m;v?this.Xh():null===(f=this.heatmaps)||void 0===f||f.discardPending(),this.consent.optInOut(!0),this.nd(),this.Dd(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(p=this.surveys)||void 0===p||p.loadIfEnabled(),null===(g=this.conversations)||void 0===g||g.loadIfEnabled()),v||!Ce(null==t?void 0:t.captureEventName)&&!(null==t?void 0:t.captureEventName)||this.capture(null!==(m=null==t?void 0:t.captureEventName)&&void 0!==m?m:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),null===(n=this.persistence)||void 0===n||n.syncCookieProperties(),this.Md(),null===(s=this.featureFlags)||void 0===s||s.sendFlagCallsPendingCapture(),this.config.capture_pageview&&this.Nd()}opt_out_capturing(){"always"!==this.config.cookieless_mode?(this.consent.optInOut(!1),this.nd(),"on_reject"===this.config.cookieless_mode&&this.sd()):Ur.warn(A$)}sd(){var t,e,i;const n=this.sessionRecording;null==n||n.dispose({discardBufferedEvents:!0}),null===(t=this.heatmaps)||void 0===t||t.discardPending(),"$posthog_cookieless"!==this.get_distinct_id()&&this.sv(!0,!0),this.register({distinct_id:Pt,$device_id:null}),this.Hh(n),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.Nd(),this.Dd()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return!this.ed&&("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.nd()}_is_bot(){return i?b$(i,this.config.custom_blocked_useragents):void 0}Nd(){n&&("visible"===n.visibilityState?this.pd||(this.pd=!0,this.capture(te,{title:n.title},{send_instantly:!0}),this.gd&&(n.removeEventListener(E,this.gd),this.gd=null)):this.gd||(this.gd=this.Nd.bind(this),to(n,E,this.gd)))}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}))}Fc(){const t=this.Qh||{};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?(Ur.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,Ur)}Ds(t,e){var i;if(Re(this.config.before_send))return t;const n=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(De),s=Se(this.config.before_send)?this.config.before_send:[this.config.before_send];let r=t;for(const i of s)try{if(r=i(r),Re(r)){const e=`Event '${t.event}' was rejected in beforeSend function`;return Le(t.event)?Ur.warn(`${e}. This can cause unexpected behavior.`):Ur.info(e),null}r.properties&&!Te(r.properties)||Ur.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(i){return Ur.error(`Error in beforeSend function for event '${t.event}':`,i),null==e||e(),null}for(const e of n)if(r.properties&&Re(r.properties[e]))return Ur.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 r}getPageViewId(){var t;return null===(t=this.pageViewManager.cu)||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)})}bd(t){const e=Pe(t)&&!t,i=Ua.Ot()&&"true"===Ua.Lt("ph_debug");return!e&&(!!i||t)}};Z$.__defaultExtensionClasses={},Z$.lv=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(let i=0;e.length>i;i++)t.prototype[e[i]]=Qr(t.prototype[e[i]])}(Z$,["identify"]);const K$=["[data-ph-capture-value]"];var Y$=class{constructor(t){this._instance=t}refresh(t){var e;const i=this._instance.config,n=$e(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance.Fc(),t.url_allowlist=null==n?void 0:n.url_allowlist,t.url_ignorelist=null==n?void 0:n.url_ignorelist,t.dom_event_allowlist=null==n?void 0:n.dom_event_allowlist,t.element_allowlist=null==n?void 0:n.element_allowlist,t.css_selector_allowlist=null==n?void 0:n.css_selector_allowlist,t.css_selector_ignorelist=null==n?void 0:n.css_selector_ignorelist,t.element_attribute_ignorelist=null==n?void 0:n.element_attribute_ignorelist,t.capture_copied_text=null==n?void 0:n.capture_copied_text,t.capture_value_css_selector_allowlist=null!==(e=null==n?void 0:n.capture_value_css_selector_allowlist)&&void 0!==e?e:K$}};const X$=Hr("[ExceptionAutocapture]"),tT=Hr("[TracingHeaders]"),eT=Hr("[Web Vitals]"),iT=9e5,nT=["CLS","FCP","INP","LCP"],sT=["INP","LCP"],rT=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],oT=Hr("[SessionRecording]"),lT=[Nt,jt,qt,Bt,zt,Ut,Ht,Wt,Vt],aT=Hr("[Heatmaps]");function uT(t){return $e(t)&&"clientX"in t&&"clientY"in t&&Ae(t.clientX)&&Ae(t.clientY)}const cT=Hr("[Product Tours]"),hT=t=>{var e;return!t.config.disable_product_tours&&!!(null===(e=t.persistence)||void 0===e?void 0:e.get_property(X))},dT=["$set_once","$set"],vT=Hr("[SiteApps]"),fT="Error while initializing PostHog app with config id ",pT=(()=>(null==t?void 0:t.location)?ho(t.location.hash,"__posthog")||ho(location.hash,"state"):null)(),gT="_postHogToolbarParams",mT=Hr("[Toolbar]"),yT=Hr("[FeatureFlags]"),bT=Hr("[FeatureFlags]",{debugEnabled:!0}),_T="\" failed. Feature flags didn't load in time.",wT=[502,504],kT=["click","keydown","wheel","touchstart","pointerdown"],ST="connection_error",xT=(t,e)=>{const i=Object.keys(e||{}).filter(t=>{var i;return null==e||null===(i=e[t])||void 0===i?void 0:i.failed});if(!i.length)return t||{};const n=ue({},t);return i.forEach(t=>delete n[t]),n},$T=(t,e)=>{const i=ue({},t);return e.forEach(t=>{var e;(null===(e=i[t])||void 0===e?void 0:e.failed)&&delete i[t]}),i},TT=(t,e)=>!!(null==e?void 0:e.partialResponse)||!!t.errorsWhileComputingFlags,CT=t=>{const e={};for(let i=0;t.length>i;i++)e[t[i]]=!0;return e},ET=t=>{const e={};for(const[i,n]of Jr(t||{}))n&&(e[i]=n);return e},MT={version:2},IT=(t,e)=>t.distinctId===e.distinctId&&t.sessionId===e.sessionId&&((t,e)=>{const i=Object.keys(t);return i.length===Object.keys(e).length&&i.every(i=>t[i]===e[i])})(t.groups,e.groups);var RT=class{constructor(t){this.name="featureFlags",this.uv=!1,this.featureFlagEventHandlers=[],this.R=yT,this.hv={},this.dv={},this.vv=[],this.fv=new Set,this.pv=new Set,this.gv=!1,this.mv=!1,this.yv=0,this.bv=!1,this._v=!1,this.wv=!1,this.Sv=new Map,this.xv=!1,this.$v=!1,this.Cv=!1,this.Tv=0,this.Mv=!1,this.Iv=!1,this.Ev=new WeakMap,this.Av=new Map,this.mn=()=>{const t=this.Rv();this.Tv=0,t&&this.reloadFeatureFlags()},this.Pv=()=>{var t,e;const i=this.Ov,n=null!==(t=this.Fv)&&void 0!==t?t:i;Ce(i)||Ce(n)||this.Yr.remoteRequestsDisabled||!this.Lv||"hidden"===this.Lv.visibilityState||Date.now()-(null!==(e=this.Dv)&&void 0!==e?e:0)<n||(this.Fv=this.Mv||!this.Yr.idleRefreshBackoff?i:Math.min(2*n,36e5),this.Mv=!1,this.reloadFeatureFlags(),this.Nv())},this.jv=()=>{this.Mv&&this.Fv===this.Ov||this.qv()},this.gn=()=>{var t;"visible"===(null===(t=this.Lv)||void 0===t?void 0:t.visibilityState)&&this.qv()},this.ra=t}get Bv(){return MT}get zv(){}Hv(){this.ia&&this.Uv()}setup(t){try{this.Wv=typeof window>"u"?void 0:window,this.Lv=typeof document>"u"?void 0:document}catch(t){this.Wv=void 0,this.Lv=void 0}return this.ga=t,this.R=t.logger.createLogger("[FeatureFlags]"),N_(t.kv.initialize(),()=>{this.ga===t&&(this.ga=void 0,this.ia=t,this.Vv(t))})}Vv(t){var e;if(this.ia===t)return this.Wv&&to(this.Wv,"online",this.mn),this.Uv(),this.Gv=t.registerDynamicEventProperties(()=>this.Jv()?this.hv:this.dv),this.Qv=null===(e=this.zv)||void 0===e?void 0:e.onCrossTabFeatureFlagChange(()=>{this.Zv(),this.Kv(),this.Yv()}),this.Kv(),this.initialize()}qv(){this.Mv=!0,this.Fv=this.Ov,this.Pv()}Uv(){var t;const e=this.Yr.refreshIntervalMs,i=!this.Yr.remoteRequestsDisabled&&this.Lv&&!Ce(e)&&e>0?e:void 0;this.Yr.idleRefreshBackoff||(this.Fv=i),i!==this.Ov&&(this.Xv(),Ce(i)||(this.Ov=i,this.Fv=i,this.Nv(),(null===(t=this.Lv)||void 0===t?void 0:t.addEventListener)&&(to(this.Lv,E,this.gn),Wr(kT,t=>{to(this.Lv,t,this.jv,{capture:!0})}))))}Nv(){Ce(this.Ov)||(Ce(this.tf)||clearInterval(this.tf),this.Dv=Date.now(),this.tf=setInterval(this.Pv,this.Ov))}Xv(){var t,e;Ce(this.tf)||(clearInterval(this.tf),this.tf=void 0,null===(t=this.Lv)||void 0===t||null===(e=t.removeEventListener)||void 0===e||e.call(t,"visibilitychange",this.gn),Wr(kT,t=>{var e,i;null===(e=this.Lv)||void 0===e||null===(i=e.removeEventListener)||void 0===i||i.call(e,t,this.jv,{capture:!0})})),this.Ov=void 0,this.Fv=void 0,this.Mv=!1,this.Dv=void 0}destroy(){this.ef()}dispose(){this.ef()}ef(){var t,e,i;this.Xv(),this.yv++,this._v=!1,this.ga=void 0,this.if(this.fv,"cancelled"),this.if(this.pv,"cancelled"),this.ia&&(this.nf(),null===(t=this.Gv)||void 0===t||t.dispose(),this.Gv=void 0,null===(e=this.Qv)||void 0===e||e.call(this),this.Qv=void 0,this.vv=[],null===(i=this.Wv)||void 0===i||i.removeEventListener("online",this.mn),this.ia=void 0)}get Yr(){return this.ra.get()}sf(t){var e;return this.rf&&t in this.rf?this.rf[t]:null===(e=this.ia)||void 0===e?void 0:e.kv.get(t)}Zv(){return!!this.rf&&(this.rf=void 0,!0)}lf(){var t;return!Ce(null===(t=this.ia)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.Zv()}$t(t){this.af(()=>{var e;return null===(e=this.ia)||void 0===e?void 0:e.kv.set(t)})}uf(t,e,i){if(!this.zv||!t.$enabled_feature_flags)return;const n=this.sf("$enabled_feature_flags")||{},s=t.$enabled_feature_flags||{},r=e.flags||e.featureFlags,o=e.flags?Object.entries(e.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],l=!!e.errorsWhileComputingFlags&&!!e.flags,a=l||i&&e.flags?o:i&&!Se(r)?Object.keys(r||{}):Array.from(new Set([...Object.keys(n),...Object.keys(s)])),u=this.sf("$feature_flag_payloads")||{},c=t.$feature_flag_payloads||{},h=l||i?a:Array.from(new Set([...Object.keys(u),...Object.keys(c)])),d=!l&&!i,p=!!d||a,_=!!d||h,w={[v]:p,[b]:p,[x]:_};t.$feature_flag_details&&(w[f]=p);for(const e of[m,g,y])Ce(t[e])||(w[e]=!0);this.zv.markCrossTabFeatureFlagChanges(w)}Dt(t){this.af(()=>{var e;return null===(e=this.ia)||void 0===e?void 0:e.kv.remove(t)})}af(t){try{t()}catch(t){this.R.error("Failed to update feature flag persistence",t)}}Kv(){const t={},e=this.sf(f);for(const e of[m,T]){const i=this.sf(e);Ce(i)||(t[e]=i)}const i=this.sf(v);i&&(t[v]=i.filter(t=>{var i;return!(null==e||null===(i=e[t])||void 0===i?void 0:i.failed)}));const n=this.sf(x);n&&(t[x]=xT(n,e)),this.hv=t;const s=ue({},t),r=xT(this.sf(b),e);if(r)for(const[t,e]of Object.entries(r))s[`$feature/${t}`]=e;this.dv=s}Jv(){const t=this.Yr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.sf(g);return"number"!=typeof e||Date.now()-e>t}cf(){return!!this.Jv()&&(this.Cv||this.mv||(this.Cv=!0,this.R.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hf(){const t=this.Yr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.R.error("Invalid evaluation context found:",t,"Expected non-empty string"),e}):[]}df(){const t=this.Yr.flagKeys;if(!Ce(t))return t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.R.error("Invalid flag key found:",t,"Expected non-empty string"),e})}initialize(){var t,e;const i=this.Yr,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=>!Ce(n[t])).reduce((t,e)=>(t[e]=n[e],t),{}),o=Object.keys(t).filter(t=>e[t]).reduce((e,n)=>(e[n]=i.encodeBootstrapPayloads?JSON.stringify(t[n]):t[n],e),{});return this.vf({featureFlags:e,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,e,i){const n=(null==i?void 0:i.merge)?xT(this.sf(b),this.sf(f)):{},s=(null==i?void 0:i.merge)?xT(this.sf(x),this.sf(f)):{},r=ue(ue({},n),t),o=ue(ue({},s),e),l={};for(const[t,e]of Object.entries(r))l[t]={key:t,enabled:os(e),variant:ls(e),reason:void 0,metadata:Ce(null==o?void 0:o[t])?void 0:{id:0,version:void 0,description:void 0,payload:o[t]}};this.vf({flags:l})}get hasLoadedFlags(){return this.gv}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.ff(),e=this.Bv.publicDetail;return e?Object.fromEntries(Object.entries(t).map(([t,i])=>[t,e(i)])):t}ff(){const t=this.sf(f),e=this.sf(T),i=this.sf(C);if(!i&&!e)return t||{};const n=Gr({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(const t of s){var r,o;const s=n[t],l=null==e?void 0:e[t],a=Ce(l)?null!==(r=null==s?void 0:s.enabled)&&void 0!==r&&r:!!l,u=Ce(l)?null==s?void 0:s.variant:"string"==typeof l?l:void 0,c=null==i?void 0:i[t],h=ue(ue({},s),{},{enabled:a,variant:a?null!=u?u:null==s?void 0:s.variant:void 0});a!==(null==s?void 0:s.enabled)&&(h.original_enabled=null==s?void 0:s.enabled),u!==(null==s?void 0:s.variant)&&(h.original_variant=null==s?void 0:s.variant),c&&(h.metadata=ue(ue({},null==s?void 0:s.metadata),{},{payload:c,original_payload:null==s||null===(o=s.metadata)||void 0===o?void 0:o.payload})),n[t]=h}return this.uv||(this.R.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:n}),this.uv=!0),n}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(i=>{const n=t[i];return{key:i,enabled:os(n),variant:ls(n),payload:rs(e[i])}})}getFlagVariants(){const t=xT(this.sf(b),this.sf(f)),e=this.sf(T);if(!e)return t||{};const i=Gr({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.uv||(this.R.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.uv=!0),i}getFlagPayloads(){const t=xT(this.sf(x),this.sf(f)),e=this.sf(C);if(!e)return t||{};const i=Gr({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.uv||(this.R.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.uv=!0),i}reloadFeatureFlags(){this.bv||this.Yr.featureFlagsDisabled||this.Rv()||(this.wv&&this.R.warn("reloadFeatureFlags() was called inside an onFeatureFlags callback. This callback also runs when flags change in other tabs, so this can cause a request loop."),this.mv&&(this._v=!0),this.pf||(this.pf=setTimeout(()=>{this.gf()},5),this.vv.slice().forEach(t=>{try{t()}catch(t){this.R.error("Error while running feature flags reloading callback",t)}})))}reloadFeatureFlagsAsync(){return!this.ia||this.bv||this.Yr.featureFlagsDisabled||this.Yr.remoteRequestsDisabled||this.Rv()?Promise.resolve({status:"skipped"}):new Promise(t=>{this.fv.add(t),this.reloadFeatureFlags()})}if(t,e){t.forEach(t=>t({status:e})),t.clear()}nf(){clearTimeout(this.pf),this.pf=void 0}onReloading(t){return this.vv.push(t),()=>{this.vv=this.vv.filter(e=>e!==t)}}ensureFlagsLoaded(){this.gv||this.mv||this.pf||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.bv=t}resetFlagCallReported(){this.Dt(k),this.Sv=new Map,this.Av=new Map}sendFlagCallsPendingCapture(){var t;if(0!==this.Sv.size&&!this.xv&&(null===(t=this.ia)||void 0===t?void 0:t.canCapture)&&!this.ia.isRateLimited){this.xv=!0;try{const t=this.getFlagVariants();for(const i of Array.from(this.Sv.keys())){var e;const n=this.Sv.get(i);if(!n)continue;const s=null===(e=this.mf(i,t[i]))||void 0===e?void 0:e.calledKey;if(n.value!==String(t[i])||n.calledKey&&n.calledKey!==s||!IT(n.context,this.yf()))this.Sv.delete(i);else if(this.getFeatureFlagResult(i),this.Sv.has(i))break}}finally{this.xv=!1}}}gf(t){var e;this.nf();const i=this.ia;if(!i||this.Yr.remoteRequestsDisabled||this.Rv())return void this.if(this.fv,"skipped");if(this.mv)return void(this._v=!0);const n={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:ue(ue(ue({},i.initialPersonProperties),this.sf("$stored_person_properties")||{}),{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.sf(_),timezone:Au()};Ce(i.deviceId)||(n.$device_id=i.deviceId),((null==t?void 0:t.disableFlags)||this.Yr.featureFlagsDisabled)&&(n.disable_flags=!0);const s=this.hf();s.length&&(n.evaluation_contexts=s);const r=this.df();Ce(r)||(n.flag_keys=r);const o=this.Yr.onlyEvaluateSurveyFeatureFlags,l=`/flags/?v=${this.Bv.version}${o?"&only_evaluate_survey_feature_flags=true":""}`,a=this.yv,u=this.fv;this.fv=new Set,this.pv=u,this.mv=!0;const c=()=>{this._v&&(this._v=!1,this.gf())},h=t=>{var e;const i=this.bf(t.json),s=200!==t.statusCode;if(this.mv=!1,a!==this.yv)return void c();if(this._f(t.statusCode),s||this._v||(this.$anon_distinct_id=void 0),n.disable_flags&&!this._v)return void this.if(u,"skipped");this.$v=!s;const r=[];t.error?r.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?ST:"unknown_error"):200!==t.statusCode&&r.push(`api_error_${t.statusCode}`),i.errorsWhileComputingFlags&&r.push("errors_while_computing_flags");const l=!!(null===(e=i.quotaLimited)||void 0===e?void 0:e.includes("feature_flags"));l&&r.push("quota_limited"),this.$t({[p]:r}),l?this.R.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):n.disable_flags||this.vf(i,s,{partialResponse:o}),this.if(u,n.disable_flags?"skipped":r.length||!i.flags&&!i.featureFlags?"error":"loaded"),c()},d=t=>{this.mv=!1,a===this.yv?(this.$t({[p]:[ST]}),this.R.error("Feature flag request failed",t),this.lf()&&this.Yv(!0),this.if(u,"error"),c()):c()};let v=null!==(e=this.Yr.requestMaxRetries)&&void 0!==e?e:1;const f=()=>v>0&&a===this.yv,g=()=>{if(a!==this.yv||!this.ia||this.Yr.remoteRequestsDisabled)return this.mv=!1,this.if(u,"skipped"),void c();try{i.sendRequest(l,{target:"flags",method:"POST",body:n,compression:this.Yr.compression,sentAt:"body",timeoutMs:this.Yr.requestTimeoutMs}).then(t=>{if((t=>wT.includes(t.statusCode)||(t=>0===t.statusCode&&t.error instanceof Error&&"AbortError"===t.error.name)(t))(t)&&f())return v--,void setTimeout(g,500);h(t)}).catch(d)}catch(t){d(t)}};g()}bf(t){const e=null!=t?t:{},i=this.Bv.read;if(!i)return e;const{body:n,withoutTypedValues:s}=i(e);return s&&!this.Iv&&(this.Iv=!0,this.R.info("The /flags response has no typed flag values. Its flags are read as before.")),n}Rv(){return so(this.Tv,3)}_f(t){this.Tv=ro(t,this.Tv,3,()=>this.R.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."))}wf(t){var e;return!this.gv&&!this.getFlags().length&&!(null===(e=this.getFeatureFlagDetails(t))||void 0===e?void 0:e.failed)}getFeatureFlag(t,e={}){var i;if(e.fresh&&!this.$v)return;if(this.wf(t))return void this.R.warn('getFeatureFlag for key "'+t+_T);if(this.cf())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){const e=this.ff()[t],i=this.Bv.publicDetail;return e&&i?i(e):e}getFeatureFlagPayload(t){const e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e={}){var i;if(e.fresh&&!this.$v)return;if(this.wf(t))return void this.R.warn('getFeatureFlagResult for key "'+t+_T);if(this.cf())return;const n=null===(i=this.sf("$feature_flag_details"))||void 0===i||null===(i=i[t])||void 0===i?void 0:i.failed,s=n?void 0:this.sf(b),r=n?void 0:this.sf(x),o=this.sf(T),l=!!o&&{}.hasOwnProperty.call(o,t),a=l||!!s&&t in s,u=l?o[t]:null==s?void 0:s[t],c=this.sf(C),h=c&&{}.hasOwnProperty.call(c,t)?c[t]:null==r?void 0:r[t],d=String(u),v=this.sf("$feature_flag_request_id")||void 0,f=this.sf("$feature_flag_evaluated_at")||void 0;let p,g=this.sf("$flag_call_reported")||{};if(this.Yr.deduplicateCallsPerSession){var m;const t=null===(m=this.ia)||void 0===m||null===(m=m.session)||void 0===m?void 0:m.sessionId,e=this.sf(S);t&&t!==e&&(g={},p=t)}if(!e.send_event&&"send_event"in e)p&&this.$t({[k]:g,[S]:p});else{var y,_,w,E;const e=!(null===(y=this.ia)||void 0===y?void 0:y.canCapture),i=!e&&!(null===(_=this.ia)||void 0===_?void 0:_.isRateLimited),n=this.mf(t,u),s=n?n.calledKey:d,r=null==n?void 0:n.exposureKey,o=()=>this.kf(t,d,null==n?void 0:n.calledKey);var M,I;i?this.Sv.delete(t):(e&&Object.keys(g).length>0&&(g={},this.$t({[k]:g})),(!(null===(M=g[t])||void 0===M?void 0:M.includes(s))||r&&!(null===(I=g[t])||void 0===I?void 0:I.includes(r)))&&o());const l=!(null===(w=g[t])||void 0===w?void 0:w.includes(s)),a=!!r&&!(null===(E=g[t])||void 0===E?void 0:E.includes(r));if(i&&n&&(l||a)){p&&this.$t({[k]:g,[S]:p});const e=n.build(this.Sf(t,u,h,v,f)),i=l?this.xf(t,s,e.called,o):void 0;a&&e.exposure&&this.xf(t,r,e.exposure,o,i)}else if(i&&l){Se(g[t])?g[t].push(d):g[t]=[d],this.$t(ue({[k]:g},p?{[S]:p}:{}));const e=this.Sf(t,u,h,v,f);this.$f(e)||(this.Cf(t,d),o())}else p&&this.$t({[k]:g,[S]:p})}return a?{key:t,enabled:!!u,variant:"string"==typeof u?u:void 0,payload:rs(h)}:void 0}Sf(t,e,i,n,s){var r,o,l,a,u,c,h,d,v,f,p,g,m;const y=this.ff()[t],b=[...null!==(r=this.sf("$feature_flag_errors"))&&void 0!==r?r:[]];Ce(e)&&b.push((null==y?void 0:y.failed)?"evaluation_failed":"flag_missing");const _={$feature_flag:t,$feature_flag_response:e,$feature_flag_payload:null!=i?i:null,$feature_flag_request_id:n,$feature_flag_evaluated_at:s,$feature_flag_bootstrapped_response:null!==(o=null===(l=this.Yr.bootstrap)||void 0===l||null===(l=l.featureFlags)||void 0===l?void 0:l[t])&&void 0!==o?o:null,$feature_flag_bootstrapped_payload:null!==(a=null===(u=this.Yr.bootstrap)||void 0===u||null===(u=u.featureFlagPayloads)||void 0===u?void 0:u[t])&&void 0!==a?a:null,$used_bootstrap_value:!this.$v};Ce(null==y||null===(c=y.metadata)||void 0===c?void 0:c.has_experiment)||(_.$feature_flag_has_experiment=y.metadata.has_experiment),Ce(null==y||null===(h=y.metadata)||void 0===h?void 0:h.version)||(_.$feature_flag_version=y.metadata.version);const w=null!==(d=null==y||null===(v=y.reason)||void 0===v?void 0:v.description)&&void 0!==d?d:null==y||null===(f=y.reason)||void 0===f?void 0:f.code;return w&&(_.$feature_flag_reason=w),(null==y||null===(p=y.metadata)||void 0===p?void 0:p.id)&&(_.$feature_flag_id=y.metadata.id),Ce(null==y?void 0:y.original_variant)&&Ce(null==y?void 0:y.original_enabled)||(_.$feature_flag_original_response=Ce(y.original_variant)?y.original_enabled:y.original_variant),(null==y||null===(g=y.metadata)||void 0===g?void 0:g.original_payload)&&(_.$feature_flag_original_payload=null==y||null===(m=y.metadata)||void 0===m?void 0:m.original_payload),b.length&&(_.$feature_flag_error=b.join(",")),_}mf(t,e){var i,n,s;const r=this.Bv.flagEvents,o=this.sf(T);if(!(!r||$e(o)&&we.call(o,t)))return r({key:t,response:e,groups:null!==(i=null===(n=this.ia)||void 0===n?void 0:n.groups)&&void 0!==i?i:{},record:null===(s=this.sf("$feature_flag_details"))||void 0===s?void 0:s[t]})}xf(t,e,i,n,s){var r;const o=this.sf("$flag_call_reported")||{},l=t+e,a=this.Av.get(l)||0;if((null===(r=o[t])||void 0===r?void 0:r.includes(e))||a>1)return;this.$t({[k]:ue(ue({},o),{},{[t]:[...o[t]||[],e].slice(-10)})});let u,c,h=!1,d=!1;this.Ev.set(i.properties,ue(ue({},i.capture),{},{failed(){h=!0},resolved:t=>(c=t.$session_id,u=JSON.stringify([t.distinct_id,t.$groups,c,t.$process_person_profile]),d=!!s&&u!==s,!d)}));let v=!1;try{var f,p;v=!1!==(null===(f=this.ia)||void 0===f?void 0:f.capture(i.event,i.properties))&&!!(null===(p=this.ia)||void 0===p?void 0:p.canCapture),v||n()}catch(t){h=!0,this.R.error("Failed to capture "+i.event,t)}h&&this.Av.set(l,a+1);const g=v&&!h&&!d;return g||this.Cf(t,e),this.Yr.deduplicateCallsPerSession&&c&&c!==this.sf("$flag_call_reported_session_id")&&this.$t({[k]:g?{[t]:[e]}:{},[S]:c}),u}flagEventCapture(t){return t?this.Ev.get(t):void 0}$f(t){try{var e;return!1!==(null===(e=this.ia)||void 0===e?void 0:e.capture("$feature_flag_called",t))}catch(t){return this.R.error("Failed to capture feature flag call",t),!0}}kf(t,e,i){this.Sv.set(t,{value:e,calledKey:i,context:this.yf()})}yf(){var t,e,i;return{distinctId:null===(t=this.ia)||void 0===t?void 0:t.distinctId,groups:ue({},null===(e=this.ia)||void 0===e?void 0:e.groups),sessionId:this.Yr.deduplicateCallsPerSession?null===(i=this.ia)||void 0===i||null===(i=i.session)||void 0===i?void 0:i.sessionId:void 0}}Cf(t,e){const i=this.sf("$flag_call_reported")||{},n=i[t];Se(n)&&n.includes(e)&&(i[t]=n.filter(t=>t!==e),this.$t({[k]:i}))}getRemoteConfigPayload(t,e){this.Tf(t,e)}Tf(t,e){var i=this;return re(function*(){const n=i.ia;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.hf();r.length&&(s.evaluation_contexts=r);const o=i.df();let l;Ce(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.Yr.compression,sentAt:"body",timeoutMs:i.Yr.requestTimeoutMs})).json)||void 0===a?void 0:a.featureFlagPayloads;l=(null==e?void 0:e[t])||void 0}catch(t){return void i.R.error("Remote config feature flag request failed",t)}try{e(l)}catch(t){i.R.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.$v)return e.defaultValue;if(this.wf(t))return this.R.warn('isFeatureEnabled for key "'+t+_T),e.defaultValue;const i=this.getFeatureFlag(t,e);return Ce(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.vf(t,e,i)}vf(t,e,i){if(!this.ia)return;var n,s;this.gv=!0,!1!==(null==i?void 0:i.persist)&&TT(t,i)&&(null===(n=this.zv)||void 0===n||null===(s=n.reconcileFeatureFlagsBeforeMerge)||void 0===s?void 0:s.call(n))&&this.Zv();const r=this.getFlagVariants(),o=!t.flags&&Se(t.featureFlags),l=((t,e={},i={},n={},s,r=yT)=>{const o=((t,e)=>{const i=t.flags;if(i){const e=Object.fromEntries(Object.keys(i).filter(t=>!i[t].failed).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].failed&&i[t].enabled).filter(t=>{var e;return!Ce(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 c=t.requestId,h=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{[v]:a,[b]:t,[f]:$T(n,a),[x]:xT(i,n),[y]:!1}}let d=a,p=u,_=l;if(TT(t,s)){const t=t=>({}.hasOwnProperty.call(e,t)&&!Ce(e[t])),r=Object.keys(d),o=p||{};d=ue(ue({},e),d),p=ue(ue({},i),o),((null==s?void 0:s.partialResponse)||l)&&r.forEach(t=>{t in o||null==p||delete p[t]}),_=l?ue(ue({},n),Object.fromEntries(Object.entries(l).filter(([e,i])=>!i.failed||!t(e)))):$T(n,r)}return ue(ue({[v]:Object.keys(ET(d)),[b]:d||{},[x]:p||{},[f]:_||{},[y]:!0===t.minimalFlagCalledEvents},c?{[m]:c}:{}),h?{[g]:h}:{})})(t,r,o?this.sf("$feature_flag_payloads")||{}:this.getFlagPayloads(),o?this.sf("$feature_flag_details")||{}:this.ff(),i,this.R);if(l)if(!1===(null==i?void 0:i.persist)){const t=!Ce(this.ia.kv.get(b));this.rf=l,t||this.$t(l)}else this.Zv(),this.uf(l,t,!!(null==i?void 0:i.partialResponse)),this.$t(l);else e&&this.lf();e||(this.Cv=!1),this.Yv(e)}override(t,e=!1){this.R.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.Mf(t)}Mf(t){if(this.ia){if(!1===t)return this.Dt([T,C]),this.Yv(),void bT.info("All overrides cleared");if(Se(t))return this.$t({[T]:CT(t)}),this.Yv(),void bT.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e;const i=t;this.uv=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);const n={},s=i.flags,r=i.payloads;return s&&(n[T]=Se(s)?CT(s):s),r&&(n[C]=r),Object.keys(n).length&&this.$t(n),!1===s&&!1===r?this.Dt([T,C]):!1===s?this.Dt(T):!1===r&&this.Dt(C),this.Yv(),!1===s?bT.info("Flag overrides cleared"):s&&bT.info("Flag overrides set",{flags:s}),void(!1===r?bT.info("Payload overrides cleared"):r&&bT.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.$t({[T]:t}),this.Yv(),void bT.info("Flag overrides set",{flags:t});this.R.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.R.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.gv){const{flags:e,flagVariants:i}=this.If();try{t(e,i)}catch(t){this.R.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var n,s;const r=(this.sf("$early_access_features")||[]).find(e=>e.flagKey===t),o={[`$feature_enrollment/${t}`]:e},l={$feature_flag:t,$feature_enrollment:e,$set:o};r&&(l.$early_access_feature_name=r.name),i&&(l.$feature_enrollment_stage=i);const a=ue(ue({},this.getFlagVariants()),{},{[t]:e}),u=ue({},this.sf(f)),c=null===(n=u[t])||void 0===n?void 0:n.failed,h=ue({},this.sf(x));c&&(delete u[t],delete h[t]),null===(s=this.zv)||void 0===s||s.markCrossTabFeatureFlagChanges(ue(ue({$active_feature_flags:[t],$enabled_feature_flags:[t]},c?{$feature_flag_details:[t],$feature_flag_payloads:[t]}:{}),{},{$stored_person_properties:Object.keys(o)})),this.$t(ue(ue({[v]:Object.keys(ET(a)),[b]:a},c?{[f]:u,[x]:h}:{}),{},{[w]:ue(ue({},this.sf("$stored_person_properties")||{}),o)})),this.Yv();try{var d;null===(d=this.ia)||void 0===d||d.capture("$feature_enrollment_update",l)}catch(t){this.R.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,e=!1,i){const n=this.sf(d);!n||e?this.Ef(t,i):t(n)}Ef(t,e){var i=this;return re(function*(){const n=i.ia;if(!n)return;const s=e?`&${e.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${s}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,i.$t({[d]:r})}catch(t){return void i.R.error("Early access feature request failed",t)}try{t(r)}catch(t){i.R.error("Early access feature callback failed",t)}})()}If(){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),{})}}Yv(t){this.Kv();const{flags:e,flagVariants:i}=this.If(),n=this.wv;this.wv=!0,this.featureFlagEventHandlers.forEach(n=>{try{n(e,i,{errorsLoading:t})}catch(t){this.R.error("Error while running feature flags callback",t)}}),this.wv=n}setPersonPropertiesForFlags(t,e=!0){this.Af(t,e)}Af(t,e=!0){const i=this.sf("$stored_person_properties")||{},n=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),s=null==t?void 0:t.$set_once,r={};if(s)for(const t in s)({}).hasOwnProperty.call(s,t)&&(t in i||(r[t]=s[t]));this.$t({[w]:ue(ue(ue({},i),r),n)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const i=ue({},this.sf("$stored_person_properties")||{});t.forEach(t=>{delete i[t]}),this.$t({[w]:i}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Dt(w),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const i=this.sf("$stored_group_properties")||{},n=ue({},i);for(const e of Object.keys(t))n[e]=ue(ue({},i[e]),t[e]);this.$t({[_]:n}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.sf("$stored_group_properties")||{};this.$t({[_]:ue(ue({},e),{},{[t]:{}})})}else this.Dt(_)}reset(){this.yv++,this.if(this.fv,"cancelled"),this.if(this.pv,"cancelled"),this._v=!1,this.hv={},this.dv={},this.rf=void 0,this.gv=!1,this.bv=!1,this.$v=!1,this.$anon_distinct_id=void 0,this.nf(),this.uv=!1,this.Tv=0,this.Sv=new Map,this.Av=new Map}};const AT=t=>$e(t)&&"value"in t?t:void 0,OT=t=>Ee(t)?t:Ae(t)||$e(t)||!0===t,PT="$experiment_exposure",FT="experiment_split",LT="experiment",DT={targeting_match:["targeted_release","percentage_rollout"],[FT]:[LT],rollout_miss:["percentage_rollout",LT],experiment_paused:[LT],holdout:[LT]},NT="$feature_flag_config_version",jT="$feature_flag_reason_code",qT="$feature_flag_rule_id",BT="$feature_flag_rule_type",zT="$feature_flag_variant_key",UT="$feature_flag_experiment_id",HT="$feature_flag_forced_variant",WT=[NT,jT,qT,BT,zT],VT=[...WT,"$feature_flag_reason",HT,UT],GT=[NT,jT,BT,"$experiment_exposure_source",UT,HT],JT=["$feature_flag_id","$feature_flag_version","$feature_flag_request_id","$feature_flag_evaluated_at"],QT=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ZT=t=>Ee(t)?t:void 0,KT={},YT=t=>Ae(t)&&t%1==0,XT=[["key",Ee],["failed",Pe]],tC=[["code",Ee],["condition_index",YT],["description",Ee]],eC=[["id",YT],["version",YT],["description",Ee],["has_experiment",Pe],["config_version",YT],["rule_type",Ee],["rule_id",Ee],["variant_key",Ee],["forced_variant",Pe],["experiment_id",YT]],iC=(t,e)=>{if(Re(t))return;if(!$e(t))throw KT;const i={};for(const[n,s]of e){const e=t[n];if(!Re(e)){if(!s(e))throw KT;i[n]=e}}return i},nC=(t,e)=>{const i=iC(e,XT),n=null==e?void 0:e.value;if(!i||!(Ie(n)||Pe(n)||Ee(n)||$e(n)||Ae(n)&&isFinite(n)))throw KT;const s=e.metadata,r=iC(s,eC),o=!0===i.failed,l=o?null:n,a=Ae(l)||$e(l),u=OT(l);return{key:t,enabled:!1!==u,variant:Ee(u)?u:null,value:l,reason:iC(e.reason,tC),metadata:r||a?ue(ue({},r),{},{payload:o?null:a?JSON.stringify(l):null==s?void 0:s.payload,experiment_id:void 0}):void 0,failed:o||void 0}},sC=["config_version","rule_type","rule_id","variant_key","forced_variant"],rC={version:4,read(t){const e=$e(t)?t.flags:void 0;let i=!1;if(!$e(e)){const e=$e(t)?t.featureFlags:void 0;return{body:t,withoutTypedValues:$e(e)&&Object.keys(e).length>0}}const n=Object.fromEntries(Object.keys(e).map(t=>{const n=e[t];if($e(n)&&!("value"in n))return i=!0,[t,n];try{return[t,nC(t,n)]}catch(e){return[t,{key:t,enabled:!1}]}}));return{body:ue(ue({},t),{},{flags:n}),withoutTypedValues:i}},publicDetail(t){if(!AT(t))return t;const e=ue({},t);if(delete e.value,$e(e.metadata)){const t=e.metadata=ue({},e.metadata);for(const e of sC)delete t[e]}return e},flagEvents(t){const{key:e,response:i,record:n}=t,s=(t=>{var e;const i=AT(t),n=null==i?void 0:i.metadata;if(!i||2!==(null==n?void 0:n.config_version))return;const s=ZT(null===(e=i.reason)||void 0===e?void 0:e.code)||void 0;let r,o,l;const a=s&&we.call(DT,s)?DT[s]:void 0,u=ZT(n.rule_id),c=ZT(n.rule_type);return!i.failed&&a&&u&&QT.test(u)&&c&&-1!==a.indexOf(c)&&(s!==FT?(r=u,o=c):Ee(n.variant_key)&&(r=u,o=c,l=n.variant_key)),{reasonCode:s,ruleId:r,ruleType:o,variantKey:l}})(n),r=AT(n);if(!s||!r||(r.failed?!Ce(i):OT(r.value)!==i))return;const{reasonCode:o,ruleId:l,ruleType:a,variantKey:u}=s,c=Object.keys(t.groups).sort().map(e=>[e,t.groups[e]]),h={[NT]:2};o&&(h[jT]=o),l&&(h[qT]=l,h[BT]=a);const d=Ee(u);return d&&(h[zT]=u),{calledKey:JSON.stringify([i,c,2,o||null,l||null,a||null,d?u:null]),exposureKey:d?JSON.stringify([PT,c,2,l,u]):void 0,build(t){const n=ue(ue({},t),h);delete n.$feature_flag_reason;const s={event:"$feature_flag_called",properties:n,capture:{omit:VT.filter(t=>!(t in n)),keep:WT}};if(!d)return{called:s,exposure:void 0};const r={};for(const t of JT)Ce(n[t])||(r[t]=n[t]);return r.$feature_flag=e,r.$feature_flag_response=i,r[zT]=u,r[qT]=l,r.locally_evaluated=!1,{called:s,exposure:{event:PT,properties:r,capture:{omit:GT,keep:[]}}}}}}},oC=Hr("[FeatureFlags]");var lC=class{constructor(t,e=!1){this.Rf=!1,this.update(t,e)}update(t,e){this.Pf=((t,e)=>{var i,n,s,r,o,l,a,u;return{bootstrap:{featureFlags:null!==(i=null===(n=t.bootstrap)||void 0===n?void 0:n.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(s=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:void 0},remoteRequestsDisabled:e,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=t.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:Ce(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!==(l=t.feature_flag_request_max_retries)&&void 0!==l?l:1),compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(a=null!==(u=t.evaluation_contexts)&&void 0!==u?u:t.evaluation_environments)&&void 0!==a?a:[],flagKeys:Se(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.Rf||(oC.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Rf=!0),Ce(t.flag_keys)||Se(t.flag_keys)||oC.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Pf}};const aC="Refusing to render web experiment since the viewer is a likely bot",uC={ADD_ATTR:(t,e)=>"target"===t&&"a"===e||"form"===t&&/^(button|fieldset|input|output|select|textarea)$/.test(e),ADD_URI_SAFE_ATTR:["form"]};let cC;const hC={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>bu(e,t),not_regex:(t,e)=>!bu(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},dC=Hr("[Conversations]"),vC="Conversations not available yet.";function fC(t,e){var i,n,s,r,o,l,a;const u=null!==(i=null==t?void 0:t.flushIntervalMs)&&void 0!==i?i:3e3,c=null!==(n=null==t?void 0:t.maxBufferSize)&&void 0!==n?n:100,h=(null==e?void 0:e.consoleCapture)?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,d=Ce(h)?Math.max(c,2048):Math.max(c,h),v=ue(ue({},function(){let t="",e="";try{var i;const n="u">typeof globalThis?globalThis:"u">typeof window?window:void 0,s=null==n||null===(i=n.navigator)||void 0===i?void 0:i.userAgent;s&&([t,e]=Ji(s))}catch(t){}return function(t,e){const i=function(t){if(t)return{}.hasOwnProperty.call(mr,t)?mr[t]:t}(t);return ue(ue({},i?{"os.name":i}:{}),e?{"os.version":e}:{})}(t,e)}()),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(r=null!==(o=null==v?void 0:v["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==r?r:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(l=null==v?void 0:v["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(a=null==v?void 0:v["deployment.environment"])&&void 0!==a?a:null==t?void 0:t.environment,resourceAttributes:v,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:c,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const pC=["debug","log","warn","error","info"],gC="console",mC="__posthogHandledLogsRequestError",yC=(t,e)=>{const i=t instanceof Error?t:new Error(e);return i[mC]=!0,i},bC=t=>!!t&&"object"==typeof t&&!0===t[mC];var _C=class{get Of(){return ue(ue({},this.R),{},{error:(...t)=>{t.some(bC)||this.R.error(...t)}})}constructor(t,e){var i;this.ra=t,this.Ff=e,this.name="logs",this.Lf=!1,this.Df=!1,this.Nf=!1,this.R=Hr("[logs]"),this.Dc=[],this.jf=[],this.Tv=0,this.qf=!1,this.qi=!1,this.Bf=[],this.zf=[],this.Hf=!1,this.Uf=!1,this.Wf=!1,this.Vf=()=>{var t,e;this.qi||(this.Tv=0,null===(t=this.Gf)||void 0===t||t.onReconnect(),null===(e=this.Jf)||void 0===e||e.onReconnect())},this.Lf=!!(null===(i=t.get())||void 0===i?void 0:i.captureConsoleLogs)}get Qf(){return!0}Zf(){}Kf(){if(!this.Wf){try{this.Wv=typeof window>"u"?void 0:window}catch(t){this.Wv=void 0}this.Wv&&(to(this.Wv,"online",this.Vf),this.Wf=!0)}}Yf(t,e,i,n){this.Kf();const s=fC(this.ra.get(),i);return[new Cr(this.Xf(t,e),s,this.Of,()=>this.Ff(),t=>t(),void 0,n),s]}tp(){const t=this.ra.get();var e;return this.Gf&&this.ep===t||(null===(e=this.Gf)||void 0===e||e.reset(),this.ep=t,[this.Gf,this.np]=this.Yf(()=>this.Dc,t=>{this.Dc=t})),this.Gf}sp(){const t=this.ra.get();var e;return this.Jf&&this.rp===t||(null===(e=this.Jf)||void 0===e||e.reset(),this.rp=t,[this.Jf,this.op]=this.Yf(()=>this.jf,t=>{this.jf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},gC)),this.Jf}setup(t){if(!this.qi&&!this.qf)return this.qf=!0,this.ia=t,this.R=t.logger.createLogger("[logs]"),N_(t.kv.initialize(),()=>{this.qi||this.Vv(t)})}Vv(t){var e;this.Kf(),(null===(e=this.ra.get())||void 0===e?void 0:e.captureConsoleLogs)&&(this.Lf=!0),(this.Lf||this.ra.remoteConfigWillArrive&&t.kv.get(this.ra.captureHintKey))&&this.lp();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.qi?n.dispose():(this.ma=n,i||this.loadIfEnabled())}dispose(){var t,e,i,n,s,r,o;this.qi||(this.qi=!0,this.ap(),null===(t=this.ma)||void 0===t||t.dispose(),this.ma=void 0,this.ia=void 0,this.Nf=!1,null===(e=this.Wv)||void 0===e||e.removeEventListener("online",this.Vf),null===(i=this.up)||void 0===i||i.call(this),this.up=void 0,null===(n=this.Gf)||void 0===n||n.clearQueue(),null===(s=this.Jf)||void 0===s||s.clearQueue(),null===(r=this.Gf)||void 0===r||r.reset(),null===(o=this.Jf)||void 0===o||o.reset())}onRemoteConfig(t){var e,i;if(this.qi)return;const n=t.ok?null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs:void 0;Re(n)?this.cp():(null===(i=this.ia)||void 0===i||i.kv.set(this.ra.captureHintKey,!!n),n?(this.Lf=!0,this.Df||this.lp(),this.loadIfEnabled()):this.cp())}reset(){var t,e,i,n;this.ap(),null===(t=this.Gf)||void 0===t||t.clearQueue(),this.Dc=[],null===(e=this.Gf)||void 0===e||e.reset(),null===(i=this.Jf)||void 0===i||i.clearQueue(),this.jf=[],null===(n=this.Jf)||void 0===n||n.reset(),this.Tv=0}captureLog(t){!this.qi&&this.ia&&this.tp().captureLog(t)}captureConsoleLog(t){!this.qi&&this.ia&&this.sp().captureLog(t)}captureBufferedConsoleLog(t,e,i){!this.qi&&this.ia&&this.sp().captureLog(t,{context:e,occurredAtMs:i})}av(){var t;this.ap(),null===(t=this.Jf)||void 0===t||t.clearQueue(),this.jf=[]}cp(){this.Lf||this.ap()}lp(){var t;if(this.Hf||!(null===(t=this.Wv)||void 0===t?void 0:t.console))return;const e=fC(this.ra.get()).maxBufferSize;let i=!0;this.zf.push(()=>{i=!1});for(const t of pC){let n;try{n=Aw(this.Wv.console[t])}catch(t){continue}n&&this.zf.push(wp(this.Wv.console,t,s=>{const r=(...n)=>{try{i&&this.hp(t,n,e)}catch(t){}return s.apply(this.Wv.console,n)};return r.__rrweb_original__=n,r}))}this.Hf=!0,this.dp=setTimeout(()=>{this.ap()},3e4)}hp(t,e,i){var n;if(this.Hf&&!this.Uf&&0!==e.length)if(null===(n=this.ia)||void 0===n?void 0:n.canCapture){if(i>this.Bf.length){this.Uf=!0;try{this.Bf.push({level:t,args:e,occurredAtMs:Date.now(),context:this.Ff()})}finally{this.Uf=!1}}}else this.ap()}ap(){if(this.Bf=[],this.Hf){this.Hf=!1,this.dp&&(clearTimeout(this.dp),this.dp=void 0);for(const t of this.zf)t();this.zf=[]}}vp(){const t=this.Bf;return this.ap(),t}get logger(){return this.fp||(this.fp={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.fp}flushLogs(t){this.ia&&(t?this.pp(t):(this.Gf&&this.Gf.flush().catch(t=>this.gp(t)),this.Jf&&this.Jf.flush().catch(t=>this.gp(t))))}flush(){var t=this;return re(function*(){var e,i;const n=null===(e=t.Gf)||void 0===e?void 0:e.flush().catch(e=>t.gp(e)),s=null===(i=t.Jf)||void 0===i?void 0:i.flush().catch(e=>t.gp(e));yield n,yield s})()}gp(t){bC(t)||this.R.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.qi||!this.Lf||this.Df||this.Nf)return;const t=this.Zf();if(t){this.Nf=!0;try{t((t,e)=>{if(this.Nf=!1,!this.qi&&this.Lf)if(t||!e)this.R.error("Could not load logs script",t),this.ap();else{const t=this.vp();this.up=e.initialize(this.ia),this.Df=!0,t.length>0&&e.replay(this.ia,t)}})}catch(t){throw this.Nf=!1,t}}else this.ap()}Xf(t,e){const i=this.ia;return{get isDisabled(){return!1},get optedOut(){return!i.canCapture},getPersistedProperty:e=>e===ce.LogsQueue?t():void 0,setPersistedProperty(t,i){t===ce.LogsQueue&&e(null!=i?i:[])},Hs:t=>this.Hs(t),getLibraryId:()=>i.library.name,getLibraryVersion:()=>i.library.version}}Hs(t){return new Promise(e=>{if(so(this.Tv,3))return void e({kind:"fatal",error:yC(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const n=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout(()=>{this.R.warn("Logs request timed out before receiving a response"),n({kind:"retry-later",error:yC(void 0,"logs request timed out")})},9e4),r=this.Qf;this.ia.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.ia.projectToken},body:t,compression:"best-available",timeoutMs:6e4}).then(t=>{var e;const i=t.statusCode;this.mp(i,r),i>=200&&300>i?n({kind:"ok"}):413===i?n({kind:"too-large"}):0!==i&&408!==i&&429!==i&&500>i?n({kind:"fatal",error:new Error(`logs request failed with status ${i}`)}):0===i?(t.error||this.R.warn("Logs request failed before receiving an HTTP response"),n({kind:"retry-later",error:yC(t.error,"logs request failed before receiving an HTTP response")})):n({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error(`logs request failed with status ${i}`)})},t=>{n({kind:"retry-later",error:t})})})}mp(t,e){(0!==t||e)&&(this.Tv=ro(t,this.Tv,3,()=>this.R.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.")))}pp(t){this.Dc.length>0&&this.yp(t,this.Dc,this.np,this.ia.library.name,t=>{this.Dc=t}),this.jf.length>0&&this.yp(t,this.jf,this.op,gC,t=>{this.jf=t})}yp(t,e,i,n,s){if(0===e.length)return;const r=e.map(t=>t.record);s([]);const o=Sr(r,kr(i,this.ia.library.name,this.ia.library.version),n,this.ia.library.version);this.ia.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.ia.projectToken},body:o,compression:"best-available",transport:t,timeoutMs:6e4}).catch(t=>this.gp(t))}};const wC=Hr("[NetworkMetrics]"),kC={"http:":80,"https:":443},SC=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),xC=t=>Ee(t)&&0===t.toLowerCase().indexOf("text/event-stream"),$C=t=>{try{return t()}catch(t){return}},TC=(t,e)=>{var i;const n=String(e);return{method:String(t).toUpperCase(),url:(null===(i=io(n))||void 0===i?void 0:i.href)||n}},CC=(t,e,i,n,s,r,o=!1)=>{try{var l,a;const u=s();if(!u)return;const c=i||void 0,h=ww()-n,d=io(e.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;const v={url:(null==d?void 0:d.href)||e.url,method:e.method},f=xe(u.name)?u.name(v):Ee(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=o&&!c?void 0:((t,e)=>t?400>t?void 0:String(t):(null==e?void 0:e.name)||"_OTHER")(c,r),g=ue(ue(ue(ue(ue({},(t=>{const e=SC.has(t)?t:"_OTHER";return ue({"http.request.method":e},"_OTHER"===e&&t!==e?{"http.request.method_original":t}:{})})(v.method)),d?(t=>{return{"server.address":t.hostname.startsWith("[")&&t.hostname.endsWith("]")?t.hostname.slice(1,-1):t.hostname,"server.port":Number(t.port)||kC[t.protocol],"url.scheme":t.protocol.slice(0,-1),"url.template":(e=t.pathname,e.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/"))};var e})(d):{}),c?{"http.response.status_code":c}:{}),p?{"error.type":p}:{}),null===(l=u.attributes)||void 0===l?void 0:l.call(u,v,{status:c,durationMs:h}));null===(a=t.metrics)||void 0===a||a.histogram(f,h,{unit:"ms",attributes:g})}catch(t){wC.error("Failed to record network metric",t)}},EC=()=>{},MC=(e,i)=>xe(null==t?void 0:t.fetch)?wp(t,"fetch",t=>function(...n){const s=ww(),r=t.apply(this,n);if(!i())return r;try{var o,l,a;const[t,u]=n,c=TC(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=>(xC($C(()=>{var e;return null==t||null===(e=t.headers)||void 0===e?void 0:e.get("content-type")}))||CC(e,c,null==t?void 0:t.status,s,i,void 0,!0),t),t=>{throw CC(e,c,void 0,s,i,t),t})}catch(t){return wC.error("Failed to observe fetch",t),r}}):EC,IC=(e,i)=>{var n;const s=null==t||null===(n=t.XMLHttpRequest)||void 0===n?void 0:n.prototype;if(!s)return EC;const r=new WeakMap,o=wp(s,"open",t=>function(...e){try{(()=>iw.has(this))()||r.set(this,TC(e[0],e[1]))}catch(t){wC.error("Failed to observe XHR open",t)}return t.apply(this,e)}),l=wp(s,"send",t=>function(...n){let s,o;try{const t=r.get(this);if(t&&i()){const n=ww(),r=()=>xC($C(()=>this.getResponseHeader("content-type")));let l=!1;o=()=>{2===this.readyState&&(l=r())},s=()=>{this.removeEventListener("loadend",s),this.removeEventListener("readystatechange",o),l||r()||CC(e,t,this.status,n,i)},to(this,"readystatechange",o),to(this,"loadend",s)}}catch(t){wC.error("Failed to observe XHR send",t)}try{return t.apply(this,n)}catch(t){throw s&&this.removeEventListener("loadend",s),o&&this.removeEventListener("readystatechange",o),t}});return()=>{o(),l()}},RC=new WeakMap,AC=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),OC={maxStringLength:2048,truncationSuffix:"..."},PC={maxStringLength:2048,truncationSuffix:"..."};function FC(t){if(t)return!0===t?{intent:!0,model:!0}:{intent:!1!==t.intent,model:!1!==t.model}}function LC(t,e){return{}.hasOwnProperty.call(t,e)}function DC(t,e){const i=Object.create(t);return e&&Object.defineProperty(i,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:e}),i}function NC(t,e,i=!1){if(!Ee(t))return;const n=t.trim();return n?(i?ir(n,OC):n).slice(0,e):void 0}function jC(t){try{return $e(t)&&!0===t.isError}catch(t){return!1}}function qC(t){return ir(t||"Unknown error",PC).slice(0,2048)}function BC(t,e){try{return qC(e?function(t){try{if(!$e(t)||!Se(t.content))return;return t.content.filter(t=>$e(t)&&"text"===t.type&&Ee(t.text)).map(t=>t.text).join(" ").trim()||void 0}catch(t){return}}(t):$e(t)&&Ee(t.message)?t.message:Ee(t)?t:String(t))}catch(t){return"Unknown error"}}function zC(t,e,i){return e.errorResult?[{type:"Error",value:i,mechanism:{type:"generic",handled:!0,synthetic:!0,exception_id:0}}]:t.buildProperties(e.error,{handled:!0}).$exception_list.map(t=>ue(ue({},t),{},{value:qC(t.value)}))}function UC(t,e){if(e)return"Error";try{if(!$e(t))return"Error";let e=Ee(t.name)?t.name.trim():"";const i=t.constructor;return e&&"Error"!==e||!xe(i)||"Error"===i.name||(e=i.name),(e||"Error").slice(0,256)}catch(t){return"Error"}}function HC(t,e){return{message:BC(t,e),type:UC(t,e)}}Z$.__defaultExtensionClasses=ue({},{featureFlags:class extends RT{constructor(t){const e=new lC(t.config,t.Fc());super(e),this.name=X_,this._instance=t,this.bp=e}get zv(){return this._instance.persistence}get Bv(){return rC}updateConfig(t,e){this.bp.update(t,e),this.Hv()}},sessionRecording:class{get Yr(){return this._instance.config}get oh(){return this._instance.persistence}get started(){var t;return!!(null===(t=this._p)||void 0===t?void 0:t.isStarted)}get status(){var t,e;return this.isReplayOff?yl:"awaiting_config"===this.wp||"missing_config"===this.wp?this.wp:null!==(t=null===(e=this._p)||void 0===e?void 0:e.status)&&void 0!==t?t:this.wp}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.wp=yl,this.kp=void 0,this.Sp=!1,this.li=void 0,this.un=(()=>{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.gn=()=>{var t,e;"visible"===(null==n?void 0:n.visibilityState)&&(this.un=!0,null===(t=this._p)||void 0===t||null===(e=t.setDocumentWasEverVisible)||void 0===e||e.call(t,!0))},!this._instance.sessionManager)throw oT.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Yr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');const i=this._instance.get_property(ct);var s;Ee(i)&&"!"===i[0]&&(null===(s=this.oh)||void 0===s||s.unregister("$session_is_sampled")),(null==n?void 0:n.addEventListener)&&to(n,"visibilitychange",this.gn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.Sp=!0,null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,"visibilitychange",this.gn),t?this.xp(!0):this.stopRecording()}get $p(){var e;const i=!!(null===(e=this._instance.get_property("$session_recording_remote_config"))||void 0===e?void 0:e.enabled),n=!this.Yr.disable_session_recording,s=this.Yr.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&n&&!s}get isReplayOff(){var t;return!!this.Yr.disable_session_recording||this._instance.consent.isOptedOut()||!1===(null===(t=this._instance.get_property("$session_recording_remote_config"))||void 0===t?void 0:t.enabled)}startIfEnabledOrStop(t){if(this.Sp)return;var e;if(this._p)if(this.li!==(null===(e=this.Yr.session_recording)||void 0===e?void 0:e.selectMaskingFn))nu.Dt(zl(this.Yr)),this._p.discard({discardProducerEvents:!0}),this.li=void 0;else if(this._p.isStarted&&this.$p)return void(this.Cp()||this.xp(!0));const i=!Ce(Object.assign)&&!Ce(Array.from);this.$p&&i?(this.Tp(t),oT.info("starting")):(this.wp=yl,this.stopRecording())}Tp(t){var e,i;if(this.$p)if("awaiting_config"!==this.wp&&"missing_config"!==this.wp&&(this.wp=Sl),(null==h||null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.rrweb)||void 0===e?void 0:e.record)&&(null===(i=h.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this.Mp(t);else{var n;const e=this._instance.sessionManager;null===(n=Ew(this._instance))||void 0===n||n(this._instance,this.Ip,i=>{if(!this.Sp&&this.$p&&this._instance.sessionManager===e)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),oT.error("could not load recorder",i)):void this.Mp(t);this.wp="disabled"})}}stopRecording(){var t,e;null===(t=this.kp)||void 0===t||t.call(this),this.kp=void 0,null===(e=this._p)||void 0===e||e.stop()}xp(t=!1){var e,i,n;t&&(this.li||(null===(e=this.Yr.session_recording)||void 0===e?void 0:e.selectMaskingFn))&&nu.Dt(zl(this.Yr)),null===(i=this.kp)||void 0===i||i.call(this),this.kp=void 0,null===(n=this._p)||void 0===n||n.discard({discardProducerEvents:t}),this.li=void 0}Ep(){var t,e;null===(t=this.oh)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this.oh)||void 0===e||e.unregister("$replay_sample_rate")}Ap(t,e){if(Re(t))return null;const i=Ae(t)?t:parseFloat(t);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(oT.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):i;var n}Rp(t){if(this.oh){var e,i;const n=this.oh,s=()=>{var e;const i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Ap(null===(e=this.Yr.session_recording)||void 0===e?void 0:e.sampleRate,"session_recording.sampleRate"),r=this.Ap(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:r;Re(o)&&this.Ep();const l=null==i?void 0:i.minimumDurationMilliseconds;n.register({[it]: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:Ce(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.kp)||void 0===e||e.call(this),this.kp=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.Rp(e),void this.xp()):(this.Rp(e),void this.startIfEnabledOrStop()):("awaiting_config"===this.wp&&(this.wp="missing_config",this._instance.register_for_session({[jt]:!0}),oT.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var i;(null===(i=this._p)||void 0===i?void 0:i.log)?this._p.log(t,e):oT.warn("log called before recorder was ready")}get Ip(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(it);return(null==i||null===(e=i.scriptConfig)||void 0===e?void 0:e.script)||"lazy-recorder"}Pp(){const t=this._instance.get_property(it);if(!t)return!1;let e;try{e="object"==typeof t?t:JSON.parse(t)}catch(t){return oT.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}Cp(){var t,e,i;return!(null===(t=this.Yr.session_recording)||void 0===t?void 0:t.selectMaskingFn)||!(!0!==(null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.rrweb)||void 0===e||null===(e=e.record)||void 0===e?void 0:e.supportsSelectMasking)||!0!==(null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.initSessionRecording)||void 0===i?void 0:i.supportsSelectMasking)||this._p&&!0!==this._p.supportsSelectMasking)||(this.wp=yl,oT.error("Session recording has not started: the recorder does not support selectMaskingFn."),!1)}Mp(t){var e,i,n,s,r,o;if(this.Sp||!this.$p||!this._instance.sessionManager)return void(this.wp=yl);if(!(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))return oT.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Nt]:!0});if(!this.Cp())return;if(this._p||(this._p=null===(o=h.__PosthogExtensions__)||void 0===o?void 0:o.initSessionRecording(this._instance,this.un),this._p._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Cp())return void this.xp(!0);if(!this.Pp()){if("missing_config"===this.wp||"awaiting_config"===this.wp)return;return this.wp="awaiting_config",oT.info("persisted remote config is stale, requesting fresh config before starting"),void new o$(this._instance).load()}this.wp=Sl,null===(i=(n=this._p).setDocumentWasEverVisible)||void 0===i||i.call(n,this.un);const l=null===(s=this.Yr.session_recording)||void 0===s?void 0:s.selectMaskingFn;this._p.start(t),this.li=l,this._p.isStarted&&l!==(null===(r=this.Yr.session_recording)||void 0===r?void 0:r.selectMaskingFn)&&this.startIfEnabledOrStop()}onRRwebEmit(t){var e,i;null===(e=this._p)||void 0===e||null===(i=e.onRRwebEmit)||void 0===i||i.call(e,t)}overrideLinkedFlag(){var t,e;this._p||null===(e=this.oh)||void 0===e||e.register({$replay_override_linked_flag:!0}),null===(t=this._p)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,e;this._p||null===(e=this.oh)||void 0===e||e.register({$replay_override_sampling:!0}),null===(t=this._p)||void 0===t||t.overrideSampling()}overrideTrigger(t){var e,i;this._p||null===(i=this.oh)||void 0===i||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(e=this._p)||void 0===e||e.overrideTrigger(t)}get sdkDebugProperties(){var t;if(this.isReplayOff)return{$recording_status:yl};const e={};for(const t of lT){var i;const n=null===(i=this._instance.sessionPersistence)||void 0===i?void 0:i.get_property(t);Ce(n)||(e[t]=n)}return ue(ue({},e),(null===(t=this._p)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(t,e){var i;return!!(null===(i=this._p)||void 0===i?void 0:i.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;null===(t=this._p)||void 0===t||null===(e=t.flushBeforeIdentityReset)||void 0===e||e.call(t)}},autocapture:class extends Y_{constructor(t){super(new Y$(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.Op=!1,this._instance=t,this.Fp=this.Lp()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.Dp();return!!(t.path||t.search||this.Np(t))}startIfEnabled(){this.isEnabled&&(Ur.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Fp=this.Lp(),this.startIfEnabled()}stop(){this.jp&&this.jp(),this.jp=void 0,this.qp&&this.qp(),this.qp=void 0,Ur.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.Bp("pushState"),this.Bp("replaceState"),this.zp(),this.Np()&&this.Hp())}Bp(e){var i;if(!t||(null===(i=t.history[e])||void 0===i?void 0:i.__posthog_wrapped__))return;const n=this;wp(t.history,e,i=>function(s,r,o){var l;n.Up(o)&&n.Wp(),i.call(this,s,r,o),n.Vp(e,!n.Op&&"popstate"!==(null==t||null===(l=t.event)||void 0===l?void 0:l.type))})}Lp(){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}}Dp(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:$e(t)?t:{}}Np(t=this.Dp()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Gp(t){const e=this.Dp(),i=this.Fp;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.Np(e)&&t.hash!==i.hash))}Vp(t,e=!1){try{e||this.Wp();const i=this.Lp();if(!i)return;if(this.Gp(i)){const i=()=>this._instance.capture(te,{navigation_type:t});e?(this.Jp=i,Promise.resolve().then(()=>this.Wp())):i()}this.Fp=i}catch(e){Ur.error(`Error capturing ${t} pageview`,e)}}Up(e){var i,n;return!(Re(e)||!t)&&(null===(i=io(String(e)))||void 0===i?void 0:i.href)!==(null===(n=t.location)||void 0===n?void 0:n.href)}Wp(){const t=this.Jp;if(t){this.Jp=void 0,this.Op=!0;try{t()}catch(t){Ur.error("Error capturing deferred pageview",t)}finally{this.Op=!1}this.Fp=this.Lp()}}zp(){if(this.jp)return;const e=()=>{this.Vp("popstate")};to(t,"popstate",e),this.jp=()=>{t&&t.removeEventListener("popstate",e)}}Hp(){if(this.qp)return;const e=()=>{this.Vp("hashchange")};to(t,"hashchange",e),this.qp=()=>{t&&t.removeEventListener("hashchange",e)}}},heatmaps:class{get Yr(){return this.instance.config}constructor(t){var e;this.Qp=!1,this.qa=!1,this.Zp=!1,this.Kp=0,this.Yp=null,this.instance=t,this.Qp=!!(null===(e=this.instance.persistence)||void 0===e?void 0:e.props[G]),this.rageclicks=new z_(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return $e(this.Yr.capture_heatmaps)&&this.Yr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Yr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Re(this.Yr.capture_heatmaps)?Re(this.Yr.enable_heatmaps)?this.Qp:this.Yr.enable_heatmaps:!1!==this.Yr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.qa)return;aT.info("starting..."),this.Xp(),this.gn()}else{var t;clearInterval(null!==(t=this.Yp)&&void 0!==t?t:void 0),this.tg(),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({[G]:i}),this.Qp=i,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}discardPending(){this.Kp=Date.now(),clearTimeout(this.eg),this.eg=void 0,this.getAndClearBuffer()}ig(t){uT(t.originalEvent)&&t.timestamp>this.Kp&&this.Jr(t.originalEvent,"deadclick")}gn(){this.Yp&&clearInterval(this.Yp),this.Yp="visible"===(null==n?void 0:n.visibilityState)?setInterval(this.Wc.bind(this),this.flushIntervalMilliseconds):null}Xp(){t&&n&&(this.ng=this.Wc.bind(this),to(t,Xt,this.ng),this.sg=e=>this.Jr(e||(null==t?void 0:t.event)),to(n,"click",this.sg,{capture:!0}),this.rg=e=>this.og(e||(null==t?void 0:t.event)),to(n,"mousemove",this.rg,{capture:!0}),this.lg=new Ix(this.instance,Ex,this.ig.bind(this)),this.lg.startIfEnabledOrStop(),this.ag=this.gn.bind(this),to(n,E,this.ag),this.qa=!0)}tg(){var e;t&&n&&(this.ng&&t.removeEventListener(Xt,this.ng),this.sg&&n.removeEventListener("click",this.sg,{capture:!0}),this.rg&&n.removeEventListener("mousemove",this.rg,{capture:!0}),this.ag&&n.removeEventListener(E,this.ag),clearTimeout(this.eg),this.eg=void 0,null===(e=this.lg)||void 0===e||e.stop(),this.qa=!1)}ug(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&&go(s)&&!mo(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=Mo(s)}return!1}($o(e),["fixed","sticky"],r);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:n),target_fixed:o,type:i}}Jr(t,e="click"){var i;if(po(t.target)||!uT(t)||!this.instance.is_capturing())return;const n=this.ug(t,e);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&Uo($o(t),this.instance.config.rageclick)&&this.Fo(ue(ue({},n),{},{type:"rageclick"})),this.Fo(n)}og(t){!po(t.target)&&uT(t)&&(Ce(this.eg)&&(this.Zp=this.instance.is_capturing()),clearTimeout(this.eg),this.eg=setTimeout(()=>{this.eg=void 0,this.Zp&&this.instance.is_capturing()&&this.Fo(this.ug(t,"mousemove"))},500))}Fo(e){if(!t)return;const i=this.Yr.disable_capture_url_hashes?un(t.location.href):t.location.href,n=this.Yr.custom_personal_data_properties,s=this.Yr.mask_personal_data_properties?[...Lu,...n||[]]:[],r=co(i,s,Nu);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}Wc(){this.Rt&&!Te(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ix,webVitalsAutocapture:class{constructor(e){var i;this._instance=e,this.Qp=!1,this.qa=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.cg=(t=!1)=>{clearTimeout(this.hg),this.hg=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}),{})),t?{transport:"sendBeacon",send_instantly:!0}:void 0),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.dg=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 eT.error("Invalid metric received",t);const i="string"==typeof t.navigationURL?t.navigationURL:void 0,n=this.vg(i);if(Ce(n))return;const s=Ae(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${n}`;if(this.fg&&t.value>=this.fg)return void eT.error("Ignoring metric with value >= "+this.fg,t);this.Rt.navigationKey!==s&&(this.cg(),this.hg=setTimeout(this.cg,this.flushToCaptureTimeoutMs)),Ce(this.Rt.navigationKey)&&(this.Rt.navigationKey=s,this.Rt.url=n),this.Rt.firstMetricTimestamp=Ce(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const r=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0),o=ue(ue(ue({},t),i?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete o.entries,$e(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const e={};for(const i of rT){const n="url"===i&&"string"==typeof t.attribution[i]?this.vg(t.attribution[i]):t.attribution[i];Ce(n)||(e[i]=n)}o.attribution=e}else delete o.attribution;Ce(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.cg()},this.pg=()=>{if(this.qa)return;let e,i,n,s,r=!1;const o=h.__PosthogExtensions__,l=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,a=(null==l?void 0:l[this.gg])||("web-vitals"===this.gg&&Ce(l)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!Ce(a)){const t=a.withoutAttribution,o=this.attributionMetrics;r=!Ce(t),e=o.indexOf("LCP")>-1?a.onLCP:(null==t?void 0:t.onLCP)||a.onLCP,i=o.indexOf("CLS")>-1?a.onCLS:(null==t?void 0:t.onCLS)||a.onCLS,n=o.indexOf("FCP")>-1?a.onFCP:(null==t?void 0:t.onFCP)||a.onFCP,s=o.indexOf("INP")>-1?a.onINP:(null==t?void 0:t.onINP)||a.onINP}if(!(e&&i&&n&&s))return void eT.error("web vitals callbacks not loaded - not starting");const u={reportSoftNavs:this.useSoftNavs},c=r&&this.attributionMetrics.indexOf("INP")>-1?ue(ue({},u),{},{includeProcessedEventEntries:!1}):u;this.allowedMetrics.indexOf("LCP")>-1&&e(this.dg.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&i(this.dg.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&n(this.dg.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&s(this.dg.bind(this),c);const d=null==t?void 0:t.document;to(d,E,()=>{"hidden"===(null==d?void 0:d.visibilityState)&&this.cg(!0)}),to(t,"pagehide",()=>this.cg(!0)),this.qa=!0},this.Qp=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[K]),this.startIfEnabled()}get mg(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const i=$e(this.mg)?null===(t=this.mg)||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)||nT:i}get flushToCaptureTimeoutMs(){return($e(this.mg)?this.mg.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=$e(this.mg)?this.mg.web_vitals_attribution:void 0;return Pe(t)?t?nT:[]:Se(t)?t:sT}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=$e(this.mg)?this.mg.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get fg(){const t=$e(this.mg)&&Ae(this.mg.__web_vitals_max_value)?this.mg.__web_vitals_max_value:iT;return t>0&&6e4>=t?iT:t}get isEnabled(){const t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return eT.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=$e(this.mg)?this.mg.web_vitals:Pe(this.mg)?this.mg:void 0;return Pe(e)?e:this.Qp}startIfEnabled(){this.isEnabled&&!this.qa&&(eT.info("enabled, starting..."),this.lu(this.pg))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const i=$e(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=$e(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[K]:i}),this._instance.persistence.register({[et]:n})),this.Qp=i,this.startIfEnabled()}get gg(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}lu(t){var e;const i=h.__PosthogExtensions__,n=this.gg,s=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==s?void 0:s[n])||"web-vitals"===n&&Ce(s)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?t():null===(e=Ew(this._instance))||void 0===e||e(this._instance,n,e=>{e?eT.error("failed to load script",e):t()})}vg(e){const i=e||(null==t?void 0:t.location.href);if(!i)return void eT.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?[...Lu,...s||[]]:[];return co(n,r,Nu)}},exceptionObserver:class{constructor(e){var i;this.pg=()=>{var e;if(!t||!this.isEnabled||!(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions))return;const i=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.yg&&this.Yr.capture_unhandled_errors&&(this.yg=i(this.captureException.bind(this))),!this.bg&&this.Yr.capture_unhandled_rejections&&(this.bg=n(this.captureException.bind(this))),!this._g&&this.Yr.capture_console_errors&&(this._g=s(this.captureException.bind(this)))}catch(t){X$.error("failed to start",t),this.wg()}},this._instance=e,this.kg=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[J]),this.kt=new Ze(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,R:X$})),this.Yr=this.Sg(),this.startIfEnabledOrStop()}Sg(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return $e(t)?e=ue(ue({},e),t):(Ce(t)?this.kg:t)&&(e=ue(ue({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Yr.capture_console_errors||this.Yr.capture_unhandled_errors||this.Yr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(X$.info("enabled"),this.wg(),this.lu(this.pg)):this.wg()}lu(t){var e,i;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions)?t():null===(i=Ew(this._instance))||void 0===i||i(this._instance,"exception-autocapture",e=>{if(e)return X$.error("failed to load script",e);t()})}wg(){var t,e,i;null===(t=this.yg)||void 0===t||t.call(this),this.yg=void 0,null===(e=this.bg)||void 0===e||e.call(this),this.bg=void 0,null===(i=this._g)||void 0===i||i.call(this),this._g=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.kg=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[J]:this.kg}),this.Yr=this.Sg(),this.startIfEnabledOrStop())}onConfigChange(){this.Yr=this.Sg()}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.kt.consumeRateLimit(s))return void X$.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.xg=[],this.$g=Zw(),this._instance=t,this.xg=null!==(e=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==e?e:[],this.Cg=is(this.Tg()),this.Mg=new ns(this.Cg)}onConfigChange(){this.Cg=is(this.Tg()),this.Mg.setConfig(this.Cg)}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.xg=r,this._instance.persistence&&this._instance.persistence.register({[Q]:this.xg,[Z]:o})}get Ig(){var t;const e=!!this._instance.get_property(Z),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.$g.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.Cg.enabled)try{if(!Ee(t)||0===t.trim().length)return void Ww.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)=>ts.has(n)?(e.push(n),i):(i[n]=t[n],i),{}),droppedKeys:e}}(this.Eg(e));n.length>0&&Ww.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Mg.add(ue({[Yn]:t,[Xn]:(new Date).toISOString()},i))}catch(t){Ww.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.Ag(e)){if(this.Rg(e))return this.Pg("Exception dropped: matched a suppression rule"),void Ww.info("Skipping exception capture because a suppression rule matched");if(!this.Ig&&this.Og(e))return this.Pg("Exception dropped: thrown by a browser extension"),void Ww.info("Skipping exception capture because it was thrown by an extension");if(!this.Ig&&this.Fg(e))return this.Pg("Exception dropped: thrown by an injected browser script"),void Ww.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Lg(e))return this.Pg("Exception dropped: thrown by the PostHog SDK"),void Ww.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this.Cg.enabled&&Re(t.$exception_steps)?this.Dg(t):t,n=function(){if("u">typeof process){var t;const e=null===(t=process.env.POSTHOG_RELEASE_ID)||void 0===t?void 0:t.trim();if(e)return e}const e=globalThis._posthogReleaseId;return"string"==typeof e&&e.length>0?e:void 0}();n&&(i.$release_id=n);try{const t=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Qd:!0});return t&&this.Mg.clear(),t}catch(t){return Hw(t)||Ww.error("Failed to capture exception event. Dropping this exception.",t),void this.Mg.clear()}}catch(t){return void(Hw(t)||Ww.error("Failed to process exception event. Ignoring this exception.",t))}}Dg(t){try{const e=this.Mg.getAttachable();return 0===e.length?t:ue(ue({},t),{},{$exception_steps:e})}catch(e){return Ww.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Pg(t){this.Cg.enabled&&this.Mg.add({[Yn]:t,[Xn]:(new Date).toISOString()})}Eg(t){return $e(t)?ue({},t):{}}Tg(){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:{}}Rg(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.xg.some(t=>{const i=t.values.map(t=>{const i=wu[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 Ww.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Og(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&&Jw.some(e=>t.startsWith(e)));return 0!==i.length&&(!i.every(({filename:t})=>!!t&&t.startsWith(Vw))||t.some(({type:t,value:e})=>"NoResponse"===t||Ee(e)&&Gw.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(Vw))))}Fg(t){return t.some(({value:t})=>Ee(t)&&Qw.some(e=>t.includes(e)))}Lg(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}Ag(t){return!Re(t)&&Se(t)}},productTours:class{get oh(){return this._instance.persistence}constructor(t){this.Ng=null,this.jg=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.oh&&this.oh.register({[X]:!!e.productTours}),!hT(this._instance))return!this.Ng&&Re(null===(i=this.oh)||void 0===i?void 0:i.props.ph_product_tours)||cT.info("product tours disabled; stopping and clearing cached tours"),null===(n=this.Ng)||void 0===n||n.stop(),this.Ng=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Ng&&hT(this._instance)&&this.lu(()=>this.qg())}lu(t){var e,i;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)?t():null===(i=Ew(this._instance))||void 0===i||i(this._instance,"product-tours",e=>{e?cT.error("Could not load product tours script",e):t()})}qg(){var t;!this.Ng&&(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.Ng=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(Se(this.jg)&&!e)return void t(this.jg,{isLoaded:!0});const i=this.oh;if(i){const n=i.props[_t];if(Se(n)&&!e)return this.jg=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(!hT(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||cT.warn(i):cT.error(i),void t([],{isLoaded:!1,error:i})}const s=Se(e.json.product_tours)?e.json.product_tours:[];this.jg=s,i&&i.register({[_t]:s}),t(s,{isLoaded:!0})}})}getActiveProductTours(t){Re(this.Ng)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ng.getActiveProductTours(t)}showProductTour(t){var e;null===(e=this.Ng)||void 0===e||e.showTourById(t)}previewTour(t){this.Ng?this.Ng.previewTour(t):this.lu(()=>{var e;this.qg(),null===(e=this.Ng)||void 0===e||e.previewTour(t)})}dismissProductTour(){var t;null===(t=this.Ng)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.Ng)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.Ng)||void 0===t||t.previousStep()}clearCache(){var t;this.jg=null,null===(t=this.oh)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var e;null===(e=this.Ng)||void 0===e||e.resetTour(t)}resetAllTours(){var t;null===(t=this.Ng)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var e;null===(e=this.Ng)||void 0===e||e.cancelPendingTour(t)}},siteApps:class{constructor(t){this._instance=t,this.Bg=0,this.zg=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps&&!this._instance.config.require_subresource_integrity}Hg(t,e){if(!e)return;const i=this.globalsForEvent(e);this.zg.push(i),this.zg.length>1e3&&(this.zg=this.zg.slice(10))}get siteAppLoaders(){var t;return null===(t=h._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this._instance.config.opt_in_site_apps&&!this.isEnabled&&vT.critical("opt_in_site_apps is ignored: require_subresource_integrity disables site apps"),this.isEnabled){const t=this._instance._addCaptureHook(this.Hg.bind(this));this.Ug=()=>{t(),this.zg=[],this.Ug=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")||[],c=this._instance.get_property("$stored_group_properties")||{};for(const[t,e]of Object.entries(c))a[t]={id:u[t],type:t,properties:e};const{$set_once:h,$set:d}=t;return{event:ue(ue({},ws(t,dT)),{},{properties:ue(ue(ue({},t.properties),d?{$set:ue(ue({},null!==(e=null===(i=t.properties)||void 0===i?void 0:i.$set)&&void 0!==e?e:{}),d)}:{}),h?{$set_once:ue(ue({},null!==(n=null===(s=t.properties)||void 0===s?void 0:s.$set_once)&&void 0!==n?n:{}),h)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(l=t.properties)||void 0===l?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:a}}Wg(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)||(vT.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)||(vT.error("prepare_external_dependency_script returned null"),null)}return t}Vg(){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,c=null==u||null===(t=u.Node)||void 0===t?void 0:t.prototype;if(!u||!c)return()=>{};if(this.Bg++,this.Gg)return this.Jg();const h=[],d=this,v=new WeakSet,f=(t,e,i)=>{if(!(null==t?void 0:t[e]))return;const n=t[e];t[e]=i(n),h.push(()=>{t[e]=n})},p=t=>{if(v.has(t))return t;const e=d.Wg(t);return e&&v.add(e),e},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!Ie(t));return f(c,"appendChild",t=>function(e){const i=p(e);return i?t.call(this,i):e}),f(c,"insertBefore",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):e}),f(c,"replaceChild",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):i}),[null===(e=u.Element)||void 0===e?void 0:e.prototype,null===(i=u.Document)||void 0===i?void 0:i.prototype,null===(s=u.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(t=>{f(t,"append",t=>function(...e){return t.apply(this,g(e))}),f(t,"prepend",t=>function(...e){return t.apply(this,g(e))})}),[null===(r=u.Element)||void 0===r?void 0:r.prototype,null===(o=u.CharacterData)||void 0===o?void 0:o.prototype,null===(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.Gg=()=>{h.forEach(t=>t()),this.Gg=void 0},this.Jg()}Jg(){let t=!1;return()=>{var e;t||(t=!0,this.Bg--,0===this.Bg&&(null===(e=this.Gg)||void 0===e||e.call(this)))}}Qg(t,e=!0){const i=this.Vg();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.zg.length&&(vT.info(`Processing ${this.zg.length} events for site app with id ${t.id}`),this.zg.forEach(t=>this.Qg(()=>{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.Ug)||void 0===i||i.call(this))};let n=!1;const s=s=>{e.errored=!s,e.loaded=!0,vT.info(`Site app with id ${t.id} ${s?"loaded":"errored"}`),n&&i()};try{const{processEvent:i}=this.Qg(e=>t.init({posthog:this._instance,callback(t){e(),s(t)}}),!1);i&&(e.processEvent=i),n=!0}catch(e){vT.error(fT+t.id,e),s(!1)}if(n&&e.loaded)try{i()}catch(i){vT.error(`Error while processing buffered events PostHog app with config id ${t.id}`,i),e.errored=!0}}Zg(){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)}Kg(t){if(0===Object.keys(this.apps).length)return;const e=this.globalsForEvent(t);for(const i of Object.values(this.apps))try{this.Qg(()=>{var t;return null===(t=i.processEvent)||void 0===t?void 0:t.call(i,e)})}catch(e){vT.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.Zg(),void this._instance.on("eventCaptured",t=>this.Kg(t))):void vT.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this.Ug)||void 0===i||i.call(this),!t.ok)return;const s=t.config;if(null===(n=s.siteApps)||void 0===n?void 0:n.length)if(this.isEnabled)for(const{id:t,url:e}of s.siteApps){var r,o;h[`__$$ph_site_app_${t}`]=this._instance,null===(r=h.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,e,e=>{if(e)return vT.error(fT+t,e)})}else vT.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},surveys:class extends B_{constructor(t){super(new Mw(t))}},tracingHeaders:class{constructor(t){this._instance=t,this.Yg=void 0,this.Xg=void 0,this.tm=void 0,this.im=void 0,this.nm=[],this.pg=()=>{const{hostnames:t,traceparentTargets:e}=this.sm();var i,n;t||e?(t||Se(this.tm)||(this.tm=[]),this.im!==this.tm&&(this.wg(),this.im=this.tm),Ce(this.Yg)&&(this.Yg=null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchXHR(this.tm,()=>this._instance.get_distinct_id(),this._instance.sessionManager,this.nm)),Ce(this.Xg)&&(this.Xg=null===(n=h.__PosthogExtensions__)||void 0===n||null===(n=n.tracingHeadersPatchFns)||void 0===n?void 0:n._patchFetch(this.tm,()=>this._instance.get_distinct_id(),this._instance.sessionManager,this.nm))):this.wg()}}initialize(){this.startIfEnabledOrStop()}lu(t){var e,i;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.tracingHeadersPatchFns)?t():null===(i=Ew(this._instance))||void 0===i||i(this._instance,"tracing-headers",e=>{if(e)return tT.error("failed to load script",e);t()})}rm(){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}om(){const t=this.rm();return Se(t)?(Se(this.tm)?this.tm.splice(0,this.tm.length,...t):this.tm=[...t],t.length>0?this.tm:void 0):!Se(this.tm)||(this.tm.splice(0),t)?(this.tm=t||void 0,this.tm):void 0}lm(){const t=this._instance.config.trace_propagation_targets,e=Se(t)?t.filter(t=>Ee(t)&&!!t):[];return this.nm.splice(0,this.nm.length,...e),e.length>0?this.nm:void 0}sm(){return{hostnames:this.om(),traceparentTargets:this.lm()}}wg(){var t,e;null===(t=this.Yg)||void 0===t||t.call(this),null===(e=this.Xg)||void 0===e||e.call(this),this.Yg=void 0,this.Xg=void 0}startIfEnabledOrStop(){const{hostnames:t,traceparentTargets:e}=this.sm();t||e?this.lu(this.pg):this.wg()}},toolbar:class{constructor(t){this.instance=t}am(t){h.ph_toolbar_state=t}um(){var t;return null!==(t=h.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,i=void 0,s=void 0){var r,o;if(eo(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=pT||ho(e.hash,"__posthog")||ho(e.hash,"state");let r;const o=n?cn(()=>JSON.parse(atob(decodeURIComponent(n))))||cn(()=>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(gT)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}hm(t){const e=h.ph_load_toolbar||h.ph_load_editor;!Re(e)&&xe(e)?e(t,this.instance):mT.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(gT,JSON.stringify(ue(ue({},r),{},{source:void 0}))),2===this.um())this.hm(r);else if(0===this.um()){var o;this.am(1),null===(o=Ew(this.instance))||void 0===o||o(this.instance,"toolbar",t=>{if(t)return mT.error("[Toolbar] Failed to load",t),void this.am(0);this.am(2),this.hm(r)}),to(t,"turbolinks:load",()=>{this.am(0),this.loadToolbar(r)})}return!0}dm(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,i=void 0){return this.maybeLoadToolbar(t,e,i)}},experiments:class e{get Yr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.vm("retrieved web experiments from the server"),this.fm=new Map,t.forEach(t=>{if(t.feature_flag_key){var i;this.fm&&(e.vm("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=this.fm)||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.pm(t,n)}else if(t.variants)for(const i in t.variants){const n=t.variants[i];e.gm(n,this._instance)&&this.ym(t.name,i,n.transforms)}})},t)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.vm(aC);else if(!this.Yr.disable_web_experiments){if(Re(this.fm))return this.fm=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.vm("applying feature flags",t),t.forEach(t=>{var e;if(this.fm&&(null===(e=this.fm)||void 0===e?void 0:e.has(t))){var i;const e=this._instance.getFeatureFlag(t),n=null===(i=this.fm)||void 0===i?void 0:i.get(t);e&&(null==n?void 0:n.variants[e])&&this.pm(n,e)}})}}previewWebExperiment(){const t=e.getWindowLocation();if(null==t?void 0:t.search){const i=uo(null==t?void 0:t.search,"__experiment_id"),n=uo(null==t?void 0:t.search,"__experiment_variant");i&&n&&(e.vm(`previewing web experiments ${i} && ${n}`),this.getWebExperiments(t=>{this.bm(parseInt(i),n,t)},!1,!0))}}loadIfEnabled(){this.Yr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Yr.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.Yr.token}`),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}bm(t,i,n){const s=n.filter(e=>e.id===t);s&&s.length>0&&(e.vm(`Previewing web experiment [${s[0].name}] with variant [${i}]`),this.ym(s[0].name,i,s[0].variants[i].transforms))}pm(t,i){const n=t.variants[i];e._m(n,this._instance)?this.ym(t.name,i,n.transforms):e.vm(`skipping variant ${i} of experiment ${t.name} because this page does not match its url conditions`)}static gm(t,i){return!Re(t.conditions)&&e._m(t,i)&&e.wm(t)}static _m(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=vo(i,s.href);return!(null===(r=t.conditions)||void 0===r?void 0:r.url)||hC[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 wm(t){var e;if(Re(t.conditions)||Re(null===(e=t.conditions)||void 0===e?void 0:e.utm))return!0;const i=qu();if(i.utm_source){var n,s,r,o,l,a,u,c;const e=!(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)||(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)==i.utm_campaign,h=!(null===(r=t.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=t.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==i.utm_source,d=!(null===(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===(c=t.conditions)||void 0===c||null===(c=c.utm)||void 0===c?void 0:c.utm_term)==i.utm_term;return e&&d&&v&&h}return!1}static vm(t,...e){Ur.info(`[WebExperiments] ${t}`,e)}static km(t,...e){Ur.warn(`[WebExperiments] ${t}`,e)}static Sm(t){("http://www.w3.org/1999/xhtml"===t.namespaceURI&&"template"===t.localName?t.content:t).querySelectorAll("a[target], template").forEach(t=>{var i;if("template"===t.localName)return void("http://www.w3.org/1999/xhtml"===t.namespaceURI&&e.Sm(t));if("http://www.w3.org/1999/xhtml"!==t.namespaceURI||"_blank"!==(null===(i=t.getAttribute("target"))||void 0===i?void 0:i.toLowerCase()))return void t.removeAttribute("target");const n=(t.getAttribute("rel")||"").split(/\s+/).filter(t=>t&&!/^(opener|noopener)$/i.test(t));n.push("noopener"),t.setAttribute("rel",n.join(" "))})}ym(t,i,n){this._is_bot()?e.vm(aC):"control"!==i?n.forEach(n=>{if(n.selector){var s;e.vm(`applying transform of variant ${i} for experiment ${t} `,n);const r=null===(s=document)||void 0===s?void 0:s.querySelectorAll(n.selector);if(!(null==r?void 0:r.length))return void e.km(`no element on this page matches selector ${n.selector} of variant ${i} for experiment ${t}`);const o=new Map;null==r||r.forEach(t=>{if("script"===t.localName.toLowerCase())return;const i=t;if(n.html){var s;const l="http://www.w3.org/1998/Math/MathML"===t.namespaceURI&&"annotation-xml"===t.localName&&(null===(s=t.getAttribute("encoding"))||void 0===s?void 0:s.toLowerCase())||"",a=JSON.stringify([t.namespaceURI,t.localName,l]);let u=o.get(a);if(Re(u)){var r;const i=null!==(r=cC)&&void 0!==r?r:cC=cb(),s=t.ownerDocument.implementation.createHTMLDocument(""),c=s.createElementNS(t.namespaceURI,t.localName);l&&c.setAttribute("encoding",l);const h=s.createRange();h.selectNodeContents(c);const d="http://www.w3.org/2000/svg"===t.namespaceURI&&/^(foreignObject|desc|title)$/.test(t.localName)||/^(text\/html|application\/xhtml\+xml)$/.test(l)?"http://www.w3.org/1999/xhtml":t.namespaceURI,v=h.createContextualFragment(n.html);"http://www.w3.org/1998/Math/MathML"===t.namespaceURI&&/^(mi|mo|mn|ms|mtext)$/.test(t.localName)?(c.appendChild(v),i.sanitize(c,ue(ue({},uC),{},{NAMESPACE:d||void 0,IN_PLACE:!0}))):("http://www.w3.org/1999/xhtml"===c.namespaceURI&&"template"===c.localName?c.content:c).appendChild(i.sanitize(v,ue(ue({},uC),{},{NAMESPACE:d||void 0,RETURN_DOM_FRAGMENT:!0}))),e.Sm(c),u=c.innerHTML,o.set(a,u)}i.innerHTML=u}n.css&&i.setAttribute("style",n.css)})}}):e.vm("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?b$(i,this.Yr.custom_blocked_useragents):void 0}},conversations:class{constructor(t){this._instance=t,this.xm=void 0,this._conversationsManager=null,this.$m=!1,this.ie=null,this.Cm=!1,this.Tm=0,this.Mm=null,this.Im=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return void(this.Mm=null);if(this.Em=t.ok,!t.ok)return;const e=t.config.conversations;Re(e)?this.Mm=null:(Pe(e)?this.xm=e:(this.xm=e.enabled,this.ie=e),this.xm||(this.Mm=null),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.Tm++,this.xm=void 0,this.ie=null,this.Em=void 0,this.Cm=!1,this.Mm=null}loadIfEnabled(){if(this._conversationsManager)return;if(this.$m)return;if(this._instance.config.disable_conversations)return;if(eo(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==h?void 0:h.__PosthogExtensions__;if(t&&!Ce(this.xm)&&this.xm)if(this.ie&&this.ie.token){this.$m=!0;try{const e=t.initConversations;if(e)return this.Am(e),void(this.$m=!1);const i=Ew(this._instance);if(!i)return void this.Rm(A);const n=this.Tm;i(this._instance,"conversations",e=>{if(n!==this.Tm)return this.$m=!1,void this.loadIfEnabled();e||!t.initConversations?this.Rm("Could not load conversations script",e):this.Am(t.initConversations),this.$m=!1})}catch(t){this.Rm("Error initializing conversations",t),this.$m=!1}}else dC.error("Conversations enabled but missing token in remote config.")}Am(t){if(this.ie){try{this._conversationsManager=t(this.ie,this._instance),this.Cm=!1,dC.info("Conversations loaded successfully")}catch(t){return void this.Rm("Error completing conversations initialization",t)}this.Im&&this._conversationsManager.setTheme(this.Im),this.Pm()}else dC.error("Cannot complete initialization: remote config is null")}Pm(){const t=this.Mm;this.Mm=null,this._conversationsManager&&t&&("open"===t?this._conversationsManager.open():this._conversationsManager.close())}Rm(t,e){dC.error(t,e),this._conversationsManager=null,this.$m=!1,this.Cm=!0}show(){this._conversationsManager?this._conversationsManager.show():dC.warn("Conversations not loaded yet.")}hide(){"open"===this.Mm&&(this.Mm=null),this._conversationsManager&&this._conversationsManager.hide()}open(){this._conversationsManager?(this.Mm=null,this._conversationsManager.open()):this.Mm="open"}close(){this._conversationsManager?(this.Mm=null,this._conversationsManager.close()):this.Mm="close"}setTheme(t){var e,i;this.Im=ue(ue(ue({},this.Im),t),{},{dark:ue(ue({},null===(e=this.Im)||void 0===e?void 0:e.dark),null==t?void 0:t.dark)}),null===(i=this._conversationsManager)||void 0===i||i.setTheme(t)}isAvailable(){return!0===this.xm&&!Ie(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":eo(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Em?"remote_config_failed":Ce(this.xm)?this.Em?"disabled_in_project":"remote_config_pending":this.xm?Re(this.ie)||!this.ie.token?"missing_token":(null==h?void 0:h.__PosthogExtensions__)?this.$m?"initializing":this.Cm?"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):(dC.warn(vC),null)})()}getMessages(t,e){var i=this;return re(function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(dC.warn(vC),null)})()}markAsRead(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(dC.warn(vC),null)})()}getTickets(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(dC.warn(vC),null)})()}requestRestoreLink(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(dC.warn(vC),null)})()}restoreFromToken(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(dC.warn(vC),null)})()}restoreFromUrlToken(){var t=this;return re(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(dC.warn(vC),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}rv(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}ov(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}},logs:class extends _C{constructor(t){super({get(){var e;return null==t||null===(e=t.config)||void 0===e?void 0:e.logs},captureHintKey:tt,get remoteConfigWillArrive(){var e,i;return!(null===(e=t.Fc)||void 0===e?void 0:e.call(t))||!!(null===(i=h._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[t.config.token])||void 0===i?void 0:i.config)}},()=>function(t){var e;const i={};if(i.distinctId=t.get_distinct_id(),t.sessionManager){const{sessionId:e,windowId:n,sessionStartTimestamp:s,lastActivityTimestamp:r}=t.sessionManager.checkAndGetSessionAndWindowId(!0);i.sessionId=e,i.windowId=n,Re(s)||(i.sessionStartTimestamp=s),Re(r)||(i.lastActivityTimestamp=r)}if((null==h||null===(e=h.location)||void 0===e?void 0:e.href)&&(i.currentUrl=t.config.disable_capture_url_hashes?un(h.location.href):h.location.href),t.featureFlags){const e=t.featureFlags.getFlags();e&&e.length>0&&(i.activeFeatureFlags=e)}return i}(t)),this._instance=t,this.name=tw,this.Kf()}get Qf(){return this._instance.__loaded}Zf(){const t=Hr("[logs]"),e=null==h?void 0:h.__PosthogExtensions__;if(!e)return void t.error("PostHog Extensions not found.");const i=Ew(this._instance);if(i)return t=>{i(this._instance,"logs",i=>{const n=e.logs;t(i,(null==n?void 0:n.initializeLogs)?{initialize:t=>n.initializeLogs(t),replay(t,e){var i;return null===(i=n.replayConsoleBuffer)||void 0===i?void 0:i.call(n,t,e)}}:void 0)})};t.error(A)}},metrics:class{constructor(t){this._instance=t,this.R=Hr("[metrics]"),this.qi=!1,this.Om=!1,this.gn=()=>{"hidden"===(null==n?void 0:n.visibilityState)&&this.flush()}}initialize(){this.onConfigChange(),this.qi||this.Om||!(null==n?void 0:n.addEventListener)||(to(n,"visibilitychange",this.gn),this.Om=!0)}onConfigChange(){var t;if(this.qi)return;const e=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);e&&!this.Fm?this.Fm=(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=MC(t,i),s=IC(t,i);return()=>{e=!1,n(),s()}})(this._instance):!e&&this.Fm&&(this.Fm(),this.Fm=void 0)}tp(){var t;if(this.qi)return;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;if(!this.Gf||this.ep!==e){var i;null===(i=this.Gf)||void 0===i||i.reset(),this.ep=e;const t=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);Ce(null==e?void 0:e.flushIntervalMs)&&(t.flushIntervalMs=6e4),this.Gf=new Fr(this.Xf(),t,this.R)}return this.Gf}count(t,e=1,i){var n;null===(n=this.tp())||void 0===n||n.count(t,e,i)}gauge(t,e,i){var n;null===(n=this.tp())||void 0===n||n.gauge(t,e,i)}histogram(t,e,i){var n;null===(n=this.tp())||void 0===n||n.histogram(t,e,i)}flush(t){if(!this.Gf)return Promise.resolve();if(t){const e=this.Gf.drainWindow();return e&&this.Go(e,t),Promise.resolve()}return this.Gf.flush().catch(t=>this.R.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.Gf)||void 0===t||t.reset()}dispose(){var t,e,i;this.qi=!0,null==n||null===(t=n.removeEventListener)||void 0===t||t.call(n,"visibilitychange",this.gn),this.Om=!1,null===(e=this.Fm)||void 0===e||e.call(this),this.Fm=void 0,null===(i=this.Gf)||void 0===i||i.reset()}Xf(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Go:t=>e.Go(t),getLibraryId:()=>su.LIB_NAME,getLibraryVersion:()=>su.LIB_VERSION}}Go(t,e){return new Promise(i=>{let s=!1;const r=t=>{s||(s=!0,clearTimeout(o),i(t))},o=setTimeout(()=>r({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(ue(ue(ue({method:"POST",url:this.Lm(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e}),"hidden"===(null==n?void 0:n.visibilityState)&&{preferSyncCompression:!0}),{},{fireCallbackOnDrop:!0,callback(t){const e=t.statusCode;if(e>=200&&300>e)r({kind:"ok"});else if(413===e)r({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)r({kind:"fatal",error:new Error(`metrics request failed with status ${e}`)});else{var i;r({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`metrics request failed with status ${e}`)})}}}))})}Lm(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}},webMCP:class{constructor(t){this._instance=t,this.Dm=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.Dm)return;const t=null==n?void 0:n.modelContext;if(!t||!xe(t.registerTool))return;const e=RC.get(t);if(e)return e.instances.add(this._instance),void(this.Dm=!0);const i={instances:new Set([this._instance])},s=t.registerTool,r=this;wp(t,"registerTool",t=>{const e=t;return function(t,...n){let s=t;try{s=r.Nm(t,i)}catch(i){return e.call(this,t,...n)}return e.call(this,s,...n)}}),t.registerTool!==s&&(RC.set(t,i),this.Dm=!0)}Nm(t,e){if(!t||!xe(t.execute))return t;const i=t.execute,n=this,{tool:s,injected:r}=function(t,e){const i={intent:!1,model:!1},n=t.inputSchema;if(!function(t){return!!Ce(t)||$e(t)&&Object.keys(t).every(t=>AC.has(t)||t.startsWith("x-"))&&!0!==t.additionalProperties&&!$e(t.additionalProperties)&&(!t.type||"object"===t.type)&&(!t.properties||$e(t.properties))&&(!t.required||Se(t.required))}(n))return{tool:DC(t),injected:i};const s=(null==n?void 0:n.properties)||{},r=t=>LC(s,t)||Se(null==n?void 0:n.required)&&n.required.includes(t);if(i.intent=e.intent&&!r("context"),i.model=e.model&&!r("llm_model"),!i.intent&&!i.model)return{tool:DC(t),injected:i};const o=ue({},s),l=Se(null==n?void 0:n.required)?[...n.required]:[];return i.intent&&(o.context={type:"string",description:'Explain why this tool is called and how it supports the user\'s goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".'},l.includes("context")||l.push("context")),i.model&&(o.llm_model={type:"string",description:'The model identifier you are running as, for example "claude-opus-4-8" or "gpt-5.2". Pass "unknown" if you are not certain. Recorded for the site developer\'s analytics.'},l.includes("llm_model")||l.push("llm_model")),{tool:DC(t,ue(ue({},n),{},{type:(null==n?void 0:n.type)||"object",properties:o,required:l})),injected:i}}(t,function(t){const e={intent:!1,model:!1};for(const i of t.instances){const t=FC(i.config.capture_webmcp);e.intent||(e.intent=!0===(null==t?void 0:t.intent)),e.model||(e.model=!0===(null==t?void 0:t.model))}return e}(e));return Object.defineProperty(s,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...o){const l=new Date,a=function(t,e){if(!$e(t))return{};try{const i=e.intent?NC(t.context,2048,!0):void 0,n=e.model?NC(t.llm_model,256):void 0;return ue(ue({},i&&"{}"!==i?{intent:i}:{}),n&&"unknown"!==n.toLowerCase()?{model:n}:{})}catch(t){return{}}}(o[0],r),u=function(t,e){const i=t[0];if(!$e(i))return t;try{const n=e.intent&&LC(i,"context"),s=e.model&&LC(i,"llm_model");if(!n&&!s)return t;const r=ue({},i);return n&&delete r.context,s&&delete r.llm_model,[r,...t.slice(1)]}catch(e){return t}}(o,r);let c;try{c=i.apply(this===s?t:this,u)}catch(t){throw n.jm(e,s,l,{error:t,errorResult:!1},a),t}if((h=c)&&"function"==typeof h.then)return Promise.resolve(c).then(t=>{const i=jC(t)?{error:t,errorResult:!0}:void 0;return n.jm(e,s,l,i,a),t},t=>{throw n.jm(e,s,l,{error:t,errorResult:!1},a),t});var h;const d=jC(c)?{error:c,errorResult:!0}:void 0;return n.jm(e,s,l,d,a),c}}),s}jm(t,e,i,n,r){const o=Date.now()-i.getTime();let l;for(const u of t.instances){var a;const t=FC(u.config.capture_webmcp);if(t){n&&!l&&(l=HC(n.error,n.errorResult));try{u.capture("$mcp_tool_call",ue(ue(ue({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:e.name,$mcp_resource_name:e.name,$mcp_tool_description:e.description,$mcp_server_name:null==s?void 0:s.hostname,$mcp_duration_ms:o,$mcp_is_error:!!n},l?{$mcp_error_type:l.type,$mcp_error_message:l.message}:{}),t.intent&&r.intent?{$mcp_intent:r.intent,$mcp_intent_source:"context_parameter"}:{}),t.model&&r.model?{$mcp_llm_model:r.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:i})}catch(t){continue}if(n&&l&&u.exceptions&&(null===(a=u.exceptionObserver)||void 0===a?void 0:a.isEnabled))try{const t={$exception_list:zC(u.exceptions,n,l.message),$exception_level:"error",$exception_source:"mcp.tool_call",$mcp_interface:"webmcp",$mcp_tool_name:e.name,$mcp_resource_name:e.name,$mcp_tool_description:e.description,$mcp_server_name:null==s?void 0:s.hostname};u.exceptionObserver.captureException(t)}catch(t){}}}}}});const WC=function(){su.SDK_DIST_CHANNEL="npm";const e=M$[U$]=new Z$;return function(){function e(){e.done||(e.done=!0,l$=!1,Vr(M$,function(t){t._dom_loaded()}))}(null==n?void 0:n.addEventListener)?"complete"===n.readyState?e():to(n,"DOMContentLoaded",e,{capture:!1}):t&&Ur.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();var VC=WC;exports.Compression=R_,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=Em,exports.PostHog=Z$,exports.ProductTourEventName=e$,exports.ProductTourEventProperties=i$,exports.SurveyEventName=Tm,exports.SurveyEventProperties=Cm,exports.SurveyEventType=ym,exports.SurveyPosition=_m,exports.SurveyQuestionBranchingType=xm,exports.SurveyQuestionType=Sm,exports.SurveySchedule=$m,exports.SurveyTabPosition=wm,exports.SurveyType=km,exports.SurveyWidgetType=bm,exports.default=VC,exports.posthog=WC,exports.severityLevels=["fatal","error","warning","log","info","debug"];