posthog-js 1.429.2 → 1.429.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) 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.js.map +1 -1
  11. package/dist/array.no-external.js +1 -1
  12. package/dist/array.no-external.js.map +1 -1
  13. package/dist/conversations.js +1 -1
  14. package/dist/customizations.d.ts +2 -0
  15. package/dist/customizations.full.js +1 -1
  16. package/dist/customizations.js +1 -1
  17. package/dist/dead-clicks-autocapture.js +1 -1
  18. package/dist/default-extensions.js +1 -1
  19. package/dist/default-extensions.js.map +1 -1
  20. package/dist/exception-autocapture.js +1 -1
  21. package/dist/extension-bundles.js +1 -1
  22. package/dist/extension-bundles.js.map +1 -1
  23. package/dist/lazy-recorder.js +1 -1
  24. package/dist/main.d.ts +2 -0
  25. package/dist/main.js +1 -1
  26. package/dist/main.js.map +1 -1
  27. package/dist/module.d.ts +2 -0
  28. package/dist/module.full.d.ts +2 -0
  29. package/dist/module.full.js +1 -1
  30. package/dist/module.full.js.map +1 -1
  31. package/dist/module.full.no-external.d.ts +2 -0
  32. package/dist/module.full.no-external.js +1 -1
  33. package/dist/module.full.no-external.js.map +1 -1
  34. package/dist/module.js +1 -1
  35. package/dist/module.js.map +1 -1
  36. package/dist/module.mjs +1 -1
  37. package/dist/module.mjs.map +1 -1
  38. package/dist/module.no-external.d.ts +2 -0
  39. package/dist/module.no-external.js +1 -1
  40. package/dist/module.no-external.js.map +1 -1
  41. package/dist/module.slim.js +1 -1
  42. package/dist/module.slim.js.map +1 -1
  43. package/dist/module.slim.no-external.d.ts +2 -0
  44. package/dist/module.slim.no-external.js +1 -1
  45. package/dist/module.slim.no-external.js.map +1 -1
  46. package/dist/posthog-recorder.js +1 -1
  47. package/dist/product-tours.js +1 -1
  48. package/dist/src/extensions/surveys.d.ts +2 -0
  49. package/dist/surveys-preview.js.map +1 -1
  50. package/dist/surveys.d.ts +2 -0
  51. package/dist/surveys.js +1 -1
  52. package/dist/surveys.js.map +1 -1
  53. package/lib/package.json +1 -1
  54. package/lib/src/extensions/surveys.d.ts +2 -0
  55. package/lib/src/extensions/surveys.js +18 -1
  56. package/lib/src/extensions/surveys.js.map +1 -1
  57. package/lib/src/feature-flags-config.js +5 -5
  58. package/lib/src/feature-flags-config.js.map +1 -1
  59. package/lib/src/posthog-core.js +3 -7
  60. package/lib/src/posthog-core.js.map +1 -1
  61. package/package.json +4 -4
@@ -1,2 +1,2 @@
1
- !function(){const t="u">typeof window?window:void 0,e="u">typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,n=null==e?void 0:e.document,s=null==e?void 0:e.location,r=null==e?void 0:e.fetch,o=(null==e?void 0:e.XMLHttpRequest)&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,l=null==e?void 0:e.AbortController,a=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent;function h(){return!(!t||!1===t.navigator.onLine)}const c="undefined"!=typeof globalThis?globalThis:t;c&&"undefined"==typeof self&&(c.self=c),c&&"undefined"==typeof File&&(c.File=function(){});const d=null!=t?t:{},v="$people_distinct_id",f="distinct_id",p="$device_id",g="$device_model",m="__alias",y="__cmpns",b="$fbc",_="$fbc_persistence",w="__timers",k="$autocapture_disabled_server_side",S="$heatmaps_enabled_server_side",x="$exception_capture_enabled_server_side",C="$error_tracking_suppression_rules",T="$error_tracking_capture_extension_exceptions",I="$web_vitals_enabled_server_side",M="$dead_clicks_enabled_server_side",E="$product_tours_enabled_server_side",P="$logs_capture_enabled_server_side",R="$web_vitals_allowed_metrics",A="$session_recording_remote_config",F="$session_recording_enabled_server_side",O="$replay_sample_rate",D="$replay_override_sampling",L="$replay_override_linked_flag",N="$replay_override_url_trigger",q="$replay_override_event_trigger",j="$sesid",B="$session_is_sampled",H="$session_past_minimum_duration",z="$session_recording_url_trigger_activated_session",U="$session_recording_event_trigger_activated_session",W="$posthog_sr_group_event_trigger_",V="$posthog_sr_group_url_trigger_",G="$posthog_sr_group_sampling_",Z="$debug_first_full_snapshot_timestamp",Q="$sess_rec_flush_size",J="$enabled_feature_flags",K="$active_feature_flags",Y="$early_access_features",X="$feature_flag_details",tt="$feature_flag_payloads",et="$feature_flag_request_id",it="$minimal_flag_called_events",nt="$override_feature_flags",st="$override_feature_flag_payloads",rt="$stored_person_properties",ot="$stored_group_properties",lt="$groups",at="$surveys",ut="$surveys_loaded_at",ht="$surveys_activated",ct="$surveys_activated_session",dt="$surveys_activated_timestamps",vt="ph_product_tours",ft="$product_tours_activated",pt="$product_tours_activated_session",gt="$conversations_widget_session_id",mt="$conversations_ticket_id",yt="$conversations_widget_state",bt="$conversations_user_traits",_t="$flag_call_reported",wt="$flag_call_reported_session_id",kt="$feature_flag_errors",St="$feature_flag_evaluated_at",xt="$user_state",Ct="$client_session_props",$t="$capture_rate_limit",Tt="$initial_campaign_params",It="$initial_referrer_info",Mt="$initial_person_info",Et="$epp",Pt="$posthog_cookieless",Rt="$cookieless_mode",At="$sdk_debug_extensions_init_method",Ft="$sdk_debug_extensions_init_time_ms",Ot="$sdk_debug_recording_script_not_loaded",Dt="$sdk_debug_replay_event_trigger_status",Lt="$sdk_debug_replay_linked_flag_trigger_status",Nt="$sdk_debug_replay_matched_recording_trigger_groups",qt="$sdk_debug_replay_pending_trigger_conditions",jt="$sdk_debug_replay_remote_trigger_matching_config",Bt="$sdk_debug_replay_trigger_groups_count",Ht="$sdk_debug_replay_url_trigger_status",zt="$sdk_debug_rrweb_attached",Ut="$sdk_debug_rrweb_start_attempted",Wt="$session_recording_start_reason",Vt="PostHog loadExternalDependency extension not found.",Gt="anonymous",Zt="identified",Qt="identified_only",Jt="visibilitychange",Kt="beforeunload",Yt="$pageview",Xt="$pageleave",te="$identify",ee="$groupidentify";function ie(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 ne(t){return function(){var e=this,i=arguments;return new Promise(function(n,s){var r=t.apply(e,i);function o(t){ie(r,n,s,o,l,"next",t)}function l(t){ie(r,n,s,o,l,"throw",t)}o(void 0)})}}function se(t){return se="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},se(t)}function re(t,e,i){return(e=function(t){var e=function(t){if("object"!=se(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=se(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==se(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function oe(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 le(t){for(var e=1;arguments.length>e;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?oe(Object(i),!0).forEach(function(e){re(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):oe(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}var ae=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),ue=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const he="min_length",ce="max_length",de=["$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"],ve=["token"];function fe(t,e){return-1!==t.indexOf(e)}const pe=function(t){return t.trim()},ge=function(t){return t.replace(/^\$/,"")};function me(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 ye=Object.prototype,be=ye.hasOwnProperty,_e=ye.toString,we=Array.isArray||function(t){return"[object Array]"===_e.call(t)},ke=t=>"function"==typeof t,Se=t=>t===Object(t)&&!we(t),xe=t=>{if(Se(t)){for(const e in t)if(be.call(t,e))return!1;return!0}return!1},Ce=t=>void 0===t,$e=t=>"[object String]"==_e.call(t),Te=t=>$e(t)&&0===t.trim().length,Ie=t=>null===t,Me=t=>Ce(t)||Ie(t),Ee=t=>"[object Number]"==_e.call(t)&&t==t,Pe=t=>Ee(t)&&t>0,Re=t=>"[object Boolean]"===_e.call(t),Ae=t=>t instanceof FormData,Fe=t=>fe(de,t),Oe=t=>fe(ve,t);function De(t){return null===t||"object"!=typeof t}function Le(t,e){return{}.toString.call(t)===`[object ${e}]`}function Ne(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 je(t,Error)}}function qe(t){return"u">typeof Event&&je(t,Event)}function je(t,e){try{return t instanceof e}catch(t){return!1}}const Be=[!0,"true",1,"1","yes"],He=t=>fe(Be,t),ze=[!1,"false",0,"0","no"],Ue=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],We=function(t,e=[]){if(!t)return!1;const i=t.toLowerCase();return Ue.concat(e).some(t=>{const e=t.toLowerCase();return-1!==i.indexOf(e)})};function Ve(t,e,i,n,s){return e>i&&(n.warn("min cannot be greater than max."),e=i),Ee(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),Ve(null!=s?s:i,e,i,n))}var Ge=class{constructor(t){this.C={},this.I=t.I,this.R=Ve(t.bucketSize,0,100,t.$),this.A=Ve(t.refillRate,0,this.R,t.$),this.O=Ve(t.refillInterval,0,864e5,t.$)}F(t,e){const i=Math.floor((e-t.lastAccess)/this.O);i>0&&(t.tokens=Math.min(t.tokens+i*this.A,this.R),t.lastAccess=t.lastAccess+i*this.O)}consumeRateLimit(t){var e;const i=Date.now(),n=String(t);let s=this.C[n];return s?this.F(s,i):(s={tokens:this.R,lastAccess:i},this.C[n]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null===(e=this.I)||void 0===e||e.call(this,t)),0===s.tokens)}stop(){this.C={}}};const Ze="Mobile",Qe="Android",Je="Tablet",Ke="Android Tablet",Ye="iPad",Xe="Apple Watch",ti="Safari",ei="BlackBerry",ii="Samsung Internet",ni="Chrome",si="Chrome iOS",ri="Internet Explorer",oi="Internet Explorer Mobile",li="Opera",ai="Microsoft Edge",ui="Firefox",hi="Firefox iOS",ci="Nintendo",di="PlayStation",vi="Xbox",fi="Android Mobile",pi="Mobile Safari",gi="Windows",mi="Windows Phone",yi="Nokia",bi="Ouya",_i="Generic "+Ze.toLowerCase(),wi="Generic "+Je.toLowerCase(),ki="Konqueror",Si="Oculus Browser",xi="Vivaldi",Ci="Yandex",$i="Whale",Ti="DuckDuckGo",Ii="Pale Moon",Mi="Waterfox",Ei="Brave",Pi="Claude",Ri="Codex",Ai="ChatGPT",Fi="Google Search App",Oi=new RegExp("Version/(\\d+(\\.\\d+)?)"),Di=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Li=new RegExp(vi,"i"),Ni=new RegExp("PlayStation \\w+","i"),qi=new RegExp("Nintendo \\w+","i"),ji=new RegExp("BlackBerry|PlayBook|BB10","i"),Bi={"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)?Ei:null}(i);return s||((null==n?void 0:n.detectGoogleSearchApp)&&fe(t,"GSA/")?Fi:fe(t," OPR/")&&fe(t,"Mini")?"Opera Mini":fe(t," OPR/")?li:ji.test(t)?ei:fe(t,"IEMobile")||fe(t,"WPDesktop")?oi:fe(t,"OculusBrowser")?Si:fe(t,"SamsungBrowser")?ii:fe(t,"Edge")||fe(t,"Edg/")?ai:fe(t,"Vivaldi/")?xi:fe(t,"YaBrowser/")?Ci:fe(t,"Whale/")?$i:fe(t,"DuckDuckGo/")||fe(t,"Ddg/")?Ti:fe(t,"Claude/")?Pi:fe(t,"Codex/")?Ri:fe(t,"ChatGPT/")?Ai:fe(t,"FBIOS")?"Facebook Mobile":fe(t,"UCWEB")||fe(t,"UCBrowser")?"UC Browser":fe(t,"CriOS")?si:fe(t,"CrMo")||fe(t,ni)?ni:fe(t,Qe)&&fe(t,ti)?fi:fe(t,"FxiOS")?hi:fe(t.toLowerCase(),ki.toLowerCase())?ki:fe(t,"Brave/")?Ei:((t,e)=>e&&fe(e,"Apple")||function(t){return fe(t,ti)&&!fe(t,ni)&&!fe(t,Qe)}(t))(t,e)?fe(t,Ze)?pi:ti:fe(t,"PaleMoon/")?Ii:fe(t,"Waterfox/")?Mi:fe(t,ui)?ui:fe(t,"MSIE")||fe(t,"Trident/")?ri:fe(t,"Gecko")?ui:"")},zi={[oi]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[ai]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[ni]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[si]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[ti]:[Oi],[pi]:[Oi],[li]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ui]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[hi]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[ki]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ei]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Oi],[fi]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ii]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Si]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[xi]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ci]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[$i]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ei]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Pi]:[Di],[Ri]:[Di],[Ai]:[Di],[Ti]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Mi]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Fi]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ri]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Ui=function(t,e,i,n){const s=Hi(t,e,i,n),r=zi[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},Wi=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[vi,t&&t[1]||""]],[new RegExp(ci,"i"),[ci,""]],[new RegExp(di,"i"),[di,""]],[ji,[ei,""]],[new RegExp(gi,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[mi,""];if(new RegExp(Ze).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){let t=Bi[i[1]]||"";return/arm/i.test(e)&&(t="RT"),[gi,t]}return[gi,""]}],[/((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]?[Qe,[t[2],t[3],t[4]||"0"].join(".")]:[Qe,""]],[/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",""]]],Vi=function(t){for(let e=0;Wi.length>e;e++){const[i,n]=Wi[e],s=i.exec(t),r=s&&(ke(n)?n(s,t):n);if(r)return r}return["",""]},Gi=function(t){return qi.test(t)?ci:Ni.test(t)?di:Li.test(t)?vi:new RegExp(bi,"i").test(t)?bi:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?mi:/iPad/.test(t)?Ye:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Xe:ji.test(t)?ei:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(yi,"i").test(t)?yi:/(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(Ze).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)?Qe:Ke:new RegExp("(pda|Mobile)","i").test(t)?_i:new RegExp(Je,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?wi:""},Zi=function(t,e){var i;const n=Gi(t);return n===Ye||n===Ke||"Kobo"===n||"Kindle Fire"===n||n===wi?Je:n===ci||n===vi||n===di||n===bi?"Console":n===Xe?"Wearable":n?Ze:"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)?Ze:Je:"Desktop";var s,r,o},Qi=/\bFBAV\/(\d+(?:\.\d+)*)/i,Ji=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Qi],[/\bFBAN\/EMA\b/i,"Facebook Lite",Qi],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Qi],[/\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"]],Ki="[Truncated]",Yi="[Unserializable]";function Xi(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}Date,Date;const tn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function en(t,e){return"string"==typeof(i=t)&&tn.test(i)?t:e();var i}function nn(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 sn(t){return t?t.split("#")[0]:t}function rn(t,e){const i=setTimeout(t,e);return null!=i&&i.unref&&(null==i||i.unref()),i}function on(t,e,i){return ln.apply(this,arguments)}function ln(){return(ln=ne(function*(t,e,i){let n;try{return yield Promise.race([t,new Promise((t,s)=>{n=rn(()=>{try{null==i||i(),t()}catch(t){s(t)}},e)})])}finally{clearTimeout(n)}})).apply(this,arguments)}let an,un,hn;function cn(t){const e=globalThis._posthogChunkIds;if(!e)return;const i=Object.keys(e);return hn&&i.length===un||(un=i.length,hn=i.reduce((i,n)=>{an||(an={});const s=an[n];if(s)i[s[0]]=s[1];else{const s=t(n);for(let t=s.length-1;t>=0;t--){const r=s[t],o=null==r?void 0:r.filename,l=e[n];if(o&&l){i[o]=l,an[n]=[o,l];break}}}return i},{})),hn}var dn=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 ne(function*(){for(const i of t)i.stacktrace&&i.stacktrace.frames&&we(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t})()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null===(e=t.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){let i,n;return null!=t.cause&&(i=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(n=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),le(le({},t),{},{cause:i,stack:n})}applyChunkIds(t,e){return t.map(t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t))}applyCoercers(t,e){for(const i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return ne(function*(){let i=t;for(const t of e.modifiers)i=yield t(i);return i})()}convertToExceptionList(t,e){var i,n,s;const r={type:t.type,value:t.value,mechanism:{type:null!==(i=e.type)&&void 0!==i?i:"generic",handled:null===(n=e.handled)||void 0===n||n,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(r.stacktrace={type:"raw",frames:t.stack});const o=[r];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,le(le({},e),{},{handled:!0}))),o}buildParsingContext(t){var e;return{chunkIdMap:cn(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,i=0){const n=(i,n)=>{if(4>=n){const s=this.buildCoercingContext(t,e,n);return this.applyCoercers(i,s)}};return le(le({},e),{},{syntheticException:0==i?e.syntheticException:void 0,mechanism:t,apply:t=>n(t,i),next:t=>n(t,i+1)})}};function vn(t,e,i,n,s){const r={platform:t,filename:e,function:"<anonymous>"===i?"?":i,in_app:!!e&&!e.startsWith("webkit-masked-url://")&&"<anonymous>"!==e};return Ce(n)||(r.lineno=n),Ce(s)||(r.colno=s),r}const fn=(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]},pn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,gn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,mn=/\((\S*)(?::(\d+))(?::(\d+))\)/,yn=(t,e)=>{const i=pn.exec(t);if(i){const[,t,n,s]=i;return vn(e,t,"?",+n,+s)}const n=gn.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){const t=mn.exec(n[2]);t&&(n[2]=t[1],n[3]=t[2],n[4]=t[3])}const[t,i]=fn(n[1]||"?",n[2]);return vn(e,i,t,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},bn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,_n=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,wn=(t,e)=>{const i=bn.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const t=_n.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]=fn(n,t),vn(e,t,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},kn=/\(error: (.*)\)/;function Sn(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function xn(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(!Sn(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 Cn(t,e){const i=e.start+e.length,n=Tn(t,e);n&&t.splice(i+n===t.length?i:e.start,n)}function $n(t,e){let i=e.start;for(;i>0&&Sn(t[i-1],t[i-1+e.length]);)i--;return e.start-i}function Tn(t,e){const i=e.start+e.length;let n=i;for(;t.length>n&&Sn(t[n],t[n-e.length]);)n++;return n-i}function In(t,e){const i=e[0];let n=t.length-(i?$n(t,i):0);for(const i of e)n-=Tn(t,i);return n}function Mn(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 En=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){const i=$e(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 Le(t,"DOMException")}isDOMError(t){return Le(t,"DOMError")}},Pn=class{match(t){return Ne(t)}coerce(t,e){var i;const n=this.getStack(t),s=void 0===n;return{type:this.getType(t),value:this.getMessage(t,e),stack:null!=n?n:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,cause:t.cause?e.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,e){const i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}},Rn=class{match(t){return!!Le(t,"ErrorEvent")&&(null!=t.error||this.sr(t))}coerce(t,e){var i;if(null!=t.error)return e.apply(t.error);const n=e.apply(t.message);return le(le({},n),{},{stack:null!==(i=this.ar(t))&&void 0!==i?i:n.stack,synthetic:!0})}sr(t){return $e(t.message)&&t.message.length>0}ar(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($e(n.filename)&&0!==n.filename.length&&0!==s)return`Error\n at ${n.filename}:${s}:${r}`}};const An=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Fn=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(An);return n&&(e=n[1],i=n[2]),[e,i]}};const On=["fatal","error","warning","log","info","debug"];function Dn(t,e=40){const i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(let t=i.length;t>0;t--){const n=i.slice(0,t).join(", ");if(e>=n.length)return t===i.length?n:n.length>e?`${n.slice(0,e)}...`:n}return""}var Ln=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(qe(t))return t.constructor.name;const e="name"in t?t.name:void 0;return $e(e)&&!Te(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: ${Dn(t)}`}isSeverityLevel(t){return $e(t)&&!Te(t)&&On.indexOf(t)>=0}getStack(t){try{return $e(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:$e(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(Ne(i))return i}}getObjectClassName(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}},Nn=class{match(t){return qe(t)}coerce(t,e){var i;const n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${Dn(t)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},qn=class{match(t){return De(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}}},jn=class{match(t){return Le(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!qe(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 De(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 Bn="$message",Hn="$timestamp",zn=new Set([Bn,Hn]),Un={enabled:!0,max_bytes:32768};function Wn(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Un.enabled,max_bytes:Gn(t.max_bytes,Un.max_bytes)}:le({},Un)}var Vn=class{constructor(t){this.ts=[],this.es=0,this.Sr=Wn(t)}setConfig(t){this.Sr=Wn(t),this.ns()}add(t){const e=function(t){let e;try{e=me(t)}catch(t){return}try{const t=JSON.parse(e);if(!Se(t))return;const i=t,n=i[Bn],s=i[Hn];if(!$e(n)||0===n.trim().length)return;if(!$e(s)&&!Ee(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.Sr.max_bytes||(this.ts.push({step:e.step,bytes:i}),this.es+=i,this.ns())}getAttachable(){return this.ts.map(t=>t.step)}clear(){this.ts=[],this.es=0}size(){return this.ts.length}ns(){for(;this.es>this.Sr.max_bytes&&this.ts.length>0;){const t=this.ts.shift();t&&(this.es-=t.bytes)}}};function Gn(t,e){if(!Ee(t)||1/0===t||-1/0===t)return e;const i=Math.floor(t);return 0>i?e:i}const Zn=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function Qn(t){return"string"==typeof t||t}function Jn(t){return"string"==typeof t?t:void 0}const Kn=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Yn="NativeGzipValidationError",Xn=t=>t.length>=2&&31===t[0]&&139===t[1],ts=(t,e)=>t===ue.GZipJS||e===ue.GZipJS||"gzip"===e,es=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),is=t=>{if(!t||"object"!=typeof t)return!1;const e="name"in t?String(t.name):"";return es(t)||e===Yn};let ns;const ss=t=>{throw nn(Yn,`Native gzip produced invalid output: ${t}`)},rs=(os=ne(function*(t,e){18>t.size&&ss("too-short");const i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Xn(i)&&8===i[2]||ss("invalid-header");const n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{const e=(()=>{if(ns)return ns;ns=[];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;ns[t]=e>>>0}return ns})();let i=4294967295;for(let n=0;t.length>n;n++)i=e[255&(i^t[n])]^i>>>8;return(4294967295^i)>>>0})(e)&&ss("invalid-crc");const s=e.length>>>0;n.getUint32(4,!0)!==s&&ss("invalid-size")}),function(t,e){return os.apply(this,arguments)});var os;function ls(t){return as.apply(this,arguments)}function as(){return as=ne(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=ne(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 rs(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}),as.apply(this,arguments)}function us(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 hs={}.propertyIsEnumerable;function cs(t,e){try{return fs(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function ds(t,e,i,n){if(0>=i.remainingNodes)return{stringValue:Ki};if(i.remainingNodes--,Re(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:Xi(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:Ki};if(t instanceof Date){const e=t.getTime(),i=Number.isFinite(e)?t.toISOString():String(t);return{stringValue:"string"==typeof i?Xi(i):String(i)}}i.ancestors.add(t);try{try{const s=t.toJSON;if("function"==typeof s)return ds(s.call(t),e,i,n+1)}catch(t){}return we(t)?{arrayValue:{values:vs(t,e,i,n+1)}}:{kvlistValue:{values:fs(t,e,i,n+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:Xi(String(t))}}function vs(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(Me(r))continue;s.push(ds(r,e,i,n))}catch(t){s.push({stringValue:Yi})}return t.length>o&&s.push({stringValue:Ki}),s}function fs(t,e,i,n){const s=[];for(const r in t)if(hs.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:Xi(r),value:ds(o,e,i,n)})}catch(t){s.push({key:Xi(r),value:{stringValue:Yi}})}}return s}function ps(t,e,i){return le(le(le(le({},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 gs={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};const ms={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},ys=ms.info;function bs(t){try{return Xi(String(t))}catch(t){return Yi}}function _s(t,e,i,n){const s=t.level||"info",{text:r,number:o}=ms[s]||ys,l=function(t=Date.now()){return String(t)+"000000"}(Ee(n)?n:void 0),a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),Me(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),Me(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=le({},a),h=t.attributes;if(h){let t=[];try{t=Object.keys(h)}catch(e){t=[]}for(const e of t){let t;try{t=h[e]}catch(e){t=Yi}Object.defineProperty(u,e,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const c={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:r,body:{stringValue:bs(t.body)},attributes:cs(u,i)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),Ce(t.trace_flags)||(c.flags=t.trace_flags),c}function ws(t,e,i){return ps(t,e,i)}function ks(t,e,i,n){return{resourceLogs:[{resource:{attributes:cs(e)},scopeLogs:[{scope:{name:i,version:n},logRecords:t}]}]}}var Ss=class{constructor(t,e,i,n,s,r=()=>Promise.resolve(),o){var l;this._instance=t,this.Sr=e,this.$=i,this.ss=n,this.rs=s,this.ls=r,this.us=o,this.hs=null,this.cs=0,this.ds=0,this.vs=0,this.fs=0,this.ps=0,this.gs=!1,this.ys=e.maxBufferSize,this.bs=Math.max(null!==(l=e.maxQueueSize)&&void 0!==l?l:e.maxBufferSize,e.maxBufferSize),this._s=e.flushIntervalMs,this.ws=e.maxBatchRecordsPerPost,this.ks=e.rateCapWindowMs,this.Ss=e.maxLogsPerInterval}clearQueue(){this.ds++,this._instance.setPersistedProperty(ae.LogsQueue,[])}reset(){this.xs(),this.fs=0,this.ps=0,this.gs=!1,this.vs=0,this.ws=this.Sr.maxBatchRecordsPerPost}onReconnect(){this.vs=0,this.Cs()}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.$s(t);if(null===n)return;if(!n.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ts())return;const s={record:_s(n,null!==(i=null==e?void 0:e.context)&&void 0!==i?i:this.ss(),this.$,null==e?void 0:e.occurredAtMs)};this.rs(()=>this.Is(s))}$s(t){const e=this.Sr.beforeSend;if(!e)return t;const i=we(e)?e:[e];let n=t;for(const t of i)try{const e=t(n);if(!e)return this.$.info("Log was rejected in beforeSend function"),null;n=e}catch(t){return this.$.error("Error in beforeSend function for log:",t),null}return n}Ts(){if(void 0===this.Ss)return!0;const t=Date.now(),e=t-this.fs;return this.ks>e&&e>=0||(this.fs=t,this.ps=0,this.gs=!1),this.Ss>this.ps?(this.ps++,!0):(this.gs||(this.$.warn(`captureLog dropping logs: exceeded ${this.Ss} logs per ${this.ks}ms`),this.gs=!0),!1)}flush(){var t=this;return ne(function*(){if(!t._instance.isDisabled)return t.hs||(t.hs=t.Ms().finally(()=>{t.hs=null})),t.hs})()}Ms(){var t=this;return ne(function*(){var e;t.xs();let i=null!==(e=t._instance.getPersistedProperty(ae.LogsQueue))&&void 0!==e?e:[];if(0===i.length)return;const n=i.length;let s=0;for(;i.length>0&&n>s;){var r,o;const e=t.ds;t.cs=0;const n=Math.min(i.length,t.ws),l=i.slice(0,n),a=ks(l.map(t=>t.record),t.Es(),null!==(r=t.us)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.Ps(a);if(t.ds!==e)return;if("too-large"===u.kind&&l.length>1)t.ws=Math.max(1,Math.floor(l.length/2)),t.$.warn(`Received 413 when sending logs batch of size ${l.length}, reducing batch size to ${t.ws}`);else{if("retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.$.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.Sr.maxBatchRecordsPerPost>t.ws&&(t.ws=Math.min(t.Sr.maxBatchRecordsPerPost,t.ws+1)),yield t.Rs(l.length),i=null!==(o=t._instance.getPersistedProperty(ae.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===u.kind)throw u.error}}})()}Rs(t){var e=this;return ne(function*(){var i;const n=Math.max(0,t-e.cs),s=null!==(i=e._instance.getPersistedProperty(ae.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(ae.LogsQueue,s.slice(n)),yield e.ls()})()}Es(){return ws(this.Sr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Is(t){var e;if(this._instance.optedOut)return;const i=null!==(e=this._instance.getPersistedProperty(ae.LogsQueue))&&void 0!==e?e:[];this.bs>i.length||(i.shift(),this.cs++,this.$.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(ae.LogsQueue,i),this.ys>i.length?this.As():this.Cs()}As(t=this._s){this.Fs||(this.Fs=rn(()=>{this.Fs=void 0,this.Cs()},t))}Os(){const t=Math.min(Math.max(0,this.vs-1),6);return this._s*Math.pow(2,t)}Ds(){const t=this._instance.getPersistedProperty(ae.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return ne(function*(){e.xs();const i=e.flush().catch(()=>{});void 0!==t?yield on(i,t):yield i})()}flushWithTimeout(t){var e=this;return ne(function*(){const i=e.flush();yield on(i,t,()=>{i.catch(()=>{})})})()}Cs(){this.flush().then(()=>{this.vs=0},t=>{this.vs++,this.$.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.Ds()&&this.As(this.Os())})}xs(){this.Fs&&(clearTimeout(this.Fs),this.Fs=void 0)}};const xs=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Cs(t){return String(t)+"000000"}function $s(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 Ts=class{constructor(t,e,i){this._instance=t,this.Sr=e,this.$=i,this.Ls=new Map,this.hs=null,this.Ns=!1,this.qs=new Map,this.js=new Set,this.Bs=0}count(t,e=1,i){this.Hs({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.Hs({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.Hs({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var t=this;const e=this.hs,i=function(){var i=ne(function*(){e&&(yield e.catch(()=>{})),yield t.zs()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this.hs===i&&(this.hs=null)});return this.hs=i,i}drainWindow(){if(0===this.Ls.size)return null;const t=this.Ls;return this.Ls=new Map,this.Ns=!1,this.qs=new Map,this.js=new Set,this.Us(t)}reset(){this.Bs++,this.xs(),this.Ls=new Map,this.hs=null,this.Ns=!1,this.qs=new Map,this.js=new Set}Hs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const e=this.$s(t);if(null===e)return;if(!e.name||"string"!=typeof e.name)return void this.$.warn("Dropping metric with empty name");if("number"!=typeof e.value||!Number.isFinite(e.value))return void this.$.warn(`Dropping metric '${e.name}': value must be a finite number`);if("count"===e.type&&0>e.value)return void this.$.warn(`Dropping count '${e.name}': counters are monotonic, value must be >= 0`);let i,n;try{i=e.attributes?le({},e.attributes):void 0,n=$s(e.type,e.name,e.unit,i)}catch(t){return void this.$.warn(`Dropping metric '${e.name}': attributes could not be serialized`,t)}let s=this.Ls.get(n);if(!s){if(!this.Ws())return;s={name:e.name,type:e.type,unit:e.unit,attributes:i,windowStartMs:Date.now()},this.Ls.set(n,s)}const r=this.qs.get(e.name);void 0===r?this.qs.set(e.name,e.type):r===e.type||this.js.has(e.name)||(this.js.add(e.name),this.$.warn(`Metric name '${e.name}' is already used as a ${r}; recording it as a ${e.type} too will blend both series in charts. Use a distinct name.`)),this.Vs(s,e.value),this.As()}Ws(){return this.Sr.maxSeriesPerFlush>this.Ls.size||(this.Ns||(this.Ns=!0,this.$.warn(`Metric series cap reached (${this.Sr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Vs(t,e){switch(t.type){case"count":var i;t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case"gauge":t.last=e;break;case"histogram":{t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(xs.length+1).fill(0)});const i=t.hist;i.count+=1,i.sum+=e,i.min=Math.min(i.min,e),i.max=Math.max(i.max,e),i.bucketCounts[function(t,e){for(let i=0;e.length>i;i++)if(e[i]>=t)return i;return e.length}(e,xs)]+=1;break}}}$s(t){const e=this.Sr.beforeSend;if(!e)return t;const i=we(e)?e:[e];let n=t;for(const t of i)try{const e=t(n);if(!e)return this.$.info("Metric was rejected in beforeSend function"),null;n=e}catch(t){return this.$.error("Error in beforeSend function for metric:",t),null}return n}As(){this.Fs||(this.Fs=rn(()=>{this.Fs=void 0,this.flush().catch(t=>{this.$.error("Metrics flush failed:",t)})},this.Sr.flushIntervalMs))}xs(){this.Fs&&(clearTimeout(this.Fs),this.Fs=void 0)}zs(){var t=this;return ne(function*(){if(0===t.Ls.size)return;const e=t.Ls;t.Ls=new Map,t.Ns=!1,t.qs=new Map,t.js=new Set;const i=t.Bs,n=yield t._instance.Gs(t.Us(e));if(i===t.Bs)switch(n.kind){case"ok":return;case"retry-later":return t.Zs(e),void t.As();case"too-large":return void t.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.$.error("Failed to send metrics batch:",n.error)}})()}Us(t){return e=this.Qs(t),i=function(t,e,i){return ps(t,e,i)}(this.Sr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:cs(i)},scopeMetrics:[{scope:{name:n,version:s},metrics:e}]}]};var e,i,n,s}Qs(t){const e=Cs(Date.now()),i=new Map;for(const o of t.values()){var n;const t=$s(o.type,o.name,o.unit,void 0);let l=i.get(t);l||(l=le({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=cs(null!==(n=o.attributes)&&void 0!==n?n:{},this.$),u=Cs(o.windowStartMs);if("count"===o.type){var s;const t={attributes:a,startTimeUnixNano:u,timeUnixNano:e,asDouble:null!==(s=o.total)&&void 0!==s?s:0};l.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t={attributes:a,timeUnixNano:e,asDouble:null!==(r=o.last)&&void 0!==r?r:0};l.gauge.dataPoints.push(t)}else o.hist&&l.histogram.dataPoints.push({attributes:a,startTimeUnixNano:u,timeUnixNano:e,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:xs})}return Array.from(i.values())}Zs(t){for(const[n,s]of t){const t=this.Ls.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,s.windowStartMs),t.type){case"count":var e,i;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(i=s.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(s.hist)if(t.hist){t.hist.count+=s.hist.count,t.hist.sum+=s.hist.sum,t.hist.min=Math.min(t.hist.min,s.hist.min),t.hist.max=Math.max(t.hist.max,s.hist.max);for(let e=0;t.hist.bucketCounts.length>e;e++)t.hist.bucketCounts[e]+=s.hist.bucketCounts[e]}else t.hist=s.hist}else this.Ws()&&this.Ls.set(n,s)}}};function Is(t,e){if(!t)return;const i=t.find(t=>t.type===e);return null==i?void 0:i.value}const Ms="0.8.2",Es={DEBUG:!1,LIB_VERSION:Ms,LIB_NAME:"browser-common",JS_SDK_VERSION:Ms},Ps=(e,{debugEnabled:i}={})=>{const n={N(n,...s){t&&(Es.DEBUG||t.POSTHOG_DEBUG||i)&&!Ce(t.console)&&t.console&&("__rrweb_original__"in t.console[n]?t.console[n].__rrweb_original__:t.console[n])(e,...s)},debug(...t){n.N("debug",...t)},info(...t){n.N("log",...t)},warn(...t){n.N("warn",...t)},error(...t){n.N("error",...t)},critical(...t){console.error(e,...t)},uninitializedWarning(t){n.error(`You must initialize PostHog before calling ${t}`)},createLogger:(t,i)=>Ps(`${e} ${t}`,i)};return n},Rs=Ps("[PostHog.js]"),As=Rs.createLogger;function Fs(t,e){we(t)&&t.forEach(e)}function Os(t,e){if(!Me(t))if(we(t))t.forEach(e);else if(Ae(t))t.forEach((t,i)=>e(t,i));else for(const i in t)be.call(t,i)&&e(t[i],i)}const Ds=function(t,...e){for(const i of e)for(const e in i)void 0!==i[e]&&(t[e]=i[e]);return t};function Ls(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 Ns=function(t){try{return t()}catch(t){return}},qs=function(t){return function(...e){try{return t.apply(this,e)}catch(t){Rs.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Rs.critical(t)}}},js=function(t){const e={};return Os(t,function(t,i){($e(t)&&t.length>0||Ee(t))&&(e[i]=t)}),e};function Bs(t){const e=le({},t);for(const i of["name","message","stack","cause","errors"])try{i in t&&(e[i]=t[i])}catch(t){}return e}const Hs=["herokuapp.com","vercel.app","netlify.app"];function zs(t){const e=null==t?void 0:t.hostname;if(!$e(e))return!1;const i=e.split(".").slice(-2).join(".");for(const t of Hs)if(i===t)return!1;return!0}function Us(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 Ws(t){return"ph_toolbar_internal"===t.name}const Vs=["localhost","127.0.0.1"],Gs=(t,e)=>{try{let i;return JSON.stringify(t,(t,e)=>{var n;return Ne(e)?(null!==(n=i)&&void 0!==n||(i=new WeakMap),i.has(e)||i.set(e,Bs(e)),i.get(e)):"bigint"==typeof e?e.toString():e},e)}catch(e){return me(t)}},Zs=t=>{const e=null==n?void 0:n.createElement("a");return Ce(e)?null:(e.href=t,e)},Qs=function(t,e="&"){let i,n;const s=[];return Os(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)},Js=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(!we(n)||2>n.length)return"";{let t=n[1];try{t=decodeURIComponent(t)}catch(e){Rs.error("Skipping decoding for malformed query param: "+t)}return t.replace(/\+/g," ")}},Ks=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("=");we(n)&&(e.includes(n[0])?u.push(n[0]+"="+i):u.push(a[t]))}let h=l;return null!=o&&(h+="?"+u.join("&")),null!=s&&(h+="#"+s),h},Ys=function(t,e){const i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Xs=(t,e)=>t>=e&&h(),tr=(t,e,i,n)=>{if(0===t){if(h()){const t=e+1;return t===i&&n(),t}return e}return 0};function er(t,e){var i;const n=null==t||null===(i=t.config)||void 0===i?void 0:i.get_current_url;if(!ke(n))return e;try{const t=n(e);return $e(t)&&t?t:e}catch(t){return Rs.error("Error in get_current_url, falling back to window.location.href",t),e}}function ir(e){var i;const n=null==t||null===(i=t.location)||void 0===i?void 0:i.href;return Ce(n)?void 0:er(e,n)}function nr(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 sr(t){return!!t&&1===t.nodeType}function rr(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function or(t){return!!t&&3===t.nodeType}function lr(t){return!!t&&11===t.nodeType&&sr(t.host)}function ar(t){return t?pe(t).split(/\s+/):[]}function ur(t,e){const i=ir(e);return!!(i&&t&&t.some(t=>i.match(t)))}function hr(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 ar(e)}function cr(t){return Me(t)?null:pe(t).split(/(\s+)/).filter(t=>Nr(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function dr(t){let e="";return Mr(t)&&!Er(t)&&t.childNodes&&t.childNodes.length&&Os(t.childNodes,function(t){var i;or(t)&&t.textContent&&(e+=null!==(i=cr(t.textContent))&&void 0!==i?i:"")}),pe(e)}function vr(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 fr=["a","button","form","input","select","textarea","label"];function pr(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 gr(t,e){if(Ce(e))return!0;for(const i of t)if(e.some(t=>pr(i,t)))return!0;return!1}function mr(t){const e=t.parentNode;return!(!e||!sr(e))&&e}const yr=[".ph-no-autocapture","[data-ph-no-autocapture]"],br=["next","previous","prev",">","<"],_r=[...br,"+","-","−","–"],wr=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,kr=[".ph-no-deadclick",".ph-no-capture"],Sr=[".ph-no-rageclick",".ph-no-capture"],xr=["","text","search","email","password","url","tel","number"];function Cr(t){return!(!t||!sr(t))&&(!!rr(t,"textarea")||(rr(t,"input")?fe(xr,(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 $r(e,i){if(!t||Tr(e))return!1;let n,s,r;var o,l;if(Re(i)?(n=!!i&&Sr,s=void 0,r=!1):(n=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Sr,s=null==i?void 0:i.content_ignorelist,r=null!==(l=null==i?void 0:i.ignore_text_selection)&&void 0!==l&&l),!1===n)return!1;if(r&&Cr(e))return!1;const{targetElementList:a}=Ir(e,!1);return!function(t,e){if(!1===t||Ce(t))return!1;let i;if(!0===t)i=br;else{if(!we(t))return!1;if(t.length>10)return Rs.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map(t=>t.toLowerCase())}return e.some(({safeText:t,ariaLabel:e})=>i.some(i=>wr(t,i)||wr(e,i)))}(s,a.map(t=>{var e;return{safeText:dr(t).toLowerCase(),ariaLabel:(null===(e=t.getAttribute("aria-label"))||void 0===e?void 0:e.toLowerCase().trim())||""}}))&&!gr(a,n)}const Tr=t=>!t||rr(t,"html")||!sr(t),Ir=(e,i)=>{if(!t||Tr(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const s=[e];let r=e;for(;r.parentNode&&!rr(r,"body");){if(lr(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}const e=mr(r);if(!e)break;if(i||fr.indexOf(e.tagName.toLowerCase())>-1)n=!0;else try{const i=t.getComputedStyle(e);i&&"pointer"===i.getPropertyValue("cursor")&&(n=!0)}catch(t){}s.push(e),r=e}return{parentIsUsefulElement:n,targetElementList:s}};function Mr(t){const e=new Set;let i=0;for(let n=t;n.parentNode&&!rr(n,"body");n=n.parentNode){if(i++>=1e3||e.has(n))return!1;e.add(n);const t=hr(n);if(fe(t,"ph-sensitive")||fe(t,"ph-no-capture"))return!1}if(fe(hr(t),"ph-include"))return!0;const n=t.type||"";if($e(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}const s=t.name||t.id||"";return!$e(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Er(t){return!!(rr(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||rr(t,"select")||rr(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const Pr=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}))$"),Rr=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Ar=[16,15,14,13],Fr=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Or=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Dr=/[0-9A-Za-z_]/;function Lr(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 Nr(t,e=!0){if(Me(t))return!1;if($e(t)){if(t=pe(t),e?Pr.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(Rr.lastIndex=0;e=Rr.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 Ar){const n=t+e;if(i.length>=n){const e=i.slice(t,n);if(Pr.test(e)&&Lr(e))return!0}}}return!1}(t))return!1;if(e?Fr.test(t):function(t){let e;for(Or.lastIndex=0;e=Or.exec(t);){const t=e[1],i=e[3];if(!(t&&i&&Dr.test(t)&&Dr.test(i)))return!0}return!1}(t))return!1}return!0}function qr(t){let e=dr(t);return e=`${e} ${jr(t)}`.trim(),Nr(e)?e:""}function jr(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Os(t.childNodes,function(t){var i;if(t&&"span"===(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=dr(t);e=`${e} ${i}`.trim(),t.childNodes&&t.childNodes.length&&(e=`${e} ${jr(t)}`.trim())}catch(t){Rs.error("[AutoCapture]",t)}}),e}function Br(t){return t.replace(/"|\\"/g,'\\"')}function Hr(t){const e=t.attr__class;if(e)return we(e)?e:ar(e)}const zr=1e6;function Ur(t){var e;return Math.min(zr,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:zr)}const Wr={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:zr,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},Vr=["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"],Gr=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Zr=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Qr=t=>{Me(t)||Os(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return Vr.includes(e)||Zr.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},Jr=["/s/","/e/","/i/"];function Kr(t,e,i,n){if(Me(t))return t;let s=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return $e(s)&&(s=parseInt(s)),s>i?`[SessionRecording] ${n} body too large to record (${s} bytes)`:t}function Yr(t,e){if(Me(t))return t;let i=t;return Nr(i,!1)||(i="[SessionRecording] "+e+" body redacted"),Os(Gr,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 Xr=new WeakSet,to="disabled",eo="sampled",io="active",no="buffering",so="paused",ro="lazy_loading",oo="rrweb_error",lo="trigger_activated",ao="trigger_pending",uo="trigger_disabled";function ho(t,e,i,n,s,r){return 0===e?uo:(null==t?void 0:t.get_property(i?n+i:s))===r?lo:ao}function co(t,e,i){return e.some(e=>{var n;return"regex"===e.matching&&(null!==(n=null==i?void 0:i.get(e.url))&&void 0!==n?n:new RegExp(e.url)).test(t)})}function vo(t){return t.includes("trigger_activated")?lo:t.includes("trigger_pending")?ao:uo}function fo(t){const e=new Set(t);switch(e.delete(uo),e.size){case 0:return uo;case 1:return Array.from(e)[0];default:return ao}}var po=class{constructor(t){this.q=t}triggerStatus(t){return vo(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return vo(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},go=class{constructor(t){this.q=t}triggerStatus(t){return fo(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return fo(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},mo=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return lo}stop(){}};const yo=t=>"sessionRecording"in t;var bo=class{constructor(t,e){this._instance=t,this.j=[],this.B=[],this.H=new Map,this.U=new Map,this.W="",this.urlBlocked=!1,this.V=e}onConfig(t){var e,i;this.j=(yo(t)?Se(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.B=(yo(t)?Se(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.Z()}Z(){this.H.clear(),this.U.clear();for(const t of this.j)if("regex"===t.matching&&!this.H.has(t.url))try{this.H.set(t.url,new RegExp(t.url))}catch(e){Rs.error("Invalid URL trigger regex pattern:",t.url,e)}for(const t of this.B)if("regex"===t.matching&&!this.U.has(t.url))try{this.U.set(t.url,new RegExp(t.url))}catch(e){Rs.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}G(t){return ho(this._instance,this.j.length,this.V,V,z,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Ht]:e}),e}triggerStatusNoSideEffects(t){return this.G(t)}isCurrentUrlBlocked(){const t=ir(this._instance);if(!t)return!1;try{return co(t,this.B,this.U)}catch(t){return!0}}checkUrlBlocklist(t,e){const i=ir(this._instance);if(!i)return;if(i===this.W)return;this.W=i;const n=this.urlBlocked,s=co(i,this.B,this.U);n&&s||(s&&!n?t():!s&&n&&e())}checkUrlTriggerConditions(t,e,i,n){const s=ir(this._instance);if(!s)return;if(s===this.W)return;this.W=s;const r=this.urlBlocked,o=co(s,this.B,this.U);o&&!r?t():!o&&r&&e();const l=this.G(n)===lo,a=co(s,this.j,this.H);!l&&a&&i("url",s)}stop(){this.W=""}},_o=class{constructor(t){this._instance=t,this.linkedFlag=null,this.linkedFlagSeen=!1,this.J=()=>{}}triggerStatus(){const t=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[Lt]:t}),t}triggerStatusNoSideEffects(){let t=ao;return Me(this.linkedFlag)&&(t=uo),this.linkedFlagSeen&&(t=lo),t}onConfig(t,e){var i;if(this.linkedFlag=(yo(t)?Se(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!Me(this.linkedFlag)&&!this.linkedFlagSeen){const t=$e(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=$e(this.linkedFlag)?null:this.linkedFlag.variant;this.J=this._instance.onFeatureFlags((n,s)=>{let r=!1;if(Se(s)&&t in s){const e=s[t];r=Re(e)?!0===e:i?e===i:!!e}const o=r&&!this.linkedFlagSeen;this.linkedFlagSeen=r,o&&e(t,i)})}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.J()}},wo=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(yo(t)?Se(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 ho(this._instance,this.K.length,this.V,W,U,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Dt]:e}),e}triggerStatusNoSideEffects(t){return this.X(t)}checkEventTriggerConditions(t,e,i){if(0===this.K.length)return;const n=this.X(i)===lo,s=this.K.includes(t);!n&&s&&e("event",t)}stop(){}},ko=class{constructor(t,e,i){if(this._instance=t,this.group=e,this.Y=new bo(t,e.id),this.tt=new wo(t,e.id),this.et=new _o(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){const t=(e.conditions.events||[]).map(t=>t.name),n={urlTriggers:e.conditions.urls||[],eventTriggers:t,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.Y.onConfig(n),this.tt.onConfig(n),this.et.onConfig(n,i);const s=[this.tt,this.Y,this.et];this.nt="any"===e.conditions.matchType?new po(s):new go(s)}else this.nt=new mo}triggerStatus(t){return this.nt.triggerStatus(t)}triggerStatusNoSideEffects(t){return this.nt.triggerStatusNoSideEffects(t)}getPendingTriggerConditions(t){return"trigger_pending"!==this.triggerStatusNoSideEffects(t)?[]:[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===ao).map(({label:t})=>t)}checkEventTriggerConditions(t,e,i){this.tt.checkEventTriggerConditions(t,e,i)}checkUrlTriggerConditions(t,e,i,n){this.Y.checkUrlTriggerConditions(t,e,i,n)}activateTrigger(t,e){var i;const n="url"===t?V+this.group.id:W+this.group.id;null===(i=this._instance.persistence)||void 0===i||i.register({[n]:e})}stop(){this.Y.stop(),this.tt.stop(),this.et.stop()}};function So(t){if(t.rrwebError)return oo;if(!t.receivedFlags)return no;if(!t.isRecordingEnabled)return to;if(t.urlTriggerMatching.urlBlocked)return so;const e=!0===t.isSampled,i=new po([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?eo:"trigger_activated"===i?io:"trigger_pending"===i?no:!1===t.isSampled?to:io}function xo(t){if(t.rrwebError)return oo;if(!t.receivedFlags)return no;if(!t.isRecordingEnabled)return to;if(t.urlTriggerMatching.urlBlocked)return so;const e=new go([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),i=e!==uo,n=Re(t.isSampled);return i&&"trigger_pending"===e?no:i&&"trigger_disabled"===e||n&&!t.isSampled?to:!0===t.isSampled?eo:io}function Co(){const t=[];return function(e,i){if(Se(i)||we(i)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(i)?"[Circular]":(t.push(i),i)}return i}}function $o(t){const e=JSON.stringify(t,Co());return e?new Blob([e]).size:0}function To(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(we(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:To(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+To(s))}return i}default:return 0}}function Io(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[Io({size:i.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),Io({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 Mo=Uint8Array,Eo=Uint16Array,Po=Uint32Array,Ro=new Mo([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]),Ao=new Mo([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]),Fo=new Mo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Oo=function(t,e){for(var i=new Eo(31),n=0;31>n;++n)i[n]=e+=1<<t[n-1];var s=new Po(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]},Do=Oo(Ro,2),Lo=Do[1];Do[0][28]=258,Lo[258]=28;for(var No=Oo(Ao,0)[1],qo=new Eo(32768),jo=0;32768>jo;++jo){var Bo=(43690&jo)>>>1|(21845&jo)<<1;qo[jo]=((65280&(Bo=(61680&(Bo=(52428&Bo)>>>2|(13107&Bo)<<2))>>>4|(3855&Bo)<<4))>>>8|(255&Bo)<<8)>>>1}var Ho=function(t,e,i){for(var n=t.length,s=0,r=new Eo(e);n>s;++s)++r[t[s]-1];var o,l=new Eo(e);for(s=0;e>s;++s)l[s]=l[s-1]+r[s-1]<<1;if(i){o=new Eo(1<<e);var a=15-e;for(s=0;n>s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],c=l[t[s]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)o[qo[c]>>>a]=u}else for(o=new Eo(n),s=0;n>s;++s)o[s]=qo[l[t[s]-1]++]>>>15-t[s];return o},zo=new Mo(288);for(jo=0;144>jo;++jo)zo[jo]=8;for(jo=144;256>jo;++jo)zo[jo]=9;for(jo=256;280>jo;++jo)zo[jo]=7;for(jo=280;288>jo;++jo)zo[jo]=8;var Uo=new Mo(32);for(jo=0;32>jo;++jo)Uo[jo]=5;var Wo=Ho(zo,9,0),Vo=Ho(Uo,5,0),Go=function(t){return(t/8|0)+(7&t&&1)},Zo=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var n=new(t instanceof Eo?Eo:t instanceof Po?Po:Mo)(i-e);return n.set(t.subarray(e,i)),n},Qo=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8},Jo=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8,t[n+2]|=i>>>16},Ko=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 Mo(0),0];if(1==s){var o=new Mo(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(t,e){return t.f-e.f}),i.push({s:-1,f:25001});var l=i[0],a=i[1],u=0,h=1,c=2;for(i[0]={s:-1,f:l.f+a.f,l:l,r:a};h!=s-1;)l=i[i[c].f>i[u].f?u++:c++],a=i[u!=h&&i[c].f>i[u].f?u++:c++],i[h++]={s:-1,f:l.f+a.f,l:l,r:a};var d=r[0].s;for(n=1;s>n;++n)r[n].s>d&&(d=r[n].s);var v=new Eo(d+1),f=Yo(i[h-1],v,0);if(f>e){n=0;var p=0,g=f-e,m=1<<g;for(r.sort(function(t,e){return v[e.s]-v[t.s]||t.f-e.f});s>n;++n){var y=r[n].s;if(e>=v[y])break;p+=m-(1<<f-v[y]),v[y]=e}for(p>>>=g;p>0;){var 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 Mo(v),f]},Yo=function(t,e,i){return-1==t.s?Math.max(Yo(t.l,e,i+1),Yo(t.r,e,i+1)):e[t.s]=i},Xo=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Eo(++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]},tl=function(t,e){for(var i=0,n=0;e.length>n;++n)i+=t[n]*e[n];return i},el=function(t,e,i){var n=i.length,s=Go(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)},il=function(t,e,i,n,s,r,o,l,a,u,h){Qo(e,h++,i),++s[256];for(var c=Ko(s,15),d=c[0],v=c[1],f=Ko(r,15),p=f[0],g=f[1],m=Xo(d),y=m[0],b=m[1],_=Xo(p),w=_[0],k=_[1],S=new Eo(19),x=0;y.length>x;++x)S[31&y[x]]++;for(x=0;w.length>x;++x)S[31&w[x]]++;for(var C=Ko(S,7),T=C[0],I=C[1],M=19;M>4&&!T[Fo[M-1]];--M);var E,P,R,A,F=u+5<<3,O=tl(s,zo)+tl(r,Uo)+o,D=tl(s,d)+tl(r,p)+o+14+3*M+tl(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(O>=F&&D>=F)return el(e,h,t.subarray(a,a+u));if(Qo(e,h,1+(O>D)),h+=2,O>D){E=Ho(d,v,0),P=d,R=Ho(p,g,0),A=p;var L=Ho(T,I,0);for(Qo(e,h,b-257),Qo(e,h+5,k-1),Qo(e,h+10,M-4),h+=14,x=0;M>x;++x)Qo(e,h+3*x,T[Fo[x]]);h+=3*M;for(var N=[y,w],q=0;2>q;++q){var j=N[q];for(x=0;j.length>x;++x)Qo(e,h,L[B=31&j[x]]),h+=T[B],B>15&&(Qo(e,h,j[x]>>>5&127),h+=j[x]>>>12)}}else E=Wo,P=zo,R=Vo,A=Uo;for(x=0;l>x;++x)if(n[x]>255){var B;Jo(e,h,E[257+(B=n[x]>>>18&31)]),h+=P[B+257],B>7&&(Qo(e,h,n[x]>>>23&31),h+=Ro[B]);var H=31&n[x];Jo(e,h,R[H]),h+=A[H],H>3&&(Jo(e,h,n[x]>>>5&8191),h+=Ao[H])}else Jo(e,h,E[n[x]]),h+=P[n[x]];return Jo(e,h,E[256]),h+P[256]},nl=new Po([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),sl=new Mo(0),rl=function(){for(var t=new Po(256),e=0;256>e;++e){for(var i=e,n=9;--n;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),ol=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function ll(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=rl[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 Mo(n+o+5*(1+Math.floor(o/7e3))+s),a=l.subarray(n,l.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var c=h+65535;o>c?u=el(a,u,t.subarray(h,c)):(a[h]=r,u=el(a,u,t.subarray(h,o)))}else{for(var d=nl[e-1],v=d>>>13,f=8191&d,p=(1<<i)-1,g=new Eo(32768),m=new Eo(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 Po(25e3),k=new Eo(288),S=new Eo(32),x=0,C=0,T=(h=0,0),I=0,M=0;o>h;++h){var E=_(h),P=32767&h,R=m[E];if(g[P]=R,m[E]=P,h>=I){var A=o-h;if((x>7e3||T>24576)&&A>423){u=il(t,a,0,w,k,S,C,T,M,h-M,u),T=x=C=0,M=h;for(var F=0;286>F;++F)k[F]=0;for(F=0;30>F;++F)S[F]=0}var O=2,D=0,L=f,N=P-R&32767;if(A>2&&E==_(h-N))for(var q=Math.min(v,A)-1,j=Math.min(32767,h),B=Math.min(258,A);j>=N&&--L&&P!=R;){if(t[h+O]==t[h+O-N]){for(var H=0;B>H&&t[h+H]==t[h+H-N];++H);if(H>O){if(O=H,D=N,H>q)break;var z=Math.min(N,H-2),U=0;for(F=0;z>F;++F){var W=h-N+F+32768&32767,V=W-g[W]+32768&32767;V>U&&(U=V,R=W)}}}N+=(P=R)-(R=g[P])+32768&32767}if(D){w[T++]=268435456|Lo[O]<<18|No[D];var G=31&Lo[O],Z=31&No[D];C+=Ro[G]+Ao[Z],++k[257+G],++S[Z],I=h+O,++x}else w[T++]=t[h],++k[t[h]]}}u=il(t,a,r,w,k,S,C,T,M,h-M,u),r||(u=el(a,u,sl))}return Zo(l,0,n+Go(u)+s)}(s,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+r.mem,o,l,!a)),h=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&ol(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),ol(u,h-8,i.d()),ol(u,h-4,n),u}function al(t,e){var i=t.length;if(!e&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new Mo(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 Mo(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 Zo(n,0,s)}function ul(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 hl=class{constructor(t,e={}){var i,n,s,r;this._rrweb=t,this.it=e,this.rt={},this.ot=Date.now(),this.st=-1/0,this.ut=()=>{const t=Date.now(),e=t-this.ot;e>0?(this.ct=Math.min(this.dt,this.ct+e/1e3*this.ht),this.ot=t):this.ot=t},this.ft=t=>{if(!this.rt[t]){var e,i;this.rt[t]=!0;const n=this.vt(t);null===(e=(i=this.it).onBlockedNode)||void 0===e||e.call(i,t,n)}},this.yt=t=>{const e=this.vt(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){const t=e.closest("svg");if(t)return[this._rrweb.mirror.getId(t),t]}return[t,e]},this.vt=t=>this._rrweb.mirror.getNode(t),this.bt=t=>{var e,i,n,s,r,o,l,a;return(null!==(e=null===(i=t.removes)||void 0===i?void 0:i.length)&&void 0!==e?e:0)+(null!==(n=null===(s=t.attributes)||void 0===s?void 0:s.length)&&void 0!==n?n:0)+(null!==(r=null===(o=t.texts)||void 0===o?void 0:o.length)&&void 0!==r?r:0)+(null!==(l=null===(a=t.adds)||void 0===a?void 0:a.length)&&void 0!==l?l:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;const e=t.data,i=this.bt(e);if(e.attributes){const t=e.attributes.length;e.attributes=e.attributes.filter(t=>{const[e]=this.yt(t.id);return!this.wt.consumeRateLimit(e)&&t});const i=t-e.attributes.length;var n,s;i>0&&(null===(n=(s=this.it).onDroppedAttributeMutations)||void 0===n||n.call(s,i))}const r=this.bt(e);if(0===r&&i!==r)return;if(this.kt)return t;this.ut();const o=To(t);var l,a;return o>this.ct?(null===(l=(a=this.it).onDroppedOversizedMutation)||void 0===l||l.call(a,o),void this._t()):(this.ct-=o,t)},this._t=()=>{if(this.St)return;const t=Math.max(0,this.xt-(Date.now()-this.st));this.St=setTimeout(()=>{var t,e;this.St=void 0,this.st=Date.now(),null===(t=(e=this.it).requestFullSnapshot)||void 0===t||t.call(e)},t)},this.wt=new Ge({bucketSize:null!==(i=this.it.bucketSize)&&void 0!==i?i:100,refillRate:null!==(n=this.it.refillRate)&&void 0!==n?n:10,refillInterval:1e3,I:this.ft,$:Rs}),this.dt=null!==(s=this.it.bytesBucketSize)&&void 0!==s?s:0,this.ht=null!==(r=this.it.bytesRefillRate)&&void 0!==r?r:25600,this.kt=!Number.isFinite(this.dt)||0>=this.dt,this.ct=this.dt;const o=this.it.resyncIntervalMs;this.xt=Ee(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this.rt={},this.St&&(clearTimeout(this.St),this.St=void 0),this.st=Date.now()}stop(){this.wt.stop(),this.reset(),this.ct=this.dt,this.ot=Date.now(),this.st=-1/0}};const cl=t=>{if(n){try{const e=t+"=",i=n.cookie.split(";").filter(t=>t.length);for(let t=0;i.length>t;t++){let n=i[t];for(;" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Ee(t)&&isFinite(t)&&Math.floor(t)===t});var dl=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}},vl=class{generate(){const t=this.generateOrAbort();if(!Ce(t))return t;{this.Ct=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 Ee(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Ct)this.Ct=t,this.Mt();else{if(this.Ct>=t+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return dl.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new pl}};let fl=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!Ce(t.crypto)&&crypto.getRandomValues&&(fl=t=>crypto.getRandomValues(t));var pl=class{nextUint32(){return this.Rt.length>this.$t||(fl(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let gl;const ml=()=>yl().toString(),yl=()=>(gl||(gl=new vl)).generate();let bl="";const _l=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let wl=null;const kl={Et(){if(!Ie(wl))return wl;if(wl=!1,n)try{const t=`__ph_cookie_support_${ml()}`;kl.At(t,"xyz"),wl='"xyz"'===cl(t),kl.Lt(t)}catch(t){wl=!1}return wl},Pt(t){Rs.error("cookieStore error: "+t)},Ot:cl,Dt(t){let e;try{e=JSON.parse(kl.Ot(t))||{}}catch(t){}return e},At(t,e,i,s,r){if(!n)return!1;try{let o="",l="";const a=function(t,e){if(e){let e=function(t,e=n){if(bl)return bl;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";const i=t.split(".");let s=Math.min(i.length,8);const r="dmn_chk_"+ml();for(;!bl&&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",bl=t)}return bl}(t);if(!e){const i=(t=>{const e=t.match(_l);return e?e[0]:""})(t);i!==e&&Rs.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&&Rs.warn("cookieStore warning: large cookie, len="+u.length),n.cookie=u,!0}catch(t){return!1}},Lt(t,e){if(null==n?void 0:n.cookie)try{kl.At(t,"",-1,e)}catch(t){return}}};let Sl=null;const xl={Et(){if(!Ie(Sl))return Sl;let e=!0;if(Ce(t))e=!1;else try{const t="__mplssupport__";xl.At(t,"xyz"),'"xyz"'!==xl.Ot(t)&&(e=!1),xl.Lt(t)}catch(t){e=!1}return e||Rs.error("localStorage unsupported; falling back to cookie store"),Sl=e,e},Pt(t){Rs.error("localStorage error: "+t)},Ot(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){xl.Pt(t)}return null},Dt(t){try{return JSON.parse(xl.Ot(t))||{}}catch(t){}return null},At(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){xl.Pt(t)}return!1},Lt(e){try{null==t||t.localStorage.removeItem(e)}catch(t){xl.Pt(t)}}},Cl=[rt,K,J,X,tt,et,St,kt,_t],$l=[p,f,j,B,Et,Mt,_,xt],Tl=t=>t+"_cpm",Il=["__proto__","constructor","prototype"],Ml=t=>{if(!Se(t))return{};const e={};return Object.keys(t).forEach(i=>{-1===Il.indexOf(i)&&(e[i]=t[i])}),e},El=(t,e=[])=>{const i={};return[...$l,...e].forEach(e=>{const n=t[e];Ce(n)||Ie(n)||""===n||(i[e]=n)}),i},Pl=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)},Rl=(t,e)=>({p:e,f:Pl(JSON.stringify(t))}),Al=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const i=kl.Dt(Tl(t)),n=(null==i?void 0:i.f)===Pl(e)&&we(i.p);return{properties:n?i.p:[],isValid:n}}catch(t){return{properties:[],isValid:!1}}},Fl=(t,e)=>e+"|"+(kl.Ot(Tl(t))||""),Ol={},Dl={Et:()=>!0,Pt(t){Rs.error("memoryStorage error: "+t)},Ot:t=>t in Ol?Ol[t]:null,Dt:t=>t in Ol?Ol[t]:null,At:(t,e)=>(Ol[t]=e,!0),Lt(t){delete Ol[t]}};let Ll=null;const Nl={Et(){if(!Ie(Ll))return Ll;if(Ll=!0,Ce(t))Ll=!1;else try{const t="__support__";Nl.At(t,"xyz"),'"xyz"'!==Nl.Ot(t)&&(Ll=!1),Nl.Lt(t)}catch(t){Ll=!1}return Ll},Pt(t){Rs.error("sessionStorage error: ",t)},Ot(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Nl.Pt(t)}return null},Dt(t){try{return JSON.parse(Nl.Ot(t))||null}catch(t){}return null},At(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Nl.Pt(t)}return!1},Lt(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Nl.Pt(t)}}};Es.DEBUG=!1,Es.LIB_VERSION="1.429.2",Es.LIB_NAME="web";var ql=Es,jl=class{constructor(t){if(!t.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.Ft=t.get_property.bind(t),this.Nt=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.Nt(Q,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){const e=this.Ft(Q);return Se(i=e)&&$e(i.sessionId)&&Ee(i.size)&&e.sessionId===t?e.size:0;var i}};function Bl(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<Ve(100*e,0,100,Rs)}function Hl(t){return`$survey_response_${t}`}function zl(t,e){if(!e)return null;const i=t[Hl(e)];return we(i)?[...i]:i}function Ul(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=zl(t,e.id);Ce(r)||(n[i]=r)}),le(le({$survey_questions:e.questions.map(e=>{var n,s;return{id:e.id,question:null!==(n=null==i?void 0:i[null!==(s=e.id)&&void 0!==s?s:""])&&void 0!==n?n:e.question,response:zl(t,e.id)}})},t),n)}function Wl(t={}){return Object.values(t).some(t=>!Me(t))}function Vl(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 Gl(t){return"string"==typeof t&&t.trim()?t.trim():null}function Zl(t){return t.toLowerCase()}function Ql(t,e,i){if(!t||!e)return null;const n=Zl(e),s=Object.keys(t).find(t=>Zl(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=>Zl(t)===s);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${e})`),r}return null}const Jl=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function Kl(t,e,i){var n;const s=Ql(t.translations,e,i),r=le({},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=le({},r.appearance);for(const i of Jl){const n=e[i];Ce(n)||(t[i]=n,o=!0)}r.appearance=t}else(function(t){return Jl.some(e=>!Ce(t[e]))})(e)&&(o=!0)}const a=t.questions.map(t=>function(t,e,i){var n;const s=Ql(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=le({},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 we(t.choices)}(r)&&(o.choices=r.choices,l=!0),{question:l?o:t,matchedKey:l?s:null,hasChanges:l}}(t,e,i)),u=a.map(t=>t.question),h=a.some(t=>t.hasChanges);let c=null;return s||(c=(null===(n=a.find(t=>t.matchedKey))||void 0===n?void 0:n.matchedKey)||null),h&&(r.questions=u,o=!0,null==i||i.info(`Applied question-level translations for language: ${e}`)),{survey:r,matchedKey:o?s||c:null}}function Yl(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 Xl(t){var e;return Yl(t)&&!!(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e?void 0:e.repeatedActivation)||"always"===t.schedule}const ta=(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}},ea=t=>t.toLowerCase(),ia={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=>ta(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!ta(e,t))),icontains:(t,e)=>e.map(ea).some(e=>t.map(ea).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(ea).every(e=>t.map(ea).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 na(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=ia[i.operator];return!!s&&s(i.values,[String(n)])})}function sa(t,e,i){return Gs({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}const ra=new Set(["is_not","not_icontains","not_regex"]);function oa(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 ra.has(r);const o=ia[r];return!!o&&!Ce(t.value)&&!Ie(t.value)&&o(we(t.value)?t.value.map(String):[String(t.value)],we(s)?s.map(String):[String(s)])})}const la=As("[SessionRecording]");function aa(t,e){return e?t:"!"+t}function ua(t,e){return t===e||t!=="!"+e&&null}var ha=class{constructor(t,e,i,n,s,r,o){this._instance=t,this.Y=e,this.tt=i,this.et=n,this.qt=s,this.jt=r,this.Bt=o,this.Ht=null,this.Ut=xo}onRemoteConfig(t){this.Ht=Ee(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.zt=new po([this.tt,this.Y]),this.Ut=So):(this.zt=new go([this.tt,this.Y]),this.Ut=xo),this._instance.register_for_session({[jt]:t.triggerMatchType}),this.Y.onConfig(t),this.tt.onConfig(t),this.et.onConfig(t,(t,e)=>{this.qt("linked_flag_matched",{flag:t,variant:e}),this.Bt()})}getStatus(t){return this.Ut({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 Ee(i)?i:null}checkUrlTriggers(t,e,i,n){this.Y.checkUrlTriggerConditions(e,i,n,t)}setupEventTriggerListeners(t,e,i){if(0!==this.tt.K.length&&Me(this.Wt))return this.Wt=t(t=>{try{this.tt.checkEventTriggerConditions(t.event,i,e)}catch(t){la.error("Could not activate event trigger",t)}}),this.Wt}makeSamplingDecisions(t){var e;const i=this.Ht;var n,s;if(!Ee(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(B),o=this._instance.get_property(O),l=ua(r,t),a=Ee(o)&&o!==i,u=Ce(o)&&r===t,h=a||u||!Re(l),c=h?Bl(t,i):l;h&&(c?this.qt("sampled"):la.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:aa(t,c),$replay_sample_rate:Ie(o)&&r===t?null:i})}ensureSamplingDecision(t){if(!Ee(this.Ht))return;const e=this._instance.get_property(B);Re(ua(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.zt)||void 0===e?void 0:e.triggerStatus(t))===ao}getPendingTriggerConditions(t){return[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===ao).map(({label:t})=>t)}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.tt.stop(),this.Y.stop(),this.et.stop()}},ca=class{constructor(t,e,i,n,s){this._instance=t,this.Y=e,this.qt=i,this.Vt=n,this.Bt=s,this.Zt=[],this.Gt=new Map,this.Qt=!1}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Jt(t.triggerGroups),this._instance.register_for_session({[jt]:"v2_trigger_groups",[Bt]:t.triggerGroups.length}),this.Y.onConfig(t)):la.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return oo;if(!t.receivedFlags)return no;if(!t.isRecordingEnabled)return to;if(t.urlTriggerMatching.urlBlocked)return so;const e=t.triggerGroupMatchers,i=t.triggerGroupSamplingResults;if(0===e.length)return to;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)?Rs.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(s=!0)}else"trigger_pending"===e&&(n=!0)}return s?eo:n?no:to}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Zt,triggerGroupSamplingResults:this.Gt,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){let e=null;for(const i of this.Zt)if("trigger_activated"===i.triggerStatus(t)){const t=i.group.minDurationMs;Ee(t)&&(Ie(e)||e>t)&&(e=t)}return e}checkUrlTriggers(t,e,i,n){this.Y.checkUrlBlocklist(e,i);for(const n of this.Zt)n.checkUrlTriggerConditions(e,i,e=>{this.Kt(n,void 0)&&(n.activateTrigger(e,t),this.updateActiveTriggers(t),this.Bt(e))},t)}setupEventTriggerListeners(t,e,i){return this.Wt=t(t=>{var i;if(this.Qt)return la.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(i=this.Wt)||void 0===i||i.call(this),void(this.Wt=void 0);try{for(const i of this.Zt)i.checkEventTriggerConditions(t.event,n=>{if(!this.Kt(i,t.properties))return;const s=(i.group.conditions.events||[]).filter(e=>e.name===t.event),r=this._instance.get_property(rt);s.some(e=>!e.properties||0===e.properties.length||oa(e.properties,t.properties,r))&&(i.activateTrigger(n,e),this.updateActiveTriggers(e),this.Bt(n))},e)}catch(t){la.error("Could not activate event trigger for trigger groups",t)}}),this.Wt}makeSamplingDecisions(t){for(const i of this.Zt){var e;const n=i.group,s=n.id,r=n.sampleRate,o=G+s,l=this._instance.get_property(o);let a=null,u=!1,h=!1,c=!1;if(Se(l)){const e=l.sessionId,i=l.sampleRate,n=l.sampled;u="string"==typeof e&&e!==t,h=Ee(i)&&i!==r,a=e===t&&Ee(i)&&i===r&&Re(n)?n:null}else a=l===t||null,u="string"==typeof l&&l!==t,c=l===t;const d=u||h||c||!Re(a),v=d?Bl(t+s,r):a;d&&this.Vt("triggerGroupSamplingDecisionMade",{group_id:s,group_name:n.name,sampleRate:r,isSampled:v}),this.Gt.set(s,v),null===(e=this._instance.persistence)||void 0===e||e.register({[o]:{sessionId:t,sampleRate:r,sampled:v}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Qt=!0}clearConditionalRecordingPersistence(){var t,e,i;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$replay_sample_rate"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_past_minimum_duration");for(const t of this.Zt){var n,s,r;const e=t.group.id;null===(n=this._instance.persistence)||void 0===n||n.unregister("$posthog_sr_group_event_trigger_"+e),null===(s=this._instance.persistence)||void 0===s||s.unregister("$posthog_sr_group_url_trigger_"+e),null===(r=this._instance.persistence)||void 0===r||r.unregister("$posthog_sr_group_sampling_"+e)}}updateActiveTriggers(t){const e=[];for(const i of this.Zt){const n=i.group,s=n.id,r="trigger_activated"===i.triggerStatus(t),o=!0===this.Gt.get(s);r&&e.push({id:s,name:n.name,matched:!0,sampled:o})}this._instance.register_for_session({[Nt]:e})}hasPendingTriggers(t){for(const e of this.Zt)if("trigger_pending"===e.triggerStatus(t))return!0;return!1}getPendingTriggerConditions(t){return this.Zt.flatMap(e=>"trigger_pending"!==e.triggerStatusNoSideEffects(t)?[]:e.getPendingTriggerConditions(t).map(t=>`trigger group "${e.group.name}": ${t}`))}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear(),this.Y.stop()}Kt(t,e){const i=t.group.conditions.properties;return!i||0===i.length||oa(i,e,this._instance.get_property(rt))}Jt(t){this.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear();for(const e of t){const t=new ko(this._instance,e,(t,i)=>{this.qt("linked_flag_matched",{flag:t,variant:i,group_id:e.id,group_name:e.name}),this.Bt()});this.Zt.push(t)}}};const da=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],va=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...da],fa="<masked>",pa=["li_fat_id"];function ga(t,e,i){if(!n)return{};const s=e?[...da,...i||[]]:[],r=ma(Ks(n.URL,s,fa),t),o=function(){const t={};return Os(pa,function(e){const i=cl(e);t[e]=i||null}),t}();return Ds(o,r)}function ma(t,e){const i=va.concat(e||[]),n={};return Os(i,function(e){const i=Js(t,e);n[e]=i||null}),n}function ya(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?Js(n.referrer,i):"";t.length&&(s.ph_keyword=t)}return s}function ba(){return navigator.language||navigator.userLanguage}function _a(){const t=ba();return"string"==typeof t?t.split("-")[0]:void 0}const wa="$direct";function ka(){return(null==n?void 0:n.referrer)||wa}function Sa(t,e,i=!1){const n=t?[...da,...e||[]]:[],r=i?sn(null==s?void 0:s.href):null==s?void 0:s.href,o=null==r?void 0:r.substring(0,1e3);return{r:ka().substring(0,1e3),u:o?Ks(o,n,fa):void 0}}function xa(t,e=!1){var i;const{r:n,u:s}=t,r=e?sn(s):s,o={$referrer:n,$referring_domain:null==n?void 0:n==wa?wa:null===(i=Zs(n))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const t=Zs(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const e=ma(r);Ds(o,e)}if(n){const t=ya(n);Ds(o,t)}return o}function Ca(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function $a(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const Ta=1e5,Ia=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Ma=[],Ea=()=>!1,Pa="@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(" "),Ra="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Aa="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(" "),Fa="Accommodation AdministrativeArea Country Place State".split(" "),Oa={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:Ra,publisher:Aa},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Ma},Offer:{seller:Aa},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:Aa,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Aa,areaServed:Fa,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Ma}},Da=[["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(" "),Oa.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Oa.Event],[Aa,Oa.Organization],[Fa,Oa.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Oa.Product]];function La(t,e){return be.call(t,e)?t[e]:void 0}function Na(t){const e=typeof t;return Ie(t)||"string"===e||"number"===e||"boolean"===e}function qa(t,e){return e&&function(t){return $e(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function ja(t,e){return we(t)&&t.every(Na)?t.map(t=>qa(t,e)).filter(t=>!Ce(t)):Na(t)?qa(t,e):void 0}function Ba(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 Ha(t){if(be.call(Oa,t))return Oa[t];for(const[e,i]of Da)if(e.includes(t))return i}function za(t,e,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0})}function Ua(t,e,i,n){if(we(t)){const s=t.map(t=>Ua(t,e,i,n)).filter(t=>!Ce(t));return s.length?s:void 0}return Wa(t,e,i,n)||void 0}function Wa(t,e,i,n){if(!Se(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(i))return null;const s=La(t,"@type"),r=function(t){const e=new Set,i="string"==typeof t?[t]:we(t)?t:[],n=[];for(const t of i){if("string"!=typeof t)continue;const i=t.replace(/^https?:\/\/schema\.org\//,"");if(100>=i.length&&Ia.test(i)&&!e.has(i)&&(e.add(i),n.push(i),20===n.length))break}return n}(s),o=r.filter(t=>!!Ha(t)&&(!n||!n.length||n.includes(t))),l={};for(const n of Pa){const o="@type"===n?r.length?"string"==typeof s?r[0]:r:void 0:"@id"===n?Ba(La(t,n),e):ja(La(t,n),i.maskUrl);Ce(o)||za(l,n,o)}for(const n of o){const s=Ha(n);for(const n of Object.keys(s)){const r=La(t,n),o=s[n];if(!0===o){const t=ja(r,i.maskUrl);Ce(t)||za(l,n,t)}else{const t=Ua(r,e,i,o);Ce(t)||za(l,n,t)}}}const a=Ua(La(t,"@graph"),e,i);return Ce(a)||za(l,"@graph",a),Object.keys(l).length?l:null}function Va(t,e,i){if(!Se(t))return null;const n=La(t,"@context");if("string"!=typeof n||!/^https?:\/\/schema\.org\/?$/.test(n))return null;const s=Wa(t,e,i);return s?le({"@context":"https://schema.org"},s):null}function Ga(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function Za(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 Qa(t,e,i){for(let n=t;n;){if(Za(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 Ja(t){return Ga(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(Ga)}function Ka(t){return Ce(t)?void 0:Math.round(t)}function Ya(t){return Se(t)?t.network_timing:t}const Xa=As("[SessionRecording]"),tu=[1,2,3,4,5,6,7,12],eu=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function iu(){var t;return null==d||null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function nu(){var t;return null===(t=iu())||void 0===t?void 0:t.record}function su(t){try{return JSON.stringify(t)}catch(e){return JSON.stringify(t,Co())}}function ru(t){return ul(ll(al(su(t))),!0)}function ou(t){return lu.apply(this,arguments)}function lu(){return(lu=ne(function*(t){const e=yield ls(su(t),ql.DEBUG,{rethrow:!0});return ul(new Uint8Array(yield e.arrayBuffer()),!0)})).apply(this,arguments)}let au,uu;const hu="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let cu=!1;function du(t){var e;return we(t)&&0===t.length?(au=null!==(e=au)&&void 0!==e?e:ru([]),au):ru(t)}function vu(t){return fu.apply(this,arguments)}function fu(){return(fu=ne(function*(t){var e;return we(t)&&0===t.length?au||(uu=null!==(e=uu)&&void 0!==e?e:ou([]).then(t=>(au=t,t)).catch(t=>{throw au=void 0,uu=void 0,t}),uu):ou(t)})).apply(this,arguments)}function pu(t){return hu&&!cu&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function gu(t){return{event:t,size:To(t)}}function mu(t,e){return le(le({},t),{},{data:e,cv:"2024-10"})}function yu(t,e){return le(le({},t),{},{cv:"2024-10",data:le(le({},t.data),e)})}function bu(t){try{if(2===t.type)return gu(mu(t,ru(t.data)));if(3===t.type&&0===t.data.source)return gu(yu(t,{texts:du(t.data.texts),attributes:du(t.data.attributes),removes:du(t.data.removes),adds:du(t.data.adds)}));if(3===t.type&&8===t.data.source)return gu(yu(t,{adds:t.data.adds?ru(t.data.adds):void 0,removes:t.data.removes?ru(t.data.removes):void 0}))}catch(t){Xa.error("could not compress event - will use uncompressed event",t)}return{event:t,size:$o(t)}}function _u(){return _u=ne(function*(t){try{if(2===t.type)return gu(mu(t,yield ou(t.data)));if(3===t.type&&0===t.data.source){const[e,i,n,s]=yield Promise.all([vu(t.data.texts),vu(t.data.attributes),vu(t.data.removes),vu(t.data.adds)]);return gu(yu(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?ou(t.data.adds):void 0,t.data.removes?ou(t.data.removes):void 0]);return gu(yu(t,{adds:e,removes:i}))}}catch(e){return is(e)&&(cu=!0),Xa.error("could not compress event asynchronously - trying synchronous compression",e),bu(t)}return{event:t,size:$o(t)}}),_u.apply(this,arguments)}function wu(t,e){return 5===t.type&&t.data.tag===e}function ku(t){return wu(t,"sessionIdle")}function Su(t){return wu(t,"$session_ending")}function xu(t){return wu(t,"$session_starting")}var Cu=class{get sessionId(){return this.Xt}get Yt(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get te(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get ee(){return ua(this._instance.get_property(B),this.sessionId)}get Ht(){var t;const e=null===(t=this.ne)||void 0===t?void 0:t.sampleRate;return Ee(e)?e:null}get ie(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t,e){this._instance=t,this.oe="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.se=void 0,this.ae=!1,this.le=Date.now(),this.ue=!1,this.ce=[],this.de="unknown",this.he=0,this.fe=0,this.ve=0,this.pe=0,this.me=!1,this.ge=!1,this.ye=!1,this.be=!1,this.we=!1,this.ke=!1,this._e=!1,this.Se=!1,this.xe=!1,this.Ce=!1,this.Me=!1,this.Ie=!1,this.Te=[],this.Re=void 0,this.$e=void 0,this.Ee=!1,this.Ae=[],this.Oe=0,this.Le=0,this.Pe=!1,this.De=void 0,this.Wt=void 0,this.Fe=void 0,this.Ne=void 0,this.qe=void 0,this.je=(t,e,i)=>{var n,s,r,o;if(!i)return;if(t===this.Xt&&e===this.Be)return;const l=!i.noSessionId&&(i.activityTimeout||i.sessionPastMaximumLength),a=this.Xt,u=this.Be;var h;if(l&&this.Vt("$session_ending",{currentSessionId:a,currentWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le,flushed_size:null===(h=this.He)||void 0===h?void 0:h.currentTrackedSize(a)}),null===(n=this._instance.persistence)||void 0===n||n.unregister("$debug_first_full_snapshot_timestamp"),this._e=!1,null===(s=iu())||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.Ue(),!(!1===this.de&&this.isStarted||this.Xt===t&&this.Be===e)){const e=this.Xt!==t&&!1!==this.de;this.de="unknown",this.ze(e)}l&&this.Vt("$session_starting",{previousSessionId:a,previousWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le}),null===(o=this.re)||void 0===o||o.makeSamplingDecisions(t)},this.We=!1,this.Ve=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[H])===this.Xt},this.Ze=()=>{var t,e;if(0===this.Rt.data.length)return null;const i=null===(t=this.Rt.data[0])||void 0===t?void 0:t.timestamp,n=null===(e=this.Rt.data[this.Rt.data.length-1])||void 0===e?void 0:e.timestamp;return Ee(i)&&Ee(n)?n-i:null},this.Ge=()=>{var t,e;const i=this.ie;if(!Ee(i))return!1;if(null===(t=null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.strictMinimumDuration)||void 0===t||!t){const t=this.Qe;return Ee(t)&&t>=0&&i>t}if(this.Ve())return!1;const n=this.Ze();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.Je=()=>{"buffering"!==this.status?(this.me&&this.ge&&this.Ke&&!this.ye&&this.Xe(void 0),this.Ye(),this.tn(!0)):this.en()},this.nn=()=>{this.Je()},this.rn=()=>{this.Vt("browser offline",{})},this.sn=()=>{this.Vt("browser online",{})},this.an=()=>{(null==n?void 0:n.visibilityState)&&("visible"===n.visibilityState&&(this.Ke=!0),this.Vt("window "+n.visibilityState,{}))},this.Ke=null==e||e;const{sessionId:i,windowId:s,sessionStartTimestamp:r}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=i,this.Be=s,this._sessionStartTimestamp=r,this.et=new _o(this._instance),this.Y=new bo(this._instance),this.tt=new wo(this._instance),this.Rt=this.en(),this.ln="ph_"+(this._instance.config.persistence_name||this._instance.config.token)+"_replay_pending_buffer",this.Yt.sessionTimeoutMs>this.te||Xa.warn(`session_idle_threshold_ms (${this.te}) is greater than the session timeout (${this.Yt.sessionTimeoutMs}). Session will never be detected as idle`),this.He=new jl(this._instance)}setDocumentWasEverVisible(t){t&&(this.Ke=!0)}get un(){var t,e,i,n,s,r,o,l,a;const u=null===(t=this.ne)||void 0===t?void 0:t.masking,h={maskAllInputs:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.maskAllInputs,maskTextSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.maskTextSelector,blockSelector:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.blockSelector,maskAllElementAttributes:null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.maskAllElementAttributes},c=null!==(r=null==h?void 0:h.maskAllInputs)&&void 0!==r?r:null==u?void 0:u.maskAllInputs,d=null!==(o=null==h?void 0:h.maskTextSelector)&&void 0!==o?o:null==u?void 0:u.maskTextSelector,v=null!==(l=null==h?void 0:h.blockSelector)&&void 0!==l?l:null==u?void 0:u.blockSelector,f=null!==(a=null==h?void 0:h.maskAllElementAttributes)&&void 0!==a?a:null==u?void 0:u.maskAllElementAttributes;return Ce(c)&&Ce(d)&&Ce(v)&&Ce(f)?void 0:{maskAllInputs:null==c||c,maskTextSelector:d,blockSelector:v,maskAllElementAttributes:f}}cn(){var t;if(this.xe)return;const e=null===(t=this.ne)||void 0===t?void 0:t.masking;if(Me(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.xe=!0,Xa.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+n.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==i?void 0:i.maskAllInputs,maskTextSelector:null==i?void 0:i.maskTextSelector,blockSelector:null==i?void 0:i.blockSelector,maskAllElementAttributes:null==i?void 0:i.maskAllElementAttributes},project:e}))}get dn(){var t;return Ve(null===(t=this._instance.config.session_recording.canvasCapture)||void 0===t?void 0:t.resolutionScale,.1,1,As("canvas recording resolution scale"),1)}get hn(){var t,e,i,n,s,r,o;const l=this._instance.config.session_recording.captureCanvas,a=null===(t=this.ne)||void 0===t?void 0:t.canvasRecording,u=null!==(e=null!==(i=null==l?void 0:l.recordCanvas)&&void 0!==i?i:null==a?void 0:a.enabled)&&void 0!==e&&e,h=null!==(n=null!==(s=null==l?void 0:l.canvasFps)&&void 0!==s?s:null==a?void 0:a.fps)&&void 0!==n?n:4;let c=null!==(r=null!==(o=null==l?void 0:l.canvasQuality)&&void 0!==o?o:null==a?void 0:a.quality)&&void 0!==r?r:.4;if("string"==typeof c){const t=parseFloat(c);c=isNaN(t)?.4:t}return{enabled:u,fps:Ve(h,0,12,As("canvas recording fps"),4),quality:Ve(c,0,1,As("canvas recording quality"),.4)}}get fn(){var t;const e=!!(null===(t=this.ne)||void 0===t?void 0:t.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return null!=i?i:e}get vn(){var t,e,i;const n=null===(t=this.ne)||void 0===t?void 0:t.networkPayloadCapture,s={recordHeaders:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.recordBody},r=(null==s?void 0:s.recordHeaders)||(null==n?void 0:n.recordHeaders),o=(null==s?void 0:s.recordBody)||(null==n?void 0:n.recordBody),l=Ya(this._instance.config.capture_performance),a=Ya(null==n?void 0:n.capturePerformance),u=!!(Re(l)?l:a);return r||o||u?{recordHeaders:r,recordBody:o,recordPerformance:u}:void 0}pn(){var t,e;const i=[],n=null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;n&&this.fn&&i.push(n());const r=null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordNetworkPlugin;if(this.vn&&ke(r))if(!Vs.includes(s.hostname)||this._forceAllowLocalhostNetworkCapture){const t=ke(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(r(((t,e,i)=>{const n={payloadSizeLimitBytes:Wr.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Wr.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...Wr.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=Ur(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=Kr(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=Kr(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=Zs(t.name);let r=0===e.indexOf("http")?null===(n=Zs(e))||void 0===n?void 0:n.pathname:e;"/"===r&&(r="");const o=null==s?void 0:s.pathname.replace(r||"","");return s&&o&&Jr.some(t=>0===o.indexOf(t))?void 0:t})((Qr((n=e).requestHeaders),Qr(n.responseHeaders),n),t.api_host,i));var n},u=ke(t.session_recording.maskNetworkRequestFn);return u&&ke(t.session_recording.maskCapturedNetworkRequestFn)&&Rs.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),u&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{const i=t.session_recording.maskNetworkRequestFn({url:e.name});return!i&&e.isInitial?i:le(le({},e),{},{name:null==i?void 0:i.url})}),n.maskRequestFn=ke(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 Me(o)&&r?(Xr.add(r),r):null!=o?o:void 0}:t=>function(t){if(!Ce(t))return t.requestBody=Yr(t.requestBody,"Request"),t.responseBody=Yr(t.responseBody,"Response"),t}(a(t)),le(le(le({},Wr),n),{},{recordHeaders:s,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.vn,t)))}else Xa.info("NetworkCapture not started because we are on localhost.");return i}mn(t){return this._instance.config.disable_capture_url_hashes?sn(t):t}gn(t,e=!1){const i=e?sn(t):this.mn(t),n=this._instance.config.mask_personal_data_properties?[...da,...this._instance.config.custom_personal_data_properties||[]]:[];return this.yn(Ks(i,n,fa))}yn(t){const e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var i;const n=e.maskCapturedNetworkRequestFn({name:t});return null!==(i=null==n?void 0:n.name)&&void 0!==i?i:null==n?void 0:n.url}if(e.maskNetworkRequestFn){const i=e.maskNetworkRequestFn({url:t});return null==i?void 0:i.url}return t}bn(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.ce.length?this.ce.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):Xa.warn("could not emit queued rrweb event.",e,t),!1}}Vt(t,e){return this.bn(eu(()=>nu().addCustomEvent(t,e)))}wn(){var t;return this.ae&&!0===(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)&&!this.Y.urlBlocked&&!0!==this.de}kn(t){if(!this.wn())return!1;try{const e=nu();return!!e&&(e.addCustomEvent("$json_ld",t),this.wn())}catch(t){return!1}}_n(t=!1){Promise.resolve().then(()=>{var e;return null===(e=this.Sn)||void 0===e?void 0:e.scan(t)})}xn(){try{if(this._instance.config.capture_pageview||!t)return;const e=new URL(t.location.href),i=this.gn(e.origin+e.pathname+e.search);this.Cn!==i&&(this.Cn=i,this.Vt("$url_changed",{href:i}))}catch(t){}}Mn(){if(this.ce.length){const t=[...this.ce];this.ce=[],t.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this.bn(t)})}}jt(){return this.bn(eu(()=>nu().takeFullSnapshot()))}get In(){var t,e,i;if((null===(t=this.re)||void 0===t?void 0:t.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var n;const t=null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.trigger_pending_buffer_interval_millis;return Ee(t)&&Number.isFinite(t)&&t>=1e3&&36e5>=t?t:6e4}return null!==(e=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.full_snapshot_interval_millis)&&void 0!==e?e:3e5}Tn(){if(this.Rn&&clearInterval(this.Rn),!0===this.de)return;const t=this.In;t&&(this.Rn=setInterval(()=>{this.jt()},t))}Bt(t){"event"===t&&this.$n(),!this.Y.urlBlocked&&["sampled","active"].includes(this.status)&&this.Tn()}En(){var t;this.Y.urlBlocked||(this.Y.urlBlocked=!0,null===(t=this.Sn)||void 0===t||t.scan(),clearInterval(this.Rn),Xa.info("recording paused due to URL blocker"),this.Vt("recording paused",{reason:"url blocker"}))}An(){var t;this.Y.urlBlocked&&(null===(t=this.Sn)||void 0===t||t.scan(),this.Y.urlBlocked=!1,this.jt(),this._n(),this.Tn(),this.Vt("recording resumed",{reason:"left blocked url"}),Xa.info("recording resumed"))}On(t,e){var i;if("event"===t&&this.$n(),!this.ue&&(null===(i=this.re)||void 0===i?void 0:i.hasPendingTriggers(this.sessionId))){this.ue=!0;try{var n,s;const i="url"===t?z:U;null===(n=this._instance.persistence)||void 0===n||n.register({[i]:this.sessionId}),null===(s=this.re)||void 0===s||s.updateActiveTriggers(this.sessionId),this.Bt(),this.tn(),this.qt(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.ue=!1}}}get isStarted(){return!!this.se}get ne(){const t=this._instance.get_property(A);if(!t)return;let e;try{e=Se(t)?t:JSON.parse(t)}catch(t){return void Xa.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.We){var i;const s=null!==(i=e.cache_timestamp)&&void 0!==i?i:Date.now();var n;if(Date.now()-s>36e5)return Xa.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:s,persistedConfig:t}),void(null===(n=this._instance.persistence)||void 0===n||n.unregister("$session_recording_remote_config"))}return e}Ln(t,e,i){this._instance.get_property(t)&&(e(),i())}start(e){var i,s;const r=this.ne;if(!r)return void Xa.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const t=!1!==this.de&&!this.be;this.Xe(t?"no_interaction_since_recording_started":void 0),this.be=!1,this.ge=t,this.ye=!1}this.Pe&&(this.Pn(),this.en());const{sessionId:o,windowId:l,sessionStartTimestamp:a}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=o,this.Be=l,this._sessionStartTimestamp=a,this.Dn(),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),(null==r?void 0:r.endpoint)&&(this.oe=null==r?void 0:r.endpoint),this.re=2===(null==r?void 0:r.version)&&(null==r?void 0:r.triggerGroups)&&r.triggerGroups.length>0?new ca(this._instance,this.Y,this.qt.bind(this),this.Vt.bind(this),this.Bt.bind(this)):new ha(this._instance,this.Y,this.tt,this.et,this.qt.bind(this),this.jt.bind(this),this.Bt.bind(this)),this.re.onRemoteConfig(r),null===(s=this.Wt)||void 0===s||s.call(this),this.Wt=this.re.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(t,e)=>this.On(t,e)),this.Ln(D,()=>{this.overrideSampling()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(D)}),this.Ln(L,()=>{this.overrideLinkedFlag()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(L)}),this.Ln(q,()=>{this.overrideTrigger("event")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(q)}),this.Ln(N,()=>{this.overrideTrigger("url")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(N)}),this.re.makeSamplingDecisions(this.sessionId),this.Fn(),this.we||(Us(t,"beforeunload",this.Je),Us(t,"pagehide",this.nn),Us(t,"offline",this.rn),Us(t,"online",this.sn),Us(n,"visibilitychange",this.an),!this.Fe&&ke(this.Yt.onSessionId)&&(this.Fe=this.Yt.onSessionId(this.je)),!this.Ne&&ke(this.Yt.on)?this.Ne=this.Yt.on("forcedIdleReset",()=>{this.Ue(),this.de="unknown",this.stop(),this.qe=this.Yt.onSessionId((t,e,i)=>{var n;null===(n=this.qe)||void 0===n||n.call(this),this.qe=void 0,this.je(t,e,i)})}):ke(this.Yt.on)||Xa.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Me(this.De)&&(this.De=this._instance.on("eventCaptured",t=>{try{if("$pageview"===t.event){const e=(null==t?void 0:t.properties.$current_url)?this.gn(t.properties.$current_url):"";if(!e)return;this.Vt("$pageview",{href:e})}}catch(t){Xa.error("Could not add $pageview to rrweb session",t)}})),"active"===this.status&&this.qt(e||"recording_initialized"))}Nn(){var e,i,s,r,o,l;null==t||t.removeEventListener("beforeunload",this.Je),null==t||t.removeEventListener("pagehide",this.nn),null==t||t.removeEventListener("offline",this.rn),null==t||t.removeEventListener("online",this.sn),null==n||n.removeEventListener("visibilitychange",this.an),clearInterval(this.Rn),this.qn(),null===(e=this.De)||void 0===e||e.call(this),this.De=void 0,null===(i=this.Wt)||void 0===i||i.call(this),this.Wt=void 0,null===(s=this.Fe)||void 0===s||s.call(this),this.Fe=void 0,null===(r=this.Ne)||void 0===r||r.call(this),this.Ne=void 0,null===(o=this.qe)||void 0===o||o.call(this),this.qe=void 0,null===(l=this.re)||void 0===l||l.stop(),this.jn(),this.Pn()}Pn(){this.Le+=1,this.Ae=[],this.Oe=0,this.Bn=void 0,this.Pe=!1}jn(){var t,e;null===(t=this.Hn)||void 0===t||t.stop(),this.ce=[],null===(e=this.Sn)||void 0===e||e.stop(),this.Sn=void 0,this.ae=!1;try{var i;null===(i=this.se)||void 0===i||i.call(this)}catch(t){Xa.warn("could not stop rrweb",t)}this.se=void 0}Un(){if(!this.Bn||0===this.Oe)return!1;if(this.Pe)return!0;this.Pe=!0,this.zn=void 0;const t=this.Le;return this.qn(),this.jn(),this.Bn.catch(()=>{}).then(()=>{t===this.Le&&(this.Pe=!1,this.tn(),this.en(),this.Wn(),this.Nn(),Xa.info("stopped"))}).catch(()=>{this.Pe=!1,this.Wn(),this.Nn(),Xa.info("stopped")}),!0}stop(){if(this.jn(),this.We)this.Ye();else if(this.Un())return;this.tn(),this.en(),this.Wn(),this.Nn(),Xa.info("stopped")}Wn(){this.Xe(void 0,{preserveLogDedup:this.We}),this.ge=!1}flushBeforeIdentityReset(){(this.isStarted||this.Pe)&&(this.Ye(),this.tn())}ze(t){this.We=!0,this.le=Date.now();try{var e,i;this.stop(),this.Vn=void 0,this.Zn=void 0,this.fe=0,this.ve=0,this.pe=0,null===(e=iu())||void 0===e||null===(i=e.resetSnapshotCostState)||void 0===i||i.call(e),this.start("session_id_changed")}finally{this.We=!1}this.Xe(t?"no_interaction_since_session_rotated":void 0),this.ge=!1}Xe(t,{preserveLogDedup:e=!1}={}){if(this.me=!Ce(t),this.zn=t,Ce(t))return void(e||(this.Gn=void 0));if(this.We)return;const i=`${this.sessionId}:${t}`;i!==this.Gn&&(this.Gn=i,Xa.info(`holding buffer: ${t}. nothing is uploaded until the user interacts with the page`))}$n(){this.isStarted||(this.be=!0),this.me&&(this.Xe(void 0),this.ge=!1,this.ye&&(this.ye=!1,this.jt()),this.Qn())}discard({discardProducerEvents:t=!1}={}){this.me=!0,t&&(this.en(),this.jn()),this.en(),this.Nn(),this.en(),this.Wn(),Xa.info("discarded")}Jn(t,e,i,n,s){const r={$snapshot_bytes:i,$snapshot_data:e,$session_id:n,$window_id:s};"disabled"!==this.status?(this.Kn(t,n),this.Xn(r)):this.en()}Yn(){try{this.ti()}catch(t){this.Se||(this.Se=!0,Xa.error("could not track full snapshot cost",t))}}ti(){var t,e;const i=null===(t=iu())||void 0===t||null===(e=t.getLastSnapshotCost)||void 0===e?void 0:e.call(t);i&&i!==this.Zn&&(this.Zn=i,this.Vn&&this.Vn.durationMs>=i.durationMs||(this.Vn=i),500>i.durationMs||Xa.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(i.durationMs),stylesheetMs:Math.round(i.stylesheetMs),nodeCount:i.nodeCount,cssRuleCount:i.cssRuleCount,nonDeferrableCssRuleCount:i.nonDeferrableCssRuleCount,deferredStylesheetCount:i.deferredStylesheetCount}))}Kn(t,e){2!==t.type?3===t.type&&(Ce(this.Re)||this.Re===e||this.$e===e||(this.$e=e,Xa.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.jt())):this.Re=e}ei(t){t.counted&&t.generation===this.Le&&(this.Oe=Math.max(0,this.Oe-1)),t.counted=!1,this.Ae=this.Ae.filter(e=>e!==t)}ni(t,e,i){t.processed||t.generation!==this.Le||(t.processed=!0,this.Jn(t.event,e,i,t.targetSessionId,t.targetWindowId))}ii(t){try{let e=t.event,i=$o(t.event);if(t.compressionEnabled)try{({event:e,size:i}=bu(t.event))}catch(t){Xa.error("could not process queued compression event - will use uncompressed event",t)}try{this.ni(t,e,i)}catch(t){Xa.error("could not capture queued compression event",t)}}finally{this.ei(t)}}Ye(){[...this.Ae].forEach(t=>{this.ii(t)})}ri(t,e,i,n){var s=this;const r={event:t,compressionEnabled:e,targetSessionId:i,targetWindowId:n,generation:this.Le,processed:!1,counted:!0};this.Ae.push(r),this.Oe+=1;const o=(l=ne(function*(){try{if(r.processed)return;let i,n;try{const s=e?pu(t)?yield function(t){return _u.apply(this,arguments)}(t):bu(t):{event:t,size:$o(t)};i=s.event,n=s.size}catch(e){Xa.error("could not process queued compression event - will use uncompressed event",e),i=t,n=$o(t)}s.ni(r,i,n)}finally{s.ei(r)}}),function(){return l.apply(this,arguments)});var l;this.Bn=this.Bn?this.Bn.catch(()=>{}).then(o):o()}onRRwebEmit(e){var i,n,s,r,o,l,a,u,h,c,d,v,f;if(!this._instance.sessionManager)return;if(this.Mn(),!e||!Se(e))return;if(4===e.type){const t=this.gn(e.data.href);if(this.Cn=t,!t)return;e.data.href=t}else this.xn();if(null===(i=this.re)||void 0===i||i.checkUrlTriggers(this.sessionId,()=>this.En(),()=>this.An(),(t,e)=>this.On(t,e)),this.Y.urlBlocked&&!function(t){return 5===t.type&&"recording paused"===t.data.tag}(e))return;2===e.type&&((null===(c=iu())||void 0===c||null===(d=c.wasMaxDepthReached)||void 0===d?void 0:d.call(c))&&(this._e=!0),this.Yn(),Promise.resolve().then(()=>this.Yn()),this.Tn(),null===(v=this.Hn)||void 0===v||v.reset(),null===(f=this._instance.persistence)||void 0===f||f.register_once({$debug_first_full_snapshot_timestamp:e.timestamp},void 0));const p=2===e.type&&(null===(n=this.re)||void 0===n?void 0:n.hasPendingTriggers(this.sessionId));p&&this.oi();const g=this.Hn?this.Hn.throttleMutations(e):e;if(!g)return void(!0===this.de&&this.he++);const m=function(t){const e=t;if(e&&Se(e)&&6===e.type&&Se(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));const i=[];for(let t=0;e.data.payload.payload.length>t;t++)i.push(e.data.payload.payload[t]&&e.data.payload.payload[t].length>2e3?e.data.payload.payload[t].slice(0,2e3)+"...[truncated]":e.data.payload.payload[t]);return e.data.payload.payload=i,t}return t}(g),y=function(t){return Su(t)?t.data.payload:null}(m),b=function(t){return xu(t)?t.data.payload:null}(m),_=function(t){return ku(t)?t.data.payload:null}(m);y||b?(null==y?void 0:y.lastActivityTimestamp)&&(m.timestamp=y.lastActivityTimestamp):(null==_?void 0:_.sessionId)||this.si(m),2===e.type&&(this.Te.push([this.Xt,e.timestamp]),this.Te.length>6&&(this.Te=this.Te.slice(-6)));const w=null!==(s=null!==(r=null!==(o=null==y?void 0:y.currentSessionId)&&void 0!==o?o:null==b?void 0:b.nextSessionId)&&void 0!==r?r:null==_?void 0:_.sessionId)&&void 0!==s?s:this.Xt,k=null!==(l=null!==(a=null!==(u=null==y?void 0:y.currentWindowId)&&void 0!==u?u:null==b?void 0:b.nextWindowId)&&void 0!==a?a:null==_?void 0:_.windowId)&&void 0!==l?l:this.Be;if(!0===this.de&&!function(t){return ku(t)||Su(t)||xu(t)}(m))return void(function(t){return 2===t.type||4===t.type||3===t.type&&9!==t.data.source}(m)&&this.he++);2===m.type&&(this.he=0),_&&(m.timestamp=_.lastActivityTimestamp+_.threshold);const S=this.ae;this.ae=!0,p?this._n(!0):S||this._n();const x=null===(h=this._instance.config.session_recording.compress_events)||void 0===h||h;if(5===m.type&&"$json_ld"===m.data.tag){let e;try{e=t?this.gn(t.location.href):void 0}catch(t){}m.data.href=e}if(this.Oe>0||x&&pu(m))return void this.ri(m,x,w,k);const{event:C,size:T}=x?bu(m):{event:m,size:$o(m)};this.Jn(m,C,T,w,k)}get status(){return this.re?this.re.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.ee,rrwebError:this.we,urlTriggerMatching:this.Y,eventTriggerMatching:this.tt,linkedFlagMatching:this.et,remoteConfig:this.ne}):to}log(t,e="log"){var i;null===(i=this._instance.sessionRecording)||void 0===i||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.et.linkedFlagSeen=!0,this.jt(),this.$n(),this.qt("linked_flag_overridden")}overrideSampling(){var t;null===(t=this._instance.persistence)||void 0===t||t.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this.jt(),this.$n(),this.qt("sampling_overridden")}overrideTrigger(t){this.On(t),this.$n()}ai(){try{var e;const i=null==t||null===(e=t.location)||void 0===e?void 0:e.href;if(!i)return;const n=this.gn(i);if(!n)return;return new URL(n).hostname||void 0}catch(t){return}}qn(){this.li&&(clearTimeout(this.li),this.li=void 0)}Qn(){this.li||(this.li=setTimeout(()=>{this.tn()},2e3))}ui(){return this.Re!==this.Rt.sessionId&&0!==this.Rt.data.length&&this.Rt.data.every(t=>5===(null==t?void 0:t.type)&&!Su(t)&&!xu(t))}ci(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}di(t){if("buffering"!==t)return Ce(this.hi)||this._instance.register_for_session({[qt]:[]}),void(this.hi=void 0);const e=this.ci();if(0===e.length)return Ce(this.hi)||this._instance.register_for_session({[qt]:[]}),void(this.hi=void 0);const i=e.join(", "),n=`${this.sessionId}:${i}`;n!==this.hi&&(this.hi=n,this._instance.register_for_session({[qt]:e}),Xa.info(`buffering: ${i}`))}fi(){var t;return"memory"!==this._instance.config.persistence&&!0!==(null===(t=this._instance.persistence)||void 0===t?void 0:t.pi)&&Nl.Et()}mi(){0!==this.Rt.data.length&&this.Rt.size!==this.gi&&943718.4>=this.Rt.size&&this.fi()&&(this.gi=this.Rt.size,Nl.At(this.ln,this.Rt))}Dn(){if(this.Ee||!this.fi())return;this.Ee=!0;const t=Nl.Dt(this.ln);Nl.Lt(this.ln),Se(t)&&we(t.data)&&0!==t.data.length&&we(t.sizes)&&t.sizes.length===t.data.length&&Ee(t.size)&&t.sessionId===this.Xt&&t.windowId===this.Be&&(this.Rt.data.length>0||(this.Rt=t))}tn(t=!1){var e;if(this.qn(),this.me)return this.Rt;if(this.ui())return this.Rt.size>943718.4?this.en():(t&&this.mi(),this.Rt);const i=this.Rt;null===(e=this.re)||void 0===e||e.ensureSamplingDecision(this.sessionId);const n=this.Ge(),s=this.status;if(this.di(s),"buffering"===s||"paused"===s||"disabled"===s||n)return!t||"active"!==s&&"sampled"!==s||this.mi(),this.Qn(),this.Rt;if(this.Rt!==i)return this.Rt;if(i.data.length>0){var r;const t=this.ai();Io(i).forEach(e=>{try{var i;null===(i=this.He)||void 0===i||i.trackSize(e.sessionId,e.size),this.yi({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:ql.LIB_NAME,$lib_version:ql.LIB_VERSION,$snapshot_host:t})}catch(t){Xa.warn("could not capture snapshot chunk - skipping it",t)}}),Ce(this.gi)||(Nl.Lt(this.ln),this.gi=void 0),null===(r=this.re)||void 0===r||r.onFlushComplete()}return this.en()}Xn(t){var e;const i=2+((null===(e=this.Rt)||void 0===e?void 0:e.data.length)||0),n=t.$session_id,s=this.Rt.sessionId!==n;if(s||!0!==this.de&&!this.me&&this.Rt.size+t.$snapshot_bytes+i>943718.4){const e=this.Xt;if(this.Rt=this.tn(),this.Xt!==e)return;s&&this.Rt.data.length>0&&(this.Rt=this.en()),this.Rt.sessionId=n,this.Rt.windowId=t.$window_id}this.me&&(this.ye||this.Rt.size+t.$snapshot_bytes+i>943718.4)?this.ye||(this.ye=!0,this.Rt=this.en()):(this.Rt.size+=t.$snapshot_bytes,this.Rt.data.push(t.$snapshot_data),this.Rt.sizes.push(t.$snapshot_bytes),!0===this.de||this.me||this.Qn())}yi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.oe),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get Qe(){var t,e;const i=null===(t=this.Rt)||void 0===t?void 0:t.data[(null===(e=this.Rt)||void 0===e?void 0:e.data.length)-1];return i?i.timestamp-this._sessionStartTimestamp:null}oi(){if(!this.Rt||0===this.Rt.data.length)return this.en();let t=-1;for(let e=this.Rt.data.length-1;e>=0;e--)if(4===this.Rt.data[e].type){t=e;break}return 0>t?this.en():(this.Rt.data=this.Rt.data.slice(t),this.Rt.sizes=this.Rt.sizes.slice(t),this.Rt.size=this.Rt.sizes.reduce((t,e)=>t+e,0),this.Rt)}en(){return this.Rt={size:0,data:[],sizes:[],sessionId:this.Xt,windowId:this.Be},this.Rt}qt(t,e){this._instance.register_for_session({[Wt]:t}),Xa.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Vt("$recording_started",le({reason:t},e))}bi(t){var e;return 3===t.type&&-1!==tu.indexOf(null===(e=t.data)||void 0===e?void 0:e.source)}si(t){const e=this.bi(t);e||!0===this.de||t.timestamp-this.le>this.te&&(this.de=!0,clearInterval(this.Rn),this.Vt("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.le,threshold:this.te,bufferLength:this.Rt.data.length,bufferSize:this.Rt.size,sessionId:this.Xt,windowId:this.Be}),this.tn());const{windowId:i,sessionId:n}=this.Yt.checkAndGetSessionAndWindowId(!e,t.timestamp);let s=!1;if(e&&(this.le=t.timestamp,this.de)){const e="unknown"===this.de;this.de=!1,e||(this.Vt("sessionNoLongerIdle",{reason:"user activity",type:t.type}),s=!0)}const r=this.Xt!==n,o=this.Be!==i;if(this.Be=i,this.Xt=n,r||o){const t=r&&!1!==this.de;t&&(this.de="unknown"),this.ze(t)}else if(e&&this.$n(),s){var l;const t=["sampled","active"].includes(this.status)||(null===(l=this.re)||void 0===l?void 0:l.hasPendingTriggers(this.sessionId));this.he>0&&t&&this.jt(),this._n(),this.Tn()}}Ue(){var t;null===(t=this.re)||void 0===t||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e,i,n,s,r,o,l,a,u,h,c;const d=null===(t=iu())||void 0===t||null===(e=t.getDeferredStylesheetStats)||void 0===e?void 0:e.call(t);return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this.zn,$sdk_debug_replay_internal_buffer_length:this.Rt.data.length,$sdk_debug_replay_internal_buffer_size:this.Rt.size,$sdk_debug_current_session_duration:this.Qe,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(i=this.He)||void 0===i?void 0:i.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Te,$snapshot_max_depth_exceeded:this._e,$sdk_debug_replay_slowest_full_snapshot_ms:Ka(null===(n=this.Vn)||void 0===n?void 0:n.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:Ka(null===(s=this.Vn)||void 0===s?void 0:s.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null===(r=this.Vn)||void 0===r?void 0:r.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null===(o=this.Vn)||void 0===o?void 0:o.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null===(l=this.Vn)||void 0===l?void 0:l.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==d?void 0:d.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==d?void 0:d.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==d?void 0:d.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:Ka(null==d?void 0:d.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:Ka(null==d?void 0:d.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:Ka(null===(a=iu())||void 0===a||null===(u=a.getMutationCost)||void 0===u||null===(u=u.call(a))||void 0===u?void 0:u.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null===(h=iu())||void 0===h||null===(c=h.getDiscardedDurationSamples)||void 0===c?void 0:c.call(h),$sdk_debug_replay_throttled_mutations_dropped:this.fe,$sdk_debug_replay_oversized_mutations_dropped:this.ve,$sdk_debug_replay_oversized_mutation_bytes_dropped:this.pe,$sdk_debug_replay_rrweb_error:this.we,[zt]:!!this.se,[Ut]:this.ke}}Fn(){var e;if(this.se)return;this.ke=!0;const i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},s=this._instance.config.session_recording;for(const[t,e]of Object.entries(s||{}))if(t in i)if("maskInputOptions"===t)i.maskInputOptions=le({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=le(le({},i.slimDOMOptions),{},{script:!0})),this.hn&&this.hn.enabled&&(i.recordCanvas=!0,i.sampling=le(le({},i.sampling),{},{canvas:this.hn.fps}),i.dataURLOptions={type:"image/webp",quality:this.hn.quality},i.canvasResolutionScale=this.dn,i.canvasMasking={configured:()=>{var t;return ke(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(ke(i))try{var n;return null!==(n=i(t))&&void 0!==n?n:null}catch(t){return this.Me||(this.Me=!0,Xa.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.un&&(i.maskAllInputs=null===(r=this.un.maskAllInputs)||void 0===r||r,i.maskTextSelector=null!==(o=this.un.maskTextSelector)&&void 0!==o?o:void 0,i.blockSelector=null!==(l=this.un.blockSelector)&&void 0!==l?l:void 0,i.maskAllElementAttributes=null!==(a=this.un.maskAllElementAttributes)&&void 0!==a&&a),i.maskAllElementAttributes&&i.maskAttributeFn&&(i.maskAttributeFn=void 0,this.Ce||(this.Ce=!0,Xa.warn('`maskAllElementAttributes` and `maskAttributeFn` are mutually exclusive, and `maskAttributeFn` is being ignored. Remove one of the two. Note that `maskAllElementAttributes` can also come from your project\'s "Privacy and masking" settings. See https://posthog.com/docs/session-replay/privacy'))),this.cn();const u=nu();if(!u)return void Xa.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this.Hn=null!==(e=this.Hn)&&void 0!==e?e:new hl(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`;Xa.info(i,{node:e}),this.log("[SessionRecording] "+i,"warn")},onDroppedAttributeMutations:t=>this.fe+=t,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this.In,onDroppedOversizedMutation:t=>{0===this.ve&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this.ve+=1,this.pe+=t},requestFullSnapshot:()=>this.jt()});const h=this.pn();if(this.se=u(le({emit:t=>{this.onRRwebEmit(t)},plugins:h,errorHandler:(t,e)=>"rrweb"===e&&(this.Ie||(this.Ie=!0,Xa.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},i)),!this.se)return this.we=!0,void Xa.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.we=!1,!0===(null==s?void 0:s.captureJsonLd)&&n&&(null==t?void 0:t.MutationObserver)&&!this.Sn&&(this.Sn=function(t,e,i){const n=new WeakMap,s=i.getCaptureState||(()=>!0);let r=Ta;const o=function(t,e){const i=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?Ea:i=>{const n=t.getElementById(i);return!!n&&"SCRIPT"!==n.nodeName&&(!e.isRecordedElement||e.isRecordedElement(n))&&!Qa(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 Qa(t,e.blockClass,e.blockSelector)||Qa(t,e.maskTextClass,e.maskTextSelector)}(e,i))return;const a=function(t,e=Ea,i){if(!t||t.length>Ta)return null;try{const n=JSON.parse(t),s={maskUrl:i,remainingNodes:2048,exceeded:!1},r=we(n)?n.map(t=>Va(t,e,s)):Va(n,e,s);if(s.exceeded||Ie(r)||we(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,h]=a;if(Ie(l))return void n.set(e,h);if(n.get(e)!==h){if(h.length>r)return void(r=0);i.emit(u)&&(n.set(e,h),r-=h.length)}}catch(t){return}};try{const i=new e(t=>{try{if(!r||!1===s())return;const e=t=>{for(const e of Ja(t))l(e)};for(const i of t)if("childList"===i.type)Ga(i.target)&&l(i.target),i.addedNodes.forEach(e);else if("characterData"===i.type){const t=i.target.parentNode;t&&Ga(t)&&l(t)}else"attributes"===i.type&&Ga(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()&&Ja(t.documentElement).forEach(t=>{e&&n.delete(t),l(t)})},stop(){return i.disconnect()}}}catch(t){return{scan(){},stop(){}}}}(n,t.MutationObserver,{maskUrl:t=>this.gn(t),attributeFilter:i.attributeFilter,blockClass:i.blockClass,blockSelector:i.blockSelector,isRecordedElement:t=>u.mirror.getId(t)>0,maskAllElementAttributes:i.maskAllElementAttributes,maskAttributeFn:i.maskAttributeFn,maskTextClass:i.maskTextClass,maskTextSelector:i.maskTextSelector,getCaptureState:()=>{var t;return!0!==(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)||this.Y.urlBlocked||this.Y.isCurrentUrlBlocked()?null:this.wn()},emit:t=>this.kn(t)}),this.Y.isCurrentUrlBlocked()&&this.Sn.scan()),this.le=Date.now(),this.de=Re(this.de)?this.de:"unknown",this.tryAddCustomEvent("$remote_config_received",this.ne),this.Vt("$session_options",{sessionRecordingOptions:i,activePlugins:h.map(t=>null==t?void 0:t.name)}),this.Vt("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(t,e){return this.Vt(t,e)}};const $u=["type"];var Tu=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}({}),Iu=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}({}),Mu=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}({}),Eu=function(t){return t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t}({}),Pu=function(t){return t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t}({}),Ru=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}({}),Au=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 Fu(t,e){return-1!==t.indexOf(e)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date;var Ou={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Du={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Lu={};function Nu(t){if(Lu[t])return Lu[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 Ou?Ou[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 Du?Du[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 Lu[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 Fu(t,"AppleWebKit")&&!Fu(t,"Chrome")}(navigator.userAgent)&&(l.classList.add("rr-block","ph-no-capture"),l.setAttribute("__rrwebUntaintedPrototype",t),a=!0),Lu[t]=s):i}catch(t){return i}finally{!a&&l.parentNode&&document.body.removeChild(l)}}var qu=Object.create(null);function ju(t,e,i){var n;const s=qu[t],r=s[i];if(r)return r.call(e);const o=Nu(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]}qu.Node=Object.create(null),qu.ShadowRoot=Object.create(null),qu.MutationObserver=Object.create(null),qu.Element=Object.create(null);var Bu,Hu={};function zu(t,e,i){const n=`${t}.${String(i)}`;if(Hu[n])return Hu[n].bind(e);const s=Nu(t)[i];return"function"!=typeof s?e[i]:(Hu[n]=s,s.bind(e))}function Uu(){return Nu("MutationObserver").constructor}function Wu(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 Vu={childNodes:t=>ju("Node",t,"childNodes"),parentNode:t=>ju("Node",t,"parentNode"),parentElement:t=>ju("Node",t,"parentElement"),textContent:t=>ju("Node",t,"textContent"),isConnected(t){if(void 0===Bu){var e;const t=null===(e=Object.getOwnPropertyDescriptor(Nu("Node"),"isConnected"))||void 0===e?void 0:e.get;Bu=(null==t?void 0:t.toString().includes("[native code]"))?t:null}return null==Bu?void 0:Bu.call(t)},contains:(t,e)=>zu("Node",t,"contains")(e),getRootNode:t=>zu("Node",t,"getRootNode")(),host:t=>t&&"host"in t?ju("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?ju("Element",t,"shadowRoot"):null,querySelector:(t,e)=>zu("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>zu("Element",t,"querySelectorAll")(e),mutationObserver:Uu,patch:Wu};function Gu(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var Zu=0;function Qu(){Zu+=1}function Ju(){return Zu}function Ku(t,e){return(e!==Zu||t>6e4)&&!0}var Yu=0,Xu=0,th=0,eh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},ih=null,nh=null,sh=[],rh=0,oh=0,lh={slowestBatchMs:0},ah={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function uh(t){(Yu+=1)>1||(eh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},sh=[],rh=0,nh=(t=>t&&t>0?t:null)(t),Xu=Gu(),th=Zu)}function hh(){return 0===Yu?ih||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(Yu-=1)>0?eh:(eh.durationMs=Gu()-Xu,eh.deferredStylesheetCount=rh,ah.deferredCount+=rh,nh=null,Ku(eh.durationMs,th)?eh:ih=eh)}function ch(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+=ch(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+=ch(s,e,i+1))}}}catch(t){}}return n}function dh(t){if(0===Yu)return;const e=ch(t,null,0);eh.cssRuleCount+=e,oh>0&&(eh.nonDeferrableCssRuleCount+=e)}function vh(t){oh+=1;try{return t()}finally{oh-=1}}function fh(t){Yu>0&&(eh.stylesheetMs+=t)}function ph(t){if(0===Yu||null===nh)return!1;const e=eh.cssRuleCount-eh.nonDeferrableCssRuleCount;return e>=nh||e+function(t){try{const e=t&&(t.rules||t.cssRules);if(!e)return 0;const i=new WeakSet;return i.add(t),ch(e,i,0)}catch(t){return 0}}(t)>nh}function gh(){const t=sh;return sh=[],t}function mh(){ah.failedCount+=1}function yh(t){t>0&&(ah.abandonedCount+=t)}function bh(t){return bh="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},bh(t)}function _h(t,e,i){return(e=function(t){var e=function(t){if("object"!=bh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=bh(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==bh(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function wh(t){return t.nodeType===t.ELEMENT_NODE}function kh(t){const e=t&&"host"in t&&"mode"in t&&Vu.host(t)||null;return Boolean(e&&"shadowRoot"in e&&Vu.shadowRoot(e)===t)}function Sh(t){return"[object ShadowRoot]"==={}.toString.call(t)}function xh(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 Ch(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 $h=0;function Th(t){const e=0===$h,i=e?Gu():0;$h+=1;try{const e=t.rules||t.cssRules;if(!e)return null;dh(e);let i=t.href;return!i&&t.ownerNode&&(i=t.ownerNode.baseURI),xh(Array.from(e,t=>Ih(t,i)).join(""))}catch(t){return null}finally{$h-=1,e&&fh(Gu()-i)}}function Ih(t,e){if(Eh(t)){let e;try{e=Th(t.styleSheet)||Ch(t)}catch(i){e=t.cssText}try{var i;if(e&&(null===(i=t.styleSheet)||void 0===i?void 0:i.href))return Vh(e,t.styleSheet.href)}catch(t){}return e}{let i=t.cssText;return Ph(t)&&t.selectorText.includes(":")&&(i=Mh(i)),e?Vh(i,e):i}}function Mh(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function Eh(t){return"styleSheet"in t}function Ph(t){return"selectorText"in t}var Rh=/^-?[A-Za-z_][\w-]*$/,Ah=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Fh(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||Ch(e)}catch(t){s=e.cssText}try{var n;s&&(null===(n=e.styleSheet)||void 0===n?void 0:n.href)&&(s=Vh(s,e.styleSheet.href))}catch(t){}s&&t.parts.push(s),t.index+=1}catch(t){r(null)}}function l(t){const i=t.rules[t.index];if("sheet"===t.kind&&Eh(i)){const n=s.get(i);return null===n?(t.parts.push(i.cssText),void(t.index+=1)):n?void e.push({kind:"sheet",sheet:n.sheet,rules:n.rules,sheetHref:n.sheetHref,index:0,parts:[],importRule:i}):void o(t,i,null)}if(function(t,i){try{const n=function(t){const e=t;if(!e.cssRules||0===e.cssRules.length)return null;if(e.media&&"string"==typeof e.media.mediaText)return`@media ${e.media.mediaText} {`;if(Ph(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&&!Rh.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]?Rh.test(e.name)?`@keyframes ${e.name} {`:null:""===e.name?"@layer {":Ah.test(e.name)?`@layer ${e.name} {`:null:null}(t);if(null===n)return!1;const s=i.sheetHref;return e.push({kind:"group",rules:Array.from(t.cssRules),sheetHref:s,index:0,parts:[],prelude:s?Vh(n,s):n,fixColons:"sheet"===i.kind&&Ph(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(i,t))return;let n=i.cssText;"sheet"===t.kind&&Ph(i)&&i.selectorText.includes(":")&&(n=Mh(n)),t.parts.push(t.sheetHref?Vh(n,t.sheetHref):n),t.index+=1}return function(t){try{const i=t.rules||t.cssRules;if(!i)return!1;dh(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,!Eh(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;dh(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=Gu();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?Mh(i):i}else e=xh(t.parts.join(""))}catch(t){}r(e);continue}o-=1;try{l(t)}catch(t){r(null)}}}catch(t){i=!0,n=null}finally{fh(Gu()-s)}return i},text:()=>i?n:null,remainingRules(){if(i)return 0;let t=0;for(const i of e)t+=i.rules.length-i.index;return t}}}var Oh=class{constructor(){_h(this,"idNodeMap",new Map),_h(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)),wh(t)){const e=Vu.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 Dh({element:t,maskInputOptions:e,tagName:i,type:n,value:s,maskInputFn:r}){let o=s||"";const l=n&&Lh(n);return(e[i.toLowerCase()]||l&&e[l])&&(o=r?r(o,t):"*".repeat(o.length)),o}function Lh(t){return t.toLowerCase()}var Nh=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 qh({element:t,name:e,value:i,maskAllElementAttributes:n,maskAttributeFn:s,isGenerated:r=!1}){return i?n?r&&Nh.has(Lh(e))?i:"*".repeat(i.length):s?s(e,i,t):i:i}var jh="__rrweb_original__";function Bh(t){try{const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?Lh(e):null}catch(t){return null}}var Hh=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,zh=/^(?:[a-z+]+:)?\/\//i,Uh=/^www\..*/i,Wh=/^(data:)([^,]*),(.*)/i;function Vh(t,e){return(t||"").replace(Hh,(t,i,n,s,r,o)=>{const l=n||r||o,a=i||s||"";if(!l)return t;if(zh.test(l)||Uh.test(l))return`url(${a}${l}${a})`;if(Wh.test(l))return`url(${a}${l}${a})`;if("/"===l[0])return`url(${a}${function(t){let e="";return e=t.indexOf("//")>-1?t.split("/").slice(0,3).join("/"):t.split("/")[0],e=e.split("?")[0],e}(e)+l}${a})`;const u=e.split("/"),h=l.split("/");u.pop();for(const t of h)"."!==t&&(".."===t?u.pop():u.push(t));return`url(${a}${u.join("/")}${a})`})}var Gh,Zh,Qh=new Map,Jh=1,Kh=new RegExp("[^a-z0-9-_:]");function Yh(){return Jh++}var Xh=/^[^ \t\n\r\u000c]+/,tc=/^[, \t\n\r\u000c]+/,ec=new WeakMap;function ic(t,e){return e&&""!==e.trim()?nc(t,e):e}function nc(t,e){let i=ec.get(t);if(i||(i=t.createElement("a"),ec.set(t,i)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return i.setAttribute("href",e),i.href}function sc(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 rc(t,e,i,n,s,r){if(!n)return n;if("src"===i||"href"===i&&("use"!==e||"#"!==n[0])){if("link"===e&&s){var o;const t=null===(o=s.sheet)||void 0===o?void 0:o.href;if(t)return t}const i=ic(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=Qh.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(Qh.size>=10){const t=Qh.keys().next().value;void 0!==t&&Qh.delete(t)}return Qh.set(e,{type:i,quality:n,result:l}),l}catch(t){return e}}(s,i,r.type,r.quality)),sc(t,r)}if("image"===e)return sc(i,r)}return i}if("xlink:href"===i&&"#"!==n[0]){const i=ic(t,n);return"image"===e&&i.startsWith("data:")?sc(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(tc),e.length>i;){let r=n(Xh);if(","===r.slice(-1))r=ic(t,r.substring(0,r.length-1)),s.push(r);else{let n="";r=ic(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?Vh(n,nc(t)):"object"===e&&"data"===i?ic(t,n):n:ic(t,n)}function oc(t,e,i){return("video"===t||"audio"===t)&&"autoplay"===e}function lc(t,e,i){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!i&&lc(Vu.parentNode(t),e,i);for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!i&&lc(Vu.parentNode(t),e,i)}function ac(t,e,i,n){let s;if(wh(t)){if(s=t,!Vu.childNodes(s).length)return!1}else{if(null===Vu.parentElement(t))return!1;s=Vu.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(lc(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 uc(t,e,i){const n=t.removeEventListener;"function"==typeof n&&n.call(t,e,i)}var hc=new Map;function cc(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function dc(t){return null==t?"":t.toLowerCase()}var vc=!1,fc=!1;function pc(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,maskTextClass:o,maskTextSelector:l,skipChild:a=!1,inlineStylesheet:u=!0,maskInputOptions:h={},maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v=!1,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g={},inlineImages:m=!1,recordCanvas:y=!1,canvasMaskingConfigured:b,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k=5e3,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:T=()=>!1,newlyAddedElement:I=!1,depth:M=0,maxDepth:E=50}=e;let{needsMask:P}=e,{preserveWhiteSpace:R=!0}=e;if(M>=E)return fc=!0,vc||(vc=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${E}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;P||(P=ac(t,o,l,void 0===P)),Yu>0&&(eh.nodeCount+=1);const A=function(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:o,inlineStylesheet:l,maskInputOptions:a={},maskTextFn:u,maskInputFn:h,maskAllElementAttributes:c=!1,maskAttributeFn:d,dataURLOptions:v={},inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y=!1}=e,b=function(t,e){if(!e.hasNode(t))return;const i=e.getId(t);return 1===i?void 0:i}(i,n);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:Au.Document,childNodes:[],compatMode:t.compatMode}:{type:Au.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:Au.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:b};case t.ELEMENT_NODE:return function(t,e){const{doc:i,blockClass:n,blockSelector:s,inlineStylesheet:r,maskInputOptions:o={},maskInputFn:l,maskAllElementAttributes:a=!1,maskAttributeFn:u,dataURLOptions:h={},inlineImages:c,recordCanvas:d,canvasMaskingConfigured:v,keepIframeSrcFn:f,newlyAddedElement:p=!1,rootId:g}=e,m=function(t,e,i){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(i)return t.matches(i)}catch(t){}return!1}(t,n,s),y=function(t){if(t instanceof HTMLFormElement)return"form";const e=Lh(t.tagName);return Kh.test(e)?"div":e}(t),b=new Set;let _={};const w=t.attributes.length;for(let e=0;w>e;e++){const n=t.attributes[e];oc(y,n.name)||(_[n.name]=rc(i,y,Lh(n.name),n.value,t,h))}if("link"===y&&r&&!m){let e=t.sheet;if(!e){const n=function(t){return t.href}(t);n&&(e=cc(i,n),!e&&n.includes(".css"))&&(e=cc(i,window.location.origin+"/"+n.replace(window.location.href,"")))}let n=null;e&&(ph(e)?Yu>0&&(sh.push(t),rh+=1):n=Th(e)),n&&(delete _.rel,delete _.href,_._cssText=n)}if("style"===y&&t.sheet&&!(t.innerText||Vu.textContent(t)||"").trim().length){const e=vh(()=>Th(t.sheet));e&&(_._cssText=e)}if("input"===y||"textarea"===y||"select"===y){const e=t.value,i=t.checked;"radio"!==_.type&&"checkbox"!==_.type&&"submit"!==_.type&&"button"!==_.type&&e?_.value=Dh({element:t,type:Bh(t),tagName:y,value:e,maskInputOptions:o,maskInputFn:l}):i&&(_.checked=i)}if("option"===y&&(t.selected&&!o.select?_.selected=!0:delete _.selected),"dialog"===y&&t.open){try{_.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){_.rr_open_mode="modal",_.ph_rr_could_not_detect_modal=!0}b.add("rr_open_mode")}if("canvas"===y&&d&&!(null==v?void 0:v()))if("2d"===t.__context)(function(t){const e=t.getContext("2d");if(!e)return!0;for(let i=0;t.width>i;i+=50)for(let n=0;t.height>n;n+=50){const s=e.getImageData;if(new Uint32Array((jh in s?s[jh]:s).call(e,i,n,Math.min(50,t.width-i),Math.min(50,t.height-n)).data.buffer).some(t=>0!==t))return!1}return!0})(t)||(_.rr_dataURL=t.toDataURL(h.type,h.quality));else if(!("__context"in t)){const e=t.toDataURL(h.type,h.quality),n=i.createElement("canvas");n.width=t.width,n.height=t.height,e!==n.toDataURL(h.type,h.quality)&&(_.rr_dataURL=e)}let k,S=!1;if("img"===y&&c){Gh||(Gh=i.createElement("canvas"),Zh=Gh.getContext("2d"));const e=t,n=e.currentSrc||e.getAttribute("src")||"<unknown-src>",s=e.crossOrigin,r=(e,i)=>S?qh({element:t,name:e,value:i,maskAllElementAttributes:a,maskAttributeFn:u}):i,o=()=>{uc(e,"load",o);try{Gh.width=e.naturalWidth,Gh.height=e.naturalHeight,Zh.drawImage(e,0,0);const t=Gh.toDataURL(h.type,h.quality);_.rr_dataURL=r("rr_dataURL",t)}catch(t){if("anonymous"!==e.crossOrigin)return e.crossOrigin="anonymous",void(e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o));console.warn(`Cannot inline img src=${n}! Error: ${t}`)}"anonymous"===e.crossOrigin&&(s?_.crossOrigin=r("crossOrigin",s):e.removeAttribute("crossorigin"))};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if("audio"===y||"video"===y){const e=_;e.rr_mediaState=t.paused?"paused":"played",b.add("rr_mediaState"),e.rr_mediaCurrentTime=t.currentTime,e.rr_mediaPlaybackRate=t.playbackRate,e.rr_mediaMuted=t.muted,e.rr_mediaLoop=t.loop,e.rr_mediaVolume=t.volume}if(p||(t.scrollLeft&&(_.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(_.rr_scrollTop=t.scrollTop)),m){var x,C,T;const{width:e,height:n,left:s,top:r}=t.getBoundingClientRect(),o=null===(x=i.defaultView)||void 0===x?void 0:x.getComputedStyle(t);_={class:_.class,rr_width:`${e}px`,rr_height:`${n}px`,rr_left:`${Math.floor(s+((null===(C=i.defaultView)||void 0===C?void 0:C.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(T=i.defaultView)||void 0===T?void 0:T.scrollY)||0))}px`},b.add("rr_width"),b.add("rr_height"),b.add("rr_left"),b.add("rr_top"),o&&(_.rr_position=o.position||"static",b.add("rr_position"),o.transform&&"none"!==o.transform&&(_.rr_transform=o.transform,b.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(_.rr_display=o.display,b.add("rr_display")))}if("iframe"!==y||f(_.src)||(t.contentDocument||(_.rr_src=_.src),delete _.src),a||u)for(const[e,i]of Object.entries(_))"string"!=typeof i&&null!==i||(_[e]=qh({element:t,name:e,value:i,maskAllElementAttributes:a,maskAttributeFn:u,isGenerated:b.has(e)}));S=!0;try{customElements.get(y)&&(k=!0)}catch(t){}return{type:Au.Element,tagName:y,attributes:_,childNodes:[],isSVG:(I=t,Boolean("svg"===I.tagName||I.ownerSVGElement)||void 0),needBlock:m,rootId:g,isCustom:k};var I}(t,{doc:i,blockClass:s,blockSelector:r,inlineStylesheet:l,maskInputOptions:a,maskInputFn:h,maskAllElementAttributes:c,maskAttributeFn:d,dataURLOptions:v,inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y,rootId:b});case t.TEXT_NODE:return function(t,e){const{needsMask:i,maskTextFn:n,rootId:s}=e,r=Vu.parentNode(t),o=r&&r.tagName;let l=Vu.textContent(t);const a="STYLE"===o||void 0,u="SCRIPT"===o||void 0;if(a&&l){try{var h;if(t.nextSibling||t.previousSibling);else if(ph(r.sheet));else if(null===(h=r.sheet)||void 0===h?void 0:h.cssRules){const t=Th(r.sheet);t&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(t)&&(l=t)}}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}l=Vh(l,nc(e.doc))}return u&&(l="SCRIPT_PLACEHOLDER"),!a&&!u&&l&&i&&(l=n?n(l,Vu.parentElement(t)):l.replace(/[\S]/g,"*")),{type:Au.Text,textContent:l||"",isStyle:a,rootId:s}}(t,{doc:i,needsMask:o,maskTextFn:u,rootId:b});case t.CDATA_SECTION_NODE:return{type:Au.CDATA,textContent:"",rootId:b};case t.COMMENT_NODE:return{type:Au.Comment,textContent:Vu.textContent(t)||"",rootId:b};default:return!1}}(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,keepIframeSrcFn:T,newlyAddedElement:I});if(!A)return console.warn(t,"not serialized"),null;let F;F=n.hasNode(t)?n.getId(t):function(t,e){if(e.comment&&t.type===Au.Comment)return!0;if(t.type===Au.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&&(dc(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===dc(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(dc(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&dc(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(dc(t.attributes.property).match(/^(og|twitter|fb):/)||dc(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===dc(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(dc(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(dc(t.attributes.name))||dc(t.attributes.property).match(/^article:/)||dc(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(dc(t.attributes.name)))return!0}}return!1}(A,p)||!R&&A.type===Au.Text&&!A.isStyle&&!A.textContent.replace(/^\s+|\s+$/gm,"").length?-2:Yh();const O=Object.assign(A,{id:F});if(n.add(t,O),-2===F)return null;_&&_(t);let D=!a;if(O.type===Au.Element){D=D&&!O.needBlock,delete O.needBlock;const e=Vu.shadowRoot(t);e&&Sh(e)&&(O.isShadowHost=!0)}if((O.type===Au.Document||O.type===Au.Element)&&D){p.headWhitespace&&O.type===Au.Element&&"head"===O.tagName&&(R=!1);const e={doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:l,skipChild:a,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:R,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:M+1,maxDepth:E};if(O.type===Au.Element&&"textarea"===O.tagName&&void 0!==O.attributes.value);else for(const i of Array.from(Vu.childNodes(t))){const t=pc(i,e);t&&O.childNodes.push(t)}let I=null;if(wh(t)&&(I=Vu.shadowRoot(t)))for(const t of Array.from(Vu.childNodes(I))){const i=pc(t,e);i&&(Sh(I)&&(i.isShadow=!0),O.childNodes.push(i))}}const L=Vu.parentNode(t);if(L&&kh(L)&&Sh(L)&&(O.isShadow=!0),O.type===Au.Element&&"iframe"===O.tagName){const e=function(t,e,i){const n=()=>{},s=t.contentWindow;if(!s)return n;let r;try{r=s.document.readyState}catch(t){return n}const o=()=>e();if("complete"!==r){let n=!1,s=null;const r=()=>{n||(n=!0,null!==s&&(clearTimeout(s),s=null),uc(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?uc(t,"load",o):(n=!0,uc(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),uc(t,"load",o)}}return t.addEventListener("load",o),()=>{uc(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&w){const i=pc(e,{doc:e,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:R,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:M+1,maxDepth:E});i&&w(t,i)}},k);null==S||S(t,e)}return O.type===Au.Element&&"link"===O.tagName&&"stylesheet"===O.attributes.rel&&function(e,a,S){if(hc.has(e))return;let I;try{I=e.sheet}catch(t){return}if(I)return;const A=new AbortController;let F=!1;const O=()=>{if(!F){F=!0;try{(()=>{if(x){const e=pc(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:R,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:M,maxDepth:E});e&&x(t,e)}})()}finally{hc.delete(e),A.abort()}}},D=setTimeout(O,S);A.signal.addEventListener("abort",()=>clearTimeout(D),{once:!0}),e.addEventListener("load",O,{signal:A.signal,once:!0}),hc.set(e,A)}(t,0,C),O}function gc(t){return!0===t||"all"===t?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===t,headMetaDescKeywords:"all"===t,headTitleMutations:"all"===t}:!1===t?{}:t}var mc=class t{constructor(...t){_h(this,"parentElement",null),_h(this,"parentNode",null),_h(this,"ownerDocument",void 0),_h(this,"firstChild",null),_h(this,"lastChild",null),_h(this,"previousSibling",null),_h(this,"nextSibling",null),_h(this,"ELEMENT_NODE",1),_h(this,"TEXT_NODE",3),_h(this,"nodeType",void 0),_h(this,"nodeName",void 0),_h(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 yc(t,e,i=document){const n={capture:!0,passive:!0};return i.addEventListener(t,e,n),()=>bc(i,t,e,n)}function bc(t,e,i,n){_c(()=>{const s=t.removeEventListener;"function"==typeof s&&(void 0!==n?s.call(t,e,i,n):s.call(t,e,i))})}function _c(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function wc(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var kc="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.",Sc={map:{},getId(){return console.error(kc),-1},getNode(){return console.error(kc),null},removeNodeFromMap(){console.error(kc)},has(){return console.error(kc),!1},reset(){console.error(kc)}};function xc(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 Cc(t,e,i,n,s=window){const r=s.Object.getOwnPropertyDescriptor(t,e);return s.Object.defineProperty(t,e,n?i:{set(t){if(setTimeout(()=>{try{i.set.call(this,t)}catch(t){}},0),r&&r.set){if(r.get)try{r.get.call(this)}catch(t){return}r.set.call(this,t)}}}),()=>Cc(t,e,r||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Sc=new Proxy(Sc,{get(t,e,i){return"map"===e&&console.error(kc),Reflect.get(t,e,i)}}));var $c=Date.now;function Tc(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=Vu.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=Vu.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 Ic(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Mc(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ec(t){return t?t.nodeType===t.ELEMENT_NODE?t:Vu.parentElement(t):null}function Pc(t,e,i,n){if(!t)return!1;const s=Ec(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(lc(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 Rc(t,e,i){return!("TITLE"!==t.tagName||!i.headTitleMutations)||-2===e.getId(t)}function Ac(t,e){if(kh(t))return!1;const i=e.getId(t);if(!e.has(i))return!0;const n=Vu.parentNode(t);return(!n||n.nodeType!==t.DOCUMENT_NODE)&&(!n||Ac(n,e))}function Fc(t){return Boolean(t.changedTouches)}function Oc(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Dc(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Lc(t){return!!t&&(t instanceof mc&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(Vu.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||($c=()=>(new Date).getTime());var Nc=class{constructor(){_h(this,"id",1),_h(this,"styleIDMap",new WeakMap),_h(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 qc(t){var e;let i=null;return"getRootNode"in t&&(null===(e=Vu.getRootNode(t))||void 0===e?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Vu.host(Vu.getRootNode(t))&&(i=Vu.host(Vu.getRootNode(t))),i}function jc(t){const e=t.ownerDocument;if(!e)return!1;if(Vu.contains(e,t))return!0;const i=Vu.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=qc(i);)i=e;return i}(t);return Vu.contains(e,i)}(t)}function Bc(t){return"__ln"in t}var Hc,zc=class{constructor(){_h(this,"length",0),_h(this,"head",null),_h(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let e=this.head;for(let i=0;t>i;i++)e=(null==e?void 0:e.next)||null;return e}addNode(t){const e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&Bc(t.previousSibling)){const i=t.previousSibling.__ln.next;e.next=i,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,i&&(i.previous=e)}else if(t.nextSibling&&Bc(t.nextSibling)&&t.nextSibling.__ln.previous){const i=t.nextSibling.__ln.previous;e.previous=i,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,i&&(i.next=e)}else this.head&&(this.head.previous=e),e.next=this.head,this.head=e;null===e.next&&(this.tail=e),this.length++}removeNode(t){const e=t.__ln;this.head&&(e.previous?(e.previous.next=e.next,e.next?e.next.previous=e.previous:this.tail=e.previous):(this.head=e.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},Uc=(t,e)=>`${t}@${e}`,Wc=class{constructor(){_h(this,"frozen",!1),_h(this,"locked",!1),_h(this,"texts",[]),_h(this,"attributes",[]),_h(this,"attributeMap",new WeakMap),_h(this,"generatedAttributes",new WeakMap),_h(this,"removes",[]),_h(this,"mapRemoves",new Set),_h(this,"movedMap",{}),_h(this,"addedSet",new Set),_h(this,"movedSet",new Set),_h(this,"droppedSet",new Set),_h(this,"removesSubTreeCache",new Set),_h(this,"mutationCb",void 0),_h(this,"blockClass",void 0),_h(this,"blockSelector",void 0),_h(this,"maskTextClass",void 0),_h(this,"maskTextSelector",void 0),_h(this,"inlineStylesheet",void 0),_h(this,"maskInputOptions",void 0),_h(this,"maskTextFn",void 0),_h(this,"maskInputFn",void 0),_h(this,"maskAllElementAttributes",void 0),_h(this,"maskAttributeFn",void 0),_h(this,"keepIframeSrcFn",void 0),_h(this,"recordCanvas",void 0),_h(this,"canvasMaskingConfigured",void 0),_h(this,"inlineImages",void 0),_h(this,"slimDOMOptions",void 0),_h(this,"dataURLOptions",void 0),_h(this,"doc",void 0),_h(this,"mirror",void 0),_h(this,"iframeManager",void 0),_h(this,"stylesheetManager",void 0),_h(this,"shadowDomManager",void 0),_h(this,"canvasManager",void 0),_h(this,"processedNodeManager",void 0),_h(this,"unattachedDoc",void 0),_h(this,"canvasManagerReleased",!1),_h(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),_h(this,"emit",()=>{if(this.frozen||this.locked)return;const t=Gu(),e=Ju();try{this.processBufferedMutations()}finally{i=Gu()-t,n=e,Yu>0||Ku(i,null!=n?n:Zu)||i>lh.slowestBatchMs&&(lh.slowestBatchMs=i)}var i,n}),_h(this,"processBufferedMutations",()=>{const t=[],e=new Set,i=new zc,n=t=>{let e=t,i=-2;for(;-2===i;)e=e&&e.nextSibling,i=e&&this.mirror.getId(e);return i};let s;const r=r=>{var o;const l=Vu.parentNode(r);if(!l||!jc(r)||"TEXTAREA"===l.tagName)return;if(this.isBlockedAtEmission(l))return;const a=kh(l)?this.mirror.getId(qc(r)):this.mirror.getId(l),u=n(r);if(-1===a||-1===u)return i.addNode(r);null!==(o=s)&&void 0!==o||(s={doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:t=>{Oc(t,this.mirror)&&this.iframeManager.addIframe(t),Dc(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Lc(t)&&!Pc(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(Vu.shadowRoot(t),this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onIframeListenerRegistered:(t,e)=>{this.iframeManager.registerLoadListenerDisposer(t,e)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}});const h=pc(r,s);h&&(t.push({parentId:a,nextId:u,node:h}),e.add(h.id))};for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t);for(const t of this.movedSet)Gc(this.removesSubTreeCache,t)&&!this.movedSet.has(Vu.parentNode(t))||r(t);for(const t of this.addedSet)Zc(this.droppedSet,t)||Gc(this.removesSubTreeCache,t)?Zc(this.movedSet,t)?r(t):this.droppedSet.add(t):r(t);let o=null;for(;i.length;){let t=null;if(o){const e=this.mirror.getId(Vu.parentNode(o.value)),i=n(o.value);-1!==e&&-1!==i&&(t=o)}if(!t){let e=i.tail;for(;e;){const i=e;if(e=e.previous,i){const e=this.mirror.getId(Vu.parentNode(i.value));if(-1===n(i.value))continue;if(-1!==e){t=i;break}{const e=Vu.parentNode(i.value);if(e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=Vu.host(e);if(-1!==this.mirror.getId(n)){t=i;break}}}}}}if(!t){for(;i.head;)i.removeNode(i.head.value);break}o=t.previous,i.removeNode(t.value),r(t.value)}const l={texts:this.texts.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const e=t.node,i=Vu.parentNode(e);return i&&"TEXTAREA"===i.tagName&&this.genTextAreaValueMutation(i),{id:this.mirror.getId(e),value:t.value}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),attributes:this.attributes.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const{attributes:e}=t;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof e.style){const i=JSON.stringify(t.styleDiff),n=JSON.stringify(t._unchangedStyles);e.style.length>i.length&&(i+n).split("var(").length===e.style.split("var(").length&&(e.style=t.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(const[n,s]of Object.entries(e))if("string"==typeof s||null===s){var i;e[n]=qh({element:t.node,name:n,value:s,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(i=this.generatedAttributes.get(t.node))||void 0===i?void 0:i.has(n)})}return{id:this.mirror.getId(t.node),attributes:e}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),removes:this.removes,adds:t};this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.generatedAttributes=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},(l.texts.length||l.attributes.length||l.removes.length||l.adds.length)&&this.mutationCb(l)}),_h(this,"bufferBelongsToIframe",t=>this.doc===t.contentDocument),_h(this,"genTextAreaValueMutation",t=>{let e=this.attributeMap.get(t);e||(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(e),this.attributeMap.set(t,e));const i=Array.from(Vu.childNodes(t),t=>Vu.textContent(t)||"").join("");e.attributes.value=Dh({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Bh(t),value:i,maskInputFn:this.maskInputFn})}),_h(this,"processMutation",t=>{if(!Rc(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const e=Vu.textContent(t.target);Pc(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:ac(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,Ec(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break}case"attributes":{var e;const n=t.target,s=t.attributeName,r=null!==(e=t.attributeNamespace)&&void 0!==e?e:null;let o=function(t,e,i){if(!i)return e;const n=t.getAttributeNodeNS(i,e);if(n)return n.name;if("http://www.w3.org/1999/xlink"===i)return`xlink:${e}`;if("http://www.w3.org/XML/1998/namespace"===i)return`xml:${e}`;if("http://www.w3.org/2000/xmlns/"===i)return"xmlns"===e?e:`xmlns:${e}`;const s=t.lookupPrefix(i);return s?`${s}:${e}`:e}(n,s,r),l=r?n.getAttributeNS(r,s):t.target.getAttribute(s);if("value"===o){const t=n,e=Bh(t);l=Dh({element:t,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:l,maskInputFn:this.maskInputFn})}if(Pc(t.target,this.blockClass,this.blockSelector,!1)||l===t.oldValue)return;let a=this.attributeMap.get(t.target);const u="IFRAME"===n.tagName&&"src"===o;if(u&&!this.keepIframeSrcFn(l)&&n.contentDocument)return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(t.target,a)),"type"===o&&"INPUT"===n.tagName&&"password"===(t.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!oc(n.tagName,o)){var i;const e=rc(this.doc,Lh(n.tagName),Lh(o),l,n,this.dataURLOptions);if(u&&!this.keepIframeSrcFn(l)&&(o="rr_src"),a.attributes[o]=e,null===(i=this.generatedAttributes.get(t.target))||void 0===i||i.delete(o),"style"===o){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const e=this.unattachedDoc.createElement("span"),i=n.style;t.oldValue&&(e.style.cssText=t.oldValue);for(const t of Array.from(i)){const n=i.getPropertyValue(t),s=i.getPropertyPriority(t);n!==e.style.getPropertyValue(t)||s!==e.style.getPropertyPriority(t)?a.styleDiff[t]=""===s?n:[n,s]:a._unchangedStyles[t]=[n,s]}for(const t of Array.from(e.style))""===i.getPropertyValue(t)&&(a.styleDiff[t]=!1)}else if("open"===o&&"DIALOG"===n.tagName){a.attributes.rr_open_mode=n.matches("dialog:modal")?"modal":"non-modal";let e=this.generatedAttributes.get(t.target);e||(e=new Set,this.generatedAttributes.set(t.target,e)),e.add("rr_open_mode")}}break}case"childList":if(Pc(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=kh(t.target)?this.mirror.getId(Vu.host(t.target)):this.mirror.getId(t.target);Pc(t.target,this.blockClass,this.blockSelector,!1)||Rc(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(Vc(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===i||Ac(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[Uc(i,n)]?Vc(this.movedSet,e):(this.removes.push({parentId:n,id:i,isShadow:!(!kh(t.target)||!Sh(t.target))||void 0}),function(t,e){const i=[t];for(;i.length;){const t=i.pop();e.has(t)||(e.add(t),Vu.childNodes(t).forEach(t=>i.push(t)))}}(e,this.removesSubTreeCache))),this.mapRemoves.add(e))})}}),_h(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(Rc(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[Uc(this.mirror.getId(t),i)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!Pc(t,this.blockClass,this.blockSelector,!1)){if(t.nodeType===t.TEXT_NODE)return;const e=Vu.childNodes(t);for(let t=0,i=e.length;i>t;t++){const i=e[t];i&&this.genAdds(i)}if(Lc(t)){const e=Vu.childNodes(Vu.shadowRoot(t));for(let i=0,n=e.length;n>i;i++){const n=e[i];n&&(this.processedNodeManager.add(n,this),this.genAdds(n,t))}}}}}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAllElementAttributes","maskAttributeFn","keepIframeSrcFn","recordCanvas","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(e=>{this[e]=t[e]}),this.canvasManager.acquire()}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t)}isBlockedAtEmission(t){const e=this.blockClass,i=e&&"string"!=typeof e&&(e.global||e.sticky)?new RegExp(e):null;for(;t;){if(i&&(i.lastIndex=0),Pc(t,i||e,this.blockSelector,!0))return!0;const n="getRootNode"in t?Vu.getRootNode(t):null;t=(null==n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?Vu.host(n):null}return!1}};function Vc(t,e){const i=[e];for(;i.length;){const e=i.pop();if(t.delete(e),e.nodeType===e.TEXT_NODE)continue;const n=Vu.childNodes(e);for(let t=0,e=n.length;e>t;t++){const e=n[t];e&&i.push(e)}}}function Gc(t,e,i){return 0!==t.size&&function(t,e){const i=Vu.parentNode(e);return!!i&&t.has(i)}(t,e)}function Zc(t,e){if(0===t.size)return!1;let i=Vu.parentNode(e);for(;i;){if(t.has(i))return!0;i=Vu.parentNode(i)}return!1}function Qc(t){Hc=t}function Jc(){Hc=void 0}var Kc=(t,e="rrweb")=>Hc?(...i)=>{try{return t(...i)}catch(t){if(Hc&&!0===Hc(t,e))return;throw t}}:t,Yc=[];function Xc(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 td(t,e){const i=new Wc;let n;i.init(t);try{n=new(Uu())(Kc(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),Yc.push(i),{observer:n,buffer:i}}catch(t){try{null==n||n.disconnect(),i.destroy(),i.reset()}catch(t){}throw t}}function ed({scrollCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){const o=new Map,l=r=>{const l=Xc(r);if(!l||Pc(l,n,s,!0))return;const a=i.getId(l);let u,h;if(l===e&&e.defaultView){const t=Tc(e.defaultView);u=t.left,h=t.top}else u=l.scrollLeft,h=l.scrollTop;const c=`${u},${h}`;o.get(a)!==c&&(o.set(a,c),t({id:a,x:u,y:h}))},a=[yc("scroll",Kc(xc(Kc(t=>l(t)),r.scroll||100)),e)];return"onscrollend"in e&&a.push(yc("scrollend",Kc(l),e)),()=>a.forEach(t=>t())}function id(t,e){for(let i=Yc.length-1;i>=0;i--){const n=Yc[i];if(!n)continue;let s=n.bufferBelongsToIframe(t);!s&&e&&e.has(n.bufferDoc())&&(s=!0),s&&(n.reset(),Yc.splice(i,1))}}var nd=["INPUT","TEXTAREA","SELECT"],sd=new WeakMap;function rd(t){return function t(e,i){if(ud("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||ud("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||ud("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||ud("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 od(t,e,i){let n,s;return t?(t.ownerNode?n=e.getId(t.ownerNode):s=i.getId(t),{styleId:s,id:n}):{}}function ld({mirror:t,stylesheetManager:e},i){var n,s;let r=null;r=t.getId("#document"===i.nodeName?i:Vu.host(i));const o="#document"===i.nodeName?null===(n=i.defaultView)||void 0===n?void 0:n.Document:null===(s=i.ownerDocument)||void 0===s||null===(s=s.defaultView)||void 0===s?void 0:s.ShadowRoot,l=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==r&&-1!==r&&o&&l?(Object.defineProperty(i,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var t;return null===(t=l.get)||void 0===t?void 0:t.call(this)},set(t){let i;try{var n;i=null===(n=l.set)||void 0===n?void 0:n.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==r&&-1!==r)try{e.adoptStyleSheets(t,r)}catch(t){}return i}}),Kc(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function ad(t,e={}){const i=t.doc.defaultView;if(!i)return()=>{};let n,s;!function(t,e){const{mutationCb:i,mousemoveCb:n,mouseInteractionCb:s,scrollCb:r,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:u,styleDeclarationCb:h,canvasMutationCb:c,fontCb:d,selectionCb:v,customElementCb:f}=t;t.mutationCb=(...t)=>{e.mutation&&e.mutation(...t),i(...t)},t.mousemoveCb=(...t)=>{e.mousemove&&e.mousemove(...t),n(...t)},t.mouseInteractionCb=(...t)=>{e.mouseInteraction&&e.mouseInteraction(...t),s(...t)},t.scrollCb=(...t)=>{e.scroll&&e.scroll(...t),r(...t)},t.viewportResizeCb=(...t)=>{e.viewportResize&&e.viewportResize(...t),o(...t)},t.inputCb=(...t)=>{e.input&&e.input(...t),l(...t)},t.mediaInteractionCb=(...t)=>{e.mediaInteaction&&e.mediaInteaction(...t),a(...t)},t.styleSheetRuleCb=(...t)=>{e.styleSheetRule&&e.styleSheetRule(...t),u(...t)},t.styleDeclarationCb=(...t)=>{e.styleDeclaration&&e.styleDeclaration(...t),h(...t)},t.canvasMutationCb=(...t)=>{e.canvasMutation&&e.canvasMutation(...t),c(...t)},t.fontCb=(...t)=>{e.font&&e.font(...t),d(...t)},t.selectionCb=(...t)=>{e.selection&&e.selection(...t),v(...t)},t.customElementCb=(...t)=>{e.customElement&&e.customElement(...t),f(...t)}}(t,e);const r=[],o=Kc(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=Yc.indexOf(s);-1!==t&&Yc.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==n||n.disconnect()}finally{wc(r)}});try{if(t.recordDOM){const e=td(t,t.doc);n=e.observer,s=e.buffer}if(r.push(function({mousemoveCb:t,sampling:e,doc:i,mirror:n}){if(!1===e.mousemove)return()=>{};const s="number"==typeof e.mousemove?e.mousemove:50,r="number"==typeof e.mousemoveCallback?e.mousemoveCallback:500;let o,l=[];const a=xc(Kc(e=>{const i=Date.now()-o;t(l.map(t=>(t.timeOffset-=i,t)),e),l=[],o=null}),r),u=Kc(xc(Kc(t=>{const e=Xc(t),{clientX:i,clientY:s}=Fc(t)?t.changedTouches[0]:t;o||(o=$c()),l.push({x:i,y:s,id:n.getId(e),timeOffset:$c()-o}),a("undefined"!=typeof DragEvent&&t instanceof DragEvent?Iu.Drag:t instanceof MouseEvent?Iu.MouseMove:Iu.TouchMove)}),s,{trailing:!1})),h=[yc("mousemove",u,i),yc("touchmove",u,i),yc("drag",u,i)];return Kc(()=>{h.forEach(t=>t())})}(t)),r.push(function({mouseInteractionCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){if(!1===r.mouseInteraction)return()=>{};const o=!0===r.mouseInteraction||void 0===r.mouseInteraction?{}:r.mouseInteraction,l=[];let a=null;return Object.keys(Mu).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t]).forEach(r=>{let o=Lh(r);const u=(e=>r=>{const o=Xc(r);if(Pc(o,n,s,!0))return;let l=null,u=e;if("pointerType"in r){switch(r.pointerType){case"mouse":l=Eu.Mouse;break;case"touch":l=Eu.Touch;break;case"pen":l=Eu.Pen}l===Eu.Touch&&(Mu[e]===Mu.MouseDown?u="TouchStart":Mu[e]===Mu.MouseUp&&(u="TouchEnd"))}else Fc(r)&&(l=Eu.Touch);null!==l?(a=l,(u.startsWith("Touch")&&l===Eu.Touch||u.startsWith("Mouse")&&l===Eu.Mouse)&&(l=null)):Mu[e]===Mu.Click&&(l=a,a=null);const h=Fc(r)?r.changedTouches[0]:r;if(!h)return;const c=i.getId(o),{clientX:d,clientY:v}=h;Kc(t)(le({type:Mu[u],id:c,x:d,y:v},null!==l&&{pointerType:l}))})(r);if(window.PointerEvent)switch(Mu[r]){case Mu.MouseDown:case Mu.MouseUp:o=o.replace("mouse","pointer");break;case Mu.TouchStart:case Mu.TouchEnd:return}l.push(yc(o,u,e))}),Kc(()=>{l.forEach(t=>t())})}(t)),r.push(ed(t)),r.push(function({viewportResizeCb:t},{win:e}){let i=-1,n=-1;return yc("resize",Kc(xc(Kc(()=>{const e=Ic(),s=Mc();i===e&&n===s||(t({width:Number(s),height:Number(e)}),i=e,n=s)}),200)),e)}(t,{win:i})),r.push(function({inputCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,ignoreClass:r,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:u,userTriggeredOnInput:h}){function c(t){let i=Xc(t);const u=t.isTrusted,c=e.defaultView;if(i&&c&&!(i instanceof c.HTMLElement))return;const v=i&&i.tagName;if(i&&"OPTION"===v&&(i=Vu.parentElement(i)),!i||!v||0>nd.indexOf(v)||Pc(i,n,s,!0))return;if(i.classList.contains(r)||o&&i.matches(o))return;let f=i.value,p=!1;const g=Bh(i)||"";"radio"===g||"checkbox"===g?p=i.checked:(l[v.toLowerCase()]||l[g])&&(f=Dh({element:i,maskInputOptions:l,tagName:v,type:g,value:f,maskInputFn:a})),d(i,h?{text:f,isChecked:p,userTriggered:u}:{text:f,isChecked:p});const m=i.name;"radio"===g&&m&&p&&e.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach(t=>{if(t!==i){const e=t.value;d(t,h?{text:e,isChecked:!p,userTriggered:!1}:{text:e,isChecked:!p})}})}function d(e,n){const s=sd.get(e);if(!s||s.text!==n.text||s.isChecked!==n.isChecked){sd.set(e,n);const s=i.getId(e);Kc(t)(le(le({},n),{},{id:s}))}}const v=("last"===u.input?["change"]:["input","change"]).map(t=>yc(t,Kc(c),e)),f=e.defaultView;if(!f)return()=>{v.forEach(t=>t())};const p=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value");return p&&p.set&&v.push(...[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]].map(t=>Cc(t[0],t[1],{set(){Kc(c)({target:this,isTrusted:!1})}},!1,f))),Kc(()=>{wc(v)})}(t)),r.push(function({mediaInteractionCb:t,blockClass:e,blockSelector:i,mirror:n,sampling:s,doc:r}){const o=Kc(r=>xc(Kc(s=>{const o=Xc(s);if(!o||Pc(o,e,i,!0))return;const{currentTime:l,volume:a,muted:u,playbackRate:h,loop:c}=o;t({type:r,id:n.getId(o),currentTime:l,volume:a,muted:u,playbackRate:h,loop:c})}),s.media||500)),l=[yc("play",o(Ru.Play),r),yc("pause",o(Ru.Pause),r),yc("seeked",o(Ru.Seeked),r),yc("volumechange",o(Ru.VolumeChange),r),yc("ratechange",o(Ru.RateChange),r)];return Kc(()=>{l.forEach(t=>t())})}(t)),t.recordDOM){const e=function(t){const e=new Map,i=new Set;let n=!0;const s=t=>{if(n)try{t()}catch(t){}},r=t=>{var i;const n=e.get(t);if(n){for(;null===(i=n[0])||void 0===i?void 0:i.ready;){const t=n.shift();(null==t?void 0:t.emit)&&s(t.emit)}0===n.length&&e.delete(t)}};return{queueMutation(t,i){if(!t)return void s(i);const n=e.get(t);n?(n.push({emit:i,ready:!0}),r(t)):s(i)},queuePendingMutation(o,l,a){if(!n)return()=>{};let u=e.get(o);u||(u=[],e.set(o,u));const h={emit:l,ready:!1};u.push(h);let c,d=!1,v=!1;const f=()=>{d||v||(d=!0,void 0!==c&&i.delete(c),h.ready=!0,h.emit=void 0,r(o))};try{c=t.setTimeout(f,5e3),d||v?t.clearTimeout(c):i.add(c)}catch(t){f()}return e=>{!v&&n&&(v=!0,void 0!==c&&(t.clearTimeout(c),i.delete(c)),d?e&&s(a):(h.ready=!0,e||(h.emit=void 0),r(o)))}},reset(){n=!1,i.forEach(e=>t.clearTimeout(e)),i.clear(),e.clear()}}}(i);r.push(e.reset),r.push(function({styleSheetRuleCb:t,mirror:e,stylesheetManager:i},{win:n,mutationQueue:s}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const r=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:Kc((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=od(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,adds:[{rule:l,index:a}]})),a},"host")}),n.CSSStyleSheet.prototype.addRule=function(t,e,i=this.cssRules.length){return n.CSSStyleSheet.prototype.insertRule.apply(this,[`${t} { ${e} }`,i])};const o=n.CSSStyleSheet.prototype.deleteRule;let l,a;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:Kc((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=od(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,removes:[{index:l}]})),a},"host")}),n.CSSStyleSheet.prototype.removeRule=function(t){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},n.CSSStyleSheet.prototype.replace&&(l=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(l,{apply:Kc((n,r,o)=>{const[l]=o,a=n.apply(r,o);try{const n=null==a?void 0:a.then;if(r.ownerNode||!a||"function"!=typeof n)return a;i.onCssomSheetMutation(r);const{id:o,styleId:u}=od(r,e,i.styleMirror);if(!(o&&-1!==o||u&&-1!==u))return a;const h=s.queuePendingMutation(r,()=>t({id:o,styleId:u,replace:l}),()=>{const e=Th(r);null!==e&&t({id:o,styleId:u,replace:e})});try{n.call(a,()=>h(!0),()=>h(!1))}catch(t){h(!1)}}catch(t){}return a},"host")})),n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Kc((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=od(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,replaceSync:l})),a},"host")}));const u={};hd("CSSGroupingRule")?u.CSSGroupingRule=n.CSSGroupingRule:(hd("CSSMediaRule")&&(u.CSSMediaRule=n.CSSMediaRule),hd("CSSConditionRule")&&(u.CSSConditionRule=n.CSSConditionRule),hd("CSSSupportsRule")&&(u.CSSSupportsRule=n.CSSSupportsRule));const h={};return Object.entries(u).forEach(([n,r])=>{h[n]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(h[n].insertRule,{apply:Kc((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:h}=od(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||h&&-1!==h)){const e=[...rd(r),a];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:h,adds:[{rule:l,index:e}]}))}return a},"host")}),r.prototype.deleteRule=new Proxy(h[n].deleteRule,{apply:Kc((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:h}=od(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||h&&-1!==h)){const e=[...rd(r),l];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:h,removes:[{index:e}]}))}return a},"host")})}),Kc(()=>{n.CSSStyleSheet.prototype.insertRule=r,n.CSSStyleSheet.prototype.deleteRule=o,l&&(n.CSSStyleSheet.prototype.replace=l),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(u).forEach(([t,e])=>{e.prototype.insertRule=h[t].insertRule,e.prototype.deleteRule=h[t].deleteRule})})}(t,{win:i,mutationQueue:e})),r.push(ld(t,t.doc)),r.push(function({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:i,stylesheetManager:n},{win:s,mutationQueue:r}){const o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Kc((s,o,l)=>{var a;const[u,h,c]=l,d=s.apply(o,l);if(i.has(u))return d;const v=null===(a=o.parentRule)||void 0===a?void 0:a.parentStyleSheet;n.onCssomSheetMutation(v);const{id:f,styleId:p}=od(v,e,n.styleMirror);if(f&&-1!==f||p&&-1!==p){const e=rd(o.parentRule);r.queueMutation(v,()=>t({id:f,styleId:p,set:{property:u,value:h,priority:c},index:e}))}return d},"host")});const l=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:Kc((s,o,l)=>{var a;const[u]=l,h=s.apply(o,l);if(i.has(u))return h;const c=null===(a=o.parentRule)||void 0===a?void 0:a.parentStyleSheet;n.onCssomSheetMutation(c);const{id:d,styleId:v}=od(c,e,n.styleMirror);if(d&&-1!==d||v&&-1!==v){const e=rd(o.parentRule);r.queueMutation(c,()=>t({id:d,styleId:v,remove:{property:u},index:e}))}return h},"host")}),Kc(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=l})}(t,{win:i,mutationQueue:e})),t.collectFonts&&r.push(function({fontCb:t,doc:e}){const i=e.defaultView;if(!i)return()=>{};const n=[],s=new WeakMap,r=i.FontFace;i.FontFace=function(t,e,i){const n=new r(t,e,i);return s.set(n,{family:t,buffer:"string"!=typeof e,descriptors:i,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),n};const o=Wu(e.fonts,"add",function(e){return function(i){return setTimeout(Kc(()=>{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),Kc(()=>{n.forEach(t=>t())})}(t))}r.push(function(t){const{doc:e,mirror:i,blockClass:n,blockSelector:s,selectionCb:r}=t;let o=!0;const l=Kc(()=>{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);Pc(r,n,s,!0)||Pc(a,n,s,!0)||l.push({start:i.getId(r),startOffset:o,end:i.getId(a),endOffset:u})}r({ranges:l})});return l(),yc("selectionchange",l)}(t)),r.push(function({doc:t,customElementCb:e}){const i=t.defaultView;return i&&i.customElements?Wu(i.customElements,"define",function(t){return function(i,n,s){try{e({define:{name:i}})}catch(t){console.warn(`Custom element callback failed for ${i}`)}return t.apply(this,[i,n,s])}}):()=>{}}(t));for(const e of t.plugins)r.push(e.observer(e.callback,i,e.options))}catch(t){try{o()}catch(t){}throw t}return o}function ud(t){return void 0!==window[t]}function hd(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var cd=class{constructor(t){_h(this,"generateIdFn",void 0),_h(this,"iframeRemoteIdToLocalIdMap",new WeakMap),_h(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}},dd=class{constructor(t){_h(this,"iframes",new WeakMap),_h(this,"crossOriginIframeMap",new WeakMap),_h(this,"crossOriginIframeMirror",new cd(Yh)),_h(this,"crossOriginIframeStyleMirror",void 0),_h(this,"crossOriginIframeRootIdMap",new WeakMap),_h(this,"mirror",void 0),_h(this,"mutationCb",void 0),_h(this,"wrappedEmit",void 0),_h(this,"loadListener",void 0),_h(this,"pageHideListener",void 0),_h(this,"stylesheetManager",void 0),_h(this,"recordCrossOriginIframes",void 0),_h(this,"messageHandler",void 0),_h(this,"nestedIframeListeners",new Map),_h(this,"attachedWindows",new WeakMap),_h(this,"attachedDocuments",new WeakMap),_h(this,"attachedIframes",new Map),_h(this,"loadListenerDisposers",new WeakMap),_h(this,"iframeElementsById",new Map),_h(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new cd(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}registerLoadListenerDisposer(t,e){let i=this.loadListenerDisposers.get(t);i||(i=new Set,this.loadListenerDisposers.set(t,i)),i.add(e);const n=this.mirror.getId(t);-1!==n&&this.iframeElementsById.set(n,t)}getIframeElementById(t){var e,i,n;return null!==(e=null!==(i=null===(n=this.attachedIframes.get(t))||void 0===n?void 0:n.element)&&void 0!==i?i:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){const e=this.loadListenerDisposers.get(t);e&&(e.forEach(t=>_c(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{bc(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);_c(()=>{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)})}_c(()=>{const e=t.contentWindow;if(!e)return;let i=this.pageHideHandlers.get(t);if(i)for(const t of i)if(t.win===e)return;const n=()=>{var e;null===(e=this.pageHideListener)||void 0===e||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument)};e.addEventListener("pagehide",n),i||(i=new Set,this.pageHideHandlers.set(t,i)),i.add({win:e,handler:n})}),null===(i=this.loadListener)||void 0===i||i.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const e=t;if("rrweb"!==e.data.type||e.origin!==e.data.origin)return;if(!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const n=this.transformCrossOriginEvent(i,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}transformCrossOriginEvent(t,e){switch(e.type){case Tu.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:Tu.IncrementalSnapshot,data:{source:Iu.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Tu.Meta:case Tu.Load:case Tu.DomContentLoaded:return!1;case Tu.Plugin:return e;case Tu.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case Tu.IncrementalSnapshot:switch(e.data.source){case Iu.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 Iu.Drag:case Iu.TouchMove:case Iu.MouseMove:return e.data.positions.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case Iu.ViewportResize:return!1;case Iu.MediaInteraction:case Iu.MouseInteraction:case Iu.Scroll:case Iu.CanvasMutation:case Iu.Input:return this.replaceIds(e.data,t,["id"]),e;case Iu.StyleSheetRule:case Iu.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case Iu.Font:return e;case Iu.Selection:return e.data.ranges.forEach(e=>{this.replaceIds(e,t,["start","end"])}),e;case Iu.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===Au.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&&(bc(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(i)),t&&this.nestedIframeListeners.has(t)&&(bc(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=>{_c(()=>this.mirror.removeNodeFromMap(t))}),_c(()=>id(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&&bc(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{bc(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}},vd=class{constructor(t){_h(this,"shadowDoms",new WeakSet),_h(this,"mutationCb",void 0),_h(this,"scrollCb",void 0),_h(this,"bypassOptions",void 0),_h(this,"mirror",void 0),_h(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(!Sh(t))return;if(this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=null!==(i=null===(n=Vu.host(t))||void 0===n?void 0:n.ownerDocument)&&void 0!==i?i:e,{observer:r,buffer:o}=td(le(le({},this.bypassOptions),{},{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push({doc:s,handler(){r.disconnect(),o.destroy(),o.releaseCanvasManager();const t=Yc.indexOf(o);-1!==t&&Yc.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:ed(le(le({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))}),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(Vu.host(t))),this.restoreHandlers.push({doc:s,handler:ld({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)})},0)}observeAttachShadow(t){t.contentWindow&&t.contentDocument&&this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,e){const i=this;this.restoreHandlers.push({doc:e,handler:Wu(t.prototype,"attachShadow",function(t){return function(n){const s=t.call(this,n),r=Vu.shadowRoot(this);return r&&jc(this)&&i.addShadowRoot(r,e),s}})})}reset(){this.restoreHandlers.forEach(({handler:t})=>{try{t()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){const e=[];for(const i of this.restoreHandlers)if(i.doc===t)try{i.handler()}catch(t){}else e.push(i);this.restoreHandlers=e}},fd="skip-frame";function pd(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 gd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",md="undefined"==typeof Uint8Array?[]:new Uint8Array(256),yd=0;64>yd;yd++)md[gd.charCodeAt(yd)]=yd;var bd=function(t){var e,i=new Uint8Array(t),n=i.length,s="";for(e=0;n>e;e+=3)s+=gd[i[e]>>2],s+=gd[(3&i[e])<<4|i[e+1]>>4],s+=gd[(15&i[e+1])<<2|i[e+2]>>6],s+=gd[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},_d=new Map,wd=(t,e,i)=>{if(!t||!xd(t,e)&&"object"!=typeof t)return;const n=function(t,e){let i=_d.get(t);return i||(i=new Map,_d.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 kd(t,e,i,n){if(t instanceof Array)return t.map(t=>kd(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:bd(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[kd(t.buffer,e,i,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const e=t.constructor.name,{src:i}=t;return{rr_type:e,src:i}}return t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL(n.type,n.quality)}:t instanceof ImageData?{rr_type:t.constructor.name,args:[kd(t.data,e,i,n),t.width,t.height]}:xd(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:wd(t,e,i)}:t}var Sd=(t,e,i,n)=>t.map(t=>kd(t,e,i,n)),xd=(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]))},Cd=["webgl","webgl2"];function $d(t){return"nodeType"in t}function Td(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 Wu(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||$d(r)&&Pc(r,e,i,!0))return n.call(this,s);$d(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?le(le({},s),{},{usage:"number"==typeof s.usage?s.usage|o:o}):s)}})}(t,e,i);n&&s.push(n)}const r=Wu(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(s,...r){const o=function(t){return"experimental-webgl"===t?"webgl":t}(s);if(!Pc(this,e,i,!0)&&("__context"in this||(this.__context=o),n&&Cd.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.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(t=>t())}}function Id(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=Wu(t,u,function(t){return function(...l){const a=t.apply(this,l);if(wd(a,r,this),this.canvas&&"tagName"in this.canvas&&!Pc(this.canvas,n,s,!0)){const t=Sd(l,r,this,o);i(this.canvas,{type:e,property:u,args:t})}return a}});l.push(a)}catch(r){const o=Cc(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!Pc(this.canvas,n,s,!0)&&i(this.canvas,{type:e,property:u,args:[t],setter:!0})}});l.push(o)}return l}var Md='(function() {\n\t//#region ../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/base64-arraybuffer/1.0.2/f63fa6b5c318cf1c9f6bdd1d4292ad2f15f76f2ec78475025a2d44070e896fe9/node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js\n\tvar chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n\tvar lookup = typeof Uint8Array === "undefined" ? [] : /* @__PURE__ */ new Uint8Array(256);\n\tfor (var i = 0; i < chars.length; i++) lookup[chars.charCodeAt(i)] = i;\n\tvar encode = function(arraybuffer) {\n\t\tvar bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = "";\n\t\tfor (i = 0; i < len; i += 3) {\n\t\t\tbase64 += chars[bytes[i] >> 2];\n\t\t\tbase64 += chars[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n\t\t\tbase64 += chars[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n\t\t\tbase64 += chars[bytes[i + 2] & 63];\n\t\t}\n\t\tif (len % 3 === 2) base64 = base64.substring(0, base64.length - 1) + "=";\n\t\telse if (len % 3 === 1) base64 = base64.substring(0, base64.length - 2) + "==";\n\t\treturn base64;\n\t};\n\t//#endregion\n\t//#region ../rrweb/src/record/workers/image-bitmap-data-url-worker.ts\n\tconst lastFingerprintMap = /* @__PURE__ */ new Map();\n\tconst transparentFingerprintMap = /* @__PURE__ */ new Map();\n\tconst lastSentAtMap = /* @__PURE__ */ new Map();\n\tconst PROVIDER_KEYFRAME_INTERVAL_MS = 3e4;\n\tfunction hashPixels(data) {\n\t\tconst view = new Uint32Array(data.buffer, data.byteOffset, data.byteLength >>> 2);\n\t\tlet primaryHash = 2166136261;\n\t\tlet secondaryHash = 2654435769;\n\t\tfor (let i = 0; i < view.length; i++) {\n\t\t\tprimaryHash ^= view[i];\n\t\t\tprimaryHash = Math.imul(primaryHash, 16777619);\n\t\t\tsecondaryHash ^= view[i];\n\t\t\tsecondaryHash = Math.imul(secondaryHash, 2246822507);\n\t\t}\n\t\treturn `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n\t}\n\tfunction frameFingerprint(width, height, data) {\n\t\treturn `${width}x${height}:${hashPixels(data)}`;\n\t}\n\tfunction transparentFingerprint(width, height) {\n\t\tconst pixelCount = width * height;\n\t\tlet hash = transparentFingerprintMap.get(pixelCount);\n\t\tif (hash === void 0) {\n\t\t\thash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n\t\t\ttransparentFingerprintMap.set(pixelCount, hash);\n\t\t}\n\t\treturn `${width}x${height}:${hash}`;\n\t}\n\tconst worker = self;\n\tlet reusableCanvas = null;\n\tlet reusableCtx = null;\n\tworker.onmessage = async function(e) {\n\t\tif ("resetFrameDedup" in e.data) {\n\t\t\tlastFingerprintMap.clear();\n\t\t\treturn;\n\t\t}\n\t\tif ("OffscreenCanvas" in globalThis) {\n\t\t\tconst { id, bitmap, width, height, displayWidth, displayHeight, dataURLOptions, maskRegions } = e.data;\n\t\t\ttry {\n\t\t\t\tif (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n\t\t\t\t\treusableCanvas = new OffscreenCanvas(width, height);\n\t\t\t\t\treusableCtx = reusableCanvas.getContext("2d", { willReadFrequently: true });\n\t\t\t\t}\n\t\t\t\tconst ctx = reusableCtx;\n\t\t\t\tctx.clearRect(0, 0, width, height);\n\t\t\t\tctx.drawImage(bitmap, 0, 0);\n\t\t\t\tbitmap.close();\n\t\t\t\tif (maskRegions) {\n\t\t\t\t\tctx.fillStyle = "black";\n\t\t\t\t\tfor (const region of maskRegions) ctx.fillRect(region.x, region.y, region.width, region.height);\n\t\t\t\t}\n\t\t\t\tconst fingerprint = frameFingerprint(width, height, ctx.getImageData(0, 0, width, height).data);\n\t\t\t\tif (fingerprint === (lastFingerprintMap.get(id) ?? transparentFingerprint(width, height))) {\n\t\t\t\t\tconst lastSentAt = lastSentAtMap.get(id);\n\t\t\t\t\tif (!(maskRegions !== void 0 && lastSentAt !== void 0 && Date.now() - lastSentAt >= PROVIDER_KEYFRAME_INTERVAL_MS)) return worker.postMessage({ id });\n\t\t\t\t}\n\t\t\t\tconst blob = await reusableCanvas.convertToBlob(dataURLOptions);\n\t\t\t\tconst arrayBuffer = await blob.arrayBuffer();\n\t\t\t\tworker.postMessage({\n\t\t\t\t\tid,\n\t\t\t\t\ttype: blob.type,\n\t\t\t\t\tbase64: encode(arrayBuffer),\n\t\t\t\t\tdisplayWidth,\n\t\t\t\t\tdisplayHeight\n\t\t\t\t});\n\t\t\t\tlastFingerprintMap.set(id, fingerprint);\n\t\t\t\tlastSentAtMap.set(id, Date.now());\n\t\t\t} catch {\n\t\t\t\tworker.postMessage({ id });\n\t\t\t}\n\t\t} else {\n\t\t\te.data.bitmap.close();\n\t\t\treturn worker.postMessage({ id: e.data.id });\n\t\t}\n\t};\n\t//#endregion\n})();\n',Ed="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Md],{type:"text/javascript;charset=utf-8"});function Pd(t){let e;try{if(e=Ed&&(self.URL||self.webkitURL).createObjectURL(Ed),!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(Md),{name:null==t?void 0:t.name})}}var Rd,Ad,Fd,Od=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){_h(this,"pendingCanvasMutations",new Map),_h(this,"rafStamps",{latestId:0,invokeId:null}),_h(this,"mirror",void 0),_h(this,"mutationCb",void 0),_h(this,"resetObservers",void 0),_h(this,"frozen",!1),_h(this,"locked",!1),_h(this,"rafIdTimestamp",null),_h(this,"rafIdFlush",null),_h(this,"refCount",0),_h(this,"torndown",!1),_h(this,"resetFrameDedup",null),_h(this,"processMutation",(t,e)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(t)||this.pendingCanvasMutations.set(t,[]),this.pendingCanvasMutations.get(t).push(e)});const{sampling:e="all",win:i,blockClass:n,blockSelector:s,recordCanvas:r,dataURLOptions:o,resolutionScale:l,canvasMasking:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,r&&"all"===e&&this.initCanvasMutationObserver(i,n,s,o),r&&"number"==typeof e&&this.initCanvasFPSObserver(e,i,n,s,{dataURLOptions:o,resolutionScale:l,canvasMasking:a})}initCanvasFPSObserver(t,e,i,n,s){var r=this;if(!("OffscreenCanvas"in e))return;const o="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,l=Td(e,i,n,!0),a=new Map;let u;try{u=new Pd}catch(t){return}let h=!1;u.onerror=()=>{var t;h=!0,cancelAnimationFrame(d),null===(t=u.terminate)||void 0===t||t.call(u),this.resetFrameDedup=null},this.resetFrameDedup=()=>{u.postMessage({resetFrameDedup:!0})},u.onmessage=t=>{const{id:e}=t.data;if(a.set(e,!1),!("base64"in t.data))return;const{base64:i,type:n,displayWidth:s,displayHeight:r}=t.data;this.mutationCb({id:e,type:Pu["2D"],commands:[{property:"clearRect",args:[0,0,s,r]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:n}]},0,0,s,r]}],displayWidth:s,displayHeight:r})};const c=1e3/t;let d,v=0;const f=t=>{var l;h||(v&&c>t-v||(v=t,(()=>{const t=[],s=e=>{try{e.querySelectorAll("canvas").forEach(e=>{Pc(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=ne(function*(t){const e=r.mirror.getId(t);if(!a.get(e)&&0!==t.width&&0!==t.height){a.set(e,!0);try{if(["webgl","webgl2"].includes(t.__context)){var i,n;const s=t.getContext(t.__context);if(null==s||null===(i=s.isContextLost)||void 0===i?void 0:i.call(s))return void a.set(e,!1);!1===(null==s||null===(n=s.getContextAttributes())||void 0===n?void 0:n.preserveDrawingBuffer)&&s.clear(s.COLOR_BUFFER_BIT)}const r=t.clientWidth||t.width,l=t.clientHeight||t.height,h=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(l*o)),d=function(t,e,i,n,s,r){if(!t||"function"!=typeof t.regionsFn)return;let o;try{o=t.regionsFn(e)}catch(t){return fd}if(void 0===o)return;if(!Array.isArray(o)||!o.every(pd))return fd;const l=i/s,a=n/r;return o.filter(t=>t.width>0&&t.height>0).map(t=>{const e=Math.floor(t.x*l),i=Math.floor(t.y*a);return{x:e,y:i,width:Math.ceil((t.x+t.width)*l)-e,height:Math.ceil((t.y+t.height)*a)-i}})}(s.canvasMasking,t,h,c,r,l);if("skip-frame"===d)return void a.set(e,!1);const v=yield createImageBitmap(t,1>o?{resizeWidth:h,resizeHeight:c,resizeQuality:"medium"}:{resizeWidth:h,resizeHeight:c});u.postMessage({id:e,bitmap:v,width:h,height:c,displayWidth:r,displayHeight:l,dataURLOptions:s.dataURLOptions,maskRegions:d},[v])}catch(t){a.set(e,!1)}}}),function(t){return l.apply(this,arguments)}))),d=requestAnimationFrame(f))};d=requestAnimationFrame(f),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(d),null===(t=u.terminate)||void 0===t||t.call(u),this.resetFrameDedup=null}}initCanvasMutationObserver(t,e,i,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=Td(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=Wu(e.CanvasRenderingContext2D.prototype,l,function(r){return function(...o){return Pc(this.canvas,i,n,!0)||setTimeout(()=>{const i=Sd(o,e,this,s);t(this.canvas,{type:Pu["2D"],property:l,args:i})},0),r.apply(this,o)}});r.push(o)}catch(s){const o=Cc(e.CanvasRenderingContext2D.prototype,l,{set(e){Pc(this.canvas,i,n,!0)||t(this.canvas,{type:Pu["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(...Id(e.WebGLRenderingContext.prototype,Pu.WebGL,t,i,n,e,s)),void 0!==e.WebGL2RenderingContext&&r.push(...Id(e.WebGL2RenderingContext.prototype,Pu.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=>us(t,$u)),{type:s}=i[0];this.mutationCb({id:e,type:s,commands:n}),this.pendingCanvasMutations.delete(t)}},Dd=class{constructor(t){var e;_h(this,"trackedLinkElements",new WeakSet),_h(this,"pendingDeferredSheets",new Set),_h(this,"mutationCb",void 0),_h(this,"adoptedStyleSheetCb",void 0),_h(this,"maskAllElementAttributes",void 0),_h(this,"maskAttributeFn",void 0),_h(this,"styleMirror",new Nc),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(e=t.maskAllElementAttributes)&&void 0!==e&&e,this.maskAttributeFn=t.maskAttributeFn}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}beginDeferredLinkInlining(t,e){if(-1===e||!t.isConnected)return null;let i=null,n=null;try{n=t.sheet,n&&(i=Fh(n))}catch(t){}if(!i||!n)return mh(),null;const s=i;let r=!1;const o={sheet:n,invalidate(){r=!0}};this.pendingDeferredSheets.add(o);let l=!1;return{advance:i=>{if(l)return!0;const a=Gu(),u=Ju();let h=!0;try{if(r)return l=!0,mh(),!0;if(!s.advance(i))return h=!1,!1;l=!0;const o=s.text();if(!t.isConnected)return!0;let a=null;try{a=t.sheet}catch(t){}return a!==n?(mh(),!0):o?(this.emitCssTextMutation(t,e,o),!0):(mh(),!0)}finally{h&&this.pendingDeferredSheets.delete(o),Ku(c=Gu()-a,null!=(d=u)?d:Zu)||(ah.totalMs+=c,c>ah.slowestSliceMs&&(ah.slowestSliceMs=c))}var c,d},remainingRules:()=>s.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(t){if(t&&0!==this.pendingDeferredSheets.size)for(const e of this.pendingDeferredSheets)e.sheet===t&&(this.pendingDeferredSheets.delete(e),e.invalidate())}inlineDeferredLinkElement(t,e){var i;null===(i=this.beginDeferredLinkInlining(t,e))||void 0===i||i.advance(1/0)}emitCssTextMutation(t,e,i){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e,attributes:{_cssText:qh({element:t,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){if(0===t.length)return;const i={id:e,styleIds:[]},n=[];for(const e of t){let t;if(this.styleMirror.has(e))t=this.styleMirror.getId(e);else{const i=this.styleMirror.add(e);t=i;const s=Gu();try{vh(()=>{try{const t=e.rules||e.cssRules;t&&dh(t)}catch(t){}n.push({styleId:i,rules:Array.from(e.rules||CSSRule,(t,i)=>({rule:Ih(t,e.href),index:i}))})})}finally{fh(Gu()-s)}}i.styleIds.push(t)}n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),hc.forEach(t=>t.abort()),hc.clear()}trackStylesheetInLinkElement(t){}},Ld=class{constructor(){_h(this,"nodeMap",new WeakMap),_h(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(){}},Nd=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var qd;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(qd=t.contentWindow)||void 0===qd?void 0:qd.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var jd=new Oh,Bd=new Set([Iu.Mutation,Iu.MediaInteraction,Iu.StyleSheetRule,Iu.CanvasMutation,Iu.Font,Iu.Log,Iu.StyleDeclaration,Iu.AdoptedStyleSheet]);function Hd(t){const e=window;if("function"==typeof e.requestIdleCallback){const i=e.requestIdleCallback(t,{timeout:2e3});return{cancel(){var t;return null===(t=e.cancelIdleCallback)||void 0===t?void 0:t.call(e,i)}}}const i=setTimeout(t,250);return{cancel:()=>clearTimeout(i)}}function zd(t={}){let e;const{emit:i,checkoutEveryNms:n,checkoutEveryNth:s,blockClass:r="rr-block",blockSelector:o=null,ignoreClass:l="rr-ignore",ignoreSelector:a=null,maskTextClass:u="rr-mask",maskTextSelector:h=null,inlineStylesheet:c=!0,inlineStylesheetBudgetRules:d,maskAllInputs:v,maskInputOptions:f,slimDOMOptions:p,maskInputFn:g,maskTextFn:m,maskAllElementAttributes:y=!1,maskAttributeFn:b,hooks:_,packFn:w,sampling:k={},dataURLOptions:S={},canvasResolutionScale:x,canvasMasking:C,mousemoveWait:T,recordDOM:I=!0,recordCanvas:M=!1,recordCrossOriginIframes:E=!1,recordAfter:P=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:R=!1,collectFonts:A=!1,inlineImages:F=!1,plugins:O,keepIframeSrcFn:D=()=>!1,ignoreCSSAttributes:L=new Set([]),attributeFilter:N,errorHandler:q}=t;Qc(q);const j=le({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},S),B=!E||window.parent===window;let H=!1;if(!B)try{window.parent.document&&(H=!1)}catch(t){H=!0}if(B&&!i)throw new Error("emit function is required");if(!B&&!H)return()=>{};void 0!==T&&void 0===k.mousemove&&(k.mousemove=T),jd.reset();const z=!0===v?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==f?f:{password:!0},U=gc(void 0!==p&&p);let W;!function(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();let V=0;const G=new Map;let Z,Q;const J=t=>{for(const e of O||[])e.eventProcessor&&(t=e.eventProcessor(t));return w&&!H&&(t=w(t)),t};Rd=(t,e)=>{var r;const o=t;if(o.timestamp=$c(),!(null===(r=Yc[0])||void 0===r?void 0:r.isFrozen())||o.type===Tu.FullSnapshot||o.type===Tu.IncrementalSnapshot&&Bd.has(o.data.source)||Yc.forEach(t=>t.unfreeze()),B)null==i||i(J(o),e);else if(H){const t={type:"rrweb",event:J(o),origin:window.location.origin,isCheckout:e};window.parent.postMessage(t,"*")}if(o.type===Tu.FullSnapshot)W=o,V=0;else if(o.type===Tu.IncrementalSnapshot){if(o.data.source===Iu.Mutation&&o.data.isAttachIframe)return;V++,(s&&V>=s||n&&o.timestamp-W.timestamp>n)&&Ad(!0)}};const K=t=>{if(t.removes&&t.removes.length>0){const e=t.adds.length>0?new Set(t.adds.map(t=>t.node.id)):null,i=new Set;if(t.adds.length>0)for(const e of t.adds){const t=jd.getNode(e.node.id);t&&"IFRAME"===t.nodeName&&i.add(t)}t.removes.forEach(({id:t})=>{if(e&&e.has(t))return;const n=et.getIframeElementById(t);n&&i.has(n)?et.forgetIframeId(t):(null==Z||Z(t),et.removeIframeById(t))}),null==Q||Q(),et.cleanupDetachedIframes()}Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.Mutation},t)})},Y=t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.Scroll},t)}),X=t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.CanvasMutation},t)}),tt=new Dd({mutationCb:K,adoptedStyleSheetCb:t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.AdoptedStyleSheet},t)}),maskAllElementAttributes:y,maskAttributeFn:b}),et=new dd({mirror:jd,mutationCb:K,stylesheetManager:tt,recordCrossOriginIframes:E,wrappedEmit:Rd});for(const t of O||[])t.getMirror&&t.getMirror({nodeMirror:jd,crossOriginIframeMirror:et.crossOriginIframeMirror,crossOriginIframeStyleMirror:et.crossOriginIframeStyleMirror});const it=new Ld,nt=null==C?void 0:C.configured;Fd=new Od({recordCanvas:M,mutationCb:X,win:window,blockClass:r,blockSelector:o,mirror:jd,sampling:k.canvas,dataURLOptions:j,resolutionScale:x,canvasMasking:C});const st=new vd({mutationCb:K,scrollCb:Y,bypassOptions:{blockClass:r,blockSelector:o,maskTextClass:u,maskTextSelector:h,inlineStylesheet:c,maskInputOptions:z,dataURLOptions:j,maskTextFn:m,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:b,recordCanvas:M,canvasMaskingConfigured:nt,inlineImages:F,sampling:k,slimDOMOptions:U,iframeManager:et,stylesheetManager:tt,canvasManager:Fd,keepIframeSrcFn:D,processedNodeManager:it,attributeFilter:N},mirror:jd});Ad=(t=!1)=>{if(I){uh(d);try{Rd({type:Tu.Meta,data:{href:window.location.href,width:Mc(),height:Ic()}},t),null==e||e.cancel(),e=void 0,tt.reset(),st.init(),Yc.forEach(t=>t.lock());let i=null,n=[];try{i=function(t,e){const{mirror:i=new Oh,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:u=!1,canvasMaskingConfigured:h,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f=!1,maskAttributeFn:p,slimDOM:g=!1,dataURLOptions:m,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:_,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C=()=>!1,maxDepth:T,inlineStylesheetBudgetRules:I}=e||{},M=!0===c?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===c?{password:!0}:c,E=gc(g);uh(I);try{return pc(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:M,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f,maskAttributeFn:p,slimDOMOptions:E,dataURLOptions:m,inlineImages:a,recordCanvas:u,canvasMaskingConfigured:h,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:_,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C,newlyAddedElement:!1,maxDepth:T})}finally{hh()}}(document,{mirror:jd,blockClass:r,blockSelector:o,maskTextClass:u,maskTextSelector:h,inlineStylesheet:c,maskAllInputs:z,inlineStylesheetBudgetRules:d,maskTextFn:m,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:b,slimDOM:U,dataURLOptions:j,recordCanvas:M,canvasMaskingConfigured:nt,inlineImages:F,onSerialize(t){Oc(t,jd)&&et.addIframe(t),Dc(t,jd)&&tt.trackLinkElement(t),Lc(t)&&st.addShadowRoot(Vu.shadowRoot(t),document)},onIframeLoad(t,e){et.attachIframe(t,e),st.observeAttachShadow(t)},onIframeListenerRegistered(t,e){et.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){tt.attachLinkElement(t,e)},keepIframeSrcFn:D})}finally{n=gh()}if(!i)return console.warn("Failed to snapshot the document");if(Rd({type:Tu.FullSnapshot,data:{node:i,initialOffset:Tc(window)}},t),Yc.forEach(t=>t.unlock()),Fd.onFullSnapshot(),n.length){const t=function(t,e,i){let n=!1,s=null,r=0,o=null;const l=()=>null!==o||t.length>r,a=()=>{const i=t[r];t[r]=null,r+=1,i&&_c(()=>{o=e.beginDeferredLinkInlining(i,jd.getId(i))})},u=()=>{if(!o)return;const t=o;let e=!0;_c(()=>{e=t.advance(200)}),e&&(o=null)},h=()=>{o||a(),u()},c=t=>{if(s=null,n)return;let e=0;do{try{h()}catch(t){null==o||o.discard(),o=null,yh(1)}e+=1}while(!n&&l()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));n||(l()?s=Hd(c):i())};return s=Hd(c),{cancel(){n=!0,null==o||o.discard(),o=null,null==s||s.cancel(),s=null},flush(){if(n)return;n=!0,null==s||s.cancel(),s=null;let e=0,h=0;for(;l()&&50>e;){o||a();const t=o;if(t)if(Math.floor(t.remainingRules()/200)+1>50-e)t.discard(),o=null,h+=1;else{try{u()}catch(t){null==o||o.discard(),o=null,h+=1}e+=1}}if(l()||h>0){let e=h+(null!==o?1:0);for(let i=r;t.length>i;i++)null!==t[i]&&(e+=1);yh(e),null==o||o.discard(),o=null}i()}}}(n,tt,()=>{e===t&&(e=void 0)});e=t}E&&et.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&tt.adoptStyleSheets(document.adoptedStyleSheets,jd.getId(document))}finally{hh()}}};try{const t=[];t.push(yc("pagehide",()=>{try{null==e||e.flush()}catch(t){}e=void 0},window));for(const e of["visibilitychange","freeze","resume"])t.push(yc(e,Qu,document));Z=e=>{const i=G.get(e);i&&(i.forEach(e=>{_c(e);const i=t.indexOf(e);-1!==i&&t.splice(i,1)}),G.delete(e))},Q=()=>{for(const[t]of G){const e=jd.getNode(t);if(e)try{e.contentDocument&&e.contentDocument.defaultView||null==Z||Z(t)}catch(e){null==Z||Z(t)}else null==Z||Z(t)}};const i=t=>{var e;return Kc(ad)({mutationCb:K,mousemoveCb:(t,e)=>Rd({type:Tu.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.MouseInteraction},t)}),scrollCb:Y,viewportResizeCb:t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.ViewportResize},t)}),inputCb:t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.Input},t)}),mediaInteractionCb:t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.MediaInteraction},t)}),styleSheetRuleCb:t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.StyleSheetRule},t)}),styleDeclarationCb:t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.StyleDeclaration},t)}),canvasMutationCb:X,fontCb:t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.Font},t)}),selectionCb(t){Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.Selection},t)})},customElementCb(t){Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.CustomElement},t)})},blockClass:r,ignoreClass:l,ignoreSelector:a,maskTextClass:u,maskTextSelector:h,maskInputOptions:z,inlineStylesheet:c,sampling:k,recordDOM:I,recordCanvas:M,canvasMaskingConfigured:nt,inlineImages:F,userTriggeredOnInput:R,collectFonts:A,doc:t,maskInputFn:g,maskTextFn:m,maskAllElementAttributes:y,maskAttributeFn:b,keepIframeSrcFn:D,blockSelector:o,slimDOMOptions:U,dataURLOptions:j,mirror:jd,iframeManager:et,stylesheetManager:tt,shadowDomManager:st,processedNodeManager:it,canvasManager:Fd,ignoreCSSAttributes:L,attributeFilter:N,plugins:(null==O||null===(e=O.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({observer:t.observer,options:t.options,callback:e=>Rd({type:Tu.Plugin,data:{plugin:t.name,payload:e}})})))||[]},_)};et.addLoadListener(e=>{try{const n=jd.getId(e),s=i(e.contentDocument);if("function"==typeof s&&(t.push(s),-1!==n)){let t=G.get(n);t||(t=new Set,G.set(n,t)),t.add(s)}}catch(t){console.warn(t)}}),et.addPageHideListener(t=>{const e=jd.getId(t);null==Z||Z(e),id(t)});let n=-1;const s=t=>Rd({type:Tu.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),d=()=>{var t,e,i,r;const o=document,l=null!==(t=null!==(e=null!==(i=null!==(r=o.fullscreenElement)&&void 0!==r?r:o.webkitFullscreenElement)&&void 0!==i?i:o.mozFullScreenElement)&&void 0!==e?e:o.msFullscreenElement)&&void 0!==t?t:null,a=l?jd.getId(l):-1;a!==n&&(-1!==n&&s({id:n,enter:!1}),n=a,-1!==a&&s({id:a,enter:!0}))},v=()=>{Ad();const e=i(document);"function"==typeof e&&t.push(e),t.push(yc("fullscreenchange",d)),t.push(yc("webkitfullscreenchange",d)),t.push(yc("mozfullscreenchange",d)),t.push(yc("MSFullscreenChange",d)),Nd=!0};return["interactive","complete"].includes(document.readyState)?v():(t.push(yc("DOMContentLoaded",()=>{Rd({type:Tu.DomContentLoaded,data:{}}),"DOMContentLoaded"===P&&v()})),t.push(yc("load",()=>{Rd({type:Tu.Load,data:{}}),"load"===P&&v()},window))),()=>{try{null==e||e.flush()}catch(t){}e=void 0,wc(t),it.destroy(),et.removeLoadListener(),et.destroy(),G.clear(),st.reset(),jd.reset(),Nd=!1,Jc()}}catch(t){console.warn(t)}}zd.addCustomEvent=(t,e)=>{if(!Nd)throw new Error("please add custom event after start recording");Rd({type:Tu.Custom,data:{tag:t,payload:e}})},zd.freezePage=()=>{Yc.forEach(t=>t.freeze())},zd.takeFullSnapshot=t=>{if(!Nd)throw new Error("please take full snapshot after start recording");Ad(t)},zd.mirror=jd,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date;var Ud=Object.create(null);function Wd(t){return Wd="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},Wd(t)}function Vd(t,e,i){return(e=function(t){var e=function(t){if("object"!=Wd(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Wd(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Wd(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}Ud.Node=Object.create(null),Ud.ShadowRoot=Object.create(null),Ud.MutationObserver=Object.create(null),Ud.Element=Object.create(null);var Gd=class{constructor(t){Vd(this,"fileName",void 0),Vd(this,"functionName",void 0),Vd(this,"lineNumber",void 0),Vd(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}`}},Zd=/(^|@)\S+:\d+/,Qd=/^\s*at .*(\S+:\d+|\(native\))/m,Jd=/^(eval@)?(\[native code])?$/,Kd={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(Qd)?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(Qd)},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 Gd({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(Jd)},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 Gd({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(e),n=i&&i[1]?i[1]:void 0,s=this.extractLocation(t.replace(e,""));return new Gd({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 Gd({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 Gd({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(Zd)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),i=this.extractLocation(e.pop());return new Gd({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function Yd(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 Xd(t){return Array.isArray(t)}function tv(t){return"object"==typeof t&&null!==t&&!Xd(t)}function ev(t,e){if(0===e)return!0;const i=Object.keys(t);for(const n of i)if(tv(t[n])&&ev(t[n],e-1))return!0;return!1}function iv(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(tv(r=e)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||tv(r)&&ev(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]=Xd(n)?Yd(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 nv={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 sv(t,e,i){const n=i?Object.assign({},nv,i):nv,s=n.logger;if(!s)return()=>{};let r;r="string"==typeof s?e[s]:s;let o=0,l=!1;const a=[];if(n.level.includes("error")){const i=e=>{const i=e.message;t({level:"error",trace:Kd.parse(e.error).map(t=>t.toString()),payload:[iv(i,n.stringifyOptions)]})};e.addEventListener("error",i),a.push(()=>{e.removeEventListener("error",i)});const s=e=>{let i,s;e.reason instanceof Error?(i=e.reason,s=[iv(`Uncaught (in promise) ${i.name}: ${i.message}`,n.stringifyOptions)]):(i=new Error,s=[iv("Uncaught (in promise)",n.stringifyOptions),iv(e.reason,n.stringifyOptions)]),t({level:"error",trace:Kd.parse(i).map(t=>t.toString()),payload:s})};e.addEventListener("unhandledrejection",s),a.push(()=>{e.removeEventListener("unhandledrejection",s)})}for(const t of n.level)a.push(u(r,t));return()=>{a.forEach(t=>t())};function u(e,i){return e[i]?function(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()=>{}}}(e,i,e=>(...s)=>{if(e.apply(this,s),!("assert"===i&&s[0]||l)){l=!0;try{const e=Kd.parse(new Error).map(t=>t.toString()).splice(1),r=("assert"===i?s.slice(1):s).map(t=>iv(t,n.stringifyOptions));o++,n.lengthThreshold>o?t({level:i,trace:e,payload:r}):o===n.lengthThreshold&&t({level:"warn",trace:[],payload:[iv("The number of log records reached the threshold.")]})}catch(t){e("rrweb logger error:",t,...s)}finally{l=!1}}}):()=>{}}}var rv=t=>({name:"rrweb/console@1",observer:sv,options:t});const ov=()=>{},lv=t=>{var e;if(ke(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function av(t,e,i){try{if(!(e in t))return ov;const n={next:t[e]},s=i(function(...t){return n.next.apply(this,t)});return ke(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=lv(i);for(;r;){if(r.next===s)return void(r.next=n.next);i=r.next,r=lv(i)}}}catch(t){return ov}}function uv(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 hv=As("[Recorder]"),cv=t=>"navigation"===t.entryType,dv=t=>"resource"===t.entryType;function vv(t,e){return!!e&&(Re(e)||e[t])}function fv(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 pv=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function gv({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:!!fv(e)&&t(e.url)}catch(t){return!1}}(n))return!1;if(s(pv))return!1;if(Re(e))return!0;if(we(e))return s(e);const r=e[t];return Re(r)?r:s(r)}function mv(t,e,i,n,s){return yv.apply(this,arguments)}function yv(){return yv=ne(function*(t,e,i,n,s,r=0){if(r>10)return hv.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=>dv(t)&&t.initiatorType===e&&(Ce(n)||t.startTime>=n)&&(Ce(s)||s>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*r)),mv(t,e,i,n,s,r+1))}),yv.apply(this,arguments)}function bv({body:t,options:e,url:i}){if(Me(t))return null;const{hostname:n,isHostDenied:s}=uv(i,e);if(s)return n+" is in deny list";if($e(t))return t;if((t=>"u">typeof Document&&t instanceof Document)(t))return t.textContent;if(Ae(t))return Qs(t);if(Se(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 _v=t=>!Ie(t)&&("navigation"===t.entryType||"resource"===t.entryType);function wv({entry:t,method:e,status:i,networkRequest:n,isInitial:s,start:r,end:o,url:l,initiatorType:a}){r=t?t.startTime:r,o=t?t.responseEnd:o;const u=Math.floor(Date.now()-performance.now()),h=Math.floor(u+(r||0)),c=[le(le({},t?t.toJSON():{name:l}),{},{startTime:Ce(r)?void 0:Math.round(r),endTime:Ce(o)?void 0:Math.round(o),timeOrigin:u,timestamp:h,method:e,initiatorType:a||(t?t.initiatorType:void 0),status:i,requestHeaders:n.requestHeaders,requestBody:n.requestBody,responseHeaders:n.responseHeaders,responseBody:n.responseBody,isInitial:s})];if(_v(t))for(const e of t.serverTiming||[])c.push({timeOrigin:u,timestamp:h,startTime:Math.round(t.startTime),name:e.name,duration:e.duration,entryType:"serverTiming"});return c}const kv=["video/","audio/"];function Sv(t){return Se(t)&&ke(t.getReader)&&ke(t.tee)}const xv="[SessionReplay] Timeout while trying to read body",Cv="[SessionReplay] Failed to read body";function $v(t){return`${Cv}: ${t}`}function Tv(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function Iv(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const i=setTimeout(()=>e(xv),500);try{t.clone().text().then(t=>e(t),t=>e($v(t))).finally(()=>clearTimeout(i))}catch(t){clearTimeout(i),e(Cv)}})}(t);const i=Ur(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(Tv(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(xv),500);let a;try{a=t.clone()}catch(t){return void o(Cv)}const u=a.body;if(!Sv(u)||"undefined"==typeof TextDecoder){try{a.text().then(t=>o(t),t=>o($v(t)))}catch(t){o(Cv)}return}try{n=u.getReader()}catch(t){return void o(Cv)}const h=[];let c=0;!function t(){n.read().then(({done:i,value:n})=>{if(s)r();else if(i)o((new TextDecoder).decode(function(t,e){const i=new Uint8Array(e);let n=0;for(const e of t)i.set(e,n),n+=e.byteLength;return i}(h,c)));else{if(n){if(c+n.byteLength>e)return void o(Tv(e));c+=n.byteLength,h.push(n)}t()}},t=>o($v(t)))}()})}(t,i)}function Mv(){return Mv=ne(function*({r:t,options:e,url:i}){const{hostname:n,isHostDenied:s}=uv(i,e);return s?Promise.resolve(n+" is in deny list"):Iv(t,e)}),Mv.apply(this,arguments)}function Ev(){return Ev=ne(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=kv.some(t=>null==s?void 0:s.startsWith(t));if(s&&r)return`Content-Type ${s} is not supported`;const{hostname:o,isHostDenied:l}=uv(i,e);return l?o+" is in deny list":null}({r:t,options:e,url:i});return Ie(n)?Iv(t,e):Promise.resolve(n)}),Ev.apply(this,arguments)}let Pv=null;function Rv(t,e,i){if(!("performance"in e))return()=>{};if(Pv)return hv.warn("Network observer already initialised, doing nothing"),()=>{};const n=i?Object.assign({},Wr,i):Wr,s=e=>{const i=[];let s=!1;e.requests.forEach(t=>{const e="serverTiming"===t.entryType;if(e&&s)return;const r=n.maskRequestFn(t);e||(s=!r||(t=>!!t&&Xr.has(t))(r)),r&&i.push(r)}),i.length>0&&t(le(le({},e),{},{requests:i}))},r=function(t,e,i){i.recordInitialRequests&&t({requests:e.performance.getEntries().filter(t=>cv(t)||dv(t)&&i.initiatorTypes.includes(t.initiatorType)).flatMap(t=>wv({entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0});const n=new e.PerformanceObserver(e=>{t({requests:e.getEntries().filter(t=>cv(t)||dv(t)&&i.initiatorTypes.includes(t.initiatorType)&&(t=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>wv({entry:t,method:void 0,status:void 0,networkRequest:{}}))})}),s=PerformanceObserver.supportedEntryTypes.filter(t=>i.performanceEntryTypeToObserve.includes(t));return n.observe({entryTypes:s}),()=>{n.disconnect()}}(s,e,n);let o=()=>{},l=()=>{};return(n.recordHeaders||n.recordBody)&&(o=function(t,e,i){if(!i.initiatorTypes.includes("xmlhttprequest"))return()=>{};const n=vv("request",i.recordHeaders),s=vv("response",i.recordHeaders),r=av(e.XMLHttpRequest.prototype,"open",r=>function(o,l,a=!0,u,h){const c=this;try{const r=new Request(l),a={};let u,h;const d={},v=c.setRequestHeader.bind(c);c.setRequestHeader=(t,e)=>(d[t]=e,v(t,e)),n&&(a.requestHeaders=d);const f=c.send.bind(c);c.send=t=>(gv({type:"request",headers:d,url:l,recordBody:i.recordBody})&&(a.requestBody=bv({body:t,options:i,url:l})),u=e.performance.now(),f(t));const p=()=>{c.removeEventListener("readystatechange",g),c.removeEventListener("error",p),c.removeEventListener("abort",p),c.removeEventListener("timeout",p)},g=()=>{if(c.readyState!==c.DONE)return;p(),h=e.performance.now();const n={};c.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(t=>{const e=t.split(": "),i=e.shift(),s=e.join(": ");i&&(n[i]=s)}),s&&(a.responseHeaders=n),gv({type:"response",headers:n,url:l,recordBody:i.recordBody})&&(a.responseBody=bv({body:c.response,options:i,url:l})),mv(e,"xmlhttprequest",r.url,u,h).then(e=>{t({requests:wv({entry:e,method:o,status:null==c?void 0:c.status,networkRequest:a,start:u,end:h,url:l.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};c.addEventListener("readystatechange",g),c.addEventListener("error",p),c.addEventListener("abort",p),c.addEventListener("timeout",p)}catch(t){hv.error("Failed to instrument XHR for network capture",t)}r.call(c,o,l.toString(),a,u,h)});return()=>{r()}}(s,e,n),l=function(t,e,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=vv("request",i.recordHeaders),s=vv("response",i.recordHeaders),r=av(e,"fetch",r=>function(){var o=ne(function*(o,l){let a,u;try{a=new Request(o,l)}catch(t){return hv.error("Failed to instrument fetch for network capture",t),r(o,l)}const h={};let c,d;try{try{const t={};a.headers.forEach((e,i)=>{t[i]=e}),n&&(h.requestHeaders=t),!Sv(null==l?void 0:l.body)&&gv({type:"request",headers:t,url:o,recordBody:i.recordBody})&&(h.requestBody=yield function(t){return Mv.apply(this,arguments)}({r:a,options:i,url:o}))}catch(t){hv.error("Failed to record fetch request for network capture",t)}c=e.performance.now(),u=fv(o)?yield r(a):yield r(o,l),d=e.performance.now();try{const t={};u.headers.forEach((e,i)=>{t[i]=e}),s&&(h.responseHeaders=t),gv({type:"response",headers:t,url:o,recordBody:i.recordBody})&&(h.responseBody=yield function(t){return Ev.apply(this,arguments)}({r:u,options:i,url:o}))}catch(t){hv.error("Failed to record fetch response for network capture",t)}return u}finally{mv(e,"fetch",a.url,c,d).then(e=>{t({requests:wv({entry:e,method:a.method,status:null==u?void 0:u.status,networkRequest:h,start:c,end:d,url:a.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(t,e){return o.apply(this,arguments)}}());return()=>{r()}}(s,e,n)),Pv=()=>{r(),o(),l(),Pv=null},Pv}const Av=t=>({name:"rrweb/network@1",observer:Rv,options:t});var Fv,Ov,Dv,Lv,Nv,qv,jv,Bv,Hv,zv,Uv,Wv,Vv,Gv,Zv;d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:rv,getRecordNetworkPlugin:Av},d.__PosthogExtensions__.rrweb={record:zd,version:"v2",wasMaxDepthReached:()=>fc,resetMaxDepthState(){fc=!1,vc=!1},getLastSnapshotCost:()=>ih,getMutationCost:()=>le({},lh),resetSnapshotCostState(){Yu=0,Xu=0,th=0,Zu=0,eh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},ih=null,nh=null,sh=[],rh=0,oh=0,lh={slowestBatchMs:0},ah={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},d.rrweb={record:zd,version:"v2"},d.rrwebConsoleRecord={getRecordConsolePlugin:rv},d.getRecordNetworkPlugin=Av,d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initSessionRecording=(t,e)=>new Cu(t,e);var Qv,Jv,Kv,Yv,Xv={},tf=[],ef=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,nf=Array.isArray;function sf(t,e){for(var i in e)t[i]=e[i];return t}function rf(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function of(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?Fv.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 lf(t,o,n,s,null)}function lf(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?++Dv:s,__i:-1,__u:0};return null==s&&null!=Ov.vnode&&Ov.vnode(r),r}function af(t){return t.children}function uf(t,e){this.props=t,this.context=e}function hf(t,e){if(null==e)return t.__?hf(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?hf(t):null}function cf(t){if(t.__P&&t.__d){var e=t.__v,i=e.__e,n=[],s=[],r=sf({},e);r.__v=e.__v+1,Ov.vnode&&Ov.vnode(r),wf(t.__P,r,e,t.__n,t.__P.namespaceURI,32&e.__u?[i]:null,n,null==i?hf(e):i,!!(32&e.__u),s),r.__v=e.__v,r.__.__k[r.__i]=r,Sf(n,r,s),e.__e=e.__=null,r.__e!=i&&df(r)}}function df(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}),df(t)}function vf(t){(!t.__d&&(t.__d=!0)&&Lv.push(t)&&!ff.__r++||Nv!=Ov.debounceRendering)&&((Nv=Ov.debounceRendering)||qv)(ff)}function ff(){try{for(var t,e=1;Lv.length;)Lv.length>e&&Lv.sort(jv),t=Lv.shift(),e=Lv.length,cf(t)}finally{Lv.length=ff.__r=0}}function pf(t,e,i,n,s,r,o,l,a,u,h){var c,d,v,f,p,g,m,y=n&&n.__k||tf,b=e.length;for(a=function(t,e,i,n,s){var r,o,l,a,u,h=i.length,c=h,d=0;for(t.__k=new Array(s),r=0;s>r;r++)null!=(o=e[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=t.__k[r]=lf(null,o,null,null,null):nf(o)?o=t.__k[r]=lf(af,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=t.__k[r]=lf(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):t.__k[r]=o,a=r+d,o.__=t,o.__b=t.__b+1,l=null,-1!=(u=o.__i=mf(o,i,a,c))&&(c--,(l=i[u])&&(l.__u|=2)),null==l||null==l.__v?(-1==u&&(s>h?d--:h>s&&d++),"function"!=typeof o.type&&(o.__u|=4)):u!=a&&(u==a-1?d--:u==a+1?d++:(u>a?d--:d++,o.__u|=4))):t.__k[r]=null;if(c)for(r=0;h>r;r++)null!=(l=i[r])&&!(2&l.__u)&&(l.__e==n&&(n=hf(l)),$f(l,l));return n}(i,e,y,a,b),c=0;b>c;c++)null!=(v=i.__k[c])&&(d=-1!=v.__i&&y[v.__i]||Xv,v.__i=c,g=wf(t,v,d,s,r,o,l,a,u,h),f=v.__e,v.ref&&d.ref!=v.ref&&(d.ref&&Cf(d.ref,null,v),h.push(v.ref,v.__c||f,v)),null==p&&null!=f&&(p=f),(m=!!(4&v.__u))||d.__k===v.__k?(a=gf(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 gf(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=gf(s[r],e,i,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=hf(t)),i.insertBefore(t.__e,e||null)),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function mf(t,e,i,n){var s,r,o,l=t.key,a=t.type,u=e[i],h=null!=u&&!(2&u.__u);if(null===u&&null==l||h&&l==u.key&&a==u.type)return i;if(n>(h?1:0))for(s=i-1,r=i+1;s>=0||e.length>r;)if(null!=(u=e[o=0>s?r++:s--])&&!(2&u.__u)&&l==u.key&&a==u.type)return o;return-1}function yf(t,e,i){"-"==e[0]?t.setProperty(e,null==i?"":i):t[e]=null==i?"":"number"!=typeof i||ef.test(e)?i:i+"px"}function bf(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||yf(t.style,e,"");if(i)for(e in i)n&&i[e]==n[e]||yf(t.style,e,i[e])}else if("o"==e[0]&&"n"==e[1])r=e!=(e=e.replace(Uv,"$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[zv]=n[zv]:(i[zv]=Wv,t.addEventListener(e,r?Gv:Vv,r)):t.removeEventListener(e,r?Gv:Vv,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 _f(t){return function(e){if(this.l){var i=this.l[e.type+t];if(null==e[Hv])e[Hv]=Wv++;else if(i[zv]>e[Hv])return;return i(Ov.event?Ov.event(e):e)}}}function wf(t,e,i,n,s,r,o,l,a,u){var h,c,d,v,f,p,g,m,y,b,$,_,w,k,S,x,C=e.type;if(void 0!==e.constructor)return null;128&i.__u&&(a=!!(32&i.__u),r=[l=e.__e=i.__e]),(h=Ov.__b)&&h(e);t:if("function"==typeof C){c=o.length;try{if(y=e.props,b=C.prototype&&C.prototype.render,$=(h=C.contextType)&&n[h.__c],_=h?$?$.props.value:h.__:n,i.__c?m=(d=e.__c=i.__c).__=d.__E:(b?e.__c=d=new C(y,_):(e.__c=d=new uf(y,_),d.constructor=C,d.render=Tf),$&&$.sub(d),d.state||(d.state={}),d.__n=n,v=d.__d=!0,d.__h=[],d._sb=[]),b&&null==d.__s&&(d.__s=d.state),b&&null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=sf({},d.__s)),sf(d.__s,C.getDerivedStateFromProps(y,d.__s))),f=d.props,p=d.state,d.__v=e,v)b&&null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),b&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(b&&null==C.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,_),e.__v==i.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,_)){e.__v!=i.__v&&(d.props=y,d.state=d.__s,d.__d=!1),e.__e=i.__e,e.__k=i.__k,e.__k.some(function(t){t&&(t.__=e)}),tf.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=Ov.__r,k=0,b)d.state=d.__s,d.__d=!1,w&&w(e),h=d.render(d.props,d.state,d.context),tf.push.apply(d.__h,d._sb),d._sb=[];else do{d.__d=!1,w&&w(e),h=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&25>++k);d.state=d.__s,null!=d.getChildContext&&(n=sf(sf({},n),d.getChildContext())),b&&!v&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(f,p)),S=null!=h&&h.type===af&&null==h.key?xf(h.props.children):h,l=pf(t,nf(S)?S:[S],e,i,n,s,r,o,l,a,u),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),m&&(d.__E=d.__=null)}catch(t){if(o.length=c,e.__v=null,a||null!=r)if(t.then){for(e.__u|=a?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;null!=r&&(r[r.indexOf(l)]=null),e.__e=l}else{if(null!=r)for(x=r.length;x--;)rf(r[x]);kf(e)}else e.__e=i.__e,!e.__k&&i.__k&&(e.__k=i.__k),t.then||kf(e);Ov.__e(t,e,i)}}else null==r&&e.__v==i.__v?(e.__k=i.__k,e.__e=i.__e):l=e.__e=function(t,e,i,n,s,r,o,l,a){var u,h,c,d,v,f,p,g=i.props||Xv,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&&(Ov.__m&&Ov.__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&&Fv.call(t.childNodes),!l&&null!=r)for(g={},u=0;t.attributes.length>u;u++)g[(v=t.attributes[u]).name]=v.value;for(u in g)v=g[u],"dangerouslySetInnerHTML"==u?c=v:"children"==u||u in m||"value"==u&&"defaultValue"in m||"checked"==u&&"defaultChecked"in m||bf(t,u,null,v,s);for(u in m)v=m[u],"children"==u?d=v:"dangerouslySetInnerHTML"==u?h=v:"value"==u?f=v:"checked"==u?p=v:l&&"function"!=typeof v||g[u]===v||bf(t,u,v,g[u],s);if(h)l||c&&(h.__html==c.__html||h.__html==t.innerHTML)||(t.innerHTML=h.__html),e.__k=[];else if(c&&(t.innerHTML=""),pf("template"==e.type?t.content:t,nf(d)?d:[d],e,i,n,"foreignObject"==y?"http://www.w3.org/1999/xhtml":s,r,o,r?r[0]:i.__k&&hf(i,0),l,a),null!=r)for(u=r.length;u--;)rf(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])&&bf(t,u,f,g[u],s),u="checked",null!=p&&p!=t[u]&&bf(t,u,p,g[u],s))}return t}(i.__e,e,i,n,s,r,o,a,u);return(h=Ov.diffed)&&h(e),128&e.__u?void 0:l}function kf(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(kf))}function Sf(t,e,i){for(var n=0;i.length>n;n++)Cf(i[n],i[++n],i[++n]);Ov.__c&&Ov.__c(e,t),t.some(function(e){try{t=e.__h,e.__h=[],t.some(function(t){t.call(e)})}catch(t){Ov.__e(t,e.__v)}})}function xf(t){return"object"!=typeof t||null==t||t.__b>0?t:nf(t)?t.map(xf):void 0!==t.constructor?null:sf({},t)}function Cf(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){Ov.__e(t,i)}}function $f(t,e,i){var n,s;if(Ov.unmount&&Ov.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Cf(n,null,e)),null!=(n=t.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(t){Ov.__e(t,e)}n.base=n.__P=n.__n=null}if(n=t.__k)for(s=0;n.length>s;s++)n[s]&&$f(n[s],e,i||"function"!=typeof t.type);i||rf(t.__e),t.__c=t.__=t.__e=void 0}function Tf(t,e,i){return this.constructor(t,i)}function If(t,e,i){var n,s,r,o;e==document&&(e=document.documentElement),Ov.__&&Ov.__(t,e),s=(n="function"==typeof i)?null:i&&i.__k||e.__k,r=[],o=[],wf(e,t=(!n&&i||e).__k=of(af,null,[t]),s||Xv,Xv,e.namespaceURI,!n&&i?[i]:s?null:e.firstChild?Fv.call(e.childNodes):null,r,!n&&i?i:s?s.__e:e.firstChild,n,o),Sf(r,t,o),t.props.children=null}Fv=tf.slice,Ov={__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}},Dv=0,uf.prototype.setState=function(t,e){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=sf({},this.state);"function"==typeof t&&(t=t(sf({},i),this.props)),t&&sf(i,t),null!=t&&this.__v&&(e&&this._sb.push(e),vf(this))},uf.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),vf(this))},uf.prototype.render=af,Lv=[],qv="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,jv=function(t,e){return t.__v.__b-e.__v.__b},ff.__r=0,Bv=Math.random().toString(8),Hv="__d"+Bv,zv="__a"+Bv,Uv=/(PointerCapture)$|Capture$/i,Wv=0,Vv=_f(!1),Gv=_f(!0),Zv=0;var Mf=0,Ef=[],Pf=Ov,Rf=Pf.__b,Af=Pf.__r,Ff=Pf.diffed,Of=Pf.__c,Df=Pf.unmount,Lf=Pf.__;function Nf(t,e){Pf.__h&&Pf.__h(Jv,t,Mf||e),Mf=0;var i=Jv.__H||(Jv.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function qf(t){return Mf=1,function(t,e){var i=Nf(Qv++,2);if(i.t=t,!i.__c&&(i.__=[Jf(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=Jv,!Jv.__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};Jv.__f=!0;var s=Jv.shouldComponentUpdate,r=Jv.componentWillUpdate;Jv.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)},Jv.shouldComponentUpdate=n}return i.__N||i.__}(Jf,t)}function jf(t,e){var i=Nf(Qv++,3);!Pf.__s&&Qf(i.__H,e)&&(i.__=t,i.u=e,Jv.__H.__h.push(i))}function Bf(t){return Mf=5,Hf(function(){return{current:t}},[])}function Hf(t,e){var i=Nf(Qv++,7);return Qf(i.__H,e)&&(i.__=t(),i.__H=e,i.__h=t),i.__}function zf(t){var e=Jv.context[t.__c],i=Nf(Qv++,9);return i.c=t,e?(null==i.__&&(i.__=!0,e.sub(Jv)),e.props.value):t.__}function Uf(){for(var t;t=Ef.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(Gf),e.__h.some(Zf),e.__h=[]}catch(i){e.__h=[],Pf.__e(i,t.__v)}}}Pf.__b=function(t){Jv=null,Rf&&Rf(t)},Pf.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Lf&&Lf(t,e)},Pf.__r=function(t){Af&&Af(t),Qv=0;var e=(Jv=t.__c).__H;e&&(Kv===Jv?(e.__h=[],Jv.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.length&&Uf(),Qv=0)),Kv=Jv},Pf.diffed=function(t){Ff&&Ff(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==Ef.push(e)&&Yv===Pf.requestAnimationFrame||((Yv=Pf.requestAnimationFrame)||Vf)(Uf)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),Kv=Jv=null},Pf.__c=function(t,e){e.some(function(t){try{t.__h.some(Gf),t.__h=t.__h.filter(function(t){return!t.__||Zf(t)})}catch(i){e.some(function(t){t.__h&&(t.__h=[])}),e=[],Pf.__e(i,t.__v)}}),Of&&Of(t,e)},Pf.unmount=function(t){Df&&Df(t);var e,i=t.__c;i&&i.__H&&(i.__H.__.some(function(t){try{Gf(t)}catch(t){e=t}}),i.__H=void 0,e&&Pf.__e(e,i.__v))};var Wf="function"==typeof requestAnimationFrame;function Vf(t){var e,i=function(){clearTimeout(n),Wf&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(i,35);Wf&&(e=requestAnimationFrame(i))}function Gf(t){var e=Jv,i=t.__c;"function"==typeof i&&(t.__c=void 0,i()),Jv=e}function Zf(t){var e=Jv;t.__c=t.__(),Jv=e}function Qf(t,e){return!t||t.length!==e.length||e.some(function(e,i){return e!==t[i]})}function Jf(t,e){return"function"==typeof e?e(t):e}const Kf="gzip-js",Yf="base64",Xf="events",tp="cancelEvents",ep="tab",ip="left",np="center",sp="right",rp="next_to_trigger",op="popover",lp="widget",ap="external_survey",up="open",hp="multiple_choice",cp="single_choice",dp="rating",vp="end",fp="always",pp="survey shown",gp="survey dismissed",mp="survey sent",yp="$survey_id",bp="$survey_name",_p="$survey_iteration",wp="$survey_iteration_start_date",kp="$survey_partially_completed",Sp="$survey_submission_id",xp="$survey_completed",Cp="$survey_last_seen_date",$p="$survey_language",Tp="popover";function Ip(t){let e=!0;return{dispose(){if(e){e=!1;const i=t();i&&ke(i.then)&&i.then(void 0,()=>{})}}}}const Mp=As("[Surveys]"),Ep="PostHog is not capturing, so a survey response cannot be recorded";function Pp(t){return ke(t.is_capturing)?t.is_capturing():!t.has_opted_out_capturing()}function Rp(t){return!(!t.start_date||t.end_date)}function Ap(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 Fp=(t,e)=>`${t}${function(t){return t.current_iteration&&t.current_iteration>0?`${t.id}_${t.current_iteration}`:t.id}(e)}`,Op=t=>Fp("seenSurvey_",t),Dp=t=>{try{const e=Op(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){Mp.error("Failed to persist survey seen state",t)}},Lp=[op,lp,"api"],Np={ignoreConditions:!1,ignoreDelay:!1,displayType:Tp},qp="logs",jp=As("[Stylesheet Loader]"),Bp=t,Hp=n,zp="#020617",Up={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:sp,widgetType:ep,widgetLabel:"Feedback",widgetColor:"black",zIndex:String(2147483645),disabledButtonOpacity:"0.6",maxWidth:"300px",textSubtleColor:"#939393",boxPadding:"20px 24px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"10px",shuffleQuestions:!1,surveyPopupDelaySeconds:void 0,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:zp,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},Wp=[np,ip,sp];function Vp(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 Gp(t=Up.backgroundColor){let e;"#"===t[0]&&(e=Vp(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=Vp(i)),!e)return zp;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?zp:"white"}return zp}const Zp=(t,e,i)=>{const n=vg(t),s=Hp.querySelector(`.${n}`);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};const r=Hp.createElement("div");((t,e,i)=>{const n=le(le({},Up),i),s=t.style,r=!Wp.includes(n.position)||e===lp&&(null==i?void 0:i.widgetType)===ep;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)||Gp(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",Gp(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||Gp(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",Gp(n.widgetColor)),s.setProperty("--ph-widget-z-index",n.zIndex);const o=(null==i?void 0:i.inputBackground)||(null==i?void 0:i.inputBackgroundColor);let l=o||n.inputBackground;o||"white"!==n.backgroundColor||(l="#f8f8f8"),s.setProperty("--ph-survey-input-background",l);const a=(null==i?void 0:i.inputTextColor)||Gp(l);s.setProperty("--ph-survey-input-text-color",a),s.setProperty("--ph-survey-rating-text-color",a),s.setProperty("--ph-survey-scrollbar-thumb-color",n.scrollbarThumbColor),s.setProperty("--ph-survey-scrollbar-track-color",n.scrollbarTrackColor),s.setProperty("--ph-survey-outline-color",n.outlineColor)})(r,t.type,t.appearance),r.className=n;const o=r.attachShadow({mode:"open"}),l=function(t){const e=((t,e,i)=>{let n=t.createElement("style");n.innerText=e;const s=(t=>{var e;return ke(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||(jp.error("prepare_external_dependency_stylesheet returned null"),null)})(Hp,':host{--ph-survey-font-family:-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--ph-survey-box-padding:20px 24px;--ph-survey-max-width:300px;--ph-survey-z-index:calc(2147480000 + 3645);--ph-survey-border-color:#dcdcdc;--ph-survey-border-bottom:1.5px solid var(--ph-survey-border-color);--ph-survey-border-radius:10px;--ph-survey-background-color:#eeeded;--ph-survey-box-shadow:0 4px 12px #00000026;--ph-survey-submit-button-color:black;--ph-survey-submit-button-text-color:white;--ph-survey-rating-bg-color:white;--ph-survey-rating-text-color:#020617;--ph-survey-rating-active-bg-color:black;--ph-survey-rating-active-text-color:white;--ph-survey-text-primary-color:#020617;--ph-survey-text-subtle-color:#939393;--ph-widget-color:#e0a045;--ph-widget-text-color:white;--ph-survey-scrollbar-thumb-color:var(--ph-survey-border-color);--ph-survey-scrollbar-track-color:var(--ph-survey-background-color);--ph-survey-outline-color:#3b82f6cc;--ph-survey-input-background:white;--ph-survey-input-text-color:#020617;--ph-survey-disabled-button-opacity:.6}.ph-survey{min-width:300px;width:var(--ph-survey-max-width);max-width:85%;z-index:var(--ph-survey-z-index);height:fit-content;margin:0;position:fixed;bottom:0}.ph-survey h3,.ph-survey p{margin:0}.ph-survey *{box-sizing:border-box;font-family:var(--ph-survey-font-family);color:var(--ph-survey-text-primary-color)}.ph-survey textarea,.ph-survey input[type=text],.ph-survey .multiple-choice-options label{color:var(--ph-survey-input-text-color);background:var(--ph-survey-input-background);border:1.5px solid var(--ph-survey-border-color);border-radius:4px;padding:10px;transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey textarea,.ph-survey input[type=text]{transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input{margin:0}.ph-survey textarea:focus,.ph-survey textarea:focus-visible,.ph-survey input[type=text]:focus,.ph-survey input[type=text]:focus-visible,.ph-survey .form-submit:focus,.ph-survey .form-submit:focus-visible,.ph-survey input[type=checkbox]:focus,.ph-survey input[type=radio]:focus,.ph-survey input[type=checkbox]:focus-visible,.ph-survey input[type=radio]:focus-visible{outline:1.5px solid var(--ph-survey-outline-color);border-color:var(--ph-survey-rating-active-bg-color);outline-offset:2px}.ph-survey textarea:focus:not(:focus-visible),.ph-survey input[type=text]:focus:not(:focus-visible),.ph-survey button:focus:not(:focus-visible),.ph-survey input[type=checkbox]:focus:not(:focus-visible),.ph-survey input[type=radio]:focus:not(:focus-visible){outline:none}.ph-survey textarea:hover:not(:focus),.ph-survey input[type=text]:hover:not(:focus){border-color:var(--ph-survey-rating-active-bg-color)}@media (max-width:768px){.ph-survey textarea,.ph-survey input[type=text]{font-size:1rem}}.ph-survey .multiple-choice-options label,.ph-survey .rating-options-number,.ph-survey .form-cancel,.ph-survey input[type=checkbox],.ph-survey input[type=radio]{border:1.5px solid var(--ph-survey-border-color)}.ph-survey label,.ph-survey input[type=checkbox],.ph-survey input[type=radio],.ph-survey .ratings-emoji,.ph-survey .ratings-number,.ph-survey .footer-branding,.ph-survey .form-cancel,.ph-survey .form-submit{transition:all .2s ease-out}@media (prefers-reduced-motion:no-preference){.ph-survey button:active,.ph-survey input[type=checkbox]:active,.ph-survey input[type=radio]:active,.ph-survey label:active{transition-duration:.1s}}.ph-survey-widget-tab{background:var(--ph-widget-color);color:var(--ph-widget-text-color);text-align:center;cursor:pointer;z-index:var(--ph-survey-z-index);border:none;border-radius:3px 3px 0 0;padding:10px 12px;transition:padding .2s ease-out;position:fixed}.ph-survey-widget-tab:hover:not(.widget-tab-top){padding-bottom:16px}.ph-survey-widget-tab.widget-tab-top{border-radius:0 0 3px 3px}.ph-survey-widget-tab.widget-tab-top:hover{padding-top:16px}@keyframes ph-survey-fade-in{0%{opacity:0}to{opacity:1}}.survey-box{flex-direction:column;gap:16px;display:flex}.bottom-section{flex-direction:column;gap:8px;display:flex}.thank-you-message-header~.bottom-section,.intro-screen-header~.bottom-section{padding-top:16px}.question-container,.thank-you-message,.intro-screen{flex-direction:column;gap:8px;display:flex}.survey-question{font-size:14px;font-weight:500}.survey-question-description{opacity:.8;padding-top:4px;font-size:13px}.survey-question-description,.thank-you-message-body,.intro-screen-body{word-wrap:break-word;overflow-wrap:break-word}:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) img,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) video,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) iframe,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) embed,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) object,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) svg{max-width:100%;height:auto}.question-textarea-wrapper{flex-direction:column;display:flex}.survey-form{animation:.3s ease-out forwards ph-survey-fade-in}.survey-form,.thank-you-message,.intro-screen{text-align:left;width:100%;z-index:var(--ph-survey-z-index);border:1.5px solid var(--ph-survey-border-color);border-bottom:var(--ph-survey-border-bottom);background:var(--ph-survey-background-color);border-radius:var(--ph-survey-border-radius);box-shadow:var(--ph-survey-box-shadow);padding:var(--ph-survey-box-padding);margin:0;position:relative}.survey-form textarea,.survey-form input[type=text]{min-width:100%}.survey-form textarea:focus,.survey-form textarea:focus-visible{box-shadow:0 4px 12px #00000014}.survey-form textarea:focus:not(:focus-visible){box-shadow:none}.survey-box .question-header--empty~.multiple-choice-options,.survey-box .question-header--empty~textarea{margin-top:0}.multiple-choice-options{border:none;flex-direction:column;gap:8px;margin:0;padding:1px 0;font-size:14px;display:flex}.multiple-choice-options label,.multiple-choice-options .response-choice{color:inherit;align-items:center;gap:8px;display:flex}.multiple-choice-options label{cursor:pointer;font-size:13px}.multiple-choice-options label:hover:not(:has(input:checked)){border-color:var(--ph-survey-text-subtle-color);box-shadow:0 2px 8px #00000014}.multiple-choice-options label:has(input:checked){border-color:var(--ph-survey-rating-active-bg-color);box-shadow:0 1px 4px #0000000d}.multiple-choice-options label.choice-option-open{flex-wrap:wrap}.multiple-choice-options label span{color:inherit}.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ph-survey-input-background);cursor:pointer;z-index:1;border-radius:3px;flex-shrink:0;width:1rem;height:1rem;transition:all .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out;position:relative}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):focus{transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):hover{border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):active{transform:scale(.95)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked{background:var(--ph-survey-rating-active-bg-color);border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked:hover{transform:scale(1.05)}.multiple-choice-options input[type=checkbox]:checked:after{border:solid var(--ph-survey-rating-active-text-color);border-width:0 2px 2px 0;width:4px;height:8px;animation:.2s ease-out .1s forwards ph-survey-checkmark-reveal;left:4px;transform:rotate(45deg)scale(0)}.multiple-choice-options input[type=radio]:checked:after{background:var(--ph-survey-rating-active-text-color);border-radius:50%;width:6px;height:6px;animation:.15s ease-out 50ms forwards ph-survey-radio-reveal;top:5px;left:5px;transform:scale(0)}.multiple-choice-options input[type=checkbox]:checked:after,.multiple-choice-options input[type=radio]:checked:after{content:"";box-sizing:content-box;position:absolute}.multiple-choice-options input[type=radio]{border-radius:50%}.multiple-choice-options input[type=radio]:checked{border:none}:is(.multiple-choice-options input[type=checkbox]:checked,.multiple-choice-options input[type=radio]:checked)~*{font-weight:700}.multiple-choice-options .choice-option-open input[type=text]::placeholder{color:var(--ph-survey-text-subtle-color);font-weight:400}.rating-options-emoji{justify-content:space-between;display:flex}.rating-options-emoji-2{justify-content:space-around}.ratings-emoji{opacity:.5;background-color:#0000;border:none;padding:0;font-size:16px}.ratings-emoji:hover{cursor:pointer;opacity:1;transform:scale(1.15)}.ratings-emoji.rating-active{opacity:1}.ratings-emoji svg{fill:var(--ph-survey-text-primary-color);transition:fill .2s ease-out}.rating-options-number{border-radius:6px;grid-auto-columns:1fr;grid-auto-flow:column;display:grid;overflow:hidden}.rating-options-number .ratings-number{border-right:1px solid var(--ph-survey-border-color);text-align:center;cursor:pointer;color:var(--ph-survey-rating-text-color);border-top:none;border-bottom:none;border-left:none;font-weight:700}.rating-options-number .ratings-number:last-of-type{border-right:0}.rating-options-number .ratings-number.rating-active{background:var(--ph-survey-rating-active-bg-color);color:var(--ph-survey-rating-active-text-color)}.ratings-number{background-color:var(--ph-survey-rating-bg-color);border:none;padding:8px 0}.ratings-number .rating-active{background-color:var(--ph-survey-rating-active-bg-color)}.ratings-number{cursor:pointer}@media (hover:hover) and (pointer:fine){.ratings-number:hover:not(.rating-active){background-color:color-mix(in srgb, var(--ph-survey-rating-active-bg-color) 14%, var(--ph-survey-rating-bg-color))}}.rating-text{opacity:.7;flex-direction:row;justify-content:space-between;font-size:11px;display:flex}.form-buttons{flex-direction:row;gap:8px;width:100%;display:flex}.form-buttons-with-back>.form-submit{flex:auto;min-width:0}.form-submit{text-align:center;cursor:pointer;user-select:none;background:var(--ph-survey-submit-button-color);color:var(--ph-survey-submit-button-text-color);border:none;border-radius:6px;min-width:100%;padding:12px;font-weight:700;box-shadow:0 2px #0000000b}.form-submit:not([disabled]):hover{transform:scale(1.02);box-shadow:0 4px 8px #0000001a}.form-submit:not([disabled]):active{transform:scale(.98);box-shadow:0 1px 2px #0000000d}.form-submit[disabled]{opacity:var(--ph-survey-disabled-button-opacity);cursor:not-allowed}.form-back{text-align:center;cursor:pointer;user-select:none;color:var(--ph-survey-text-primary-color);border:1.5px solid var(--ph-survey-border-color);background:0 0;border-radius:6px;flex:none;padding:12px 16px;font-weight:600}.form-back:hover{transform:scale(1.02)}.form-back:active{transform:scale(.98)}.validation-hint{opacity:.7;margin-top:4px;font-size:12px}.form-cancel{cursor:pointer;background:#fff;border-radius:100%;padding:12px;line-height:0;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.form-cancel:hover{opacity:.7;transform:translate(50%,-50%)scale(1.1)}.footer-branding{opacity:.6;justify-content:center;align-items:center;gap:4px;font-size:11px;font-weight:500;text-decoration:none;display:flex}.footer-branding:hover{opacity:1}.footer-branding a{text-decoration:none}.thank-you-message{text-align:center}.thank-you-message-header{margin:10px 0 0}.thank-you-message-body{opacity:.8;font-size:14px}.intro-screen{text-align:center;animation:.3s ease-out forwards ph-survey-fade-in}.intro-screen-header{margin:10px 0 0}.intro-screen-body{opacity:.8;font-size:14px}.limit-height{scrollbar-width:thin;scrollbar-color:var(--ph-survey-scrollbar-thumb-color) var(--ph-survey-scrollbar-track-color);max-height:256px;overflow:hidden auto}.limit-height::-webkit-scrollbar{width:8px}.limit-height::-webkit-scrollbar-track{background:var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb{background-color:var(--ph-survey-scrollbar-thumb-color);border:2px solid var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb:hover{background-color:var(--ph-survey-text-subtle-color)}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.ph-survey *{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@keyframes ph-survey-checkmark-reveal{0%{opacity:0;transform:rotate(45deg)scale(0)}50%{opacity:1;transform:rotate(45deg)scale(1.2)}to{opacity:1;transform:rotate(45deg)scale(1)}}@keyframes ph-survey-radio-reveal{0%{opacity:0;transform:scale(0)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}',t);return null==e||e.setAttribute("data-ph-survey-style","true"),e}(e);if(l){const t=o.querySelector("style");t&&o.removeChild(t),o.appendChild(l)}return(i||Hp.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},Qp=({responses:t,survey:e,surveySubmissionId:i,posthog:n,isSurveyCompleted:s,properties:r,surveyLanguage:o,questionSnapshots:l})=>{var a;n?Pp(n)&&(Dp(e),n.capture(mp,le(le(le(le({[bp]:e.name,[yp]:e.id,[_p]:e.current_iteration,[wp]:e.current_iteration_start_date,[Sp]:i,[xp]:s},o&&{[$p]:o}),{},{sessionRecordingUrl:null===(a=n.get_session_replay_url)||void 0===a?void 0:a.call(n)},Ul(t,e,l)),r),{},{$set:{[Vl(e,"responded")]:!0}})),s&&(Bp.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:e.id}})),dg(e),n.reloadFeatureFlags())):Mp.error("[survey sent] event not captured, PostHog instance not found.")},Jp=(t,e,i)=>{var n;return le(le({[bp]:t.name,[yp]:t.id,[_p]:t.current_iteration,[wp]:t.current_iteration_start_date,[kp]:Wl(null==e?void 0:e.responses)},(null==e?void 0:e.surveyLanguage)&&{[$p]:e.surveyLanguage}),{},{sessionRecordingUrl:null===(n=i.get_session_replay_url)||void 0===n?void 0:n.call(i),[Sp]:null==e?void 0:e.surveySubmissionId},Ul(null==e?void 0:e.responses,t,null==e?void 0:e.questionSnapshots))},Kp=(t,e,i,n)=>{if(!e)return void Mp.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const s=hg(t),r=s?s.surveyLanguage:n;e.capture(gp,le(le(le({},Jp(t,s,e)),r&&{[$p]:r}),{},{$set:{[Vl(t,"dismissed")]:!0}})),dg(t),Dp(t),Bp.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:t.id}}))},Yp=(t,e)=>{if(!e)return void Mp.error("[survey abandoned] event not captured, PostHog instance not found.");const i=(t=>Fp("abandonedSurvey_",t))(t);try{if("true"===localStorage.getItem(i))return}catch(t){return}const n=hg(t);if(n){try{localStorage.setItem(i,"true")}catch(t){}e.capture("survey abandoned",Jp(t,n,e),{transport:"sendBeacon"})}},Xp=t=>t.map(t=>({sort:Math.floor(10*Math.random()),value:t})).sort((t,e)=>t.sort-e.sort).map(t=>t.value),tg=(t,e)=>t.length===e.length&&t.every((t,i)=>t===e[i])?e.reverse():e,eg=t=>{const e=t.map(t=>t.id);return e.every(t=>!!t)?e:void 0},ig=(t,e)=>{return(t=>t.questions.some(t=>{var e;return!!(null===(e=t.branching)||void 0===e?void 0:e.type)}))(t)?t.questions:e?null!==(i=((t,e)=>{if(!e||e.length!==t.questions.length)return null;const i=new Map(t.questions.map(t=>[t.id,t])),n=[];for(const t of e){const e=i.get(t);if(!e)return null;n.push(e)}return n})(t,e.questionOrder))&&void 0!==i?i:t.questions:t.appearance&&t.appearance.shuffleQuestions&&!t.enable_partial_responses?tg(t.questions,Xp(t.questions)):t.questions;var i},ng=t=>Xl(t)||cg(t),sg=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,vf(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"+Zv++,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}),rg=()=>zf(sg),og=({component:t,children:e,renderAsHtml:i,style:n})=>function(t,e,i){var n,s,r,o,l=sf({},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?Fv.call(arguments,2):i),lf(t.type,l,n||t.key,s||t.ref,null)}(t,i?{dangerouslySetInnerHTML:{__html:e},style:n}:{children:e,style:n});function lg(t,e){var i,n;if(!(null===(i=t.conditions)||void 0===i?void 0:i.url))return!0;const s=ir(e);if(!s)return!1;const r=[t.conditions.url],o=function(t){return null!=t?t:"icontains"}(null===(n=t.conditions)||void 0===n?void 0:n.urlMatchType);return ia[o](r,[s])}const ag=t=>Fp("inProgressSurvey_",t),ug=(t,e)=>{try{localStorage.setItem(ag(t),JSON.stringify(e))}catch(t){Mp.error("Error setting in-progress survey state in localStorage",t)}},hg=t=>{try{const e=localStorage.getItem(ag(t));if(e)return JSON.parse(e)}catch(t){Mp.error("Error getting in-progress survey state from localStorage",t)}return null},cg=t=>{const e=hg(t);return!Me(null==e?void 0:e.surveySubmissionId)},dg=t=>{try{localStorage.removeItem(ag(t))}catch(t){Mp.error("Error clearing in-progress survey state from localStorage",t)}};function vg(t,e=!1){const i=`PostHogSurvey-${t.id}`;return e?`.${i}`:i}function fg(t,e=sp,i){if(t===ap)return{};switch(e){case"top_left":return{top:"0",left:"0",transform:"translate(30px, 30px)"};case"top_right":return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case"top_center":return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case"middle_left":return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case"middle_right":return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case"middle_center":return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case ip:return{left:"30px"};case np:return{left:"50%",transform:"translateX(-50%)"};default:return{right:t===lp&&i===ep?"60px":"30px"}}}var pg=0;function gg(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:--pg,__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 Ov.vnode&&Ov.vnode(u),u}const mg=gg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:gg("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"})}),yg=gg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:gg("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"})}),bg=gg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:gg("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"})}),_g=gg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:gg("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"})}),wg=gg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:gg("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"})}),kg=gg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:gg("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"})}),Sg=gg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:gg("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"})}),xg=({fill:t="currentColor"}={})=>gg("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:[gg("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),gg("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})]}),Cg=gg("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[gg("g",{"clip-path":"url(#clip0_2415_6911)",children:[gg("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:gg("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),gg("g",{mask:"url(#mask0_2415_6911)",children:[gg("path",{d:"M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z",fill:"#1D4AFF"}),gg("path",{d:"M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z",fill:"#F9BD2B"}),gg("path",{d:"M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z",fill:"currentColor"}),gg("path",{d:"M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z",fill:"#1D4AFF"}),gg("path",{d:"M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z",fill:"#F54E00"}),gg("path",{d:"M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z",fill:"currentColor"})]})]}),gg("defs",{children:gg("clipPath",{id:"clip0_2415_6911",children:gg("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function $g({urlParams:t}){const e=t?Object.entries(t).map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"):"";return gg("a",{href:"https://posthog.com/surveys"+(e?`?${e}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",Cg]})}function Tg({text:e,submitDisabled:i,appearance:n,onSubmit:s,link:r,onPreviewSubmit:o,skipSubmitButton:l,canGoBack:a,onBack:u}){const{isPreviewMode:h}=zf(sg),c=!!a&&!!u,d=!l&&gg("button",{className:"form-submit",disabled:i,"aria-label":"Submit survey",type:"button",onClick(){r&&(null==t||t.open(r)),h?null==o||o():s()},children:e});return gg("div",{className:"bottom-section",children:[c?gg("div",{className:"form-buttons form-buttons-with-back",children:[gg("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:u,children:n.backButtonText||"Back"}),d]}):d,!n.whiteLabel&&gg($g,{urlParams:{utm_source:"survey-footer"}})]})}function Ig({question:t,forceDisableHtml:e,htmlFor:i}){return gg("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[gg(t.type===up?"label":"h3",{className:"survey-question",htmlFor:i,children:t.question}),t.description&&og({component:of("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!e&&"text"!==t.descriptionContentType})]})}function Mg({onClick:t}){const{isPreviewMode:e}=zf(sg);return gg("button",{className:"form-cancel",onClick:t,disabled:e,"aria-label":"Close survey",type:"button",children:xg({fill:"black"})})}const Eg=t;function Pg({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onClose:r}){const{isPopup:o}=zf(sg);return jf(()=>{const t=t=>{"Enter"!==t.key&&"Escape"!==t.key||(t.preventDefault(),r())};return Us(Eg,"keydown",t),()=>{Eg.removeEventListener("keydown",t)}},[r]),gg("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&gg(Mg,{onClick:()=>r()}),gg("h3",{className:"thank-you-message-header",children:t}),e&&og({component:of("p",{className:"thank-you-message-body"}),children:e,renderAsHtml:!n&&"text"!==i}),o&&gg(Tg,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>r()})]})}function Rg({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onStart:r}){const{isPopup:o,onPreviewSubmit:l,onPopupSurveyDismissed:a}=zf(sg);return gg("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&gg(Mg,{onClick:()=>a()}),t&&gg("h3",{className:"intro-screen-header",children:t}),e&&og({component:of("p",{className:"intro-screen-body"}),children:e,renderAsHtml:!n&&"text"!==i}),gg(Tg,{text:s.introScreenButtonText||"Get started",submitDisabled:!1,appearance:s,onSubmit:r,onPreviewSubmit:()=>l(null)})]})}const Ag=t=>we(t)&&t.every(t=>$e(t));function Fg({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,displayQuestionIndex:r,initialValue:o,canGoBack:l,onBack:a}){const{isPreviewMode:u}=rg(),h=Bf(null),[c,d]=qf(()=>$e(o)?o:""),v=null==i?void 0:i.disableAutofocus;jf(()=>{v||setTimeout(()=>{var t;u||null===(t=h.current)||void 0===t||t.focus()},100)},[u,v]);const f=`surveyQuestion${r}`,p=Hf(()=>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 he: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 ce:var r;if(void 0!==t.value&&n.length>t.value)return null!==(r=t.errorMessage)&&void 0!==r?r:`Please enter no more than ${t.value} characters`}return!1}(c,t.validation,t.optional),[c,t.validation,t.optional]),g=Is(t.validation,he),m=Is(t.validation,ce),y=Hf(()=>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(c.trim())},_=()=>{p||s(c.trim())};return gg(af,{children:[gg("div",{className:"question-container",children:[gg(Ig,{question:t,forceDisableHtml:e,htmlFor:f}),gg("textarea",{ref:h,id:f,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:g,maxLength:m,onInput(t){d(t.currentTarget.value),t.stopPropagation()},onKeyDown(t){t.stopPropagation(),"Enter"!==t.key||!t.metaKey&&!t.ctrlKey||p||(t.preventDefault(),u?_():b())},value:c}),y&&gg("div",{className:"validation-hint",children:y})]}),gg(Tg,{text:t.buttonText||"Submit",submitDisabled:!!p,appearance:i,onSubmit:b,onPreviewSubmit:_,canGoBack:l,onBack:a})]})}function Og({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,canGoBack:r,onBack:o}){return gg(af,{children:[gg("div",{className:"question-container",children:gg(Ig,{question:t,forceDisableHtml:e})}),gg(Tg,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:()=>n("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:r,onBack:o})]})}function Dg({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:l,onBack:a}){var u;const h=t.scale,c=10===t.scale?0:1,[d,v]=qf(()=>Ee(o)?o:we(o)&&o.length>0&&Ee(parseInt(o[0]))?parseInt(o[0]):$e(o)&&Ee(parseInt(o))?parseInt(o):null),f="emoji"===t.display&&2===t.scale,{isPreviewMode:p}=rg(),g=t=>p?r(t):s(t);return gg(af,{children:[gg("div",{className:"question-container",children:[gg(Ig,{question:t,forceDisableHtml:e}),gg("div",{className:"rating-section",children:[gg("div",{className:"rating-options",children:["emoji"===t.display&&gg("div",{className:"rating-options-emoji"+(f?" rating-options-emoji-2":""),children:null===(u=Hg[t.scale])||void 0===u?void 0:u.map((e,n)=>gg("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&&gg("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${h-c+1}, minmax(0, 1fr))`},children:zg(t.scale).map((e,s)=>gg(Lg,{displayQuestionIndex:i,active:d===e,appearance:n,num:e,setActiveNumber(e){v(e),t.skipSubmitButton&&g(e)}},s))})]}),!f&&gg("div",{className:"rating-text",children:[gg("div",{children:t.lowerBoundLabel}),gg("div",{children:t.upperBoundLabel})]})]})]}),gg(Tg,{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 Lg({num:t,active:e,displayQuestionIndex:i,setActiveNumber:n}){return gg("button",{"aria-label":`Rate ${t}`,className:`ratings-number question-${i}-rating-${t} ${e?"rating-active":""}`,type:"button",onClick(){n(t)},children:t})}function Ng({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:l,onBack:a}){const u=Bf(null),h=Hf(()=>(t=>{if(!t.shuffleOptions)return t.choices;const e=t.choices;let i="";t.hasOpenChoice&&(i=e.pop());const n=tg(e,Xp(e));return t.hasOpenChoice&&(t.choices.push(i),n.push(i)),n})(t),[t]),[c,d]=qf(()=>((t,e)=>$e(t)||Ag(t)?t:e===cp?null:[])(o,t.type)),[v,f]=qf(()=>((t,e)=>{if($e(t)&&!e.includes(t))return{isSelected:!0,inputValue:t};if(Ag(t)){const i=t.find(t=>!e.includes(t));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,h)),{isPreviewMode:p}=rg(),g=t.type===cp,m=t.type===hp,y=t.skipSubmitButton&&g&&!t.hasOpenChoice,b=(t,e)=>{if(e){const t=!v.isSelected;return f(e=>le(le({},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=>le(le({},t),{},{isSelected:!1,inputValue:""})),void(y&&(s(t),p&&r(t)));m&&we(c)&&(c.includes(t)?d(c.filter(e=>e!==t)):d([...c,t]))},_=t=>{t.stopPropagation();const e=t.currentTarget.value;f(t=>le(le({},t),{},{inputValue:e})),g&&d(e)},w=t=>{t.stopPropagation(),"Enter"!==t.key||k()||(t.preventDefault(),S()),"Escape"===t.key&&(t.preventDefault(),f(t=>le(le({},t),{},{isSelected:!1,inputValue:""})),g&&d(null))},k=()=>!(t.optional||!Ie(c)&&(!we(c)||v.isSelected||0!==c.length)&&(!v.isSelected||""!==v.inputValue.trim())),S=()=>{v.isSelected&&m?we(c)&&(p?r([...c,v.inputValue]):s([...c,v.inputValue])):p?r(c):s(c)};return gg(af,{children:[gg("div",{className:"question-container",children:[gg(Ig,{question:t,forceDisableHtml:e}),gg("fieldset",{className:"multiple-choice-options limit-height",children:[gg("legend",{className:"sr-only",children:m?" Select all that apply":" Select one"}),h.map((e,n)=>{const s=!!t.hasOpenChoice&&n===t.choices.length-1,r=`surveyQuestion${i}Choice${n}`,o=`${r}Open`,l=s?v.isSelected:g?c===e:we(c)&&c.includes(e);return gg("label",{className:s?"choice-option-open":"",children:[gg("div",{className:"response-choice",children:[gg("input",{type:g?"radio":"checkbox",name:r,checked:l,onChange:()=>b(e,s),id:r,"aria-controls":o}),gg("span",{children:s?`${e}:`:e})]}),s&&gg("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)})]})]}),gg(Tg,{text:t.buttonText||"Submit",submitDisabled:k(),appearance:n,onSubmit:S,onPreviewSubmit:S,skipSubmitButton:y,canGoBack:l,onBack:a})]})}const qg=[1,2,3,4,5],jg=[1,2,3,4,5,6,7],Bg=[0,1,2,3,4,5,6,7,8,9,10],Hg={2:[kg,Sg],3:[bg,yg,mg],5:[_g,bg,yg,mg,wg]};function zg(t){switch(t){case 5:default:return qg;case 7:return jg;case 10:return Bg}}const Ug=As("[Surveys]");function Wg(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?vp:r;if(s.branching.type===vp)return vp;if("specific_question"===s.branching.type){if(Number.isInteger(s.branching.index))return s.branching.index}else if("response_based"===s.branching.type){if(s.type===cp){var o;let t=s.choices.indexOf(`${i}`);if(-1===t&&s.hasOpenChoice&&(t=s.choices.length-1),null===(o=s.branching)||void 0===o||null===(o=o.responseValues)||void 0===o?void 0:o.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===vp?vp:r}}else if(s.type===dp){var l;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const t=function(t,e){if(2===e){if(1>t||t>2)throw new Error("The response must be in range 1-2");return 1===t?"positive":"negative"}if(3===e){if(1>t||t>3)throw new Error("The response must be in range 1-3");return 1===t?"negative":2===t?"neutral":"positive"}if(5===e){if(1>t||t>5)throw new Error("The response must be in range 1-5");return t>2?3===t?"neutral":"positive":"negative"}if(7===e){if(1>t||t>7)throw new Error("The response must be in range 1-7");return t>3?4===t?"neutral":"positive":"negative"}if(10===e){if(0>t||t>10)throw new Error("The response must be in range 0-10");return t>6?t>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(i,s.scale);if(null===(l=s.branching)||void 0===l||null===(l=l.responseValues)||void 0===l?void 0:l.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===vp?vp:r}}return r}return Ug.warn("Falling back to next question index due to unexpected branching type"),r}const Vg=As("[SurveyTranslations]");function Gg(t,e){const i=function(t){return function({overrideLanguage:t,storedPersonProperties:e,locale:i},n){const s=Gl(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?Gl(t.language):null}(e);if(r)return null==n||n.info(`Using person property language: ${r}`),r;const o=Gl(i);return o?(null==n||n.info(`Using detected locale: ${o}`),o):(null==n||n.info("No user language detected"),null)}({overrideLanguage:t.config.override_display_language,storedPersonProperties:ke(t.get_property)?t.get_property(rt):void 0,locale:ba()},Vg)}(e);if(!i)return Vg.info("No user language detected"),{survey:t,language:null};const n=Kl(t,i,Vg);return{survey:n.survey,language:n.matchedKey}}const Zg=t,Qg=n,Jg="ph:show_survey_widget",Kg="PHWidgetSurveyClickListener";function Yg(t,e){try{const i=t.getBoundingClientRect(),n=Zg.innerHeight,s=Zg.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:Up.zIndex}}catch(t){return Mp.warn("Failed to calculate trigger position:",t),null}}var Xg=class{constructor(t){this.wi=new Map,this.ki=new Map,this.Si=new Map,this.xi=new Map,this.Ci=new Set,this.Mi=null,this.Ii=!1,this.Ti=null,this.Ri=null,this.$i=null,this.handlePageUnload=()=>{const t=this._posthog.get_property(at);if(t)for(const e of t)cg(e)&&Yp(e,this._posthog)},this.handlePopoverSurvey=(t,e,{resumeDelayFromActivation:i=!1}={})=>{var n,s,r,o,l,a;if(!Pp(this._posthog))return;const{survey:u,language:h}=this.Ei(t);this.Mi=h,this.$i=null,this.Ai=e;const c=this.Oi(u,e);this.Li(c.id);const{properties:d,initialResponses:v}=null!=e?e:{},f=!(!v||0>=Object.keys(v).length)&&this.Pi(c,v,d,h);if(f&&!(null===(n=c.appearance)||void 0===n?void 0:n.displayThankYouMessage))return;this.Di(c);let p={};if((null===(s=c.appearance)||void 0===s?void 0:s.position)===rp&&(null===(r=c.appearance)||void 0===r?void 0:r.widgetSelector)){const t=Qg.querySelector(c.appearance.widgetSelector);var g;t&&(p=Yg(t,parseInt((null===(g=c.appearance)||void 0===g?void 0:g.maxWidth)||Up.maxWidth))||{})}const m=(null===(o=c.appearance)||void 0===o?void 0:o.surveyPopupDelaySeconds)||0,{shadow:y}=Zp(c,this._posthog);this.xi.set(y,y.host);const b={posthog:this._posthog,survey:c,removeSurveyFromFocus:this.Fi,properties:d,style:p,isSurveyCompleted:f,skipShownEvent:null==e?void 0:e.skipShownEvent,surveyLanguage:h};if(this.$i=b,0>=m)return this.Ii=!0,If(gg(sm,le({},b)),y);const _=()=>{this.Ii=!0;const{survey:i,language:n}=this.Ei(t);this.Mi=n;const s=this.Oi(i,e),r=le(le({},b),{},{survey:s,surveyLanguage:n});this.$i=r,If(gg(sm,le(le({},r),{},{survey:le(le({},s),{},{appearance:le(le({},s.appearance),{},{surveyPopupDelaySeconds:0})})})),y)},w=()=>{if(!Pp(this._posthog)||!this.Ni(c))return Mp.info(`Survey ${c.id} no longer eligible when its display delay elapsed; not displaying`),this.Fi(c);_()},k=i?null===(l=this._posthog.surveys)||void 0===l||null===(l=l._surveyEventReceiver)||void 0===l||null===(a=l.getActivationTimestamp)||void 0===a?void 0:a.call(l,c.id):void 0,S=Ee(k)?Math.max(0,Date.now()-k):0,x=Math.max(0,1e3*m-S);if(0>=x)return w();const C=Zg.setTimeout(()=>{this.wi.delete(c.id),w()},x);this.wi.set(c.id,C)},this.qi=t=>{var e;const{survey:i,language:n}=this.Ei(t),{shadow:s,isNewlyCreated:r}=Zp(i,this._posthog);this.xi.set(s,s.host),(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===ep&&this.Si.set(t.id,t),r&&If(gg(om,{posthog:this._posthog,survey:i,surveyLanguage:n},t.id),s)},this.ji=t=>{const e=this.ki.get(t);e&&(e.element.removeEventListener("click",e.listener),e.element.removeAttribute(Kg),this.ki.delete(t),Mp.info(`Removed click listener for survey ${t}`))},this.Bi=t=>{this.Hi(t)||(this.Ui(t),this.ji(t.id))},this.zi=t=>{this.Hi(t)||(this.Ui(t),this.Si.delete(t.id))},this.Hi=t=>{try{var e;const i=Qg.querySelector(vg(t,!0));return!!(null==i||null===(e=i.shadowRoot)||void 0===e?void 0:e.querySelector(".ph-survey"))}catch(t){return!1}},this.Wi=(t,e)=>{const i=Qg.querySelector(e),n=this.ki.get(t.id);if(i){if(this.qi(t),n){if(i===n.element)return;Mp.info(`Selector element changed for survey ${t.id}. Re-attaching listener.`),this.ji(t.id)}if(!i.hasAttribute(Kg)){const e=e=>{var i,n;e.stopPropagation();const s=(null===(i=t.appearance)||void 0===i?void 0:i.position)===rp?Yg(e.currentTarget,parseInt((null===(n=t.appearance)||void 0===n?void 0:n.maxWidth)||Up.maxWidth)):{};Zg.dispatchEvent(new CustomEvent(Jg,{detail:{surveyId:t.id,position:s}}))};Us(i,"click",e),i.setAttribute(Kg,"true"),this.ki.set(t.id,{element:i,listener:e,survey:t}),Mp.info(`Attached click listener for feedback button survey ${t.id}`)}}else n&&this.Bi(t)},this.renderPopover=t=>{if(!Pp(this._posthog))return;const{survey:e,language:i}=this.Ei(t),{shadow:n}=Zp(e,this._posthog);this.xi.set(n,n.host),If(gg(sm,{posthog:this._posthog,survey:e,removeSurveyFromFocus:this.Fi,surveyLanguage:i}),n)},this.renderSurvey=(t,e,i)=>{var n;if(!Pp(this._posthog))return;const{survey:s,language:r}=this.Ei(t);let o=!1;(null===(n=this._posthog.config)||void 0===n||null===(n=n.surveys)||void 0===n?void 0:n.prefillFromUrl)&&(o=this.Vi(s,r,i)),If(gg(sm,{posthog:this._posthog,survey:s,removeSurveyFromFocus:this.Fi,isPopup:!1,properties:i,isSurveyCompleted:o,surveyLanguage:r}),e)},this.getActiveMatchingSurveys=(t,e=!1)=>{var i;null===(i=this._posthog)||void 0===i||null===(i=i.surveys)||void 0===i||i.getSurveys(e=>{t(e.filter(t=>this.Ni(t)))},e)},this.callSurveysAndEvaluateDisplayLogic=(t=!1)=>{this.getActiveMatchingSurveys(t=>{const e=Pp(this._posthog),i=t.filter(t=>e&&(t.type===op||t.type===lp)),n=new Set(i.map(t=>t.id));for(const t of Array.from(this.wi.keys()))n.has(t)||this.cancelSurvey(t);const s=this.Zi(i),r=new Set,o=new Set;s.forEach(t=>{if(t.type===lp){var e,i,n,s;if((null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===ep)return o.add(t.id),void this.qi(t);"selector"===(null===(i=t.appearance)||void 0===i?void 0:i.widgetType)&&(null===(n=t.appearance)||void 0===n?void 0:n.widgetSelector)&&(r.add(t.id),this.Wi(t,null===(s=t.appearance)||void 0===s?void 0:s.widgetSelector))}Ie(this.Gi)&&t.type===op&&this.handlePopoverSurvey(t,void 0,{resumeDelayFromActivation:!0})}),this.ki.forEach(({survey:t})=>{r.has(t.id)||this.Bi(t)}),this.Si.forEach((t,e)=>{o.has(e)||this.zi(t)})},t)},this.Di=t=>{Ie(this.Gi)||Mp.error(`Survey ${this.Gi} already in focus. Cannot add survey ${t.id}.`),this.Gi=t.id},this.Fi=t=>{this.Gi!==t.id&&Mp.error(`Survey ${t.id} is not in focus. Cannot remove survey ${t.id}.`),this.Li(t.id),this.Gi=null,this.Mi=null,this.Ii=!1,this.$i=null,this.Ai=void 0,this.Ui(t)},this._posthog=t,this.Gi=null,this.Ti=()=>this.Qi(),Us(Zg,"languagechange",this.Ti),this.Ri=t.onFeatureFlags(()=>this.Qi())}Qi(){if(Ie(this.Gi))return;const t=this._posthog.get_property(at),e=null==t?void 0:t.find(t=>t.id===this.Gi);if(!e)return;const{survey:i,language:n}=this.Ei(e);if(n===this.Mi)return;if(this.Mi=n,!this.Ii)return;const s=this.Oi(i,this.Ai),{shadow:r}=Zp(s,this._posthog);If(gg(sm,le(le({},this.$i),{},{posthog:this._posthog,survey:s,removeSurveyFromFocus:this.Fi,surveyLanguage:n})),r)}get Ji(){var t,e,i;return null!==(t=null===(e=(i=this._posthog).getExtension)||void 0===e?void 0:e.call(i,"featureFlags"))&&void 0!==t?t:this._posthog.featureFlags}Oi(t,e){return(null==e?void 0:e.position)||(null==e?void 0:e.selector)?le(le({},t),{},{appearance:le(le(le({},t.appearance),e.position&&{position:e.position}),e.selector&&{widgetSelector:e.selector})}):t}Li(t){const e=this.wi.get(t);e&&(clearTimeout(e),this.wi.delete(t))}cancelSurvey(t){this.wi.has(t)&&(Mp.info(`Cancelled pending survey ${t}`),this.Li(t),this.Gi===t&&(this.Gi=null,this.Mi=null,this.Ii=!1,this.$i=null,this.Ai=void 0))}setAutomaticDisplayDispose(t){this.Ki=t}dispose(){var t;null===(t=this.Ki)||void 0===t||t.call(this),this.Ki=void 0,this.Ti&&(Zg.removeEventListener("languagechange",this.Ti),this.Ti=null),this.Ri&&(this.Ri(),this.Ri=null),this.wi.forEach((t,e)=>this.Li(e)),this.ki.forEach((t,e)=>this.ji(e)),this.xi.forEach((t,e)=>{If(null,e),null==t||t.remove()}),this.xi.clear(),this.Si.clear(),this.Gi=null}Zi(t){return t.sort((t,e)=>{var i,n;const s=cg(t),r=cg(e);if(s&&!r)return-1;if(!s&&r)return 1;const o=t.schedule===fp,l=e.schedule===fp;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)})}Ei(t){return Gg(t,this._posthog)}Vi(t,e,i){if(this.Ci.has(t.id))return!1;const{params:n}=function(t){const e={};let i=!1;const n=t.replace(/^\?/,"");if(!n)return{params:e,autoSubmit:i};const s=n.split("&");for(const t of s){const[n,s]=t.split("=");if(!n||Ce(s))continue;const r=decodeURIComponent(n),o=decodeURIComponent(s);if("auto_submit"===r&&"true"===o){i=!0;continue}const l=r.match(/^q(\d+)$/);if(l){const t=parseInt(l[1],10);e[t]||(e[t]=[]),e[t].push(o)}}return{params:e,autoSubmit:i}}(Zg.location.search);if(0===Object.keys(n).length)return!1;Mp.info("[Survey Prefill] Detected URL prefill parameters");const s=this.Xi(t,n,e);return!!s&&(this.Yi(t,s,i,e),this.Ci.add(t.id),s.isSurveyCompleted)}Yi(t,e,i,n){const{responses:s,submissionId:r,isSurveyCompleted:o,skippedResponses:l}=e;(Object.keys(l).length>0&&t.enable_partial_responses||o)&&Qp({responses:o?s:l,survey:t,surveySubmissionId:r,posthog:this._posthog,isSurveyCompleted:o,properties:i,surveyLanguage:n})}Pi(t,e,i,n){const s={};for(const[t,i]of Object.entries(e))s[parseInt(t)]=we(i)?i.map(String):[String(i)];Mp.info("[Survey] Processing initial responses");const r=this.Xi(t,s,n);return!!r&&(this.Yi(t,r,i,n),r.isSurveyCompleted)}Xi(t,e,i){try{const n=function(t,e){const i={};return t.questions.forEach((t,n)=>{if(!e[n]||!t.id)return;const s=e[n],r=Hl(t.id);try{switch(t.type){case cp:{if(!t.choices||0===t.choices.length)return void Rs.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 Rs.warn(`[Survey Prefill] Invalid choice index for q${n}: ${s[0]}`);i[r]=t.choices[e];break}case hp:{if(!t.choices||0===t.choices.length)return void Rs.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 Rs.warn(`[Survey Prefill] No valid choices for q${n}`);const o=[...new Set(e.map(e=>t.choices[e]))];e.length>o.length&&Rs.warn(`[Survey Prefill] Removed duplicate choices for q${n}`),i[r]=o;break}case dp:{const e=parseInt(s[0],10),o=t.scale||10;if(isNaN(e)||0>e||e>o)return void Rs.warn(`[Survey Prefill] Invalid rating for q${n}: ${s[0]} (scale: 0-${o})`);i[r]=e;break}default:Rs.info(`[Survey Prefill] Question type ${t.type} does not support prefill`)}}catch(t){Rs.error(`[Survey Prefill] Error converting q${n}:`,t)}}),i}(t,e);if(0===Object.keys(n).length)return Mp.warn("[Survey Prefill] No valid responses after conversion"),null;const s=ml(),{startQuestionIndex:r,skippedResponses:o,skippedIndices:l}=function(t,e,i){let n=0;const s={},r=[],o=t.questions.length+1;let l=0;for(;t.questions.length>n&&o>l&&(l++,e.includes(n));){const e=t.questions[n];if(!e||!("skipSubmitButton"in e)||!e.skipSubmitButton)break;if(e.id){const t=Hl(e.id);Ce(i[t])||(s[t]=i[t])}r.push(n);const o=Wg(t,n,e.id?i[Hl(e.id)]:null);if(o===vp)return{startQuestionIndex:t.questions.length,skippedResponses:s,skippedIndices:r};n=o}return{startQuestionIndex:n,skippedResponses:s,skippedIndices:r}}(t,Object.keys(e).map(t=>parseInt(t,10)),n),a=r>=t.questions.length;return ug(t,{surveySubmissionId:s,responses:n,lastQuestionIndex:r,questionOrder:eg(t.questions),visitedIndices:l,surveyLanguage:i}),Mp.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:n,submissionId:s,startQuestionIndex:r,isSurveyCompleted:a,skippedResponses:o}}catch(t){return Mp.error("[Survey Prefill] Error handling prefill:",t),null}}tr(t,e=void 0){if(!t)return!0;const i=this.Ji,n=!!(null==i?void 0:i.isFeatureEnabled(t,{send_event:!t.startsWith("survey-targeting-")}));let s=!0;return e&&(s=(null==i?void 0:i.getFeatureFlag(t,{send_event:!1}))===e||"any"===e),n&&s}er(e){return!e.conditions||lg(e,this._posthog)&&function(e){var n,s;return function(e,n){var s,r,o;if(!e||0===e.length)return!0;if(!u)return!1;const l=Zi(u,{userAgentDataPlatform:null==i||null===(s=i.userAgentData)||void 0===s?void 0:s.platform,maxTouchPoints:null==i?void 0:i.maxTouchPoints,screenWidth:null==t||null===(r=t.screen)||void 0===r?void 0:r.width,screenHeight:null==t||null===(o=t.screen)||void 0===o?void 0:o.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio});return ia[null!=n?n:"icontains"](e,[l])}(null===(n=e.conditions)||void 0===n?void 0:n.deviceTypes,null===(s=e.conditions)||void 0===s?void 0:s.deviceTypesMatchType)}(e)&&function(t){var e;return!(null===(e=t.conditions)||void 0===e?void 0:e.selector)||!!(null==Hp?void 0:Hp.querySelector(t.conditions.selector))}(e)}nr(t){var e;return ng(t)?{satisfied:!0}:t.internal_targeting_flag_key&&function(t){var e;return"recurring"===t.schedule||(null!==(e=t.current_iteration)&&void 0!==e?e:0)>0}(t)&&!(null===(e=this.Ji)||void 0===e?void 0:e.hasLoadedFlags)?{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}:{satisfied:this.tr(t.internal_targeting_flag_key)}}checkSurveyEligibility(t){var e,i;const n={eligible:!0,reason:void 0};if(!Rp(t))return n.eligible=!1,n.reason=`Survey is not running. It was completed on ${t.end_date}`,n;if(!Lp.includes(t.type))return n.eligible=!1,n.reason=`Surveys of type ${t.type} are never eligible to be shown in the app`,n;const s=null===(e=t.conditions)||void 0===e?void 0:e.linkedFlagVariant;if(!this.tr(t.linked_flag_key,s))return n.eligible=!1,n.reason=s?`Survey linked feature flag is not enabled for variant ${s}`:"Survey linked feature flag is not enabled",n;if(!this.tr(t.targeting_flag_key))return n.eligible=!1,n.reason="Survey targeting feature flag is not enabled",n;const r=this.nr(t);var o;return r.satisfied?function(t,e){if(!t||!e)return!0;const i="string"==typeof e?new Date(e):e,n=Math.abs((new Date).getTime()-i.getTime());return Math.ceil(n/864e5)>t}(null===(i=t.conditions)||void 0===i?void 0:i.seenSurveyWaitPeriodInDays,xl.Ot("lastSeenSurveyDate"))?(t=>!!xl.Ot(Op(t))&&!ng(t))(t)?(n.eligible=!1,n.reason="Survey has already been seen and it can't be activated again",n):n:(n.eligible=!1,n.reason="Survey wait period has not passed",n):(n.eligible=!1,n.reason=null!==(o=r.reason)&&void 0!==o?o:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",n)}checkSurveyCaptureEligibility(){return Pp(this._posthog)?{eligible:!0}:{eligible:!1,reason:Ep}}checkSurveyDisplayEligibility(t){const e=this.checkSurveyCaptureEligibility();return e.eligible?this.checkSurveyEligibility(t):e}checkSurveyRenderability(t){const e=this.checkSurveyDisplayEligibility(t);return e.eligible&&!this.ir(t)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:e}ir(t){var e;if(!Yl(t)&&!Ap(t))return!0;const i=null===(e=this._posthog.surveys)||void 0===e||null===(e=e._surveyEventReceiver)||void 0===e?void 0:e.getSurveys();return!!(null==i?void 0:i.includes(t.id))}rr(t){var e;return!(null===(e=t.feature_flag_keys)||void 0===e?void 0:e.length)||t.feature_flag_keys.every(({key:t,value:e})=>!t||!e||this.tr(e))}Ni(t){return this.checkSurveyEligibility(t).eligible&&this.er(t)&&this.ir(t)&&this.rr(t)}Ui(t){try{const e=Qg.querySelector(vg(t,!0));(null==e?void 0:e.shadowRoot)&&(If(null,e.shadowRoot),this.xi.delete(e.shadowRoot)),null==e||e.remove()}catch(e){Mp.warn(`Failed to remove survey ${t.id} from DOM:`,e)}}getTestAPI(){return{addSurveyToFocus:this.Di,removeSurveyFromFocus:this.Fi,surveyInFocus:this.Gi,surveyTimeouts:this.wi,handleWidget:this.qi,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this.Wi,sortSurveysByAppearanceDelay:this.Zi,checkFlags:this.rr.bind(this),isSurveyFeatureFlagEnabled:this.tr.bind(this),onLanguageChange:this.Qi.bind(this),currentLanguage:this.Mi,surveyIsRendered:this.Ii}}};function tm(t,e){if(!Qg||!Zg)return;const i=new Xg(t);if(t.config.disable_surveys_automatic_display)return Mp.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===e)return Mp.info("There are no surveys to load or Surveys is disabled in the project settings."),i;let n;i.callSurveysAndEvaluateDisplayLogic(!0);const s=()=>{Ce(n)&&(n=setInterval(()=>{i.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},r=()=>{Ce(n)||(clearInterval(n),n=void 0)};s();const o=()=>{Qg.hidden?r():(i.callSurveysAndEvaluateDisplayLogic(!1),s())};return Us(Qg,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{r(),Qg.removeEventListener("visibilitychange",o)}),i}function em({survey:t,removeSurveyFromFocus:e=()=>{},setSurveyVisible:i,isPreviewMode:n=!1,posthog:s}){jf(()=>{var r;if(n||!(null===(r=t.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var n;const r=t.type===lp,o=lg(t,s),l=(null===(n=t.appearance)||void 0===n?void 0:n.widgetType)===ep&&r;if(!o)return Mp.info(`Hiding survey ${t.id} because URL does not match`),i(!1),e(t);l&&(Mp.info(`Showing survey ${t.id} because it is a feedback button tab and URL matches`),i(!0))};Us(Zg,"popstate",o),Us(Zg,"hashchange",o);const l=Zg.history.pushState,a=Zg.history.replaceState;return Zg.history.pushState=function(...t){l.apply(this,t),o()},Zg.history.replaceState=function(...t){a.apply(this,t),o()},()=>{Zg.removeEventListener("popstate",o),Zg.removeEventListener("hashchange",o),Zg.history.pushState=l,Zg.history.replaceState=a}},[n,t,e,i,s])}const im=200;function nm(t="right"){switch(t){case"top":return{top:"0",left:"50%",transform:"translateX(-50%)"};case"left":return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case"bottom":return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function sm({survey:t,forceDisableHtml:e,posthog:i,style:n={},previewPageIndex:s,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:l=()=>{},onPreviewBack:a=()=>{},onPopupSurveyDismissed:u=()=>{},onCloseConfirmationMessage:h=()=>{},properties:c,isSurveyCompleted:d,skipShownEvent:v,surveyLanguage:f}){var p,g,m,y,b,_,w,k,S,x,C,T;const I=Bf(null),M=Number.isInteger(s),{isPopupVisible:E,isSurveySent:P,hidePopupWithAnimation:R}=function(t,e,i,n,s,r,o,l,a){const[u,h]=qf(n||0===i||t.type===ap),[c,d]=qf(!1),v=Bf(!1),f=()=>{const e=()=>{r&&s(t),h(!1)};if(v.current)return;const i=null==o?void 0:o.current;i?(v.current=!0,i.style.transition=`opacity ${im}ms ease-out`,i.style.opacity="0",setTimeout(()=>{v.current=!1,e()},250)):e()},p=e=>{e.detail.surveyId===t.id&&f()};return jf(()=>{if(!e)return void Mp.error("usePopupVisibility hook called without a PostHog instance.");if(n)return;let s;const r=e=>{var i,n;if(e.detail.surveyId===t.id){if(!(null===(i=t.appearance)||void 0===i?void 0:i.displayThankYouMessage))return f();d(!0),(null===(n=t.appearance)||void 0===n?void 0:n.autoDisappear)&&(s&&clearTimeout(s),s=setTimeout(f,5e3))}},o=()=>{if(lg(t,e)){var i;h(!0),Zg.dispatchEvent(new Event("PHSurveyShown")),l||e.capture(pp,le(le({[bp]:t.name,[yp]:t.id,[_p]:t.current_iteration,[wp]:t.current_iteration_start_date},a&&{[$p]:a}),{},{sessionRecordingUrl:null===(i=e.get_session_replay_url)||void 0===i?void 0:i.call(e)}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}};Us(Zg,"PHSurveyClosed",p),Us(Zg,"PHSurveySent",r);const u=i>0?setTimeout(o,i):void 0;return Ce(u)&&o(),()=>{Ce(u)||clearTimeout(u),Ce(s)||clearTimeout(s),Zg.removeEventListener("PHSurveyClosed",p),Zg.removeEventListener("PHSurveySent",r)}},[]),em({survey:t,removeSurveyFromFocus:s,setSurveyVisible:h,isPreviewMode:n,posthog:e}),{isPopupVisible:u,isSurveySent:c,setIsPopupVisible:h,hidePopupWithAnimation:f}}(t,i,(null===(p=t.appearance)||void 0===p?void 0:p.surveyPopupDelaySeconds)?1e3*t.appearance.surveyPopupDelaySeconds:0,M,r,o,I,v,f),A=P||s===t.questions.length||!0===d,[F,O]=qf(!1),D=Hf(()=>!!hg(t),[t]),L=!(!(null===(g=t.appearance)||void 0===g?void 0:g.introScreenHeader)&&!(null===(m=t.appearance)||void 0===m?void 0:m.introScreenDescription)),N=M?-1===s:!!(null===(y=t.appearance)||void 0===y?void 0:y.displayIntroScreen)&&L&&!F&&!D,q=Hf(()=>{const e=hg(t),n=(null==e?void 0:e.surveySubmissionId)||ml();return{isPreviewMode:M,previewPageIndex:s,onPopupSurveyDismissed(){f?Kp(t,i,M,f):Kp(t,i,M),u()},isPopup:o||!1,surveySubmissionId:n,onPreviewSubmit:l,onPreviewBack:a,posthog:i,properties:c,surveyLanguage:f}},[M,s,o,i,t,u,l,a,c,f]);return E?gg(sg.Provider,{value:q,children:gg("div",{className:"ph-survey",style:le(le({},fg(t.type,null===(b=t.appearance)||void 0===b?void 0:b.position,null===(_=t.appearance)||void 0===_?void 0:_.widgetType)),n),ref:I,children:A?gg(Pg,{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||Up,onClose(){R(),h()}}):N?gg(Rg,{header:(null===(x=t.appearance)||void 0===x?void 0:x.introScreenHeader)||"",description:(null===(C=t.appearance)||void 0===C?void 0:C.introScreenDescription)||"",forceDisableHtml:!!e,contentType:null===(T=t.appearance)||void 0===T?void 0:T.introScreenDescriptionContentType,appearance:t.appearance||Up,onStart:()=>O(!0)}):gg(rm,{survey:t,forceDisableHtml:!!e,posthog:i})})}):null}function rm({survey:t,forceDisableHtml:e,posthog:i}){var n,s;const r=Hf(()=>{const e=hg(t);if(!e)return null;const i=Ee(e.lastQuestionIndex);return!i||i&&e.lastQuestionIndex>=0&&t.questions.length>e.lastQuestionIndex?e:(dg(t),null)},[t]),[o,l]=qf(()=>((null==r?void 0:r.responses)&&Mp.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[a,u]=qf(!1),{previewPageIndex:h,onPopupSurveyDismissed:c,isPopup:d,onPreviewSubmit:v,onPreviewBack:f,surveySubmissionId:p,isPreviewMode:g,properties:m,surveyLanguage:y}=zf(sg),[b,_]=qf(()=>{const e=null==r?void 0:r.lastQuestionIndex,i=Ee(e)&&e>=0&&t.questions.length>e?e:0;return Ee(h)&&h>=0?h:i}),[w,k]=qf(()=>{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]=qf(()=>{var e;const i=hg(t);return null!==(e=null==i?void 0:i.questionSnapshots)&&void 0!==e?e:{}}),C=Hf(()=>eg(ig(t,r)),[t.id,r]),T=Hf(()=>{if(!C||new Set(C).size!==C.length)return ig(t,r);const e=new Map(t.questions.map(t=>[t.id,t])),i=C.map(t=>e.get(t)).filter(t=>!!t);return i.length===C.length?i:t.questions},[C,t.questions,t,r]);jf(()=>{!g||Ce(h)||0>h||_(h)},[h,g]);const I=!!(null===(n=t.appearance)||void 0===n?void 0:n.allowGoBack)&&(g?(null!=h?h:0)>0:w.length>0),M=T.at(b);return M?gg("form",{className:"survey-form",name:"surveyForm",children:[d&&!0!==(null===(s=t.appearance)||void 0===s?void 0:s.hideCancelButton)&&gg(Mg,{onClick(){c()}}),gg("div",{className:"survey-box","data-question-index":b,children:[a&&gg("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),lm({question:M,forceDisableHtml:e,displayQuestionIndex:b,appearance:t.appearance||Up,onSubmit:e=>(({res:e,displayQuestionIndex:n,questionId:s})=>{if(!i)return void Mp.error("onNextButtonClick called without a PostHog instance.");if(!Pp(i))return void u(!0);if(u(!1),!s)return void Mp.error("onNextButtonClick called without a questionId.");const r=Hl(s),a=le(le({},o),{},{[r]:e});l(a);const h=T[n],c=(null==h?void 0:h.id)?le(le({},S),{},{[h.id]:h.question}):S;x(c);const d=Wg(t,n,e),v=d===vp,f=[...w,n];if(v||(k(f),_(d),ug(t,{surveySubmissionId:p,responses:a,lastQuestionIndex:d,questionOrder:eg(T),visitedIndices:f,surveyLanguage:y,questionSnapshots:c})),t.enable_partial_responses||v){const e=new Set(f.map(t=>{var e;return null===(e=T[t])||void 0===e?void 0:e.id}).filter(t=>!!t).map(t=>Hl(t))),n=Object.fromEntries(Object.entries(a).filter(([t])=>e.has(t)));Qp({responses:n,survey:t,surveySubmissionId:p,isSurveyCompleted:v,posthog:i,properties:m,surveyLanguage:y,questionSnapshots:c})}})({res:e,displayQuestionIndex:b,questionId:M.id}),onPreviewSubmit:v,initialValue:M.id?o[Hl(M.id)]:void 0,canGoBack:I,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),ug(t,{surveySubmissionId:p,responses:o,lastQuestionIndex:e,questionOrder:eg(T),visitedIndices:i,surveyLanguage:y,questionSnapshots:S})}})]})]}):null}function om({survey:t,forceDisableHtml:e,posthog:i,readOnly:n,surveyLanguage:s}){var r,o,l,a,u,h,c;const[d,v]=qf(!0),[f,p]=qf(!1),[g,m]=qf({}),y=Bf(void 0),b=()=>{(f||!i||n||Pp(i))&&p(!f)};if(jf(()=>{var e;if(!i)return void Mp.error("FeedbackWidget called without a PostHog instance.");if(n)return;"tab"===(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)&&m({top:"50%",bottom:"auto"});const s=e=>{var i;const n=e;(null===(i=n.detail)||void 0===i?void 0:i.surveyId)===t.id&&(Mp.info(`Received show event for feedback button survey ${t.id}`),m(n.detail.position||{}),b())};return Us(Zg,Jg,s),()=>{Ce(y.current)||(clearTimeout(y.current),y.current=void 0),Zg.removeEventListener(Jg,s)}},[i,n,t.id,null===(r=t.appearance)||void 0===r?void 0:r.widgetType,null===(o=t.appearance)||void 0===o?void 0:o.widgetSelector,null===(l=t.appearance)||void 0===l?void 0:l.borderColor]),em({survey:t,setSurveyVisible:v,posthog:i}),!d)return null;const _=()=>{t.schedule!==fp&&v(!1),Ce(y.current)||clearTimeout(y.current),y.current=setTimeout(()=>{y.current=void 0,p(!1)},200)};return gg(af,{children:["tab"===(null===(a=t.appearance)||void 0===a?void 0:a.widgetType)&&gg("button",{className:"ph-survey-widget-tab "+("top"===(null===(u=t.appearance)||void 0===u?void 0:u.tabPosition)?"widget-tab-top":""),onClick:b,disabled:n,style:nm(null===(h=t.appearance)||void 0===h?void 0:h.tabPosition),children:(null===(c=t.appearance)||void 0===c?void 0:c.widgetLabel)||""}),f&&gg(sm,{posthog:i,survey:t,forceDisableHtml:e,style:g,onPopupSurveyDismissed:_,onCloseConfirmationMessage:_,surveyLanguage:s})]})}const lm=({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 up:return of(Fg,le(le({},u),{},{question:t,key:t.id}));case"link":return of(Og,le(le({},u),{},{question:t,key:t.id}));case dp:return of(Dg,le(le({},u),{},{question:t,key:t.id}));case cp:case hp:return of(Ng,le(le({},u),{},{question:t,key:t.id}));default:return Mp.error(`Unsupported question type: ${t.type}`),null}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.generateSurveys=tm,d.extendPostHogWithSurveys=tm;const am=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},um=1e4,hm=(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),cm=(t,e,i)=>{const n=JSON.stringify(t);if(i.remaining>=n.length)return hm(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 hm(e,JSON.stringify(t.slice(0,s)),i)},dm=t=>void 0!==t&&"function"!=typeof t&&"symbol"!=typeof t&&"bigint"!=typeof t,vm=(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}},fm=(t,e,i)=>{if(!i.truncated)if(Se(t)){if(i.seen.has(t))return void vm(e||"circular","[Circular]",i);i.seen.add(t);try{for(const n in t)try{if(!{}.hasOwnProperty.call(t,n))continue;if(fm(t[n],e?`${e}.${n}`:n,i),i.truncated)return}catch(t){continue}}catch(t){}}else vm(e,t,i)},pm=(t,e,i,n,s=!1,r)=>{if(!dm(t))return!s||hm(e,"null",i);if(Ie(t)||(t=>{try{return Ee(t)||Re(t)}catch(t){return!1}})(t))return hm(e,JSON.stringify(t),i);if("string"==typeof t)return cm(t,e,i);if(!Se(t)&&!we(t))return hm(e,JSON.stringify(t),i);if(n.has(t))return cm("[Circular]",e,i);n.add(t);try{const r=t.toJSON;if(ke(r))return pm(r.call(t),e,i,n,s)}catch(t){}try{const n={}.toString.call(t);if("[object String]"===n)return cm(String(t.valueOf()),e,i);if("[object Number]"===n||"[object Boolean]"===n)return hm(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 pm(o,e,i,n,s,r)}if(we(t)){if(!hm(e,"[",i))return!1;for(let s=0;t.length>s;s++){if(s>0&&!hm(e,",",i))return!1;let r;try{r=t[s]}catch(t){r=void 0}if(!pm(r,e,i,n,!0))return!1}return hm(e,"]",i)}if(!hm(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{fm(l,s,r)}catch(t){}if(!dm(l))continue;const a=`${o?"":","}${JSON.stringify(s)}:`;if(a.length>=i.remaining)return i.truncated=!0,!1;const u=e.length,h=i.remaining,c=i.truncated;if(!hm(e,a,i))return!1;const d=e.length,v=pm(l,e,i,n,!1),f=i.truncated;if(e.length!==d){if(o=!1,!v)return!1}else if(e.length=u,i.remaining=h,i.truncated=v?c:f,!v)return!1}}catch(t){}return hm(e,"}",i)},gm=(t,e)=>{const i=[],n={remaining:e,truncated:!1},s=Se(t[0])?{result:{},keysRemaining:50,sizeRemaining:um,truncated:!1,seen:new WeakSet([t[0]])}:void 0;for(let e=0;t.length>e&&(0>=e||hm(i," ",n))&&pm(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)||{}}},mm={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},ym=t=>"canCapture"in t,bm=t=>ym(t)?t.canCapture?t.getExtension(qp):void 0:t.is_capturing()?t.logs:void 0,_m=(t,e,i)=>{if(ym(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;ke(s)&&s.call(e,i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.logs={initializeLogs(t){let e=t;const i=[],n={host:d.location.host};let s=!1;for(const t of Object.keys(mm)){const r=i=>(...r)=>{let o=!1;try{const i=e;if(r.length>0&&!s&&i){const e=bm(i);if(e){s=!0,o=!0;const{body:l,truncated:a,attributes:u}=gm(r,um),h=le(le({},n),a?{body_truncated:"true"}:{}),c={level:mm[t],body:l,attributes:le(le({"log.source":`console.${t}`},h),u)};_m(i,e,c)}}}catch(t){}finally{o&&(s=!1),i.apply(d.console,r)}},o=d.console[t];i.push(av(d.console,t,t=>{const e=r(t);return e.__rrweb_original__=am(o),e}))}return()=>{e=void 0,i.forEach(t=>t())}},replayConsoleBuffer(t,e){const i=bm(t);if(i)for(const t of e)try{var n;const{body:e,truncated:s,attributes:r}=gm(t.args,um);null===(n=i.captureBufferedConsoleLog)||void 0===n||n.call(i,{level:mm[t.level],body:e,attributes:le(le({"log.source":`console.${t.level}`,host:d.location.host},s?{body_truncated:"true"}:{}),r)},t.context,t.occurredAtMs)}catch(t){}}};const wm=t=>Ne(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),km=As("[Error tracking]"),Sm="webkit-masked-url:",xm=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Cm=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Sm],$m=["__firefox__","__gCrWeb"];function Tm(){return new dn([new En,new jn,new Rn,new Pn,new Nn,new Ln,new Fn,new qn],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=kn.test(n)?n.replace(kn,"$1"):n;if(!o.match(/\S*Error: /)){for(const i of e){const e=i(o,t);if(e){s.push(e);const t=xn(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(In(s,l)>=50)break}}const a=[...l].sort((t,e)=>e.start-t.start),u=a[a.length-1];if(u){const t=$n(s,u);s.splice(u.start-t,t);for(const e of a)e.start-=t}for(const t of a)Cn(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++)Mn(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 le(le({},t),{},{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||"?"});var i})}(s)}}("web:javascript",yn,wn))}const Im=As("[ExceptionAutocapture]"),Mm=Tm(),Em=(t,e)=>{try{return t()}catch(t){return e}},Pm=(t,e)=>Em(()=>t(e()),void 0),Rm=t=>Em(()=>ke(t)&&ke(t.call),!1),Am=(t,e)=>Em(()=>{t[e].__POSTHOG_INSTRUMENTED__=!0},void 0),Fm=(t,e,i)=>{Em(()=>{var i;null===(i=t[e])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),Em(()=>{t[e]=i},void 0)},Om=e=>{const i=t;i||Im.info("window not available, cannot wrap onerror");const n=Em(()=>i.onerror,void 0);return i.onerror=function(...t){var i;return Pm(e,()=>Mm.buildFromUnknown((([t,e,i,n,s])=>{if(null!=s)return s;if($e(t)&&$e(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}})),!!Rm(n)&&null!==(i=n(...t))&&void 0!==i&&i},Am(i,"onerror"),()=>Fm(i,"onerror",n)},Dm=(e,i=!1)=>{const n=t;n||Im.info("window not available, cannot wrap onUnhandledRejection");const s=Em(()=>n.onunhandledrejection,void 0);return n.onunhandledrejection=function(t){var n;return Pm(e,()=>Mm.buildFromUnknown(t,{mechanism:{handled:!1}})),Rm(s)?null!==(n=s(t))&&void 0!==n&&n:i},Am(n,"onunhandledrejection"),()=>Fm(n,"onunhandledrejection",s)},Lm={wrapOnError:Om,wrapUnhandledRejection:Dm,wrapConsoleError(t){const e=console;e||Im.info("console not available, cannot wrap console.error");const i=Em(()=>e.error,void 0);return e.error=function(...e){Pm(t,()=>{let t;t=1==e.length?e[0]:e.join(" ");const i=e.find(t=>t instanceof Error);return Mm.buildFromUnknown(i||t,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),Rm(i)&&i(...e)},Am(e,"error"),()=>Fm(e,"error",i)}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.errorWrappingFunctions=Lm,d.posthogErrorWrappingFunctions=Lm;const Nm=(t,e)=>{if(!ke(null==t?void 0:t.capture))return;const i=null==e?void 0:e.autocaptureExceptions,n=!Ie(i)&&"object"==typeof i&&we(i.errors_to_ignore)?i.errors_to_ignore.reduce((t,e)=>{try{t.push(new RegExp(e))}catch(t){Im.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){Im.error("Failed to capture exception for a legacy client",t)}};Om(t=>{n.some(e=>t.$exception_list.some(t=>e.test(t.value||"")))||s(t)}),Dm(s,!0)};d.extendPostHogWithExceptionAutoCapture=Nm,d.extendPostHogWithExceptionAutocapture=Nm;const qm="X-POSTHOG-SESSION-ID",jm="X-POSTHOG-WINDOW-ID",Bm="X-POSTHOG-DISTINCT-ID",Hm=[qm,jm,Bm],zm=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],Um=(t,e)=>({}.hasOwnProperty.call(t,e)),Wm=t=>"object"==typeof t&&!Ie(t)||ke(t),Vm=t=>"undefined"!=typeof Request&&(t instanceof Request||"[object Request]"==={}.toString.call(t)),Gm=e=>{try{var i;return Vm(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}},Zm=(t,e,i,n,s)=>{let r;try{r=new URL(n).hostname}catch(t){return!1}if(!t)return!1;if(we(t)&&!t.includes(r))return!1;let o=!1;if(i){const{sessionId:t,windowId:e}=i.checkAndGetSessionAndWindowId(!0);s.set(qm,t),s.set(jm,e),o=!0}const l=(t=>ke(t)?t():t)(e);return l&&"$posthog_cookieless"!==l&&(s.set(Bm,l),o=!0),o};d.__PosthogExtensions__=d.__PosthogExtensions__||{};const Qm={_patchFetch:(e,i,n)=>av(t,"fetch",t=>function(s,r){const o=arguments.length>1?[s,r]:[s];let l=o;try{const t=Gm(s);if(t)if(Vm(s)){const t=new Request(s,r);Zm(e,i,n,t.url,t.headers),l=[t]}else{const o=new Headers(Wm(r)?r.headers:void 0);if(Zm(e,i,n,t,o)){const t=((t,e)=>{if(Ce(t)||Ie(t))return{headers:e};if(!Wm(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)=>Um(t,e)?Reflect.get(t,e):Reflect.get(i,e,i),has:(t,e)=>Um(t,e)||e in i,ownKeys(t){const e=new Set(Reflect.ownKeys(t));return Reflect.ownKeys(i).forEach(t=>e.add(t)),zm.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&&zm.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?le(le({},s),{},{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(i)})})(r,o);t&&(l=[s,t])}}}catch(t){l=o}return t.apply(this,l)}),_patchXHR:(e,i,n)=>av(t.XMLHttpRequest.prototype,"open",t=>function(s,r,o=!0,l,a){const u=this,h=new Headers,c=Gm(r);c&&Zm(e,i,n,c,h);const d=t.call(u,s,r,o,l,a);return Hm.forEach(t=>{const e=h.get(t);if(e)try{u.setRequestHeader(t,e)}catch(t){}}),d})};d.__PosthogExtensions__.tracingHeadersPatchFns=Qm,d.postHogTracingHeadersPatchFns=Qm,"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 Jm=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 Km=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Ym=t=>{if("loading"===document.readyState)return"loading";const e=Km();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"},Xm=t=>{const e=t.nodeName;return 1===t.nodeType?e.toLowerCase():e.toUpperCase().replace(/^#/,"")},ty=t=>{let e="";try{for(;9!==(null==t?void 0:t.nodeType);){var i;const n=t,s=n.id?"#"+n.id:[Xm(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},ey=new WeakMap;function iy(t,e){let i=ey.get(e);return i||(i=new WeakMap,ey.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}let ny=-1;const sy=()=>ny,ry=t=>{addEventListener("pageshow",e=>{e.persisted&&(ny=e.timeStamp,t(e))},!0)},oy=(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)))}},ly=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},ay=()=>{var t,e;return null!==(t=null===(e=Km())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let uy=-1;const hy=new Set,cy=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,dy=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of hy)t();isFinite(uy)||(uy="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",dy,!0))}},vy=(t=!1)=>{if(t&&(uy=1/0),0>uy){var e;const t=ay(),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;uy=null!=i?i:cy(),addEventListener("visibilitychange",dy,!0),addEventListener("prerenderingchange",dy,!0),ry(()=>{setTimeout(()=>{uy=cy()})})}return{get firstHiddenTime(){return uy},onHidden(t){hy.add(t)}}},fy=(t,e=-1,i,n=0,s,r,o)=>{const l=Km(),a=(null==l?void 0:l.navigationId)||0;let u="navigate";return i?u=i:0>sy()?l&&(document.prerendering||ay()>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}},py=(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(le({type:e,buffered:!0},i));return t}}catch(t){}},gy=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},my=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},yy=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var by=class{constructor(){this.u=void 0}};const _y=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},wy=[1800,3e3],ky=(t,e={})=>{const i=gy(e);_y(()=>{const n=iy(e,by),s=vy();let r,o=fy("FCP");const l=py(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(l.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-ay(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});l&&(r=oy(t,o,wy,e.reportAllChanges),ry(i=>{o=fy("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,sy()),r=oy(t,o,wy,e.reportAllChanges),ly(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&py(["soft-navigation"],i=>{i.forEach(i=>{n.u&&i.navigationId&&my(n.u,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=fy("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=oy(t,o,wy,e.reportAllChanges),r(!0)})},e)})},Sy=[.1,.25],xy=t=>t.find(t=>{var e;return 1===(null===(e=t.node)||void 0===e?void 0:e.nodeType)})||t[0],Cy=(t,e={})=>{const i=iy(e=Object.assign({},e),Jm),n=new WeakMap;i.t=t=>{var i;if(null==t||null===(i=t.sources)||void 0===i?void 0:i.length){const i=xy(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:ty(o);n.set(i,t)}}},((t,e={})=>{const i=vy();ky(yy(()=>{let n,s=fy("CLS",0);const r=iy(e,Jm),o=(i,o,l,a,u)=>{s=fy("CLS",0,i,o,l,a,u),r.o=0,n=oy(t,s,Sy,e.reportAllChanges)},l=(t=!1)=>{r.o>s.value&&(s.value=r.o,s.entries=r.i),n(t)},a=t=>{l(!0),o("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},u=t=>{for(const e of t)"soft-navigation"!==e.entryType?r.l(e):a(e);l()},h=["layout-shift"];gy(e)&&h.push("soft-navigation");const c=py(h,u);c&&(n=oy(t,s,Sy,e.reportAllChanges),i.onHidden(()=>{u(c.takeRecords()),n(!0)}),ry(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,sy()),ly(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=xy(s.sources);t&&(e={largestShiftTarget:n.get(t),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:t,largestShiftEntry:s,loadState:Ym(s.startTime)})}}return Object.assign(t,{attribution:e})})(e))},e)},$y=(t,e={})=>{const i=iy(e=Object.assign({},e),by);gy(e)&&(i.u=new Map),ky(e=>{t((t=>{let e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:Ym(sy())};if("soft-navigation"!==t.navigationType){if(t.entries.length){const i=Km(),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:Ym(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 Ty=0,Iy=1/0,My=0;const Ey=t=>{for(const e of t)e.interactionId&&(Iy=Math.min(Iy,e.interactionId),My=Math.max(My,e.interactionId),Ty=My?(My-Iy)/7+1:0)};let Py;const Ry=()=>{var t;return Py?Ty:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var Ay=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return Ry()-this.h}D(){this.h=Ry(),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 Fy=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=yy(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})}},Oy=[200,500],Dy=(t,e={})=>{const i=iy(e=Object.assign({},e),Ay);let n=[],s=[],r=0;const o=new WeakMap,l=new WeakMap;let a=!1;const u=()=>{a||(Fy(h),a=!0)},h=()=>{const t=new Set(i.v.map(t=>o.get(t.entries[0]))),e=s.length-10;s=s.filter((i,n)=>n>=e||t.has(i));const l=new Set;for(const t of s){const e=c(t.startTime,t.processingEnd);for(const t of e)l.add(t)}n=n.filter(t=>t.startTime>r||l.has(t)),a=!1};i.m=t=>{const i=t.startTime+t.duration;let n;r=Math.max(r,t.processingEnd);for(let r=s.length-1;r>=0;r--){const o=s[r];if(8>=Math.abs(i-o.renderTime)){n=o,n.startTime=Math.min(t.startTime,n.startTime),n.processingStart=Math.min(t.processingStart,n.processingStart),n.processingEnd=Math.max(t.processingEnd,n.processingEnd),e.includeProcessedEventEntries&&n.entries.push(t);break}}n||(n={startTime:t.startTime,processingStart:t.processingStart,processingEnd:t.processingEnd,renderTime:i,entries:e.includeProcessedEventEntries?[t]:[]},s.push(n)),t.interactionId&&o.set(t,n),u()},i.M=t=>{if(!l.get(t)){var i;const o=null===(i=t.entries.find(t=>t.target))||void 0===i?void 0:i.target;if(o){var n,s;const i=null!==(n=null===(s=e.generateTarget)||void 0===s?void 0:s.call(e,o))&&void 0!==n?n:ty(o);l.set(t,i)}else{var r;const e=null===(r=t.entries.find(t=>t.targetSelector))||void 0===r?void 0:r.targetSelector;e&&l.set(t,e)}}};const c=(t,e)=>{const i=[];for(const s of n)if(s.startTime+s.duration>=t){if(s.startTime>e)break;i.push(s)}return i};py(["long-animation-frame"],t=>{n=n.concat(t),u()},e),((t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=vy();_y(()=>{var n;"interactionCount"in performance||Py||(Py=py(["event"],Ey,{durationThreshold:0}));let s,r=fy("INP");const o=iy(e,Ay),l=(i,n,l,a,u)=>{o.D(),r=fy("INP",-1,i,n,l,a,u),s=oy(t,r,Oy,e.reportAllChanges)},a=()=>{const t=o.S(r.navigationType);t&&t.k!==r.value&&(r.value=t.k,r.entries=t.entries,s())},u=t=>{a(),s(!0),l("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},h=(t,e=!1)=>{Fy(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.l(e):u(e);a(),e&&s(!0)})},c=["event","first-input"];gy(e)&&c.push("soft-navigation");const d=py(c,h,le(le({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=oy(t,r,Oy,e.reportAllChanges),d&&(i.onHidden(()=>{h(d.takeRecords(),!0)}),ry(()=>{l("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,sy())}))})})(e=>{t((t=>{if(0===t.entries.length){const e={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:t.value,loadState:Ym(t.navigationStartTime||0)};return Object.assign(t,{attribution:e})}const e=t.entries[0],n=o.get(e),s=Math.max(n.processingStart,e.startTime),r=Math.max(e.startTime+e.duration,s),a=Math.min(n.processingEnd,r),u=n.entries.sort((t,e)=>t.processingStart-e.processingStart),h=c(e.startTime,a),d=i.p.get(e.interactionId),v={interactionTarget:l.get(d),interactionType:e.name.startsWith("key")?"keyboard":"pointer",interactionTime:e.startTime,nextPaintTime:r,processedEventEntries:u,longAnimationFrameEntries:h,inputDelay:s-e.startTime,processingDuration:a-s,presentationDelay:r-a,loadState:Ym(e.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(t=>{var e;const i=t.interactionTime,n=t.nextPaintTime;if(!(null===(e=t.longAnimationFrameEntries)||void 0===e?void 0:e.length)||!i||!n)return;const s=t.inputDelay,r=t.processingDuration;let o,l,a=0,u=0,h=0,c=0;for(const e of t.longAnimationFrameEntries){u=u+e.startTime+e.duration-e.styleAndLayoutStart;for(const t of e.scripts){const e=t.startTime+t.duration;if(i>e)continue;const n=e-Math.max(i,t.startTime),h=t.duration?n/t.duration*t.forcedStyleAndLayoutDuration:0;a+=n-h,u+=h,n>c&&(l=i+s>t.startTime?"input-delay":i+s+r>t.startTime?"processing-duration":"presentation-delay",o=t,c=n)}}const d=t.longAnimationFrameEntries.at(-1),v=d?d.startTime+d.duration:0;v>=i+s+r&&(h=n-v),o&&l&&(t.longestScript={entry:o,subpart:l,intersectingDuration:c}),t.totalScriptDuration=a,t.totalStyleAndLayoutDuration=u,t.totalPaintDuration=h,t.totalUnattributedDuration=n-i-a-u-h})(v),Object.assign(t,{attribution:v})})(e))},e)};var Ly=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 Ny=50;const qy=[];py(["resource"],t=>{for(const e of t)qy.push(e),qy.length>Ny&&qy.shift()});const jy=(t,e={})=>{null!=(e=Object.assign({},e)).resourceBufferSize&&(Ny=e.resourceBufferSize);const i=iy(e,Ly),n=new WeakMap;gy(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:ty(i);n.set(t,o)}else t.id&&n.set(t,`#${t.id}`)},((t,e={})=>{let i=!1;const n=gy(e);_y(()=>{let s,r=vy(),o=fy("LCP");const l=iy(e,Ly),a=(n,l,a,u,h)=>{o=fy("LCP",-1,n,l,a,u,h),s=oy(t,o,$,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=vy(!0))},u=t=>{var e;l.u&&t.navigationId&&my(l.u,t),i||s(!0),a("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime);const n=null===(e=t.getLargestInteractionContentfulPaint)||void 0===e?void 0:e.call(t);n&&h([n])},h=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],a=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-ay(),0),l.l(e),n=[e];else if("interaction-contentful-paint"===e.entryType){var i;const s=e;if(!o.navigationId)continue;if("interactionId"in s&&s.interactionId!=o.navigationInteractionId)continue;a=(null===(i=s.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,t=Math.max(a-e.startTime,0),s.largestContentfulPaint&&(l.l(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>a&&(o.value=t,o.entries=n,s())}},c=["largest-contentful-paint"];n&&c.push("interaction-contentful-paint","soft-navigation");const d=py(c,h);if(d){s=oy(t,o,$,e.reportAllChanges);const r=["keydown","click","visibilitychange"],l=t=>{if(t.isTrusted&&!i){const t=o.id;Fy(()=>{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});ry(n=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,sy()),s=oy(t,o,$,e.reportAllChanges),ly(()=>{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&&(qy.findLast(t=>t.name===l.url)||performance.getEntriesByType("resource").findLast(t=>t.name===l.url));let u;e.target=n.get(l),e.lcpEntry=l,l.url&&(e.url=l.url),a&&(e.lcpResourceEntry=a);let h=0,c=0;if("soft-navigation"!==t.navigationType?(u=Km(),h=null!==(s=null==u?void 0:u.activationStart)&&void 0!==s?s:0,c=null!==(r=null==u?void 0:u.responseStart)&&void 0!==r?r:0):(h=t.navigationStartTime||0,u=null===(o=i.u)||void 0===o?void 0:o.get(t.navigationId)),u){const i=Math.max(0,c-h),n=Math.max(i,a?(a.requestStart||a.startTime)-h:0),s=Math.min(t.value,Math.max(n,a?a.responseEnd-h:0));e=le(le({},e),{},{timeToFirstByte:i,resourceLoadDelay:n-i,resourceLoadDuration:s-n,elementRenderDelay:t.value-s,navigationEntry:u})}}return Object.assign(t,{attribution:e})})(e))},e)};let By=-1;const Hy=()=>By,zy=t=>{addEventListener("pageshow",e=>{e.persisted&&(By=e.timeStamp,t(e))},!0)},Uy=(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)))}},Wy=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},Vy=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Gy=()=>{var t,e;return null!==(t=null===(e=Vy())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let Zy=-1;const Qy=new Set,Jy=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Ky=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of Qy)t();isFinite(Zy)||(Zy="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",Ky,!0))}},Yy=(t=!1)=>{if(t&&(Zy=1/0),0>Zy){var e;const t=Gy(),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;Zy=null!=i?i:Jy(),addEventListener("visibilitychange",Ky,!0),addEventListener("prerenderingchange",Ky,!0),zy(()=>{setTimeout(()=>{Zy=Jy()})})}return{get firstHiddenTime(){return Zy},onHidden(t){Qy.add(t)}}},Xy=(t,e=-1,i,n=0,s,r,o)=>{const l=Vy(),a=(null==l?void 0:l.navigationId)||0;let u="navigate";return i?u=i:0>Hy()?l&&(document.prerendering||Gy()>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}},tb=new WeakMap;function eb(t,e){let i=tb.get(e);return i||(i=new WeakMap,tb.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}var ib=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 nb=(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(le({type:e,buffered:!0},i));return t}}catch(t){}},sb=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},rb=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},ob=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var lb=class{constructor(){this.l=void 0}};const ab=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},ub=[1800,3e3],hb=(t,e={})=>{const i=sb(e);ab(()=>{const n=eb(e,lb),s=Yy();let r,o=Xy("FCP");const l=nb(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(l.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-Gy(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});l&&(r=Uy(t,o,ub,e.reportAllChanges),zy(i=>{o=Xy("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Hy()),r=Uy(t,o,ub,e.reportAllChanges),Wy(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&nb(["soft-navigation"],i=>{i.forEach(i=>{n.l&&i.navigationId&&rb(n.l,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Xy("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Uy(t,o,ub,e.reportAllChanges),r(!0)})},e)})},cb=[.1,.25],db=(t,e={})=>{const i=Yy();hb(ob(()=>{let n,s=Xy("CLS",0);const r=eb(e,ib),o=(i,o,l,a,u)=>{s=Xy("CLS",0,i,o,l,a,u),r.i=0,n=Uy(t,s,cb,e.reportAllChanges)},l=(t=!1)=>{r.i>s.value&&(s.value=r.i,s.entries=r.o),n(t)},a=t=>{l(!0),o("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},u=t=>{for(const e of t)"soft-navigation"!==e.entryType?r.h(e):a(e);l()},h=["layout-shift"];sb(e)&&h.push("soft-navigation");const c=nb(h,u);c&&(n=Uy(t,s,cb,e.reportAllChanges),i.onHidden(()=>{u(c.takeRecords()),n(!0)}),zy(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Hy()),Wy(n)}),setTimeout(n))}))};let vb=0,fb=1/0,pb=0;const gb=t=>{for(const e of t)e.interactionId&&(fb=Math.min(fb,e.interactionId),pb=Math.max(pb,e.interactionId),vb=pb?(pb-fb)/7+1:0)};let mb;const yb=()=>{var t;return mb?vb:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var bb=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return yb()-this.u}M(){this.u=yb(),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 _b=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=ob(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})}},wb=[200,500],kb=(t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Yy();ab(()=>{var n;"interactionCount"in performance||mb||(mb=nb(["event"],gb,{durationThreshold:0}));let s,r=Xy("INP");const o=eb(e,bb),l=(i,n,l,a,u)=>{o.M(),r=Xy("INP",-1,i,n,l,a,u),s=Uy(t,r,wb,e.reportAllChanges)},a=()=>{const t=o.L(r.navigationType);t&&t.P!==r.value&&(r.value=t.P,r.entries=t.entries,s())},u=t=>{a(),s(!0),l("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},h=(t,e=!1)=>{_b(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.h(e):u(e);a(),e&&s(!0)})},c=["event","first-input"];sb(e)&&c.push("soft-navigation");const d=nb(c,h,le(le({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=Uy(t,r,wb,e.reportAllChanges),d&&(i.onHidden(()=>{h(d.takeRecords(),!0)}),zy(()=>{l("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Hy())}))})};var Sb=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 xb=[2500,4e3],Cb=(t,e={})=>{let i=!1;const n=sb(e);ab(()=>{let s,r=Yy(),o=Xy("LCP");const l=eb(e,Sb),a=(n,l,a,u,h)=>{o=Xy("LCP",-1,n,l,a,u,h),s=Uy(t,o,xb,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=Yy(!0))},u=t=>{var e;l.l&&t.navigationId&&rb(l.l,t),i||s(!0),a("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime);const n=null===(e=t.getLargestInteractionContentfulPaint)||void 0===e?void 0:e.call(t);n&&h([n])},h=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],a=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-Gy(),0),l.h(e),n=[e];else if("interaction-contentful-paint"===e.entryType){var i;const s=e;if(!o.navigationId)continue;if("interactionId"in s&&s.interactionId!=o.navigationInteractionId)continue;a=(null===(i=s.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,t=Math.max(a-e.startTime,0),s.largestContentfulPaint&&(l.h(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>a&&(o.value=t,o.entries=n,s())}},c=["largest-contentful-paint"];n&&c.push("interaction-contentful-paint","soft-navigation");const d=nb(c,h);if(d){s=Uy(t,o,xb,e.reportAllChanges);const r=["keydown","click","visibilitychange"],l=t=>{if(t.isTrusted&&!i){const t=o.id;_b(()=>{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});zy(n=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Hy()),s=Uy(t,o,xb,e.reportAllChanges),Wy(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})},$b={onLCP:jy,onCLS:Cy,onFCP:$y,onINP:Dy,withoutAttribution:{onLCP:Cb,onCLS:db,onFCP:hb,onINP:kb}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=$b,d.__PosthogExtensions__.postHogWebVitalsCallbacks=$b,d.postHogWebVitalsCallbacks=$b;const Tb={onLCP:Cb,onCLS:db,onFCP:hb,onINP:kb};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=Tb,d.__PosthogExtensions__.postHogWebVitalsCallbacks=Tb,d.postHogWebVitalsCallbacks=Tb,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Tb;const Ib={onLCP:jy,onCLS:Cy,onFCP:$y,onINP:Dy,withoutAttribution:{onLCP:Cb,onCLS:db,onFCP:hb,onINP:kb}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=Ib,d.__PosthogExtensions__.postHogWebVitalsCallbacks=Ib,d.postHogWebVitalsCallbacks=Ib;const Mb={onLCP:Cb,onCLS:db,onFCP:hb,onINP:kb};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=Mb,d.__PosthogExtensions__.postHogWebVitalsCallbacks=Mb,d.postHogWebVitalsCallbacks=Mb,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Mb;var Eb=class{constructor(t){this.disabled=!1===t;const e=Se(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 Pb="$copy_autocapture",Rb=As("[AutoCapture]");function Ab(t,e){return e.length>t?e.slice(0,t)+"...":e}function Fb(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do{e=e.previousSibling}while(e&&!sr(e));return e}function Ob(e,{e:i,maskAllElementAttributes:n,maskAllText:s,elementAttributeIgnoreList:r,elementsChainAsString:o,disableCaptureUrlHashes:l}){var a,u;if(!sr(e))return{props:{}};const h=[e],c=new Set([e]);let d=e;for(;d.parentNode&&!rr(d,"body")&&1e3>h.length;){if(lr(d.parentNode)){const t=d.parentNode.host;if(c.has(t))break;c.add(t),h.push(t),d=t;continue}if(!sr(d.parentNode))break;if(c.has(d.parentNode))break;c.add(d.parentNode),h.push(d.parentNode),d=d.parentNode}const v="click"===i.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?h.findIndex(t=>rr(t,"button")||rr(t,"a")):-1;v>0&&(s=s||h.slice(0,v+1).some(t=>!Mr(t)||Er(t)));const f=[],p={};let g,m=!1,y=!1;if(Os(h,t=>{const e=Mr(t);if(rr(t,"a")){const i=t.getAttribute("href");m=!!(e&&i&&Nr(i))&&(l?sn(i):i)}fe(hr(t),"ph-no-capture")&&(y=!0),f.push(function(t,e,i,n,s=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};fr.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?Ab(1024,qr(t)):Ab(1024,dr(t)));const l=hr(t);l.length>0&&(o.classes=l.filter(function(t){return""!==t})),Os(t.attributes,function(i){var r;if((!Er(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==n?void 0:n.includes(i.name))&&!e&&Nr(i.value)&&(!$e(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=i.value;"class"===i.name&&(t=ar(t).join(" ")),o["attr__"+i.name]=Ab(1024,"href"===i.name&&s?sn(t):t)}});let a=1,u=1,h=t;for(;h=Fb(h);)a++,h.tagName===t.tagName&&u++;return o.nth_child=a,o.nth_of_type=u,o}(t,n,s,r,l)),Os(function(t){if(!Mr(t))return{};const e={};return Os(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&&Nr(n)&&(e[i]=n)}}),e}(t),(t,e)=>{({}).hasOwnProperty.call(p,e)||(p[e]=t)})}),y)return{props:{},explicitNoCapture:y};if(v>0&&(e=h[v],f.splice(0,v)),s||(f[0].$el_text=rr(e,"a")||rr(e,"button")?qr(e):dr(e)),m){var b,_;f[0].attr__href=m;const e=null===(b=Zs(m))||void 0===b?void 0:b.host,i=null==t||null===(_=t.location)||void 0===_?void 0:_.host;e&&i&&e!==i&&(g=m)}return{props:Ds((k=i.type,{$event_type:k,$ce_version:1}),o?{}:{$elements:f},{$elements_chain:(w=f,we(w)?function(t){return t.map(t=>{var e,i;let n="";if(t.tag_name&&(n+=t.tag_name),t.attr_class){t.attr_class.sort();for(const e of t.attr_class)n+=`.${e.replace(/"/g,"")}`}const s=le(le(le(le({},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 Ls(s).sort(([t],[e])=>function(t,e){return e>t?-1:t>e?1:0}(t,e)).forEach(([t,e])=>r[Br(t.toString())]=Br(e.toString())),n+=":",n+=Ls(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:Hr(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Ls(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,e])=>n.attributes[t]=e),n})}(w)):"")},(null===(a=f[0])||void 0===a?void 0:a.$el_text)?{$el_text:null===(u=f[0])||void 0===u?void 0:u.$el_text}:{},g&&"click"===i.type?{$external_click_url:g}:{},p),target:e};var w,k}var Db=class{Js(){this.Ks=void 0,clearTimeout(this.Ys),this.Ys=void 0}Xs(t){var e;if(!Mr(t))return!0;const i=null!==(e=this.so().css_selector_ignorelist)&&void 0!==e?e:yr,n=new Set;let s=t;for(;s;){if(n.size>=1e3||n.has(s))return!0;n.add(s);const t=s,e=hr(t);if(fe(e,"ph-no-capture")||fe(e,"ph-sensitive")||Er(t)||i.some(e=>pr(t,e)))return!0;const r=s.parentNode;s=lr(r)?r.host:r&&sr(r)?r:null}return!1}oo(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.Js();if("pointerdown"===t.type){this.Js();const i=vr(t);var e;return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&i&&sr(i)&&(this.Ks={target:i,excluded:this.Xs(i),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(e=this.lo)||void 0===e?void 0:e.distinctId}))}const i=this.Ks;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.Js():"pointerup"===t.type&&(i.released=!0,this.Ys=setTimeout(()=>this.Js(),0)))}ao(t){var e;const i=this.Ks;this.Js();const s=vr(t);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(e=this.lo)||void 0===e?void 0:e.distinctId)&&t.pointerId===i.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-i.x)&&5>=Math.abs(t.clientY-i.y)&&s&&(rr(s,"html")||rr(s,"body"))){var r;if(i.excluded)return null;const t=null!==(r=this.so().css_selector_ignorelist)&&void 0!==r?r:yr;return[s,null==n?void 0:n.documentElement,null==n?void 0:n.body].some(e=>{if(!e)return!1;const i=hr(e);return fe(i,"ph-no-capture")||fe(i,"ph-sensitive")||!Mr(e)||Er(e)||t.some(t=>pr(e,t))})?null:i.target}}constructor(t){this.uo=t,this.name="autocapture",this.ho=!1,this.co=null,this.do=!1,this.vo=!1,this.Sr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.fo=!1,this.uo.refresh(this.Sr),this.rageclicks=new Eb(this.Sr.rageclick),this.po=null}setup(t){this.mo(),this.lo=t;const e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.fo?e.dispose():(this.yo=e,this.startIfEnabled())}dispose(){var t;this.fo||(this.fo=!0,this.lo=void 0,null===(t=this.yo)||void 0===t||t.dispose(),this.yo=void 0,this.bo())}so(){return this.uo.refresh(this.Sr),this.Sr}mo(){var t,e;return this.so(),this.Sr.url_allowlist=null===(t=this.Sr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Sr.url_ignorelist=null===(e=this.Sr.url_ignorelist)||void 0===e?void 0:e.map(t=>new RegExp(t)),this.Sr}_o(){if(!this.isBrowserSupported())return void Rb.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!n)return;const e=this.wo=e=>{e=e||(null==t?void 0:t.event);try{if("blur"===e.type)return void this.Js();if(0===e.type.indexOf("pointer"))return void this.oo(e);const t="click"===e.type?this.ao(e):void 0;if(Ie(t))return;this.ko(e,"$autocapture",t)}catch(t){Rb.error("Failed to capture event",t)}};if(Us(t,"blur",e),Us(n,"submit",e,{capture:!0}),Us(n,"change",e,{capture:!0}),Us(n,"click",e,{capture:!0}),Os(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Us(n,t,e,{capture:!0})}),this.so().capture_copied_text){const e=this.So=e=>{e=e||(null==t?void 0:t.event);try{this.ko(e,Pb)}catch(t){Rb.error("Failed to capture clipboard event",t)}};Us(n,"copy",e,{capture:!0}),Us(n,"cut",e,{capture:!0}),Us(n,"paste",e,{capture:!0})}}bo(){this.Js(),this.wo&&(null==t||t.removeEventListener("blur",this.wo),Os(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==n||n.removeEventListener(t,this.wo,!0)}),null==n||n.removeEventListener("submit",this.wo,!0),null==n||n.removeEventListener("change",this.wo,!0),null==n||n.removeEventListener("click",this.wo,!0),this.wo=void 0),this.So&&(null==n||n.removeEventListener("copy",this.So,!0),null==n||n.removeEventListener("cut",this.So,!0),null==n||n.removeEventListener("paste",this.So,!0),this.So=void 0),this.ho=!1}startIfEnabled(){this.isEnabled||this.Js(),!this.fo&&this.lo&&this.isEnabled&&!this.ho&&(this._o(),this.ho=!0)}onRemoteConfig(t){if(this.fo)return;if(this.do=!0,!t.ok)return void this.startIfEnabled();const e=t.config;e.elementsChainAsString&&(this.vo=e.elementsChainAsString);const i=e.autocapture_opt_out;var n;Re(i)&&(null===(n=this.lo)||void 0===n||n.kv.set("$autocapture_disabled_server_side",i),this.co=i),this.startIfEnabled()}setElementSelectors(t){this.po=t}getElementSelectors(t,e){var i;const s=[];return null===(i=this.po)||void 0===i||i.forEach(i=>{const r=null==n?void 0:n.querySelectorAll(i);null==r||r.forEach(n=>{t!==n&&e!==n||fe(s,i)||s.push(i)})}),s}get isEnabled(){var t,e;if(this.fo)return!1;const i=null===(t=this.lo)||void 0===t?void 0:t.kv.get(k),n=this.co,s=this.so();if(!s.remoteRequestsDisabled&&!this.do)return!1;const r=s.remoteRequestsDisabled&&!this.do;if(Ie(n)&&!Re(i)&&!r)return!1;const o=null!==(e=this.co)&&void 0!==e?e:!!i;return!!s.enabled&&!o}ko(e,i="$autocapture",n){if(!this.isEnabled)return void this.Js();let s=n||vr(e);or(s)&&(s=s.parentNode||null);const r=this.mo();var o;"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&r.rageclick&&(null===(o=this.rageclicks)||void 0===o?void 0:o.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&$r(s,r.rageclick)&&this.ko(e,"$rageclick",n);const l=i===Pb,a=l?le(le({},r),{},{dom_event_allowlist:void 0}):r;if(s&&function(e,i,n,s,r,o){var l;if(!t||Tr(e))return!1;if((null==n?void 0:n.url_allowlist)&&!ur(n.url_allowlist,o))return!1;if((null==n?void 0:n.url_ignorelist)&&ur(n.url_ignorelist,o))return!1;if(null==n?void 0:n.dom_event_allowlist){const t=n.dom_event_allowlist;if(t&&!t.some(t=>i.type===t))return!1}const{parentIsUsefulElement:a,targetElementList:u}=Ir(e,s);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,n))return!1;if(!gr(u,null==n?void 0:n.css_selector_allowlist))return!1;if(gr(u,null!==(l=null==n?void 0:n.css_selector_ignorelist)&&void 0!==l?l:yr))return!1;try{const n=t.getComputedStyle(e);if(n&&"pointer"===n.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}const h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(r||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(i.type)>=0;default:return a?(r||["click"]).indexOf(i.type)>=0:(r||["click"]).indexOf(i.type)>=0&&(fr.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,a,l,l?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var u;const{props:n,explicitNoCapture:o,target:l}=Ob(s,{e:e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.vo,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(o)return!1;const a=this.getElementSelectors(s,l);if(a&&a.length>0&&(n.$element_selectors=a),i===Pb){const i=e.type||"clipboard";if("paste"!==i){var h,c;const e=null==t||null===(h=t.getSelection())||void 0===h?void 0:h.toString(),i=cr(e);if(!i)return!1;n.$selected_content=i,n.$clipboard_text_length=null!==(c=null==e?void 0:e.length)&&void 0!==c?c:0}n.$copy_type=i}return null===(u=this.lo)||void 0===u||u.capture(i,n).catch(t=>Rb.error("Failed to capture event",t)),!0}}isBrowserSupported(){return ke(null==n?void 0:n.querySelectorAll)}};const Lb={};function Nb(t,e){const i=vr(t);return i?le({node:i,originalEvent:t,timestamp:Date.now()},e):null}function qb(t,e){return Math.abs(t)<Math.abs(e)?0>e?"up":"down":0>t?"left":"right"}function jb(t){return"swipe"===t.type?"$dead_swipe":"$dead_click"}const Bb="canvas,video,audio,embed,object";function Hb(t,e){return Ee(t)&&t>=e}function zb(t,e=1e3){return t>=0&&e>t?t:void 0}function Ub(t,e,i=1e3){return Ee(e)?zb(t-e,i):void 0}var Wb=class{lr(t){var e,i,n,s,r,o,l,a;const u=this.ur((null==t?void 0:t.__onCapture)||this.cr.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.dr=!1,this.hr=[],this.vr=0,this.ur=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.pr=()=>{clearTimeout(this.mr),this.mr=void 0,this.gr=void 0},this.yr=t=>{if(this.pr(),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.br(i,e),this.gr=e}},this.wr=t=>{Ie(t.relatedTarget)&&this.pr()},this.kr=t=>{const e=this.gr,i=t;if(!e||0!==i.button||t.isTrusted!==e.trusted)return;const n=t.composedPath();for(const t of e.path)if(sr(t)&&-1!==n.indexOf(t)){e.clickTarget=t;break}e.clickDetail=i.detail,this.mr=d.setTimeout(this.pr,0)},this._r=t=>{const e=t,i=Nb(e,{type:"click"}),n=this.gr;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.Sr.selection_change_threshold_ms>0,this.pr()),Ie(i)||this.Cr(i)||this.Mr(i),this.Ir()},this.Tr=()=>{const t=Date.now();this.Rr=t,t%50==0&&this.hr.forEach(e=>{Ce(e.scrollDelayMs)&&(e.scrollDelayMs=t-e.timestamp)})},this.$r=t=>{var e,i;const s=null==n?void 0:n.getSelection(),r=this.dr;this.dr="Range"===(null==s?void 0:s.type);const o=null==s?void 0:s.focusNode,l=o&&(sr(o)?o:o.parentElement),a=null==n?void 0:n.activeElement;let u=a;for(;null==u||null===(e=u.shadowRoot)||void 0===e?void 0:e.activeElement;)u=u.shadowRoot.activeElement;const h=Cr(vr(t))||Cr(null!=l?l:null)||Cr(null!==(i=u)&&void 0!==i?i:null),c="Caret"===(null==s?void 0:s.type)&&u&&!u.shadowRoot&&o&&o!==a&&o.contains(null!=a?a:null);if(!(r||this.dr||h||c))return;const d=Date.now();this.Er=d;const v=this.gr;if(v&&(r||this.dr||h)){const e=vr(t);let i;if(Cr(e))i=e;else if("Caret"===(null==s?void 0:s.type)){var f;Cr(null!==(f=u)&&void 0!==f?f:null)||c?i=u:h&&(i=l)}const n=i?this.Ar(i,v):s&&(o||s.anchorNode)?this.br(s,v):r&&!this.dr&&v.selectionInitiallyRelated;v.selectionChanged=v.selectionChanged||n}this.hr.forEach(t=>{const e=d-t.timestamp;0>e||!Ce(t.selectionChangedDelayMs)&&e>=t.selectionChangedDelayMs||(t.selectionChangedDelayMs=e)})},this.an=()=>{"hidden"===(null==n?void 0:n.visibilityState)&&this.pr();const t=Date.now();this.Or=t,this.Lr("visibilityChangedDelayMs",t)},this.Pr=()=>{const t=Date.now();this.Dr=t,this.Lr("focusChangedDelayMs",t)},this.Fr=t=>{const e=t.touches,i=1===(null==e?void 0:e.length)?e[0]:void 0;this.Nr=i?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this.qr=()=>{this.Nr=void 0},this.jr=t=>{var e;const i=this.Nr;if(this.Nr=void 0,Ce(i)||this.vr>=this.Sr.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.Sr.swipe_threshold_px;if(u*u>a)return;if([this.Rr,this.Br,this.Er].some(t=>Ee(t)&&t>=i.timestamp))return;var h,c;if(this.Hr()&&(null!==(h=null==n||null===(c=n.elementsFromPoint)||void 0===c?void 0:c.call(n,i.x,i.y))&&void 0!==h?h:[]).some(t=>{var e;return null===(e=t.matches)||void 0===e?void 0:e.call(t,Bb)}))return;const d=Nb(s,{type:"swipe",swipeDirection:qb(o,l),swipeDistancePx:Math.round(Math.sqrt(a))});Ie(d)||this.Cr(d)||this.Mr(d),this.Ir()},this.Sr=this.lr(e),this._onCapture=this.Sr.__onCapture}start(t){this.Ur(),this.zr(),this.Wr(),this.Vr(),this.Zr(),this.Gr(t),this.Sr.capture_dead_swipes&&this.Qr()}Gr(e){if(!this.Jr){const i=function(e){return function(e,i){const n=Lb[e];if(n)return n;let s=i[e];if((t=>ke(t)&&-1!==t.toString().indexOf("[native code]"))(s)&&!(null==t?void 0:t.Zone))return Lb[e]=s.bind(i);const r=i.document;if(r&&ke(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 fe(t,"AppleWebKit")&&!fe(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){Rs.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&&ke(s)?Lb[e]=s.bind(i):s}("MutationObserver",e)}(d);this.Jr=new i(t=>{this.Kr(t)}),this.Jr.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var t;null===(t=this.Jr)||void 0===t||t.disconnect(),this.Jr=void 0,d.removeEventListener("click",this._r),d.removeEventListener("mousedown",this.yr,{capture:!0}),d.removeEventListener("mouseup",this.kr,{capture:!0}),d.removeEventListener("mouseout",this.wr,{capture:!0}),d.removeEventListener("dragstart",this.pr,{capture:!0}),d.removeEventListener("pointercancel",this.pr,{capture:!0}),d.removeEventListener("blur",this.pr),this.pr(),d.removeEventListener("scroll",this.Tr,{capture:!0}),null==n||n.removeEventListener("selectionchange",this.$r),d.removeEventListener("touchstart",this.Fr,{capture:!0}),d.removeEventListener("touchend",this.jr,{capture:!0}),d.removeEventListener("touchcancel",this.qr,{capture:!0}),null==n||n.removeEventListener("visibilitychange",this.an),d.removeEventListener("blur",this.Pr),d.removeEventListener("focus",this.Pr),this.Nr=void 0}Kr(t){this.Br=Date.now()}Ur(){Us(d,"click",this._r),Us(d,"mousedown",this.yr,{capture:!0}),Us(d,"mouseup",this.kr,{capture:!0}),Us(d,"mouseout",this.wr,{capture:!0}),Us(d,"dragstart",this.pr,{capture:!0}),Us(d,"pointercancel",this.pr,{capture:!0}),Us(d,"blur",this.pr)}Mr(t){t.selectionChangedDelayMs=Ub(t.timestamp,this.Er,this.Sr.selection_change_threshold_ms),t.visibilityChangedDelayMs=Ub(t.timestamp,this.Or),t.focusChangedDelayMs=Ub(t.timestamp,this.Dr),this.hr.push(t)}Ir(){this.hr.length&&Ce(this.Xr)&&(this.Xr=d.setTimeout(()=>{this.Yr()},1e3))}zr(){Us(d,"scroll",this.Tr,{capture:!0})}Wr(){var t;this.dr="Range"===(null==n||null===(t=n.getSelection())||void 0===t?void 0:t.type),Us(n,"selectionchange",this.$r)}Ar(t,e){const i=e.path[0];for(;t;){if(-1!==e.path.indexOf(t)||sr(i)&&i.contains(t))return!0;t=t.getRootNode().host}return!1}br(t,e){const i=e.path[0],n=t.rangeCount>0?t.getRangeAt(0):void 0;if(n&&sr(i)&&n.startContainer.getRootNode()===i.getRootNode()){var s;if(!n.collapsed)return n.intersectsNode(i);const t=sr(n.startContainer)&&null!==(s=n.startContainer.childNodes[n.startOffset])&&void 0!==s?s:n.startContainer;return this.Ar(t,e)}return this.Ar(t.focusNode,e)||this.Ar(t.anchorNode,e)}Vr(){Us(n,"visibilitychange",this.an)}Zr(){Us(d,"blur",this.Pr),Us(d,"focus",this.Pr)}Lr(t,e){this.hr.forEach(i=>{const n=zb(e-i.timestamp);Ee(n)&&(Ce(i[t])||i[t]>n)&&(i[t]=n)})}Qr(){Us(d,"touchstart",this.Fr,{capture:!0,passive:!0}),Us(d,"touchend",this.jr,{capture:!0,passive:!0}),Us(d,"touchcancel",this.qr,{capture:!0,passive:!0})}Hr(){const t=Ce(this.eo)||Ee(this.Br)&&this.Br>this.eo;return(Ce(this.no)||t)&&(this.eo=Date.now(),this.no=!!(null==n?void 0:n.querySelector(Bb))),!!this.no}Cr(t){return!t||("swipe"===t.type?this.io(t):this.ro(t))}io(e){return!(!nr(e.node)&&!this.hr.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!rr(e.node,"html")&&sr(e.node)&&function(e,i){var n;if(!t||Tr(e))return!1;const s=Re(i)?kr:null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:kr,{targetElementList:r}=Ir(e,!1);return!gr(r,s)}(e.node,{css_selector_ignorelist:this.Sr.css_selector_ignorelist}))}ro(e){return!(this.Sr.capture_clicks_with_modifier_keys||(i=e.originalEvent,!(i.ctrlKey||i.metaKey||i.altKey||i.shiftKey)))||!!this.io(e)||function(e){if(!t||Tr(e))return!1;const{targetElementList:i}=Ir(e,!1);return i.some(t=>rr(t,"a"))}(e.node);var i}Yr(){if(!this.hr.length)return;clearTimeout(this.Xr),this.Xr=void 0;const t=this.hr;this.hr=[];for(const i of t){var e;i.mutationDelayMs=null!==(e=i.mutationDelayMs)&&void 0!==e?e:this.Br&&this.Br>=i.timestamp?this.Br-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const t=Hb(i.scrollDelayMs,this.Sr.scroll_threshold_ms),n=Hb(i.selectionChangedDelayMs,this.Sr.selection_change_threshold_ms),s=Hb(i.mutationDelayMs,this.Sr.mutation_threshold_ms),r=Hb(i.absoluteDelayMs,1.1*this.Sr.mutation_threshold_ms),o=Ee(i.scrollDelayMs)&&this.Sr.scroll_threshold_ms>i.scrollDelayMs,l=Ee(i.mutationDelayMs)&&this.Sr.mutation_threshold_ms>i.mutationDelayMs,a=i.selectionChangedDuringGesture||Ee(i.selectionChangedDelayMs)&&this.Sr.selection_change_threshold_ms>i.selectionChangedDelayMs,u=Ee(i.visibilityChangedDelayMs),h=Ee(i.focusChangedDelayMs);if(!(o||l||a||u||h))if(t||s||r||n){const e=jb(i);if("$dead_swipe"===e){if(this.vr>=this.Sr.max_dead_swipes_per_page_load)continue;this.vr++}this._onCapture(i,{[`${e}_last_mutation_timestamp`]:this.Br,[`${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.Sr.mutation_threshold_ms>i.absoluteDelayMs&&this.hr.push(i)}this.Ir()}cr(t,e){const i=jb(t);this.instance.capture(i,le(le(le({},e),Ob(t.node,{e:t.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Sr.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:t.scrollDelayMs,[`${i}_mutation_delay_ms`]:t.mutationDelayMs,[`${i}_absolute_delay_ms`]:t.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:t.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:t.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:t.focusChangedDelayMs,$dead_swipe_direction:t.swipeDirection,$dead_swipe_distance_px:t.swipeDistancePx}),{timestamp:new Date(t.timestamp)})}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initDeadClicksAutocapture=(t,e)=>new Wb(t,e);const Vb=As("[ExternalScriptsLoader]"),Gb=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]},Zb=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return Vb.warn(`${e} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const s=Gb(e);if(s){if(s.__posthog_loading_callback_fired)return i();const t=s.__posthog_loading_error;return t?i(t):(s.addEventListener("load",t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)}),void s.addEventListener("error",t=>{s.__posthog_loading_error=t,i(t)}))}const r=()=>{if(!n)return i("document not found");if(Gb(e))return Zb(t,e,i);let s=n.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)n.head.appendChild(s);else{const t=n.querySelectorAll("body > script");var r;t.length>0?null===(r=t[0].parentNode)||void 0===r||r.insertBefore(s,t[0]):n.body.appendChild(s)}};(null==n?void 0:n.body)?r():null==n||n.addEventListener("DOMContentLoaded",r)},Qb={},Jb=(t,e)=>{let i=`/static/${e}.js?v=${t.version}`;if("toolbar"===e){const t=3e5;i=`${i}&t=${Math.floor(Date.now()/t)*t}`}return t.requestRouter.endpointFor("assets",i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"===e){const e=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void Zb(t,e,i)}const n=t.config.strict_script_versioning;if(n){const s=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=Qb[s];if("fallback"===n&&r){if(Gb(r))return void Zb(t,r,i);delete Qb[s]}return void Zb(t,s,"fallback"===n?(n,r)=>{if(n)if("string"==typeof n)i(n);else{var o;const n=Jb(t,e);Qb[s]=n;const r=Gb(s);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),Zb(t,n,i)}else i(void 0,r)}:i)}Zb(t,Jb(t,e),i)},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{const n=t.requestRouter.endpointFor("api",e);Zb(t,n,i)};var Kb=class{constructor(t){this._instance=t}get Sr(){return this._instance.config}get consent(){return this.xo()?0:this.Co}isOptedOut(){return"always"===this.Sr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Sr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Sr.opt_out_capturing_by_default}optInOut(t){this.$o.At(this.To,t?1:0,this.Sr.cookie_expiration,this.Sr.cross_subdomain_cookie,this.Sr.secure_cookie)}reset(){this.$o.Lt(this.To,this.Sr.cross_subdomain_cookie)}get To(){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 Co(){const t=this.$o.Ot(this.To);return He(t)?1:fe(ze,t)?0:-1}get $o(){const t=this.Sr.opt_out_capturing_persistence_type,e="localStorage"===t?xl:kl,i=e.Et()?e:Dl;if(!this.Io||this.Io!==i){this.Io=i;const e="localStorage"===t?kl:xl;e.Ot(this.To)&&(this.Io.Ot(this.To)||this.optInOut(He(e.Ot(this.To))),e.Lt(this.To,this.Sr.cross_subdomain_cookie))}return this.Io}xo(){return!!this.Sr.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(t=>He(t))}};const Yb=As("[Dead Clicks]"),Xb=()=>!0,t_=t=>{var e;const i=!!(null===(e=t.instance.persistence)||void 0===e?void 0:e.get_property(M)),n=t.instance.config.capture_dead_clicks;return Re(n)?n:!!Se(n)||i};var e_=class{get lazyLoadedDeadClicksAutocapture(){return this.Mo}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({[M]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Eo(()=>{this.Po()}):this.stop()}Eo(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this.instance,"dead-clicks-autocapture",e=>{e?Yb.error("failed to load script",e):t()})}Po(){var t;if(n){if(!this.Mo&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=Se(this.instance.config.capture_dead_clicks)?le({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Mo=d.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Mo.start(n),Yb.info("starting...")}}else Yb.error("`document` not found. Cannot start.")}stop(){this.Mo&&(this.Mo.stop(),this.Mo=void 0,Yb.info("stopping..."))}};const i_=As("[SegmentIntegration]");function n_(t,e,i=!0){const n=t.config.segment;if(!n)return e();const{analytics:s,filterProperties:r}=(t=>ke(t.register))(o=n)?{analytics:o}:o;var o;!function(t,e,i,n){const s=e=>{const s=()=>e.anonymousId()||ml();t.config.get_device_id=s,n&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property(xt,Zt)),i(n?void 0:e.anonymousId()||void 0)},r=e.user();"then"in r&&ke(r.then)?r.then(s):s(r)}(t,s,i=>{s.register(((t,e,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||i_.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()||(i_.info("No userId set, resetting PostHog"),t.reset()),r||(e=void 0),n.event.userId&&n.event.userId!==t.get_distinct_id()&&(i_.info("UserId set, identifying with PostHog"),t.identify(n.event.userId));let o=t.calculateEventProperties(s,n.event.properties);if(!Me(i)){const t=n.event.properties||{},e={};for(const i of Object.keys(o))be.call(t,i)||(e[i]=o[i]);const s=((t,e)=>{const i=we(t)?t:[t];let n=le({},e);for(const t of i)try{if(n=t(n),Me(n))return null}catch(t){return i_.error("Error in Segment filterProperties:",t),null}return n})(i,e);if(Me(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,Yt)},identify(t){return n(t,te)},screen(t){return n(t,"$screen")}}})(t,i,{filterProperties:r})).then(()=>{e()},t=>{i_.error("Failed to register the Segment integration",t),e()})},i)}const s_="posthog-js";function r_(t,{organization:e,projectId:i,prefix:n,severityAllowList:s=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var l,a,u,h,c;if("*"!==s&&!s.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const d=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,t.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const v=(null===(l=o.exception)||void 0===l?void 0:l.values)||[],f=v.map(t=>le(le({},t),{},{stacktrace:t.stacktrace?le(le({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>le(le({},t),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:(null===(a=v[0])||void 0===a?void 0:a.value)||o.message,$exception_type:null===(u=v[0])||void 0===u?void 0:u.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(h=v[0])||void 0===h?void 0:h.value)||o.message,$sentry_exception_type:null===(c=v[0])||void 0===c?void 0:c.type,$sentry_tags:o.tags};var g;return e&&i&&(p.$sentry_url=(n||"https://sentry.io/organizations/")+e+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(g=t.exceptions)||void 0===g||g.sendExceptionEvent(p)),o}}var o_=class{constructor(t,e,i,n,s,r){this.name=s_,this.setupOnce=function(o){o(r_(t,{organization:e,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:null==r||r}))}}},l_=class{constructor(t){this.Ro=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Rs.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Ao=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Fo()}Fo(){var t;this.Oo=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.Ro)}destroy(){var t;null===(t=this.Oo)||void 0===t||t.call(this),this.Oo=void 0}doPageView(e,i){var n;const s=this.Do(e,i);return this.Ao={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.Do(t,null===(e=this.Ao)||void 0===e?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.Ao)||void 0===t?void 0:t.pageViewId}}Do(t,e){const i=this.Ao;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?Ve(e/t,0,1,Rs):1,a=t>1?Ve(i/t,0,1,Rs):1,u=r>1?Ve(o/r,0,1,Rs):1,h=r>1?Ve(l/r,0,1,Rs):1;n=Ds(n,{$prev_pageview_last_scroll:e,$prev_pageview_last_scroll_percentage:s,$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:a,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:u,$prev_pageview_max_content:l,$prev_pageview_max_content_percentage:h})}}return i.pathname&&(n.$prev_pageview_pathname=i.pathname),i.timestamp&&(n.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),n}};const a_=["flags","surveys"],u_={[v]:{exposure:"hidden"},[m]:{exposure:"hidden"},[y]:{exposure:"hidden"},[w]:{exposure:"hidden"},[_]:{exposure:"hidden"},[k]:{exposure:"event"},[S]:{exposure:"hidden"},[P]:{exposure:"hidden"},[x]:{exposure:"event"},[C]:{exposure:"hidden"},[T]:{exposure:"event"},[I]:{exposure:"event"},[M]:{exposure:"event"},[E]:{exposure:"hidden"},[R]:{exposure:"event"},[A]:{exposure:"hidden"},[F]:{exposure:"hidden"},[j]:{exposure:"hidden"},[B]:{exposure:"event"},[O]:{exposure:"event",shouldSkipFromEventProperties:t=>Ie(t)},[H]:{exposure:"event"},[z]:{exposure:"event"},[U]:{exposure:"event"},[Z]:{exposure:"event"},[Q]:{exposure:"hidden"},[J]:{exposure:"hidden",storageGroup:"flags"},[K]:{exposure:"hidden",storageGroup:"flags"},[Y]:{exposure:"hidden"},[X]:{exposure:"hidden",storageGroup:"flags"},[tt]:{exposure:"hidden",storageGroup:"flags"},[et]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[it]:{exposure:"hidden",storageGroup:"flags"},[nt]:{exposure:"hidden"},[st]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[ot]:{exposure:"hidden"},[at]:{exposure:"hidden",storageGroup:"surveys"},[ut]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ht]:{exposure:"event"},[ct]:{exposure:"hidden"},[dt]:{exposure:"hidden"},[vt]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[pt]:{exposure:"hidden"},[gt]:{exposure:"event"},[mt]:{exposure:"event"},[yt]:{exposure:"event"},[bt]:{exposure:"event"},[_t]:{exposure:"hidden"},[wt]:{exposure:"hidden"},[lt]:{exposure:"event"},[kt]:{exposure:"hidden"},[St]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[xt]:{exposure:"hidden"},[Ct]:{exposure:"hidden"},[$t]:{exposure:"hidden"},[Tt]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[Et]:{exposure:"hidden"},[D]:{exposure:"event"},[L]:{exposure:"event"},[N]:{exposure:"event"},[q]:{exposure:"event"},[At]:{exposure:"event"},[Ft]:{exposure:"event"},[Ot]:{exposure:"event"},[Dt]:{exposure:"event"},[Lt]:{exposure:"event"},[Nt]:{exposure:"event"},[qt]:{exposure:"event"},[jt]:{exposure:"event"},[Bt]:{exposure:"event"},[Ht]:{exposure:"event"},[Wt]:{exposure:"event"}},h_=[[W,{exposure:"hidden"}],[V,{exposure:"hidden"}],[G,{exposure:"hidden"}]],c_=t=>{const e=u_[t];if(e)return e;for(const[e,i]of h_)if(0===t.indexOf(e))return i},d_={flags:St,surveys:ut},v_=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],f_=t=>`${t}_cookie_identity_change_pending`,p_=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},g_="main",m_=[J,K,X,tt,et,St,it,rt],y_=t=>-1!==m_.indexOf(t),b_=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},__=t=>{if(!t)return{};const e=JSON.parse(t);return Se(e)?e:{}},w_=(t,e)=>{Os(t,(i,n)=>{const s=c_(n);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,n)||delete t[n]})};var k_=class{constructor(e,i,n=!0){if(this.Lo={},this.No=!1,this.qo=!1,this.jo=!1,this.Bo=!1,this.Ho=!1,this.zo=new Map,this.Uo=!1,this.Wo=!1,this.Vo=!1,this.Go=!1,this.Zo=new Set,this.Sr=e,this.Qo=n,this.props={},this.Jo=void 0,this.Ko=(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.$o=this.Yo(e),this.jo=this.Xo(e),this.load(),this.tl(),e.debug&&Rs.info("Persistence loaded",e.persistence,le({},this.props)),this.update_config(e,e,i),this.save(),t){const e=()=>this.flush();Us(t,"beforeunload",e,{capture:!1}),Us(t,"pagehide",e,{capture:!1}),this.el=e=>{if(this.No&&(!e.storageArea||e.storageArea===(null==t?void 0:t.localStorage))&&e.key)if(e.key!==this.Ko){if(this.jo){const t=a_.find(t=>e.key===this.il(t));t&&this.nl(e.key,t)}}else this.nl(e.key,g_)},Us(t,"storage",this.el)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,e])=>{const i=this.zo.get(t);if(!y_(t)||!0===i)return;if(!0===e)return void this.sl(t,!0);const n=new Set(i||[]);e.forEach(t=>n.add(t)),n.size&&this.sl(t,n)})}onCrossTabFeatureFlagChange(t){return this.Zo.add(t),()=>this.Zo.delete(t)}destroy(){this.el&&t&&(t.removeEventListener("storage",this.el),this.el=void 0),this.Zo.clear()}nl(t,e,i=!0){if(this.pi)return!1;let n,s;try{if(s=xl.Ot(t),Ie(s)){const t=this.rl(e);return t.storageValue=null,e!==g_&&(t.persisted=!1),!1}n=__(s)}catch(t){return!1}const r=e===g_?n:xl.Dt(this.Ko);if(r&&this.ol(r))return!1;const o=this.ll(n,e,i);return e===g_&&this.jo&&!b_(this.al().main,n)||this.ul(n,e,!0,s),o}ol(t){const e=this.props[f],i=t[f];return!Ce(e)&&!Ce(i)&&e!==i}ul(t,e,i,n){const s=this.rl(e);s.storageValue=n,e!==g_&&(s.persisted=i);try{s.fingerprint=this.hl(t,e)}catch(t){s.fingerprint=void 0}}ll(t,e,i){let n=!1;return m_.forEach(i=>{var s;const r=null===(s=c_(i))||void 0===s?void 0:s.storageGroup;if(e===g_&&this.jo&&r||e!==g_&&r!==e)return;const o=i in t,l=this.cl(i,o?t[i]:void 0),a=this.zo.has(i)?i in this.props:o;a===i in this.props&&b_(l,this.props[i])||(a?this.dl(i,l,!1):this.vl(i,!1),n=!0)}),n&&i&&this.Zo.forEach(t=>t()),n}fl(){if(!this.No)return!1;try{this.Vo=!1;const t=xl.Ot(this.Ko),e=this.rl(g_);let i,n=!1,s=!1;if(t!==e.storageValue)if(Ie(t))e.storageValue=null;else{if(i=__(t),this.Vo=!this.Wo&&this.ol(i),this.Vo)return!1;s=this.ll(i,g_,!1),!this.jo||b_(this.al().main,i)?this.ul(i,g_,!0,t):e.storageValue=t,n=!0}return this.jo&&a_.forEach(t=>{const e=xl.Ot(this.il(t)),r=this.rl(t),o=i||{},l=n&&m_.some(e=>{var i;return(null===(i=c_(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.ll(o,t,!1)||s));const a=__(e);s=this.ll(a,t,!1)||s,this.ul(a,t,!0,e)}),s}catch(t){return!1}}sl(t,e){this.zo.set(t,e);const i=c_(t);(null==i?void 0:i.volatile)||(this.rl((this.jo?null==i?void 0:i.storageGroup:void 0)||g_).fingerprint=void 0,this.pl(t))}gl(){m_.forEach(t=>this.zo.set(t,!0))}tl(){if(this.No)try{const t=xl.Ot(this.Ko),e=__(t);this.rl(g_).storageValue=t,m_.forEach(t=>{var i;const n=this.jo?null===(i=c_(t))||void 0===i?void 0:i.storageGroup:void 0,s=n?xl.Ot(this.il(n)):null;if(n){const t=this.rl(n);t.storageValue=s,t.persisted=!Ie(s)}const r=n&&!Ie(s)?__(s):e;t in this.props?this.ml(t,r[t],this.props[t]):t in r&&this.sl(t,!0)})}catch(t){}}cl(t,e){const i=this.zo.get(t);if(!i)return e;if(!0===i)return this.props[t];if("$active_feature_flags"===t){const n=new Set(we(e)?e:[]),s=new Set(we(this.props[t])?this.props[t]:[]);return i.forEach(t=>s.has(t)?n.add(t):n.delete(t)),Array.from(n)}const n=Se(e)?le({},e):{},s=Se(this.props[t])?this.props[t]:{};return i.forEach(t=>{t in s?n[t]=s[t]:delete n[t]}),n}ml(t,e,i){if(!y_(t))return;const n=this.zo.get(t);if(!0===n)return;let s=e;if(this.No)try{var r;const e=this.jo?null===(r=c_(t))||void 0===r?void 0:r.storageGroup:void 0,i=e?this.il(e):this.Ko;s=__(xl.Ot(i))[t]}catch(t){}const o=new Set(n||[]);if("$active_feature_flags"===t){if(!Ce(e)&&!we(e)||!Ce(s)&&!we(s)||!we(i))return void this.sl(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(!Se(i))return void(b_(s,i)?this.zo.delete(t):this.sl(t,!0));{if(!Ce(e)&&!Se(e)||Ce(e)&&xe(i)&&Ce(s))return void this.sl(t,!0);const n=Se(e)?e:{},r=Se(s)?s:{};new Set([...Object.keys(n),...Object.keys(i)]).forEach(t=>{t in n==t in i&&b_(n[t],i[t])||o.add(t)}),o.forEach(t=>{t in r==t in i&&b_(r[t],i[t])&&o.delete(t)})}}o.size?this.sl(t,o):this.zo.delete(t)}yl(){var t;const e=null===(t=this.Sr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Ee(e)&&e>0?e:0}bl(t){if(this.Sr.cookieWinsOnConflict&&"localstorage+cookie"===this.Sr.persistence.toLowerCase())if(t)try{const e=El(t,this.Sr.cookie_persisted_properties||[]),i=Rl(e,this.Sr.cookie_persisted_properties||[]),n=JSON.stringify(e)+"|"+JSON.stringify(i),s=kl.Ot(this.Ko)||void 0;s&&Fl(this.Ko,s)===n&&(this._l=n,this.wl=s)}catch(t){}else try{const t=kl.Ot(this.Ko)||void 0;this._l=t?Fl(this.Ko,t):void 0,this.wl=t}catch(t){}}syncCookieProperties(){return this.kl(this.Sr)}kl(t,e=!1){if(this.pi&&!e||this.Ho||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let i;try{i=kl.Ot(this.Ko)||void 0}catch(t){}if(!i||i===this.wl)return!1;const n=Fl(this.Ko,i);let s;try{s=Ml(JSON.parse(i))}catch(t){return!1}if((kl.Ot(this.Ko)||void 0)!==i)return!1;this._l=n,this.wl=i;const r=Al(this.Ko,i),o=[...$l,...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])}),xe(s))return!1;const a="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,u=this.props,h=u[f],c=u[xt],d=Ds({},u);[...$l,...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===$l.indexOf(t)||!1!==e&&0!==e)&&delete d[t]}}),this.props=Ds(d,s),m_.forEach(t=>{const e=t in this.props;t in u===e&&b_(u[t],this.props[t])||(e?this.ml(t,u[t],this.props[t]):this.sl(t,!0))}),!a||"$user_state"in s||"$user_state"in this.props||this.dl(xt,Gt);const v=this.props[f],p=this.props[xt];return!a||v===h&&p===c||(this.Wo=!0,this.Bo=!0,Nl.At(f_(this.Ko),!0),this.vl(rt),this.vl(K),this.vl(J),this.vl(X),this.vl(tt),this.vl(et),this.vl(St),this.vl(kt),this.vl(_t),"anonymous"!==p||"identified"!==c&&"anonymous"!==s.$user_state&&(Ce(h)||v===h)||(w_(this.props,s),this.vl(ot)),"identified"===p?this.props.$user_id=v:delete this.props.$user_id,this.vl(m)),!0}consumeCookieIdentityChange(){const t=f_(this.Ko),e=this.Bo||!!Nl.Ot(t);return this.Bo=!1,e&&Nl.Lt(t),e}Sl(t=!1){return!(this.Ho||this.pi&&!t||!this.Sr.cookieWinsOnConflict||"localstorage+cookie"!==this.Sr.persistence.toLowerCase()||(this.Ho=!0,0))}xl(){this.Ho&&(Ce(this.Cl)||(clearTimeout(this.Cl),this.Cl=void 0),delete this.Lo[g_],this.$l(!0))}Tl(t=!0){if(this.Ho)try{t?this.xl():Ce(this.Cl)||(clearTimeout(this.Cl),this.Cl=void 0)}finally{this.Ho=!1}}isDisabled(){return!!this.pi}Yo(e){-1===v_.indexOf(e.persistence.toLowerCase())&&(Rs.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const i=((e=[],i=!1)=>{const n=[...$l,...e];return le(le({},xl),{},{Dt(t){try{let s,r={};try{s=kl.Ot(t)||void 0,r=s?Ml(JSON.parse(s)):{}}catch(t){}const o=JSON.parse(xl.Ot(t)||"{}");let l;if(i){const i=Al(t,s),a=[...$l,...i.properties],u={};Object.keys(r).forEach(t=>{const e=r[t];Ie(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e||(u[t]=e)});const h="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var e;const t=o[f],s=null!==(e=o.$user_state)&&void 0!==e?e:Gt;n.forEach(t=>{if(-1!==a.indexOf(t)&&!(t in r)&&(h||"distinct_id"!==t&&"$user_state"!==t)){const e=o[t];(i.isValid||-1===$l.indexOf(t)||!1!==e&&0!==e)&&delete o[t]}}),!h||"$user_state"in r||"$user_state"in o||(o[xt]=Gt),!h||("distinct_id"in u?u[f]:o[f])===t&&("$user_state"in u?u[xt]:o[xt])===s||(Cl.forEach(t=>delete o[t]),"identified"===u.$user_state&&"distinct_id"in u?o.$user_id=u[f]:delete o.$user_id,"identified"!==u.$user_state&&(delete o[lt],delete o[ot]),delete o.__alias)}l=Ds(o,u)}else l=Ds(r,o);return xl.At(t,l),l}catch(t){}return null},At(t,n,s,r,o,l){const a=xl.At(t,n,void 0,void 0,l);try{const u=El(n,e);if(Object.keys(u).length){if(i){const i=Tl(t),h=Rl(u,e);if(kl.At(i,h,s,r,o,l),kl.Ot(i)!==JSON.stringify(h)){kl.Lt(i,r);const e=El(n);return kl.At(t,e,s,r,o,l),a}}kl.At(t,u,s,r,o,l)}}catch(t){xl.Pt(t)}return a},Lt(e,i){try{null==t||t.localStorage.removeItem(e),kl.Lt(e,i),kl.Lt(Tl(e),i)}catch(t){xl.Pt(t)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let n,s=!1,r=!1;const o=e.persistence.toLowerCase();return"localstorage"===o&&xl.Et()?(n=xl,r=!0):"localstorage+cookie"===o&&i.Et()?(n=i,r=!0,s=!0):"sessionstorage"===o&&Nl.Et()?n=Nl:"memory"===o?n=Dl:"cookie"===o&&kl.Et()?(n=kl,s=!0):i.Et()?(n=i,r=!0,s=!0):kl.Et()?(n=kl,s=!0):n=Dl,this.No=r,this.qo=s,n}il(t){return`${this.Ko}__${t}`}Xo(t){return this.No&&!!t.split_storage}properties(){const t={};return Os(this.props,(e,i)=>{const n=c_(i);if(!n||"event"===n.exposure){var s;if(null==n||null===(s=n.shouldSkipFromEventProperties)||void 0===s?void 0:s.call(n,e))return;t[i]=e}}),t}load(t=!1){if(this.pi&&!t)return;const e=this.Sr.cookieWinsOnConflict&&"localstorage+cookie"===this.Sr.persistence.toLowerCase(),i=e?xl.Dt(this.Ko):null;let n={};if(e)try{n=Ml(kl.Dt(this.Ko)),Os(n,(t,e)=>{(Ce(t)||Ie(t)||""===t)&&delete n[e]})}catch(t){}const s=this.$o.Dt(this.Ko);if(s&&(this.props=Ds({},s)),this.jo&&this.Il(),e&&s){var r,o;const t=null==i?void 0:i[f],e=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Gt,l=s[f],a=null!==(o=s.$user_state)&&void 0!==o?o:Gt;if(l!==t||a!==e){this.Bo=!0,Nl.At(f_(this.Ko),!0);const i=Ds({},this.props);Cl.forEach(t=>delete i[t]),"anonymous"!==a||"identified"!==e&&"anonymous"!==n.$user_state&&(Ce(t)||l===t)||(w_(i,n),delete i[ot]),this.props=i;const s=new Set;Cl.forEach(t=>{var e;const i=null===(e=c_(t))||void 0===e?void 0:e.storageGroup;i&&s.add(i)}),s.forEach(t=>{const e={};Os(this.props,(i,n)=>{var s;(null===(s=c_(n))||void 0===s?void 0:s.storageGroup)===t&&(e[n]=i)}),xe(e)?(xl.Lt(this.il(t)),this.Lo[t]={}):xl.At(this.il(t),e)&&(this.Lo[t]={persisted:!0,fingerprint:this.hl(e,t)})})}}Nl.Ot(f_(this.Ko))&&(this.Bo=!0)}Il(){for(const t of a_){const e=xl.Dt(this.il(t));if(e&&!xe(e)){const i=this.rl(t);i.persisted=!0,this.Ml(t)||(i.fingerprint=this.hl(e,t)),this.El(t,e)||Ds(this.props,e)}}}Ml(t){return Object.keys(this.props).some(e=>{var i;return(null===(i=c_(e))||void 0===i?void 0:i.storageGroup)===t})}El(t,e){const i=d_[t];if(!i)return!1;const n=e[i],s=this.props[i];return Ee(n)&&Ee(s)&&s>n}refreshKey(t){var e;if(this.pi)return;if("$fbc_persistence"===t&&this.Go)return;const i=this.jo?null===(e=c_(t))||void 0===e?void 0:e.storageGroup:void 0,n=i?xl.Dt(this.il(i)):this.$o.Dt(this.Ko);if(n&&t in n)this.dl(t,n[t],!1);else{if(i){const e=this.$o.Dt(this.Ko);if(e&&t in e)return void this.dl(t,e[t],!1)}this.vl(t,!1)}}save(){if(this.pi)return;const t=this.yl();t>0?Ce(this.Cl)&&(this.Cl=setTimeout(()=>{this.Cl=void 0,this.$l()},t)):this.$l()}flush(){Ce(this.Cl)||(clearTimeout(this.Cl),this.Cl=void 0,this.$l())}$l(t=!1){if(this.pi||this.Ho&&!t)return;t||(this.syncCookieProperties(),this.Go||this.Sr.cookieWinsOnConflict&&"localstorage+cookie"===this.Sr.persistence.toLowerCase()||this.refreshKey(_));const e=!t&&!this.Uo;e||(this.Vo=!1);const i=!!e&&this.fl();if(this.Vo)return void(this.Sr.debug&&Rs.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.jo)return this.Pl(),void(i&&this.Zo.forEach(t=>t()));const n=this.Rl(this.$o,this.Ko,this.props,g_);"written"===n&&this.bl(this.props),"failed"!==n&&(this.zo.clear(),this.Wo=!1,this.Go=!1),i&&this.Zo.forEach(t=>t())}Pl(){const{main:t,groups:e}=this.al(),i=this.Rl(this.$o,this.Ko,t,g_);"written"===i&&this.bl(t),"failed"!==i&&(this.Wo=!1,this.Go=!1,m_.forEach(t=>{var e;(null===(e=c_(t))||void 0===e?void 0:e.storageGroup)||this.zo.delete(t)}));for(const t of a_){var n;const i=e[t];if(xe(i)&&!(null===(n=this.Lo[t])||void 0===n?void 0:n.persisted)){m_.forEach(e=>{var i;(null===(i=c_(e))||void 0===i?void 0:i.storageGroup)===t&&this.zo.delete(e)});continue}const s=this.Rl(xl,this.il(t),i,t);"failed"!==s&&m_.forEach(e=>{const i=c_(e);(null==i?void 0:i.storageGroup)!==t||"written"!==s&&i.volatile||this.zo.delete(e)})}}al(){const t={},e={flags:{},surveys:{}};return Os(this.props,(i,n)=>{var s;const r=null===(s=c_(n))||void 0===s?void 0:s.storageGroup;r?e[r][n]=i:t[n]=i}),{main:t,groups:e}}hl(t,e){if(e===g_)return JSON.stringify(t)+"|"+this.Al+"|"+this.Fl+"|"+this.Ol;const i={};return Os(t,(t,e)=>{var n;i[e]=(null===(n=c_(e))||void 0===n?void 0:n.volatile)?"__volatile__":t}),JSON.stringify(i)}Rl(t,e,i,n){const s=this.rl(n);if(n!==g_&&!s.dirty&&!Ce(s.fingerprint))return"skipped";let r;try{if(r=this.hl(i,n),r===s.fingerprint)return s.dirty=!1,"skipped"}catch(t){r=void 0}return t.At(e,i,this.Al,this.Fl,this.Ol,this.Sr.debug)?(s.dirty=!1,n!==g_&&(s.persisted=!0),Ce(r)||(s.fingerprint=r),this.No&&(s.storageValue=xl.Ot(e)),"written"):(this.Sr.debug&&Rs.warn(`failed to persist storage entry "${e}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.gl(),Ce(this.Cl)||(clearTimeout(this.Cl),this.Cl=void 0),this.$o.Lt(this.Ko,!1),this.$o.Lt(this.Ko,!0),!t&&this.Qo)for(const t of a_)xl.Lt(this.il(t));t?delete this.Lo[g_]:this.Lo={},this._l=void 0,this.wl=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(Se(t)){this.syncCookieProperties(),Ce(e)&&(e="None"),this.Al=Ce(i)?this.Dl:i;let n=!1;if(Os(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.dl(i,t),n=!0)}),n)return this.save(),!0}return!1}register(t,e){if(Se(t)){this.syncCookieProperties(),this.Al=Ce(e)?this.Dl:e;let i=!1;if(Os(t,(e,n)=>{t.hasOwnProperty(n)&&(this.props[n]!==e||Se(e)||we(e))&&(this.dl(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.vl(t),i=!0);i&&this.save()}update_campaign_params(){const t=null==n?void 0:n.URL;if(t===this.Jo)return;const e=ga(this.Sr.custom_campaign_params,this.Sr.mask_personal_data_properties,this.Sr.custom_personal_data_properties),i=!xe(js(e));return i&&this.register(e),this.Jo=t,i?e:void 0}update_search_keyword(){this.register(function(){const t=null==n?void 0:n.referrer;return t?ya(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:ka(),$referring_domain:(null==n?void 0:n.referrer)&&(null===(t=Zs(n.referrer))||void 0===t?void 0:t.host)||wa},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Sa(this.Sr.mask_personal_data_properties,this.Sr.custom_personal_data_properties,this.Sr.disable_capture_url_hashes);this.register_once({[Mt]:this.qo?{r:p_(t.r),u:t.u?p_(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Os([It,Tt],e=>{const i=this.props[e];i&&Os(i,function(e,i){t["$initial_"+ge(i)]=e})});const e=this.props[Mt];if(e){const i=function(t,e=!1){const i=xa(t,e),n={};return Os(i,function(t,e){n[`$initial_${ge(e)}`]=t}),n}(e,this.Sr.disable_capture_url_hashes);Ds(t,i)}return t}safe_merge(t){return Os(this.props,function(e,i){i in t||(t[i]=e)}),t}update_config(t,e,i){const n=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;const i=[...t].sort(),n=[...e].sort();return i.every((t,e)=>t===n[e])})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),r=n||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,l=t.disable_persistence||!!i,a=!!this.pi&&!l;l||this.kl(e,a),this.Sr=t,!l&&(n||s||o)&&(this._l=void 0,this.wl=void 0,this.kl(le(le({},t),{},{cookie_persisted_properties:e.cookie_persisted_properties}),a));const u=r||o?this.Yo(t):this.$o;this.Ll();const h=this.Xo(t),c=r||h!==this.jo,d=!l&&(c||t.cross_subdomain_cookie!==this.Fl||t.secure_cookie!==this.Ol)&&this.Sl(a);this.Uo=c;try{if(this.Dl=this.Al=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),c){const t=this.props;this.clear(),this.$o=u,this.jo=h,this.props=t,this.save()}else o&&(this.$o=u,l||(delete this.Lo[g_],this.$l()))}finally{this.Uo=!1,d&&this.Tl()}}Ll(){const t=this.props[Mt];if(!this.qo||!Se(t)||"string"!=typeof t.r)return;const e=p_(t.r),i="string"==typeof t.u?p_(t.u):t.u;e===t.r&&i===t.u||this.dl(Mt,le(le({},t),{},{r:e,u:i}))}set_disabled(t){this.pi=t,this.pi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Fl&&(this.Fl=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Ol&&(this.Ol=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){const i=this.props.__timers||{};i[t]=e,this.dl(w,i),this.save()}remove_event_timer(t){const e=this.props.__timers||{},i=e[t];return Ce(i)||(delete e[t],this.dl(w,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.dl(t,e),this.save()}dl(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.Wo=!0),"$fbc_persistence"!==t||b_(s,e)||(this.Go=!0),this.ml(t,s,e),(null===(n=c_(t))||void 0===n?void 0:n.volatile)||this.pl(t))}vl(t,e=!0){delete this.props[t],e&&(y_(t)&&this.sl(t,!0),"$fbc_persistence"===t&&(this.Go=!0),this.pl(t))}pl(t){var e;const i=null===(e=c_(t))||void 0===e?void 0:e.storageGroup;i&&(this.rl(i).dirty=!0)}rl(t){return this.Lo[t]||(this.Lo[t]={})}};const S_=As("[RateLimiter]");var x_=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=>{S_.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void S_.warn(`could not rate limit - continuing. Error: "${null==t?void 0:t.message}"`,{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t=!1){var e,i,n;const{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,o=(new Date).getTime(),l=null!==(e=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_property("$capture_rate_limit"))&&void 0!==e?e:{tokens:s,last:o};l.tokens+=(o-l.last)/1e3*r,l.last=o,l.tokens>s&&(l.tokens=s);const a=1>l.tokens;if(a||t||(l.tokens=Math.max(0,l.tokens-1)),a&&!t){const t=(Ee(l.dropped)?l.dropped:0)+1;l.dropped=t,!this.lastEventRateLimited&&this.Nl(t)&&(l.dropped=0)}return this.lastEventRateLimited=a,null===(n=this.instance.persistence)||void 0===n||n.set_property("$capture_rate_limit",l),{isRateLimited:a,remainingTokens:l.tokens}}ql(t){const e=this.instance.config.property_denylist;return!we(e)||!e.includes(t)}jl(){var t;if(this.ql("$current_url")&&this.ql("$pathname")&&(null==s?void 0:s.pathname))return`${null!==(t=s.origin)&&void 0!==t?t:""}${s.pathname}`}Nl(t){var e,i;const{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,r=this.jl(),o=this.ql("$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 C_=As("[RemoteConfig]");var $_=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=d._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Bl(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.loadExternalDependency)?null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Hl(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:t})}load(){try{if(this.remoteConfig)return C_.info("Using preloaded remote config",this.remoteConfig),void this.zl(this.remoteConfig);if(this._instance.Ul())return void C_.warn("Remote config is disabled. Falling back to local config.");this.Bl(t=>{if(!t)return C_.info("No config found after loading remote JS config. Falling back to JSON."),void this.Hl(t=>{this.zl(t.json,t)});this.zl(t)})}catch(t){C_.error("Error loading remote config",t),this.zl()}}zl(t,e){!t&&e&&(0===e.statusCode?e.error||C_.warn("Failed to fetch remote config from PostHog."):C_.error("Failed to fetch remote config from PostHog."));try{this._instance.zl(t?{ok:!0,config:t}:{ok:!1})}catch(t){C_.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){C_.error("Error loading feature flags",t)}}};const T_=!!o||!!r,I_="text/plain";let M_=!1;const E_=(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}`:""}`},P_=(t,e,i=!0)=>{var n;const[s,r]=t.split("?"),o=le({},e),l=null!==(n=null==r?void 0:r.split("&").map(t=>{var e;const[n,s]=t.split("="),r=i&&null!==(e=o[n])&&void 0!==e?e:s;return delete o[n],`${n}=${r}`}))&&void 0!==n?n:[],a=Qs(o);return a&&l.push(a),l.length>0?`${s}?${l.join("&")}`:s},R_=t=>{if(t.Wl)return t.Wl;const{data:e,compression:i}=t;if(!e)return;if(i===Kf){const t=ll(al(Gs(e)),{mtime:0});return{contentType:I_,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(i===Yf){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(Gs(e)),i=(t=>"data="+encodeURIComponent("string"==typeof t?t:Gs(t)))(t);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const n=Gs(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}},A_=t=>{const e=()=>"sendBeacon"===t.transport?{url:P_(t.url,{compression:Yf}),encodedBody:R_(le(le({},t),{},{compression:Yf,Wl:void 0}))}:{url:E_(t.url,"compression"),encodedBody:R_(le(le({},t),{},{compression:void 0,Wl:void 0}))};let i;try{i=R_(t)}catch(i){if(ts(t.compression,Js(t.url,"compression")))return Rs.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return i&&ts(t.compression,Js(t.url,"compression"))&&!((n=i.body)instanceof ArrayBuffer?Xn(new Uint8Array(n)):ArrayBuffer.isView(n)&&Xn(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(M_=!0,e()):{url:t.url,encodedBody:i};var n},F_=t=>{try{return A_(t)}catch(i){var e;return Rs.error(i),void(null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))}},O_=function(){var t=ne(function*(t){const e=yield ls(Gs(t.data),ql.DEBUG,{rethrow:!0});if(!e)return t;const i=yield e.arrayBuffer();return le(le({},t),{},{Wl:{contentType:I_,body:i,estimatedSize:i.byteLength}})});return function(e){return t.apply(this,arguments)}}(),D_=/Failed to fetch|NetworkError|Load failed/i,L_=t=>"TypeError"===(null==t?void 0:t.name)&&D_.test((null==t?void 0:t.message)||""),N_=t=>{const e=F_(t);if(!e)return;const i=new o,{url:n,encodedBody:s}=e;i.open(t.method||"GET",n,!0);const{contentType:r,body:l}=null!=s?s:{};Os(t.headers,function(t,e){i.setRequestHeader(e,t)}),r&&i.setRequestHeader("Content-Type",r),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e;const n={statusCode:i.status,text:i.responseText};if(200===i.status)try{n.json=JSON.parse(i.responseText)}catch(t){}null===(e=t.callback)||void 0===e||e.call(t,n)}},i.send(l)},q_=t=>{const e=F_(t);if(!e)return;const{url:i,encodedBody:n}=e,{contentType:s,body:o,estimatedSize:a}=null!=n?n:{},u=new Headers;Os(t.headers,function(t,e){u.append(e,t)}),s&&u.append("Content-Type",s);let h=null,c=!1;if(l){const e=new l;h={signal:e.signal,timeout:setTimeout(()=>{var i;c=!0,e.abort(nn("AbortError","PostHog request timed out"+((i=t.timeout)?` after ${i}ms`:"")))},t.timeout)}}const d=e=>{var i;c&&"AbortError"===(null==e?void 0:e.name)||L_(e)?Rs.warn(e):Rs.error(e),null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e})};try{r(i,le({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t.Vl&&52428.8>(a||0),body:o,signal:null==h?void 0:h.signal},t.fetchOptions)).then(e=>e.text().then(i=>{var n;const s={statusCode:e.status,text:i};if(200===e.status)try{s.json=JSON.parse(i)}catch(t){Rs.error(t)}null===(n=t.callback)||void 0===n||n.call(t,s)})).catch(d).finally(()=>h?clearTimeout(h.timeout):null)}catch(t){h&&clearTimeout(h.timeout),d(t)}},j_=t=>{try{var e;const{url:n,encodedBody:s}=A_(t),{contentType:o,body:l,estimatedSize:a}=null!=s?s:{};if(!l)return;const u=l instanceof Blob?l:new Blob([l],{type:o});if(i.sendBeacon(n,u))return;const h=we(t.data)?t.data:null===(e=t.data)||void 0===e?void 0:e.batch;if(we(h)&&h.length>1&&(null!=a?a:0)>16384){const e=Math.ceil(h.length/2),i=e=>we(t.data)?e:le(le({},t.data),{},{batch:e});return j_(le(le({},t),{},{data:i(h.slice(0,e))})),void j_(le(le({},t),{},{data:i(h.slice(e))}))}Rs.warn(`Beacon of ~${null!=a?a:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?q_(le(le({},t),{},{Vl:!0})):N_(t)}catch(t){Rs.warn("Beacon send failed",t)}},B_=(t,e,i,n)=>{const s="query"===n?"POST"===e?"sent_at":"_":void 0;return P_(i===Kf?E_(t,"compression"):t,le(le({},s?{[s]:Date.now().toString()}:{}),i===Kf?{}:{compression:i}))},H_=(()=>{const t=[];return r&&t.push({transport:"fetch",method:q_}),o&&t.push({transport:"XHR",method:N_}),(null==i?void 0:i.sendBeacon)&&t.push({transport:"sendBeacon",method:j_}),t})();var z_=class{constructor(t,e){this.Gl=!0,this.Zl=[],this.Ql=Ve((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,Rs.createLogger("flush interval"),3e3),this.Jl=t}enqueue(t){this.Zl.push(t),this.Kl||this.Yl()}unload(){this.Xl();const t=this.Zl.length>0?this.ta():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.ea(le(le({},t),{},{transport:"sendBeacon"}))})}enable(){this.Gl=!1,this.Yl()}Yl(){this.Gl||(this.Kl=setTimeout(()=>{if(this.Xl(),this.Zl.length>0){const t=this.ta();for(const e in t){const i=t[e],n=(new Date).getTime();i.data&&we(i.data)&&Os(i.data,t=>{t.offset=Math.abs(t.timestamp-n),delete t.timestamp}),this.ea(i)}}},this.Ql))}ea(t){try{this.Jl(t)}catch(t){Rs.error(t)}}Xl(){clearTimeout(this.Kl),this.Kl=void 0}ta(){const t={};return Os(this.Zl,e=>{var i;const n=e,s=(n?n.batchKey:null)||n.url;Ce(t[s])&&(t[s]=le(le({},n),{},{data:[]})),null===(i=t[s].data)||void 0===i||i.push(n.data)}),this.Zl=[],t}};const U_=["retriesPerformedSoFar"];var W_=class{constructor(t){this._instance=t,this.ia=!1,this.na=3e3,this.Zl=[],this.Zl=[],this.sa=!0,this.resume()}resume(){if(!Ce(t)&&"onLine"in t.navigator){if(this.sa=t.navigator.onLine,this.ra)return;this.ra=()=>{this.sa=!0,this.oa()},this.la=()=>{this.sa=!1},Us(t,"online",this.ra),Us(t,"offline",this.la)}}get length(){return this.Zl.length}retriableRequest(t){let{retriesPerformedSoFar:e}=t,i=us(t,U_);Pe(e)&&(i.url=P_(i.url,{retry_count:e})),this._instance._send_request(le(le({},i),{},{callback:t=>{var n;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.Is(le({retriesPerformedSoFar:e},i));0===t.statusCode&&Rs.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!=e?e:0} retries.`)}null===(n=i.callback)||void 0===n||n.call(i,t)}}))}Is(t){const e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;const i=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)}(e),n=Date.now()+i;this.Zl.push({retryAt:n,requestOptions:t});let s=`Enqueued failed request for retry in ${i}`;navigator.onLine||(s+=" (Browser is offline)"),Rs.warn(s),this.ia||(this.ia=!0,this.aa())}aa(){if(this.ua&&clearTimeout(this.ua),0===this.Zl.length)return this.ia=!1,void(this.ua=void 0);this.ua=setTimeout(()=>{this.sa&&this.Zl.length>0&&this.oa(),this.aa()},this.na)}oa(){const t=Date.now(),e=[],i=this.Zl.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.Zl=e,i.length>0)for(const{requestOptions:t}of i)this.retriableRequest(t)}unload(){this.ua&&(clearTimeout(this.ua),this.ua=void 0),this.ia=!1,Ce(t)||(this.ra&&(t.removeEventListener("online",this.ra),this.ra=void 0),this.la&&(t.removeEventListener("offline",this.la),this.la=void 0));for(const{requestOptions:t}of this.Zl)try{this._instance._send_request(le(le({},t),{},{transport:"sendBeacon"}))}catch(t){Rs.error(t)}this.Zl=[]}},V_=class{constructor(t){this._instance=t,this.ha=()=>{var t,e,i,n;this.ca||(this.ca={});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.ca.lastScrollY=Math.ceil(r),this.ca.maxScrollY=Math.max(r,null!==(t=this.ca.maxScrollY)&&void 0!==t?t:0),this.ca.maxScrollHeight=Math.max(o,null!==(e=this.ca.maxScrollHeight)&&void 0!==e?e:0),this.ca.lastContentY=l,this.ca.maxContentY=Math.max(l,null!==(i=this.ca.maxContentY)&&void 0!==i?i:0),this.ca.maxContentHeight=Math.max(a,null!==(n=this.ca.maxContentHeight)&&void 0!==n?n:0)}}get da(){return this._instance.config.scroll_root_selector}getContext(){return this.ca}resetContext(){const t=this.ca;return setTimeout(this.ha,0),t}startMeasuringScrollPosition(){Us(t,"scroll",this.ha,{capture:!0}),Us(t,"scrollend",this.ha,{capture:!0}),Us(t,"resize",this.ha)}scrollElement(){if(this.da){const i=we(this.da)?this.da:[this.da];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}va(e){var i,n;const s="y"===e?"scrollTop":"scrollLeft";if(this.da){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.va("y")}scrollX(){return this.va("x")}};const G_=t=>Sa(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 Z_=class{constructor(t,e,i,n){this.je=t=>{const e=this.fa();if(e&&e.sessionId===t)return;const i={sessionId:t,props:this.pa(this._instance)};this.ga.register({[Ct]:i})},this._instance=t,this.ma=e,this.ga=i,this.pa=n||G_,this.ma.onSessionId(this.je)}fa(){return this.ga.props[Ct]}getSetOnceProps(){var t;const e=null===(t=this.fa())||void 0===t?void 0:t.props;return e?"r"in e?xa(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){const t={};return Os(js(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t[`$session_entry_${ge(i)}`]=e}),t}},Q_=class{on(t,e){return this.ya[t]||(this.ya[t]=[]),this.ya[t].push(e),()=>{this.ya[t]=this.ya[t].filter(t=>t!==e)}}emit(t,e){for(const i of this.ya[t]||[])i(e);for(const i of this.ya["*"]||[])i(t,e)}constructor(){this.ya={}}};const J_=As("[SessionId]"),K_=864e5;var Y_=class{on(t,e){return this.ba.on(t,e)}constructor(t,e,i){var n;if(this._a=null,this.wa=null,this.ka=[],this.Sa=void 0,this.xa=!1,this.ba=new Q_,this.Ca=(t,e)=>!(!Pe(t)||!Pe(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.Sr=t.config,this.ga=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.$a=void 0,this._sessionActivityTimestamp=null,this.Ta=e||ml,this.Ia=i||ml;const s=this.Sr.persistence_name||this.Sr.token;if(this._sessionTimeoutMs=1e3*Ve(this.Sr.session_idle_timeout_seconds||1800,60,36e3,J_.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Ma(),this.Ea="ph_"+s+"_window_id",this.Pa="ph_"+s+"_primary_window_exists",this.Ra()){const t=Nl.Dt(this.Ea),e=Nl.Dt(this.Pa);t&&!e?this.Be=t:Nl.Lt(this.Ea),Nl.At(this.Pa,!0)}(null===(n=this.Sr.bootstrap)||void 0===n?void 0:n.sessionID)&&this.setBootstrapSessionId(this.Sr.bootstrap.sessionID),this.Aa()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Ce(this.ka)&&(this.ka=[]),this.ka.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.ka=this.ka.filter(e=>e!==t)}}Ra(){return"memory"!==this.Sr.persistence&&!this.ga.pi&&Nl.Et()}Fa(t){t!==this.Be&&(this.Be=t,this.Ra()&&Nl.At(this.Ea,t))}Oa(){return this.Be?this.Be:this.Ra()?Nl.Dt(this.Ea):null}Da(t){const e=this._a;return!Ie(e)&&!Ie(t)&&5e3>Math.abs(t-e)}La(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.Da(e)||(this._a=e,this.ga.register({[j]:[e,t,i]}))}Na(){var t;const e=null===(t=this.Sr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Pe(e)&&e>0}qa(){this.Na()?this.ga.refreshKey(j):(this.ga.flush(),this.ga.load())}ja(){var t;if(Ie(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this._a)return;this.qa();const[,e,i]=this.Ba();e===this.Xt&&i===this._sessionStartTimestamp&&(this._a=this._sessionActivityTimestamp,this.ga.register({[j]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.ga.flush())}Ha(){const[t]=this.Ba(),e=Pe(t)?t:0,i=Pe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}za(t){return this.qa(),this.Ca(t,this.Ha())}Ba(){const t=this.ga.props[j];return we(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this._a=null,this.$a=void 0,clearTimeout(this.Ua),this.Ua=void 0,this.La(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 J_.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void J_.error("Invalid sessionID in bootstrap",t)}})(t);return!Ce(i)&&(e?this.$a={sessionId:t,sessionStartTimestamp:i}:this.La(t,(new Date).getTime(),i),!0)}destroy(){this.xa=!0,this.ja(),clearTimeout(this.Ua),this.Ua=void 0,this.Sa&&t&&(t.removeEventListener(Kt,this.Sa,{capture:!1}),this.Sa=void 0),this.ka=[]}Aa(){this.Sa=()=>{this.ja(),this.Ra()&&Nl.Lt(this.Pa)},Us(t,Kt,this.Sa,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,e=null,i=!1){if("always"===this.Sr.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.wa=n;else if(Ie(this.wa)||this.wa>n||n-this.wa>=1e3){var r,o;null===(r=(o=this.ga).syncCookieProperties)||void 0===r||r.call(o),this.wa=n}let[,l,a]=this.Ba();const u=!Ce(s)&&l!==s,h=this.Ha();let c=this.Oa();const d=this.$a,v=!!d&&(d.sessionStartTimestamp>n+6e4||n-d.sessionStartTimestamp>K_),f=d?v:Pe(a)&&Math.abs(n-a)>K_;let p=!1,g=u;const m=!l||!!d,y=l;let b=!m&&!t&&this.Ca(n,h);if(b&&(b=this.za(n),b||J_.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,a]=this.Ba()),m||b||f){g=!1;const t=d&&!v;l=t?d.sessionId:this.Ta(),c=this.Ia(),J_.info("new session ID assigned",{sessionId:l,windowId:c,bootstrapped:!!t,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:f}}),a=t?d.sessionStartTimestamp:n,this.$a=void 0,p=!0}else c||(c=this.Ia(),p=!0),g=g||l!==y,g&&(J_.info("adopted cross-tab session id",{sessionId:l,windowId:c}),p=!0);const _=Pe(h)&&t&&!f?h:n,w=Pe(a)?a:(new Date).getTime();this.Fa(c),this.La(l,_,w),t||this.Ma();const k={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.ka.forEach(t=>t(l,c,k)),{sessionId:l,windowId:c,sessionStartTimestamp:w,changeReason:p?k:void 0,lastActivityTimestamp:h}}Ma(){this.xa||(clearTimeout(this.Ua),this.Ua=setTimeout(()=>{if(!this.xa)if(this.za((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.ba.emit("forcedIdleReset",{idleSessionId:t})}else this.Ma()},1.1*this.sessionTimeoutMs))}};const X_=function(t,e){if(!t)return!1;const i=t.userAgent;if(i&&We(i,e))return!0;try{const i=null==t?void 0:t.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(t=>We(null==t?void 0:t.brand,e)))return!0}catch(t){}return!!t.webdriver};function tw(){return tw=ne(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 $e(i)&&i.length>0?i:void 0}catch(t){return void Rs.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}),tw.apply(this,arguments)}const ew="custom",iw="i.posthog.com",nw=/^\/static\//,sw=["/s/","/e/","/i/"];var rw=class{constructor(t){this.Wa={},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(`.${iw}`,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Wa[this.apiHost]||(this.Wa[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":ew),this.Wa[this.apiHost]}Va(t){if(!nw.test(t))return;const e=this.instance.config.asset_host;return"string"==typeof e&&e.trim().replace(/\/$/,"")||void 0}Ga(t){const e=Zs(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}Za(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=Zs(i))||void 0===r?void 0:r.href)||i;n=s(new URL(t)).toString()}if(s&&"api"===t&&sw.some(t=>0===e.indexOf(t))){const t=this.Ga(n);if(t){const e=this.apiHost;let i=this.Qa;(null==i?void 0:i.apiHost)===e&&i.rewriteRequestPath===s||(i={apiHost:e,rewriteRequestPath:s,urls:new Set},this.Qa=i),i.urls.add(t)}}return n}isIngestionEndpoint(t){const e=this.Qa,i=this.Ga(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.Za(t,e,this.uiHost+e);if("flags"===t)return this.Za(t,e,this.flagsApiHost+e);if("assets"===t){const i=this.Va(e);if(i)return this.Za(t,e,`${i}${e}`)}if(this.region===ew)return this.Za(t,e,this.apiHost+e);const i=iw+e;switch(t){case"assets":return this.Za(t,e,`https://${this.region}-assets.${i}`);case"api":return this.Za(t,e,`https://${this.region}.${i}`)}}};const ow=As("[PostHog ExternalIntegrations]"),lw={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var aw=class{constructor(t){this._instance=t}Eo(t,e){var i,n;null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,t,t=>{if(t)return ow.error("failed to load script",t);e()})}startIfEnabledOrStop(){var t;for(const[s,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var e,i,n;r&&!(null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[s])&&this.Eo(lw[s],()=>{var t;null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[s])||void 0===t||t.start(this._instance)}),!r&&(null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[s])&&(null===(n=d.__PosthogExtensions__)||void 0===n||null===(n=n.integrations)||void 0===n||null===(n=n[s])||void 0===n||n.stop())}}},uw=class{constructor(t,e){this.$=t,this.lo=e,this.Ja=new Map,this.fo=!1}add(t){var e=this;return ne(function*(){if(e.fo)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.Ja.has(t.name))throw new Error(`Browser extension "${t.name}" is already registered`);e.Ja.set(t.name,t);try{const i=t.setup(e.lo);i&&(yield i)}catch(i){const n=e.Ja.get(t.name)===t;n&&e.Ja.delete(t.name),e.$.error(`Failed to set up browser extension "${t.name}"`,i),n&&e.Ka(t)}})()}getExtension(t){return this.Ja.get(t)}dispose(){if(this.fo)return;this.fo=!0;const t=Array.from(this.Ja.values()).reverse();this.Ja.clear();for(const e of t)this.Ka(e)}Ka(t){try{var e;const i=null===(e=t.dispose)||void 0===e?void 0:e.call(t);i&&ke(i.then)&&i.then(void 0,e=>{this.$.error(`Failed to dispose browser extension "${t.name}"`,e)})}catch(e){this.$.error(`Failed to dispose browser extension "${t.name}"`,e)}}},hw=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)}};const cw="extensionsRemoteConfig";var dw=class{constructor(t){this.instance=t,this.fo=!1,this.$=Rs,this.Ya=t.Xa,this.kv=new hw(t),this.onEvent=t=>Ip(this.instance.on("eventCaptured",e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.$.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.fo)return Ip(()=>{});const e=e=>{try{t(e)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},i=this.instance.tu.on(cw,e);return this.Ya&&e(this.Ya),Ip(i)},this.eu=new uw(Rs.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){const t=this.instance.get_property(p);return"string"==typeof t?t:void 0}get library(){return{name:ql.LIB_NAME,version:ql.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,n;const s=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(n=null==s?void 0:s.sessionStartTimestamp)&&void 0!==n?n:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.eu.add(t)}getExtension(t){return this.eu.getExtension(t)}capture(t,e,i){var n=this;return ne(function*(){i?n.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):n.instance.capture(t,e)})()}registerDynamicEventProperties(t){return Ip(this.instance.iu(t))}handleRemoteConfig(t){this.fo||(this.Ya=t,this.instance.tu.emit(cw,t))}sendRequest(t){var e=this;return ne(function*(t,i={}){var n;const s=e.instance.requestRouter.endpointFor(null!==(n=i.target)&&void 0!==n?n:"api",t),r={method:i.method,url:i.query?P_(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?ue.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(e.instance._send_request(r),{statusCode:202}):new Promise(t=>{r.callback=t,e.instance._send_request(r)})}).apply(this,arguments)}dispose(){this.fo||(this.fo=!0,this.eu.dispose())}};const vw={};let fw=0;const pw=()=>{},gw='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',mw="Surveys module not available",yw="sanitize_properties is deprecated. Use before_send instead",bw="Invalid value for property_denylist config: ",_w=/^[A-Za-z0-9_-]{1,400}$/,ww=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,kw=["token","distinct_id",Rt],Sw="posthog";let xw=!T_&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla"));const Cw=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 le({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:zs(null==n?void 0:n.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:pw,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&$e(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null===(i=t.location)||void 0===i?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Rs.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:Qt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:pw},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:_r,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Cw(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))},Tw=[["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"]],Iw=t=>{const e={};for(const[i,n]of Tw)Ce(t[i])||(e[n]=t[i]);const i=Ds({},e,t),n=t.__preview_external_dependency_versioned_paths;return Ce(n)||(Ce(t.strict_script_versioning)&&(i.strict_script_versioning=!!n),$e(n)&&Ce(t.asset_host)&&(i.asset_host=n)),we(t.property_blacklist)&&(Ce(t.property_denylist)?i.property_denylist=t.property_blacklist:we(t.property_denylist)?i.property_denylist=[...t.property_blacklist,...t.property_denylist]:Rs.error(bw+t.property_denylist)),i};var Mw=class{constructor(){this.__forceAllowLocalhost=!1}get nu(){return this.__forceAllowLocalhost}set nu(t){Rs.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Ew=class e{su(t){if(!t)return;const e=this.Ja.indexOf(t);-1!==e&&this.Ja.splice(e,1)}ru(t,e){var i;return this.su(t),this.Ja.push(e),null===(i=e.initialize)||void 0===i||i.call(e),e}ou(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}lu(){if(this.au)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.ou())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.uu)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.au=!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}`)}hu(){if(this.ou()||"$posthog_cookieless"!==this.get_distinct_id())return;const t=this.persistence;if(!t)return;this.cu()||t.load(!0);const e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){const e=this.config.get_device_id(ml());this.register({distinct_id:e,$device_id:e}),t.set_property(xt,Gt)}this.du()}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.vu=!1,this.fu=!1,this.webPerformance=new Mw,this.pu=!1,this.version=ql.LIB_VERSION,this.gu=new Set,this.mu="",this.tu=new Q_,this.Ja=[],this.yu=[],this.uu=!1,this.au=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=$w(),this.SentryIntegration=o_,this.sentryIntegration=t=>function(t,e){const i=r_(t,e);return{name:s_,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.bu=!1,this._u=null,this.wu=null,this.ku=null,this.scrollManager=new V_(this),this.pageViewManager=new l_(this),this.rateLimiter=new x_(this),this.requestRouter=new rw(this),this.consent=new Kb(this),this.externalIntegrations=new aw(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=$e(t)?{[t]:e}:t;this.setPersonProperties(n),null==i||i({})},set_once:(t,e,i)=>{const n=$e(t)?{[t]:e}:t;this.setPersonProperties(void 0,n),null==i||i({})}},this.on("eventCaptured",t=>Rs.info(`send "${null==t?void 0:t.event}"`,t))}init(t,i,n){if(n&&n!==Sw){var s;const r=null!==(s=vw[n])&&void 0!==s?s:new e;return r._init(t,i,n),vw[n]=r,vw[Sw][n]=r,r}return this._init(t,i,n)}_init(e,i={},n){var s,r,o;const l=$e(e)?e.trim():"";if(!l)return Rs.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.Su(i.debug),this.xu=i,this.Cu=[],i.person_profiles?this.wu=i.person_profiles:i.process_person&&(this.wu=i.process_person);const u=$w(i.defaults),h=Iw(i),c=Ds({},u,h,{name:n,token:l});Se(u.rageclick)&&Se(h.rageclick)&&(c.rageclick=Ds({},u.rageclick,h.rageclick)),Se(u.session_recording)&&Se(h.session_recording)&&(c.session_recording=Ds({},u.session_recording,h.session_recording)),this.set_config(c),this.config.on_xhr_error&&Rs.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Kf;const d=this.cu();if(this.persistence=new k_(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new k_(le(le({},this.config),{},{persistence:"sessionStorage"}),d,!1),this.mu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&Nl.Et()){const t=Nl.Dt(this.mu);we(t)&&t.forEach(t=>{$e(t)&&this.gu.add(t)})}else Nl.Lt(this.mu);const v=le({},this.persistence.props),f=le({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.$u=new z_(t=>this.Tu(t),this.config.request_queue_config),this.Iu=new W_(this),this.__request_queue=[];const p=this.ou();p||(this.sessionManager=new Y_(this),this.sessionPropsManager=new Z_(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.Mu()})),this.Eu(),this.config.__preview_deferred_init_extensions?(Rs.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Pu(p)},0)):(Rs.info("Initializing extensions synchronously"),this.Pu(p)),ql.DEBUG=ql.DEBUG||this.config.debug,ql.DEBUG&&Rs.info("Starting in debug mode",{this:this,config:i,thisC:le({},this.config),p:v,s:f}),this.config.identity_distinct_id&&!(null===(s=i.bootstrap)||void 0===s?void 0:s.distinctID)&&(i.bootstrap=le(le({},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.uu=!!m&&!Te(m),void 0!==(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(xt);if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"anonymous"===n)this.identify(t);else if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"identified"===n)Rs.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const e=this.config.get_device_id(ml()),n=i.bootstrap.isIdentifiedID?e:t;this.persistence.set_property(xt,i.bootstrap.isIdentifiedID?Zt:Gt),this.register({distinct_id:t,$device_id:n})}}if(p)this.register_once({distinct_id:Pt,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(ml());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(xt,Gt)}return Us(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Us(t,"pageshow",()=>{var t;this.vu=!1,this.fu||null===(t=this.Iu)||void 0===t||t.resume()}),i.segment?n_(this,()=>this.Ru()):this.Ru(),ke(this.config._onCapture)&&this.config._onCapture!==pw&&(Rs.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Rs.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 tw.apply(this,arguments)}().then(t=>{t&&this.register({[g]:t})}).catch(pw),this}Au(t){const e=t;return $e(e.name)&&ke(e.setup)}Fu(t,e){this.Au(t)?e.push(()=>{this.Ou().add(t).catch(()=>{var e;return null===(e=t.dispose)||void 0===e?void 0:e.call(t)}).catch(e=>{Rs.error(`Failed to dispose browser extension "${t.name}"`,e)})}):this.Ja.push(t)}Eu(){var t,i,n;const s=null!==(t=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:null===(n=e.__defaultExtensionClasses)||void 0===n?void 0:n.featureFlags;var r,o,l;s&&(this.featureFlags&&this.featureFlags instanceof s||(null===(r=this.Du)||void 0===r||r.call(this),this.Du=void 0,this.featureFlags=new s(this)),ke(this.featureFlags.onReloading)&&ke(this.featureFlags.setup)?this.Du||(this.Du=this.featureFlags.onReloading(()=>{this.tu.emit("featureFlagsReloading",!0)}),this.Ou().add(this.featureFlags)):null===(o=(l=this.featureFlags).initialize)||void 0===o||o.call(l))}Pu(t){const i=performance.now(),n=le(le({},e.__defaultExtensionClasses),this.config.__extensionClasses),s=[];var r,o,l,a,u,h,c;n.exceptions&&this.Ja.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new n.exceptions(this)),n.historyAutocapture&&this.Ja.push(this.historyAutocapture=new n.historyAutocapture(this)),n.tracingHeaders&&this.Ja.push(this.tracingHeaders=new n.tracingHeaders(this)),n.siteApps&&this.Ja.push(this.siteApps=new n.siteApps(this)),n.sessionRecording&&!t&&this.Ja.push(this.sessionRecording=new n.sessionRecording(this)),this.config.disable_scroll_properties||s.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),n.autocapture&&this.Fu(this.autocapture=new n.autocapture(this),s),n.surveys&&this.Fu(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new n.surveys(this),s),n.logs&&this.Fu(this.logs=null!==(l=this.logs)&&void 0!==l?l:new n.logs(this),s),n.metrics&&this.Ja.push(this.metrics=null!==(a=this.metrics)&&void 0!==a?a:new n.metrics(this)),n.conversations&&this.Ja.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new n.conversations(this)),n.productTours&&this.Ja.push(this.productTours=new n.productTours(this)),n.heatmaps&&this.Ja.push(this.heatmaps=new n.heatmaps(this)),n.webVitalsAutocapture&&this.Ja.push(this.webVitalsAutocapture=new n.webVitalsAutocapture(this)),n.exceptionObserver&&this.Ja.push(this.exceptionObserver=new n.exceptionObserver(this)),n.deadClicksAutocapture&&this.Ja.push(this.deadClicksAutocapture=new n.deadClicksAutocapture(this,t_)),n.toolbar&&this.Ja.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new n.toolbar(this)),n.experiments&&this.Ja.push(this.experiments=null!==(c=this.experiments)&&void 0!==c?c:new n.experiments(this)),this.Ja.forEach(t=>{t.initialize&&s.push(()=>{var e;null===(e=t.initialize)||void 0===e||e.call(t)})}),s.push(()=>{if(this.Lu){const t=this.Lu;this.Lu=void 0,this.Ja.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}}),this.Nu(s,i)}Nu(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout(()=>{this.Nu(t,e)},0);const i=t.shift();if(i)try{i()}catch(t){Rs.error("Error initializing extension:",t)}}const i=Math.round(performance.now()-e);this.register_for_session({[At]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ft]:i}),this.config.__preview_deferred_init_extensions&&Rs.info(`PostHog extensions initialized (${i}ms)`)}zl(t){var e;if(!n||!n.body)return Rs.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.zl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Lu=t),this.Xa=t,this.compression=void 0,t.ok){var i;const e=t.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=fe(e.supportedCompression,Kf)?Kf:fe(e.supportedCompression,Yf)?Yf:void 0),(null===(i=e.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=e.analytics.endpoint)}this.set_config({person_profiles:this.wu?this.wu:Qt}),null===(e=this.qu)||void 0===e||e.handleRemoteConfig(t),this.Ja.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}Ru(){try{this.config.loaded(this)}catch(t){Rs.critical("`loaded` function failed",t)}if(this.ju(),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.ou())&&this.Bu()},1),this.Hu=new $_(this),this.Hu.load()}ju(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.$u)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Fs(this.__request_queue,t=>this.Tu(t)),this.__request_queue=[],this.ju()}_handle_unload(){var t,e,i,n,s,r;this.vu=!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.zu()&&this.capture(Xt),null===(n=this.logs)||void 0===n||n.flushLogs("sendBeacon"),null===(s=this.$u)||void 0===s||s.unload(),null===(r=this.Iu)||void 0===r||r.unload()):this.zu()&&this.capture(Xt,null,{transport:"sendBeacon"})}_send_request(t){var e,i,n;this.__loaded?xw?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=le(le({},this.config.request_headers),t.headers),t.compression="best-available"===t.compression?null!==(e=this.compression)&&void 0!==e?e:t.compressionFallback:t.compression,(Ce(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,i,n;const s=le({},t);s.timeout=s.timeout||6e4;const r=null!==(e=s.transport)&&void 0!==e?e:"fetch";"sendBeacon"===r&&Ce(s.compression)&&s.data&&(s.compression=Yf),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data=(t=>{var e,i;const n=(we(t)?t:[t]).map(t=>le(le({},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()}})(s.data):"body"===s.timestampMode&&(s.data=((t,e=(new Date).toISOString())=>we(t)?t.map(t=>le(le({},t),{},{sent_at:e})):le(le({},t),{},{sent_at:e}))(s.data))),s.url=B_(s.url,s.method,s.compression,s.timestampMode);const o=H_.filter(t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport)),l=null!==(i=null===(n=function(t,e){for(let i=0;t.length>i;i++)if(e(t[i]))return t[i]}(o,t=>t.transport===r))||void 0===n?void 0:n.method)&&void 0!==i?i:o[0].method;if(!l)throw new Error("No available transport method");const u=t=>{try{l(t)}catch(t){var e;L_(t)?Rs.warn(t):Rs.error(t),null===(e=s.callback)||void 0===e||e.call(s,{statusCode:0,error:t})}};"sendBeacon"!==r&&s.data&&s.compression===Kf&&a&&"undefined"!=typeof Promise&&!M_?O_(s).then(t=>{u(t)}).catch(e=>{if(es(e))return M_=!0,void u(le(le({},s),{},{compression:void 0,url:B_(t.url,t.method,void 0,t.timestampMode)}));is(e)&&(M_=!0),u(s)}):l(s)})(le(le({},t),{},{callback:e=>{var i,n,s;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null===(n=(s=this.config).on_request_error)||void 0===n||n.call(s,e),null===(i=t.callback)||void 0===i||i.call(t,e)}}))):t.fireCallbackOnDrop&&(null===(n=t.callback)||void 0===n||n.call(t,{statusCode:0}))}Tu(t){this.Iu?this.Iu.retriableRequest(t):this._send_request(t)}_execute_array(t){fw++;try{let e;const i=[],n=[],s=[];Fs(t,t=>{if(t)if(e=t[0],we(e))s.push(t);else if(ke(t))try{t.call(this)}catch(e){Rs.error("Error executing queued PostHog call",t,e)}else we(t)&&"alias"===e?i.push(t):we(t)&&-1!==e.indexOf("capture")&&ke(this[e])?s.push(t):n.push(t)});const r=function(t,e){Fs(t,function(t){try{if(we(t[0])){let i=e;Os(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){Rs.error("Error executing queued PostHog call",t,e)}})};r(i,this),r(n,this),r(s,this)}finally{fw--}}push(t){if(fw>0&&we(t)&&$e(t[0])){const i=e.prototype[t[0]];return void(ke(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}Uu(){var t;const e=null===(t=this.persistence)||void 0===t?void 0:t.get_property(_);return $e(e)&&ww.test(e)?{value:e,delivered:!1}:Se(e)&&$e(e.value)&&ww.test(e.value)?{value:e.value,delivered:!0===e.delivered}:void 0}Wu(t,e,i,n){if(!this.persistence)return;this.persistence.refreshKey(_);const s=this.Uu();if(!n){if(i)return $e(e)&&ww.test(e)?(e!==(null==s?void 0:s.value)&&this.persistence.register({[_]:{value:e,delivered:!1}}),{value:e,pending:e!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(_);if($e(t)&&_w.test(t)){if((null==s?void 0:s.value.split(".")[3])===t)return{value:s.value,pending:!s.delivered};const e=`fb.1.${Date.now()}.${t}`;return this.persistence.register({[_]:{value:e,delivered:!1}}),{value:e,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(_)}Vu(t){if(!this.persistence)return;this.persistence.refreshKey(_);const e=this.Uu();(null==e?void 0:e.value)!==t||e.delivered||this.persistence.register({[_]:{value:t,delivered:!0}})}capture(t,e,i){var n,s,r,o,l;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.$u))return void Rs.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Ce(t)||!$e(t))return void Rs.error("No event name provided to posthog.capture");this.hu();const a=!this.config.opt_out_useragent_filter&&this._is_bot();if(a&&!this.config.__preview_capture_bot_pageviews)return;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 Rs.critical("This capture call is ignored due to client rate limiting.");let h;(null==e?void 0:e.$current_url)&&!$e(null==e?void 0:e.$current_url)&&(Rs.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.Gu)||Rs.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(h=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 c=new Date,d=(null==i?void 0:i.timestamp)||c,v=en(null==i?void 0:i.uuid,ml);let f={uuid:v,event:t,properties:this.calculateEventProperties(t,e||{},d,v)};"$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 p="$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)&&!p&&(f.$set=null==i?void 0:i.$set);const g=Se(null==e?void 0:e.$set)?e.$set:void 0,m=!!(null==i?void 0:i.$set)&&"$fbc"in i.$set,y=m||!!g&&"$fbc"in g,_=m?null==i||null===(n=i.$set)||void 0===n?void 0:n[b]:null==g?void 0:g[b],w=we(null==e?void 0:e.$unset)?e.$unset:[],k=(null==i?void 0:i.$unset)||[],S=-1!==w.indexOf("$fbc")||-1!==k.indexOf("$fbc"),x=this.Wu(null==h?void 0:h.fbclid,_,y,S);x&&!0===f.properties.$process_person_profile&&x.pending&&!y&&!p&&(f.$set=le({[b]:x.value},f.$set));const C=null==i?void 0:i.$unset;C&&(f.$unset=C);const T=p?void 0:this.Zu(null==i?void 0:i.$set_once,t!==ee,t===te);if(T&&(f.$set_once=T),(null==i?void 0:i._noTruncate)||(I=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),we(n))r=[],Fs(n,e=>{r.push(t(e))});else{const e={};Os(Ne(n)?Bs(n):n,(n,s)=>{i.has(n)||(e[s]=t(n,s))}),r=e}return r}(t)}(f,t=>$e(t)?t.slice(0,I):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=c),p&&(f.properties=((t,e=[])=>{const i={},n=e=>{void 0!==t[e]&&(i[e]=t[e])};return Kn.forEach(n),e.forEach(n),i})(f.properties,kw)),t===gp||t===mp){const i=null==e?void 0:e[yp],n=null==e?void 0:e[_p];Dp({id:i,current_iteration:n}),f.$set=le(le({},f.$set),{},{[Vl({id:i,current_iteration:n},t===mp?"responded":"dismissed")]:!0})}else t===pp&&(f.$set=le(le({},f.$set),{},{[Cp]:(new Date).toISOString()}));var I;if("product tour shown"===t){const t=null==e?void 0:e.$product_tour_type;t&&(f.$set=le(le({},f.$set),{},{[`$product_tour_last_seen_date/${t}`]:(new Date).toISOString()}))}const M=le(le({},f.properties.$set),f.$set);if(xe(M)||this.setPersonPropertiesForFlags(M),!Me(this.config.before_send)){const t=this.$s(f);if(!t)return;f=t,f.uuid=en(f.uuid,ml)}const E=null!==(s=null===(r=f.$set)||void 0===r?void 0:r.$fbc)&&void 0!==s?s:Se(null===(o=f.properties)||void 0===o?void 0:o.$set)?f.properties.$set[b]:void 0,P=(null==x?void 0:x.pending)&&E===x.value?x.value:void 0;this.tu.emit("eventCaptured",f);const R=null!==(l=null==i?void 0:i._url)&&void 0!==l?l:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),A=le(le({method:"POST",url:R,data:f,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(R)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},(null==i?void 0:i.transport)?{transport:i.transport}:{}),P?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.Vu(P)}}:{});var F;return!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)||P?(!A.transport&&!A.callback&&xe(null!==(F=this.config.request_headers)&&void 0!==F?F:{})&&this.vu&&(A.transport="sendBeacon"),this.Tu(A)):this.$u.enqueue(A),f}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null===(e=this.qu)||void 0===e?void 0:e.getExtension(t)}Ou(){var t;return null!==(t=this.qu)&&void 0!==t?t:this.qu=new dw(this)}iu(t){this.yu.push(t);let e=!0;return()=>{if(!e)return;e=!1;const i=this.yu.indexOf(t);-1!==i&&this.yu.splice(i,1)}}Qu(t=!0){var e,i,n;return!!(null===(e=this.persistence)||void 0===e?void 0:e.consumeCookieIdentityChange())&&(this.ku=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(n=this.sessionPersistence)||void 0===n||n.clear(),this.gu.clear(),this.Ju()),null===(i=this.featureFlags)||void 0===i||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,r,o,l){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.Qu();const a=l?void 0:this.persistence.remove_event_timer(e);let h=le({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.ou()&&(h[Rt]=!0),"$snapshot"===e){const t=le(le({},this.persistence.properties()),this.sessionPersistence.properties());return h.distinct_id=t.distinct_id,(!$e(h.distinct_id)&&!Ee(h.distinct_id)||Te(h.distinct_id))&&Rs.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}const c=function(e,i,n,r=!1){var o,l,a,h;if(!u)return{};const c=e?[...da,...i||[]]:[],[d,v]=Vi(u),[f,p]=function(t){for(let e=0;Ji.length>e;e++){const[i,n,s]=Ji[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===(h=t.screen)||void 0===h?void 0:h.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=Ds(js({$os:d,$os_version:v,$browser:Hi(u,navigator.vendor,g,m),$webview_app:f,$webview_app_version:p,$device:Gi(u),$device_type:Zi(u,y),$timezone:Ca(),$timezone_offset:$a()}),{$current_url:Ks(r?sn(null==s?void 0:s.href):null==s?void 0:s.href,c,fa),$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:Ui(u,navigator.vendor,g,m),$browser_language:ba(),$browser_language_prefix:_a(),$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:Es.LIB_NAME,$lib_version:Es.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Es.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=Es.SDK_DIST_CHANNEL),x}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:t,windowId:e}=this.sessionManager.checkAndGetSessionAndWindowId(l,r.getTime(),!0);h.$session_id=t,h.$window_id=e}this.sessionPropsManager&&Ds(h,this.sessionPropsManager.getSessionProps());try{var d;this.sessionRecording&&Ds(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null===(d=this.Iu)||void 0===d?void 0:d.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}let v;if(this.requestRouter.region===ew&&(h.$lib_custom_api_host=this.config.api_host),v="$pageview"!==e||l?"$pageleave"!==e||l?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),h=Ds(h,v),"$pageview"===e&&n&&(h.title=n.title),!Ce(a)){const t=r.getTime()-a;h.$duration=parseFloat((t/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");const f=this.persistence.properties(),p=this.sessionPersistence.properties(),g=h.$groups,m=f.$groups;Se(g)&&!xe(g)&&(h.$groups=le(le({},Se(m)?m:{}),g)),Os(["$referrer","$referring_domain"],t=>{t in f&&delete p[t]});const y={};if(this.yu.length>0)for(const t of this.yu.slice())try{Ds(y,t())}catch(t){Rs.error("Failed to produce browser extension event properties",t)}h=Ds({},c,f,p,le(le({},y),h)),h.$is_identified=this._isIdentified(),we(this.config.property_denylist)?Os(this.config.property_denylist,function(t){delete h[t]}):Rs.error(bw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const b=this.config.sanitize_properties;b&&(Rs.error(yw),h=b(h,e));const _=this.Ku();return h.$process_person_profile=_,_&&!l&&this.Yu("_calculate_event_properties"),h}Zu(t,e=!0,i=!1){var n;if(!this.persistence||!this.Ku())return t;if(this.pu&&!i)return t;const s=this.persistence.get_initial_props(),r=null===(n=this.sessionPropsManager)||void 0===n?void 0:n.getSetOnceProps();let o=Ds({},s,r||{},t||{});const l=this.config.sanitize_properties;return l&&(Rs.error(yw),o=l(o,"$set_once")),e&&(this.pu=!0),xe(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.Qu(),null===(i=this.sessionPersistence)||void 0===i||i.register(t),Object.keys(t).forEach(t=>this.gu.add(t)),this.Ju()}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.gu.delete(t),this.Ju()}Xu(t,e){this.register({[t]:e})}Mu(){this.gu.forEach(t=>{var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t)}),this.gu.clear(),this.Ju()}Ju(){var t;if(!this.mu)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.pi)||!Nl.Et())return void Nl.Lt(this.mu);const e=[];this.gu.forEach(t=>e.push(t)),e.length>0?Nl.At(this.mu,e):Nl.Lt(this.mu)}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.tu.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:mw}),()=>{})}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:mw})}getActiveMatchingSurveys(t,e=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:mw})}renderSurvey(t,e){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(t,e)}displaySurvey(t,e=Np){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:mw}}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:mw})}th(t){return!t||Te(t)?(Rs.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Rs.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())||(Rs.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 Rs.uninitializedWarning("posthog.identify");if(Ee(t)&&(t=t.toString(),Rs.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.th(t))return;if(!this.Yu("posthog.identify"))return;this.hu();const n=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,r=this.Qu(!1),o=this.persistence.Sl();let l=!1;try{const n=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:n},""),t!==n&&t!==this.get_property("__alias")&&(this.unregister(m),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Gt,u=t!==n,h=!u&&o;if(u&&o){var a;const s=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:n};this.persistence.set_property(xt,Zt),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.xl(),this.capture(te,s,{$set:e||{},$set_once:i||{}}),this.ku=sa(t,e,i),null===(a=this.featureFlags)||void 0===a||a.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:n)}else if(h){this.persistence.set_property(xt,Zt);const n=e||{},s=i||{};this.setPersonPropertiesForFlags({$set:n,$set_once:s},!1),this.config.cookieWinsOnConflict&&this.persistence.xl(),this.capture("$set",{$set:n,$set_once:s}),this.ku=sa(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);u||s||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(_t)):h&&(e||i)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Tl(l)}}setPersonProperties(t,e){if(!t&&!e)return;if(!this.Yu("posthog.setPersonProperties"))return;const i=sa(this.get_distinct_id(),t,e);this.ku!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.ku=i):Rs.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var e;const i=(we(t)?t:[t]).filter(t=>$e(t)&&t.length>0);0!==i.length&&this.Yu("posthog.unsetPersonProperties")&&(null===(e=this.featureFlags)||void 0===e||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.ku=null)}group(t,e,i){var n;if(!t||!e)return void Rs.error("posthog.group requires a group type and group key");null===(n=this.persistence)||void 0===n||n.syncCookieProperties(),this.Qu();const s=this.getGroups(),r=s[t]!==e;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:le(le({},s),{},{[t]:e})}),(r||i)&&this.Ku()){const n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(ee,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.Yu("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=Re(t)?t:null==t?void 0:t.resetDeviceID,i=Re(t)||null==t?void 0:t.bootstrap;this.eh(e,!1,i)}eh(t,e=!1,i){var n,s,r,o,l,a;if(Rs.info("reset"),!this.__loaded)return Rs.uninitializedWarning("posthog.reset");const u=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(n=this.xu)||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.Ul());const h=this.get_property(p),c=this.get_property(g),d=this.get_property(A);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();this.consent.reset(),e||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const f=null===(l=this.persistence)||void 0===l||null===(a=l.Sl)||void 0===a?void 0:a.call(l);let m=!1;try{var y,b,_,w,k,S,x,C,T,I,M,E,P;if(null===(y=this.persistence)||void 0===y||y.clear(),null===(b=this.sessionPersistence)||void 0===b||b.clear(),this.gu.clear(),this.Ju(),Ce(d)||null===(I=this.persistence)||void 0===I||I.register({$session_recording_remote_config:d}),null===(_=this.surveys)||void 0===_||_.reset(),null===(w=this.featureFlags)||void 0===w||w.reset(),null===(k=this.conversations)||void 0===k||k.reset(),null===(S=this.logs)||void 0===S||S.reset(),null===(x=this.metrics)||void 0===x||x.reset(),null===(C=this.persistence)||void 0===C||C.set_property("$user_state","anonymous"),null===(T=this.sessionManager)||void 0===T||T.resetSessionId(),this.ku=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Pt,$device_id:null},"");else{const e=this.config.get_device_id(ml());this.register_once({distinct_id:e,$device_id:t?e:h},""),t||Ce(c)||this.register({[g]:c})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(void 0===i.distinctID||this.ou()||(null===(P=this.persistence)||void 0===P||P.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(M=this.featureFlags)||void 0===M||M.initialize(),!Ce(u)&&!(null===(E=this.sessionManager)||void 0===E?void 0:E.setBootstrapSessionId(u,!0))){const t=le({},i);delete t.sessionID,this.config.bootstrap=t}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,m=!0}finally{var R,F;f&&(null===(R=this.persistence)||void 0===R||null===(F=R.Tl)||void 0===F||F.call(R,m))}this.reloadFeatureFlags()}shutdown(t){var e=this;return ne(function*(){var t,i,n,s,r,o,l;if(e.__loaded){e.fu=!0,e.Ou().dispose(),null===(t=e.sessionRecording)||void 0===t||t.dispose(),null===(i=e.logs)||void 0===i||i.flushLogs("sendBeacon"),null===(n=e.metrics)||void 0===n||n.flush("sendBeacon"),null===(s=e.$u)||void 0===s||s.unload(),null===(r=e.Iu)||void 0===r||r.unload();try{var a;null===(a=e.featureFlags)||void 0===a||a.destroy()}catch(t){Rs.error("Error while destroying feature flags",t)}null===(o=e.persistence)||void 0===o||o.destroy(),null===(l=e.sessionPersistence)||void 0===l||l.destroy()}else Rs.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,e){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null===(i=this.conversations)||void 0===i||i.ih()}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.nh()}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")?(Rs.critical("Attempting to create alias for existing People user - aborting."),-2):this.Yu("posthog.alias")?(Ce(e)&&(e=this.get_distinct_id()),t!==e?(this.Xu(m,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Rs.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const e=le({},this.config);if(Se(t)){var i,n,s,r,o,l,a,u,h,c,d,v,f;Ds(this.config,Iw(t));const g=this.cu();null===(i=this.persistence)||void 0===i||i.update_config(this.config,e,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new k_(le(le({},this.config),{},{persistence:"sessionStorage"}),g,!1);const m=this.Su(this.config.debug);var p;Re(m)&&(this.config.debug=m),Re(this.config.debug)&&(this.config.debug?(ql.DEBUG=!0,xl.Et()&&xl.At("ph_debug",!0),Rs.info("set_config",{config:t,oldConfig:e,newConfig:le({},this.config)})):(ql.DEBUG=!1,xl.Et()&&xl.Lt("ph_debug"))),null===(n=this.featureFlags)||void 0===n||null===(s=n.updateConfig)||void 0===s||s.call(n,this.config,this.Ul()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(l=this.sessionRecording)||void 0===l||l.startIfEnabledOrStop(),null===(a=this.tracingHeaders)||void 0===a||a.startIfEnabledOrStop(),null===(u=this.autocapture)||void 0===u||u.startIfEnabled(),null===(h=this.heatmaps)||void 0===h||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(p=this.historyAutocapture)||void 0===p||p.startIfEnabledOrStop()),null===(c=this.exceptionObserver)||void 0===c||c.startIfEnabledOrStop(),null===(d=this.deadClicksAutocapture)||void 0===d||d.startIfEnabledOrStop(),null===(v=this.surveys)||void 0===v||v.loadIfEnabled(),this.du(),null===(f=this.externalIntegrations)||void 0===f||f.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&n_(this,pw,!1)}}_overrideSDKInfo(t,e){ql.LIB_NAME=t,ql.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(le(le({},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.sh}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:Sw;return e!==Sw&&(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"))}Ku(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&xe(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))}zu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.Ku()||this.Yu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Yu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Yu(t){return"never"===this.config.person_profiles?(Rs.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.lu(),this.Xu(Et,!0),!0)}cu(){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)}du(){var t,e;const i=this.cu();var n,s,r;return this.is_capturing()||null===(n=this.logs)||void 0===n||n.rh(),(null===(t=this.persistence)||void 0===t?void 0:t.pi)!==i&&(null===(s=this.persistence)||void 0===s||s.set_disabled(i)),(null===(e=this.sessionPersistence)||void 0===e?void 0:e.pi)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),i&&(this.gu.clear(),this.Ju()),i}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){if(this.ou()){var n,s,r,o,l,a;null===(n=this.sessionRecording)||void 0===n||n.dispose({discardBufferedEvents:!0}),this.eh(!0,!0),null===(s=this.sessionManager)||void 0===s||s.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new Y_(this),this.pageViewManager=new l_(this),this.persistence&&(this.sessionPropsManager=new Z_(this,this.sessionManager,this.persistence));const t=null!==(o=null===(l=this.config.__extensionClasses)||void 0===l?void 0:l.sessionRecording)&&void 0!==o?o:null===(a=e.__defaultExtensionClasses)||void 0===a?void 0:a.sessionRecording;var u,h;t&&(this.sessionRecording=this.ru(this.sessionRecording,new t(this)),this.Xa&&(null===(u=this.sessionRecording)||void 0===u||null===(h=u.onRemoteConfig)||void 0===h||h.call(u,this.Xa)))}var c,d;this.consent.optInOut(!0),this.du(),this.ju(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(c=this.surveys)||void 0===c||c.loadIfEnabled()),(Ce(null==t?void 0:t.captureEventName)||(null==t?void 0:t.captureEventName))&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Bu()}else Rs.warn(gw)}opt_out_capturing(){if("always"===this.config.cookieless_mode)return void Rs.warn(gw);const t="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;var e,i;null==t||t.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.eh(!0,!0),this.consent.optInOut(!1),this.du(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Pt,$device_id:null}),this.su(t),this.sessionRecording=void 0,null===(e=this.sessionManager)||void 0===e||e.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Bu(),this.ju())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.du()}_is_bot(){return i?X_(i,this.config.custom_blocked_useragents):void 0}Bu(){n&&("visible"===n.visibilityState?this.bu||(this.bu=!0,this.capture(Yt,{title:n.title},{send_instantly:!0}),this._u&&(n.removeEventListener(Jt,this._u),this._u=null)):this._u||(this._u=this.Bu.bind(this),Us(n,Jt,this._u)))}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}))}Ul(){const t=this.xu||{};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?(Rs.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&&!Me(t[e]),o=i in t&&!Me(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,Rs)}$s(t){var e;if(Me(this.config.before_send))return t;const i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(Oe),n=we(this.config.before_send)?this.config.before_send:[this.config.before_send];let s=t;for(const e of n)try{if(s=e(s),Me(s)){const e=`Event '${t.event}' was rejected in beforeSend function`;return Fe(t.event)?Rs.warn(`${e}. This can cause unexpected behavior.`):Rs.info(e),null}s.properties&&!xe(s.properties)||Rs.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(e){return Rs.error(`Error in beforeSend function for event '${t.event}':`,e),null}for(const e of i)if(s.properties&&Me(s.properties[e]))return Rs.warn(`Event '${t.event}' had its '${e}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return s}getPageViewId(){var t;return null===(t=this.pageViewManager.Ao)||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)})}Su(t){const e=Re(t)&&!t,i=xl.Et()&&"true"===xl.Ot("ph_debug");return!e&&(!!i||t)}};Ew.__defaultExtensionClasses={},Ew.sh=(()=>{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]]=qs(t.prototype[e[i]])}(Ew,["identify"]);var Pw=class{constructor(t){this._instance=t}refresh(t){const e=this._instance.config,i=Se(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.Ul(),t.url_allowlist=null==i?void 0:i.url_allowlist,t.url_ignorelist=null==i?void 0:i.url_ignorelist,t.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,t.element_allowlist=null==i?void 0:i.element_allowlist,t.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,t.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,t.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,t.capture_copied_text=null==i?void 0:i.capture_copied_text}};const Rw=As("[ExceptionAutocapture]"),Aw=As("[TracingHeaders]"),Fw=As("[Web Vitals]"),Ow=9e5,Dw=["CLS","FCP","INP","LCP"],Lw=["INP","LCP"],Nw=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],qw=As("[SessionRecording]"),jw=As("[Heatmaps]");function Bw(t){return Se(t)&&"clientX"in t&&"clientY"in t&&Ee(t.clientX)&&Ee(t.clientY)}const Hw=As("[Product Tours]"),zw=t=>{var e;return!t.config.disable_product_tours&&!!(null===(e=t.persistence)||void 0===e?void 0:e.get_property(E))},Uw=["$set_once","$set"],Ww=As("[SiteApps]"),Vw="Error while initializing PostHog app with config id ",Gw=(t,e)=>(null==t?void 0:t.then)?t.then(e):e(t),Zw="SDK is not enabled or survey functionality is not yet loaded",Qw="Disabled. Not loading surveys.";var Jw=class{constructor(t,e){this.uo=t,this.oh=e,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.ah=!1,this.uh=[],this.hh=null,this.dh=null,this.fo=!1,this.fh=new Set,this.onRemoteConfig=t=>{if(this.fo)return;if(this.Sr.disableSurveys)return;if(!t.ok)return Mp.warn("Remote config unavailable. Not loading surveys.");const e=t.config.surveys;if(Me(e))return Mp.warn("Flags not loaded yet. Not loading surveys.");this.ph=Re(e)?e:e.length>0,Mp.info(`flags response received, isSurveysEnabled: ${this.ph}`),this.loadIfEnabled()}}setup(t){if(!this.fo)return this.gh=t,Gw(t.kv.initialize(),()=>{if(this.gh!==t||this.fo)return;this.gh=void 0,this.lo=t;const e=t.onRemoteConfig(this.onRemoteConfig);this.fo?e.dispose():(this.yo=e,this.loadIfEnabled())})}dispose(){var t,e,i,n;this.fo||(this.fo=!0,this.gh=void 0,this.lo=void 0,null===(t=this.yo)||void 0===t||t.dispose(),this.yo=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.uh=[],this.hh=null,this.fh.forEach(t=>clearTimeout(t)),this.fh.clear())}get Sr(){return this.uo.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null===(t=this._surveyEventReceiver)||void 0===t||t.reset(),localStorage.removeItem("lastSeenSurveyDate");const e=[];for(let t=0;t<localStorage.length;t++){const i=localStorage.key(t);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&e.push(i)}e.forEach(t=>localStorage.removeItem(t))}catch(t){}}loadIfEnabled(){if(this.fo||!this.lo)return;const t=this.Sr;if(this._surveyManager)return;if(this.ah)return void Mp.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Mp.info(Qw);if(t.cookielessMode&&this.uo.isOptedOut())return void Mp.info("Not loading surveys in cookieless mode without consent.");const e=this.uo.getExtensions();if(!e)return void Mp.error("PostHog Extensions not found.");if(Ce(this.ph)&&!t.advancedEnableSurveys)return;const i=this.ph||t.advancedEnableSurveys;this.ah=!0;try{const t=e.generateSurveys;if(t)return this.mh(t,i),void(this.ah=!1);const n=e.loadExternalDependency;if(!n)return this.yh(Vt),void(this.ah=!1);n(t=>{try{if(this.fo)return;const e=this.uo.getExtensions();t||!(null==e?void 0:e.generateSurveys)?this.yh("Could not load surveys script",t):this.mh(e.generateSurveys,i)}finally{this.ah=!1}})}catch(t){throw this.ah=!1,this.yh("Error initializing surveys",t),t}}mh(t,e){this.fo||(this._surveyManager=t(e),this._surveyEventReceiver=this.uo.createEventReceiver(),Mp.info("Surveys loaded successfully"),this.bh({isLoaded:!0}))}yh(t,e){Mp.error(t,e),this.bh({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.uh.push(t),this._surveyManager&&this.bh({isLoaded:!0}),()=>{this.uh=this.uh.filter(e=>e!==t)}}getSurveys(t,e=!1){var i;const n=null!==(i=this.lo)&&void 0!==i?i:this.oh;if(!n||this.fo)return;if(this.Sr.disableSurveys)return Mp.info(Qw),t([]);const s=n.kv.get(at);if(s&&!e)return t(s,{isLoaded:!0}),void(this._h()&&this.getSurveys(()=>{},!0));if(this.hh)return void this.hh.then(({surveys:e,context:i})=>{this.fo||t(e,i)}).catch(t=>Mp.error("Error in survey callback",t));const r=this.wh("/api/surveys/",{method:"GET",query:{token:n.projectToken},sentAt:"query",timeoutMs:this.Sr.requestTimeoutMs}).then(t=>{try{return this.kh(n,t)}catch(t){return Mp.error("Error processing surveys response",t),this.kh(n,{statusCode:0,error:t})}},t=>this.kh(n,{statusCode:0,error:t}));this.hh=r;const o=()=>{this.hh===r&&(this.hh=null)};r.then(e=>{o(),this.fo||t(e.surveys,e.context)},o).catch(t=>Mp.error("Error in survey callback",t))}wh(t,e){const i=this.lo;return i?i.sendRequest(t,e):new Promise(t=>t({statusCode:0,error:new Error(Zw)}))}kh(t,e){if(this.fo)return{surveys:[],context:{isLoaded:!1,error:Zw}};const i=e.statusCode;if(200!==i||!e.json){const t=`Surveys API could not be loaded, status: ${i}`;return 0!==i?Mp.error(t):e.error||Mp.warn(t),this.dh=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.dh=null;const n=e.json.surveys||[],s=n.filter(t=>Rp(t)&&(Yl(t)||Ap(t)));var r;return s.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(s)),t.kv.set({[at]:n,[ut]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}_h(){return this.Sh()&&!this.hh&&!this.xh()}Sh(){var t,e;const i=null===(t=null!==(e=this.lo)&&void 0!==e?e:this.oh)||void 0===t?void 0:t.kv.get(ut);return Ee(i)&&Date.now()-i>3e5}xh(){return Ee(this.dh)&&3e5>Date.now()-this.dh}markSurveyAsSeen(t,e){var i;const n={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};Dp(n);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}bh(t){for(const e of this.uh)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Mp.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e=!1){if(!Me(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Mp.warn("init was not called")}Ch(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}$h(t){if(Me(this._surveyManager))return{eligible:!1,reason:Zw};const e="string"==typeof t?this.Ch(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Th(t){if(!this.uo.isCapturing())return{eligible:!1,reason:Ep};if(Me(this._surveyManager))return{eligible:!1,reason:Zw};const e="string"==typeof t?this.Ch(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Me(this._surveyManager))return Mp.warn("init was not called"),{visible:!1,disabledReason:Zw};const e=this.Th(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Me(this._surveyManager)?(Mp.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Zw})):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.Th(s);i({visible:t.eligible,disabledReason:t.reason})}else i({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,i){var s;if(!this.uo.isCapturing())return;if(Me(this._surveyManager))return void Mp.warn("init was not called");const r="string"==typeof t?this.Ch(t):t;if(!(null==r?void 0:r.id))return void Mp.warn("Survey not found");if(!Lp.includes(r.type))return void Mp.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const o=null==n?void 0:n.querySelector(e);if(o){if(null===(s=r.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds){Mp.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var e,n;this.fh.delete(t),!this.fo&&this.uo.isCapturing()&&(Mp.info(`Rendering survey ${r.id} with delay of ${null===(e=r.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds} seconds`),null===(n=this._surveyManager)||void 0===n||n.renderSurvey(r,o,i),Mp.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.fh.add(t)}this._surveyManager.renderSurvey(r,o,i)}else Mp.warn("Survey element not found")}displaySurvey(t,e){var i;if(!this.uo.isCapturing())return;if(Me(this._surveyManager))return void Mp.warn("init was not called");const n=this.Ch(t);if(!n)return void Mp.warn("Survey not found");let s=n;if((null===(i=n.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)&&e.ignoreDelay&&(s=le(le({},n),{},{appearance:le(le({},n.appearance),{},{surveyPopupDelaySeconds:0})})),e.displayType!==Tp&&e.initialResponses&&Mp.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){const t=this.$h(n);if(!t.eligible)return void Mp.warn("Survey is not eligible to be displayed: ",t.reason)}"inline"!==e.displayType?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}cancelPendingSurvey(t){Me(this._surveyManager)?Mp.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t,e;null===(t=this._surveyManager)||void 0===t||null===(e=t.handlePageUnload)||void 0===e||e.call(t)}};function Kw(t,e,i){if(Me(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 Yw=class{constructor(t){this._instance=t,this.Ih=new Set,this.Mh=new Set,this.Eh=new Q_,this.Ph=(t,e)=>this.Rh(t,e)&&this.Ah(t,e)&&this.Fh(t,e)&&this.Oh(t,e),this.Rh=(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._instance)||void 0===t?void 0:t._addCaptureHook)||(this.Dh=null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook((t,e)=>{this.on(t,e)}))}dispose(){var t;null===(t=this.Dh)||void 0===t||t.call(this),this.Dh=void 0,this.Eh=new Q_}register(t){var e,i;if(!Ce(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)&&(t.forEach(t=>{var e;this.Ih.add(t),null===(e=t.steps)||void 0===e||e.forEach(t=>{this.Mh.add((null==t?void 0:t.event)||"")})}),null===(i=this._instance)||void 0===i?void 0:i.autocapture)){const t=new Set;this.Ih.forEach(e=>{var i;null===(i=e.steps)||void 0===i||i.forEach(e=>{(null==e?void 0:e.selector)&&t.add(e.selector)})}),this._instance.autocapture.setElementSelectors(t)}}replace(t){this.Ih.clear(),this.Mh.clear(),this.register(t)}on(t,e){null!=e&&0!=t.length&&(this.Mh.has(t)||this.Mh.has(e.event))&&this.Ih.forEach(t=>{this.Lh(e,t)&&this.Eh.emit("actionCaptured",t.name)})}Nh(t){this.onAction("actionCaptured",e=>t(e))}Lh(t,e){if(null==(null==e?void 0:e.steps))return!1;for(const i of e.steps)if(this.Ph(t,i))return!0;return!1}onAction(t,e){return this.Eh.on(t,e)}Ah(t,e){if(null==e?void 0:e.url){var i;const n=null==t||null===(i=t.properties)||void 0===i?void 0:i.$current_url;if(!n||"string"!=typeof n)return!1;if(!Kw(n,e.url,e.url_matching||"contains"))return!1}return!0}Fh(t,e){return!!this.qh(t,e)&&!!this.jh(t,e)&&!!this.Bh(t,e)}qh(t,e){var i;if(!(null==e?void 0:e.href))return!0;const n=this.Hh(t);if(n.length>0)return n.some(t=>Kw(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&&Kw(function(t){const e=t.match(/(?::|")href="(.*?)"/);return e?e[1]:""}(s),e.href,e.href_matching||"exact")}jh(t,e){var i;if(!(null==e?void 0:e.text))return!0;const n=this.Hh(t);if(n.length>0)return n.some(t=>Kw(t.text,e.text,e.text_matching||"exact")||Kw(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(;!Me(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=>Kw(t,o,l)));var r,o,l}Bh(t,e){var i,n;if(!(null==e?void 0:e.selector))return!0;const s=null==t||null===(i=t.properties)||void 0===i?void 0:i.$element_selectors;if(null==s?void 0:s.includes(e.selector))return!0;const r=(null==t||null===(n=t.properties)||void 0===n?void 0:n.$elements_chain)||"";if(e.selector_regex&&r)try{return new RegExp(e.selector_regex).test(r)}catch(t){return!1}return!1}Hh(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}Oh(t,e){return!(null==e?void 0:e.properties)||0===e.properties.length||na(e.properties.reduce((t,e)=>{const i=we(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)}},Xw=class{constructor(t){var e,i;this.zh=[],this._instance=t,this.Uh=new Map,this.Wh=new Map,this.Vh=new Map,this.Gh=null===(e=this._instance)||void 0===e||null===(i=e.onSessionId)||void 0===i?void 0:i.call(e,t=>this.Zh(t))}Qh(t){return!1}Jh(){return null}Kh(t){}Yh(){}Xh(t,e){return!!t&&na(t.propertyFilters,null==e?void 0:e.properties)}tc(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}ec(t,e,i){const n=(i===Xf?this.Uh:this.Wh).get(t);let s=[];return this.nc(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.Xh(r,e)})}register(t){this.sc(t,!1)}replace(t){this.sc(t,!0)}sc(t,e){var i;Ce(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)||(this.rc(t,e),this.oc(t,e))}oc(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.Vh.clear(),0===i.length)return void(e&&(null===(n=this.lc)||void 0===n||n.replace([])));this.lc||(this.lc=new Yw(this._instance),this.lc.init(),this.lc.Nh(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.Vh.get(e.name))&&void 0!==i?i:[];n.includes(t.id)||n.push(t.id),this.Vh.set(e.name,n)}})}),e?this.lc.replace(s):this.lc.register(s)}ac(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)})}rc(t,e){var i,n;const s=t.filter(t=>{var e,i;return(null===(e=t.conditions)||void 0===e?void 0:e.events)&&(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),r=t.filter(t=>{var e,i;return(null===(e=t.conditions)||void 0===e?void 0:e.cancelEvents)&&(null===(i=t.conditions)||void 0===i||null===(i=i.cancelEvents)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),o=this.tc(t,Xf),l=this.tc(t,tp);e?(this.Uh=o,this.Wh=l):(this.ac(this.Uh,o),this.ac(this.Wh,l)),(0!==s.length||0!==r.length)&&(null!==(i=this.Dh)&&void 0!==i||(this.Dh=null===(n=this._instance)||void 0===n?void 0:n._addCaptureHook((t,e)=>{this.onEvent(t,e)})))}onEvent(t,e){var i,n;const s=this.uc(),r=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$survey_id)||(null==e||null===(n=e.properties)||void 0===n?void 0:n.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const e=this.hc(t,r);if("consume"===e)return s.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.cc([r]);if("persist"===e)return s.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.dc(r),void this.vc([r])}if(this.Wh.has(t)){const i=this.ec(t,e,tp);i.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:i.map(t=>t.id)}),this.cc(i.map(t=>t.id)),i.forEach(t=>this.fc(t.id)))}if(!this.Uh.has(t))return;s.info("event name matched",{event:t,eventPayload:e,items:this.Uh.get(t)});const o=this.ec(t,e,Xf);this.gc(o.map(t=>t.id))}onAction(t){this.Vh.has(t)&&this.gc(this.Vh.get(t)||[])}gc(t){var e,i;if(0===t.length)return;const n=!!(null===(e=this._instance)||void 0===e||null===(i=e.get_session_id)||void 0===i?void 0:i.call(e)),s=[];for(const e of t)n&&this.Qh(e)?this.dc(e)&&this.mc(e):s.push(e);s.length>0&&(this.zh=[...new Set([...this.zh,...s])]),this.uc().info("updating activated items",{activatedItems:this.getActivatedIds()})}dc(t){this.zh=this.zh.filter(e=>e!==t);const e=this.yc();return!e.includes(t)&&(this.bc([...e,t]),this._c(),!0)}cc(t){const e=new Set(t);this.zh=this.zh.filter(t=>!e.has(t));const i=this.wc(),n=i.filter(t=>!e.has(t));n.length!==i.length&&(this.bc(n),0===n.length&&this.kc()),this.vc(t)}Sc(){var t;const e=this.Jh();if(!e)return{};const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[e];return i&&"object"==typeof i?i:{}}mc(t){if(!this.Jh())return;const e=this.Sc();this.Kh(le(le({},e),{},{[t]:Date.now()}))}vc(t){if(!this.Jh())return;const e=this.Sc(),i={};let n=!1;for(const[s,r]of Object.entries(e))t.includes(s)?n=!0:i[s]=r;n&&(xe(i)?this.Yh():this.Kh(i))}xc(){this.Jh()&&this.Yh()}getActivationTimestamp(t){if(!this.yc().includes(t))return;const e=this.Sc()[t];return Ee(e)?e:void 0}wc(){var t;const e=this.Cc();return(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[e])||[]}yc(){var t,e,i;const n=this.wc();if(0===n.length)return[];const s=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[this.$c()],r=null===(e=this._instance)||void 0===e||null===(i=e.get_session_id)||void 0===i?void 0:i.call(e);return r&&s===r?n:[]}_c(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(e=t.get_session_id)||void 0===e?void 0:e.call(t);i&&this.Tc(i)}kc(){this.Ic()}Zh(t){var e;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[this.$c()];if(i&&i!==t){const t=this.wc(),e=this.Sc();t.length>0&&(this.bc([]),t.filter(t=>Ee(e[t])).forEach(t=>this.fc(t))),this.kc(),this.xc()}}getActivatedIds(){return[...new Set([...this.yc(),...this.zh])].filter(t=>!this.Mc(t))}dispose(){var t,e,i;null===(t=this.Gh)||void 0===t||t.call(this),this.Gh=void 0,null===(e=this.Dh)||void 0===e||e.call(this),this.Dh=void 0,null===(i=this.lc)||void 0===i||i.dispose(),this.lc=void 0}reset(){this.zh=[],this.wc().length>0&&this.bc([]),this.kc(),this.xc()}getEventToItemsMap(){return this.Uh}Ec(){return this.lc}},tk=class extends Xw{constructor(t){super(t)}Cc(){return ht}$c(){return ct}Jh(){return dt}Kh(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_timestamps:t})}Yh(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_timestamps")}Qh(t){var e;let i;this.nc(e=>{i=e.find(e=>e.id===t)});const n=null==i||null===(e=i.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds;return Ee(n)&&n>0}Pc(){return pp}nc(t){var e;null===(e=this._instance)||void 0===e||e.getSurveys(t)}fc(t){var e;null===(e=this._instance)||void 0===e||e.cancelPendingSurvey(t)}uc(){return Mp}bc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated:t})}Tc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_session:t})}Ic(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_session")}Mc(){return!1}hc(t,e){let i;return this.nc(t=>{i=t.find(t=>t.id===e)}),!i||Xl(i)?t===pp?"consume":"ignore":t===pp?"persist":t===gp||t===mp?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},ek=class{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);const e={};for(const i of t){const t=this._instance.get_property(i);Ce(t)||(e[i]=t)}return e}set(t,e){this._instance.register("string"==typeof t?{[t]:e}:t)}remove(t){"string"!=typeof t?t.forEach(t=>this._instance.unregister(t)):this._instance.unregister(t)}},ik=class{constructor(t){this._instance=t}get(){const t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const t=null==d?void 0:d.__PosthogExtensions__;if(!t)return;const{generateSurveys:e,loadExternalDependency:i}=t;return{generateSurveys:e?t=>e(this._instance,t):void 0,loadExternalDependency:i?t=>i(this._instance,"surveys",t):void 0}}createEventReceiver(){return new tk(this._instance)}};const nk=(null==t?void 0:t.location)?Ys(t.location.hash,"__posthog")||Ys(location.hash,"state"):null,sk="_postHogToolbarParams",rk=As("[Toolbar]"),ok=As("[FeatureFlags]");var lk=class{constructor(t,e=!1){this.Rc=!1,this.update(t,e)}update(t,e){this.Ac=((t,e)=>{var i,n,s,r,o;return{bootstrap:{featureFlags:null===(i=t.bootstrap)||void 0===i?void 0:i.featureFlags,featureFlagPayloads:null===(n=t.bootstrap)||void 0===n?void 0:n.featureFlagPayloads},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!==(s=t.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(r=null!==(o=t.evaluation_contexts)&&void 0!==o?o:t.evaluation_environments)&&void 0!==r?r:[],flagKeys:we(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.Rc||(ok.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Rc=!0),Ce(t.flag_keys)||we(t.flag_keys)||ok.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Ac}};const ak=As("[FeatureFlags]"),uk=As("[FeatureFlags]",{debugEnabled:!0}),hk="\" failed. Feature flags didn't load in time.",ck="connection_error",dk=t=>{const e={};for(let i=0;t.length>i;i++)e[t[i]]=!0;return e},vk=t=>{const e={};for(const[i,n]of Ls(t||{}))n&&(e[i]=n);return e},fk="Refusing to render web experiment since the viewer is a likely bot",pk={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>ta(e,t),not_regex:(t,e)=>!ta(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},gk=As("[Conversations]"),mk="Conversations not available yet.";function yk(t,e){var n,s,r,o,l,a,u;const h=null!==(n=null==t?void 0:t.flushIntervalMs)&&void 0!==n?n:3e3,c=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,d=(null==e?void 0:e.consoleCapture)?void 0:null!==(r=null==t?void 0:t.maxLogsPerInterval)&&void 0!==r?r:1e3,v=Ce(d)?Math.max(c,2048):Math.max(c,d),f=le(le({},function(){let t="",e="";try{const n=null==i?void 0:i.userAgent;n&&([t,e]=Vi(n))}catch(t){}return function(t,e){const i=function(t){if(t)return{}.hasOwnProperty.call(gs,t)?gs[t]:t}(t);return le(le({},i?{"os.name":i}:{}),e?{"os.version":e}:{})}(t,e)}()),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(l=null==f?void 0:f["service.name"])&&void 0!==l?l:null==t?void 0:t.serviceName)&&void 0!==o?o:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(a=null==f?void 0:f["service.version"])&&void 0!==a?a:null==t?void 0:t.serviceVersion,environment:null!==(u=null==f?void 0:f["deployment.environment"])&&void 0!==u?u:null==t?void 0:t.environment,resourceAttributes:f,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:h,maxBufferSize:c,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const bk=["debug","log","warn","error","info"],_k="console",wk="__posthogHandledLogsRequestError",kk=(t,e)=>{const i=t instanceof Error?t:new Error(e);return i[wk]=!0,i},Sk=t=>!!t&&"object"==typeof t&&!0===t[wk],xk={featureFlags:class{constructor(t){this.name="featureFlags",this.Fc=!1,this.featureFlagEventHandlers=[],this.$=ak,this.Oc={},this.Dc={},this.Lc=[],this.Nc=!1,this.qc=!1,this.jc=0,this.Bc=!1,this.Hc=!1,this.zc=!1,this.Uc=!1,this.Wc=0,this.sn=()=>{const t=this.Vc();this.Wc=0,t&&this.reloadFeatureFlags()},this.Gc=()=>{var t;const e=this.Zc;Ce(e)||this.Sr.remoteRequestsDisabled||!n||"hidden"===n.visibilityState||Date.now()-(null!==(t=this.Qc)&&void 0!==t?t:0)<e||(this.reloadFeatureFlags(),this.Jc())},this.an=()=>{"visible"===(null==n?void 0:n.visibilityState)&&this.Gc()},"get"in t?this.uo=t:(this._instance=t,this.Kc=new lk(t.config,t.Ul()),this.uo=this.Kc)}updateConfig(t,e){var i;null===(i=this.Kc)||void 0===i||i.update(t,e),this.lo&&this.Yc()}setup(t){return this.gh=t,this.$=t.logger.createLogger("[FeatureFlags]"),Gw(t.kv.initialize(),()=>{this.gh===t&&(this.gh=void 0,this.lo=t,this.Xc(t))})}Xc(e){var i;if(this.lo===e)return t&&Us(t,"online",this.sn),this.Yc(),this.td=e.registerDynamicEventProperties(()=>this.ed()?this.Oc:this.Dc),this.nd=null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.sd(),this.rd(),this.od()}),this.rd(),this.initialize()}Yc(){const t=this.Sr.refreshIntervalMs,e=!this.Sr.remoteRequestsDisabled&&n&&!Ce(t)&&t>0?t:void 0;e!==this.Zc&&(this.ld(),Ce(e)||(this.Zc=e,this.Jc(),(null==n?void 0:n.addEventListener)&&Us(n,Jt,this.an)))}Jc(){Ce(this.Zc)||(Ce(this.ad)||clearInterval(this.ad),this.Qc=Date.now(),this.ad=setInterval(this.Gc,this.Zc))}ld(){var t;Ce(this.ad)||(clearInterval(this.ad),this.ad=void 0,null==n||null===(t=n.removeEventListener)||void 0===t||t.call(n,"visibilitychange",this.an)),this.Zc=void 0,this.Qc=void 0}destroy(){this.ud()}dispose(){this.ud()}ud(){var e,i;this.ld(),this.jc++,this.Hc=!1,this.gh=void 0,this.lo&&(this.hd(),null===(e=this.td)||void 0===e||e.dispose(),this.td=void 0,null===(i=this.nd)||void 0===i||i.call(this),this.nd=void 0,this.Lc=[],null==t||t.removeEventListener("online",this.sn),this.lo=void 0)}get Sr(){return this.uo.get()}dd(t){var e;return this.vd&&t in this.vd?this.vd[t]:null===(e=this.lo)||void 0===e?void 0:e.kv.get(t)}sd(){return!!this.vd&&(this.vd=void 0,!0)}fd(){var t;return!Ce(null===(t=this.lo)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.sd()}At(t){this.pd(()=>{var e;return null===(e=this.lo)||void 0===e?void 0:e.kv.set(t)})}gd(t,e,i){var n;if(!(null===(n=this._instance)||void 0===n?void 0:n.persistence)||!t.$enabled_feature_flags)return;const s=this.dd("$enabled_feature_flags")||{},r=t.$enabled_feature_flags||{},o=e.flags||e.featureFlags,l=e.flags?Object.entries(e.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],a=!!e.errorsWhileComputingFlags&&!!e.flags,u=a?l:i&&!we(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(r)])),h=this.dd("$feature_flag_payloads")||{},c=t.$feature_flag_payloads||{},d=a||i?u:Array.from(new Set([...Object.keys(h),...Object.keys(c)])),v=!a&&!i,f=!!v||u,p=!!v||d,g={[K]:f,[J]:f,[tt]:p};t.$feature_flag_details&&(g[X]=f);for(const e of[et,St,it])Ce(t[e])||(g[e]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(g)}Lt(t){this.pd(()=>{var e;return null===(e=this.lo)||void 0===e?void 0:e.kv.remove(t)})}pd(t){try{t()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}rd(){const t={};for(const e of[K,tt,et,nt]){const i=this.dd(e);Ce(i)||(t[e]=i)}this.Oc=t;const e=le({},t),i=this.dd(J);if(i)for(const[t,n]of Object.entries(i))e[`$feature/${t}`]=n;this.Dc=e}ed(){const t=this.Sr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.dd(St);return"number"!=typeof e||Date.now()-e>t}md(){return!!this.ed()&&(this.Uc||this.qc||(this.Uc=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}yd(){const t=this.Sr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),e}):[]}bd(){const t=this.Sr.flagKeys;if(!Ce(t))return t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),e})}initialize(){var t,e;const i=this.Sr,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,i)=>(e[i]=t[i],e),{});return this._d({featureFlags:e,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,e,i){var n,s;const r=(null==i?void 0:i.merge)&&null!==(n=this.dd("$enabled_feature_flags"))&&void 0!==n?n:{},o=(null==i?void 0:i.merge)&&null!==(s=this.dd("$feature_flag_payloads"))&&void 0!==s?s:{},l=le(le({},r),t),a=le(le({},o),e),u={};for(const[t,e]of Object.entries(l))u[t]={key:t,enabled:Qn(e),variant:Jn(e),reason:void 0,metadata:Ce(null==a?void 0:a[t])?void 0:{id:0,version:void 0,description:void 0,payload:a[t]}};this._d({flags:u})}get hasLoadedFlags(){return this.Nc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.dd(X),e=this.dd(nt),i=this.dd(st);if(!i&&!e)return t||{};const n=Ds({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(const t of s){var r;const s=n[t],l=null==e?void 0:e[t],a=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,h=null==i?void 0:i[t],c=le(le({},s),{},{enabled:a,variant:a?null!=u?u:null==s?void 0:s.variant:void 0});var o;a!==(null==s?void 0:s.enabled)&&(c.original_enabled=null==s?void 0:s.enabled),u!==(null==s?void 0:s.variant)&&(c.original_variant=null==s?void 0:s.variant),h&&(c.metadata=le(le({},null==s?void 0:s.metadata),{},{payload:h,original_payload:null==s||null===(o=s.metadata)||void 0===o?void 0:o.payload})),n[t]=c}return this.Fc||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:n}),this.Fc=!0),n}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(i=>{const n=t[i];return{key:i,enabled:Qn(n),variant:Jn(n),payload:Zn(e[i])}})}getFlagVariants(){const t=this.dd(J),e=this.dd(nt);if(!e)return t||{};const i=Ds({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.Fc||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Fc=!0),i}getFlagPayloads(){const t=this.dd(tt),e=this.dd(st);if(!e)return t||{};const i=Ds({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.Fc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Fc=!0),i}reloadFeatureFlags(){this.Bc||this.Sr.featureFlagsDisabled||this.Vc()||(this.qc&&(this.Hc=!0),this.wd||(this.Lc.slice().forEach(t=>{try{t()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.wd=setTimeout(()=>{this.kd()},5)))}hd(){clearTimeout(this.wd),this.wd=void 0}onReloading(t){return this.Lc.push(t),()=>{this.Lc=this.Lc.filter(e=>e!==t)}}ensureFlagsLoaded(){this.Nc||this.qc||this.wd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Bc=t}resetFlagCallReported(){this.Lt(_t)}kd(t){this.hd();const e=this.lo;if(!e||this.Sr.remoteRequestsDisabled||this.Vc())return;if(this.qc)return void(this.Hc=!0);const i={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:le(le(le({},e.initialPersonProperties),this.dd("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.dd(ot),timezone:Ca()};Ce(e.deviceId)||(i.$device_id=e.deviceId),((null==t?void 0:t.disableFlags)||this.Sr.featureFlagsDisabled)&&(i.disable_flags=!0);const n=this.yd();n.length&&(i.evaluation_contexts=n);const s=this.bd();Ce(s)||(i.flag_keys=s);const r=this.Sr.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),l=this.jc;this.qc=!0;const a=()=>{this.Hc&&(this.Hc=!1,this.kd())},u=t=>{var e,n;const s=null!==(e=t.json)&&void 0!==e?e:{},o=200!==t.statusCode;if(this.qc=!1,l!==this.jc)return void a();if(this.Sd(t.statusCode),o||this.Hc||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.Hc)return;this.zc=!o;const u=[];t.error?u.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?ck:"unknown_error"):200!==t.statusCode&&u.push(`api_error_${t.statusCode}`),s.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");const h=!!(null===(n=s.quotaLimited)||void 0===n?void 0:n.includes("feature_flags"));h&&u.push("quota_limited"),this.At({[kt]:u}),h?this.$.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):i.disable_flags||this._d(s,o,{partialResponse:r}),a()},h=t=>{this.qc=!1,l===this.jc?(this.At({[kt]:[ck]}),this.$.error("Feature flag request failed",t),this.fd()&&this.od(!0),a()):a()};try{e.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this.Sr.compression,sentAt:"body",timeoutMs:this.Sr.requestTimeoutMs}).then(u).catch(h)}catch(t){h(t)}}Vc(){return Xs(this.Wc,3)}Sd(t){this.Wc=tr(t,this.Wc,3,()=>this.$.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,e={}){var i;if(e.fresh&&!this.zc)return;if(!(this.Nc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+t+hk);if(this.md())return;const n=this.getFeatureFlagResult(t,e);return null!==(i=null==n?void 0:n.variant)&&void 0!==i?i:null==n?void 0:n.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e={}){if(e.fresh&&!this.zc)return;if(!(this.Nc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+t+hk);if(this.md())return;const i=this.getFlagVariants(),n=t in i,s=i[t],r=this.getFlagPayloads()[t],o=String(s),l=this.dd("$feature_flag_request_id")||void 0,a=this.dd("$feature_flag_evaluated_at")||void 0;let u,h=this.dd("$flag_call_reported")||{};if(this.Sr.deduplicateCallsPerSession){var c;const t=null===(c=this.lo)||void 0===c?void 0:c.session.sessionId,e=this.dd(wt);t&&t!==e&&(h={},u=t)}if(e.send_event||!("send_event"in e))if(t in h&&h[t].includes(o))u&&this.At({[_t]:h,[wt]:u});else{var d,v,f,p,g,m,y,b,_,w,k,S;we(h[t])?h[t].push(o):h[t]=[o],this.At(le({[_t]:h},u?{[wt]:u}:{}));const e=this.getFeatureFlagDetails(t),i=[...null!==(d=this.dd("$feature_flag_errors"))&&void 0!==d?d:[]];Ce(s)&&i.push("flag_missing");const n={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:a,$feature_flag_bootstrapped_response:null!==(v=null===(f=this.Sr.bootstrap)||void 0===f||null===(f=f.featureFlags)||void 0===f?void 0:f[t])&&void 0!==v?v:null,$feature_flag_bootstrapped_payload:null!==(p=null===(g=this.Sr.bootstrap)||void 0===g||null===(g=g.featureFlagPayloads)||void 0===g?void 0:g[t])&&void 0!==p?p:null,$used_bootstrap_value:!this.zc};Ce(null==e||null===(m=e.metadata)||void 0===m?void 0:m.has_experiment)||(n.$feature_flag_has_experiment=e.metadata.has_experiment),Ce(null==e||null===(y=e.metadata)||void 0===y?void 0:y.version)||(n.$feature_flag_version=e.metadata.version);const c=null!==(b=null==e||null===(_=e.reason)||void 0===_?void 0:_.description)&&void 0!==b?b:null==e||null===(w=e.reason)||void 0===w?void 0:w.code;var x;c&&(n.$feature_flag_reason=c),(null==e||null===(k=e.metadata)||void 0===k?void 0:k.id)&&(n.$feature_flag_id=e.metadata.id),Ce(null==e?void 0:e.original_variant)&&Ce(null==e?void 0:e.original_enabled)||(n.$feature_flag_original_response=Ce(e.original_variant)?e.original_enabled:e.original_variant),(null==e||null===(S=e.metadata)||void 0===S?void 0:S.original_payload)&&(n.$feature_flag_original_payload=null==e||null===(x=e.metadata)||void 0===x?void 0:x.original_payload),i.length&&(n.$feature_flag_error=i.join(",")),this.xd(n)}else u&&this.At({[_t]:h,[wt]:u});return n?{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:Zn(r)}:void 0}xd(t){try{var e;null===(e=this.lo)||void 0===e||e.capture("$feature_flag_called",t).catch(t=>{this.$.error("Failed to capture feature flag call",t)})}catch(t){this.$.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,e){this.Cd(t,e)}Cd(t,e){var i=this;return ne(function*(){const n=i.lo;if(!n)return;const s={distinct_id:n.distinctId,token:n.projectToken,person_properties:{$lib:n.library.name,$lib_version:n.library.version}},r=i.yd();r.length&&(s.evaluation_contexts=r);const o=i.bd();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.Sr.compression,sentAt:"body",timeoutMs:i.Sr.requestTimeoutMs})).json)||void 0===a?void 0:a.featureFlagPayloads;l=(null==e?void 0:e[t])||void 0}catch(t){return void i.$.error("Remote config feature flag request failed",t)}try{e(l)}catch(t){i.$.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.zc)return e.defaultValue;if(!(this.Nc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+hk),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._d(t,e,i)}_d(t,e,i){if(!this.lo)return;this.Nc=!0;const n=((t,e={},i={},n={},s,r=ak)=>{const o=((t,e)=>{const i=t.flags;if(i){const e=Object.fromEntries(Object.keys(i).map(t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]})),n=Object.fromEntries(Object.keys(i).filter(t=>i[t].enabled).filter(t=>{var e;return!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 le(le({},t),{},{featureFlags:e,featureFlagPayloads:n})}return t.featureFlags&&e.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t,r),l=o.flags,a=o.featureFlags,u=o.featureFlagPayloads;if(!a)return;const h=t.requestId,c=t.evaluatedAt;if(we(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{[K]:a,[J]:t,[it]:!1}}let d=a,v=u,f=l;if(null==s?void 0:s.partialResponse){const t=Object.keys(d),s=v||{};d=le(le({},e),d),v=le(le({},i),s),t.forEach(t=>{t in s||null==v||delete v[t]}),f=le(le({},n),f)}else if(t.errorsWhileComputingFlags)if(l){const t=new Set(Object.keys(l).filter(t=>{var e;return!(null===(e=l[t])||void 0===e?void 0:e.failed)}));d=le(le({},e),Object.fromEntries(Object.entries(d).filter(([e])=>t.has(e))));const s=Object.fromEntries(Object.entries(v||{}).filter(([e])=>t.has(e)));v=le(le({},i),s),t.forEach(t=>{t in s||null==v||delete v[t]}),f=le(le({},n),Object.fromEntries(Object.entries(f||{}).filter(([e])=>t.has(e))))}else d=le(le({},e),d),v=le(le({},i),v),f=le(le({},n),f);return le(le({[K]:Object.keys(vk(d)),[J]:d||{},[tt]:v||{},[X]:f||{},[it]:!0===t.minimalFlagCalledEvents},h?{[et]:h}:{}),c?{[St]:c}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.$);if(n)if(!1===(null==i?void 0:i.persist)){const t=!Ce(this.lo.kv.get(J));this.vd=n,t||this.At(n)}else this.sd(),this.gd(n,t,!!(null==i?void 0:i.partialResponse)),this.At(n);else e&&this.fd();e||(this.Uc=!1),this.od(e)}override(t,e=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.$d(t)}$d(t){if(this.lo){if(!1===t)return this.Lt([nt,st]),this.od(),void uk.info("All overrides cleared");if(we(t))return this.At({[nt]:dk(t)}),this.od(),void uk.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e;const i=t;this.Fc=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);const n={},s=i.flags,r=i.payloads;return s&&(n[nt]=we(s)?dk(s):s),r&&(n[st]=r),Object.keys(n).length&&this.At(n),!1===s&&!1===r?this.Lt([nt,st]):!1===s?this.Lt(nt):!1===r&&this.Lt(st),this.od(),!1===s?uk.info("Flag overrides cleared"):s&&uk.info("Flag overrides set",{flags:s}),void(!1===r?uk.info("Payload overrides cleared"):r&&uk.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.At({[nt]:t}),this.od(),void uk.info("Flag overrides set",{flags:t});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Nc){const{flags:e,flagVariants:i}=this.Td();try{t(e,i)}catch(t){this.$.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var n;const s=(this.dd("$early_access_features")||[]).find(e=>e.flagKey===t),r={[`$feature_enrollment/${t}`]:e},o={$feature_flag:t,$feature_enrollment:e,$set:r};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i);const l=le(le({},this.getFlagVariants()),{},{[t]:e});null===(n=this._instance)||void 0===n||null===(n=n.persistence)||void 0===n||n.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.At({[K]:Object.keys(vk(l)),[J]:l,[rt]:le(le({},this.dd("$stored_person_properties")||{}),r)}),this.od();try{var a;null===(a=this.lo)||void 0===a||a.capture("$feature_enrollment_update",o).catch(t=>{this.$.error("Failed to capture early access feature enrollment",t)})}catch(t){this.$.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,e=!1,i){const n=this.dd(Y);!n||e?this.Id(t,i):t(n)}Id(t,e){var i=this;return ne(function*(){const n=i.lo;if(!n)return;const s=e?`&${e.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${s}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,i.At({[Y]:r})}catch(t){return void i.$.error("Early access feature request failed",t)}try{t(r)}catch(t){i.$.error("Early access feature callback failed",t)}})()}Td(){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),{})}}od(t){this.rd();const{flags:e,flagVariants:i}=this.Td();this.featureFlagEventHandlers.forEach(n=>{try{n(e,i,{errorsLoading:t})}catch(t){this.$.error("Error while running feature flags callback",t)}})}setPersonPropertiesForFlags(t,e=!0){this.Md(t,e)}Md(t,e=!0){const i=this.dd("$stored_person_properties")||{},n=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),s=null==t?void 0:t.$set_once,r={};if(s)for(const t in s)({}).hasOwnProperty.call(s,t)&&(t in i||(r[t]=s[t]));this.At({[rt]:le(le(le({},i),r),n)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const i=le({},this.dd("$stored_person_properties")||{});t.forEach(t=>{delete i[t]}),this.At({[rt]:i}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(rt),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const i=this.dd("$stored_group_properties")||{},n=le({},i);for(const e of Object.keys(t))n[e]=le(le({},i[e]),t[e]);this.At({[ot]:n}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.dd("$stored_group_properties")||{};this.At({[ot]:le(le({},e),{},{[t]:{}})})}else this.Lt(ot)}reset(){this.jc++,this.Hc=!1,this.Oc={},this.Dc={},this.vd=void 0,this.Nc=!1,this.Bc=!1,this.zc=!1,this.$anon_distinct_id=void 0,this.hd(),this.Fc=!1,this.Wc=0}}},Ck={sessionRecording:class{get Sr(){return this._instance.config}get ga(){return this._instance.persistence}get started(){var t;return!!(null===(t=this.Ed)||void 0===t?void 0:t.isStarted)}get status(){var t,e;return"awaiting_config"===this.Pd||"missing_config"===this.Pd?this.Pd:null!==(t=null===(e=this.Ed)||void 0===e?void 0:e.status)&&void 0!==t?t:this.Pd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.Pd=to,this.Rd=void 0,this.Ad=!1,this.Ke=(()=>{var e,i;if(!(null==n?void 0:n.visibilityState)||"visible"===n.visibilityState)return!0;const s=null==t||null===(e=t.performance)||void 0===e||null===(i=e.getEntriesByType)||void 0===i?void 0:i.call(e,"visibility-state");return!(null==s?void 0:s.length)||s.some(t=>"visible"===t.name)})(),this.an=()=>{var t,e;"visible"===(null==n?void 0:n.visibilityState)&&(this.Ke=!0,null===(t=this.Ed)||void 0===t||null===(e=t.setDocumentWasEverVisible)||void 0===e||e.call(t,!0))},!this._instance.sessionManager)throw qw.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Sr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==n?void 0:n.addEventListener)&&Us(n,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.Ad=!0,null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,"visibilitychange",this.an),t?this.Fd(!0):this.stopRecording()}get Od(){var e;const i=!!(null===(e=this._instance.get_property("$session_recording_remote_config"))||void 0===e?void 0:e.enabled),n=!this.Sr.disable_session_recording,s=this.Sr.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&n&&!s}startIfEnabledOrStop(t){var e;if(this.Ad)return;if(this.Od&&(null===(e=this.Ed)||void 0===e?void 0:e.isStarted))return;const i=!Ce(Object.assign)&&!Ce(Array.from);this.Od&&i?(this.Dd(t),qw.info("starting")):(this.Pd=to,this.stopRecording())}Dd(t){var e,i;if(this.Od)if("awaiting_config"!==this.Pd&&"missing_config"!==this.Pd&&(this.Pd=ro),(null==d||null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.rrweb)||void 0===e?void 0:e.record)&&(null===(i=d.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this.Ld(t);else{var n,s;const e=this._instance.sessionManager;null===(n=d.__PosthogExtensions__)||void 0===n||null===(s=n.loadExternalDependency)||void 0===s||s.call(n,this._instance,this.Nd,i=>{if(!this.Ad&&this.Od&&this._instance.sessionManager===e)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),qw.error("could not load recorder",i)):void this.Ld(t);this.Pd="disabled"})}}stopRecording(){var t,e;null===(t=this.Rd)||void 0===t||t.call(this),this.Rd=void 0,null===(e=this.Ed)||void 0===e||e.stop()}Fd(t=!1){var e,i;null===(e=this.Rd)||void 0===e||e.call(this),this.Rd=void 0,null===(i=this.Ed)||void 0===i||i.discard({discardProducerEvents:t})}qd(){var t,e;null===(t=this.ga)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this.ga)||void 0===e||e.unregister("$replay_sample_rate")}jd(t,e){if(Me(t))return null;const i=Ee(t)?t:parseFloat(t);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(qw.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):i;var n}Bd(t){if(this.ga){var e,i;const n=this.ga,s=()=>{var e;const i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.jd(null===(e=this.Sr.session_recording)||void 0===e?void 0:e.sampleRate,"session_recording.sampleRate"),r=this.jd(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:r;Me(o)&&this.qd();const l=null==i?void 0:i.minimumDurationMilliseconds;n.register({[A]:le(le({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:le({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.Rd)||void 0===e||e.call(this),this.Rd=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.Bd(e),void this.Fd()):(this.Bd(e),void this.startIfEnabledOrStop()):("awaiting_config"===this.Pd&&(this.Pd="missing_config",qw.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var i;(null===(i=this.Ed)||void 0===i?void 0:i.log)?this.Ed.log(t,e):qw.warn("log called before recorder was ready")}get Nd(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(A);return(null==i||null===(e=i.scriptConfig)||void 0===e?void 0:e.script)||"lazy-recorder"}Hd(){const t=this._instance.get_property(A);if(!t)return!1;let e;try{e="object"==typeof t?t:JSON.parse(t)}catch(t){return qw.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!Me(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}Ld(t){var e,i,n;if(!this.Ad&&this.Od&&this._instance.sessionManager){if(!(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))return qw.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Ot]:!0});var s;if(this.Ed||(this.Ed=null===(s=d.__PosthogExtensions__)||void 0===s?void 0:s.initSessionRecording(this._instance,this.Ke),this.Ed._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Hd()){if("missing_config"===this.Pd||"awaiting_config"===this.Pd)return;return this.Pd="awaiting_config",qw.info("persisted remote config is stale, requesting fresh config before starting"),void new $_(this._instance).load()}this.Pd=ro,null===(i=(n=this.Ed).setDocumentWasEverVisible)||void 0===i||i.call(n,this.Ke),this.Ed.start(t)}else this.Pd=to}onRRwebEmit(t){var e,i;null===(e=this.Ed)||void 0===e||null===(i=e.onRRwebEmit)||void 0===i||i.call(e,t)}overrideLinkedFlag(){var t,e;this.Ed||null===(e=this.ga)||void 0===e||e.register({$replay_override_linked_flag:!0}),null===(t=this.Ed)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Ed||null===(e=this.ga)||void 0===e||e.register({$replay_override_sampling:!0}),null===(t=this.Ed)||void 0===t||t.overrideSampling()}overrideTrigger(t){var e,i;this.Ed||null===(i=this.ga)||void 0===i||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(e=this.Ed)||void 0===e||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null===(t=this.Ed)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!!(null===(i=this.Ed)||void 0===i?void 0:i.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;null===(t=this.Ed)||void 0===t||null===(e=t.flushBeforeIdentityReset)||void 0===e||e.call(t)}}},$k={autocapture:class extends Db{constructor(t){super(new Pw(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.zd=this.Ud()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.Wd();return!!(t.path||t.search||this.Vd(t))}startIfEnabled(){this.isEnabled&&(Rs.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.zd=this.Ud(),this.startIfEnabled()}stop(){this.Gd&&this.Gd(),this.Gd=void 0,this.Zd&&this.Zd(),this.Zd=void 0,Rs.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.Qd("pushState"),this.Qd("replaceState"),this.Jd(),this.Vd()&&this.Kd())}Qd(e){var i;if(!t||(null===(i=t.history[e])||void 0===i?void 0:i.__posthog_wrapped__))return;const n=this;av(t.history,e,t=>function(i,s,r){t.call(this,i,s,r),n.Yd(e)})}Ud(){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}}Wd(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:Se(t)?t:{}}Vd(t=this.Wd()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Xd(t){const e=this.Wd(),i=this.zd;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.Vd(e)&&t.hash!==i.hash))}Yd(t){try{const e=this.Ud();if(!e)return;this.Xd(e)&&this._instance.capture(Yt,{navigation_type:t}),this.zd=e}catch(e){Rs.error(`Error capturing ${t} pageview`,e)}}Jd(){if(this.Gd)return;const e=()=>{this.Yd("popstate")};Us(t,"popstate",e),this.Gd=()=>{t&&t.removeEventListener("popstate",e)}}Kd(){if(this.Zd)return;const e=()=>{this.Yd("hashchange")};Us(t,"hashchange",e),this.Zd=()=>{t&&t.removeEventListener("hashchange",e)}}},heatmaps:class{get Sr(){return this.instance.config}constructor(t){var e;this.tv=!1,this.ho=!1,this.ev=null,this.instance=t,this.tv=!!(null===(e=this.instance.persistence)||void 0===e?void 0:e.props[S]),this.rageclicks=new Eb(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return Se(this.Sr.capture_heatmaps)&&this.Sr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Sr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Me(this.Sr.capture_heatmaps)?Me(this.Sr.enable_heatmaps)?this.tv:this.Sr.enable_heatmaps:!1!==this.Sr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.ho)return;jw.info("starting..."),this.iv(),this.an()}else{var t;clearInterval(null!==(t=this.ev)&&void 0!==t?t:void 0),this.nv(),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({[S]:i}),this.tv=i,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}sv(t){Bw(t.originalEvent)&&this._r(t.originalEvent,"deadclick")}an(){this.ev&&clearInterval(this.ev),this.ev=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(n)?setInterval(this.oa.bind(this),this.flushIntervalMilliseconds):null}iv(){t&&n&&(this.rv=this.oa.bind(this),Us(t,Kt,this.rv),this.ov=e=>this._r(e||(null==t?void 0:t.event)),Us(n,"click",this.ov,{capture:!0}),this.lv=e=>this.av(e||(null==t?void 0:t.event)),Us(n,"mousemove",this.lv,{capture:!0}),this.uv=new e_(this.instance,Xb,this.sv.bind(this)),this.uv.startIfEnabledOrStop(),this.hv=this.an.bind(this),Us(n,Jt,this.hv),this.ho=!0)}nv(){var e;t&&n&&(this.rv&&t.removeEventListener(Kt,this.rv),this.ov&&n.removeEventListener("click",this.ov,{capture:!0}),this.lv&&n.removeEventListener("mousemove",this.lv,{capture:!0}),this.hv&&n.removeEventListener(Jt,this.hv),clearTimeout(this.dv),null===(e=this.uv)||void 0===e||e.stop(),this.ho=!1)}vv(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&&sr(s)&&!rr(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(fe(i,e))return!0;s=mr(s)}return!1}(vr(e),["fixed","sticky"],r);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:n),target_fixed:o,type:i}}_r(t,e="click"){var i;if(nr(t.target)||!Bw(t))return;const n=this.vv(t,e);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&$r(vr(t),this.instance.config.rageclick)&&this.Hs(le(le({},n),{},{type:"rageclick"})),this.Hs(n)}av(t){!nr(t.target)&&Bw(t)&&(clearTimeout(this.dv),this.dv=setTimeout(()=>{this.Hs(this.vv(t,"mousemove"))},500))}Hs(e){if(!t)return;const i=this.Sr.disable_capture_url_hashes?sn(t.location.href):t.location.href,n=this.Sr.custom_personal_data_properties,s=this.Sr.mask_personal_data_properties?[...da,...n||[]]:[],r=Ks(i,s,fa);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}oa(){this.Rt&&!xe(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:e_,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.tv=!1,this.ho=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.fv=()=>{clearTimeout(this.pv),this.pv=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",le({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,e)=>le(le({},t),{},{[`$web_vitals_${e.name}_event`]:le({},e),[`$web_vitals_${e.name}_value`]:e.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.gv=t=>{var e;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Me(null==t?void 0:t.name)||Me(null==t?void 0:t.value))return void Fw.error("Invalid metric received",t);const i="string"==typeof t.navigationURL?t.navigationURL:void 0,n=this.mv(i);if(Ce(n))return;const s=Ee(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${n}`;if(this.yv&&t.value>=this.yv)return void Fw.error("Ignoring metric with value >= "+this.yv,t);this.Rt.navigationKey!==s&&(this.fv(),this.pv=setTimeout(this.fv,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=le(le(le({},t),i?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete o.entries,Se(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const e={};for(const i of Nw){const n="url"===i&&"string"==typeof t.attribution[i]?this.mv(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.fv()},this.bv=()=>{if(this.ho)return;let t,e,i,n,s=!1;const r=d.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,l=(null==o?void 0:o[this._v])||("web-vitals"===this._v&&Ce(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!Ce(l)){const r=l.withoutAttribution,o=this.attributionMetrics;s=!Ce(r),t=o.indexOf("LCP")>-1?l.onLCP:(null==r?void 0:r.onLCP)||l.onLCP,e=o.indexOf("CLS")>-1?l.onCLS:(null==r?void 0:r.onCLS)||l.onCLS,i=o.indexOf("FCP")>-1?l.onFCP:(null==r?void 0:r.onFCP)||l.onFCP,n=o.indexOf("INP")>-1?l.onINP:(null==r?void 0:r.onINP)||l.onINP}if(!(t&&e&&i&&n))return void Fw.error("web vitals callbacks not loaded - not starting");const a={reportSoftNavs:this.useSoftNavs},u=s&&this.attributionMetrics.indexOf("INP")>-1?le(le({},a),{},{includeProcessedEventEntries:!1}):a;this.allowedMetrics.indexOf("LCP")>-1&&t(this.gv.bind(this),a),this.allowedMetrics.indexOf("CLS")>-1&&e(this.gv.bind(this),a),this.allowedMetrics.indexOf("FCP")>-1&&i(this.gv.bind(this),a),this.allowedMetrics.indexOf("INP")>-1&&n(this.gv.bind(this),u),this.ho=!0},this.tv=!!(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[I]),this.startIfEnabled()}get wv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const i=Se(this.wv)?null===(t=this.wv)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return Me(i)?(null===(e=this._instance.persistence)||void 0===e?void 0:e.props.$web_vitals_allowed_metrics)||Dw:i}get flushToCaptureTimeoutMs(){return(Se(this.wv)?this.wv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=Se(this.wv)?this.wv.web_vitals_attribution:void 0;return Re(t)?t?Dw:[]:we(t)?t:Lw}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=Se(this.wv)?this.wv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get yv(){const t=Se(this.wv)&&Ee(this.wv.__web_vitals_max_value)?this.wv.__web_vitals_max_value:Ow;return t>0&&6e4>=t?Ow:t}get isEnabled(){const t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Fw.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=Se(this.wv)?this.wv.web_vitals:Re(this.wv)?this.wv:void 0;return Re(e)?e:this.tv}startIfEnabled(){this.isEnabled&&!this.ho&&(Fw.info("enabled, starting..."),this.Eo(this.bv))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const i=Se(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Se(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[I]:i}),this._instance.persistence.register({[R]:n})),this.tv=i,this.startIfEnabled()}get _v(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Eo(t){var e;const i=d.__PosthogExtensions__,n=this._v,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==i||null===(e=i.loadExternalDependency)||void 0===e||e.call(i,this._instance,n,e=>{e?Fw.error("failed to load script",e):t()})}mv(e){const i=e||(null==t?void 0:t.location.href);if(!i)return void Fw.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?sn(i):i,s=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...da,...s||[]]:[];return Ks(n,r,fa)}}},Tk={exceptionObserver:class{constructor(e){var i;this.bv=()=>{var e;if(!t||!this.isEnabled||!(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions))return;const i=d.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=d.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=d.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Sv&&this.Sr.capture_unhandled_errors&&(this.Sv=i(this.captureException.bind(this))),!this.xv&&this.Sr.capture_unhandled_rejections&&(this.xv=n(this.captureException.bind(this))),!this.Cv&&this.Sr.capture_console_errors&&(this.Cv=s(this.captureException.bind(this)))}catch(t){Rw.error("failed to start",t),this.$v()}},this._instance=e,this.Tv=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[x]),this.wt=new Ge(le(le({},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,$:Rw})),this.Sr=this.Iv(),this.startIfEnabledOrStop()}Iv(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Se(t)?e=le(le({},e),t):(Ce(t)?this.Tv:t)&&(e=le(le({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Sr.capture_console_errors||this.Sr.capture_unhandled_errors||this.Sr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Rw.info("enabled"),this.$v(),this.Eo(this.bv)):this.$v()}Eo(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"exception-autocapture",e=>{if(e)return Rw.error("failed to load script",e);t()})}$v(){var t,e,i;null===(t=this.Sv)||void 0===t||t.call(this),this.Sv=void 0,null===(e=this.xv)||void 0===e||e.call(this),this.xv=void 0,null===(i=this.Cv)||void 0===i||i.call(this),this.Cv=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.Tv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[x]:this.Tv}),this.Sr=this.Iv(),this.startIfEnabledOrStop())}onConfigChange(){this.Sr=this.Iv()}captureException(t){try{var e,i,n;const s=null!==(e=null==t||null===(i=t.$exception_list)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.type)&&void 0!==e?e:"Exception";if(this.wt.consumeRateLimit(s))return void Rw.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.Mv=[],this.Ev=Tm(),this._instance=t,this.Mv=null!==(e=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==e?e:[],this.Pv=Wn(this.Rv()),this.Av=new Vn(this.Pv)}onConfigChange(){this.Pv=Wn(this.Rv()),this.Av.setConfig(this.Pv)}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.Mv=r,this._instance.persistence&&this._instance.persistence.register({[C]:this.Mv,[T]:o})}get Fv(){var t;const e=!!this._instance.get_property(T),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.Ev.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.Pv.enabled)try{if(!$e(t)||0===t.trim().length)return void km.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)=>zn.has(n)?(e.push(n),i):(i[n]=t[n],i),{}),droppedKeys:e}}(this.Ov(e));n.length>0&&km.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Av.add(le({[Bn]:t,[Hn]:(new Date).toISOString()},i))}catch(t){km.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.Dv(e)){if(this.Lv(e))return this.Nv("Exception dropped: matched a suppression rule"),void km.info("Skipping exception capture because a suppression rule matched");if(!this.Fv&&this.qv(e))return this.Nv("Exception dropped: thrown by a browser extension"),void km.info("Skipping exception capture because it was thrown by an extension");if(!this.Fv&&this.jv(e))return this.Nv("Exception dropped: thrown by an injected browser script"),void km.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Bv(e))return this.Nv("Exception dropped: thrown by the PostHog SDK"),void km.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this.Pv.enabled&&Me(t.$exception_steps)?this.Hv(t):t,n=function(){const t=globalThis._posthogReleaseId;return"string"==typeof t&&t.length>0?t:void 0}();n&&(i.$release_id=n);try{const t=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Gu:!0});return t&&this.Av.clear(),t}catch(t){return wm(t)||km.error("Failed to capture exception event. Dropping this exception.",t),void this.Av.clear()}}catch(t){return void(wm(t)||km.error("Failed to process exception event. Ignoring this exception.",t))}}Hv(t){try{const e=this.Av.getAttachable();return 0===e.length?t:le(le({},t),{},{$exception_steps:e})}catch(e){return km.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Nv(t){this.Pv.enabled&&this.Av.add({[Bn]:t,[Hn]:(new Date).toISOString()})}Ov(t){return Se(t)?le({},t):{}}Rv(){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:{}}Lv(t){if(0===t.length)return!1;try{const e=t.reduce((t,{type:e,value:i})=>($e(e)&&e.length>0&&t.$exception_types.push(e),$e(i)&&i.length>0&&t.$exception_values.push(i),t),{$exception_types:[],$exception_values:[]});return this.Mv.some(t=>{const i=t.values.map(t=>{const i=ia[t.operator],n=e[t.key];if(!i||!n)return!1;const s=we(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 km.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}qv(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&&Cm.some(e=>t.startsWith(e)));return 0!==i.length&&(!i.every(({filename:t})=>!!t&&t.startsWith(Sm))||t.some(({type:t,value:e})=>"NoResponse"===t||$e(e)&&xm.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(Sm))))}jv(t){return t.some(({value:t})=>$e(t)&&$m.some(e=>t.includes(e)))}Bv(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}Dv(t){return!Me(t)&&we(t)}}},Ik=le({productTours:class{get ga(){return this._instance.persistence}constructor(t){this.zv=null,this.Uv=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.ga&&this.ga.register({[E]:!!e.productTours}),!zw(this._instance))return!this.zv&&Me(null===(i=this.ga)||void 0===i?void 0:i.props.ph_product_tours)||Hw.info("product tours disabled; stopping and clearing cached tours"),null===(n=this.zv)||void 0===n||n.stop(),this.zv=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.zv&&zw(this._instance)&&this.Eo(()=>this.Wv())}Eo(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"product-tours",e=>{e?Hw.error("Could not load product tours script",e):t()})}Wv(){var t;!this.zv&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.zv=d.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(we(this.Uv)&&!e)return void t(this.Uv,{isLoaded:!0});const i=this.ga;if(i){const n=i.props[vt];if(we(n)&&!e)return this.Uv=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(!zw(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||Hw.warn(i):Hw.error(i),void t([],{isLoaded:!1,error:i})}const s=we(e.json.product_tours)?e.json.product_tours:[];this.Uv=s,i&&i.register({[vt]:s}),t(s,{isLoaded:!0})}})}getActiveProductTours(t){Me(this.zv)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.zv.getActiveProductTours(t)}showProductTour(t){var e;null===(e=this.zv)||void 0===e||e.showTourById(t)}previewTour(t){this.zv?this.zv.previewTour(t):this.Eo(()=>{var e;this.Wv(),null===(e=this.zv)||void 0===e||e.previewTour(t)})}dismissProductTour(){var t;null===(t=this.zv)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.zv)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.zv)||void 0===t||t.previousStep()}clearCache(){var t;this.Uv=null,null===(t=this.ga)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var e;null===(e=this.zv)||void 0===e||e.resetTour(t)}resetAllTours(){var t;null===(t=this.zv)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var e;null===(e=this.zv)||void 0===e||e.cancelPendingTour(t)}}},xk),Mk={siteApps:class{constructor(t){this._instance=t,this.Vv=0,this.Gv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Zv(t,e){if(!e)return;const i=this.globalsForEvent(e);this.Gv.push(i),this.Gv.length>1e3&&(this.Gv=this.Gv.slice(10))}get siteAppLoaders(){var t;return null===(t=d._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.Zv.bind(this));this.Qv=()=>{t(),this.Gv=[],this.Qv=void 0}}}globalsForEvent(t){var e,i,n,s,r,o,l;if(!t)throw new Error("Event payload is required");const a={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(const[t,e]of Object.entries(h))a[t]={id:u[t],type:t,properties:e};const{$set_once:c,$set:d}=t;return{event:le(le({},us(t,Uw)),{},{properties:le(le(le({},t.properties),d?{$set:le(le({},null!==(e=null===(i=t.properties)||void 0===i?void 0:i.$set)&&void 0!==e?e:{}),d)}:{}),c?{$set_once:le(le({},null!==(n=null===(s=t.properties)||void 0===s?void 0:s.$set_once)&&void 0!==n?n:{}),c)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(l=t.properties)||void 0===l?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:a}}Jv(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)||(Ww.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)||(Ww.error("prepare_external_dependency_script returned null"),null)}return t}Kv(){var t,e,i,s,r,o,l,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const u=null==n?void 0:n.defaultView,h=null==u||null===(t=u.Node)||void 0===t?void 0:t.prototype;if(!u||!h)return()=>{};if(this.Vv++,this.Yv)return this.Xv();const c=[],d=this,v=new WeakSet,f=(t,e,i)=>{if(!(null==t?void 0:t[e]))return;const n=t[e];t[e]=i(n),c.push(()=>{t[e]=n})},p=t=>{if(v.has(t))return t;const e=d.Jv(t);return e&&v.add(e),e},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!Ie(t));return f(h,"appendChild",t=>function(e){const i=p(e);return i?t.call(this,i):e}),f(h,"insertBefore",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):e}),f(h,"replaceChild",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):i}),[null===(e=u.Element)||void 0===e?void 0:e.prototype,null===(i=u.Document)||void 0===i?void 0:i.prototype,null===(s=u.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(t=>{f(t,"append",t=>function(...e){return t.apply(this,g(e))}),f(t,"prepend",t=>function(...e){return t.apply(this,g(e))})}),[null===(r=u.Element)||void 0===r?void 0:r.prototype,null===(o=u.CharacterData)||void 0===o?void 0:o.prototype,null===(l=u.DocumentType)||void 0===l?void 0:l.prototype].forEach(t=>{f(t,"before",t=>function(...e){return t.apply(this,g(e))}),f(t,"after",t=>function(...e){return t.apply(this,g(e))}),f(t,"replaceWith",t=>function(...e){const i=g(e);return e.length&&!i.length?void 0:t.apply(this,i)})}),f(null===(a=u.Element)||void 0===a?void 0:a.prototype,"insertAdjacentElement",t=>function(e,i){const n=p(i);return n?t.call(this,e,n):null}),this.Yv=()=>{c.forEach(t=>t()),this.Yv=void 0},this.Xv()}Xv(){let t=!1;return()=>{var e;t||(t=!0,this.Vv--,0===this.Vv&&(null===(e=this.Yv)||void 0===e||e.call(this)))}}tf(t,e=!0){const i=this.Kv();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.Gv.length&&(Ww.info(`Processing ${this.Gv.length} events for site app with id ${t.id}`),this.Gv.forEach(t=>this.tf(()=>{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.Qv)||void 0===i||i.call(this))};let n=!1;const s=s=>{e.errored=!s,e.loaded=!0,Ww.info(`Site app with id ${t.id} ${s?"loaded":"errored"}`),n&&i()};try{const{processEvent:i}=this.tf(e=>t.init({posthog:this._instance,callback(t){e(),s(t)}}),!1);i&&(e.processEvent=i),n=!0}catch(e){Ww.error(Vw+t.id,e),s(!1)}if(n&&e.loaded)try{i()}catch(i){Ww.error(`Error while processing buffered events PostHog app with config id ${t.id}`,i),e.errored=!0}}ef(){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)}if(t){if(0===Object.keys(this.apps).length)return;const e=this.globalsForEvent(t);for(const i of Object.values(this.apps))try{this.tf(()=>{var t;return null===(t=i.processEvent)||void 0===t?void 0:t.call(i,e)})}catch(e){Ww.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.ef(),void this._instance.on("eventCaptured",t=>this.if(t))):void Ww.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this.Qv)||void 0===i||i.call(this),!t.ok)return;const s=t.config;if(null===(n=s.siteApps)||void 0===n?void 0:n.length)if(this.isEnabled)for(const{id:t,url:e}of s.siteApps){var r,o;d[`__$$ph_site_app_${t}`]=this._instance,null===(r=d.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,e,e=>{if(e)return Ww.error(Vw+t,e)})}else Ww.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Ek={tracingHeaders:class{constructor(t){this._instance=t,this.nf=void 0,this.sf=void 0,this.rf=void 0,this.bv=()=>{const t=this.lf();var e,i;t?(Ce(this.nf)&&(this.nf=null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Ce(this.sf)&&(this.sf=null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.$v()}}initialize(){this.startIfEnabledOrStop()}Eo(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.tracingHeadersPatchFns)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"tracing-headers",e=>{if(e)return Aw.error("failed to load script",e);t()})}af(){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}lf(){const t=this.af();return we(t)?(we(this.rf)?this.rf.splice(0,this.rf.length,...t):this.rf=[...t],t.length>0?this.rf:void 0):(we(this.rf)&&this.rf.splice(0),this.rf=t||void 0,this.rf)}$v(){var t,e;null===(t=this.nf)||void 0===t||t.call(this),null===(e=this.sf)||void 0===e||e.call(this),this.nf=void 0,this.sf=void 0}startIfEnabledOrStop(){this.lf()?this.Eo(this.bv):this.$v()}}},Pk=le({surveys:class extends Jw{constructor(t){var e;super(new ik(t),(e=t,{get projectToken(){return e.config.token},kv:new ek(e)})),this._instance=t}wh(t,e){const i=e.query?P_(t,e.query):t;return new Promise(t=>{var n;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor(null!==(n=e.target)&&void 0!==n?n:"api",i),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:t})})}}},xk),Rk={toolbar:class{constructor(t){this.instance=t}uf(t){d.ph_toolbar_state=t}hf(){var t;return null!==(t=d.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,i=void 0,s=void 0){var r,o;if(Ws(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=nk||Ys(e.hash,"__posthog")||Ys(e.hash,"state");let r;const o=n?Ns(()=>JSON.parse(atob(decodeURIComponent(n))))||Ns(()=>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(sk)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}cf(t){const e=d.ph_load_toolbar||d.ph_load_editor;!Me(e)&&ke(e)?e(t,this.instance):rk.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=le(le({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(sk,JSON.stringify(le(le({},r),{},{source:void 0}))),2===this.hf())this.cf(r);else if(0===this.hf()){var o,l;this.uf(1),null===(o=d.__PosthogExtensions__)||void 0===o||null===(l=o.loadExternalDependency)||void 0===l||l.call(o,this.instance,"toolbar",t=>{if(t)return rk.error("[Toolbar] Failed to load",t),void this.uf(0);this.uf(2),this.cf(r)}),Us(t,"turbolinks:load",()=>{this.uf(0),this.loadToolbar(r)})}return!0}df(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,i=void 0){return this.maybeLoadToolbar(t,e,i)}}},Ak=le({experiments:class e{get Sr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.vf("retrieved web experiments from the server"),this.ff=new Map,t.forEach(t=>{if(t.feature_flag_key){var i;this.ff&&(e.vf("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=this.ff)||void 0===i||i.set(t.feature_flag_key,t));const n=this._instance.getFeatureFlag(t.feature_flag_key);$e(n)&&t.variants[n]&&this.pf(t.name,n,t.variants[n].transforms)}else if(t.variants)for(const i in t.variants){const n=t.variants[i];e.gf(n,this._instance)&&this.pf(t.name,i,n.transforms)}})},t)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.vf(fk);else if(!this.Sr.disable_web_experiments){if(Me(this.ff))return this.ff=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.vf("applying feature flags",t),t.forEach(t=>{var e;if(this.ff&&(null===(e=this.ff)||void 0===e?void 0:e.has(t))){var i;const e=this._instance.getFeatureFlag(t),n=null===(i=this.ff)||void 0===i?void 0:i.get(t);e&&(null==n?void 0:n.variants[e])&&this.pf(n.name,e,n.variants[e].transforms)}})}}previewWebExperiment(){const t=e.getWindowLocation();if(null==t?void 0:t.search){const i=Js(null==t?void 0:t.search,"__experiment_id"),n=Js(null==t?void 0:t.search,"__experiment_variant");i&&n&&(e.vf(`previewing web experiments ${i} && ${n}`),this.getWebExperiments(t=>{this.mf(parseInt(i),n,t)},!1,!0))}}loadIfEnabled(){this.Sr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Sr.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.Sr.token}`),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}mf(t,i,n){const s=n.filter(e=>e.id===t);s&&s.length>0&&(e.vf(`Previewing web experiment [${s[0].name}] with variant [${i}]`),this.pf(s[0].name,i,s[0].variants[i].transforms))}static gf(t,i){return!Me(t.conditions)&&e.yf(t,i)&&e.bf(t)}static yf(t,i){var n;if(Me(t.conditions)||Me(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=er(i,s.href);return!(null===(r=t.conditions)||void 0===r?void 0:r.url)||pk[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 bf(t){var e;if(Me(t.conditions)||Me(null===(e=t.conditions)||void 0===e?void 0:e.utm))return!0;const i=ga();if(i.utm_source){var n,s,r,o,l,a,u,h;const e=!(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)||(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)==i.utm_campaign,c=!(null===(r=t.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=t.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==i.utm_source,d=!(null===(l=t.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)||(null===(a=t.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)==i.utm_medium,v=!(null===(u=t.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)||(null===(h=t.conditions)||void 0===h||null===(h=h.utm)||void 0===h?void 0:h.utm_term)==i.utm_term;return e&&d&&v&&c}return!1}static vf(t,...e){Rs.info(`[WebExperiments] ${t}`,e)}pf(t,i,n){this._is_bot()?e.vf(fk):"control"!==i?n.forEach(n=>{if(n.selector){var s;e.vf(`applying transform of variant ${i} for experiment ${t} `,n);const r=null===(s=document)||void 0===s?void 0:s.querySelectorAll(n.selector);null==r||r.forEach(t=>{const e=t;n.html&&(e.innerHTML=n.html),n.css&&e.setAttribute("style",n.css)})}}):e.vf("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?X_(i,this.Sr.custom_blocked_useragents):void 0}}},xk),Fk={conversations:class{constructor(t){this._instance=t,this._f=void 0,this._conversationsManager=null,this.wf=!1,this.ne=null,this.kf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return;if(this.Sf=t.ok,!t.ok)return;const e=t.config.conversations;Me(e)||(Re(e)?this._f=e:(this._f=e.enabled,this.ne=e),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this._f=void 0,this.ne=null,this.Sf=void 0,this.kf=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this.wf)return;if(this._instance.config.disable_conversations)return;if(Ws(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==d?void 0:d.__PosthogExtensions__;if(t&&!Ce(this._f)&&this._f)if(this.ne&&this.ne.token){this.wf=!0;try{const e=t.initConversations;if(e)return this.xf(e),void(this.wf=!1);const i=t.loadExternalDependency;if(!i)return void this.Cf(Vt);i(this._instance,"conversations",e=>{e||!t.initConversations?this.Cf("Could not load conversations script",e):this.xf(t.initConversations),this.wf=!1})}catch(t){this.Cf("Error initializing conversations",t),this.wf=!1}}else gk.error("Conversations enabled but missing token in remote config.")}xf(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.kf=!1,gk.info("Conversations loaded successfully")}catch(t){this.Cf("Error completing conversations initialization",t)}else gk.error("Cannot complete initialization: remote config is null")}Cf(t,e){gk.error(t,e),this._conversationsManager=null,this.wf=!1,this.kf=!0}show(){this._conversationsManager?this._conversationsManager.show():gk.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._f&&!Ie(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Ws(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Sf?"remote_config_failed":Ce(this._f)?this.Sf?"disabled_in_project":"remote_config_pending":this._f?Me(this.ne)||!this.ne.token?"missing_token":(null==d?void 0:d.__PosthogExtensions__)?this.wf?"initializing":this.kf?"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 ne(function*(){return n._conversationsManager?n._conversationsManager.sendMessage(t,e,i):(gk.warn(mk),null)})()}getMessages(t,e){var i=this;return ne(function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(gk.warn(mk),null)})()}markAsRead(t){var e=this;return ne(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(gk.warn(mk),null)})()}getTickets(t){var e=this;return ne(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(gk.warn(mk),null)})()}requestRestoreLink(t){var e=this;return ne(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(gk.warn(mk),null)})()}restoreFromToken(t){var e=this;return ne(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(gk.warn(mk),null)})()}restoreFromUrlToken(){var t=this;return ne(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(gk.warn(mk),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}ih(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}nh(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}}},Ok={logs:class{constructor(e){var i;this._instance=e,this.name=qp,this.$f=!1,this.Tf=!1,this.If=!1,this.$=As("[logs]"),this.Mf=le(le({},this.$),{},{error:(...t)=>{t.some(Sk)||this.$.error(...t)}}),this.Zl=[],this.Ef=[],this.Wc=0,this.fo=!1,this.Pf=[],this.Rf=[],this.Af=!1,this.Ff=!1,this.Of=()=>{var t,e;this.fo||(this.Wc=0,null===(t=this.Df)||void 0===t||t.onReconnect(),null===(e=this.Lf)||void 0===e||e.onReconnect())},this._instance&&(null===(i=this._instance.config.logs)||void 0===i?void 0:i.captureConsoleLogs)&&(this.$f=!0),t&&Us(t,"online",this.Of)}Nf(t,e,i,n){var s;const r=yk(null===(s=this._instance)||void 0===s||null===(s=s.config)||void 0===s?void 0:s.logs,i);return[new Ss(this.qf(t,e),r,this.Mf,()=>this.jf(),t=>t(),void 0,n),r]}Bf(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs;var i;return this.Df&&this.Hf===e||(null===(i=this.Df)||void 0===i||i.reset(),this.Hf=e,[this.Df,this.zf]=this.Nf(()=>this.Zl,t=>{this.Zl=t})),this.Df}Uf(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs;var i;return this.Lf&&this.Wf===e||(null===(i=this.Lf)||void 0===i||i.reset(),this.Wf=e,[this.Lf,this.Vf]=this.Nf(()=>this.Ef,t=>{this.Ef=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},_k)),this.Lf}setup(t){var e;if(this.fo)return;this.lo=t,(null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.logs)||void 0===e?void 0:e.captureConsoleLogs)&&(this.$f=!0),(this.$f||this.Gf()&&this.Zf())&&this.Qf();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.fo?n.dispose():(this.yo=n,i||this.loadIfEnabled())}dispose(){var e,i,n,s;this.fo||(this.fo=!0,this.Jf(),null===(e=this.yo)||void 0===e||e.dispose(),this.yo=void 0,this.lo=void 0,this.If=!1,null==t||t.removeEventListener("online",this.Of),null===(i=this.Kf)||void 0===i||i.call(this),this.Kf=void 0,null===(n=this.Df)||void 0===n||n.reset(),null===(s=this.Lf)||void 0===s||s.reset())}onRemoteConfig(t){var e,i;if(this.fo)return;const n=t.ok?null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs:void 0;Me(n)?this.Yf():(null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$logs_capture_enabled_server_side:!!n}),n?(this.$f=!0,this.Tf||this.Qf(),this.loadIfEnabled()):this.Yf())}reset(){var t,e,i,n;this.Jf(),null===(t=this.Df)||void 0===t||t.clearQueue(),this.Zl=[],null===(e=this.Df)||void 0===e||e.reset(),null===(i=this.Lf)||void 0===i||i.clearQueue(),this.Ef=[],null===(n=this.Lf)||void 0===n||n.reset(),this.Wc=0}captureLog(t){this.fo||this.Bf().captureLog(t)}captureConsoleLog(t){this.fo||this.Uf().captureLog(t)}captureBufferedConsoleLog(t,e,i){this.fo||this.Uf().captureLog(t,{context:e,occurredAtMs:i})}Zf(){var t;return!!(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t[P])}Gf(){var t,e,i;return!(null===(t=this._instance)||void 0===t||null===(e=t.Ul)||void 0===e?void 0:e.call(t))||!!(null===(i=d._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[this._instance.config.token])||void 0===i?void 0:i.config)}rh(){var t;this.Jf(),null===(t=this.Lf)||void 0===t||t.clearQueue(),this.Ef=[]}Yf(){this.$f||this.Jf()}Qf(){var t;if(this.Af||!(null==d?void 0:d.console))return;const e=yk(null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs).maxBufferSize;for(const t of bk){let i;try{i=am(d.console[t])}catch(t){continue}i&&this.Rf.push(av(d.console,t,n=>{const s=(...i)=>{try{this.Xf(t,i,e)}catch(t){}return n.apply(d.console,i)};return s.__rrweb_original__=i,s}))}this.Af=!0,this.tp=setTimeout(()=>{this.Jf()},3e4)}Xf(t,e,i){var n;if(this.Af&&!this.Ff&&0!==e.length)if(null===(n=this._instance)||void 0===n?void 0:n.is_capturing()){if(i>this.Pf.length){this.Ff=!0;try{this.Pf.push({level:t,args:e,occurredAtMs:Date.now(),context:this.jf()})}finally{this.Ff=!1}}}else this.Jf()}Jf(){if(this.Pf=[],this.Af){this.Af=!1,this.tp&&(clearTimeout(this.tp),this.tp=void 0);for(const t of this.Rf)t();this.Rf=[]}}ep(){const t=this.Pf;return this.Jf(),t}get logger(){return this.np||(this.np={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.np}flushLogs(t){t?this.sp(t):(this.Df&&this.Df.flush().catch(t=>this.rp(t)),this.Lf&&this.Lf.flush().catch(t=>this.rp(t)))}rp(t){Sk(t)||this.$.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.fo||!this.$f||this.Tf||this.If)return;const t=null==d?void 0:d.__PosthogExtensions__;if(!t)return this.$.error("PostHog Extensions not found."),void this.Jf();const e=t.loadExternalDependency;if(!e)return this.$.error(Vt),void this.Jf();this.If=!0;try{e(this._instance,"logs",e=>{if(this.If=!1,this.fo||!this.$f)return;const i=t.logs;if(e||!(null==i?void 0:i.initializeLogs))this.$.error("Could not load logs script",e),this.Jf();else{var n;const t=this.ep();var s,r;this.Kf=i.initializeLogs(null!==(n=this.lo)&&void 0!==n?n:this._instance),this.Tf=!0,t.length>0&&(null===(s=i.replayConsoleBuffer)||void 0===s||s.call(i,null!==(r=this.lo)&&void 0!==r?r:this._instance,t))}})}catch(t){throw this.If=!1,t}}qf(t,e){const i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===ae.LogsQueue?t():void 0,setPersistedProperty(t,i){var n;t===ae.LogsQueue&&e(null!==(n=i)&&void 0!==n?n:[])},Ps:t=>this.Ps(t),getLibraryId:()=>ql.LIB_NAME,getLibraryVersion:()=>ql.LIB_VERSION}}Ps(t){return new Promise(e=>{if(Xs(this.Wc,3))return void e({kind:"fatal",error:kk(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const n=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),n({kind:"retry-later",error:kk(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.op(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{const e=t.statusCode;if(this.lp(e),e>=200&&300>e)n({kind:"ok"});else if(413===e)n({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)n({kind:"fatal",error:new Error(`logs request failed with status ${e}`)});else{var i;0===e?(t.error||this.$.warn("Logs request failed before receiving an HTTP response"),n({kind:"retry-later",error:kk(t.error,"logs request failed before receiving an HTTP response")})):n({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`logs request failed with status ${e}`)})}}})})}lp(t){(0!==t||this._instance.__loaded)&&(this.Wc=tr(t,this.Wc,3,()=>this.$.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}sp(t){this.Zl.length>0&&this.ap(t,this.Zl,this.zf,ql.LIB_NAME,t=>{this.Zl=t}),this.Ef.length>0&&this.ap(t,this.Ef,this.Vf,_k,t=>{this.Ef=t})}ap(t,e,i,n,s){if(0===e.length)return;const r=e.map(t=>t.record);s([]);const o=ks(r,ws(i,ql.LIB_NAME,ql.LIB_VERSION),n,ql.LIB_VERSION);this._instance._send_request({method:"POST",url:this.op(),data:o,compression:"best-available",batchKey:"logs",transport:t})}op(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}jf(){var t;const e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:t,windowId:i,sessionStartTimestamp:n,lastActivityTimestamp:s}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=t,e.windowId=i,Me(n)||(e.sessionStartTimestamp=n),Me(s)||(e.lastActivityTimestamp=s)}if((null==d||null===(t=d.location)||void 0===t?void 0:t.href)&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?sn(d.location.href):d.location.href),this._instance.featureFlags){const t=this._instance.featureFlags.getFlags();t&&t.length>0&&(e.activeFeatureFlags=t)}return e}}},Dk={metrics:class{constructor(t){this._instance=t,this.$=As("[metrics]")}initialize(){}Bf(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;var i;return this.Df&&this.Hf===e||(null===(i=this.Df)||void 0===i||i.reset(),this.Hf=e,this.Df=new Ts(this.qf(),function(t){var e,i,n,s,r;const o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(e=null==o?void 0:o["service.name"])&&void 0!==e?e:null==t?void 0:t.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==t?void 0:t.serviceVersion,environment:null!==(n=null==o?void 0:o["deployment.environment"])&&void 0!==n?n:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(r=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(e),this.$)),this.Df}count(t,e=1,i){this.Bf().count(t,e,i)}gauge(t,e,i){this.Bf().gauge(t,e,i)}histogram(t,e,i){this.Bf().histogram(t,e,i)}flush(t){if(!this.Df)return Promise.resolve();if(t){const e=this.Df.drainWindow();return e&&this.Gs(e,t),Promise.resolve()}return this.Df.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.Df)||void 0===t||t.reset()}qf(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Gs:t=>e.Gs(t),getLibraryId:()=>ql.LIB_NAME,getLibraryVersion:()=>ql.LIB_VERSION}}Gs(t,e){return new Promise(i=>{let n=!1;const s=t=>{n||(n=!0,clearTimeout(r),i(t))},r=setTimeout(()=>s({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(le(le({method:"POST",url:this.up(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e}),{},{fireCallbackOnDrop:!0,callback(t){const e=t.statusCode;if(e>=200&&300>e)s({kind:"ok"});else if(413===e)s({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)s({kind:"fatal",error:new Error(`metrics request failed with status ${e}`)});else{var i;s({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`metrics request failed with status ${e}`)})}}}))})}up(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};Ew.__defaultExtensionClasses=le({},le(le(le(le(le(le(le(le(le(le(le(le(le({},xk),Ck),$k),Tk),Ik),Mk),Pk),Ek),Rk),Ak),Fk),Ok),Dk)),function(){ql.SDK_DIST_CHANNEL="cdn";const e=d.posthog;if(e&&!we(e._i))return;const i=vw[Sw]=new Ew;if(e){const t=[];Os(e._i,function(n){if(n&&we(n)){const s=i.init(n[0],n[1],n[2]),r=e[n[2]]||e;s.__loaded&&-1===t.indexOf(r)&&(t.push(r),s._execute_array.call(s.people,r.people),s._execute_array(r))}})}i.__SV=1,d.posthog=i,function(){function e(){e.done||(e.done=!0,xw=!1,Os(vw,function(t){t._dom_loaded()}))}(null==n?void 0:n.addEventListener)?"complete"===n.readyState?e():Us(n,"DOMContentLoaded",e,{capture:!1}):t&&Rs.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}()}();
1
+ !function(){const t="u">typeof window?window:void 0,e="u">typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,n=null==e?void 0:e.document,s=null==e?void 0:e.location,r=null==e?void 0:e.fetch,o=(null==e?void 0:e.XMLHttpRequest)&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,l=null==e?void 0:e.AbortController,a=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent;function h(){return!(!t||!1===t.navigator.onLine)}const c="undefined"!=typeof globalThis?globalThis:t;c&&"undefined"==typeof self&&(c.self=c),c&&"undefined"==typeof File&&(c.File=function(){});const d=null!=t?t:{},v="$people_distinct_id",f="distinct_id",p="$device_id",g="$device_model",m="__alias",y="__cmpns",b="$fbc",_="$fbc_persistence",w="__timers",k="$autocapture_disabled_server_side",S="$heatmaps_enabled_server_side",x="$exception_capture_enabled_server_side",C="$error_tracking_suppression_rules",T="$error_tracking_capture_extension_exceptions",I="$web_vitals_enabled_server_side",M="$dead_clicks_enabled_server_side",E="$product_tours_enabled_server_side",P="$logs_capture_enabled_server_side",R="$web_vitals_allowed_metrics",A="$session_recording_remote_config",F="$session_recording_enabled_server_side",O="$replay_sample_rate",D="$replay_override_sampling",L="$replay_override_linked_flag",N="$replay_override_url_trigger",q="$replay_override_event_trigger",j="$sesid",B="$session_is_sampled",H="$session_past_minimum_duration",z="$session_recording_url_trigger_activated_session",U="$session_recording_event_trigger_activated_session",W="$posthog_sr_group_event_trigger_",V="$posthog_sr_group_url_trigger_",G="$posthog_sr_group_sampling_",Z="$debug_first_full_snapshot_timestamp",Q="$sess_rec_flush_size",J="$enabled_feature_flags",K="$active_feature_flags",Y="$early_access_features",X="$feature_flag_details",tt="$feature_flag_payloads",et="$feature_flag_request_id",it="$minimal_flag_called_events",nt="$override_feature_flags",st="$override_feature_flag_payloads",rt="$stored_person_properties",ot="$stored_group_properties",lt="$groups",at="$surveys",ut="$surveys_loaded_at",ht="$surveys_activated",ct="$surveys_activated_session",dt="$surveys_activated_timestamps",vt="ph_product_tours",ft="$product_tours_activated",pt="$product_tours_activated_session",gt="$conversations_widget_session_id",mt="$conversations_ticket_id",yt="$conversations_widget_state",bt="$conversations_user_traits",_t="$flag_call_reported",wt="$flag_call_reported_session_id",kt="$feature_flag_errors",St="$feature_flag_evaluated_at",xt="$user_state",Ct="$client_session_props",$t="$capture_rate_limit",Tt="$initial_campaign_params",It="$initial_referrer_info",Mt="$initial_person_info",Et="$epp",Pt="$posthog_cookieless",Rt="$cookieless_mode",At="$sdk_debug_extensions_init_method",Ft="$sdk_debug_extensions_init_time_ms",Ot="$sdk_debug_recording_script_not_loaded",Dt="$sdk_debug_replay_event_trigger_status",Lt="$sdk_debug_replay_linked_flag_trigger_status",Nt="$sdk_debug_replay_matched_recording_trigger_groups",qt="$sdk_debug_replay_pending_trigger_conditions",jt="$sdk_debug_replay_remote_trigger_matching_config",Bt="$sdk_debug_replay_trigger_groups_count",Ht="$sdk_debug_replay_url_trigger_status",zt="$sdk_debug_rrweb_attached",Ut="$sdk_debug_rrweb_start_attempted",Wt="$session_recording_start_reason",Vt="PostHog loadExternalDependency extension not found.",Gt="anonymous",Zt="identified",Qt="identified_only",Jt="visibilitychange",Kt="beforeunload",Yt="$pageview",Xt="$pageleave",te="$identify",ee="$groupidentify";function ie(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 ne(t){return function(){var e=this,i=arguments;return new Promise(function(n,s){var r=t.apply(e,i);function o(t){ie(r,n,s,o,l,"next",t)}function l(t){ie(r,n,s,o,l,"throw",t)}o(void 0)})}}function se(t){return se="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},se(t)}function re(t,e,i){return(e=function(t){var e=function(t){if("object"!=se(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=se(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==se(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function oe(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 le(t){for(var e=1;arguments.length>e;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?oe(Object(i),!0).forEach(function(e){re(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):oe(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}var ae=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),ue=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const he="min_length",ce="max_length",de=["$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"],ve=["token"];function fe(t,e){return-1!==t.indexOf(e)}const pe=function(t){return t.trim()},ge=function(t){return t.replace(/^\$/,"")};function me(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 ye=Object.prototype,be=ye.hasOwnProperty,_e=ye.toString,we=Array.isArray||function(t){return"[object Array]"===_e.call(t)},ke=t=>"function"==typeof t,Se=t=>t===Object(t)&&!we(t),xe=t=>{if(Se(t)){for(const e in t)if(be.call(t,e))return!1;return!0}return!1},Ce=t=>void 0===t,$e=t=>"[object String]"==_e.call(t),Te=t=>$e(t)&&0===t.trim().length,Ie=t=>null===t,Me=t=>Ce(t)||Ie(t),Ee=t=>"[object Number]"==_e.call(t)&&t==t,Pe=t=>Ee(t)&&t>0,Re=t=>"[object Boolean]"===_e.call(t),Ae=t=>t instanceof FormData,Fe=t=>fe(de,t),Oe=t=>fe(ve,t);function De(t){return null===t||"object"!=typeof t}function Le(t,e){return{}.toString.call(t)===`[object ${e}]`}function Ne(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 je(t,Error)}}function qe(t){return"u">typeof Event&&je(t,Event)}function je(t,e){try{return t instanceof e}catch(t){return!1}}const Be=[!0,"true",1,"1","yes"],He=t=>fe(Be,t),ze=[!1,"false",0,"0","no"],Ue=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],We=function(t,e=[]){if(!t)return!1;const i=t.toLowerCase();return Ue.concat(e).some(t=>{const e=t.toLowerCase();return-1!==i.indexOf(e)})};function Ve(t,e,i,n,s){return e>i&&(n.warn("min cannot be greater than max."),e=i),Ee(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),Ve(null!=s?s:i,e,i,n))}var Ge=class{constructor(t){this.C={},this.I=t.I,this.R=Ve(t.bucketSize,0,100,t.$),this.A=Ve(t.refillRate,0,this.R,t.$),this.O=Ve(t.refillInterval,0,864e5,t.$)}F(t,e){const i=Math.floor((e-t.lastAccess)/this.O);i>0&&(t.tokens=Math.min(t.tokens+i*this.A,this.R),t.lastAccess=t.lastAccess+i*this.O)}consumeRateLimit(t){var e;const i=Date.now(),n=String(t);let s=this.C[n];return s?this.F(s,i):(s={tokens:this.R,lastAccess:i},this.C[n]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null===(e=this.I)||void 0===e||e.call(this,t)),0===s.tokens)}stop(){this.C={}}};const Ze="Mobile",Qe="Android",Je="Tablet",Ke="Android Tablet",Ye="iPad",Xe="Apple Watch",ti="Safari",ei="BlackBerry",ii="Samsung Internet",ni="Chrome",si="Chrome iOS",ri="Internet Explorer",oi="Internet Explorer Mobile",li="Opera",ai="Microsoft Edge",ui="Firefox",hi="Firefox iOS",ci="Nintendo",di="PlayStation",vi="Xbox",fi="Android Mobile",pi="Mobile Safari",gi="Windows",mi="Windows Phone",yi="Nokia",bi="Ouya",_i="Generic "+Ze.toLowerCase(),wi="Generic "+Je.toLowerCase(),ki="Konqueror",Si="Oculus Browser",xi="Vivaldi",Ci="Yandex",$i="Whale",Ti="DuckDuckGo",Ii="Pale Moon",Mi="Waterfox",Ei="Brave",Pi="Claude",Ri="Codex",Ai="ChatGPT",Fi="Google Search App",Oi=new RegExp("Version/(\\d+(\\.\\d+)?)"),Di=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Li=new RegExp(vi,"i"),Ni=new RegExp("PlayStation \\w+","i"),qi=new RegExp("Nintendo \\w+","i"),ji=new RegExp("BlackBerry|PlayBook|BB10","i"),Bi={"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)?Ei:null}(i);return s||((null==n?void 0:n.detectGoogleSearchApp)&&fe(t,"GSA/")?Fi:fe(t," OPR/")&&fe(t,"Mini")?"Opera Mini":fe(t," OPR/")?li:ji.test(t)?ei:fe(t,"IEMobile")||fe(t,"WPDesktop")?oi:fe(t,"OculusBrowser")?Si:fe(t,"SamsungBrowser")?ii:fe(t,"Edge")||fe(t,"Edg/")?ai:fe(t,"Vivaldi/")?xi:fe(t,"YaBrowser/")?Ci:fe(t,"Whale/")?$i:fe(t,"DuckDuckGo/")||fe(t,"Ddg/")?Ti:fe(t,"Claude/")?Pi:fe(t,"Codex/")?Ri:fe(t,"ChatGPT/")?Ai:fe(t,"FBIOS")?"Facebook Mobile":fe(t,"UCWEB")||fe(t,"UCBrowser")?"UC Browser":fe(t,"CriOS")?si:fe(t,"CrMo")||fe(t,ni)?ni:fe(t,Qe)&&fe(t,ti)?fi:fe(t,"FxiOS")?hi:fe(t.toLowerCase(),ki.toLowerCase())?ki:fe(t,"Brave/")?Ei:((t,e)=>e&&fe(e,"Apple")||function(t){return fe(t,ti)&&!fe(t,ni)&&!fe(t,Qe)}(t))(t,e)?fe(t,Ze)?pi:ti:fe(t,"PaleMoon/")?Ii:fe(t,"Waterfox/")?Mi:fe(t,ui)?ui:fe(t,"MSIE")||fe(t,"Trident/")?ri:fe(t,"Gecko")?ui:"")},zi={[oi]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[ai]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[ni]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[si]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[ti]:[Oi],[pi]:[Oi],[li]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ui]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[hi]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[ki]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ei]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Oi],[fi]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ii]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Si]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[xi]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ci]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[$i]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ei]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Pi]:[Di],[Ri]:[Di],[Ai]:[Di],[Ti]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Mi]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Fi]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ri]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Ui=function(t,e,i,n){const s=Hi(t,e,i,n),r=zi[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},Wi=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[vi,t&&t[1]||""]],[new RegExp(ci,"i"),[ci,""]],[new RegExp(di,"i"),[di,""]],[ji,[ei,""]],[new RegExp(gi,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[mi,""];if(new RegExp(Ze).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){let t=Bi[i[1]]||"";return/arm/i.test(e)&&(t="RT"),[gi,t]}return[gi,""]}],[/((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]?[Qe,[t[2],t[3],t[4]||"0"].join(".")]:[Qe,""]],[/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",""]]],Vi=function(t){for(let e=0;Wi.length>e;e++){const[i,n]=Wi[e],s=i.exec(t),r=s&&(ke(n)?n(s,t):n);if(r)return r}return["",""]},Gi=function(t){return qi.test(t)?ci:Ni.test(t)?di:Li.test(t)?vi:new RegExp(bi,"i").test(t)?bi:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?mi:/iPad/.test(t)?Ye:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Xe:ji.test(t)?ei:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(yi,"i").test(t)?yi:/(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(Ze).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)?Qe:Ke:new RegExp("(pda|Mobile)","i").test(t)?_i:new RegExp(Je,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?wi:""},Zi=function(t,e){var i;const n=Gi(t);return n===Ye||n===Ke||"Kobo"===n||"Kindle Fire"===n||n===wi?Je:n===ci||n===vi||n===di||n===bi?"Console":n===Xe?"Wearable":n?Ze:"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)?Ze:Je:"Desktop";var s,r,o},Qi=/\bFBAV\/(\d+(?:\.\d+)*)/i,Ji=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Qi],[/\bFBAN\/EMA\b/i,"Facebook Lite",Qi],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Qi],[/\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"]],Ki="[Truncated]",Yi="[Unserializable]";function Xi(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}Date,Date;const tn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function en(t,e){return"string"==typeof(i=t)&&tn.test(i)?t:e();var i}function nn(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 sn(t){return t?t.split("#")[0]:t}function rn(t,e){const i=setTimeout(t,e);return null!=i&&i.unref&&(null==i||i.unref()),i}function on(t,e,i){return ln.apply(this,arguments)}function ln(){return(ln=ne(function*(t,e,i){let n;try{return yield Promise.race([t,new Promise((t,s)=>{n=rn(()=>{try{null==i||i(),t()}catch(t){s(t)}},e)})])}finally{clearTimeout(n)}})).apply(this,arguments)}let an,un,hn;function cn(t){const e=globalThis._posthogChunkIds;if(!e)return;const i=Object.keys(e);return hn&&i.length===un||(un=i.length,hn=i.reduce((i,n)=>{an||(an={});const s=an[n];if(s)i[s[0]]=s[1];else{const s=t(n);for(let t=s.length-1;t>=0;t--){const r=s[t],o=null==r?void 0:r.filename,l=e[n];if(o&&l){i[o]=l,an[n]=[o,l];break}}}return i},{})),hn}var dn=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 ne(function*(){for(const i of t)i.stacktrace&&i.stacktrace.frames&&we(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t})()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null===(e=t.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){let i,n;return null!=t.cause&&(i=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(n=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),le(le({},t),{},{cause:i,stack:n})}applyChunkIds(t,e){return t.map(t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t))}applyCoercers(t,e){for(const i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return ne(function*(){let i=t;for(const t of e.modifiers)i=yield t(i);return i})()}convertToExceptionList(t,e){var i,n,s;const r={type:t.type,value:t.value,mechanism:{type:null!==(i=e.type)&&void 0!==i?i:"generic",handled:null===(n=e.handled)||void 0===n||n,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(r.stacktrace={type:"raw",frames:t.stack});const o=[r];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,le(le({},e),{},{handled:!0}))),o}buildParsingContext(t){var e;return{chunkIdMap:cn(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,i=0){const n=(i,n)=>{if(4>=n){const s=this.buildCoercingContext(t,e,n);return this.applyCoercers(i,s)}};return le(le({},e),{},{syntheticException:0==i?e.syntheticException:void 0,mechanism:t,apply:t=>n(t,i),next:t=>n(t,i+1)})}};function vn(t,e,i,n,s){const r={platform:t,filename:e,function:"<anonymous>"===i?"?":i,in_app:!!e&&!e.startsWith("webkit-masked-url://")&&"<anonymous>"!==e};return Ce(n)||(r.lineno=n),Ce(s)||(r.colno=s),r}const fn=(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]},pn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,gn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,mn=/\((\S*)(?::(\d+))(?::(\d+))\)/,yn=(t,e)=>{const i=pn.exec(t);if(i){const[,t,n,s]=i;return vn(e,t,"?",+n,+s)}const n=gn.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){const t=mn.exec(n[2]);t&&(n[2]=t[1],n[3]=t[2],n[4]=t[3])}const[t,i]=fn(n[1]||"?",n[2]);return vn(e,i,t,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},bn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,_n=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,wn=(t,e)=>{const i=bn.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const t=_n.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]=fn(n,t),vn(e,t,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},kn=/\(error: (.*)\)/;function Sn(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function xn(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(!Sn(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 Cn(t,e){const i=e.start+e.length,n=Tn(t,e);n&&t.splice(i+n===t.length?i:e.start,n)}function $n(t,e){let i=e.start;for(;i>0&&Sn(t[i-1],t[i-1+e.length]);)i--;return e.start-i}function Tn(t,e){const i=e.start+e.length;let n=i;for(;t.length>n&&Sn(t[n],t[n-e.length]);)n++;return n-i}function In(t,e){const i=e[0];let n=t.length-(i?$n(t,i):0);for(const i of e)n-=Tn(t,i);return n}function Mn(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 En=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){const i=$e(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 Le(t,"DOMException")}isDOMError(t){return Le(t,"DOMError")}},Pn=class{match(t){return Ne(t)}coerce(t,e){var i;const n=this.getStack(t),s=void 0===n;return{type:this.getType(t),value:this.getMessage(t,e),stack:null!=n?n:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,cause:t.cause?e.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,e){const i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}},Rn=class{match(t){return!!Le(t,"ErrorEvent")&&(null!=t.error||this.lr(t))}coerce(t,e){var i;if(null!=t.error)return e.apply(t.error);const n=e.apply(t.message);return le(le({},n),{},{stack:null!==(i=this.ur(t))&&void 0!==i?i:n.stack,synthetic:!0})}lr(t){return $e(t.message)&&t.message.length>0}ur(t){var e,i;const n=t,s=null!==(e=n.lineno)&&void 0!==e?e:0,r=null!==(i=n.colno)&&void 0!==i?i:0;if($e(n.filename)&&0!==n.filename.length&&0!==s)return`Error\n at ${n.filename}:${s}:${r}`}};const An=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Fn=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(An);return n&&(e=n[1],i=n[2]),[e,i]}};const On=["fatal","error","warning","log","info","debug"];function Dn(t,e=40){const i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(let t=i.length;t>0;t--){const n=i.slice(0,t).join(", ");if(e>=n.length)return t===i.length?n:n.length>e?`${n.slice(0,e)}...`:n}return""}var Ln=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(qe(t))return t.constructor.name;const e="name"in t?t.name:void 0;return $e(e)&&!Te(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: ${Dn(t)}`}isSeverityLevel(t){return $e(t)&&!Te(t)&&On.indexOf(t)>=0}getStack(t){try{return $e(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:$e(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(Ne(i))return i}}getObjectClassName(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}},Nn=class{match(t){return qe(t)}coerce(t,e){var i;const n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${Dn(t)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},qn=class{match(t){return De(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}}},jn=class{match(t){return Le(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!qe(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 De(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 Bn="$message",Hn="$timestamp",zn=new Set([Bn,Hn]),Un={enabled:!0,max_bytes:32768};function Wn(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Un.enabled,max_bytes:Gn(t.max_bytes,Un.max_bytes)}:le({},Un)}var Vn=class{constructor(t){this.ts=[],this.es=0,this.Mr=Wn(t)}setConfig(t){this.Mr=Wn(t),this.ns()}add(t){const e=function(t){let e;try{e=me(t)}catch(t){return}try{const t=JSON.parse(e);if(!Se(t))return;const i=t,n=i[Bn],s=i[Hn];if(!$e(n)||0===n.trim().length)return;if(!$e(s)&&!Ee(s))return;return{step:i,json:e}}catch(t){return}}(t);if(!e)return;const i=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;const e=encodeURIComponent(t);let i=0;for(let t=0;e.length>t;t++)"%"===e[t]?(i+=1,t+=2):i+=1;return i}(e.json);i>this.Mr.max_bytes||(this.ts.push({step:e.step,bytes:i}),this.es+=i,this.ns())}getAttachable(){return this.ts.map(t=>t.step)}clear(){this.ts=[],this.es=0}size(){return this.ts.length}ns(){for(;this.es>this.Mr.max_bytes&&this.ts.length>0;){const t=this.ts.shift();t&&(this.es-=t.bytes)}}};function Gn(t,e){if(!Ee(t)||1/0===t||-1/0===t)return e;const i=Math.floor(t);return 0>i?e:i}const Zn=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function Qn(t){return"string"==typeof t||t}function Jn(t){return"string"==typeof t?t:void 0}const Kn=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Yn="NativeGzipValidationError",Xn=t=>t.length>=2&&31===t[0]&&139===t[1],ts=(t,e)=>t===ue.GZipJS||e===ue.GZipJS||"gzip"===e,es=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),is=t=>{if(!t||"object"!=typeof t)return!1;const e="name"in t?String(t.name):"";return es(t)||e===Yn};let ns;const ss=t=>{throw nn(Yn,`Native gzip produced invalid output: ${t}`)},rs=(os=ne(function*(t,e){18>t.size&&ss("too-short");const i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Xn(i)&&8===i[2]||ss("invalid-header");const n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{const e=(()=>{if(ns)return ns;ns=[];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;ns[t]=e>>>0}return ns})();let i=4294967295;for(let n=0;t.length>n;n++)i=e[255&(i^t[n])]^i>>>8;return(4294967295^i)>>>0})(e)&&ss("invalid-crc");const s=e.length>>>0;n.getUint32(4,!0)!==s&&ss("invalid-size")}),function(t,e){return os.apply(this,arguments)});var os;function ls(t){return as.apply(this,arguments)}function as(){return as=ne(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=ne(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 rs(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}),as.apply(this,arguments)}function us(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 hs={}.propertyIsEnumerable;function cs(t,e){try{return fs(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function ds(t,e,i,n){if(0>=i.remainingNodes)return{stringValue:Ki};if(i.remainingNodes--,Re(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:Xi(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:Ki};if(t instanceof Date){const e=t.getTime(),i=Number.isFinite(e)?t.toISOString():String(t);return{stringValue:"string"==typeof i?Xi(i):String(i)}}i.ancestors.add(t);try{try{const s=t.toJSON;if("function"==typeof s)return ds(s.call(t),e,i,n+1)}catch(t){}return we(t)?{arrayValue:{values:vs(t,e,i,n+1)}}:{kvlistValue:{values:fs(t,e,i,n+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:Xi(String(t))}}function vs(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(Me(r))continue;s.push(ds(r,e,i,n))}catch(t){s.push({stringValue:Yi})}return t.length>o&&s.push({stringValue:Ki}),s}function fs(t,e,i,n){const s=[];for(const r in t)if(hs.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:Xi(r),value:ds(o,e,i,n)})}catch(t){s.push({key:Xi(r),value:{stringValue:Yi}})}}return s}function ps(t,e,i){return le(le(le(le({},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 gs={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};const ms={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},ys=ms.info;function bs(t){try{return Xi(String(t))}catch(t){return Yi}}function _s(t,e,i,n){const s=t.level||"info",{text:r,number:o}=ms[s]||ys,l=function(t=Date.now()){return String(t)+"000000"}(Ee(n)?n:void 0),a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),Me(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),Me(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=le({},a),h=t.attributes;if(h){let t=[];try{t=Object.keys(h)}catch(e){t=[]}for(const e of t){let t;try{t=h[e]}catch(e){t=Yi}Object.defineProperty(u,e,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const c={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:r,body:{stringValue:bs(t.body)},attributes:cs(u,i)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),Ce(t.trace_flags)||(c.flags=t.trace_flags),c}function ws(t,e,i){return ps(t,e,i)}function ks(t,e,i,n){return{resourceLogs:[{resource:{attributes:cs(e)},scopeLogs:[{scope:{name:i,version:n},logRecords:t}]}]}}var Ss=class{constructor(t,e,i,n,s,r=()=>Promise.resolve(),o){var l;this._instance=t,this.Mr=e,this.$=i,this.ss=n,this.rs=s,this.ls=r,this.us=o,this.hs=null,this.cs=0,this.ds=0,this.vs=0,this.fs=0,this.ps=0,this.gs=!1,this.ys=e.maxBufferSize,this.bs=Math.max(null!==(l=e.maxQueueSize)&&void 0!==l?l:e.maxBufferSize,e.maxBufferSize),this._s=e.flushIntervalMs,this.ws=e.maxBatchRecordsPerPost,this.ks=e.rateCapWindowMs,this.Ss=e.maxLogsPerInterval}clearQueue(){this.ds++,this._instance.setPersistedProperty(ae.LogsQueue,[])}reset(){this.xs(),this.fs=0,this.ps=0,this.gs=!1,this.vs=0,this.ws=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.vs=0,this.Cs()}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.$s(t);if(null===n)return;if(!n.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ts())return;const s={record:_s(n,null!==(i=null==e?void 0:e.context)&&void 0!==i?i:this.ss(),this.$,null==e?void 0:e.occurredAtMs)};this.rs(()=>this.Is(s))}$s(t){const e=this.Mr.beforeSend;if(!e)return t;const i=we(e)?e:[e];let n=t;for(const t of i)try{const e=t(n);if(!e)return this.$.info("Log was rejected in beforeSend function"),null;n=e}catch(t){return this.$.error("Error in beforeSend function for log:",t),null}return n}Ts(){if(void 0===this.Ss)return!0;const t=Date.now(),e=t-this.fs;return this.ks>e&&e>=0||(this.fs=t,this.ps=0,this.gs=!1),this.Ss>this.ps?(this.ps++,!0):(this.gs||(this.$.warn(`captureLog dropping logs: exceeded ${this.Ss} logs per ${this.ks}ms`),this.gs=!0),!1)}flush(){var t=this;return ne(function*(){if(!t._instance.isDisabled)return t.hs||(t.hs=t.Ms().finally(()=>{t.hs=null})),t.hs})()}Ms(){var t=this;return ne(function*(){var e;t.xs();let i=null!==(e=t._instance.getPersistedProperty(ae.LogsQueue))&&void 0!==e?e:[];if(0===i.length)return;const n=i.length;let s=0;for(;i.length>0&&n>s;){var r,o;const e=t.ds;t.cs=0;const n=Math.min(i.length,t.ws),l=i.slice(0,n),a=ks(l.map(t=>t.record),t.Es(),null!==(r=t.us)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.Ps(a);if(t.ds!==e)return;if("too-large"===u.kind&&l.length>1)t.ws=Math.max(1,Math.floor(l.length/2)),t.$.warn(`Received 413 when sending logs batch of size ${l.length}, reducing batch size to ${t.ws}`);else{if("retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.$.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.Mr.maxBatchRecordsPerPost>t.ws&&(t.ws=Math.min(t.Mr.maxBatchRecordsPerPost,t.ws+1)),yield t.Rs(l.length),i=null!==(o=t._instance.getPersistedProperty(ae.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===u.kind)throw u.error}}})()}Rs(t){var e=this;return ne(function*(){var i;const n=Math.max(0,t-e.cs),s=null!==(i=e._instance.getPersistedProperty(ae.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(ae.LogsQueue,s.slice(n)),yield e.ls()})()}Es(){return ws(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Is(t){var e;if(this._instance.optedOut)return;const i=null!==(e=this._instance.getPersistedProperty(ae.LogsQueue))&&void 0!==e?e:[];this.bs>i.length||(i.shift(),this.cs++,this.$.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(ae.LogsQueue,i),this.ys>i.length?this.As():this.Cs()}As(t=this._s){this.Fs||(this.Fs=rn(()=>{this.Fs=void 0,this.Cs()},t))}Os(){const t=Math.min(Math.max(0,this.vs-1),6);return this._s*Math.pow(2,t)}Ds(){const t=this._instance.getPersistedProperty(ae.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return ne(function*(){e.xs();const i=e.flush().catch(()=>{});void 0!==t?yield on(i,t):yield i})()}flushWithTimeout(t){var e=this;return ne(function*(){const i=e.flush();yield on(i,t,()=>{i.catch(()=>{})})})()}Cs(){this.flush().then(()=>{this.vs=0},t=>{this.vs++,this.$.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.Ds()&&this.As(this.Os())})}xs(){this.Fs&&(clearTimeout(this.Fs),this.Fs=void 0)}};const xs=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Cs(t){return String(t)+"000000"}function $s(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 Ts=class{constructor(t,e,i){this._instance=t,this.Mr=e,this.$=i,this.Ls=new Map,this.hs=null,this.Ns=!1,this.qs=new Map,this.js=new Set,this.Bs=0}count(t,e=1,i){this.Hs({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.Hs({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.Hs({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var t=this;const e=this.hs,i=function(){var i=ne(function*(){e&&(yield e.catch(()=>{})),yield t.zs()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this.hs===i&&(this.hs=null)});return this.hs=i,i}drainWindow(){if(0===this.Ls.size)return null;const t=this.Ls;return this.Ls=new Map,this.Ns=!1,this.qs=new Map,this.js=new Set,this.Us(t)}reset(){this.Bs++,this.xs(),this.Ls=new Map,this.hs=null,this.Ns=!1,this.qs=new Map,this.js=new Set}Hs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const e=this.$s(t);if(null===e)return;if(!e.name||"string"!=typeof e.name)return void this.$.warn("Dropping metric with empty name");if("number"!=typeof e.value||!Number.isFinite(e.value))return void this.$.warn(`Dropping metric '${e.name}': value must be a finite number`);if("count"===e.type&&0>e.value)return void this.$.warn(`Dropping count '${e.name}': counters are monotonic, value must be >= 0`);let i,n;try{i=e.attributes?le({},e.attributes):void 0,n=$s(e.type,e.name,e.unit,i)}catch(t){return void this.$.warn(`Dropping metric '${e.name}': attributes could not be serialized`,t)}let s=this.Ls.get(n);if(!s){if(!this.Ws())return;s={name:e.name,type:e.type,unit:e.unit,attributes:i,windowStartMs:Date.now()},this.Ls.set(n,s)}const r=this.qs.get(e.name);void 0===r?this.qs.set(e.name,e.type):r===e.type||this.js.has(e.name)||(this.js.add(e.name),this.$.warn(`Metric name '${e.name}' is already used as a ${r}; recording it as a ${e.type} too will blend both series in charts. Use a distinct name.`)),this.Vs(s,e.value),this.As()}Ws(){return this.Mr.maxSeriesPerFlush>this.Ls.size||(this.Ns||(this.Ns=!0,this.$.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Vs(t,e){switch(t.type){case"count":var i;t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case"gauge":t.last=e;break;case"histogram":{t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(xs.length+1).fill(0)});const i=t.hist;i.count+=1,i.sum+=e,i.min=Math.min(i.min,e),i.max=Math.max(i.max,e),i.bucketCounts[function(t,e){for(let i=0;e.length>i;i++)if(e[i]>=t)return i;return e.length}(e,xs)]+=1;break}}}$s(t){const e=this.Mr.beforeSend;if(!e)return t;const i=we(e)?e:[e];let n=t;for(const t of i)try{const e=t(n);if(!e)return this.$.info("Metric was rejected in beforeSend function"),null;n=e}catch(t){return this.$.error("Error in beforeSend function for metric:",t),null}return n}As(){this.Fs||(this.Fs=rn(()=>{this.Fs=void 0,this.flush().catch(t=>{this.$.error("Metrics flush failed:",t)})},this.Mr.flushIntervalMs))}xs(){this.Fs&&(clearTimeout(this.Fs),this.Fs=void 0)}zs(){var t=this;return ne(function*(){if(0===t.Ls.size)return;const e=t.Ls;t.Ls=new Map,t.Ns=!1,t.qs=new Map,t.js=new Set;const i=t.Bs,n=yield t._instance.Gs(t.Us(e));if(i===t.Bs)switch(n.kind){case"ok":return;case"retry-later":return t.Zs(e),void t.As();case"too-large":return void t.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.$.error("Failed to send metrics batch:",n.error)}})()}Us(t){return e=this.Qs(t),i=function(t,e,i){return ps(t,e,i)}(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:cs(i)},scopeMetrics:[{scope:{name:n,version:s},metrics:e}]}]};var e,i,n,s}Qs(t){const e=Cs(Date.now()),i=new Map;for(const o of t.values()){var n;const t=$s(o.type,o.name,o.unit,void 0);let l=i.get(t);l||(l=le({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=cs(null!==(n=o.attributes)&&void 0!==n?n:{},this.$),u=Cs(o.windowStartMs);if("count"===o.type){var s;const t={attributes:a,startTimeUnixNano:u,timeUnixNano:e,asDouble:null!==(s=o.total)&&void 0!==s?s:0};l.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t={attributes:a,timeUnixNano:e,asDouble:null!==(r=o.last)&&void 0!==r?r:0};l.gauge.dataPoints.push(t)}else o.hist&&l.histogram.dataPoints.push({attributes:a,startTimeUnixNano:u,timeUnixNano:e,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:xs})}return Array.from(i.values())}Zs(t){for(const[n,s]of t){const t=this.Ls.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,s.windowStartMs),t.type){case"count":var e,i;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(i=s.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(s.hist)if(t.hist){t.hist.count+=s.hist.count,t.hist.sum+=s.hist.sum,t.hist.min=Math.min(t.hist.min,s.hist.min),t.hist.max=Math.max(t.hist.max,s.hist.max);for(let e=0;t.hist.bucketCounts.length>e;e++)t.hist.bucketCounts[e]+=s.hist.bucketCounts[e]}else t.hist=s.hist}else this.Ws()&&this.Ls.set(n,s)}}};function Is(t,e){if(!t)return;const i=t.find(t=>t.type===e);return null==i?void 0:i.value}const Ms="0.8.2",Es={DEBUG:!1,LIB_VERSION:Ms,LIB_NAME:"browser-common",JS_SDK_VERSION:Ms},Ps=(e,{debugEnabled:i}={})=>{const n={N(n,...s){t&&(Es.DEBUG||t.POSTHOG_DEBUG||i)&&!Ce(t.console)&&t.console&&("__rrweb_original__"in t.console[n]?t.console[n].__rrweb_original__:t.console[n])(e,...s)},debug(...t){n.N("debug",...t)},info(...t){n.N("log",...t)},warn(...t){n.N("warn",...t)},error(...t){n.N("error",...t)},critical(...t){console.error(e,...t)},uninitializedWarning(t){n.error(`You must initialize PostHog before calling ${t}`)},createLogger:(t,i)=>Ps(`${e} ${t}`,i)};return n},Rs=Ps("[PostHog.js]"),As=Rs.createLogger;function Fs(t,e){we(t)&&t.forEach(e)}function Os(t,e){if(!Me(t))if(we(t))t.forEach(e);else if(Ae(t))t.forEach((t,i)=>e(t,i));else for(const i in t)be.call(t,i)&&e(t[i],i)}const Ds=function(t,...e){for(const i of e)for(const e in i)void 0!==i[e]&&(t[e]=i[e]);return t};function Ls(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 Ns=function(t){try{return t()}catch(t){return}},qs=function(t){return function(...e){try{return t.apply(this,e)}catch(t){Rs.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Rs.critical(t)}}},js=function(t){const e={};return Os(t,function(t,i){($e(t)&&t.length>0||Ee(t))&&(e[i]=t)}),e};function Bs(t){const e=le({},t);for(const i of["name","message","stack","cause","errors"])try{i in t&&(e[i]=t[i])}catch(t){}return e}const Hs=["herokuapp.com","vercel.app","netlify.app"];function zs(t){const e=null==t?void 0:t.hostname;if(!$e(e))return!1;const i=e.split(".").slice(-2).join(".");for(const t of Hs)if(i===t)return!1;return!0}function Us(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 Ws(t){return"ph_toolbar_internal"===t.name}const Vs=["localhost","127.0.0.1"],Gs=(t,e)=>{try{let i;return JSON.stringify(t,(t,e)=>{var n;return Ne(e)?(null!==(n=i)&&void 0!==n||(i=new WeakMap),i.has(e)||i.set(e,Bs(e)),i.get(e)):"bigint"==typeof e?e.toString():e},e)}catch(e){return me(t)}},Zs=t=>{const e=null==n?void 0:n.createElement("a");return Ce(e)?null:(e.href=t,e)},Qs=function(t,e="&"){let i,n;const s=[];return Os(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)},Js=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(!we(n)||2>n.length)return"";{let t=n[1];try{t=decodeURIComponent(t)}catch(e){Rs.error("Skipping decoding for malformed query param: "+t)}return t.replace(/\+/g," ")}},Ks=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("=");we(n)&&(e.includes(n[0])?u.push(n[0]+"="+i):u.push(a[t]))}let h=l;return null!=o&&(h+="?"+u.join("&")),null!=s&&(h+="#"+s),h},Ys=function(t,e){const i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Xs=(t,e)=>t>=e&&h(),tr=(t,e,i,n)=>{if(0===t){if(h()){const t=e+1;return t===i&&n(),t}return e}return 0};function er(t,e){var i;const n=null==t||null===(i=t.config)||void 0===i?void 0:i.get_current_url;if(!ke(n))return e;try{const t=n(e);return $e(t)&&t?t:e}catch(t){return Rs.error("Error in get_current_url, falling back to window.location.href",t),e}}function ir(e){var i;const n=null==t||null===(i=t.location)||void 0===i?void 0:i.href;return Ce(n)?void 0:er(e,n)}function nr(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 sr(t){return!!t&&1===t.nodeType}function rr(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function or(t){return!!t&&3===t.nodeType}function lr(t){return!!t&&11===t.nodeType&&sr(t.host)}function ar(t){return t?pe(t).split(/\s+/):[]}function ur(t,e){const i=ir(e);return!!(i&&t&&t.some(t=>i.match(t)))}function hr(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 ar(e)}function cr(t){return Me(t)?null:pe(t).split(/(\s+)/).filter(t=>Nr(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function dr(t){let e="";return Mr(t)&&!Er(t)&&t.childNodes&&t.childNodes.length&&Os(t.childNodes,function(t){var i;or(t)&&t.textContent&&(e+=null!==(i=cr(t.textContent))&&void 0!==i?i:"")}),pe(e)}function vr(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 fr=["a","button","form","input","select","textarea","label"];function pr(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 gr(t,e){if(Ce(e))return!0;for(const i of t)if(e.some(t=>pr(i,t)))return!0;return!1}function mr(t){const e=t.parentNode;return!(!e||!sr(e))&&e}const yr=[".ph-no-autocapture","[data-ph-no-autocapture]"],br=["next","previous","prev",">","<"],_r=[...br,"+","-","−","–"],wr=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,kr=[".ph-no-deadclick",".ph-no-capture"],Sr=[".ph-no-rageclick",".ph-no-capture"],xr=["","text","search","email","password","url","tel","number"];function Cr(t){return!(!t||!sr(t))&&(!!rr(t,"textarea")||(rr(t,"input")?fe(xr,(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 $r(e,i){if(!t||Tr(e))return!1;let n,s,r;var o,l;if(Re(i)?(n=!!i&&Sr,s=void 0,r=!1):(n=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Sr,s=null==i?void 0:i.content_ignorelist,r=null!==(l=null==i?void 0:i.ignore_text_selection)&&void 0!==l&&l),!1===n)return!1;if(r&&Cr(e))return!1;const{targetElementList:a}=Ir(e,!1);return!function(t,e){if(!1===t||Ce(t))return!1;let i;if(!0===t)i=br;else{if(!we(t))return!1;if(t.length>10)return Rs.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map(t=>t.toLowerCase())}return e.some(({safeText:t,ariaLabel:e})=>i.some(i=>wr(t,i)||wr(e,i)))}(s,a.map(t=>{var e;return{safeText:dr(t).toLowerCase(),ariaLabel:(null===(e=t.getAttribute("aria-label"))||void 0===e?void 0:e.toLowerCase().trim())||""}}))&&!gr(a,n)}const Tr=t=>!t||rr(t,"html")||!sr(t),Ir=(e,i)=>{if(!t||Tr(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const s=[e];let r=e;for(;r.parentNode&&!rr(r,"body");){if(lr(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}const e=mr(r);if(!e)break;if(i||fr.indexOf(e.tagName.toLowerCase())>-1)n=!0;else try{const i=t.getComputedStyle(e);i&&"pointer"===i.getPropertyValue("cursor")&&(n=!0)}catch(t){}s.push(e),r=e}return{parentIsUsefulElement:n,targetElementList:s}};function Mr(t){const e=new Set;let i=0;for(let n=t;n.parentNode&&!rr(n,"body");n=n.parentNode){if(i++>=1e3||e.has(n))return!1;e.add(n);const t=hr(n);if(fe(t,"ph-sensitive")||fe(t,"ph-no-capture"))return!1}if(fe(hr(t),"ph-include"))return!0;const n=t.type||"";if($e(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}const s=t.name||t.id||"";return!$e(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Er(t){return!!(rr(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||rr(t,"select")||rr(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const Pr=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}))$"),Rr=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Ar=[16,15,14,13],Fr=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Or=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Dr=/[0-9A-Za-z_]/;function Lr(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 Nr(t,e=!0){if(Me(t))return!1;if($e(t)){if(t=pe(t),e?Pr.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(Rr.lastIndex=0;e=Rr.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 Ar){const n=t+e;if(i.length>=n){const e=i.slice(t,n);if(Pr.test(e)&&Lr(e))return!0}}}return!1}(t))return!1;if(e?Fr.test(t):function(t){let e;for(Or.lastIndex=0;e=Or.exec(t);){const t=e[1],i=e[3];if(!(t&&i&&Dr.test(t)&&Dr.test(i)))return!0}return!1}(t))return!1}return!0}function qr(t){let e=dr(t);return e=`${e} ${jr(t)}`.trim(),Nr(e)?e:""}function jr(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Os(t.childNodes,function(t){var i;if(t&&"span"===(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=dr(t);e=`${e} ${i}`.trim(),t.childNodes&&t.childNodes.length&&(e=`${e} ${jr(t)}`.trim())}catch(t){Rs.error("[AutoCapture]",t)}}),e}function Br(t){return t.replace(/"|\\"/g,'\\"')}function Hr(t){const e=t.attr__class;if(e)return we(e)?e:ar(e)}const zr=1e6;function Ur(t){var e;return Math.min(zr,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:zr)}const Wr={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:zr,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},Vr=["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"],Gr=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Zr=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Qr=t=>{Me(t)||Os(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return Vr.includes(e)||Zr.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},Jr=["/s/","/e/","/i/"];function Kr(t,e,i,n){if(Me(t))return t;let s=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return $e(s)&&(s=parseInt(s)),s>i?`[SessionRecording] ${n} body too large to record (${s} bytes)`:t}function Yr(t,e){if(Me(t))return t;let i=t;return Nr(i,!1)||(i="[SessionRecording] "+e+" body redacted"),Os(Gr,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 Xr=new WeakSet,to="disabled",eo="sampled",io="active",no="buffering",so="paused",ro="lazy_loading",oo="rrweb_error",lo="trigger_activated",ao="trigger_pending",uo="trigger_disabled";function ho(t,e,i,n,s,r){return 0===e?uo:(null==t?void 0:t.get_property(i?n+i:s))===r?lo:ao}function co(t,e,i){return e.some(e=>{var n;return"regex"===e.matching&&(null!==(n=null==i?void 0:i.get(e.url))&&void 0!==n?n:new RegExp(e.url)).test(t)})}function vo(t){return t.includes("trigger_activated")?lo:t.includes("trigger_pending")?ao:uo}function fo(t){const e=new Set(t);switch(e.delete(uo),e.size){case 0:return uo;case 1:return Array.from(e)[0];default:return ao}}var po=class{constructor(t){this.q=t}triggerStatus(t){return vo(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return vo(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},go=class{constructor(t){this.q=t}triggerStatus(t){return fo(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return fo(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},mo=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return lo}stop(){}};const yo=t=>"sessionRecording"in t;var bo=class{constructor(t,e){this._instance=t,this.j=[],this.B=[],this.H=new Map,this.U=new Map,this.W="",this.urlBlocked=!1,this.V=e}onConfig(t){var e,i;this.j=(yo(t)?Se(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.B=(yo(t)?Se(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.Z()}Z(){this.H.clear(),this.U.clear();for(const t of this.j)if("regex"===t.matching&&!this.H.has(t.url))try{this.H.set(t.url,new RegExp(t.url))}catch(e){Rs.error("Invalid URL trigger regex pattern:",t.url,e)}for(const t of this.B)if("regex"===t.matching&&!this.U.has(t.url))try{this.U.set(t.url,new RegExp(t.url))}catch(e){Rs.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}G(t){return ho(this._instance,this.j.length,this.V,V,z,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Ht]:e}),e}triggerStatusNoSideEffects(t){return this.G(t)}isCurrentUrlBlocked(){const t=ir(this._instance);if(!t)return!1;try{return co(t,this.B,this.U)}catch(t){return!0}}checkUrlBlocklist(t,e){const i=ir(this._instance);if(!i)return;if(i===this.W)return;this.W=i;const n=this.urlBlocked,s=co(i,this.B,this.U);n&&s||(s&&!n?t():!s&&n&&e())}checkUrlTriggerConditions(t,e,i,n){const s=ir(this._instance);if(!s)return;if(s===this.W)return;this.W=s;const r=this.urlBlocked,o=co(s,this.B,this.U);o&&!r?t():!o&&r&&e();const l=this.G(n)===lo,a=co(s,this.j,this.H);!l&&a&&i("url",s)}stop(){this.W=""}},_o=class{constructor(t){this._instance=t,this.linkedFlag=null,this.linkedFlagSeen=!1,this.J=()=>{}}triggerStatus(){const t=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[Lt]:t}),t}triggerStatusNoSideEffects(){let t=ao;return Me(this.linkedFlag)&&(t=uo),this.linkedFlagSeen&&(t=lo),t}onConfig(t,e){var i;if(this.linkedFlag=(yo(t)?Se(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!Me(this.linkedFlag)&&!this.linkedFlagSeen){const t=$e(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=$e(this.linkedFlag)?null:this.linkedFlag.variant;this.J=this._instance.onFeatureFlags((n,s)=>{let r=!1;if(Se(s)&&t in s){const e=s[t];r=Re(e)?!0===e:i?e===i:!!e}const o=r&&!this.linkedFlagSeen;this.linkedFlagSeen=r,o&&e(t,i)})}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.J()}},wo=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(yo(t)?Se(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 ho(this._instance,this.K.length,this.V,W,U,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Dt]:e}),e}triggerStatusNoSideEffects(t){return this.X(t)}checkEventTriggerConditions(t,e,i){if(0===this.K.length)return;const n=this.X(i)===lo,s=this.K.includes(t);!n&&s&&e("event",t)}stop(){}},ko=class{constructor(t,e,i){if(this._instance=t,this.group=e,this.Y=new bo(t,e.id),this.tt=new wo(t,e.id),this.et=new _o(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){const t=(e.conditions.events||[]).map(t=>t.name),n={urlTriggers:e.conditions.urls||[],eventTriggers:t,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.Y.onConfig(n),this.tt.onConfig(n),this.et.onConfig(n,i);const s=[this.tt,this.Y,this.et];this.nt="any"===e.conditions.matchType?new po(s):new go(s)}else this.nt=new mo}triggerStatus(t){return this.nt.triggerStatus(t)}triggerStatusNoSideEffects(t){return this.nt.triggerStatusNoSideEffects(t)}getPendingTriggerConditions(t){return"trigger_pending"!==this.triggerStatusNoSideEffects(t)?[]:[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===ao).map(({label:t})=>t)}checkEventTriggerConditions(t,e,i){this.tt.checkEventTriggerConditions(t,e,i)}checkUrlTriggerConditions(t,e,i,n){this.Y.checkUrlTriggerConditions(t,e,i,n)}activateTrigger(t,e){var i;const n="url"===t?V+this.group.id:W+this.group.id;null===(i=this._instance.persistence)||void 0===i||i.register({[n]:e})}stop(){this.Y.stop(),this.tt.stop(),this.et.stop()}};function So(t){if(t.rrwebError)return oo;if(!t.receivedFlags)return no;if(!t.isRecordingEnabled)return to;if(t.urlTriggerMatching.urlBlocked)return so;const e=!0===t.isSampled,i=new po([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?eo:"trigger_activated"===i?io:"trigger_pending"===i?no:!1===t.isSampled?to:io}function xo(t){if(t.rrwebError)return oo;if(!t.receivedFlags)return no;if(!t.isRecordingEnabled)return to;if(t.urlTriggerMatching.urlBlocked)return so;const e=new go([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),i=e!==uo,n=Re(t.isSampled);return i&&"trigger_pending"===e?no:i&&"trigger_disabled"===e||n&&!t.isSampled?to:!0===t.isSampled?eo:io}function Co(){const t=[];return function(e,i){if(Se(i)||we(i)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(i)?"[Circular]":(t.push(i),i)}return i}}function $o(t){const e=JSON.stringify(t,Co());return e?new Blob([e]).size:0}function To(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(we(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:To(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+To(s))}return i}default:return 0}}function Io(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[Io({size:i.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),Io({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 Mo=Uint8Array,Eo=Uint16Array,Po=Uint32Array,Ro=new Mo([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]),Ao=new Mo([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]),Fo=new Mo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Oo=function(t,e){for(var i=new Eo(31),n=0;31>n;++n)i[n]=e+=1<<t[n-1];var s=new Po(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]},Do=Oo(Ro,2),Lo=Do[1];Do[0][28]=258,Lo[258]=28;for(var No=Oo(Ao,0)[1],qo=new Eo(32768),jo=0;32768>jo;++jo){var Bo=(43690&jo)>>>1|(21845&jo)<<1;qo[jo]=((65280&(Bo=(61680&(Bo=(52428&Bo)>>>2|(13107&Bo)<<2))>>>4|(3855&Bo)<<4))>>>8|(255&Bo)<<8)>>>1}var Ho=function(t,e,i){for(var n=t.length,s=0,r=new Eo(e);n>s;++s)++r[t[s]-1];var o,l=new Eo(e);for(s=0;e>s;++s)l[s]=l[s-1]+r[s-1]<<1;if(i){o=new Eo(1<<e);var a=15-e;for(s=0;n>s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],c=l[t[s]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)o[qo[c]>>>a]=u}else for(o=new Eo(n),s=0;n>s;++s)o[s]=qo[l[t[s]-1]++]>>>15-t[s];return o},zo=new Mo(288);for(jo=0;144>jo;++jo)zo[jo]=8;for(jo=144;256>jo;++jo)zo[jo]=9;for(jo=256;280>jo;++jo)zo[jo]=7;for(jo=280;288>jo;++jo)zo[jo]=8;var Uo=new Mo(32);for(jo=0;32>jo;++jo)Uo[jo]=5;var Wo=Ho(zo,9,0),Vo=Ho(Uo,5,0),Go=function(t){return(t/8|0)+(7&t&&1)},Zo=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var n=new(t instanceof Eo?Eo:t instanceof Po?Po:Mo)(i-e);return n.set(t.subarray(e,i)),n},Qo=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8},Jo=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8,t[n+2]|=i>>>16},Ko=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 Mo(0),0];if(1==s){var o=new Mo(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(t,e){return t.f-e.f}),i.push({s:-1,f:25001});var l=i[0],a=i[1],u=0,h=1,c=2;for(i[0]={s:-1,f:l.f+a.f,l:l,r:a};h!=s-1;)l=i[i[c].f>i[u].f?u++:c++],a=i[u!=h&&i[c].f>i[u].f?u++:c++],i[h++]={s:-1,f:l.f+a.f,l:l,r:a};var d=r[0].s;for(n=1;s>n;++n)r[n].s>d&&(d=r[n].s);var v=new Eo(d+1),f=Yo(i[h-1],v,0);if(f>e){n=0;var p=0,g=f-e,m=1<<g;for(r.sort(function(t,e){return v[e.s]-v[t.s]||t.f-e.f});s>n;++n){var y=r[n].s;if(e>=v[y])break;p+=m-(1<<f-v[y]),v[y]=e}for(p>>>=g;p>0;){var 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 Mo(v),f]},Yo=function(t,e,i){return-1==t.s?Math.max(Yo(t.l,e,i+1),Yo(t.r,e,i+1)):e[t.s]=i},Xo=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Eo(++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]},tl=function(t,e){for(var i=0,n=0;e.length>n;++n)i+=t[n]*e[n];return i},el=function(t,e,i){var n=i.length,s=Go(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)},il=function(t,e,i,n,s,r,o,l,a,u,h){Qo(e,h++,i),++s[256];for(var c=Ko(s,15),d=c[0],v=c[1],f=Ko(r,15),p=f[0],g=f[1],m=Xo(d),y=m[0],b=m[1],_=Xo(p),w=_[0],k=_[1],S=new Eo(19),x=0;y.length>x;++x)S[31&y[x]]++;for(x=0;w.length>x;++x)S[31&w[x]]++;for(var C=Ko(S,7),T=C[0],I=C[1],M=19;M>4&&!T[Fo[M-1]];--M);var E,P,R,A,F=u+5<<3,O=tl(s,zo)+tl(r,Uo)+o,D=tl(s,d)+tl(r,p)+o+14+3*M+tl(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(O>=F&&D>=F)return el(e,h,t.subarray(a,a+u));if(Qo(e,h,1+(O>D)),h+=2,O>D){E=Ho(d,v,0),P=d,R=Ho(p,g,0),A=p;var L=Ho(T,I,0);for(Qo(e,h,b-257),Qo(e,h+5,k-1),Qo(e,h+10,M-4),h+=14,x=0;M>x;++x)Qo(e,h+3*x,T[Fo[x]]);h+=3*M;for(var N=[y,w],q=0;2>q;++q){var j=N[q];for(x=0;j.length>x;++x)Qo(e,h,L[B=31&j[x]]),h+=T[B],B>15&&(Qo(e,h,j[x]>>>5&127),h+=j[x]>>>12)}}else E=Wo,P=zo,R=Vo,A=Uo;for(x=0;l>x;++x)if(n[x]>255){var B;Jo(e,h,E[257+(B=n[x]>>>18&31)]),h+=P[B+257],B>7&&(Qo(e,h,n[x]>>>23&31),h+=Ro[B]);var H=31&n[x];Jo(e,h,R[H]),h+=A[H],H>3&&(Jo(e,h,n[x]>>>5&8191),h+=Ao[H])}else Jo(e,h,E[n[x]]),h+=P[n[x]];return Jo(e,h,E[256]),h+P[256]},nl=new Po([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),sl=new Mo(0),rl=function(){for(var t=new Po(256),e=0;256>e;++e){for(var i=e,n=9;--n;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),ol=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function ll(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=rl[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 Mo(n+o+5*(1+Math.floor(o/7e3))+s),a=l.subarray(n,l.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var c=h+65535;o>c?u=el(a,u,t.subarray(h,c)):(a[h]=r,u=el(a,u,t.subarray(h,o)))}else{for(var d=nl[e-1],v=d>>>13,f=8191&d,p=(1<<i)-1,g=new Eo(32768),m=new Eo(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 Po(25e3),k=new Eo(288),S=new Eo(32),x=0,C=0,T=(h=0,0),I=0,M=0;o>h;++h){var E=_(h),P=32767&h,R=m[E];if(g[P]=R,m[E]=P,h>=I){var A=o-h;if((x>7e3||T>24576)&&A>423){u=il(t,a,0,w,k,S,C,T,M,h-M,u),T=x=C=0,M=h;for(var F=0;286>F;++F)k[F]=0;for(F=0;30>F;++F)S[F]=0}var O=2,D=0,L=f,N=P-R&32767;if(A>2&&E==_(h-N))for(var q=Math.min(v,A)-1,j=Math.min(32767,h),B=Math.min(258,A);j>=N&&--L&&P!=R;){if(t[h+O]==t[h+O-N]){for(var H=0;B>H&&t[h+H]==t[h+H-N];++H);if(H>O){if(O=H,D=N,H>q)break;var z=Math.min(N,H-2),U=0;for(F=0;z>F;++F){var W=h-N+F+32768&32767,V=W-g[W]+32768&32767;V>U&&(U=V,R=W)}}}N+=(P=R)-(R=g[P])+32768&32767}if(D){w[T++]=268435456|Lo[O]<<18|No[D];var G=31&Lo[O],Z=31&No[D];C+=Ro[G]+Ao[Z],++k[257+G],++S[Z],I=h+O,++x}else w[T++]=t[h],++k[t[h]]}}u=il(t,a,r,w,k,S,C,T,M,h-M,u),r||(u=el(a,u,sl))}return Zo(l,0,n+Go(u)+s)}(s,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+r.mem,o,l,!a)),h=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&ol(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),ol(u,h-8,i.d()),ol(u,h-4,n),u}function al(t,e){var i=t.length;if(!e&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new Mo(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 Mo(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 Zo(n,0,s)}function ul(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 hl=class{constructor(t,e={}){var i,n,s,r;this._rrweb=t,this.it=e,this.rt={},this.ot=Date.now(),this.st=-1/0,this.ut=()=>{const t=Date.now(),e=t-this.ot;e>0?(this.ct=Math.min(this.dt,this.ct+e/1e3*this.ht),this.ot=t):this.ot=t},this.ft=t=>{if(!this.rt[t]){var e,i;this.rt[t]=!0;const n=this.vt(t);null===(e=(i=this.it).onBlockedNode)||void 0===e||e.call(i,t,n)}},this.yt=t=>{const e=this.vt(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){const t=e.closest("svg");if(t)return[this._rrweb.mirror.getId(t),t]}return[t,e]},this.vt=t=>this._rrweb.mirror.getNode(t),this.bt=t=>{var e,i,n,s,r,o,l,a;return(null!==(e=null===(i=t.removes)||void 0===i?void 0:i.length)&&void 0!==e?e:0)+(null!==(n=null===(s=t.attributes)||void 0===s?void 0:s.length)&&void 0!==n?n:0)+(null!==(r=null===(o=t.texts)||void 0===o?void 0:o.length)&&void 0!==r?r:0)+(null!==(l=null===(a=t.adds)||void 0===a?void 0:a.length)&&void 0!==l?l:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;const e=t.data,i=this.bt(e);if(e.attributes){const t=e.attributes.length;e.attributes=e.attributes.filter(t=>{const[e]=this.yt(t.id);return!this.wt.consumeRateLimit(e)&&t});const i=t-e.attributes.length;var n,s;i>0&&(null===(n=(s=this.it).onDroppedAttributeMutations)||void 0===n||n.call(s,i))}const r=this.bt(e);if(0===r&&i!==r)return;if(this.kt)return t;this.ut();const o=To(t);var l,a;return o>this.ct?(null===(l=(a=this.it).onDroppedOversizedMutation)||void 0===l||l.call(a,o),void this._t()):(this.ct-=o,t)},this._t=()=>{if(this.St)return;const t=Math.max(0,this.xt-(Date.now()-this.st));this.St=setTimeout(()=>{var t,e;this.St=void 0,this.st=Date.now(),null===(t=(e=this.it).requestFullSnapshot)||void 0===t||t.call(e)},t)},this.wt=new Ge({bucketSize:null!==(i=this.it.bucketSize)&&void 0!==i?i:100,refillRate:null!==(n=this.it.refillRate)&&void 0!==n?n:10,refillInterval:1e3,I:this.ft,$:Rs}),this.dt=null!==(s=this.it.bytesBucketSize)&&void 0!==s?s:0,this.ht=null!==(r=this.it.bytesRefillRate)&&void 0!==r?r:25600,this.kt=!Number.isFinite(this.dt)||0>=this.dt,this.ct=this.dt;const o=this.it.resyncIntervalMs;this.xt=Ee(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this.rt={},this.St&&(clearTimeout(this.St),this.St=void 0),this.st=Date.now()}stop(){this.wt.stop(),this.reset(),this.ct=this.dt,this.ot=Date.now(),this.st=-1/0}};const cl=t=>{if(n){try{const e=t+"=",i=n.cookie.split(";").filter(t=>t.length);for(let t=0;i.length>t;t++){let n=i[t];for(;" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Ee(t)&&isFinite(t)&&Math.floor(t)===t});var dl=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}},vl=class{generate(){const t=this.generateOrAbort();if(!Ce(t))return t;{this.Ct=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 Ee(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Ct)this.Ct=t,this.Mt();else{if(this.Ct>=t+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return dl.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new pl}};let fl=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!Ce(t.crypto)&&crypto.getRandomValues&&(fl=t=>crypto.getRandomValues(t));var pl=class{nextUint32(){return this.Rt.length>this.$t||(fl(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let gl;const ml=()=>yl().toString(),yl=()=>(gl||(gl=new vl)).generate();let bl="";const _l=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let wl=null;const kl={Et(){if(!Ie(wl))return wl;if(wl=!1,n)try{const t=`__ph_cookie_support_${ml()}`;kl.At(t,"xyz"),wl='"xyz"'===cl(t),kl.Lt(t)}catch(t){wl=!1}return wl},Pt(t){Rs.error("cookieStore error: "+t)},Ot:cl,Dt(t){let e;try{e=JSON.parse(kl.Ot(t))||{}}catch(t){}return e},At(t,e,i,s,r){if(!n)return!1;try{let o="",l="";const a=function(t,e){if(e){let e=function(t,e=n){if(bl)return bl;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";const i=t.split(".");let s=Math.min(i.length,8);const r="dmn_chk_"+ml();for(;!bl&&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",bl=t)}return bl}(t);if(!e){const i=(t=>{const e=t.match(_l);return e?e[0]:""})(t);i!==e&&Rs.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&&Rs.warn("cookieStore warning: large cookie, len="+u.length),n.cookie=u,!0}catch(t){return!1}},Lt(t,e){if(null==n?void 0:n.cookie)try{kl.At(t,"",-1,e)}catch(t){return}}};let Sl=null;const xl={Et(){if(!Ie(Sl))return Sl;let e=!0;if(Ce(t))e=!1;else try{const t="__mplssupport__";xl.At(t,"xyz"),'"xyz"'!==xl.Ot(t)&&(e=!1),xl.Lt(t)}catch(t){e=!1}return e||Rs.error("localStorage unsupported; falling back to cookie store"),Sl=e,e},Pt(t){Rs.error("localStorage error: "+t)},Ot(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){xl.Pt(t)}return null},Dt(t){try{return JSON.parse(xl.Ot(t))||{}}catch(t){}return null},At(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){xl.Pt(t)}return!1},Lt(e){try{null==t||t.localStorage.removeItem(e)}catch(t){xl.Pt(t)}}},Cl=[rt,K,J,X,tt,et,St,kt,_t],$l=[p,f,j,B,Et,Mt,_,xt],Tl=t=>t+"_cpm",Il=["__proto__","constructor","prototype"],Ml=t=>{if(!Se(t))return{};const e={};return Object.keys(t).forEach(i=>{-1===Il.indexOf(i)&&(e[i]=t[i])}),e},El=(t,e=[])=>{const i={};return[...$l,...e].forEach(e=>{const n=t[e];Ce(n)||Ie(n)||""===n||(i[e]=n)}),i},Pl=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)},Rl=(t,e)=>({p:e,f:Pl(JSON.stringify(t))}),Al=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const i=kl.Dt(Tl(t)),n=(null==i?void 0:i.f)===Pl(e)&&we(i.p);return{properties:n?i.p:[],isValid:n}}catch(t){return{properties:[],isValid:!1}}},Fl=(t,e)=>e+"|"+(kl.Ot(Tl(t))||""),Ol={},Dl={Et:()=>!0,Pt(t){Rs.error("memoryStorage error: "+t)},Ot:t=>t in Ol?Ol[t]:null,Dt:t=>t in Ol?Ol[t]:null,At:(t,e)=>(Ol[t]=e,!0),Lt(t){delete Ol[t]}};let Ll=null;const Nl={Et(){if(!Ie(Ll))return Ll;if(Ll=!0,Ce(t))Ll=!1;else try{const t="__support__";Nl.At(t,"xyz"),'"xyz"'!==Nl.Ot(t)&&(Ll=!1),Nl.Lt(t)}catch(t){Ll=!1}return Ll},Pt(t){Rs.error("sessionStorage error: ",t)},Ot(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Nl.Pt(t)}return null},Dt(t){try{return JSON.parse(Nl.Ot(t))||null}catch(t){}return null},At(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Nl.Pt(t)}return!1},Lt(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Nl.Pt(t)}}};Es.DEBUG=!1,Es.LIB_VERSION="1.429.3",Es.LIB_NAME="web";var ql=Es,jl=class{constructor(t){if(!t.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.Ft=t.get_property.bind(t),this.Nt=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.Nt(Q,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){const e=this.Ft(Q);return Se(i=e)&&$e(i.sessionId)&&Ee(i.size)&&e.sessionId===t?e.size:0;var i}};function Bl(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<Ve(100*e,0,100,Rs)}function Hl(t){return`$survey_response_${t}`}function zl(t,e){if(!e)return null;const i=t[Hl(e)];return we(i)?[...i]:i}function Ul(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=zl(t,e.id);Ce(r)||(n[i]=r)}),le(le({$survey_questions:e.questions.map(e=>{var n,s;return{id:e.id,question:null!==(n=null==i?void 0:i[null!==(s=e.id)&&void 0!==s?s:""])&&void 0!==n?n:e.question,response:zl(t,e.id)}})},t),n)}function Wl(t={}){return Object.values(t).some(t=>!Me(t))}function Vl(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 Gl(t){return"string"==typeof t&&t.trim()?t.trim():null}function Zl(t){return t.toLowerCase()}function Ql(t,e,i){if(!t||!e)return null;const n=Zl(e),s=Object.keys(t).find(t=>Zl(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=>Zl(t)===s);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${e})`),r}return null}const Jl=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function Kl(t,e,i){var n;const s=Ql(t.translations,e,i),r=le({},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=le({},r.appearance);for(const i of Jl){const n=e[i];Ce(n)||(t[i]=n,o=!0)}r.appearance=t}else(function(t){return Jl.some(e=>!Ce(t[e]))})(e)&&(o=!0)}const a=t.questions.map(t=>function(t,e,i){var n;const s=Ql(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=le({},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 we(t.choices)}(r)&&(o.choices=r.choices,l=!0),{question:l?o:t,matchedKey:l?s:null,hasChanges:l}}(t,e,i)),u=a.map(t=>t.question),h=a.some(t=>t.hasChanges);let c=null;return s||(c=(null===(n=a.find(t=>t.matchedKey))||void 0===n?void 0:n.matchedKey)||null),h&&(r.questions=u,o=!0,null==i||i.info(`Applied question-level translations for language: ${e}`)),{survey:r,matchedKey:o?s||c:null}}function Yl(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 Xl(t){var e;return Yl(t)&&!!(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e?void 0:e.repeatedActivation)||"always"===t.schedule}const ta=(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}},ea=t=>t.toLowerCase(),ia={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=>ta(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!ta(e,t))),icontains:(t,e)=>e.map(ea).some(e=>t.map(ea).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(ea).every(e=>t.map(ea).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 na(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=ia[i.operator];return!!s&&s(i.values,[String(n)])})}function sa(t,e,i){return Gs({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}const ra=new Set(["is_not","not_icontains","not_regex"]);function oa(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 ra.has(r);const o=ia[r];return!!o&&!Ce(t.value)&&!Ie(t.value)&&o(we(t.value)?t.value.map(String):[String(t.value)],we(s)?s.map(String):[String(s)])})}const la=As("[SessionRecording]");function aa(t,e){return e?t:"!"+t}function ua(t,e){return t===e||t!=="!"+e&&null}var ha=class{constructor(t,e,i,n,s,r,o){this._instance=t,this.Y=e,this.tt=i,this.et=n,this.qt=s,this.jt=r,this.Bt=o,this.Ht=null,this.Ut=xo}onRemoteConfig(t){this.Ht=Ee(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.zt=new po([this.tt,this.Y]),this.Ut=So):(this.zt=new go([this.tt,this.Y]),this.Ut=xo),this._instance.register_for_session({[jt]:t.triggerMatchType}),this.Y.onConfig(t),this.tt.onConfig(t),this.et.onConfig(t,(t,e)=>{this.qt("linked_flag_matched",{flag:t,variant:e}),this.Bt()})}getStatus(t){return this.Ut({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 Ee(i)?i:null}checkUrlTriggers(t,e,i,n){this.Y.checkUrlTriggerConditions(e,i,n,t)}setupEventTriggerListeners(t,e,i){if(0!==this.tt.K.length&&Me(this.Wt))return this.Wt=t(t=>{try{this.tt.checkEventTriggerConditions(t.event,i,e)}catch(t){la.error("Could not activate event trigger",t)}}),this.Wt}makeSamplingDecisions(t){var e;const i=this.Ht;var n,s;if(!Ee(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(B),o=this._instance.get_property(O),l=ua(r,t),a=Ee(o)&&o!==i,u=Ce(o)&&r===t,h=a||u||!Re(l),c=h?Bl(t,i):l;h&&(c?this.qt("sampled"):la.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:aa(t,c),$replay_sample_rate:Ie(o)&&r===t?null:i})}ensureSamplingDecision(t){if(!Ee(this.Ht))return;const e=this._instance.get_property(B);Re(ua(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.zt)||void 0===e?void 0:e.triggerStatus(t))===ao}getPendingTriggerConditions(t){return[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===ao).map(({label:t})=>t)}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.tt.stop(),this.Y.stop(),this.et.stop()}},ca=class{constructor(t,e,i,n,s){this._instance=t,this.Y=e,this.qt=i,this.Vt=n,this.Bt=s,this.Zt=[],this.Gt=new Map,this.Qt=!1}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Jt(t.triggerGroups),this._instance.register_for_session({[jt]:"v2_trigger_groups",[Bt]:t.triggerGroups.length}),this.Y.onConfig(t)):la.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return oo;if(!t.receivedFlags)return no;if(!t.isRecordingEnabled)return to;if(t.urlTriggerMatching.urlBlocked)return so;const e=t.triggerGroupMatchers,i=t.triggerGroupSamplingResults;if(0===e.length)return to;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)?Rs.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(s=!0)}else"trigger_pending"===e&&(n=!0)}return s?eo:n?no:to}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Zt,triggerGroupSamplingResults:this.Gt,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){let e=null;for(const i of this.Zt)if("trigger_activated"===i.triggerStatus(t)){const t=i.group.minDurationMs;Ee(t)&&(Ie(e)||e>t)&&(e=t)}return e}checkUrlTriggers(t,e,i,n){this.Y.checkUrlBlocklist(e,i);for(const n of this.Zt)n.checkUrlTriggerConditions(e,i,e=>{this.Kt(n,void 0)&&(n.activateTrigger(e,t),this.updateActiveTriggers(t),this.Bt(e))},t)}setupEventTriggerListeners(t,e,i){return this.Wt=t(t=>{var i;if(this.Qt)return la.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(i=this.Wt)||void 0===i||i.call(this),void(this.Wt=void 0);try{for(const i of this.Zt)i.checkEventTriggerConditions(t.event,n=>{if(!this.Kt(i,t.properties))return;const s=(i.group.conditions.events||[]).filter(e=>e.name===t.event),r=this._instance.get_property(rt);s.some(e=>!e.properties||0===e.properties.length||oa(e.properties,t.properties,r))&&(i.activateTrigger(n,e),this.updateActiveTriggers(e),this.Bt(n))},e)}catch(t){la.error("Could not activate event trigger for trigger groups",t)}}),this.Wt}makeSamplingDecisions(t){for(const i of this.Zt){var e;const n=i.group,s=n.id,r=n.sampleRate,o=G+s,l=this._instance.get_property(o);let a=null,u=!1,h=!1,c=!1;if(Se(l)){const e=l.sessionId,i=l.sampleRate,n=l.sampled;u="string"==typeof e&&e!==t,h=Ee(i)&&i!==r,a=e===t&&Ee(i)&&i===r&&Re(n)?n:null}else a=l===t||null,u="string"==typeof l&&l!==t,c=l===t;const d=u||h||c||!Re(a),v=d?Bl(t+s,r):a;d&&this.Vt("triggerGroupSamplingDecisionMade",{group_id:s,group_name:n.name,sampleRate:r,isSampled:v}),this.Gt.set(s,v),null===(e=this._instance.persistence)||void 0===e||e.register({[o]:{sessionId:t,sampleRate:r,sampled:v}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Qt=!0}clearConditionalRecordingPersistence(){var t,e,i;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$replay_sample_rate"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_past_minimum_duration");for(const t of this.Zt){var n,s,r;const e=t.group.id;null===(n=this._instance.persistence)||void 0===n||n.unregister("$posthog_sr_group_event_trigger_"+e),null===(s=this._instance.persistence)||void 0===s||s.unregister("$posthog_sr_group_url_trigger_"+e),null===(r=this._instance.persistence)||void 0===r||r.unregister("$posthog_sr_group_sampling_"+e)}}updateActiveTriggers(t){const e=[];for(const i of this.Zt){const n=i.group,s=n.id,r="trigger_activated"===i.triggerStatus(t),o=!0===this.Gt.get(s);r&&e.push({id:s,name:n.name,matched:!0,sampled:o})}this._instance.register_for_session({[Nt]:e})}hasPendingTriggers(t){for(const e of this.Zt)if("trigger_pending"===e.triggerStatus(t))return!0;return!1}getPendingTriggerConditions(t){return this.Zt.flatMap(e=>"trigger_pending"!==e.triggerStatusNoSideEffects(t)?[]:e.getPendingTriggerConditions(t).map(t=>`trigger group "${e.group.name}": ${t}`))}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear(),this.Y.stop()}Kt(t,e){const i=t.group.conditions.properties;return!i||0===i.length||oa(i,e,this._instance.get_property(rt))}Jt(t){this.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear();for(const e of t){const t=new ko(this._instance,e,(t,i)=>{this.qt("linked_flag_matched",{flag:t,variant:i,group_id:e.id,group_name:e.name}),this.Bt()});this.Zt.push(t)}}};const da=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],va=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...da],fa="<masked>",pa=["li_fat_id"];function ga(t,e,i){if(!n)return{};const s=e?[...da,...i||[]]:[],r=ma(Ks(n.URL,s,fa),t),o=function(){const t={};return Os(pa,function(e){const i=cl(e);t[e]=i||null}),t}();return Ds(o,r)}function ma(t,e){const i=va.concat(e||[]),n={};return Os(i,function(e){const i=Js(t,e);n[e]=i||null}),n}function ya(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?Js(n.referrer,i):"";t.length&&(s.ph_keyword=t)}return s}function ba(){return navigator.language||navigator.userLanguage}function _a(){const t=ba();return"string"==typeof t?t.split("-")[0]:void 0}const wa="$direct";function ka(){return(null==n?void 0:n.referrer)||wa}function Sa(t,e,i=!1){const n=t?[...da,...e||[]]:[],r=i?sn(null==s?void 0:s.href):null==s?void 0:s.href,o=null==r?void 0:r.substring(0,1e3);return{r:ka().substring(0,1e3),u:o?Ks(o,n,fa):void 0}}function xa(t,e=!1){var i;const{r:n,u:s}=t,r=e?sn(s):s,o={$referrer:n,$referring_domain:null==n?void 0:n==wa?wa:null===(i=Zs(n))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const t=Zs(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const e=ma(r);Ds(o,e)}if(n){const t=ya(n);Ds(o,t)}return o}function Ca(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function $a(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const Ta=1e5,Ia=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Ma=[],Ea=()=>!1,Pa="@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(" "),Ra="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Aa="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(" "),Fa="Accommodation AdministrativeArea Country Place State".split(" "),Oa={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:Ra,publisher:Aa},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Ma},Offer:{seller:Aa},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:Aa,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Aa,areaServed:Fa,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Ma}},Da=[["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(" "),Oa.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Oa.Event],[Aa,Oa.Organization],[Fa,Oa.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Oa.Product]];function La(t,e){return be.call(t,e)?t[e]:void 0}function Na(t){const e=typeof t;return Ie(t)||"string"===e||"number"===e||"boolean"===e}function qa(t,e){return e&&function(t){return $e(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function ja(t,e){return we(t)&&t.every(Na)?t.map(t=>qa(t,e)).filter(t=>!Ce(t)):Na(t)?qa(t,e):void 0}function Ba(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 Ha(t){if(be.call(Oa,t))return Oa[t];for(const[e,i]of Da)if(e.includes(t))return i}function za(t,e,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0})}function Ua(t,e,i,n){if(we(t)){const s=t.map(t=>Ua(t,e,i,n)).filter(t=>!Ce(t));return s.length?s:void 0}return Wa(t,e,i,n)||void 0}function Wa(t,e,i,n){if(!Se(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(i))return null;const s=La(t,"@type"),r=function(t){const e=new Set,i="string"==typeof t?[t]:we(t)?t:[],n=[];for(const t of i){if("string"!=typeof t)continue;const i=t.replace(/^https?:\/\/schema\.org\//,"");if(100>=i.length&&Ia.test(i)&&!e.has(i)&&(e.add(i),n.push(i),20===n.length))break}return n}(s),o=r.filter(t=>!!Ha(t)&&(!n||!n.length||n.includes(t))),l={};for(const n of Pa){const o="@type"===n?r.length?"string"==typeof s?r[0]:r:void 0:"@id"===n?Ba(La(t,n),e):ja(La(t,n),i.maskUrl);Ce(o)||za(l,n,o)}for(const n of o){const s=Ha(n);for(const n of Object.keys(s)){const r=La(t,n),o=s[n];if(!0===o){const t=ja(r,i.maskUrl);Ce(t)||za(l,n,t)}else{const t=Ua(r,e,i,o);Ce(t)||za(l,n,t)}}}const a=Ua(La(t,"@graph"),e,i);return Ce(a)||za(l,"@graph",a),Object.keys(l).length?l:null}function Va(t,e,i){if(!Se(t))return null;const n=La(t,"@context");if("string"!=typeof n||!/^https?:\/\/schema\.org\/?$/.test(n))return null;const s=Wa(t,e,i);return s?le({"@context":"https://schema.org"},s):null}function Ga(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function Za(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 Qa(t,e,i){for(let n=t;n;){if(Za(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 Ja(t){return Ga(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(Ga)}function Ka(t){return Ce(t)?void 0:Math.round(t)}function Ya(t){return Se(t)?t.network_timing:t}const Xa=As("[SessionRecording]"),tu=[1,2,3,4,5,6,7,12],eu=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function iu(){var t;return null==d||null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function nu(){var t;return null===(t=iu())||void 0===t?void 0:t.record}function su(t){try{return JSON.stringify(t)}catch(e){return JSON.stringify(t,Co())}}function ru(t){return ul(ll(al(su(t))),!0)}function ou(t){return lu.apply(this,arguments)}function lu(){return(lu=ne(function*(t){const e=yield ls(su(t),ql.DEBUG,{rethrow:!0});return ul(new Uint8Array(yield e.arrayBuffer()),!0)})).apply(this,arguments)}let au,uu;const hu="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let cu=!1;function du(t){var e;return we(t)&&0===t.length?(au=null!==(e=au)&&void 0!==e?e:ru([]),au):ru(t)}function vu(t){return fu.apply(this,arguments)}function fu(){return(fu=ne(function*(t){var e;return we(t)&&0===t.length?au||(uu=null!==(e=uu)&&void 0!==e?e:ou([]).then(t=>(au=t,t)).catch(t=>{throw au=void 0,uu=void 0,t}),uu):ou(t)})).apply(this,arguments)}function pu(t){return hu&&!cu&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function gu(t){return{event:t,size:To(t)}}function mu(t,e){return le(le({},t),{},{data:e,cv:"2024-10"})}function yu(t,e){return le(le({},t),{},{cv:"2024-10",data:le(le({},t.data),e)})}function bu(t){try{if(2===t.type)return gu(mu(t,ru(t.data)));if(3===t.type&&0===t.data.source)return gu(yu(t,{texts:du(t.data.texts),attributes:du(t.data.attributes),removes:du(t.data.removes),adds:du(t.data.adds)}));if(3===t.type&&8===t.data.source)return gu(yu(t,{adds:t.data.adds?ru(t.data.adds):void 0,removes:t.data.removes?ru(t.data.removes):void 0}))}catch(t){Xa.error("could not compress event - will use uncompressed event",t)}return{event:t,size:$o(t)}}function _u(){return _u=ne(function*(t){try{if(2===t.type)return gu(mu(t,yield ou(t.data)));if(3===t.type&&0===t.data.source){const[e,i,n,s]=yield Promise.all([vu(t.data.texts),vu(t.data.attributes),vu(t.data.removes),vu(t.data.adds)]);return gu(yu(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?ou(t.data.adds):void 0,t.data.removes?ou(t.data.removes):void 0]);return gu(yu(t,{adds:e,removes:i}))}}catch(e){return is(e)&&(cu=!0),Xa.error("could not compress event asynchronously - trying synchronous compression",e),bu(t)}return{event:t,size:$o(t)}}),_u.apply(this,arguments)}function wu(t,e){return 5===t.type&&t.data.tag===e}function ku(t){return wu(t,"sessionIdle")}function Su(t){return wu(t,"$session_ending")}function xu(t){return wu(t,"$session_starting")}var Cu=class{get sessionId(){return this.Xt}get Yt(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get te(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get ee(){return ua(this._instance.get_property(B),this.sessionId)}get Ht(){var t;const e=null===(t=this.ne)||void 0===t?void 0:t.sampleRate;return Ee(e)?e:null}get ie(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t,e){this._instance=t,this.oe="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.se=void 0,this.ae=!1,this.le=Date.now(),this.ue=!1,this.ce=[],this.de="unknown",this.he=0,this.fe=0,this.ve=0,this.pe=0,this.me=!1,this.ge=!1,this.ye=!1,this.be=!1,this.we=!1,this.ke=!1,this._e=!1,this.Se=!1,this.xe=!1,this.Ce=!1,this.Me=!1,this.Ie=!1,this.Te=[],this.Re=void 0,this.$e=void 0,this.Ee=!1,this.Ae=[],this.Oe=0,this.Le=0,this.Pe=!1,this.De=void 0,this.Wt=void 0,this.Fe=void 0,this.Ne=void 0,this.qe=void 0,this.je=(t,e,i)=>{var n,s,r,o;if(!i)return;if(t===this.Xt&&e===this.Be)return;const l=!i.noSessionId&&(i.activityTimeout||i.sessionPastMaximumLength),a=this.Xt,u=this.Be;var h;if(l&&this.Vt("$session_ending",{currentSessionId:a,currentWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le,flushed_size:null===(h=this.He)||void 0===h?void 0:h.currentTrackedSize(a)}),null===(n=this._instance.persistence)||void 0===n||n.unregister("$debug_first_full_snapshot_timestamp"),this._e=!1,null===(s=iu())||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.Ue(),!(!1===this.de&&this.isStarted||this.Xt===t&&this.Be===e)){const e=this.Xt!==t&&!1!==this.de;this.de="unknown",this.ze(e)}l&&this.Vt("$session_starting",{previousSessionId:a,previousWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le}),null===(o=this.re)||void 0===o||o.makeSamplingDecisions(t)},this.We=!1,this.Ve=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[H])===this.Xt},this.Ze=()=>{var t,e;if(0===this.Rt.data.length)return null;const i=null===(t=this.Rt.data[0])||void 0===t?void 0:t.timestamp,n=null===(e=this.Rt.data[this.Rt.data.length-1])||void 0===e?void 0:e.timestamp;return Ee(i)&&Ee(n)?n-i:null},this.Ge=()=>{var t,e;const i=this.ie;if(!Ee(i))return!1;if(null===(t=null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.strictMinimumDuration)||void 0===t||!t){const t=this.Qe;return Ee(t)&&t>=0&&i>t}if(this.Ve())return!1;const n=this.Ze();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.Je=()=>{"buffering"!==this.status?(this.me&&this.ge&&this.Ke&&!this.ye&&this.Xe(void 0),this.Ye(),this.tn(!0)):this.en()},this.nn=()=>{this.Je()},this.rn=()=>{this.Vt("browser offline",{})},this.sn=()=>{this.Vt("browser online",{})},this.an=()=>{(null==n?void 0:n.visibilityState)&&("visible"===n.visibilityState&&(this.Ke=!0),this.Vt("window "+n.visibilityState,{}))},this.Ke=null==e||e;const{sessionId:i,windowId:s,sessionStartTimestamp:r}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=i,this.Be=s,this._sessionStartTimestamp=r,this.et=new _o(this._instance),this.Y=new bo(this._instance),this.tt=new wo(this._instance),this.Rt=this.en(),this.ln="ph_"+(this._instance.config.persistence_name||this._instance.config.token)+"_replay_pending_buffer",this.Yt.sessionTimeoutMs>this.te||Xa.warn(`session_idle_threshold_ms (${this.te}) is greater than the session timeout (${this.Yt.sessionTimeoutMs}). Session will never be detected as idle`),this.He=new jl(this._instance)}setDocumentWasEverVisible(t){t&&(this.Ke=!0)}get un(){var t,e,i,n,s,r,o,l,a;const u=null===(t=this.ne)||void 0===t?void 0:t.masking,h={maskAllInputs:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.maskAllInputs,maskTextSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.maskTextSelector,blockSelector:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.blockSelector,maskAllElementAttributes:null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.maskAllElementAttributes},c=null!==(r=null==h?void 0:h.maskAllInputs)&&void 0!==r?r:null==u?void 0:u.maskAllInputs,d=null!==(o=null==h?void 0:h.maskTextSelector)&&void 0!==o?o:null==u?void 0:u.maskTextSelector,v=null!==(l=null==h?void 0:h.blockSelector)&&void 0!==l?l:null==u?void 0:u.blockSelector,f=null!==(a=null==h?void 0:h.maskAllElementAttributes)&&void 0!==a?a:null==u?void 0:u.maskAllElementAttributes;return Ce(c)&&Ce(d)&&Ce(v)&&Ce(f)?void 0:{maskAllInputs:null==c||c,maskTextSelector:d,blockSelector:v,maskAllElementAttributes:f}}cn(){var t;if(this.xe)return;const e=null===(t=this.ne)||void 0===t?void 0:t.masking;if(Me(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.xe=!0,Xa.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+n.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==i?void 0:i.maskAllInputs,maskTextSelector:null==i?void 0:i.maskTextSelector,blockSelector:null==i?void 0:i.blockSelector,maskAllElementAttributes:null==i?void 0:i.maskAllElementAttributes},project:e}))}get dn(){var t;return Ve(null===(t=this._instance.config.session_recording.canvasCapture)||void 0===t?void 0:t.resolutionScale,.1,1,As("canvas recording resolution scale"),1)}get hn(){var t,e,i,n,s,r,o;const l=this._instance.config.session_recording.captureCanvas,a=null===(t=this.ne)||void 0===t?void 0:t.canvasRecording,u=null!==(e=null!==(i=null==l?void 0:l.recordCanvas)&&void 0!==i?i:null==a?void 0:a.enabled)&&void 0!==e&&e,h=null!==(n=null!==(s=null==l?void 0:l.canvasFps)&&void 0!==s?s:null==a?void 0:a.fps)&&void 0!==n?n:4;let c=null!==(r=null!==(o=null==l?void 0:l.canvasQuality)&&void 0!==o?o:null==a?void 0:a.quality)&&void 0!==r?r:.4;if("string"==typeof c){const t=parseFloat(c);c=isNaN(t)?.4:t}return{enabled:u,fps:Ve(h,0,12,As("canvas recording fps"),4),quality:Ve(c,0,1,As("canvas recording quality"),.4)}}get fn(){var t;const e=!!(null===(t=this.ne)||void 0===t?void 0:t.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return null!=i?i:e}get vn(){var t,e,i;const n=null===(t=this.ne)||void 0===t?void 0:t.networkPayloadCapture,s={recordHeaders:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.recordBody},r=(null==s?void 0:s.recordHeaders)||(null==n?void 0:n.recordHeaders),o=(null==s?void 0:s.recordBody)||(null==n?void 0:n.recordBody),l=Ya(this._instance.config.capture_performance),a=Ya(null==n?void 0:n.capturePerformance),u=!!(Re(l)?l:a);return r||o||u?{recordHeaders:r,recordBody:o,recordPerformance:u}:void 0}pn(){var t,e;const i=[],n=null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;n&&this.fn&&i.push(n());const r=null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordNetworkPlugin;if(this.vn&&ke(r))if(!Vs.includes(s.hostname)||this._forceAllowLocalhostNetworkCapture){const t=ke(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(r(((t,e,i)=>{const n={payloadSizeLimitBytes:Wr.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Wr.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...Wr.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=Ur(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=Kr(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=Kr(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=Zs(t.name);let r=0===e.indexOf("http")?null===(n=Zs(e))||void 0===n?void 0:n.pathname:e;"/"===r&&(r="");const o=null==s?void 0:s.pathname.replace(r||"","");return s&&o&&Jr.some(t=>0===o.indexOf(t))?void 0:t})((Qr((n=e).requestHeaders),Qr(n.responseHeaders),n),t.api_host,i));var n},u=ke(t.session_recording.maskNetworkRequestFn);return u&&ke(t.session_recording.maskCapturedNetworkRequestFn)&&Rs.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),u&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{const i=t.session_recording.maskNetworkRequestFn({url:e.name});return!i&&e.isInitial?i:le(le({},e),{},{name:null==i?void 0:i.url})}),n.maskRequestFn=ke(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 Me(o)&&r?(Xr.add(r),r):null!=o?o:void 0}:t=>function(t){if(!Ce(t))return t.requestBody=Yr(t.requestBody,"Request"),t.responseBody=Yr(t.responseBody,"Response"),t}(a(t)),le(le(le({},Wr),n),{},{recordHeaders:s,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.vn,t)))}else Xa.info("NetworkCapture not started because we are on localhost.");return i}mn(t){return this._instance.config.disable_capture_url_hashes?sn(t):t}gn(t,e=!1){const i=e?sn(t):this.mn(t),n=this._instance.config.mask_personal_data_properties?[...da,...this._instance.config.custom_personal_data_properties||[]]:[];return this.yn(Ks(i,n,fa))}yn(t){const e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var i;const n=e.maskCapturedNetworkRequestFn({name:t});return null!==(i=null==n?void 0:n.name)&&void 0!==i?i:null==n?void 0:n.url}if(e.maskNetworkRequestFn){const i=e.maskNetworkRequestFn({url:t});return null==i?void 0:i.url}return t}bn(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.ce.length?this.ce.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):Xa.warn("could not emit queued rrweb event.",e,t),!1}}Vt(t,e){return this.bn(eu(()=>nu().addCustomEvent(t,e)))}wn(){var t;return this.ae&&!0===(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)&&!this.Y.urlBlocked&&!0!==this.de}kn(t){if(!this.wn())return!1;try{const e=nu();return!!e&&(e.addCustomEvent("$json_ld",t),this.wn())}catch(t){return!1}}_n(t=!1){Promise.resolve().then(()=>{var e;return null===(e=this.Sn)||void 0===e?void 0:e.scan(t)})}xn(){try{if(this._instance.config.capture_pageview||!t)return;const e=new URL(t.location.href),i=this.gn(e.origin+e.pathname+e.search);this.Cn!==i&&(this.Cn=i,this.Vt("$url_changed",{href:i}))}catch(t){}}Mn(){if(this.ce.length){const t=[...this.ce];this.ce=[],t.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this.bn(t)})}}jt(){return this.bn(eu(()=>nu().takeFullSnapshot()))}get In(){var t,e,i;if((null===(t=this.re)||void 0===t?void 0:t.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var n;const t=null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.trigger_pending_buffer_interval_millis;return Ee(t)&&Number.isFinite(t)&&t>=1e3&&36e5>=t?t:6e4}return null!==(e=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.full_snapshot_interval_millis)&&void 0!==e?e:3e5}Tn(){if(this.Rn&&clearInterval(this.Rn),!0===this.de)return;const t=this.In;t&&(this.Rn=setInterval(()=>{this.jt()},t))}Bt(t){"event"===t&&this.$n(),!this.Y.urlBlocked&&["sampled","active"].includes(this.status)&&this.Tn()}En(){var t;this.Y.urlBlocked||(this.Y.urlBlocked=!0,null===(t=this.Sn)||void 0===t||t.scan(),clearInterval(this.Rn),Xa.info("recording paused due to URL blocker"),this.Vt("recording paused",{reason:"url blocker"}))}An(){var t;this.Y.urlBlocked&&(null===(t=this.Sn)||void 0===t||t.scan(),this.Y.urlBlocked=!1,this.jt(),this._n(),this.Tn(),this.Vt("recording resumed",{reason:"left blocked url"}),Xa.info("recording resumed"))}On(t,e){var i;if("event"===t&&this.$n(),!this.ue&&(null===(i=this.re)||void 0===i?void 0:i.hasPendingTriggers(this.sessionId))){this.ue=!0;try{var n,s;const i="url"===t?z:U;null===(n=this._instance.persistence)||void 0===n||n.register({[i]:this.sessionId}),null===(s=this.re)||void 0===s||s.updateActiveTriggers(this.sessionId),this.Bt(),this.tn(),this.qt(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.ue=!1}}}get isStarted(){return!!this.se}get ne(){const t=this._instance.get_property(A);if(!t)return;let e;try{e=Se(t)?t:JSON.parse(t)}catch(t){return void Xa.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.We){var i;const s=null!==(i=e.cache_timestamp)&&void 0!==i?i:Date.now();var n;if(Date.now()-s>36e5)return Xa.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:s,persistedConfig:t}),void(null===(n=this._instance.persistence)||void 0===n||n.unregister("$session_recording_remote_config"))}return e}Ln(t,e,i){this._instance.get_property(t)&&(e(),i())}start(e){var i,s;const r=this.ne;if(!r)return void Xa.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const t=!1!==this.de&&!this.be;this.Xe(t?"no_interaction_since_recording_started":void 0),this.be=!1,this.ge=t,this.ye=!1}this.Pe&&(this.Pn(),this.en());const{sessionId:o,windowId:l,sessionStartTimestamp:a}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=o,this.Be=l,this._sessionStartTimestamp=a,this.Dn(),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),(null==r?void 0:r.endpoint)&&(this.oe=null==r?void 0:r.endpoint),this.re=2===(null==r?void 0:r.version)&&(null==r?void 0:r.triggerGroups)&&r.triggerGroups.length>0?new ca(this._instance,this.Y,this.qt.bind(this),this.Vt.bind(this),this.Bt.bind(this)):new ha(this._instance,this.Y,this.tt,this.et,this.qt.bind(this),this.jt.bind(this),this.Bt.bind(this)),this.re.onRemoteConfig(r),null===(s=this.Wt)||void 0===s||s.call(this),this.Wt=this.re.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(t,e)=>this.On(t,e)),this.Ln(D,()=>{this.overrideSampling()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(D)}),this.Ln(L,()=>{this.overrideLinkedFlag()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(L)}),this.Ln(q,()=>{this.overrideTrigger("event")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(q)}),this.Ln(N,()=>{this.overrideTrigger("url")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(N)}),this.re.makeSamplingDecisions(this.sessionId),this.Fn(),this.we||(Us(t,"beforeunload",this.Je),Us(t,"pagehide",this.nn),Us(t,"offline",this.rn),Us(t,"online",this.sn),Us(n,"visibilitychange",this.an),!this.Fe&&ke(this.Yt.onSessionId)&&(this.Fe=this.Yt.onSessionId(this.je)),!this.Ne&&ke(this.Yt.on)?this.Ne=this.Yt.on("forcedIdleReset",()=>{this.Ue(),this.de="unknown",this.stop(),this.qe=this.Yt.onSessionId((t,e,i)=>{var n;null===(n=this.qe)||void 0===n||n.call(this),this.qe=void 0,this.je(t,e,i)})}):ke(this.Yt.on)||Xa.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Me(this.De)&&(this.De=this._instance.on("eventCaptured",t=>{try{if("$pageview"===t.event){const e=(null==t?void 0:t.properties.$current_url)?this.gn(t.properties.$current_url):"";if(!e)return;this.Vt("$pageview",{href:e})}}catch(t){Xa.error("Could not add $pageview to rrweb session",t)}})),"active"===this.status&&this.qt(e||"recording_initialized"))}Nn(){var e,i,s,r,o,l;null==t||t.removeEventListener("beforeunload",this.Je),null==t||t.removeEventListener("pagehide",this.nn),null==t||t.removeEventListener("offline",this.rn),null==t||t.removeEventListener("online",this.sn),null==n||n.removeEventListener("visibilitychange",this.an),clearInterval(this.Rn),this.qn(),null===(e=this.De)||void 0===e||e.call(this),this.De=void 0,null===(i=this.Wt)||void 0===i||i.call(this),this.Wt=void 0,null===(s=this.Fe)||void 0===s||s.call(this),this.Fe=void 0,null===(r=this.Ne)||void 0===r||r.call(this),this.Ne=void 0,null===(o=this.qe)||void 0===o||o.call(this),this.qe=void 0,null===(l=this.re)||void 0===l||l.stop(),this.jn(),this.Pn()}Pn(){this.Le+=1,this.Ae=[],this.Oe=0,this.Bn=void 0,this.Pe=!1}jn(){var t,e;null===(t=this.Hn)||void 0===t||t.stop(),this.ce=[],null===(e=this.Sn)||void 0===e||e.stop(),this.Sn=void 0,this.ae=!1;try{var i;null===(i=this.se)||void 0===i||i.call(this)}catch(t){Xa.warn("could not stop rrweb",t)}this.se=void 0}Un(){if(!this.Bn||0===this.Oe)return!1;if(this.Pe)return!0;this.Pe=!0,this.zn=void 0;const t=this.Le;return this.qn(),this.jn(),this.Bn.catch(()=>{}).then(()=>{t===this.Le&&(this.Pe=!1,this.tn(),this.en(),this.Wn(),this.Nn(),Xa.info("stopped"))}).catch(()=>{this.Pe=!1,this.Wn(),this.Nn(),Xa.info("stopped")}),!0}stop(){if(this.jn(),this.We)this.Ye();else if(this.Un())return;this.tn(),this.en(),this.Wn(),this.Nn(),Xa.info("stopped")}Wn(){this.Xe(void 0,{preserveLogDedup:this.We}),this.ge=!1}flushBeforeIdentityReset(){(this.isStarted||this.Pe)&&(this.Ye(),this.tn())}ze(t){this.We=!0,this.le=Date.now();try{var e,i;this.stop(),this.Vn=void 0,this.Zn=void 0,this.fe=0,this.ve=0,this.pe=0,null===(e=iu())||void 0===e||null===(i=e.resetSnapshotCostState)||void 0===i||i.call(e),this.start("session_id_changed")}finally{this.We=!1}this.Xe(t?"no_interaction_since_session_rotated":void 0),this.ge=!1}Xe(t,{preserveLogDedup:e=!1}={}){if(this.me=!Ce(t),this.zn=t,Ce(t))return void(e||(this.Gn=void 0));if(this.We)return;const i=`${this.sessionId}:${t}`;i!==this.Gn&&(this.Gn=i,Xa.info(`holding buffer: ${t}. nothing is uploaded until the user interacts with the page`))}$n(){this.isStarted||(this.be=!0),this.me&&(this.Xe(void 0),this.ge=!1,this.ye&&(this.ye=!1,this.jt()),this.Qn())}discard({discardProducerEvents:t=!1}={}){this.me=!0,t&&(this.en(),this.jn()),this.en(),this.Nn(),this.en(),this.Wn(),Xa.info("discarded")}Jn(t,e,i,n,s){const r={$snapshot_bytes:i,$snapshot_data:e,$session_id:n,$window_id:s};"disabled"!==this.status?(this.Kn(t,n),this.Xn(r)):this.en()}Yn(){try{this.ti()}catch(t){this.Se||(this.Se=!0,Xa.error("could not track full snapshot cost",t))}}ti(){var t,e;const i=null===(t=iu())||void 0===t||null===(e=t.getLastSnapshotCost)||void 0===e?void 0:e.call(t);i&&i!==this.Zn&&(this.Zn=i,this.Vn&&this.Vn.durationMs>=i.durationMs||(this.Vn=i),500>i.durationMs||Xa.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(i.durationMs),stylesheetMs:Math.round(i.stylesheetMs),nodeCount:i.nodeCount,cssRuleCount:i.cssRuleCount,nonDeferrableCssRuleCount:i.nonDeferrableCssRuleCount,deferredStylesheetCount:i.deferredStylesheetCount}))}Kn(t,e){2!==t.type?3===t.type&&(Ce(this.Re)||this.Re===e||this.$e===e||(this.$e=e,Xa.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.jt())):this.Re=e}ei(t){t.counted&&t.generation===this.Le&&(this.Oe=Math.max(0,this.Oe-1)),t.counted=!1,this.Ae=this.Ae.filter(e=>e!==t)}ni(t,e,i){t.processed||t.generation!==this.Le||(t.processed=!0,this.Jn(t.event,e,i,t.targetSessionId,t.targetWindowId))}ii(t){try{let e=t.event,i=$o(t.event);if(t.compressionEnabled)try{({event:e,size:i}=bu(t.event))}catch(t){Xa.error("could not process queued compression event - will use uncompressed event",t)}try{this.ni(t,e,i)}catch(t){Xa.error("could not capture queued compression event",t)}}finally{this.ei(t)}}Ye(){[...this.Ae].forEach(t=>{this.ii(t)})}ri(t,e,i,n){var s=this;const r={event:t,compressionEnabled:e,targetSessionId:i,targetWindowId:n,generation:this.Le,processed:!1,counted:!0};this.Ae.push(r),this.Oe+=1;const o=(l=ne(function*(){try{if(r.processed)return;let i,n;try{const s=e?pu(t)?yield function(t){return _u.apply(this,arguments)}(t):bu(t):{event:t,size:$o(t)};i=s.event,n=s.size}catch(e){Xa.error("could not process queued compression event - will use uncompressed event",e),i=t,n=$o(t)}s.ni(r,i,n)}finally{s.ei(r)}}),function(){return l.apply(this,arguments)});var l;this.Bn=this.Bn?this.Bn.catch(()=>{}).then(o):o()}onRRwebEmit(e){var i,n,s,r,o,l,a,u,h,c,d,v,f;if(!this._instance.sessionManager)return;if(this.Mn(),!e||!Se(e))return;if(4===e.type){const t=this.gn(e.data.href);if(this.Cn=t,!t)return;e.data.href=t}else this.xn();if(null===(i=this.re)||void 0===i||i.checkUrlTriggers(this.sessionId,()=>this.En(),()=>this.An(),(t,e)=>this.On(t,e)),this.Y.urlBlocked&&!function(t){return 5===t.type&&"recording paused"===t.data.tag}(e))return;2===e.type&&((null===(c=iu())||void 0===c||null===(d=c.wasMaxDepthReached)||void 0===d?void 0:d.call(c))&&(this._e=!0),this.Yn(),Promise.resolve().then(()=>this.Yn()),this.Tn(),null===(v=this.Hn)||void 0===v||v.reset(),null===(f=this._instance.persistence)||void 0===f||f.register_once({$debug_first_full_snapshot_timestamp:e.timestamp},void 0));const p=2===e.type&&(null===(n=this.re)||void 0===n?void 0:n.hasPendingTriggers(this.sessionId));p&&this.oi();const g=this.Hn?this.Hn.throttleMutations(e):e;if(!g)return void(!0===this.de&&this.he++);const m=function(t){const e=t;if(e&&Se(e)&&6===e.type&&Se(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));const i=[];for(let t=0;e.data.payload.payload.length>t;t++)i.push(e.data.payload.payload[t]&&e.data.payload.payload[t].length>2e3?e.data.payload.payload[t].slice(0,2e3)+"...[truncated]":e.data.payload.payload[t]);return e.data.payload.payload=i,t}return t}(g),y=function(t){return Su(t)?t.data.payload:null}(m),b=function(t){return xu(t)?t.data.payload:null}(m),_=function(t){return ku(t)?t.data.payload:null}(m);y||b?(null==y?void 0:y.lastActivityTimestamp)&&(m.timestamp=y.lastActivityTimestamp):(null==_?void 0:_.sessionId)||this.si(m),2===e.type&&(this.Te.push([this.Xt,e.timestamp]),this.Te.length>6&&(this.Te=this.Te.slice(-6)));const w=null!==(s=null!==(r=null!==(o=null==y?void 0:y.currentSessionId)&&void 0!==o?o:null==b?void 0:b.nextSessionId)&&void 0!==r?r:null==_?void 0:_.sessionId)&&void 0!==s?s:this.Xt,k=null!==(l=null!==(a=null!==(u=null==y?void 0:y.currentWindowId)&&void 0!==u?u:null==b?void 0:b.nextWindowId)&&void 0!==a?a:null==_?void 0:_.windowId)&&void 0!==l?l:this.Be;if(!0===this.de&&!function(t){return ku(t)||Su(t)||xu(t)}(m))return void(function(t){return 2===t.type||4===t.type||3===t.type&&9!==t.data.source}(m)&&this.he++);2===m.type&&(this.he=0),_&&(m.timestamp=_.lastActivityTimestamp+_.threshold);const S=this.ae;this.ae=!0,p?this._n(!0):S||this._n();const x=null===(h=this._instance.config.session_recording.compress_events)||void 0===h||h;if(5===m.type&&"$json_ld"===m.data.tag){let e;try{e=t?this.gn(t.location.href):void 0}catch(t){}m.data.href=e}if(this.Oe>0||x&&pu(m))return void this.ri(m,x,w,k);const{event:C,size:T}=x?bu(m):{event:m,size:$o(m)};this.Jn(m,C,T,w,k)}get status(){return this.re?this.re.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.ee,rrwebError:this.we,urlTriggerMatching:this.Y,eventTriggerMatching:this.tt,linkedFlagMatching:this.et,remoteConfig:this.ne}):to}log(t,e="log"){var i;null===(i=this._instance.sessionRecording)||void 0===i||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.et.linkedFlagSeen=!0,this.jt(),this.$n(),this.qt("linked_flag_overridden")}overrideSampling(){var t;null===(t=this._instance.persistence)||void 0===t||t.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this.jt(),this.$n(),this.qt("sampling_overridden")}overrideTrigger(t){this.On(t),this.$n()}ai(){try{var e;const i=null==t||null===(e=t.location)||void 0===e?void 0:e.href;if(!i)return;const n=this.gn(i);if(!n)return;return new URL(n).hostname||void 0}catch(t){return}}qn(){this.li&&(clearTimeout(this.li),this.li=void 0)}Qn(){this.li||(this.li=setTimeout(()=>{this.tn()},2e3))}ui(){return this.Re!==this.Rt.sessionId&&0!==this.Rt.data.length&&this.Rt.data.every(t=>5===(null==t?void 0:t.type)&&!Su(t)&&!xu(t))}ci(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}di(t){if("buffering"!==t)return Ce(this.hi)||this._instance.register_for_session({[qt]:[]}),void(this.hi=void 0);const e=this.ci();if(0===e.length)return Ce(this.hi)||this._instance.register_for_session({[qt]:[]}),void(this.hi=void 0);const i=e.join(", "),n=`${this.sessionId}:${i}`;n!==this.hi&&(this.hi=n,this._instance.register_for_session({[qt]:e}),Xa.info(`buffering: ${i}`))}fi(){var t;return"memory"!==this._instance.config.persistence&&!0!==(null===(t=this._instance.persistence)||void 0===t?void 0:t.pi)&&Nl.Et()}mi(){0!==this.Rt.data.length&&this.Rt.size!==this.gi&&943718.4>=this.Rt.size&&this.fi()&&(this.gi=this.Rt.size,Nl.At(this.ln,this.Rt))}Dn(){if(this.Ee||!this.fi())return;this.Ee=!0;const t=Nl.Dt(this.ln);Nl.Lt(this.ln),Se(t)&&we(t.data)&&0!==t.data.length&&we(t.sizes)&&t.sizes.length===t.data.length&&Ee(t.size)&&t.sessionId===this.Xt&&t.windowId===this.Be&&(this.Rt.data.length>0||(this.Rt=t))}tn(t=!1){var e;if(this.qn(),this.me)return this.Rt;if(this.ui())return this.Rt.size>943718.4?this.en():(t&&this.mi(),this.Rt);const i=this.Rt;null===(e=this.re)||void 0===e||e.ensureSamplingDecision(this.sessionId);const n=this.Ge(),s=this.status;if(this.di(s),"buffering"===s||"paused"===s||"disabled"===s||n)return!t||"active"!==s&&"sampled"!==s||this.mi(),this.Qn(),this.Rt;if(this.Rt!==i)return this.Rt;if(i.data.length>0){var r;const t=this.ai();Io(i).forEach(e=>{try{var i;null===(i=this.He)||void 0===i||i.trackSize(e.sessionId,e.size),this.yi({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:ql.LIB_NAME,$lib_version:ql.LIB_VERSION,$snapshot_host:t})}catch(t){Xa.warn("could not capture snapshot chunk - skipping it",t)}}),Ce(this.gi)||(Nl.Lt(this.ln),this.gi=void 0),null===(r=this.re)||void 0===r||r.onFlushComplete()}return this.en()}Xn(t){var e;const i=2+((null===(e=this.Rt)||void 0===e?void 0:e.data.length)||0),n=t.$session_id,s=this.Rt.sessionId!==n;if(s||!0!==this.de&&!this.me&&this.Rt.size+t.$snapshot_bytes+i>943718.4){const e=this.Xt;if(this.Rt=this.tn(),this.Xt!==e)return;s&&this.Rt.data.length>0&&(this.Rt=this.en()),this.Rt.sessionId=n,this.Rt.windowId=t.$window_id}this.me&&(this.ye||this.Rt.size+t.$snapshot_bytes+i>943718.4)?this.ye||(this.ye=!0,this.Rt=this.en()):(this.Rt.size+=t.$snapshot_bytes,this.Rt.data.push(t.$snapshot_data),this.Rt.sizes.push(t.$snapshot_bytes),!0===this.de||this.me||this.Qn())}yi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.oe),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get Qe(){var t,e;const i=null===(t=this.Rt)||void 0===t?void 0:t.data[(null===(e=this.Rt)||void 0===e?void 0:e.data.length)-1];return i?i.timestamp-this._sessionStartTimestamp:null}oi(){if(!this.Rt||0===this.Rt.data.length)return this.en();let t=-1;for(let e=this.Rt.data.length-1;e>=0;e--)if(4===this.Rt.data[e].type){t=e;break}return 0>t?this.en():(this.Rt.data=this.Rt.data.slice(t),this.Rt.sizes=this.Rt.sizes.slice(t),this.Rt.size=this.Rt.sizes.reduce((t,e)=>t+e,0),this.Rt)}en(){return this.Rt={size:0,data:[],sizes:[],sessionId:this.Xt,windowId:this.Be},this.Rt}qt(t,e){this._instance.register_for_session({[Wt]:t}),Xa.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Vt("$recording_started",le({reason:t},e))}bi(t){var e;return 3===t.type&&-1!==tu.indexOf(null===(e=t.data)||void 0===e?void 0:e.source)}si(t){const e=this.bi(t);e||!0===this.de||t.timestamp-this.le>this.te&&(this.de=!0,clearInterval(this.Rn),this.Vt("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.le,threshold:this.te,bufferLength:this.Rt.data.length,bufferSize:this.Rt.size,sessionId:this.Xt,windowId:this.Be}),this.tn());const{windowId:i,sessionId:n}=this.Yt.checkAndGetSessionAndWindowId(!e,t.timestamp);let s=!1;if(e&&(this.le=t.timestamp,this.de)){const e="unknown"===this.de;this.de=!1,e||(this.Vt("sessionNoLongerIdle",{reason:"user activity",type:t.type}),s=!0)}const r=this.Xt!==n,o=this.Be!==i;if(this.Be=i,this.Xt=n,r||o){const t=r&&!1!==this.de;t&&(this.de="unknown"),this.ze(t)}else if(e&&this.$n(),s){var l;const t=["sampled","active"].includes(this.status)||(null===(l=this.re)||void 0===l?void 0:l.hasPendingTriggers(this.sessionId));this.he>0&&t&&this.jt(),this._n(),this.Tn()}}Ue(){var t;null===(t=this.re)||void 0===t||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e,i,n,s,r,o,l,a,u,h,c;const d=null===(t=iu())||void 0===t||null===(e=t.getDeferredStylesheetStats)||void 0===e?void 0:e.call(t);return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this.zn,$sdk_debug_replay_internal_buffer_length:this.Rt.data.length,$sdk_debug_replay_internal_buffer_size:this.Rt.size,$sdk_debug_current_session_duration:this.Qe,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(i=this.He)||void 0===i?void 0:i.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Te,$snapshot_max_depth_exceeded:this._e,$sdk_debug_replay_slowest_full_snapshot_ms:Ka(null===(n=this.Vn)||void 0===n?void 0:n.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:Ka(null===(s=this.Vn)||void 0===s?void 0:s.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null===(r=this.Vn)||void 0===r?void 0:r.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null===(o=this.Vn)||void 0===o?void 0:o.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null===(l=this.Vn)||void 0===l?void 0:l.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==d?void 0:d.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==d?void 0:d.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==d?void 0:d.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:Ka(null==d?void 0:d.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:Ka(null==d?void 0:d.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:Ka(null===(a=iu())||void 0===a||null===(u=a.getMutationCost)||void 0===u||null===(u=u.call(a))||void 0===u?void 0:u.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null===(h=iu())||void 0===h||null===(c=h.getDiscardedDurationSamples)||void 0===c?void 0:c.call(h),$sdk_debug_replay_throttled_mutations_dropped:this.fe,$sdk_debug_replay_oversized_mutations_dropped:this.ve,$sdk_debug_replay_oversized_mutation_bytes_dropped:this.pe,$sdk_debug_replay_rrweb_error:this.we,[zt]:!!this.se,[Ut]:this.ke}}Fn(){var e;if(this.se)return;this.ke=!0;const i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},s=this._instance.config.session_recording;for(const[t,e]of Object.entries(s||{}))if(t in i)if("maskInputOptions"===t)i.maskInputOptions=le({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=le(le({},i.slimDOMOptions),{},{script:!0})),this.hn&&this.hn.enabled&&(i.recordCanvas=!0,i.sampling=le(le({},i.sampling),{},{canvas:this.hn.fps}),i.dataURLOptions={type:"image/webp",quality:this.hn.quality},i.canvasResolutionScale=this.dn,i.canvasMasking={configured:()=>{var t;return ke(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(ke(i))try{var n;return null!==(n=i(t))&&void 0!==n?n:null}catch(t){return this.Me||(this.Me=!0,Xa.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.un&&(i.maskAllInputs=null===(r=this.un.maskAllInputs)||void 0===r||r,i.maskTextSelector=null!==(o=this.un.maskTextSelector)&&void 0!==o?o:void 0,i.blockSelector=null!==(l=this.un.blockSelector)&&void 0!==l?l:void 0,i.maskAllElementAttributes=null!==(a=this.un.maskAllElementAttributes)&&void 0!==a&&a),i.maskAllElementAttributes&&i.maskAttributeFn&&(i.maskAttributeFn=void 0,this.Ce||(this.Ce=!0,Xa.warn('`maskAllElementAttributes` and `maskAttributeFn` are mutually exclusive, and `maskAttributeFn` is being ignored. Remove one of the two. Note that `maskAllElementAttributes` can also come from your project\'s "Privacy and masking" settings. See https://posthog.com/docs/session-replay/privacy'))),this.cn();const u=nu();if(!u)return void Xa.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this.Hn=null!==(e=this.Hn)&&void 0!==e?e:new hl(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`;Xa.info(i,{node:e}),this.log("[SessionRecording] "+i,"warn")},onDroppedAttributeMutations:t=>this.fe+=t,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this.In,onDroppedOversizedMutation:t=>{0===this.ve&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this.ve+=1,this.pe+=t},requestFullSnapshot:()=>this.jt()});const h=this.pn();if(this.se=u(le({emit:t=>{this.onRRwebEmit(t)},plugins:h,errorHandler:(t,e)=>"rrweb"===e&&(this.Ie||(this.Ie=!0,Xa.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},i)),!this.se)return this.we=!0,void Xa.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.we=!1,!0===(null==s?void 0:s.captureJsonLd)&&n&&(null==t?void 0:t.MutationObserver)&&!this.Sn&&(this.Sn=function(t,e,i){const n=new WeakMap,s=i.getCaptureState||(()=>!0);let r=Ta;const o=function(t,e){const i=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?Ea:i=>{const n=t.getElementById(i);return!!n&&"SCRIPT"!==n.nodeName&&(!e.isRecordedElement||e.isRecordedElement(n))&&!Qa(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 Qa(t,e.blockClass,e.blockSelector)||Qa(t,e.maskTextClass,e.maskTextSelector)}(e,i))return;const a=function(t,e=Ea,i){if(!t||t.length>Ta)return null;try{const n=JSON.parse(t),s={maskUrl:i,remainingNodes:2048,exceeded:!1},r=we(n)?n.map(t=>Va(t,e,s)):Va(n,e,s);if(s.exceeded||Ie(r)||we(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,h]=a;if(Ie(l))return void n.set(e,h);if(n.get(e)!==h){if(h.length>r)return void(r=0);i.emit(u)&&(n.set(e,h),r-=h.length)}}catch(t){return}};try{const i=new e(t=>{try{if(!r||!1===s())return;const e=t=>{for(const e of Ja(t))l(e)};for(const i of t)if("childList"===i.type)Ga(i.target)&&l(i.target),i.addedNodes.forEach(e);else if("characterData"===i.type){const t=i.target.parentNode;t&&Ga(t)&&l(t)}else"attributes"===i.type&&Ga(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()&&Ja(t.documentElement).forEach(t=>{e&&n.delete(t),l(t)})},stop(){return i.disconnect()}}}catch(t){return{scan(){},stop(){}}}}(n,t.MutationObserver,{maskUrl:t=>this.gn(t),attributeFilter:i.attributeFilter,blockClass:i.blockClass,blockSelector:i.blockSelector,isRecordedElement:t=>u.mirror.getId(t)>0,maskAllElementAttributes:i.maskAllElementAttributes,maskAttributeFn:i.maskAttributeFn,maskTextClass:i.maskTextClass,maskTextSelector:i.maskTextSelector,getCaptureState:()=>{var t;return!0!==(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)||this.Y.urlBlocked||this.Y.isCurrentUrlBlocked()?null:this.wn()},emit:t=>this.kn(t)}),this.Y.isCurrentUrlBlocked()&&this.Sn.scan()),this.le=Date.now(),this.de=Re(this.de)?this.de:"unknown",this.tryAddCustomEvent("$remote_config_received",this.ne),this.Vt("$session_options",{sessionRecordingOptions:i,activePlugins:h.map(t=>null==t?void 0:t.name)}),this.Vt("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(t,e){return this.Vt(t,e)}};const $u=["type"];var Tu=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}({}),Iu=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}({}),Mu=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}({}),Eu=function(t){return t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t}({}),Pu=function(t){return t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t}({}),Ru=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}({}),Au=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 Fu(t,e){return-1!==t.indexOf(e)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date;var Ou={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Du={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Lu={};function Nu(t){if(Lu[t])return Lu[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 Ou?Ou[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 Du?Du[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 Lu[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 Fu(t,"AppleWebKit")&&!Fu(t,"Chrome")}(navigator.userAgent)&&(l.classList.add("rr-block","ph-no-capture"),l.setAttribute("__rrwebUntaintedPrototype",t),a=!0),Lu[t]=s):i}catch(t){return i}finally{!a&&l.parentNode&&document.body.removeChild(l)}}var qu=Object.create(null);function ju(t,e,i){var n;const s=qu[t],r=s[i];if(r)return r.call(e);const o=Nu(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]}qu.Node=Object.create(null),qu.ShadowRoot=Object.create(null),qu.MutationObserver=Object.create(null),qu.Element=Object.create(null);var Bu,Hu={};function zu(t,e,i){const n=`${t}.${String(i)}`;if(Hu[n])return Hu[n].bind(e);const s=Nu(t)[i];return"function"!=typeof s?e[i]:(Hu[n]=s,s.bind(e))}function Uu(){return Nu("MutationObserver").constructor}function Wu(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 Vu={childNodes:t=>ju("Node",t,"childNodes"),parentNode:t=>ju("Node",t,"parentNode"),parentElement:t=>ju("Node",t,"parentElement"),textContent:t=>ju("Node",t,"textContent"),isConnected(t){if(void 0===Bu){var e;const t=null===(e=Object.getOwnPropertyDescriptor(Nu("Node"),"isConnected"))||void 0===e?void 0:e.get;Bu=(null==t?void 0:t.toString().includes("[native code]"))?t:null}return null==Bu?void 0:Bu.call(t)},contains:(t,e)=>zu("Node",t,"contains")(e),getRootNode:t=>zu("Node",t,"getRootNode")(),host:t=>t&&"host"in t?ju("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?ju("Element",t,"shadowRoot"):null,querySelector:(t,e)=>zu("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>zu("Element",t,"querySelectorAll")(e),mutationObserver:Uu,patch:Wu};function Gu(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var Zu=0;function Qu(){Zu+=1}function Ju(){return Zu}function Ku(t,e){return(e!==Zu||t>6e4)&&!0}var Yu=0,Xu=0,th=0,eh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},ih=null,nh=null,sh=[],rh=0,oh=0,lh={slowestBatchMs:0},ah={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function uh(t){(Yu+=1)>1||(eh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},sh=[],rh=0,nh=(t=>t&&t>0?t:null)(t),Xu=Gu(),th=Zu)}function hh(){return 0===Yu?ih||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(Yu-=1)>0?eh:(eh.durationMs=Gu()-Xu,eh.deferredStylesheetCount=rh,ah.deferredCount+=rh,nh=null,Ku(eh.durationMs,th)?eh:ih=eh)}function ch(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+=ch(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+=ch(s,e,i+1))}}}catch(t){}}return n}function dh(t){if(0===Yu)return;const e=ch(t,null,0);eh.cssRuleCount+=e,oh>0&&(eh.nonDeferrableCssRuleCount+=e)}function vh(t){oh+=1;try{return t()}finally{oh-=1}}function fh(t){Yu>0&&(eh.stylesheetMs+=t)}function ph(t){if(0===Yu||null===nh)return!1;const e=eh.cssRuleCount-eh.nonDeferrableCssRuleCount;return e>=nh||e+function(t){try{const e=t&&(t.rules||t.cssRules);if(!e)return 0;const i=new WeakSet;return i.add(t),ch(e,i,0)}catch(t){return 0}}(t)>nh}function gh(){const t=sh;return sh=[],t}function mh(){ah.failedCount+=1}function yh(t){t>0&&(ah.abandonedCount+=t)}function bh(t){return bh="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},bh(t)}function _h(t,e,i){return(e=function(t){var e=function(t){if("object"!=bh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=bh(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==bh(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function wh(t){return t.nodeType===t.ELEMENT_NODE}function kh(t){const e=t&&"host"in t&&"mode"in t&&Vu.host(t)||null;return Boolean(e&&"shadowRoot"in e&&Vu.shadowRoot(e)===t)}function Sh(t){return"[object ShadowRoot]"==={}.toString.call(t)}function xh(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 Ch(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 $h=0;function Th(t){const e=0===$h,i=e?Gu():0;$h+=1;try{const e=t.rules||t.cssRules;if(!e)return null;dh(e);let i=t.href;return!i&&t.ownerNode&&(i=t.ownerNode.baseURI),xh(Array.from(e,t=>Ih(t,i)).join(""))}catch(t){return null}finally{$h-=1,e&&fh(Gu()-i)}}function Ih(t,e){if(Eh(t)){let e;try{e=Th(t.styleSheet)||Ch(t)}catch(i){e=t.cssText}try{var i;if(e&&(null===(i=t.styleSheet)||void 0===i?void 0:i.href))return Vh(e,t.styleSheet.href)}catch(t){}return e}{let i=t.cssText;return Ph(t)&&t.selectorText.includes(":")&&(i=Mh(i)),e?Vh(i,e):i}}function Mh(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function Eh(t){return"styleSheet"in t}function Ph(t){return"selectorText"in t}var Rh=/^-?[A-Za-z_][\w-]*$/,Ah=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Fh(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||Ch(e)}catch(t){s=e.cssText}try{var n;s&&(null===(n=e.styleSheet)||void 0===n?void 0:n.href)&&(s=Vh(s,e.styleSheet.href))}catch(t){}s&&t.parts.push(s),t.index+=1}catch(t){r(null)}}function l(t){const i=t.rules[t.index];if("sheet"===t.kind&&Eh(i)){const n=s.get(i);return null===n?(t.parts.push(i.cssText),void(t.index+=1)):n?void e.push({kind:"sheet",sheet:n.sheet,rules:n.rules,sheetHref:n.sheetHref,index:0,parts:[],importRule:i}):void o(t,i,null)}if(function(t,i){try{const n=function(t){const e=t;if(!e.cssRules||0===e.cssRules.length)return null;if(e.media&&"string"==typeof e.media.mediaText)return`@media ${e.media.mediaText} {`;if(Ph(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&&!Rh.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]?Rh.test(e.name)?`@keyframes ${e.name} {`:null:""===e.name?"@layer {":Ah.test(e.name)?`@layer ${e.name} {`:null:null}(t);if(null===n)return!1;const s=i.sheetHref;return e.push({kind:"group",rules:Array.from(t.cssRules),sheetHref:s,index:0,parts:[],prelude:s?Vh(n,s):n,fixColons:"sheet"===i.kind&&Ph(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(i,t))return;let n=i.cssText;"sheet"===t.kind&&Ph(i)&&i.selectorText.includes(":")&&(n=Mh(n)),t.parts.push(t.sheetHref?Vh(n,t.sheetHref):n),t.index+=1}return function(t){try{const i=t.rules||t.cssRules;if(!i)return!1;dh(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,!Eh(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;dh(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=Gu();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?Mh(i):i}else e=xh(t.parts.join(""))}catch(t){}r(e);continue}o-=1;try{l(t)}catch(t){r(null)}}}catch(t){i=!0,n=null}finally{fh(Gu()-s)}return i},text:()=>i?n:null,remainingRules(){if(i)return 0;let t=0;for(const i of e)t+=i.rules.length-i.index;return t}}}var Oh=class{constructor(){_h(this,"idNodeMap",new Map),_h(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)),wh(t)){const e=Vu.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 Dh({element:t,maskInputOptions:e,tagName:i,type:n,value:s,maskInputFn:r}){let o=s||"";const l=n&&Lh(n);return(e[i.toLowerCase()]||l&&e[l])&&(o=r?r(o,t):"*".repeat(o.length)),o}function Lh(t){return t.toLowerCase()}var Nh=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 qh({element:t,name:e,value:i,maskAllElementAttributes:n,maskAttributeFn:s,isGenerated:r=!1}){return i?n?r&&Nh.has(Lh(e))?i:"*".repeat(i.length):s?s(e,i,t):i:i}var jh="__rrweb_original__";function Bh(t){try{const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?Lh(e):null}catch(t){return null}}var Hh=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,zh=/^(?:[a-z+]+:)?\/\//i,Uh=/^www\..*/i,Wh=/^(data:)([^,]*),(.*)/i;function Vh(t,e){return(t||"").replace(Hh,(t,i,n,s,r,o)=>{const l=n||r||o,a=i||s||"";if(!l)return t;if(zh.test(l)||Uh.test(l))return`url(${a}${l}${a})`;if(Wh.test(l))return`url(${a}${l}${a})`;if("/"===l[0])return`url(${a}${function(t){let e="";return e=t.indexOf("//")>-1?t.split("/").slice(0,3).join("/"):t.split("/")[0],e=e.split("?")[0],e}(e)+l}${a})`;const u=e.split("/"),h=l.split("/");u.pop();for(const t of h)"."!==t&&(".."===t?u.pop():u.push(t));return`url(${a}${u.join("/")}${a})`})}var Gh,Zh,Qh=new Map,Jh=1,Kh=new RegExp("[^a-z0-9-_:]");function Yh(){return Jh++}var Xh=/^[^ \t\n\r\u000c]+/,tc=/^[, \t\n\r\u000c]+/,ec=new WeakMap;function ic(t,e){return e&&""!==e.trim()?nc(t,e):e}function nc(t,e){let i=ec.get(t);if(i||(i=t.createElement("a"),ec.set(t,i)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return i.setAttribute("href",e),i.href}function sc(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 rc(t,e,i,n,s,r){if(!n)return n;if("src"===i||"href"===i&&("use"!==e||"#"!==n[0])){if("link"===e&&s){var o;const t=null===(o=s.sheet)||void 0===o?void 0:o.href;if(t)return t}const i=ic(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=Qh.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(Qh.size>=10){const t=Qh.keys().next().value;void 0!==t&&Qh.delete(t)}return Qh.set(e,{type:i,quality:n,result:l}),l}catch(t){return e}}(s,i,r.type,r.quality)),sc(t,r)}if("image"===e)return sc(i,r)}return i}if("xlink:href"===i&&"#"!==n[0]){const i=ic(t,n);return"image"===e&&i.startsWith("data:")?sc(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(tc),e.length>i;){let r=n(Xh);if(","===r.slice(-1))r=ic(t,r.substring(0,r.length-1)),s.push(r);else{let n="";r=ic(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?Vh(n,nc(t)):"object"===e&&"data"===i?ic(t,n):n:ic(t,n)}function oc(t,e,i){return("video"===t||"audio"===t)&&"autoplay"===e}function lc(t,e,i){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!i&&lc(Vu.parentNode(t),e,i);for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!i&&lc(Vu.parentNode(t),e,i)}function ac(t,e,i,n){let s;if(wh(t)){if(s=t,!Vu.childNodes(s).length)return!1}else{if(null===Vu.parentElement(t))return!1;s=Vu.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(lc(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 uc(t,e,i){const n=t.removeEventListener;"function"==typeof n&&n.call(t,e,i)}var hc=new Map;function cc(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function dc(t){return null==t?"":t.toLowerCase()}var vc=!1,fc=!1;function pc(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,maskTextClass:o,maskTextSelector:l,skipChild:a=!1,inlineStylesheet:u=!0,maskInputOptions:h={},maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v=!1,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g={},inlineImages:m=!1,recordCanvas:y=!1,canvasMaskingConfigured:b,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k=5e3,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:T=()=>!1,newlyAddedElement:I=!1,depth:M=0,maxDepth:E=50}=e;let{needsMask:P}=e,{preserveWhiteSpace:R=!0}=e;if(M>=E)return fc=!0,vc||(vc=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${E}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;P||(P=ac(t,o,l,void 0===P)),Yu>0&&(eh.nodeCount+=1);const A=function(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:o,inlineStylesheet:l,maskInputOptions:a={},maskTextFn:u,maskInputFn:h,maskAllElementAttributes:c=!1,maskAttributeFn:d,dataURLOptions:v={},inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y=!1}=e,b=function(t,e){if(!e.hasNode(t))return;const i=e.getId(t);return 1===i?void 0:i}(i,n);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:Au.Document,childNodes:[],compatMode:t.compatMode}:{type:Au.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:Au.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:b};case t.ELEMENT_NODE:return function(t,e){const{doc:i,blockClass:n,blockSelector:s,inlineStylesheet:r,maskInputOptions:o={},maskInputFn:l,maskAllElementAttributes:a=!1,maskAttributeFn:u,dataURLOptions:h={},inlineImages:c,recordCanvas:d,canvasMaskingConfigured:v,keepIframeSrcFn:f,newlyAddedElement:p=!1,rootId:g}=e,m=function(t,e,i){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(i)return t.matches(i)}catch(t){}return!1}(t,n,s),y=function(t){if(t instanceof HTMLFormElement)return"form";const e=Lh(t.tagName);return Kh.test(e)?"div":e}(t),b=new Set;let _={};const w=t.attributes.length;for(let e=0;w>e;e++){const n=t.attributes[e];oc(y,n.name)||(_[n.name]=rc(i,y,Lh(n.name),n.value,t,h))}if("link"===y&&r&&!m){let e=t.sheet;if(!e){const n=function(t){return t.href}(t);n&&(e=cc(i,n),!e&&n.includes(".css"))&&(e=cc(i,window.location.origin+"/"+n.replace(window.location.href,"")))}let n=null;e&&(ph(e)?Yu>0&&(sh.push(t),rh+=1):n=Th(e)),n&&(delete _.rel,delete _.href,_._cssText=n)}if("style"===y&&t.sheet&&!(t.innerText||Vu.textContent(t)||"").trim().length){const e=vh(()=>Th(t.sheet));e&&(_._cssText=e)}if("input"===y||"textarea"===y||"select"===y){const e=t.value,i=t.checked;"radio"!==_.type&&"checkbox"!==_.type&&"submit"!==_.type&&"button"!==_.type&&e?_.value=Dh({element:t,type:Bh(t),tagName:y,value:e,maskInputOptions:o,maskInputFn:l}):i&&(_.checked=i)}if("option"===y&&(t.selected&&!o.select?_.selected=!0:delete _.selected),"dialog"===y&&t.open){try{_.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){_.rr_open_mode="modal",_.ph_rr_could_not_detect_modal=!0}b.add("rr_open_mode")}if("canvas"===y&&d&&!(null==v?void 0:v()))if("2d"===t.__context)(function(t){const e=t.getContext("2d");if(!e)return!0;for(let i=0;t.width>i;i+=50)for(let n=0;t.height>n;n+=50){const s=e.getImageData;if(new Uint32Array((jh in s?s[jh]:s).call(e,i,n,Math.min(50,t.width-i),Math.min(50,t.height-n)).data.buffer).some(t=>0!==t))return!1}return!0})(t)||(_.rr_dataURL=t.toDataURL(h.type,h.quality));else if(!("__context"in t)){const e=t.toDataURL(h.type,h.quality),n=i.createElement("canvas");n.width=t.width,n.height=t.height,e!==n.toDataURL(h.type,h.quality)&&(_.rr_dataURL=e)}let k,S=!1;if("img"===y&&c){Gh||(Gh=i.createElement("canvas"),Zh=Gh.getContext("2d"));const e=t,n=e.currentSrc||e.getAttribute("src")||"<unknown-src>",s=e.crossOrigin,r=(e,i)=>S?qh({element:t,name:e,value:i,maskAllElementAttributes:a,maskAttributeFn:u}):i,o=()=>{uc(e,"load",o);try{Gh.width=e.naturalWidth,Gh.height=e.naturalHeight,Zh.drawImage(e,0,0);const t=Gh.toDataURL(h.type,h.quality);_.rr_dataURL=r("rr_dataURL",t)}catch(t){if("anonymous"!==e.crossOrigin)return e.crossOrigin="anonymous",void(e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o));console.warn(`Cannot inline img src=${n}! Error: ${t}`)}"anonymous"===e.crossOrigin&&(s?_.crossOrigin=r("crossOrigin",s):e.removeAttribute("crossorigin"))};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if("audio"===y||"video"===y){const e=_;e.rr_mediaState=t.paused?"paused":"played",b.add("rr_mediaState"),e.rr_mediaCurrentTime=t.currentTime,e.rr_mediaPlaybackRate=t.playbackRate,e.rr_mediaMuted=t.muted,e.rr_mediaLoop=t.loop,e.rr_mediaVolume=t.volume}if(p||(t.scrollLeft&&(_.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(_.rr_scrollTop=t.scrollTop)),m){var x,C,T;const{width:e,height:n,left:s,top:r}=t.getBoundingClientRect(),o=null===(x=i.defaultView)||void 0===x?void 0:x.getComputedStyle(t);_={class:_.class,rr_width:`${e}px`,rr_height:`${n}px`,rr_left:`${Math.floor(s+((null===(C=i.defaultView)||void 0===C?void 0:C.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(T=i.defaultView)||void 0===T?void 0:T.scrollY)||0))}px`},b.add("rr_width"),b.add("rr_height"),b.add("rr_left"),b.add("rr_top"),o&&(_.rr_position=o.position||"static",b.add("rr_position"),o.transform&&"none"!==o.transform&&(_.rr_transform=o.transform,b.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(_.rr_display=o.display,b.add("rr_display")))}if("iframe"!==y||f(_.src)||(t.contentDocument||(_.rr_src=_.src),delete _.src),a||u)for(const[e,i]of Object.entries(_))"string"!=typeof i&&null!==i||(_[e]=qh({element:t,name:e,value:i,maskAllElementAttributes:a,maskAttributeFn:u,isGenerated:b.has(e)}));S=!0;try{customElements.get(y)&&(k=!0)}catch(t){}return{type:Au.Element,tagName:y,attributes:_,childNodes:[],isSVG:(I=t,Boolean("svg"===I.tagName||I.ownerSVGElement)||void 0),needBlock:m,rootId:g,isCustom:k};var I}(t,{doc:i,blockClass:s,blockSelector:r,inlineStylesheet:l,maskInputOptions:a,maskInputFn:h,maskAllElementAttributes:c,maskAttributeFn:d,dataURLOptions:v,inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y,rootId:b});case t.TEXT_NODE:return function(t,e){const{needsMask:i,maskTextFn:n,rootId:s}=e,r=Vu.parentNode(t),o=r&&r.tagName;let l=Vu.textContent(t);const a="STYLE"===o||void 0,u="SCRIPT"===o||void 0;if(a&&l){try{var h;if(t.nextSibling||t.previousSibling);else if(ph(r.sheet));else if(null===(h=r.sheet)||void 0===h?void 0:h.cssRules){const t=Th(r.sheet);t&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(t)&&(l=t)}}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}l=Vh(l,nc(e.doc))}return u&&(l="SCRIPT_PLACEHOLDER"),!a&&!u&&l&&i&&(l=n?n(l,Vu.parentElement(t)):l.replace(/[\S]/g,"*")),{type:Au.Text,textContent:l||"",isStyle:a,rootId:s}}(t,{doc:i,needsMask:o,maskTextFn:u,rootId:b});case t.CDATA_SECTION_NODE:return{type:Au.CDATA,textContent:"",rootId:b};case t.COMMENT_NODE:return{type:Au.Comment,textContent:Vu.textContent(t)||"",rootId:b};default:return!1}}(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,keepIframeSrcFn:T,newlyAddedElement:I});if(!A)return console.warn(t,"not serialized"),null;let F;F=n.hasNode(t)?n.getId(t):function(t,e){if(e.comment&&t.type===Au.Comment)return!0;if(t.type===Au.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&&(dc(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===dc(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(dc(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&dc(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(dc(t.attributes.property).match(/^(og|twitter|fb):/)||dc(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===dc(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(dc(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(dc(t.attributes.name))||dc(t.attributes.property).match(/^article:/)||dc(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(dc(t.attributes.name)))return!0}}return!1}(A,p)||!R&&A.type===Au.Text&&!A.isStyle&&!A.textContent.replace(/^\s+|\s+$/gm,"").length?-2:Yh();const O=Object.assign(A,{id:F});if(n.add(t,O),-2===F)return null;_&&_(t);let D=!a;if(O.type===Au.Element){D=D&&!O.needBlock,delete O.needBlock;const e=Vu.shadowRoot(t);e&&Sh(e)&&(O.isShadowHost=!0)}if((O.type===Au.Document||O.type===Au.Element)&&D){p.headWhitespace&&O.type===Au.Element&&"head"===O.tagName&&(R=!1);const e={doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:l,skipChild:a,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:R,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:M+1,maxDepth:E};if(O.type===Au.Element&&"textarea"===O.tagName&&void 0!==O.attributes.value);else for(const i of Array.from(Vu.childNodes(t))){const t=pc(i,e);t&&O.childNodes.push(t)}let I=null;if(wh(t)&&(I=Vu.shadowRoot(t)))for(const t of Array.from(Vu.childNodes(I))){const i=pc(t,e);i&&(Sh(I)&&(i.isShadow=!0),O.childNodes.push(i))}}const L=Vu.parentNode(t);if(L&&kh(L)&&Sh(L)&&(O.isShadow=!0),O.type===Au.Element&&"iframe"===O.tagName){const e=function(t,e,i){const n=()=>{},s=t.contentWindow;if(!s)return n;let r;try{r=s.document.readyState}catch(t){return n}const o=()=>e();if("complete"!==r){let n=!1,s=null;const r=()=>{n||(n=!0,null!==s&&(clearTimeout(s),s=null),uc(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?uc(t,"load",o):(n=!0,uc(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),uc(t,"load",o)}}return t.addEventListener("load",o),()=>{uc(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&w){const i=pc(e,{doc:e,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:R,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:M+1,maxDepth:E});i&&w(t,i)}},k);null==S||S(t,e)}return O.type===Au.Element&&"link"===O.tagName&&"stylesheet"===O.attributes.rel&&function(e,a,S){if(hc.has(e))return;let I;try{I=e.sheet}catch(t){return}if(I)return;const A=new AbortController;let F=!1;const O=()=>{if(!F){F=!0;try{(()=>{if(x){const e=pc(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:R,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:M,maxDepth:E});e&&x(t,e)}})()}finally{hc.delete(e),A.abort()}}},D=setTimeout(O,S);A.signal.addEventListener("abort",()=>clearTimeout(D),{once:!0}),e.addEventListener("load",O,{signal:A.signal,once:!0}),hc.set(e,A)}(t,0,C),O}function gc(t){return!0===t||"all"===t?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===t,headMetaDescKeywords:"all"===t,headTitleMutations:"all"===t}:!1===t?{}:t}var mc=class t{constructor(...t){_h(this,"parentElement",null),_h(this,"parentNode",null),_h(this,"ownerDocument",void 0),_h(this,"firstChild",null),_h(this,"lastChild",null),_h(this,"previousSibling",null),_h(this,"nextSibling",null),_h(this,"ELEMENT_NODE",1),_h(this,"TEXT_NODE",3),_h(this,"nodeType",void 0),_h(this,"nodeName",void 0),_h(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 yc(t,e,i=document){const n={capture:!0,passive:!0};return i.addEventListener(t,e,n),()=>bc(i,t,e,n)}function bc(t,e,i,n){_c(()=>{const s=t.removeEventListener;"function"==typeof s&&(void 0!==n?s.call(t,e,i,n):s.call(t,e,i))})}function _c(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function wc(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var kc="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.",Sc={map:{},getId(){return console.error(kc),-1},getNode(){return console.error(kc),null},removeNodeFromMap(){console.error(kc)},has(){return console.error(kc),!1},reset(){console.error(kc)}};function xc(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 Cc(t,e,i,n,s=window){const r=s.Object.getOwnPropertyDescriptor(t,e);return s.Object.defineProperty(t,e,n?i:{set(t){if(setTimeout(()=>{try{i.set.call(this,t)}catch(t){}},0),r&&r.set){if(r.get)try{r.get.call(this)}catch(t){return}r.set.call(this,t)}}}),()=>Cc(t,e,r||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Sc=new Proxy(Sc,{get(t,e,i){return"map"===e&&console.error(kc),Reflect.get(t,e,i)}}));var $c=Date.now;function Tc(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=Vu.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=Vu.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 Ic(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Mc(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ec(t){return t?t.nodeType===t.ELEMENT_NODE?t:Vu.parentElement(t):null}function Pc(t,e,i,n){if(!t)return!1;const s=Ec(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(lc(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 Rc(t,e,i){return!("TITLE"!==t.tagName||!i.headTitleMutations)||-2===e.getId(t)}function Ac(t,e){if(kh(t))return!1;const i=e.getId(t);if(!e.has(i))return!0;const n=Vu.parentNode(t);return(!n||n.nodeType!==t.DOCUMENT_NODE)&&(!n||Ac(n,e))}function Fc(t){return Boolean(t.changedTouches)}function Oc(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Dc(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Lc(t){return!!t&&(t instanceof mc&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(Vu.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||($c=()=>(new Date).getTime());var Nc=class{constructor(){_h(this,"id",1),_h(this,"styleIDMap",new WeakMap),_h(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 qc(t){var e;let i=null;return"getRootNode"in t&&(null===(e=Vu.getRootNode(t))||void 0===e?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Vu.host(Vu.getRootNode(t))&&(i=Vu.host(Vu.getRootNode(t))),i}function jc(t){const e=t.ownerDocument;if(!e)return!1;if(Vu.contains(e,t))return!0;const i=Vu.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=qc(i);)i=e;return i}(t);return Vu.contains(e,i)}(t)}function Bc(t){return"__ln"in t}var Hc,zc=class{constructor(){_h(this,"length",0),_h(this,"head",null),_h(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let e=this.head;for(let i=0;t>i;i++)e=(null==e?void 0:e.next)||null;return e}addNode(t){const e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&Bc(t.previousSibling)){const i=t.previousSibling.__ln.next;e.next=i,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,i&&(i.previous=e)}else if(t.nextSibling&&Bc(t.nextSibling)&&t.nextSibling.__ln.previous){const i=t.nextSibling.__ln.previous;e.previous=i,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,i&&(i.next=e)}else this.head&&(this.head.previous=e),e.next=this.head,this.head=e;null===e.next&&(this.tail=e),this.length++}removeNode(t){const e=t.__ln;this.head&&(e.previous?(e.previous.next=e.next,e.next?e.next.previous=e.previous:this.tail=e.previous):(this.head=e.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},Uc=(t,e)=>`${t}@${e}`,Wc=class{constructor(){_h(this,"frozen",!1),_h(this,"locked",!1),_h(this,"texts",[]),_h(this,"attributes",[]),_h(this,"attributeMap",new WeakMap),_h(this,"generatedAttributes",new WeakMap),_h(this,"removes",[]),_h(this,"mapRemoves",new Set),_h(this,"movedMap",{}),_h(this,"addedSet",new Set),_h(this,"movedSet",new Set),_h(this,"droppedSet",new Set),_h(this,"removesSubTreeCache",new Set),_h(this,"mutationCb",void 0),_h(this,"blockClass",void 0),_h(this,"blockSelector",void 0),_h(this,"maskTextClass",void 0),_h(this,"maskTextSelector",void 0),_h(this,"inlineStylesheet",void 0),_h(this,"maskInputOptions",void 0),_h(this,"maskTextFn",void 0),_h(this,"maskInputFn",void 0),_h(this,"maskAllElementAttributes",void 0),_h(this,"maskAttributeFn",void 0),_h(this,"keepIframeSrcFn",void 0),_h(this,"recordCanvas",void 0),_h(this,"canvasMaskingConfigured",void 0),_h(this,"inlineImages",void 0),_h(this,"slimDOMOptions",void 0),_h(this,"dataURLOptions",void 0),_h(this,"doc",void 0),_h(this,"mirror",void 0),_h(this,"iframeManager",void 0),_h(this,"stylesheetManager",void 0),_h(this,"shadowDomManager",void 0),_h(this,"canvasManager",void 0),_h(this,"processedNodeManager",void 0),_h(this,"unattachedDoc",void 0),_h(this,"canvasManagerReleased",!1),_h(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),_h(this,"emit",()=>{if(this.frozen||this.locked)return;const t=Gu(),e=Ju();try{this.processBufferedMutations()}finally{i=Gu()-t,n=e,Yu>0||Ku(i,null!=n?n:Zu)||i>lh.slowestBatchMs&&(lh.slowestBatchMs=i)}var i,n}),_h(this,"processBufferedMutations",()=>{const t=[],e=new Set,i=new zc,n=t=>{let e=t,i=-2;for(;-2===i;)e=e&&e.nextSibling,i=e&&this.mirror.getId(e);return i};let s;const r=r=>{var o;const l=Vu.parentNode(r);if(!l||!jc(r)||"TEXTAREA"===l.tagName)return;if(this.isBlockedAtEmission(l))return;const a=kh(l)?this.mirror.getId(qc(r)):this.mirror.getId(l),u=n(r);if(-1===a||-1===u)return i.addNode(r);null!==(o=s)&&void 0!==o||(s={doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:t=>{Oc(t,this.mirror)&&this.iframeManager.addIframe(t),Dc(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Lc(t)&&!Pc(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(Vu.shadowRoot(t),this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onIframeListenerRegistered:(t,e)=>{this.iframeManager.registerLoadListenerDisposer(t,e)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}});const h=pc(r,s);h&&(t.push({parentId:a,nextId:u,node:h}),e.add(h.id))};for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t);for(const t of this.movedSet)Gc(this.removesSubTreeCache,t)&&!this.movedSet.has(Vu.parentNode(t))||r(t);for(const t of this.addedSet)Zc(this.droppedSet,t)||Gc(this.removesSubTreeCache,t)?Zc(this.movedSet,t)?r(t):this.droppedSet.add(t):r(t);let o=null;for(;i.length;){let t=null;if(o){const e=this.mirror.getId(Vu.parentNode(o.value)),i=n(o.value);-1!==e&&-1!==i&&(t=o)}if(!t){let e=i.tail;for(;e;){const i=e;if(e=e.previous,i){const e=this.mirror.getId(Vu.parentNode(i.value));if(-1===n(i.value))continue;if(-1!==e){t=i;break}{const e=Vu.parentNode(i.value);if(e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=Vu.host(e);if(-1!==this.mirror.getId(n)){t=i;break}}}}}}if(!t){for(;i.head;)i.removeNode(i.head.value);break}o=t.previous,i.removeNode(t.value),r(t.value)}const l={texts:this.texts.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const e=t.node,i=Vu.parentNode(e);return i&&"TEXTAREA"===i.tagName&&this.genTextAreaValueMutation(i),{id:this.mirror.getId(e),value:t.value}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),attributes:this.attributes.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const{attributes:e}=t;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof e.style){const i=JSON.stringify(t.styleDiff),n=JSON.stringify(t._unchangedStyles);e.style.length>i.length&&(i+n).split("var(").length===e.style.split("var(").length&&(e.style=t.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(const[n,s]of Object.entries(e))if("string"==typeof s||null===s){var i;e[n]=qh({element:t.node,name:n,value:s,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(i=this.generatedAttributes.get(t.node))||void 0===i?void 0:i.has(n)})}return{id:this.mirror.getId(t.node),attributes:e}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),removes:this.removes,adds:t};this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.generatedAttributes=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},(l.texts.length||l.attributes.length||l.removes.length||l.adds.length)&&this.mutationCb(l)}),_h(this,"bufferBelongsToIframe",t=>this.doc===t.contentDocument),_h(this,"genTextAreaValueMutation",t=>{let e=this.attributeMap.get(t);e||(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(e),this.attributeMap.set(t,e));const i=Array.from(Vu.childNodes(t),t=>Vu.textContent(t)||"").join("");e.attributes.value=Dh({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Bh(t),value:i,maskInputFn:this.maskInputFn})}),_h(this,"processMutation",t=>{if(!Rc(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const e=Vu.textContent(t.target);Pc(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:ac(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,Ec(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break}case"attributes":{var e;const n=t.target,s=t.attributeName,r=null!==(e=t.attributeNamespace)&&void 0!==e?e:null;let o=function(t,e,i){if(!i)return e;const n=t.getAttributeNodeNS(i,e);if(n)return n.name;if("http://www.w3.org/1999/xlink"===i)return`xlink:${e}`;if("http://www.w3.org/XML/1998/namespace"===i)return`xml:${e}`;if("http://www.w3.org/2000/xmlns/"===i)return"xmlns"===e?e:`xmlns:${e}`;const s=t.lookupPrefix(i);return s?`${s}:${e}`:e}(n,s,r),l=r?n.getAttributeNS(r,s):t.target.getAttribute(s);if("value"===o){const t=n,e=Bh(t);l=Dh({element:t,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:l,maskInputFn:this.maskInputFn})}if(Pc(t.target,this.blockClass,this.blockSelector,!1)||l===t.oldValue)return;let a=this.attributeMap.get(t.target);const u="IFRAME"===n.tagName&&"src"===o;if(u&&!this.keepIframeSrcFn(l)&&n.contentDocument)return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(t.target,a)),"type"===o&&"INPUT"===n.tagName&&"password"===(t.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!oc(n.tagName,o)){var i;const e=rc(this.doc,Lh(n.tagName),Lh(o),l,n,this.dataURLOptions);if(u&&!this.keepIframeSrcFn(l)&&(o="rr_src"),a.attributes[o]=e,null===(i=this.generatedAttributes.get(t.target))||void 0===i||i.delete(o),"style"===o){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const e=this.unattachedDoc.createElement("span"),i=n.style;t.oldValue&&(e.style.cssText=t.oldValue);for(const t of Array.from(i)){const n=i.getPropertyValue(t),s=i.getPropertyPriority(t);n!==e.style.getPropertyValue(t)||s!==e.style.getPropertyPriority(t)?a.styleDiff[t]=""===s?n:[n,s]:a._unchangedStyles[t]=[n,s]}for(const t of Array.from(e.style))""===i.getPropertyValue(t)&&(a.styleDiff[t]=!1)}else if("open"===o&&"DIALOG"===n.tagName){a.attributes.rr_open_mode=n.matches("dialog:modal")?"modal":"non-modal";let e=this.generatedAttributes.get(t.target);e||(e=new Set,this.generatedAttributes.set(t.target,e)),e.add("rr_open_mode")}}break}case"childList":if(Pc(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=kh(t.target)?this.mirror.getId(Vu.host(t.target)):this.mirror.getId(t.target);Pc(t.target,this.blockClass,this.blockSelector,!1)||Rc(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(Vc(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===i||Ac(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[Uc(i,n)]?Vc(this.movedSet,e):(this.removes.push({parentId:n,id:i,isShadow:!(!kh(t.target)||!Sh(t.target))||void 0}),function(t,e){const i=[t];for(;i.length;){const t=i.pop();e.has(t)||(e.add(t),Vu.childNodes(t).forEach(t=>i.push(t)))}}(e,this.removesSubTreeCache))),this.mapRemoves.add(e))})}}),_h(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(Rc(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[Uc(this.mirror.getId(t),i)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!Pc(t,this.blockClass,this.blockSelector,!1)){if(t.nodeType===t.TEXT_NODE)return;const e=Vu.childNodes(t);for(let t=0,i=e.length;i>t;t++){const i=e[t];i&&this.genAdds(i)}if(Lc(t)){const e=Vu.childNodes(Vu.shadowRoot(t));for(let i=0,n=e.length;n>i;i++){const n=e[i];n&&(this.processedNodeManager.add(n,this),this.genAdds(n,t))}}}}}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAllElementAttributes","maskAttributeFn","keepIframeSrcFn","recordCanvas","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(e=>{this[e]=t[e]}),this.canvasManager.acquire()}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t)}isBlockedAtEmission(t){const e=this.blockClass,i=e&&"string"!=typeof e&&(e.global||e.sticky)?new RegExp(e):null;for(;t;){if(i&&(i.lastIndex=0),Pc(t,i||e,this.blockSelector,!0))return!0;const n="getRootNode"in t?Vu.getRootNode(t):null;t=(null==n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?Vu.host(n):null}return!1}};function Vc(t,e){const i=[e];for(;i.length;){const e=i.pop();if(t.delete(e),e.nodeType===e.TEXT_NODE)continue;const n=Vu.childNodes(e);for(let t=0,e=n.length;e>t;t++){const e=n[t];e&&i.push(e)}}}function Gc(t,e,i){return 0!==t.size&&function(t,e){const i=Vu.parentNode(e);return!!i&&t.has(i)}(t,e)}function Zc(t,e){if(0===t.size)return!1;let i=Vu.parentNode(e);for(;i;){if(t.has(i))return!0;i=Vu.parentNode(i)}return!1}function Qc(t){Hc=t}function Jc(){Hc=void 0}var Kc=(t,e="rrweb")=>Hc?(...i)=>{try{return t(...i)}catch(t){if(Hc&&!0===Hc(t,e))return;throw t}}:t,Yc=[];function Xc(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 td(t,e){const i=new Wc;let n;i.init(t);try{n=new(Uu())(Kc(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),Yc.push(i),{observer:n,buffer:i}}catch(t){try{null==n||n.disconnect(),i.destroy(),i.reset()}catch(t){}throw t}}function ed({scrollCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){const o=new Map,l=r=>{const l=Xc(r);if(!l||Pc(l,n,s,!0))return;const a=i.getId(l);let u,h;if(l===e&&e.defaultView){const t=Tc(e.defaultView);u=t.left,h=t.top}else u=l.scrollLeft,h=l.scrollTop;const c=`${u},${h}`;o.get(a)!==c&&(o.set(a,c),t({id:a,x:u,y:h}))},a=[yc("scroll",Kc(xc(Kc(t=>l(t)),r.scroll||100)),e)];return"onscrollend"in e&&a.push(yc("scrollend",Kc(l),e)),()=>a.forEach(t=>t())}function id(t,e){for(let i=Yc.length-1;i>=0;i--){const n=Yc[i];if(!n)continue;let s=n.bufferBelongsToIframe(t);!s&&e&&e.has(n.bufferDoc())&&(s=!0),s&&(n.reset(),Yc.splice(i,1))}}var nd=["INPUT","TEXTAREA","SELECT"],sd=new WeakMap;function rd(t){return function t(e,i){if(ud("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||ud("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||ud("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||ud("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 od(t,e,i){let n,s;return t?(t.ownerNode?n=e.getId(t.ownerNode):s=i.getId(t),{styleId:s,id:n}):{}}function ld({mirror:t,stylesheetManager:e},i){var n,s;let r=null;r=t.getId("#document"===i.nodeName?i:Vu.host(i));const o="#document"===i.nodeName?null===(n=i.defaultView)||void 0===n?void 0:n.Document:null===(s=i.ownerDocument)||void 0===s||null===(s=s.defaultView)||void 0===s?void 0:s.ShadowRoot,l=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==r&&-1!==r&&o&&l?(Object.defineProperty(i,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var t;return null===(t=l.get)||void 0===t?void 0:t.call(this)},set(t){let i;try{var n;i=null===(n=l.set)||void 0===n?void 0:n.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==r&&-1!==r)try{e.adoptStyleSheets(t,r)}catch(t){}return i}}),Kc(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function ad(t,e={}){const i=t.doc.defaultView;if(!i)return()=>{};let n,s;!function(t,e){const{mutationCb:i,mousemoveCb:n,mouseInteractionCb:s,scrollCb:r,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:u,styleDeclarationCb:h,canvasMutationCb:c,fontCb:d,selectionCb:v,customElementCb:f}=t;t.mutationCb=(...t)=>{e.mutation&&e.mutation(...t),i(...t)},t.mousemoveCb=(...t)=>{e.mousemove&&e.mousemove(...t),n(...t)},t.mouseInteractionCb=(...t)=>{e.mouseInteraction&&e.mouseInteraction(...t),s(...t)},t.scrollCb=(...t)=>{e.scroll&&e.scroll(...t),r(...t)},t.viewportResizeCb=(...t)=>{e.viewportResize&&e.viewportResize(...t),o(...t)},t.inputCb=(...t)=>{e.input&&e.input(...t),l(...t)},t.mediaInteractionCb=(...t)=>{e.mediaInteaction&&e.mediaInteaction(...t),a(...t)},t.styleSheetRuleCb=(...t)=>{e.styleSheetRule&&e.styleSheetRule(...t),u(...t)},t.styleDeclarationCb=(...t)=>{e.styleDeclaration&&e.styleDeclaration(...t),h(...t)},t.canvasMutationCb=(...t)=>{e.canvasMutation&&e.canvasMutation(...t),c(...t)},t.fontCb=(...t)=>{e.font&&e.font(...t),d(...t)},t.selectionCb=(...t)=>{e.selection&&e.selection(...t),v(...t)},t.customElementCb=(...t)=>{e.customElement&&e.customElement(...t),f(...t)}}(t,e);const r=[],o=Kc(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=Yc.indexOf(s);-1!==t&&Yc.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==n||n.disconnect()}finally{wc(r)}});try{if(t.recordDOM){const e=td(t,t.doc);n=e.observer,s=e.buffer}if(r.push(function({mousemoveCb:t,sampling:e,doc:i,mirror:n}){if(!1===e.mousemove)return()=>{};const s="number"==typeof e.mousemove?e.mousemove:50,r="number"==typeof e.mousemoveCallback?e.mousemoveCallback:500;let o,l=[];const a=xc(Kc(e=>{const i=Date.now()-o;t(l.map(t=>(t.timeOffset-=i,t)),e),l=[],o=null}),r),u=Kc(xc(Kc(t=>{const e=Xc(t),{clientX:i,clientY:s}=Fc(t)?t.changedTouches[0]:t;o||(o=$c()),l.push({x:i,y:s,id:n.getId(e),timeOffset:$c()-o}),a("undefined"!=typeof DragEvent&&t instanceof DragEvent?Iu.Drag:t instanceof MouseEvent?Iu.MouseMove:Iu.TouchMove)}),s,{trailing:!1})),h=[yc("mousemove",u,i),yc("touchmove",u,i),yc("drag",u,i)];return Kc(()=>{h.forEach(t=>t())})}(t)),r.push(function({mouseInteractionCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){if(!1===r.mouseInteraction)return()=>{};const o=!0===r.mouseInteraction||void 0===r.mouseInteraction?{}:r.mouseInteraction,l=[];let a=null;return Object.keys(Mu).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t]).forEach(r=>{let o=Lh(r);const u=(e=>r=>{const o=Xc(r);if(Pc(o,n,s,!0))return;let l=null,u=e;if("pointerType"in r){switch(r.pointerType){case"mouse":l=Eu.Mouse;break;case"touch":l=Eu.Touch;break;case"pen":l=Eu.Pen}l===Eu.Touch&&(Mu[e]===Mu.MouseDown?u="TouchStart":Mu[e]===Mu.MouseUp&&(u="TouchEnd"))}else Fc(r)&&(l=Eu.Touch);null!==l?(a=l,(u.startsWith("Touch")&&l===Eu.Touch||u.startsWith("Mouse")&&l===Eu.Mouse)&&(l=null)):Mu[e]===Mu.Click&&(l=a,a=null);const h=Fc(r)?r.changedTouches[0]:r;if(!h)return;const c=i.getId(o),{clientX:d,clientY:v}=h;Kc(t)(le({type:Mu[u],id:c,x:d,y:v},null!==l&&{pointerType:l}))})(r);if(window.PointerEvent)switch(Mu[r]){case Mu.MouseDown:case Mu.MouseUp:o=o.replace("mouse","pointer");break;case Mu.TouchStart:case Mu.TouchEnd:return}l.push(yc(o,u,e))}),Kc(()=>{l.forEach(t=>t())})}(t)),r.push(ed(t)),r.push(function({viewportResizeCb:t},{win:e}){let i=-1,n=-1;return yc("resize",Kc(xc(Kc(()=>{const e=Ic(),s=Mc();i===e&&n===s||(t({width:Number(s),height:Number(e)}),i=e,n=s)}),200)),e)}(t,{win:i})),r.push(function({inputCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,ignoreClass:r,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:u,userTriggeredOnInput:h}){function c(t){let i=Xc(t);const u=t.isTrusted,c=e.defaultView;if(i&&c&&!(i instanceof c.HTMLElement))return;const v=i&&i.tagName;if(i&&"OPTION"===v&&(i=Vu.parentElement(i)),!i||!v||0>nd.indexOf(v)||Pc(i,n,s,!0))return;if(i.classList.contains(r)||o&&i.matches(o))return;let f=i.value,p=!1;const g=Bh(i)||"";"radio"===g||"checkbox"===g?p=i.checked:(l[v.toLowerCase()]||l[g])&&(f=Dh({element:i,maskInputOptions:l,tagName:v,type:g,value:f,maskInputFn:a})),d(i,h?{text:f,isChecked:p,userTriggered:u}:{text:f,isChecked:p});const m=i.name;"radio"===g&&m&&p&&e.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach(t=>{if(t!==i){const e=t.value;d(t,h?{text:e,isChecked:!p,userTriggered:!1}:{text:e,isChecked:!p})}})}function d(e,n){const s=sd.get(e);if(!s||s.text!==n.text||s.isChecked!==n.isChecked){sd.set(e,n);const s=i.getId(e);Kc(t)(le(le({},n),{},{id:s}))}}const v=("last"===u.input?["change"]:["input","change"]).map(t=>yc(t,Kc(c),e)),f=e.defaultView;if(!f)return()=>{v.forEach(t=>t())};const p=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value");return p&&p.set&&v.push(...[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]].map(t=>Cc(t[0],t[1],{set(){Kc(c)({target:this,isTrusted:!1})}},!1,f))),Kc(()=>{wc(v)})}(t)),r.push(function({mediaInteractionCb:t,blockClass:e,blockSelector:i,mirror:n,sampling:s,doc:r}){const o=Kc(r=>xc(Kc(s=>{const o=Xc(s);if(!o||Pc(o,e,i,!0))return;const{currentTime:l,volume:a,muted:u,playbackRate:h,loop:c}=o;t({type:r,id:n.getId(o),currentTime:l,volume:a,muted:u,playbackRate:h,loop:c})}),s.media||500)),l=[yc("play",o(Ru.Play),r),yc("pause",o(Ru.Pause),r),yc("seeked",o(Ru.Seeked),r),yc("volumechange",o(Ru.VolumeChange),r),yc("ratechange",o(Ru.RateChange),r)];return Kc(()=>{l.forEach(t=>t())})}(t)),t.recordDOM){const e=function(t){const e=new Map,i=new Set;let n=!0;const s=t=>{if(n)try{t()}catch(t){}},r=t=>{var i;const n=e.get(t);if(n){for(;null===(i=n[0])||void 0===i?void 0:i.ready;){const t=n.shift();(null==t?void 0:t.emit)&&s(t.emit)}0===n.length&&e.delete(t)}};return{queueMutation(t,i){if(!t)return void s(i);const n=e.get(t);n?(n.push({emit:i,ready:!0}),r(t)):s(i)},queuePendingMutation(o,l,a){if(!n)return()=>{};let u=e.get(o);u||(u=[],e.set(o,u));const h={emit:l,ready:!1};u.push(h);let c,d=!1,v=!1;const f=()=>{d||v||(d=!0,void 0!==c&&i.delete(c),h.ready=!0,h.emit=void 0,r(o))};try{c=t.setTimeout(f,5e3),d||v?t.clearTimeout(c):i.add(c)}catch(t){f()}return e=>{!v&&n&&(v=!0,void 0!==c&&(t.clearTimeout(c),i.delete(c)),d?e&&s(a):(h.ready=!0,e||(h.emit=void 0),r(o)))}},reset(){n=!1,i.forEach(e=>t.clearTimeout(e)),i.clear(),e.clear()}}}(i);r.push(e.reset),r.push(function({styleSheetRuleCb:t,mirror:e,stylesheetManager:i},{win:n,mutationQueue:s}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const r=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:Kc((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=od(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,adds:[{rule:l,index:a}]})),a},"host")}),n.CSSStyleSheet.prototype.addRule=function(t,e,i=this.cssRules.length){return n.CSSStyleSheet.prototype.insertRule.apply(this,[`${t} { ${e} }`,i])};const o=n.CSSStyleSheet.prototype.deleteRule;let l,a;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:Kc((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=od(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,removes:[{index:l}]})),a},"host")}),n.CSSStyleSheet.prototype.removeRule=function(t){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},n.CSSStyleSheet.prototype.replace&&(l=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(l,{apply:Kc((n,r,o)=>{const[l]=o,a=n.apply(r,o);try{const n=null==a?void 0:a.then;if(r.ownerNode||!a||"function"!=typeof n)return a;i.onCssomSheetMutation(r);const{id:o,styleId:u}=od(r,e,i.styleMirror);if(!(o&&-1!==o||u&&-1!==u))return a;const h=s.queuePendingMutation(r,()=>t({id:o,styleId:u,replace:l}),()=>{const e=Th(r);null!==e&&t({id:o,styleId:u,replace:e})});try{n.call(a,()=>h(!0),()=>h(!1))}catch(t){h(!1)}}catch(t){}return a},"host")})),n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Kc((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=od(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,replaceSync:l})),a},"host")}));const u={};hd("CSSGroupingRule")?u.CSSGroupingRule=n.CSSGroupingRule:(hd("CSSMediaRule")&&(u.CSSMediaRule=n.CSSMediaRule),hd("CSSConditionRule")&&(u.CSSConditionRule=n.CSSConditionRule),hd("CSSSupportsRule")&&(u.CSSSupportsRule=n.CSSSupportsRule));const h={};return Object.entries(u).forEach(([n,r])=>{h[n]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(h[n].insertRule,{apply:Kc((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:h}=od(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||h&&-1!==h)){const e=[...rd(r),a];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:h,adds:[{rule:l,index:e}]}))}return a},"host")}),r.prototype.deleteRule=new Proxy(h[n].deleteRule,{apply:Kc((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:h}=od(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||h&&-1!==h)){const e=[...rd(r),l];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:h,removes:[{index:e}]}))}return a},"host")})}),Kc(()=>{n.CSSStyleSheet.prototype.insertRule=r,n.CSSStyleSheet.prototype.deleteRule=o,l&&(n.CSSStyleSheet.prototype.replace=l),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(u).forEach(([t,e])=>{e.prototype.insertRule=h[t].insertRule,e.prototype.deleteRule=h[t].deleteRule})})}(t,{win:i,mutationQueue:e})),r.push(ld(t,t.doc)),r.push(function({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:i,stylesheetManager:n},{win:s,mutationQueue:r}){const o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Kc((s,o,l)=>{var a;const[u,h,c]=l,d=s.apply(o,l);if(i.has(u))return d;const v=null===(a=o.parentRule)||void 0===a?void 0:a.parentStyleSheet;n.onCssomSheetMutation(v);const{id:f,styleId:p}=od(v,e,n.styleMirror);if(f&&-1!==f||p&&-1!==p){const e=rd(o.parentRule);r.queueMutation(v,()=>t({id:f,styleId:p,set:{property:u,value:h,priority:c},index:e}))}return d},"host")});const l=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:Kc((s,o,l)=>{var a;const[u]=l,h=s.apply(o,l);if(i.has(u))return h;const c=null===(a=o.parentRule)||void 0===a?void 0:a.parentStyleSheet;n.onCssomSheetMutation(c);const{id:d,styleId:v}=od(c,e,n.styleMirror);if(d&&-1!==d||v&&-1!==v){const e=rd(o.parentRule);r.queueMutation(c,()=>t({id:d,styleId:v,remove:{property:u},index:e}))}return h},"host")}),Kc(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=l})}(t,{win:i,mutationQueue:e})),t.collectFonts&&r.push(function({fontCb:t,doc:e}){const i=e.defaultView;if(!i)return()=>{};const n=[],s=new WeakMap,r=i.FontFace;i.FontFace=function(t,e,i){const n=new r(t,e,i);return s.set(n,{family:t,buffer:"string"!=typeof e,descriptors:i,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),n};const o=Wu(e.fonts,"add",function(e){return function(i){return setTimeout(Kc(()=>{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),Kc(()=>{n.forEach(t=>t())})}(t))}r.push(function(t){const{doc:e,mirror:i,blockClass:n,blockSelector:s,selectionCb:r}=t;let o=!0;const l=Kc(()=>{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);Pc(r,n,s,!0)||Pc(a,n,s,!0)||l.push({start:i.getId(r),startOffset:o,end:i.getId(a),endOffset:u})}r({ranges:l})});return l(),yc("selectionchange",l)}(t)),r.push(function({doc:t,customElementCb:e}){const i=t.defaultView;return i&&i.customElements?Wu(i.customElements,"define",function(t){return function(i,n,s){try{e({define:{name:i}})}catch(t){console.warn(`Custom element callback failed for ${i}`)}return t.apply(this,[i,n,s])}}):()=>{}}(t));for(const e of t.plugins)r.push(e.observer(e.callback,i,e.options))}catch(t){try{o()}catch(t){}throw t}return o}function ud(t){return void 0!==window[t]}function hd(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var cd=class{constructor(t){_h(this,"generateIdFn",void 0),_h(this,"iframeRemoteIdToLocalIdMap",new WeakMap),_h(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}},dd=class{constructor(t){_h(this,"iframes",new WeakMap),_h(this,"crossOriginIframeMap",new WeakMap),_h(this,"crossOriginIframeMirror",new cd(Yh)),_h(this,"crossOriginIframeStyleMirror",void 0),_h(this,"crossOriginIframeRootIdMap",new WeakMap),_h(this,"mirror",void 0),_h(this,"mutationCb",void 0),_h(this,"wrappedEmit",void 0),_h(this,"loadListener",void 0),_h(this,"pageHideListener",void 0),_h(this,"stylesheetManager",void 0),_h(this,"recordCrossOriginIframes",void 0),_h(this,"messageHandler",void 0),_h(this,"nestedIframeListeners",new Map),_h(this,"attachedWindows",new WeakMap),_h(this,"attachedDocuments",new WeakMap),_h(this,"attachedIframes",new Map),_h(this,"loadListenerDisposers",new WeakMap),_h(this,"iframeElementsById",new Map),_h(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new cd(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}registerLoadListenerDisposer(t,e){let i=this.loadListenerDisposers.get(t);i||(i=new Set,this.loadListenerDisposers.set(t,i)),i.add(e);const n=this.mirror.getId(t);-1!==n&&this.iframeElementsById.set(n,t)}getIframeElementById(t){var e,i,n;return null!==(e=null!==(i=null===(n=this.attachedIframes.get(t))||void 0===n?void 0:n.element)&&void 0!==i?i:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){const e=this.loadListenerDisposers.get(t);e&&(e.forEach(t=>_c(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{bc(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);_c(()=>{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)})}_c(()=>{const e=t.contentWindow;if(!e)return;let i=this.pageHideHandlers.get(t);if(i)for(const t of i)if(t.win===e)return;const n=()=>{var e;null===(e=this.pageHideListener)||void 0===e||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument)};e.addEventListener("pagehide",n),i||(i=new Set,this.pageHideHandlers.set(t,i)),i.add({win:e,handler:n})}),null===(i=this.loadListener)||void 0===i||i.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const e=t;if("rrweb"!==e.data.type||e.origin!==e.data.origin)return;if(!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const n=this.transformCrossOriginEvent(i,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}transformCrossOriginEvent(t,e){switch(e.type){case Tu.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:Tu.IncrementalSnapshot,data:{source:Iu.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Tu.Meta:case Tu.Load:case Tu.DomContentLoaded:return!1;case Tu.Plugin:return e;case Tu.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case Tu.IncrementalSnapshot:switch(e.data.source){case Iu.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 Iu.Drag:case Iu.TouchMove:case Iu.MouseMove:return e.data.positions.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case Iu.ViewportResize:return!1;case Iu.MediaInteraction:case Iu.MouseInteraction:case Iu.Scroll:case Iu.CanvasMutation:case Iu.Input:return this.replaceIds(e.data,t,["id"]),e;case Iu.StyleSheetRule:case Iu.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case Iu.Font:return e;case Iu.Selection:return e.data.ranges.forEach(e=>{this.replaceIds(e,t,["start","end"])}),e;case Iu.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===Au.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&&(bc(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(i)),t&&this.nestedIframeListeners.has(t)&&(bc(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=>{_c(()=>this.mirror.removeNodeFromMap(t))}),_c(()=>id(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&&bc(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{bc(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}},vd=class{constructor(t){_h(this,"shadowDoms",new WeakSet),_h(this,"mutationCb",void 0),_h(this,"scrollCb",void 0),_h(this,"bypassOptions",void 0),_h(this,"mirror",void 0),_h(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(!Sh(t))return;if(this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=null!==(i=null===(n=Vu.host(t))||void 0===n?void 0:n.ownerDocument)&&void 0!==i?i:e,{observer:r,buffer:o}=td(le(le({},this.bypassOptions),{},{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push({doc:s,handler(){r.disconnect(),o.destroy(),o.releaseCanvasManager();const t=Yc.indexOf(o);-1!==t&&Yc.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:ed(le(le({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))}),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(Vu.host(t))),this.restoreHandlers.push({doc:s,handler:ld({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)})},0)}observeAttachShadow(t){t.contentWindow&&t.contentDocument&&this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,e){const i=this;this.restoreHandlers.push({doc:e,handler:Wu(t.prototype,"attachShadow",function(t){return function(n){const s=t.call(this,n),r=Vu.shadowRoot(this);return r&&jc(this)&&i.addShadowRoot(r,e),s}})})}reset(){this.restoreHandlers.forEach(({handler:t})=>{try{t()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){const e=[];for(const i of this.restoreHandlers)if(i.doc===t)try{i.handler()}catch(t){}else e.push(i);this.restoreHandlers=e}},fd="skip-frame";function pd(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 gd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",md="undefined"==typeof Uint8Array?[]:new Uint8Array(256),yd=0;64>yd;yd++)md[gd.charCodeAt(yd)]=yd;var bd=function(t){var e,i=new Uint8Array(t),n=i.length,s="";for(e=0;n>e;e+=3)s+=gd[i[e]>>2],s+=gd[(3&i[e])<<4|i[e+1]>>4],s+=gd[(15&i[e+1])<<2|i[e+2]>>6],s+=gd[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},_d=new Map,wd=(t,e,i)=>{if(!t||!xd(t,e)&&"object"!=typeof t)return;const n=function(t,e){let i=_d.get(t);return i||(i=new Map,_d.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 kd(t,e,i,n){if(t instanceof Array)return t.map(t=>kd(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:bd(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[kd(t.buffer,e,i,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const e=t.constructor.name,{src:i}=t;return{rr_type:e,src:i}}return t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL(n.type,n.quality)}:t instanceof ImageData?{rr_type:t.constructor.name,args:[kd(t.data,e,i,n),t.width,t.height]}:xd(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:wd(t,e,i)}:t}var Sd=(t,e,i,n)=>t.map(t=>kd(t,e,i,n)),xd=(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]))},Cd=["webgl","webgl2"];function $d(t){return"nodeType"in t}function Td(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 Wu(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||$d(r)&&Pc(r,e,i,!0))return n.call(this,s);$d(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?le(le({},s),{},{usage:"number"==typeof s.usage?s.usage|o:o}):s)}})}(t,e,i);n&&s.push(n)}const r=Wu(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(s,...r){const o=function(t){return"experimental-webgl"===t?"webgl":t}(s);if(!Pc(this,e,i,!0)&&("__context"in this||(this.__context=o),n&&Cd.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.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(t=>t())}}function Id(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=Wu(t,u,function(t){return function(...l){const a=t.apply(this,l);if(wd(a,r,this),this.canvas&&"tagName"in this.canvas&&!Pc(this.canvas,n,s,!0)){const t=Sd(l,r,this,o);i(this.canvas,{type:e,property:u,args:t})}return a}});l.push(a)}catch(r){const o=Cc(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!Pc(this.canvas,n,s,!0)&&i(this.canvas,{type:e,property:u,args:[t],setter:!0})}});l.push(o)}return l}var Md='(function() {\n\t//#region ../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/base64-arraybuffer/1.0.2/f63fa6b5c318cf1c9f6bdd1d4292ad2f15f76f2ec78475025a2d44070e896fe9/node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js\n\tvar chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n\tvar lookup = typeof Uint8Array === "undefined" ? [] : /* @__PURE__ */ new Uint8Array(256);\n\tfor (var i = 0; i < chars.length; i++) lookup[chars.charCodeAt(i)] = i;\n\tvar encode = function(arraybuffer) {\n\t\tvar bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = "";\n\t\tfor (i = 0; i < len; i += 3) {\n\t\t\tbase64 += chars[bytes[i] >> 2];\n\t\t\tbase64 += chars[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n\t\t\tbase64 += chars[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n\t\t\tbase64 += chars[bytes[i + 2] & 63];\n\t\t}\n\t\tif (len % 3 === 2) base64 = base64.substring(0, base64.length - 1) + "=";\n\t\telse if (len % 3 === 1) base64 = base64.substring(0, base64.length - 2) + "==";\n\t\treturn base64;\n\t};\n\t//#endregion\n\t//#region ../rrweb/src/record/workers/image-bitmap-data-url-worker.ts\n\tconst lastFingerprintMap = /* @__PURE__ */ new Map();\n\tconst transparentFingerprintMap = /* @__PURE__ */ new Map();\n\tconst lastSentAtMap = /* @__PURE__ */ new Map();\n\tconst PROVIDER_KEYFRAME_INTERVAL_MS = 3e4;\n\tfunction hashPixels(data) {\n\t\tconst view = new Uint32Array(data.buffer, data.byteOffset, data.byteLength >>> 2);\n\t\tlet primaryHash = 2166136261;\n\t\tlet secondaryHash = 2654435769;\n\t\tfor (let i = 0; i < view.length; i++) {\n\t\t\tprimaryHash ^= view[i];\n\t\t\tprimaryHash = Math.imul(primaryHash, 16777619);\n\t\t\tsecondaryHash ^= view[i];\n\t\t\tsecondaryHash = Math.imul(secondaryHash, 2246822507);\n\t\t}\n\t\treturn `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n\t}\n\tfunction frameFingerprint(width, height, data) {\n\t\treturn `${width}x${height}:${hashPixels(data)}`;\n\t}\n\tfunction transparentFingerprint(width, height) {\n\t\tconst pixelCount = width * height;\n\t\tlet hash = transparentFingerprintMap.get(pixelCount);\n\t\tif (hash === void 0) {\n\t\t\thash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n\t\t\ttransparentFingerprintMap.set(pixelCount, hash);\n\t\t}\n\t\treturn `${width}x${height}:${hash}`;\n\t}\n\tconst worker = self;\n\tlet reusableCanvas = null;\n\tlet reusableCtx = null;\n\tworker.onmessage = async function(e) {\n\t\tif ("resetFrameDedup" in e.data) {\n\t\t\tlastFingerprintMap.clear();\n\t\t\treturn;\n\t\t}\n\t\tif ("OffscreenCanvas" in globalThis) {\n\t\t\tconst { id, bitmap, width, height, displayWidth, displayHeight, dataURLOptions, maskRegions } = e.data;\n\t\t\ttry {\n\t\t\t\tif (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n\t\t\t\t\treusableCanvas = new OffscreenCanvas(width, height);\n\t\t\t\t\treusableCtx = reusableCanvas.getContext("2d", { willReadFrequently: true });\n\t\t\t\t}\n\t\t\t\tconst ctx = reusableCtx;\n\t\t\t\tctx.clearRect(0, 0, width, height);\n\t\t\t\tctx.drawImage(bitmap, 0, 0);\n\t\t\t\tbitmap.close();\n\t\t\t\tif (maskRegions) {\n\t\t\t\t\tctx.fillStyle = "black";\n\t\t\t\t\tfor (const region of maskRegions) ctx.fillRect(region.x, region.y, region.width, region.height);\n\t\t\t\t}\n\t\t\t\tconst fingerprint = frameFingerprint(width, height, ctx.getImageData(0, 0, width, height).data);\n\t\t\t\tif (fingerprint === (lastFingerprintMap.get(id) ?? transparentFingerprint(width, height))) {\n\t\t\t\t\tconst lastSentAt = lastSentAtMap.get(id);\n\t\t\t\t\tif (!(maskRegions !== void 0 && lastSentAt !== void 0 && Date.now() - lastSentAt >= PROVIDER_KEYFRAME_INTERVAL_MS)) return worker.postMessage({ id });\n\t\t\t\t}\n\t\t\t\tconst blob = await reusableCanvas.convertToBlob(dataURLOptions);\n\t\t\t\tconst arrayBuffer = await blob.arrayBuffer();\n\t\t\t\tworker.postMessage({\n\t\t\t\t\tid,\n\t\t\t\t\ttype: blob.type,\n\t\t\t\t\tbase64: encode(arrayBuffer),\n\t\t\t\t\tdisplayWidth,\n\t\t\t\t\tdisplayHeight\n\t\t\t\t});\n\t\t\t\tlastFingerprintMap.set(id, fingerprint);\n\t\t\t\tlastSentAtMap.set(id, Date.now());\n\t\t\t} catch {\n\t\t\t\tworker.postMessage({ id });\n\t\t\t}\n\t\t} else {\n\t\t\te.data.bitmap.close();\n\t\t\treturn worker.postMessage({ id: e.data.id });\n\t\t}\n\t};\n\t//#endregion\n})();\n',Ed="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Md],{type:"text/javascript;charset=utf-8"});function Pd(t){let e;try{if(e=Ed&&(self.URL||self.webkitURL).createObjectURL(Ed),!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(Md),{name:null==t?void 0:t.name})}}var Rd,Ad,Fd,Od=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){_h(this,"pendingCanvasMutations",new Map),_h(this,"rafStamps",{latestId:0,invokeId:null}),_h(this,"mirror",void 0),_h(this,"mutationCb",void 0),_h(this,"resetObservers",void 0),_h(this,"frozen",!1),_h(this,"locked",!1),_h(this,"rafIdTimestamp",null),_h(this,"rafIdFlush",null),_h(this,"refCount",0),_h(this,"torndown",!1),_h(this,"resetFrameDedup",null),_h(this,"processMutation",(t,e)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(t)||this.pendingCanvasMutations.set(t,[]),this.pendingCanvasMutations.get(t).push(e)});const{sampling:e="all",win:i,blockClass:n,blockSelector:s,recordCanvas:r,dataURLOptions:o,resolutionScale:l,canvasMasking:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,r&&"all"===e&&this.initCanvasMutationObserver(i,n,s,o),r&&"number"==typeof e&&this.initCanvasFPSObserver(e,i,n,s,{dataURLOptions:o,resolutionScale:l,canvasMasking:a})}initCanvasFPSObserver(t,e,i,n,s){var r=this;if(!("OffscreenCanvas"in e))return;const o="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,l=Td(e,i,n,!0),a=new Map;let u;try{u=new Pd}catch(t){return}let h=!1;u.onerror=()=>{var t;h=!0,cancelAnimationFrame(d),null===(t=u.terminate)||void 0===t||t.call(u),this.resetFrameDedup=null},this.resetFrameDedup=()=>{u.postMessage({resetFrameDedup:!0})},u.onmessage=t=>{const{id:e}=t.data;if(a.set(e,!1),!("base64"in t.data))return;const{base64:i,type:n,displayWidth:s,displayHeight:r}=t.data;this.mutationCb({id:e,type:Pu["2D"],commands:[{property:"clearRect",args:[0,0,s,r]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:n}]},0,0,s,r]}],displayWidth:s,displayHeight:r})};const c=1e3/t;let d,v=0;const f=t=>{var l;h||(v&&c>t-v||(v=t,(()=>{const t=[],s=e=>{try{e.querySelectorAll("canvas").forEach(e=>{Pc(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=ne(function*(t){const e=r.mirror.getId(t);if(!a.get(e)&&0!==t.width&&0!==t.height){a.set(e,!0);try{if(["webgl","webgl2"].includes(t.__context)){var i,n;const s=t.getContext(t.__context);if(null==s||null===(i=s.isContextLost)||void 0===i?void 0:i.call(s))return void a.set(e,!1);!1===(null==s||null===(n=s.getContextAttributes())||void 0===n?void 0:n.preserveDrawingBuffer)&&s.clear(s.COLOR_BUFFER_BIT)}const r=t.clientWidth||t.width,l=t.clientHeight||t.height,h=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(l*o)),d=function(t,e,i,n,s,r){if(!t||"function"!=typeof t.regionsFn)return;let o;try{o=t.regionsFn(e)}catch(t){return fd}if(void 0===o)return;if(!Array.isArray(o)||!o.every(pd))return fd;const l=i/s,a=n/r;return o.filter(t=>t.width>0&&t.height>0).map(t=>{const e=Math.floor(t.x*l),i=Math.floor(t.y*a);return{x:e,y:i,width:Math.ceil((t.x+t.width)*l)-e,height:Math.ceil((t.y+t.height)*a)-i}})}(s.canvasMasking,t,h,c,r,l);if("skip-frame"===d)return void a.set(e,!1);const v=yield createImageBitmap(t,1>o?{resizeWidth:h,resizeHeight:c,resizeQuality:"medium"}:{resizeWidth:h,resizeHeight:c});u.postMessage({id:e,bitmap:v,width:h,height:c,displayWidth:r,displayHeight:l,dataURLOptions:s.dataURLOptions,maskRegions:d},[v])}catch(t){a.set(e,!1)}}}),function(t){return l.apply(this,arguments)}))),d=requestAnimationFrame(f))};d=requestAnimationFrame(f),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(d),null===(t=u.terminate)||void 0===t||t.call(u),this.resetFrameDedup=null}}initCanvasMutationObserver(t,e,i,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=Td(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=Wu(e.CanvasRenderingContext2D.prototype,l,function(r){return function(...o){return Pc(this.canvas,i,n,!0)||setTimeout(()=>{const i=Sd(o,e,this,s);t(this.canvas,{type:Pu["2D"],property:l,args:i})},0),r.apply(this,o)}});r.push(o)}catch(s){const o=Cc(e.CanvasRenderingContext2D.prototype,l,{set(e){Pc(this.canvas,i,n,!0)||t(this.canvas,{type:Pu["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(...Id(e.WebGLRenderingContext.prototype,Pu.WebGL,t,i,n,e,s)),void 0!==e.WebGL2RenderingContext&&r.push(...Id(e.WebGL2RenderingContext.prototype,Pu.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=>us(t,$u)),{type:s}=i[0];this.mutationCb({id:e,type:s,commands:n}),this.pendingCanvasMutations.delete(t)}},Dd=class{constructor(t){var e;_h(this,"trackedLinkElements",new WeakSet),_h(this,"pendingDeferredSheets",new Set),_h(this,"mutationCb",void 0),_h(this,"adoptedStyleSheetCb",void 0),_h(this,"maskAllElementAttributes",void 0),_h(this,"maskAttributeFn",void 0),_h(this,"styleMirror",new Nc),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(e=t.maskAllElementAttributes)&&void 0!==e&&e,this.maskAttributeFn=t.maskAttributeFn}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}beginDeferredLinkInlining(t,e){if(-1===e||!t.isConnected)return null;let i=null,n=null;try{n=t.sheet,n&&(i=Fh(n))}catch(t){}if(!i||!n)return mh(),null;const s=i;let r=!1;const o={sheet:n,invalidate(){r=!0}};this.pendingDeferredSheets.add(o);let l=!1;return{advance:i=>{if(l)return!0;const a=Gu(),u=Ju();let h=!0;try{if(r)return l=!0,mh(),!0;if(!s.advance(i))return h=!1,!1;l=!0;const o=s.text();if(!t.isConnected)return!0;let a=null;try{a=t.sheet}catch(t){}return a!==n?(mh(),!0):o?(this.emitCssTextMutation(t,e,o),!0):(mh(),!0)}finally{h&&this.pendingDeferredSheets.delete(o),Ku(c=Gu()-a,null!=(d=u)?d:Zu)||(ah.totalMs+=c,c>ah.slowestSliceMs&&(ah.slowestSliceMs=c))}var c,d},remainingRules:()=>s.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(t){if(t&&0!==this.pendingDeferredSheets.size)for(const e of this.pendingDeferredSheets)e.sheet===t&&(this.pendingDeferredSheets.delete(e),e.invalidate())}inlineDeferredLinkElement(t,e){var i;null===(i=this.beginDeferredLinkInlining(t,e))||void 0===i||i.advance(1/0)}emitCssTextMutation(t,e,i){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e,attributes:{_cssText:qh({element:t,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){if(0===t.length)return;const i={id:e,styleIds:[]},n=[];for(const e of t){let t;if(this.styleMirror.has(e))t=this.styleMirror.getId(e);else{const i=this.styleMirror.add(e);t=i;const s=Gu();try{vh(()=>{try{const t=e.rules||e.cssRules;t&&dh(t)}catch(t){}n.push({styleId:i,rules:Array.from(e.rules||CSSRule,(t,i)=>({rule:Ih(t,e.href),index:i}))})})}finally{fh(Gu()-s)}}i.styleIds.push(t)}n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),hc.forEach(t=>t.abort()),hc.clear()}trackStylesheetInLinkElement(t){}},Ld=class{constructor(){_h(this,"nodeMap",new WeakMap),_h(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(){}},Nd=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var qd;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(qd=t.contentWindow)||void 0===qd?void 0:qd.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var jd=new Oh,Bd=new Set([Iu.Mutation,Iu.MediaInteraction,Iu.StyleSheetRule,Iu.CanvasMutation,Iu.Font,Iu.Log,Iu.StyleDeclaration,Iu.AdoptedStyleSheet]);function Hd(t){const e=window;if("function"==typeof e.requestIdleCallback){const i=e.requestIdleCallback(t,{timeout:2e3});return{cancel(){var t;return null===(t=e.cancelIdleCallback)||void 0===t?void 0:t.call(e,i)}}}const i=setTimeout(t,250);return{cancel:()=>clearTimeout(i)}}function zd(t={}){let e;const{emit:i,checkoutEveryNms:n,checkoutEveryNth:s,blockClass:r="rr-block",blockSelector:o=null,ignoreClass:l="rr-ignore",ignoreSelector:a=null,maskTextClass:u="rr-mask",maskTextSelector:h=null,inlineStylesheet:c=!0,inlineStylesheetBudgetRules:d,maskAllInputs:v,maskInputOptions:f,slimDOMOptions:p,maskInputFn:g,maskTextFn:m,maskAllElementAttributes:y=!1,maskAttributeFn:b,hooks:_,packFn:w,sampling:k={},dataURLOptions:S={},canvasResolutionScale:x,canvasMasking:C,mousemoveWait:T,recordDOM:I=!0,recordCanvas:M=!1,recordCrossOriginIframes:E=!1,recordAfter:P=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:R=!1,collectFonts:A=!1,inlineImages:F=!1,plugins:O,keepIframeSrcFn:D=()=>!1,ignoreCSSAttributes:L=new Set([]),attributeFilter:N,errorHandler:q}=t;Qc(q);const j=le({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},S),B=!E||window.parent===window;let H=!1;if(!B)try{window.parent.document&&(H=!1)}catch(t){H=!0}if(B&&!i)throw new Error("emit function is required");if(!B&&!H)return()=>{};void 0!==T&&void 0===k.mousemove&&(k.mousemove=T),jd.reset();const z=!0===v?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==f?f:{password:!0},U=gc(void 0!==p&&p);let W;!function(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();let V=0;const G=new Map;let Z,Q;const J=t=>{for(const e of O||[])e.eventProcessor&&(t=e.eventProcessor(t));return w&&!H&&(t=w(t)),t};Rd=(t,e)=>{var r;const o=t;if(o.timestamp=$c(),!(null===(r=Yc[0])||void 0===r?void 0:r.isFrozen())||o.type===Tu.FullSnapshot||o.type===Tu.IncrementalSnapshot&&Bd.has(o.data.source)||Yc.forEach(t=>t.unfreeze()),B)null==i||i(J(o),e);else if(H){const t={type:"rrweb",event:J(o),origin:window.location.origin,isCheckout:e};window.parent.postMessage(t,"*")}if(o.type===Tu.FullSnapshot)W=o,V=0;else if(o.type===Tu.IncrementalSnapshot){if(o.data.source===Iu.Mutation&&o.data.isAttachIframe)return;V++,(s&&V>=s||n&&o.timestamp-W.timestamp>n)&&Ad(!0)}};const K=t=>{if(t.removes&&t.removes.length>0){const e=t.adds.length>0?new Set(t.adds.map(t=>t.node.id)):null,i=new Set;if(t.adds.length>0)for(const e of t.adds){const t=jd.getNode(e.node.id);t&&"IFRAME"===t.nodeName&&i.add(t)}t.removes.forEach(({id:t})=>{if(e&&e.has(t))return;const n=et.getIframeElementById(t);n&&i.has(n)?et.forgetIframeId(t):(null==Z||Z(t),et.removeIframeById(t))}),null==Q||Q(),et.cleanupDetachedIframes()}Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.Mutation},t)})},Y=t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.Scroll},t)}),X=t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.CanvasMutation},t)}),tt=new Dd({mutationCb:K,adoptedStyleSheetCb:t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.AdoptedStyleSheet},t)}),maskAllElementAttributes:y,maskAttributeFn:b}),et=new dd({mirror:jd,mutationCb:K,stylesheetManager:tt,recordCrossOriginIframes:E,wrappedEmit:Rd});for(const t of O||[])t.getMirror&&t.getMirror({nodeMirror:jd,crossOriginIframeMirror:et.crossOriginIframeMirror,crossOriginIframeStyleMirror:et.crossOriginIframeStyleMirror});const it=new Ld,nt=null==C?void 0:C.configured;Fd=new Od({recordCanvas:M,mutationCb:X,win:window,blockClass:r,blockSelector:o,mirror:jd,sampling:k.canvas,dataURLOptions:j,resolutionScale:x,canvasMasking:C});const st=new vd({mutationCb:K,scrollCb:Y,bypassOptions:{blockClass:r,blockSelector:o,maskTextClass:u,maskTextSelector:h,inlineStylesheet:c,maskInputOptions:z,dataURLOptions:j,maskTextFn:m,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:b,recordCanvas:M,canvasMaskingConfigured:nt,inlineImages:F,sampling:k,slimDOMOptions:U,iframeManager:et,stylesheetManager:tt,canvasManager:Fd,keepIframeSrcFn:D,processedNodeManager:it,attributeFilter:N},mirror:jd});Ad=(t=!1)=>{if(I){uh(d);try{Rd({type:Tu.Meta,data:{href:window.location.href,width:Mc(),height:Ic()}},t),null==e||e.cancel(),e=void 0,tt.reset(),st.init(),Yc.forEach(t=>t.lock());let i=null,n=[];try{i=function(t,e){const{mirror:i=new Oh,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:u=!1,canvasMaskingConfigured:h,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f=!1,maskAttributeFn:p,slimDOM:g=!1,dataURLOptions:m,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:_,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C=()=>!1,maxDepth:T,inlineStylesheetBudgetRules:I}=e||{},M=!0===c?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===c?{password:!0}:c,E=gc(g);uh(I);try{return pc(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:M,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f,maskAttributeFn:p,slimDOMOptions:E,dataURLOptions:m,inlineImages:a,recordCanvas:u,canvasMaskingConfigured:h,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:_,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C,newlyAddedElement:!1,maxDepth:T})}finally{hh()}}(document,{mirror:jd,blockClass:r,blockSelector:o,maskTextClass:u,maskTextSelector:h,inlineStylesheet:c,maskAllInputs:z,inlineStylesheetBudgetRules:d,maskTextFn:m,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:b,slimDOM:U,dataURLOptions:j,recordCanvas:M,canvasMaskingConfigured:nt,inlineImages:F,onSerialize(t){Oc(t,jd)&&et.addIframe(t),Dc(t,jd)&&tt.trackLinkElement(t),Lc(t)&&st.addShadowRoot(Vu.shadowRoot(t),document)},onIframeLoad(t,e){et.attachIframe(t,e),st.observeAttachShadow(t)},onIframeListenerRegistered(t,e){et.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){tt.attachLinkElement(t,e)},keepIframeSrcFn:D})}finally{n=gh()}if(!i)return console.warn("Failed to snapshot the document");if(Rd({type:Tu.FullSnapshot,data:{node:i,initialOffset:Tc(window)}},t),Yc.forEach(t=>t.unlock()),Fd.onFullSnapshot(),n.length){const t=function(t,e,i){let n=!1,s=null,r=0,o=null;const l=()=>null!==o||t.length>r,a=()=>{const i=t[r];t[r]=null,r+=1,i&&_c(()=>{o=e.beginDeferredLinkInlining(i,jd.getId(i))})},u=()=>{if(!o)return;const t=o;let e=!0;_c(()=>{e=t.advance(200)}),e&&(o=null)},h=()=>{o||a(),u()},c=t=>{if(s=null,n)return;let e=0;do{try{h()}catch(t){null==o||o.discard(),o=null,yh(1)}e+=1}while(!n&&l()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));n||(l()?s=Hd(c):i())};return s=Hd(c),{cancel(){n=!0,null==o||o.discard(),o=null,null==s||s.cancel(),s=null},flush(){if(n)return;n=!0,null==s||s.cancel(),s=null;let e=0,h=0;for(;l()&&50>e;){o||a();const t=o;if(t)if(Math.floor(t.remainingRules()/200)+1>50-e)t.discard(),o=null,h+=1;else{try{u()}catch(t){null==o||o.discard(),o=null,h+=1}e+=1}}if(l()||h>0){let e=h+(null!==o?1:0);for(let i=r;t.length>i;i++)null!==t[i]&&(e+=1);yh(e),null==o||o.discard(),o=null}i()}}}(n,tt,()=>{e===t&&(e=void 0)});e=t}E&&et.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&tt.adoptStyleSheets(document.adoptedStyleSheets,jd.getId(document))}finally{hh()}}};try{const t=[];t.push(yc("pagehide",()=>{try{null==e||e.flush()}catch(t){}e=void 0},window));for(const e of["visibilitychange","freeze","resume"])t.push(yc(e,Qu,document));Z=e=>{const i=G.get(e);i&&(i.forEach(e=>{_c(e);const i=t.indexOf(e);-1!==i&&t.splice(i,1)}),G.delete(e))},Q=()=>{for(const[t]of G){const e=jd.getNode(t);if(e)try{e.contentDocument&&e.contentDocument.defaultView||null==Z||Z(t)}catch(e){null==Z||Z(t)}else null==Z||Z(t)}};const i=t=>{var e;return Kc(ad)({mutationCb:K,mousemoveCb:(t,e)=>Rd({type:Tu.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.MouseInteraction},t)}),scrollCb:Y,viewportResizeCb:t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.ViewportResize},t)}),inputCb:t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.Input},t)}),mediaInteractionCb:t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.MediaInteraction},t)}),styleSheetRuleCb:t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.StyleSheetRule},t)}),styleDeclarationCb:t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.StyleDeclaration},t)}),canvasMutationCb:X,fontCb:t=>Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.Font},t)}),selectionCb(t){Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.Selection},t)})},customElementCb(t){Rd({type:Tu.IncrementalSnapshot,data:le({source:Iu.CustomElement},t)})},blockClass:r,ignoreClass:l,ignoreSelector:a,maskTextClass:u,maskTextSelector:h,maskInputOptions:z,inlineStylesheet:c,sampling:k,recordDOM:I,recordCanvas:M,canvasMaskingConfigured:nt,inlineImages:F,userTriggeredOnInput:R,collectFonts:A,doc:t,maskInputFn:g,maskTextFn:m,maskAllElementAttributes:y,maskAttributeFn:b,keepIframeSrcFn:D,blockSelector:o,slimDOMOptions:U,dataURLOptions:j,mirror:jd,iframeManager:et,stylesheetManager:tt,shadowDomManager:st,processedNodeManager:it,canvasManager:Fd,ignoreCSSAttributes:L,attributeFilter:N,plugins:(null==O||null===(e=O.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({observer:t.observer,options:t.options,callback:e=>Rd({type:Tu.Plugin,data:{plugin:t.name,payload:e}})})))||[]},_)};et.addLoadListener(e=>{try{const n=jd.getId(e),s=i(e.contentDocument);if("function"==typeof s&&(t.push(s),-1!==n)){let t=G.get(n);t||(t=new Set,G.set(n,t)),t.add(s)}}catch(t){console.warn(t)}}),et.addPageHideListener(t=>{const e=jd.getId(t);null==Z||Z(e),id(t)});let n=-1;const s=t=>Rd({type:Tu.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),d=()=>{var t,e,i,r;const o=document,l=null!==(t=null!==(e=null!==(i=null!==(r=o.fullscreenElement)&&void 0!==r?r:o.webkitFullscreenElement)&&void 0!==i?i:o.mozFullScreenElement)&&void 0!==e?e:o.msFullscreenElement)&&void 0!==t?t:null,a=l?jd.getId(l):-1;a!==n&&(-1!==n&&s({id:n,enter:!1}),n=a,-1!==a&&s({id:a,enter:!0}))},v=()=>{Ad();const e=i(document);"function"==typeof e&&t.push(e),t.push(yc("fullscreenchange",d)),t.push(yc("webkitfullscreenchange",d)),t.push(yc("mozfullscreenchange",d)),t.push(yc("MSFullscreenChange",d)),Nd=!0};return["interactive","complete"].includes(document.readyState)?v():(t.push(yc("DOMContentLoaded",()=>{Rd({type:Tu.DomContentLoaded,data:{}}),"DOMContentLoaded"===P&&v()})),t.push(yc("load",()=>{Rd({type:Tu.Load,data:{}}),"load"===P&&v()},window))),()=>{try{null==e||e.flush()}catch(t){}e=void 0,wc(t),it.destroy(),et.removeLoadListener(),et.destroy(),G.clear(),st.reset(),jd.reset(),Nd=!1,Jc()}}catch(t){console.warn(t)}}zd.addCustomEvent=(t,e)=>{if(!Nd)throw new Error("please add custom event after start recording");Rd({type:Tu.Custom,data:{tag:t,payload:e}})},zd.freezePage=()=>{Yc.forEach(t=>t.freeze())},zd.takeFullSnapshot=t=>{if(!Nd)throw new Error("please take full snapshot after start recording");Ad(t)},zd.mirror=jd,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date;var Ud=Object.create(null);function Wd(t){return Wd="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},Wd(t)}function Vd(t,e,i){return(e=function(t){var e=function(t){if("object"!=Wd(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Wd(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Wd(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}Ud.Node=Object.create(null),Ud.ShadowRoot=Object.create(null),Ud.MutationObserver=Object.create(null),Ud.Element=Object.create(null);var Gd=class{constructor(t){Vd(this,"fileName",void 0),Vd(this,"functionName",void 0),Vd(this,"lineNumber",void 0),Vd(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}`}},Zd=/(^|@)\S+:\d+/,Qd=/^\s*at .*(\S+:\d+|\(native\))/m,Jd=/^(eval@)?(\[native code])?$/,Kd={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(Qd)?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(Qd)},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 Gd({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(Jd)},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 Gd({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(e),n=i&&i[1]?i[1]:void 0,s=this.extractLocation(t.replace(e,""));return new Gd({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 Gd({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 Gd({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(Zd)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),i=this.extractLocation(e.pop());return new Gd({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function Yd(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 Xd(t){return Array.isArray(t)}function tv(t){return"object"==typeof t&&null!==t&&!Xd(t)}function ev(t,e){if(0===e)return!0;const i=Object.keys(t);for(const n of i)if(tv(t[n])&&ev(t[n],e-1))return!0;return!1}function iv(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(tv(r=e)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||tv(r)&&ev(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]=Xd(n)?Yd(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 nv={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 sv(t,e,i){const n=i?Object.assign({},nv,i):nv,s=n.logger;if(!s)return()=>{};let r;r="string"==typeof s?e[s]:s;let o=0,l=!1;const a=[];if(n.level.includes("error")){const i=e=>{const i=e.message;t({level:"error",trace:Kd.parse(e.error).map(t=>t.toString()),payload:[iv(i,n.stringifyOptions)]})};e.addEventListener("error",i),a.push(()=>{e.removeEventListener("error",i)});const s=e=>{let i,s;e.reason instanceof Error?(i=e.reason,s=[iv(`Uncaught (in promise) ${i.name}: ${i.message}`,n.stringifyOptions)]):(i=new Error,s=[iv("Uncaught (in promise)",n.stringifyOptions),iv(e.reason,n.stringifyOptions)]),t({level:"error",trace:Kd.parse(i).map(t=>t.toString()),payload:s})};e.addEventListener("unhandledrejection",s),a.push(()=>{e.removeEventListener("unhandledrejection",s)})}for(const t of n.level)a.push(u(r,t));return()=>{a.forEach(t=>t())};function u(e,i){return e[i]?function(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()=>{}}}(e,i,e=>(...s)=>{if(e.apply(this,s),!("assert"===i&&s[0]||l)){l=!0;try{const e=Kd.parse(new Error).map(t=>t.toString()).splice(1),r=("assert"===i?s.slice(1):s).map(t=>iv(t,n.stringifyOptions));o++,n.lengthThreshold>o?t({level:i,trace:e,payload:r}):o===n.lengthThreshold&&t({level:"warn",trace:[],payload:[iv("The number of log records reached the threshold.")]})}catch(t){e("rrweb logger error:",t,...s)}finally{l=!1}}}):()=>{}}}var rv=t=>({name:"rrweb/console@1",observer:sv,options:t});const ov=()=>{},lv=t=>{var e;if(ke(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function av(t,e,i){try{if(!(e in t))return ov;const n={next:t[e]},s=i(function(...t){return n.next.apply(this,t)});return ke(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=lv(i);for(;r;){if(r.next===s)return void(r.next=n.next);i=r.next,r=lv(i)}}}catch(t){return ov}}function uv(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 hv=As("[Recorder]"),cv=t=>"navigation"===t.entryType,dv=t=>"resource"===t.entryType;function vv(t,e){return!!e&&(Re(e)||e[t])}function fv(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 pv=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function gv({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:!!fv(e)&&t(e.url)}catch(t){return!1}}(n))return!1;if(s(pv))return!1;if(Re(e))return!0;if(we(e))return s(e);const r=e[t];return Re(r)?r:s(r)}function mv(t,e,i,n,s){return yv.apply(this,arguments)}function yv(){return yv=ne(function*(t,e,i,n,s,r=0){if(r>10)return hv.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=>dv(t)&&t.initiatorType===e&&(Ce(n)||t.startTime>=n)&&(Ce(s)||s>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*r)),mv(t,e,i,n,s,r+1))}),yv.apply(this,arguments)}function bv({body:t,options:e,url:i}){if(Me(t))return null;const{hostname:n,isHostDenied:s}=uv(i,e);if(s)return n+" is in deny list";if($e(t))return t;if((t=>"u">typeof Document&&t instanceof Document)(t))return t.textContent;if(Ae(t))return Qs(t);if(Se(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 _v=t=>!Ie(t)&&("navigation"===t.entryType||"resource"===t.entryType);function wv({entry:t,method:e,status:i,networkRequest:n,isInitial:s,start:r,end:o,url:l,initiatorType:a}){r=t?t.startTime:r,o=t?t.responseEnd:o;const u=Math.floor(Date.now()-performance.now()),h=Math.floor(u+(r||0)),c=[le(le({},t?t.toJSON():{name:l}),{},{startTime:Ce(r)?void 0:Math.round(r),endTime:Ce(o)?void 0:Math.round(o),timeOrigin:u,timestamp:h,method:e,initiatorType:a||(t?t.initiatorType:void 0),status:i,requestHeaders:n.requestHeaders,requestBody:n.requestBody,responseHeaders:n.responseHeaders,responseBody:n.responseBody,isInitial:s})];if(_v(t))for(const e of t.serverTiming||[])c.push({timeOrigin:u,timestamp:h,startTime:Math.round(t.startTime),name:e.name,duration:e.duration,entryType:"serverTiming"});return c}const kv=["video/","audio/"];function Sv(t){return Se(t)&&ke(t.getReader)&&ke(t.tee)}const xv="[SessionReplay] Timeout while trying to read body",Cv="[SessionReplay] Failed to read body";function $v(t){return`${Cv}: ${t}`}function Tv(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function Iv(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const i=setTimeout(()=>e(xv),500);try{t.clone().text().then(t=>e(t),t=>e($v(t))).finally(()=>clearTimeout(i))}catch(t){clearTimeout(i),e(Cv)}})}(t);const i=Ur(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(Tv(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(xv),500);let a;try{a=t.clone()}catch(t){return void o(Cv)}const u=a.body;if(!Sv(u)||"undefined"==typeof TextDecoder){try{a.text().then(t=>o(t),t=>o($v(t)))}catch(t){o(Cv)}return}try{n=u.getReader()}catch(t){return void o(Cv)}const h=[];let c=0;!function t(){n.read().then(({done:i,value:n})=>{if(s)r();else if(i)o((new TextDecoder).decode(function(t,e){const i=new Uint8Array(e);let n=0;for(const e of t)i.set(e,n),n+=e.byteLength;return i}(h,c)));else{if(n){if(c+n.byteLength>e)return void o(Tv(e));c+=n.byteLength,h.push(n)}t()}},t=>o($v(t)))}()})}(t,i)}function Mv(){return Mv=ne(function*({r:t,options:e,url:i}){const{hostname:n,isHostDenied:s}=uv(i,e);return s?Promise.resolve(n+" is in deny list"):Iv(t,e)}),Mv.apply(this,arguments)}function Ev(){return Ev=ne(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=kv.some(t=>null==s?void 0:s.startsWith(t));if(s&&r)return`Content-Type ${s} is not supported`;const{hostname:o,isHostDenied:l}=uv(i,e);return l?o+" is in deny list":null}({r:t,options:e,url:i});return Ie(n)?Iv(t,e):Promise.resolve(n)}),Ev.apply(this,arguments)}let Pv=null;function Rv(t,e,i){if(!("performance"in e))return()=>{};if(Pv)return hv.warn("Network observer already initialised, doing nothing"),()=>{};const n=i?Object.assign({},Wr,i):Wr,s=e=>{const i=[];let s=!1;e.requests.forEach(t=>{const e="serverTiming"===t.entryType;if(e&&s)return;const r=n.maskRequestFn(t);e||(s=!r||(t=>!!t&&Xr.has(t))(r)),r&&i.push(r)}),i.length>0&&t(le(le({},e),{},{requests:i}))},r=function(t,e,i){i.recordInitialRequests&&t({requests:e.performance.getEntries().filter(t=>cv(t)||dv(t)&&i.initiatorTypes.includes(t.initiatorType)).flatMap(t=>wv({entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0});const n=new e.PerformanceObserver(e=>{t({requests:e.getEntries().filter(t=>cv(t)||dv(t)&&i.initiatorTypes.includes(t.initiatorType)&&(t=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>wv({entry:t,method:void 0,status:void 0,networkRequest:{}}))})}),s=PerformanceObserver.supportedEntryTypes.filter(t=>i.performanceEntryTypeToObserve.includes(t));return n.observe({entryTypes:s}),()=>{n.disconnect()}}(s,e,n);let o=()=>{},l=()=>{};return(n.recordHeaders||n.recordBody)&&(o=function(t,e,i){if(!i.initiatorTypes.includes("xmlhttprequest"))return()=>{};const n=vv("request",i.recordHeaders),s=vv("response",i.recordHeaders),r=av(e.XMLHttpRequest.prototype,"open",r=>function(o,l,a=!0,u,h){const c=this;try{const r=new Request(l),a={};let u,h;const d={},v=c.setRequestHeader.bind(c);c.setRequestHeader=(t,e)=>(d[t]=e,v(t,e)),n&&(a.requestHeaders=d);const f=c.send.bind(c);c.send=t=>(gv({type:"request",headers:d,url:l,recordBody:i.recordBody})&&(a.requestBody=bv({body:t,options:i,url:l})),u=e.performance.now(),f(t));const p=()=>{c.removeEventListener("readystatechange",g),c.removeEventListener("error",p),c.removeEventListener("abort",p),c.removeEventListener("timeout",p)},g=()=>{if(c.readyState!==c.DONE)return;p(),h=e.performance.now();const n={};c.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(t=>{const e=t.split(": "),i=e.shift(),s=e.join(": ");i&&(n[i]=s)}),s&&(a.responseHeaders=n),gv({type:"response",headers:n,url:l,recordBody:i.recordBody})&&(a.responseBody=bv({body:c.response,options:i,url:l})),mv(e,"xmlhttprequest",r.url,u,h).then(e=>{t({requests:wv({entry:e,method:o,status:null==c?void 0:c.status,networkRequest:a,start:u,end:h,url:l.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};c.addEventListener("readystatechange",g),c.addEventListener("error",p),c.addEventListener("abort",p),c.addEventListener("timeout",p)}catch(t){hv.error("Failed to instrument XHR for network capture",t)}r.call(c,o,l.toString(),a,u,h)});return()=>{r()}}(s,e,n),l=function(t,e,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=vv("request",i.recordHeaders),s=vv("response",i.recordHeaders),r=av(e,"fetch",r=>function(){var o=ne(function*(o,l){let a,u;try{a=new Request(o,l)}catch(t){return hv.error("Failed to instrument fetch for network capture",t),r(o,l)}const h={};let c,d;try{try{const t={};a.headers.forEach((e,i)=>{t[i]=e}),n&&(h.requestHeaders=t),!Sv(null==l?void 0:l.body)&&gv({type:"request",headers:t,url:o,recordBody:i.recordBody})&&(h.requestBody=yield function(t){return Mv.apply(this,arguments)}({r:a,options:i,url:o}))}catch(t){hv.error("Failed to record fetch request for network capture",t)}c=e.performance.now(),u=fv(o)?yield r(a):yield r(o,l),d=e.performance.now();try{const t={};u.headers.forEach((e,i)=>{t[i]=e}),s&&(h.responseHeaders=t),gv({type:"response",headers:t,url:o,recordBody:i.recordBody})&&(h.responseBody=yield function(t){return Ev.apply(this,arguments)}({r:u,options:i,url:o}))}catch(t){hv.error("Failed to record fetch response for network capture",t)}return u}finally{mv(e,"fetch",a.url,c,d).then(e=>{t({requests:wv({entry:e,method:a.method,status:null==u?void 0:u.status,networkRequest:h,start:c,end:d,url:a.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(t,e){return o.apply(this,arguments)}}());return()=>{r()}}(s,e,n)),Pv=()=>{r(),o(),l(),Pv=null},Pv}const Av=t=>({name:"rrweb/network@1",observer:Rv,options:t});var Fv,Ov,Dv,Lv,Nv,qv,jv,Bv,Hv,zv,Uv,Wv,Vv,Gv,Zv;d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:rv,getRecordNetworkPlugin:Av},d.__PosthogExtensions__.rrweb={record:zd,version:"v2",wasMaxDepthReached:()=>fc,resetMaxDepthState(){fc=!1,vc=!1},getLastSnapshotCost:()=>ih,getMutationCost:()=>le({},lh),resetSnapshotCostState(){Yu=0,Xu=0,th=0,Zu=0,eh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},ih=null,nh=null,sh=[],rh=0,oh=0,lh={slowestBatchMs:0},ah={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},d.rrweb={record:zd,version:"v2"},d.rrwebConsoleRecord={getRecordConsolePlugin:rv},d.getRecordNetworkPlugin=Av,d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initSessionRecording=(t,e)=>new Cu(t,e);var Qv,Jv,Kv,Yv,Xv={},tf=[],ef=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,nf=Array.isArray;function sf(t,e){for(var i in e)t[i]=e[i];return t}function rf(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function of(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?Fv.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 lf(t,o,n,s,null)}function lf(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?++Dv:s,__i:-1,__u:0};return null==s&&null!=Ov.vnode&&Ov.vnode(r),r}function af(t){return t.children}function uf(t,e){this.props=t,this.context=e}function hf(t,e){if(null==e)return t.__?hf(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?hf(t):null}function cf(t){if(t.__P&&t.__d){var e=t.__v,i=e.__e,n=[],s=[],r=sf({},e);r.__v=e.__v+1,Ov.vnode&&Ov.vnode(r),wf(t.__P,r,e,t.__n,t.__P.namespaceURI,32&e.__u?[i]:null,n,null==i?hf(e):i,!!(32&e.__u),s),r.__v=e.__v,r.__.__k[r.__i]=r,Sf(n,r,s),e.__e=e.__=null,r.__e!=i&&df(r)}}function df(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}),df(t)}function vf(t){(!t.__d&&(t.__d=!0)&&Lv.push(t)&&!ff.__r++||Nv!=Ov.debounceRendering)&&((Nv=Ov.debounceRendering)||qv)(ff)}function ff(){try{for(var t,e=1;Lv.length;)Lv.length>e&&Lv.sort(jv),t=Lv.shift(),e=Lv.length,cf(t)}finally{Lv.length=ff.__r=0}}function pf(t,e,i,n,s,r,o,l,a,u,h){var c,d,v,f,p,g,m,y=n&&n.__k||tf,b=e.length;for(a=function(t,e,i,n,s){var r,o,l,a,u,h=i.length,c=h,d=0;for(t.__k=new Array(s),r=0;s>r;r++)null!=(o=e[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=t.__k[r]=lf(null,o,null,null,null):nf(o)?o=t.__k[r]=lf(af,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=t.__k[r]=lf(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):t.__k[r]=o,a=r+d,o.__=t,o.__b=t.__b+1,l=null,-1!=(u=o.__i=mf(o,i,a,c))&&(c--,(l=i[u])&&(l.__u|=2)),null==l||null==l.__v?(-1==u&&(s>h?d--:h>s&&d++),"function"!=typeof o.type&&(o.__u|=4)):u!=a&&(u==a-1?d--:u==a+1?d++:(u>a?d--:d++,o.__u|=4))):t.__k[r]=null;if(c)for(r=0;h>r;r++)null!=(l=i[r])&&!(2&l.__u)&&(l.__e==n&&(n=hf(l)),$f(l,l));return n}(i,e,y,a,b),c=0;b>c;c++)null!=(v=i.__k[c])&&(d=-1!=v.__i&&y[v.__i]||Xv,v.__i=c,g=wf(t,v,d,s,r,o,l,a,u,h),f=v.__e,v.ref&&d.ref!=v.ref&&(d.ref&&Cf(d.ref,null,v),h.push(v.ref,v.__c||f,v)),null==p&&null!=f&&(p=f),(m=!!(4&v.__u))||d.__k===v.__k?(a=gf(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 gf(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=gf(s[r],e,i,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=hf(t)),i.insertBefore(t.__e,e||null)),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function mf(t,e,i,n){var s,r,o,l=t.key,a=t.type,u=e[i],h=null!=u&&!(2&u.__u);if(null===u&&null==l||h&&l==u.key&&a==u.type)return i;if(n>(h?1:0))for(s=i-1,r=i+1;s>=0||e.length>r;)if(null!=(u=e[o=0>s?r++:s--])&&!(2&u.__u)&&l==u.key&&a==u.type)return o;return-1}function yf(t,e,i){"-"==e[0]?t.setProperty(e,null==i?"":i):t[e]=null==i?"":"number"!=typeof i||ef.test(e)?i:i+"px"}function bf(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||yf(t.style,e,"");if(i)for(e in i)n&&i[e]==n[e]||yf(t.style,e,i[e])}else if("o"==e[0]&&"n"==e[1])r=e!=(e=e.replace(Uv,"$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[zv]=n[zv]:(i[zv]=Wv,t.addEventListener(e,r?Gv:Vv,r)):t.removeEventListener(e,r?Gv:Vv,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 _f(t){return function(e){if(this.l){var i=this.l[e.type+t];if(null==e[Hv])e[Hv]=Wv++;else if(i[zv]>e[Hv])return;return i(Ov.event?Ov.event(e):e)}}}function wf(t,e,i,n,s,r,o,l,a,u){var h,c,d,v,f,p,g,m,y,b,$,_,w,k,S,x,C=e.type;if(void 0!==e.constructor)return null;128&i.__u&&(a=!!(32&i.__u),r=[l=e.__e=i.__e]),(h=Ov.__b)&&h(e);t:if("function"==typeof C){c=o.length;try{if(y=e.props,b=C.prototype&&C.prototype.render,$=(h=C.contextType)&&n[h.__c],_=h?$?$.props.value:h.__:n,i.__c?m=(d=e.__c=i.__c).__=d.__E:(b?e.__c=d=new C(y,_):(e.__c=d=new uf(y,_),d.constructor=C,d.render=Tf),$&&$.sub(d),d.state||(d.state={}),d.__n=n,v=d.__d=!0,d.__h=[],d._sb=[]),b&&null==d.__s&&(d.__s=d.state),b&&null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=sf({},d.__s)),sf(d.__s,C.getDerivedStateFromProps(y,d.__s))),f=d.props,p=d.state,d.__v=e,v)b&&null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),b&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(b&&null==C.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,_),e.__v==i.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,_)){e.__v!=i.__v&&(d.props=y,d.state=d.__s,d.__d=!1),e.__e=i.__e,e.__k=i.__k,e.__k.some(function(t){t&&(t.__=e)}),tf.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=Ov.__r,k=0,b)d.state=d.__s,d.__d=!1,w&&w(e),h=d.render(d.props,d.state,d.context),tf.push.apply(d.__h,d._sb),d._sb=[];else do{d.__d=!1,w&&w(e),h=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&25>++k);d.state=d.__s,null!=d.getChildContext&&(n=sf(sf({},n),d.getChildContext())),b&&!v&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(f,p)),S=null!=h&&h.type===af&&null==h.key?xf(h.props.children):h,l=pf(t,nf(S)?S:[S],e,i,n,s,r,o,l,a,u),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),m&&(d.__E=d.__=null)}catch(t){if(o.length=c,e.__v=null,a||null!=r)if(t.then){for(e.__u|=a?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;null!=r&&(r[r.indexOf(l)]=null),e.__e=l}else{if(null!=r)for(x=r.length;x--;)rf(r[x]);kf(e)}else e.__e=i.__e,!e.__k&&i.__k&&(e.__k=i.__k),t.then||kf(e);Ov.__e(t,e,i)}}else null==r&&e.__v==i.__v?(e.__k=i.__k,e.__e=i.__e):l=e.__e=function(t,e,i,n,s,r,o,l,a){var u,h,c,d,v,f,p,g=i.props||Xv,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&&(Ov.__m&&Ov.__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&&Fv.call(t.childNodes),!l&&null!=r)for(g={},u=0;t.attributes.length>u;u++)g[(v=t.attributes[u]).name]=v.value;for(u in g)v=g[u],"dangerouslySetInnerHTML"==u?c=v:"children"==u||u in m||"value"==u&&"defaultValue"in m||"checked"==u&&"defaultChecked"in m||bf(t,u,null,v,s);for(u in m)v=m[u],"children"==u?d=v:"dangerouslySetInnerHTML"==u?h=v:"value"==u?f=v:"checked"==u?p=v:l&&"function"!=typeof v||g[u]===v||bf(t,u,v,g[u],s);if(h)l||c&&(h.__html==c.__html||h.__html==t.innerHTML)||(t.innerHTML=h.__html),e.__k=[];else if(c&&(t.innerHTML=""),pf("template"==e.type?t.content:t,nf(d)?d:[d],e,i,n,"foreignObject"==y?"http://www.w3.org/1999/xhtml":s,r,o,r?r[0]:i.__k&&hf(i,0),l,a),null!=r)for(u=r.length;u--;)rf(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])&&bf(t,u,f,g[u],s),u="checked",null!=p&&p!=t[u]&&bf(t,u,p,g[u],s))}return t}(i.__e,e,i,n,s,r,o,a,u);return(h=Ov.diffed)&&h(e),128&e.__u?void 0:l}function kf(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(kf))}function Sf(t,e,i){for(var n=0;i.length>n;n++)Cf(i[n],i[++n],i[++n]);Ov.__c&&Ov.__c(e,t),t.some(function(e){try{t=e.__h,e.__h=[],t.some(function(t){t.call(e)})}catch(t){Ov.__e(t,e.__v)}})}function xf(t){return"object"!=typeof t||null==t||t.__b>0?t:nf(t)?t.map(xf):void 0!==t.constructor?null:sf({},t)}function Cf(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){Ov.__e(t,i)}}function $f(t,e,i){var n,s;if(Ov.unmount&&Ov.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Cf(n,null,e)),null!=(n=t.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(t){Ov.__e(t,e)}n.base=n.__P=n.__n=null}if(n=t.__k)for(s=0;n.length>s;s++)n[s]&&$f(n[s],e,i||"function"!=typeof t.type);i||rf(t.__e),t.__c=t.__=t.__e=void 0}function Tf(t,e,i){return this.constructor(t,i)}function If(t,e,i){var n,s,r,o;e==document&&(e=document.documentElement),Ov.__&&Ov.__(t,e),s=(n="function"==typeof i)?null:i&&i.__k||e.__k,r=[],o=[],wf(e,t=(!n&&i||e).__k=of(af,null,[t]),s||Xv,Xv,e.namespaceURI,!n&&i?[i]:s?null:e.firstChild?Fv.call(e.childNodes):null,r,!n&&i?i:s?s.__e:e.firstChild,n,o),Sf(r,t,o),t.props.children=null}Fv=tf.slice,Ov={__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}},Dv=0,uf.prototype.setState=function(t,e){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=sf({},this.state);"function"==typeof t&&(t=t(sf({},i),this.props)),t&&sf(i,t),null!=t&&this.__v&&(e&&this._sb.push(e),vf(this))},uf.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),vf(this))},uf.prototype.render=af,Lv=[],qv="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,jv=function(t,e){return t.__v.__b-e.__v.__b},ff.__r=0,Bv=Math.random().toString(8),Hv="__d"+Bv,zv="__a"+Bv,Uv=/(PointerCapture)$|Capture$/i,Wv=0,Vv=_f(!1),Gv=_f(!0),Zv=0;var Mf=0,Ef=[],Pf=Ov,Rf=Pf.__b,Af=Pf.__r,Ff=Pf.diffed,Of=Pf.__c,Df=Pf.unmount,Lf=Pf.__;function Nf(t,e){Pf.__h&&Pf.__h(Jv,t,Mf||e),Mf=0;var i=Jv.__H||(Jv.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function qf(t){return Mf=1,function(t,e){var i=Nf(Qv++,2);if(i.t=t,!i.__c&&(i.__=[Jf(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=Jv,!Jv.__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};Jv.__f=!0;var s=Jv.shouldComponentUpdate,r=Jv.componentWillUpdate;Jv.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)},Jv.shouldComponentUpdate=n}return i.__N||i.__}(Jf,t)}function jf(t,e){var i=Nf(Qv++,3);!Pf.__s&&Qf(i.__H,e)&&(i.__=t,i.u=e,Jv.__H.__h.push(i))}function Bf(t){return Mf=5,Hf(function(){return{current:t}},[])}function Hf(t,e){var i=Nf(Qv++,7);return Qf(i.__H,e)&&(i.__=t(),i.__H=e,i.__h=t),i.__}function zf(t){var e=Jv.context[t.__c],i=Nf(Qv++,9);return i.c=t,e?(null==i.__&&(i.__=!0,e.sub(Jv)),e.props.value):t.__}function Uf(){for(var t;t=Ef.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(Gf),e.__h.some(Zf),e.__h=[]}catch(i){e.__h=[],Pf.__e(i,t.__v)}}}Pf.__b=function(t){Jv=null,Rf&&Rf(t)},Pf.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Lf&&Lf(t,e)},Pf.__r=function(t){Af&&Af(t),Qv=0;var e=(Jv=t.__c).__H;e&&(Kv===Jv?(e.__h=[],Jv.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.length&&Uf(),Qv=0)),Kv=Jv},Pf.diffed=function(t){Ff&&Ff(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==Ef.push(e)&&Yv===Pf.requestAnimationFrame||((Yv=Pf.requestAnimationFrame)||Vf)(Uf)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),Kv=Jv=null},Pf.__c=function(t,e){e.some(function(t){try{t.__h.some(Gf),t.__h=t.__h.filter(function(t){return!t.__||Zf(t)})}catch(i){e.some(function(t){t.__h&&(t.__h=[])}),e=[],Pf.__e(i,t.__v)}}),Of&&Of(t,e)},Pf.unmount=function(t){Df&&Df(t);var e,i=t.__c;i&&i.__H&&(i.__H.__.some(function(t){try{Gf(t)}catch(t){e=t}}),i.__H=void 0,e&&Pf.__e(e,i.__v))};var Wf="function"==typeof requestAnimationFrame;function Vf(t){var e,i=function(){clearTimeout(n),Wf&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(i,35);Wf&&(e=requestAnimationFrame(i))}function Gf(t){var e=Jv,i=t.__c;"function"==typeof i&&(t.__c=void 0,i()),Jv=e}function Zf(t){var e=Jv;t.__c=t.__(),Jv=e}function Qf(t,e){return!t||t.length!==e.length||e.some(function(e,i){return e!==t[i]})}function Jf(t,e){return"function"==typeof e?e(t):e}const Kf="gzip-js",Yf="base64",Xf="events",tp="cancelEvents",ep="tab",ip="left",np="center",sp="right",rp="next_to_trigger",op="popover",lp="widget",ap="external_survey",up="open",hp="multiple_choice",cp="single_choice",dp="rating",vp="end",fp="always",pp="survey shown",gp="survey dismissed",mp="survey sent",yp="$survey_id",bp="$survey_name",_p="$survey_iteration",wp="$survey_iteration_start_date",kp="$survey_partially_completed",Sp="$survey_submission_id",xp="$survey_completed",Cp="$survey_last_seen_date",$p="$survey_language",Tp="popover";function Ip(t){let e=!0;return{dispose(){if(e){e=!1;const i=t();i&&ke(i.then)&&i.then(void 0,()=>{})}}}}const Mp=As("[Surveys]"),Ep="PostHog is not capturing, so a survey response cannot be recorded";function Pp(t){return ke(t.is_capturing)?t.is_capturing():!t.has_opted_out_capturing()}function Rp(t){return!(!t.start_date||t.end_date)}function Ap(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 Fp=(t,e)=>`${t}${function(t){return t.current_iteration&&t.current_iteration>0?`${t.id}_${t.current_iteration}`:t.id}(e)}`,Op=t=>Fp("seenSurvey_",t),Dp=t=>{try{const e=Op(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){Mp.error("Failed to persist survey seen state",t)}},Lp=[op,lp,"api"],Np={ignoreConditions:!1,ignoreDelay:!1,displayType:Tp},qp="logs",jp=As("[Stylesheet Loader]"),Bp=t,Hp=n,zp="#020617",Up={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:sp,widgetType:ep,widgetLabel:"Feedback",widgetColor:"black",zIndex:String(2147483645),disabledButtonOpacity:"0.6",maxWidth:"300px",textSubtleColor:"#939393",boxPadding:"20px 24px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"10px",shuffleQuestions:!1,surveyPopupDelaySeconds:void 0,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:zp,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},Wp=[np,ip,sp];function Vp(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 Gp(t=Up.backgroundColor){let e;"#"===t[0]&&(e=Vp(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=Vp(i)),!e)return zp;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?zp:"white"}return zp}const Zp=(t,e,i)=>{const n=vg(t),s=Hp.querySelector(`.${n}`);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};const r=Hp.createElement("div");((t,e,i)=>{const n=le(le({},Up),i),s=t.style,r=!Wp.includes(n.position)||e===lp&&(null==i?void 0:i.widgetType)===ep;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)||Gp(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",Gp(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||Gp(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",Gp(n.widgetColor)),s.setProperty("--ph-widget-z-index",n.zIndex);const o=(null==i?void 0:i.inputBackground)||(null==i?void 0:i.inputBackgroundColor);let l=o||n.inputBackground;o||"white"!==n.backgroundColor||(l="#f8f8f8"),s.setProperty("--ph-survey-input-background",l);const a=(null==i?void 0:i.inputTextColor)||Gp(l);s.setProperty("--ph-survey-input-text-color",a),s.setProperty("--ph-survey-rating-text-color",a),s.setProperty("--ph-survey-scrollbar-thumb-color",n.scrollbarThumbColor),s.setProperty("--ph-survey-scrollbar-track-color",n.scrollbarTrackColor),s.setProperty("--ph-survey-outline-color",n.outlineColor)})(r,t.type,t.appearance),r.className=n;const o=r.attachShadow({mode:"open"}),l=function(t){const e=((t,e,i)=>{let n=t.createElement("style");n.innerText=e;const s=(t=>{var e;return ke(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||(jp.error("prepare_external_dependency_stylesheet returned null"),null)})(Hp,':host{--ph-survey-font-family:-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--ph-survey-box-padding:20px 24px;--ph-survey-max-width:300px;--ph-survey-z-index:calc(2147480000 + 3645);--ph-survey-border-color:#dcdcdc;--ph-survey-border-bottom:1.5px solid var(--ph-survey-border-color);--ph-survey-border-radius:10px;--ph-survey-background-color:#eeeded;--ph-survey-box-shadow:0 4px 12px #00000026;--ph-survey-submit-button-color:black;--ph-survey-submit-button-text-color:white;--ph-survey-rating-bg-color:white;--ph-survey-rating-text-color:#020617;--ph-survey-rating-active-bg-color:black;--ph-survey-rating-active-text-color:white;--ph-survey-text-primary-color:#020617;--ph-survey-text-subtle-color:#939393;--ph-widget-color:#e0a045;--ph-widget-text-color:white;--ph-survey-scrollbar-thumb-color:var(--ph-survey-border-color);--ph-survey-scrollbar-track-color:var(--ph-survey-background-color);--ph-survey-outline-color:#3b82f6cc;--ph-survey-input-background:white;--ph-survey-input-text-color:#020617;--ph-survey-disabled-button-opacity:.6}.ph-survey{min-width:300px;width:var(--ph-survey-max-width);max-width:85%;z-index:var(--ph-survey-z-index);height:fit-content;margin:0;position:fixed;bottom:0}.ph-survey h3,.ph-survey p{margin:0}.ph-survey *{box-sizing:border-box;font-family:var(--ph-survey-font-family);color:var(--ph-survey-text-primary-color)}.ph-survey textarea,.ph-survey input[type=text],.ph-survey .multiple-choice-options label{color:var(--ph-survey-input-text-color);background:var(--ph-survey-input-background);border:1.5px solid var(--ph-survey-border-color);border-radius:4px;padding:10px;transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey textarea,.ph-survey input[type=text]{transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input{margin:0}.ph-survey textarea:focus,.ph-survey textarea:focus-visible,.ph-survey input[type=text]:focus,.ph-survey input[type=text]:focus-visible,.ph-survey .form-submit:focus,.ph-survey .form-submit:focus-visible,.ph-survey input[type=checkbox]:focus,.ph-survey input[type=radio]:focus,.ph-survey input[type=checkbox]:focus-visible,.ph-survey input[type=radio]:focus-visible{outline:1.5px solid var(--ph-survey-outline-color);border-color:var(--ph-survey-rating-active-bg-color);outline-offset:2px}.ph-survey textarea:focus:not(:focus-visible),.ph-survey input[type=text]:focus:not(:focus-visible),.ph-survey button:focus:not(:focus-visible),.ph-survey input[type=checkbox]:focus:not(:focus-visible),.ph-survey input[type=radio]:focus:not(:focus-visible){outline:none}.ph-survey textarea:hover:not(:focus),.ph-survey input[type=text]:hover:not(:focus){border-color:var(--ph-survey-rating-active-bg-color)}@media (max-width:768px){.ph-survey textarea,.ph-survey input[type=text]{font-size:1rem}}.ph-survey .multiple-choice-options label,.ph-survey .rating-options-number,.ph-survey .form-cancel,.ph-survey input[type=checkbox],.ph-survey input[type=radio]{border:1.5px solid var(--ph-survey-border-color)}.ph-survey label,.ph-survey input[type=checkbox],.ph-survey input[type=radio],.ph-survey .ratings-emoji,.ph-survey .ratings-number,.ph-survey .footer-branding,.ph-survey .form-cancel,.ph-survey .form-submit{transition:all .2s ease-out}@media (prefers-reduced-motion:no-preference){.ph-survey button:active,.ph-survey input[type=checkbox]:active,.ph-survey input[type=radio]:active,.ph-survey label:active{transition-duration:.1s}}.ph-survey-widget-tab{background:var(--ph-widget-color);color:var(--ph-widget-text-color);text-align:center;cursor:pointer;z-index:var(--ph-survey-z-index);border:none;border-radius:3px 3px 0 0;padding:10px 12px;transition:padding .2s ease-out;position:fixed}.ph-survey-widget-tab:hover:not(.widget-tab-top){padding-bottom:16px}.ph-survey-widget-tab.widget-tab-top{border-radius:0 0 3px 3px}.ph-survey-widget-tab.widget-tab-top:hover{padding-top:16px}@keyframes ph-survey-fade-in{0%{opacity:0}to{opacity:1}}.survey-box{flex-direction:column;gap:16px;display:flex}.bottom-section{flex-direction:column;gap:8px;display:flex}.thank-you-message-header~.bottom-section,.intro-screen-header~.bottom-section{padding-top:16px}.question-container,.thank-you-message,.intro-screen{flex-direction:column;gap:8px;display:flex}.survey-question{font-size:14px;font-weight:500}.survey-question-description{opacity:.8;padding-top:4px;font-size:13px}.survey-question-description,.thank-you-message-body,.intro-screen-body{word-wrap:break-word;overflow-wrap:break-word}:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) img,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) video,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) iframe,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) embed,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) object,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) svg{max-width:100%;height:auto}.question-textarea-wrapper{flex-direction:column;display:flex}.survey-form{animation:.3s ease-out forwards ph-survey-fade-in}.survey-form,.thank-you-message,.intro-screen{text-align:left;width:100%;z-index:var(--ph-survey-z-index);border:1.5px solid var(--ph-survey-border-color);border-bottom:var(--ph-survey-border-bottom);background:var(--ph-survey-background-color);border-radius:var(--ph-survey-border-radius);box-shadow:var(--ph-survey-box-shadow);padding:var(--ph-survey-box-padding);margin:0;position:relative}.survey-form textarea,.survey-form input[type=text]{min-width:100%}.survey-form textarea:focus,.survey-form textarea:focus-visible{box-shadow:0 4px 12px #00000014}.survey-form textarea:focus:not(:focus-visible){box-shadow:none}.survey-box .question-header--empty~.multiple-choice-options,.survey-box .question-header--empty~textarea{margin-top:0}.multiple-choice-options{border:none;flex-direction:column;gap:8px;margin:0;padding:1px 0;font-size:14px;display:flex}.multiple-choice-options label,.multiple-choice-options .response-choice{color:inherit;align-items:center;gap:8px;display:flex}.multiple-choice-options label{cursor:pointer;font-size:13px}.multiple-choice-options label:hover:not(:has(input:checked)){border-color:var(--ph-survey-text-subtle-color);box-shadow:0 2px 8px #00000014}.multiple-choice-options label:has(input:checked){border-color:var(--ph-survey-rating-active-bg-color);box-shadow:0 1px 4px #0000000d}.multiple-choice-options label.choice-option-open{flex-wrap:wrap}.multiple-choice-options label span{color:inherit}.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ph-survey-input-background);cursor:pointer;z-index:1;border-radius:3px;flex-shrink:0;width:1rem;height:1rem;transition:all .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out;position:relative}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):focus{transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):hover{border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):active{transform:scale(.95)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked{background:var(--ph-survey-rating-active-bg-color);border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked:hover{transform:scale(1.05)}.multiple-choice-options input[type=checkbox]:checked:after{border:solid var(--ph-survey-rating-active-text-color);border-width:0 2px 2px 0;width:4px;height:8px;animation:.2s ease-out .1s forwards ph-survey-checkmark-reveal;left:4px;transform:rotate(45deg)scale(0)}.multiple-choice-options input[type=radio]:checked:after{background:var(--ph-survey-rating-active-text-color);border-radius:50%;width:6px;height:6px;animation:.15s ease-out 50ms forwards ph-survey-radio-reveal;top:5px;left:5px;transform:scale(0)}.multiple-choice-options input[type=checkbox]:checked:after,.multiple-choice-options input[type=radio]:checked:after{content:"";box-sizing:content-box;position:absolute}.multiple-choice-options input[type=radio]{border-radius:50%}.multiple-choice-options input[type=radio]:checked{border:none}:is(.multiple-choice-options input[type=checkbox]:checked,.multiple-choice-options input[type=radio]:checked)~*{font-weight:700}.multiple-choice-options .choice-option-open input[type=text]::placeholder{color:var(--ph-survey-text-subtle-color);font-weight:400}.rating-options-emoji{justify-content:space-between;display:flex}.rating-options-emoji-2{justify-content:space-around}.ratings-emoji{opacity:.5;background-color:#0000;border:none;padding:0;font-size:16px}.ratings-emoji:hover{cursor:pointer;opacity:1;transform:scale(1.15)}.ratings-emoji.rating-active{opacity:1}.ratings-emoji svg{fill:var(--ph-survey-text-primary-color);transition:fill .2s ease-out}.rating-options-number{border-radius:6px;grid-auto-columns:1fr;grid-auto-flow:column;display:grid;overflow:hidden}.rating-options-number .ratings-number{border-right:1px solid var(--ph-survey-border-color);text-align:center;cursor:pointer;color:var(--ph-survey-rating-text-color);border-top:none;border-bottom:none;border-left:none;font-weight:700}.rating-options-number .ratings-number:last-of-type{border-right:0}.rating-options-number .ratings-number.rating-active{background:var(--ph-survey-rating-active-bg-color);color:var(--ph-survey-rating-active-text-color)}.ratings-number{background-color:var(--ph-survey-rating-bg-color);border:none;padding:8px 0}.ratings-number .rating-active{background-color:var(--ph-survey-rating-active-bg-color)}.ratings-number{cursor:pointer}@media (hover:hover) and (pointer:fine){.ratings-number:hover:not(.rating-active){background-color:color-mix(in srgb, var(--ph-survey-rating-active-bg-color) 14%, var(--ph-survey-rating-bg-color))}}.rating-text{opacity:.7;flex-direction:row;justify-content:space-between;font-size:11px;display:flex}.form-buttons{flex-direction:row;gap:8px;width:100%;display:flex}.form-buttons-with-back>.form-submit{flex:auto;min-width:0}.form-submit{text-align:center;cursor:pointer;user-select:none;background:var(--ph-survey-submit-button-color);color:var(--ph-survey-submit-button-text-color);border:none;border-radius:6px;min-width:100%;padding:12px;font-weight:700;box-shadow:0 2px #0000000b}.form-submit:not([disabled]):hover{transform:scale(1.02);box-shadow:0 4px 8px #0000001a}.form-submit:not([disabled]):active{transform:scale(.98);box-shadow:0 1px 2px #0000000d}.form-submit[disabled]{opacity:var(--ph-survey-disabled-button-opacity);cursor:not-allowed}.form-back{text-align:center;cursor:pointer;user-select:none;color:var(--ph-survey-text-primary-color);border:1.5px solid var(--ph-survey-border-color);background:0 0;border-radius:6px;flex:none;padding:12px 16px;font-weight:600}.form-back:hover{transform:scale(1.02)}.form-back:active{transform:scale(.98)}.validation-hint{opacity:.7;margin-top:4px;font-size:12px}.form-cancel{cursor:pointer;background:#fff;border-radius:100%;padding:12px;line-height:0;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.form-cancel:hover{opacity:.7;transform:translate(50%,-50%)scale(1.1)}.footer-branding{opacity:.6;justify-content:center;align-items:center;gap:4px;font-size:11px;font-weight:500;text-decoration:none;display:flex}.footer-branding:hover{opacity:1}.footer-branding a{text-decoration:none}.thank-you-message{text-align:center}.thank-you-message-header{margin:10px 0 0}.thank-you-message-body{opacity:.8;font-size:14px}.intro-screen{text-align:center;animation:.3s ease-out forwards ph-survey-fade-in}.intro-screen-header{margin:10px 0 0}.intro-screen-body{opacity:.8;font-size:14px}.limit-height{scrollbar-width:thin;scrollbar-color:var(--ph-survey-scrollbar-thumb-color) var(--ph-survey-scrollbar-track-color);max-height:256px;overflow:hidden auto}.limit-height::-webkit-scrollbar{width:8px}.limit-height::-webkit-scrollbar-track{background:var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb{background-color:var(--ph-survey-scrollbar-thumb-color);border:2px solid var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb:hover{background-color:var(--ph-survey-text-subtle-color)}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.ph-survey *{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@keyframes ph-survey-checkmark-reveal{0%{opacity:0;transform:rotate(45deg)scale(0)}50%{opacity:1;transform:rotate(45deg)scale(1.2)}to{opacity:1;transform:rotate(45deg)scale(1)}}@keyframes ph-survey-radio-reveal{0%{opacity:0;transform:scale(0)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}',t);return null==e||e.setAttribute("data-ph-survey-style","true"),e}(e);if(l){const t=o.querySelector("style");t&&o.removeChild(t),o.appendChild(l)}return(i||Hp.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},Qp=({responses:t,survey:e,surveySubmissionId:i,posthog:n,isSurveyCompleted:s,properties:r,surveyLanguage:o,questionSnapshots:l})=>{var a;n?Pp(n)&&(Dp(e),n.capture(mp,le(le(le(le({[bp]:e.name,[yp]:e.id,[_p]:e.current_iteration,[wp]:e.current_iteration_start_date,[Sp]:i,[xp]:s},o&&{[$p]:o}),{},{sessionRecordingUrl:null===(a=n.get_session_replay_url)||void 0===a?void 0:a.call(n)},Ul(t,e,l)),r),{},{$set:{[Vl(e,"responded")]:!0}})),s&&(Bp.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:e.id}})),dg(e),n.reloadFeatureFlags())):Mp.error("[survey sent] event not captured, PostHog instance not found.")},Jp=(t,e,i)=>{var n;return le(le({[bp]:t.name,[yp]:t.id,[_p]:t.current_iteration,[wp]:t.current_iteration_start_date,[kp]:Wl(null==e?void 0:e.responses)},(null==e?void 0:e.surveyLanguage)&&{[$p]:e.surveyLanguage}),{},{sessionRecordingUrl:null===(n=i.get_session_replay_url)||void 0===n?void 0:n.call(i),[Sp]:null==e?void 0:e.surveySubmissionId},Ul(null==e?void 0:e.responses,t,null==e?void 0:e.questionSnapshots))},Kp=(t,e,i,n)=>{if(!e)return void Mp.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const s=hg(t),r=s?s.surveyLanguage:n;e.capture(gp,le(le(le({},Jp(t,s,e)),r&&{[$p]:r}),{},{$set:{[Vl(t,"dismissed")]:!0}})),dg(t),Dp(t),Bp.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:t.id}}))},Yp=(t,e)=>{if(!e)return void Mp.error("[survey abandoned] event not captured, PostHog instance not found.");const i=(t=>Fp("abandonedSurvey_",t))(t);try{if("true"===localStorage.getItem(i))return}catch(t){return}const n=hg(t);if(n){try{localStorage.setItem(i,"true")}catch(t){}e.capture("survey abandoned",Jp(t,n,e),{transport:"sendBeacon"})}},Xp=t=>t.map(t=>({sort:Math.floor(10*Math.random()),value:t})).sort((t,e)=>t.sort-e.sort).map(t=>t.value),tg=(t,e)=>t.length===e.length&&t.every((t,i)=>t===e[i])?e.reverse():e,eg=t=>{const e=t.map(t=>t.id);return e.every(t=>!!t)?e:void 0},ig=(t,e)=>{return(t=>t.questions.some(t=>{var e;return!!(null===(e=t.branching)||void 0===e?void 0:e.type)}))(t)?t.questions:e?null!==(i=((t,e)=>{if(!e||e.length!==t.questions.length)return null;const i=new Map(t.questions.map(t=>[t.id,t])),n=[];for(const t of e){const e=i.get(t);if(!e)return null;n.push(e)}return n})(t,e.questionOrder))&&void 0!==i?i:t.questions:t.appearance&&t.appearance.shuffleQuestions&&!t.enable_partial_responses?tg(t.questions,Xp(t.questions)):t.questions;var i},ng=t=>Xl(t)||cg(t),sg=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,vf(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"+Zv++,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}),rg=()=>zf(sg),og=({component:t,children:e,renderAsHtml:i,style:n})=>function(t,e,i){var n,s,r,o,l=sf({},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?Fv.call(arguments,2):i),lf(t.type,l,n||t.key,s||t.ref,null)}(t,i?{dangerouslySetInnerHTML:{__html:e},style:n}:{children:e,style:n});function lg(t,e){var i,n;if(!(null===(i=t.conditions)||void 0===i?void 0:i.url))return!0;const s=ir(e);if(!s)return!1;const r=[t.conditions.url],o=function(t){return null!=t?t:"icontains"}(null===(n=t.conditions)||void 0===n?void 0:n.urlMatchType);return ia[o](r,[s])}const ag=t=>Fp("inProgressSurvey_",t),ug=(t,e)=>{try{localStorage.setItem(ag(t),JSON.stringify(e))}catch(t){Mp.error("Error setting in-progress survey state in localStorage",t)}},hg=t=>{try{const e=localStorage.getItem(ag(t));if(e)return JSON.parse(e)}catch(t){Mp.error("Error getting in-progress survey state from localStorage",t)}return null},cg=t=>{const e=hg(t);return!Me(null==e?void 0:e.surveySubmissionId)},dg=t=>{try{localStorage.removeItem(ag(t))}catch(t){Mp.error("Error clearing in-progress survey state from localStorage",t)}};function vg(t,e=!1){const i=`PostHogSurvey-${t.id}`;return e?`.${i}`:i}function fg(t,e=sp,i){if(t===ap)return{};switch(e){case"top_left":return{top:"0",left:"0",transform:"translate(30px, 30px)"};case"top_right":return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case"top_center":return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case"middle_left":return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case"middle_right":return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case"middle_center":return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case ip:return{left:"30px"};case np:return{left:"50%",transform:"translateX(-50%)"};default:return{right:t===lp&&i===ep?"60px":"30px"}}}var pg=0;function gg(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:--pg,__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 Ov.vnode&&Ov.vnode(u),u}const mg=gg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:gg("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"})}),yg=gg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:gg("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"})}),bg=gg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:gg("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"})}),_g=gg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:gg("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"})}),wg=gg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:gg("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"})}),kg=gg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:gg("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"})}),Sg=gg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:gg("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"})}),xg=({fill:t="currentColor"}={})=>gg("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:[gg("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),gg("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})]}),Cg=gg("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[gg("g",{"clip-path":"url(#clip0_2415_6911)",children:[gg("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:gg("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),gg("g",{mask:"url(#mask0_2415_6911)",children:[gg("path",{d:"M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z",fill:"#1D4AFF"}),gg("path",{d:"M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z",fill:"#F9BD2B"}),gg("path",{d:"M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z",fill:"currentColor"}),gg("path",{d:"M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z",fill:"#1D4AFF"}),gg("path",{d:"M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z",fill:"#F54E00"}),gg("path",{d:"M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z",fill:"currentColor"})]})]}),gg("defs",{children:gg("clipPath",{id:"clip0_2415_6911",children:gg("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function $g({urlParams:t}){const e=t?Object.entries(t).map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"):"";return gg("a",{href:"https://posthog.com/surveys"+(e?`?${e}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",Cg]})}function Tg({text:e,submitDisabled:i,appearance:n,onSubmit:s,link:r,onPreviewSubmit:o,skipSubmitButton:l,canGoBack:a,onBack:u}){const{isPreviewMode:h}=zf(sg),c=!!a&&!!u,d=!l&&gg("button",{className:"form-submit",disabled:i,"aria-label":"Submit survey",type:"button",onClick(){r&&(null==t||t.open(r)),h?null==o||o():s()},children:e});return gg("div",{className:"bottom-section",children:[c?gg("div",{className:"form-buttons form-buttons-with-back",children:[gg("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:u,children:n.backButtonText||"Back"}),d]}):d,!n.whiteLabel&&gg($g,{urlParams:{utm_source:"survey-footer"}})]})}function Ig({question:t,forceDisableHtml:e,htmlFor:i}){return gg("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[gg(t.type===up?"label":"h3",{className:"survey-question",htmlFor:i,children:t.question}),t.description&&og({component:of("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!e&&"text"!==t.descriptionContentType})]})}function Mg({onClick:t}){const{isPreviewMode:e}=zf(sg);return gg("button",{className:"form-cancel",onClick:t,disabled:e,"aria-label":"Close survey",type:"button",children:xg({fill:"black"})})}const Eg=t;function Pg({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onClose:r}){const{isPopup:o}=zf(sg);return jf(()=>{const t=t=>{"Enter"!==t.key&&"Escape"!==t.key||(t.preventDefault(),r())};return Us(Eg,"keydown",t),()=>{Eg.removeEventListener("keydown",t)}},[r]),gg("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&gg(Mg,{onClick:()=>r()}),gg("h3",{className:"thank-you-message-header",children:t}),e&&og({component:of("p",{className:"thank-you-message-body"}),children:e,renderAsHtml:!n&&"text"!==i}),o&&gg(Tg,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>r()})]})}function Rg({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onStart:r}){const{isPopup:o,onPreviewSubmit:l,onPopupSurveyDismissed:a}=zf(sg);return gg("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&gg(Mg,{onClick:()=>a()}),t&&gg("h3",{className:"intro-screen-header",children:t}),e&&og({component:of("p",{className:"intro-screen-body"}),children:e,renderAsHtml:!n&&"text"!==i}),gg(Tg,{text:s.introScreenButtonText||"Get started",submitDisabled:!1,appearance:s,onSubmit:r,onPreviewSubmit:()=>l(null)})]})}const Ag=t=>we(t)&&t.every(t=>$e(t));function Fg({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,displayQuestionIndex:r,initialValue:o,canGoBack:l,onBack:a}){const{isPreviewMode:u}=rg(),h=Bf(null),[c,d]=qf(()=>$e(o)?o:""),v=null==i?void 0:i.disableAutofocus;jf(()=>{v||setTimeout(()=>{var t;u||null===(t=h.current)||void 0===t||t.focus()},100)},[u,v]);const f=`surveyQuestion${r}`,p=Hf(()=>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 he: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 ce:var r;if(void 0!==t.value&&n.length>t.value)return null!==(r=t.errorMessage)&&void 0!==r?r:`Please enter no more than ${t.value} characters`}return!1}(c,t.validation,t.optional),[c,t.validation,t.optional]),g=Is(t.validation,he),m=Is(t.validation,ce),y=Hf(()=>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(c.trim())},_=()=>{p||s(c.trim())};return gg(af,{children:[gg("div",{className:"question-container",children:[gg(Ig,{question:t,forceDisableHtml:e,htmlFor:f}),gg("textarea",{ref:h,id:f,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:g,maxLength:m,onInput(t){d(t.currentTarget.value),t.stopPropagation()},onKeyDown(t){t.stopPropagation(),"Enter"!==t.key||!t.metaKey&&!t.ctrlKey||p||(t.preventDefault(),u?_():b())},value:c}),y&&gg("div",{className:"validation-hint",children:y})]}),gg(Tg,{text:t.buttonText||"Submit",submitDisabled:!!p,appearance:i,onSubmit:b,onPreviewSubmit:_,canGoBack:l,onBack:a})]})}function Og({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,canGoBack:r,onBack:o}){return gg(af,{children:[gg("div",{className:"question-container",children:gg(Ig,{question:t,forceDisableHtml:e})}),gg(Tg,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:()=>n("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:r,onBack:o})]})}function Dg({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:l,onBack:a}){var u;const h=t.scale,c=10===t.scale?0:1,[d,v]=qf(()=>Ee(o)?o:we(o)&&o.length>0&&Ee(parseInt(o[0]))?parseInt(o[0]):$e(o)&&Ee(parseInt(o))?parseInt(o):null),f="emoji"===t.display&&2===t.scale,{isPreviewMode:p}=rg(),g=t=>p?r(t):s(t);return gg(af,{children:[gg("div",{className:"question-container",children:[gg(Ig,{question:t,forceDisableHtml:e}),gg("div",{className:"rating-section",children:[gg("div",{className:"rating-options",children:["emoji"===t.display&&gg("div",{className:"rating-options-emoji"+(f?" rating-options-emoji-2":""),children:null===(u=Hg[t.scale])||void 0===u?void 0:u.map((e,n)=>gg("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&&gg("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${h-c+1}, minmax(0, 1fr))`},children:zg(t.scale).map((e,s)=>gg(Lg,{displayQuestionIndex:i,active:d===e,appearance:n,num:e,setActiveNumber(e){v(e),t.skipSubmitButton&&g(e)}},s))})]}),!f&&gg("div",{className:"rating-text",children:[gg("div",{children:t.lowerBoundLabel}),gg("div",{children:t.upperBoundLabel})]})]})]}),gg(Tg,{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 Lg({num:t,active:e,displayQuestionIndex:i,setActiveNumber:n}){return gg("button",{"aria-label":`Rate ${t}`,className:`ratings-number question-${i}-rating-${t} ${e?"rating-active":""}`,type:"button",onClick(){n(t)},children:t})}function Ng({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:l,onBack:a}){const u=Bf(null),h=Hf(()=>(t=>{if(!t.shuffleOptions)return t.choices;const e=t.choices;let i="";t.hasOpenChoice&&(i=e.pop());const n=tg(e,Xp(e));return t.hasOpenChoice&&(t.choices.push(i),n.push(i)),n})(t),[t]),[c,d]=qf(()=>((t,e)=>$e(t)||Ag(t)?t:e===cp?null:[])(o,t.type)),[v,f]=qf(()=>((t,e)=>{if($e(t)&&!e.includes(t))return{isSelected:!0,inputValue:t};if(Ag(t)){const i=t.find(t=>!e.includes(t));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,h)),{isPreviewMode:p}=rg(),g=t.type===cp,m=t.type===hp,y=t.skipSubmitButton&&g&&!t.hasOpenChoice,b=(t,e)=>{if(e){const t=!v.isSelected;return f(e=>le(le({},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=>le(le({},t),{},{isSelected:!1,inputValue:""})),void(y&&(s(t),p&&r(t)));m&&we(c)&&(c.includes(t)?d(c.filter(e=>e!==t)):d([...c,t]))},_=t=>{t.stopPropagation();const e=t.currentTarget.value;f(t=>le(le({},t),{},{inputValue:e})),g&&d(e)},w=t=>{t.stopPropagation(),"Enter"!==t.key||k()||(t.preventDefault(),S()),"Escape"===t.key&&(t.preventDefault(),f(t=>le(le({},t),{},{isSelected:!1,inputValue:""})),g&&d(null))},k=()=>!(t.optional||!Ie(c)&&(!we(c)||v.isSelected||0!==c.length)&&(!v.isSelected||""!==v.inputValue.trim())),S=()=>{v.isSelected&&m?we(c)&&(p?r([...c,v.inputValue]):s([...c,v.inputValue])):p?r(c):s(c)};return gg(af,{children:[gg("div",{className:"question-container",children:[gg(Ig,{question:t,forceDisableHtml:e}),gg("fieldset",{className:"multiple-choice-options limit-height",children:[gg("legend",{className:"sr-only",children:m?" Select all that apply":" Select one"}),h.map((e,n)=>{const s=!!t.hasOpenChoice&&n===t.choices.length-1,r=`surveyQuestion${i}Choice${n}`,o=`${r}Open`,l=s?v.isSelected:g?c===e:we(c)&&c.includes(e);return gg("label",{className:s?"choice-option-open":"",children:[gg("div",{className:"response-choice",children:[gg("input",{type:g?"radio":"checkbox",name:r,checked:l,onChange:()=>b(e,s),id:r,"aria-controls":o}),gg("span",{children:s?`${e}:`:e})]}),s&&gg("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)})]})]}),gg(Tg,{text:t.buttonText||"Submit",submitDisabled:k(),appearance:n,onSubmit:S,onPreviewSubmit:S,skipSubmitButton:y,canGoBack:l,onBack:a})]})}const qg=[1,2,3,4,5],jg=[1,2,3,4,5,6,7],Bg=[0,1,2,3,4,5,6,7,8,9,10],Hg={2:[kg,Sg],3:[bg,yg,mg],5:[_g,bg,yg,mg,wg]};function zg(t){switch(t){case 5:default:return qg;case 7:return jg;case 10:return Bg}}const Ug=As("[Surveys]");function Wg(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?vp:r;if(s.branching.type===vp)return vp;if("specific_question"===s.branching.type){if(Number.isInteger(s.branching.index))return s.branching.index}else if("response_based"===s.branching.type){if(s.type===cp){var o;let t=s.choices.indexOf(`${i}`);if(-1===t&&s.hasOpenChoice&&(t=s.choices.length-1),null===(o=s.branching)||void 0===o||null===(o=o.responseValues)||void 0===o?void 0:o.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===vp?vp:r}}else if(s.type===dp){var l;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const t=function(t,e){if(2===e){if(1>t||t>2)throw new Error("The response must be in range 1-2");return 1===t?"positive":"negative"}if(3===e){if(1>t||t>3)throw new Error("The response must be in range 1-3");return 1===t?"negative":2===t?"neutral":"positive"}if(5===e){if(1>t||t>5)throw new Error("The response must be in range 1-5");return t>2?3===t?"neutral":"positive":"negative"}if(7===e){if(1>t||t>7)throw new Error("The response must be in range 1-7");return t>3?4===t?"neutral":"positive":"negative"}if(10===e){if(0>t||t>10)throw new Error("The response must be in range 0-10");return t>6?t>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(i,s.scale);if(null===(l=s.branching)||void 0===l||null===(l=l.responseValues)||void 0===l?void 0:l.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===vp?vp:r}}return r}return Ug.warn("Falling back to next question index due to unexpected branching type"),r}const Vg=As("[SurveyTranslations]");function Gg(t,e){const i=function(t){return function({overrideLanguage:t,storedPersonProperties:e,locale:i},n){const s=Gl(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?Gl(t.language):null}(e);if(r)return null==n||n.info(`Using person property language: ${r}`),r;const o=Gl(i);return o?(null==n||n.info(`Using detected locale: ${o}`),o):(null==n||n.info("No user language detected"),null)}({overrideLanguage:t.config.override_display_language,storedPersonProperties:ke(t.get_property)?t.get_property(rt):void 0,locale:ba()},Vg)}(e);if(!i)return Vg.info("No user language detected"),{survey:t,language:null};const n=Kl(t,i,Vg);return{survey:n.survey,language:n.matchedKey}}const Zg=t,Qg=n,Jg="ph:show_survey_widget",Kg="PHWidgetSurveyClickListener";function Yg(t,e){try{const i=t.getBoundingClientRect(),n=Zg.innerHeight,s=Zg.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:Up.zIndex}}catch(t){return Mp.warn("Failed to calculate trigger position:",t),null}}var Xg=class{constructor(t){this.wi=new Map,this.ki=new Map,this.Si=new Map,this.xi=new Map,this.Ci=new Set,this.Mi=null,this.Ii=!1,this.Ti=null,this.Ri=null,this.$i=null,this.Ei=!1,this.handlePageUnload=()=>{const t=this._posthog.get_property(at);if(t)for(const e of t)cg(e)&&Yp(e,this._posthog)},this.handlePopoverSurvey=(t,e,{resumeDelayFromActivation:i=!1}={})=>{var n,s,r,o,l,a;if(!Pp(this._posthog))return;const{survey:u,language:h}=this.Ai(t);this.Mi=h,this.$i=null,this.Oi=e;const c=this.Li(u,e);this.Pi(c.id);const{properties:d,initialResponses:v}=null!=e?e:{},f=!(!v||0>=Object.keys(v).length)&&this.Di(c,v,d,h);if(f&&!(null===(n=c.appearance)||void 0===n?void 0:n.displayThankYouMessage))return;this.Fi(c);let p={};if((null===(s=c.appearance)||void 0===s?void 0:s.position)===rp&&(null===(r=c.appearance)||void 0===r?void 0:r.widgetSelector)){const t=Qg.querySelector(c.appearance.widgetSelector);var g;t&&(p=Yg(t,parseInt((null===(g=c.appearance)||void 0===g?void 0:g.maxWidth)||Up.maxWidth))||{})}const m=(null===(o=c.appearance)||void 0===o?void 0:o.surveyPopupDelaySeconds)||0,{shadow:y}=Zp(c,this._posthog);this.xi.set(y,y.host);const b={posthog:this._posthog,survey:c,removeSurveyFromFocus:this.Ni,properties:d,style:p,isSurveyCompleted:f,skipShownEvent:null==e?void 0:e.skipShownEvent,surveyLanguage:h};if(this.$i=b,0>=m)return this.Ii=!0,If(gg(sm,le({},b)),y);const _=()=>{this.Ii=!0;const{survey:i,language:n}=this.Ai(t);this.Mi=n;const s=this.Li(i,e),r=le(le({},b),{},{survey:s,surveyLanguage:n});this.$i=r,If(gg(sm,le(le({},r),{},{survey:le(le({},s),{},{appearance:le(le({},s.appearance),{},{surveyPopupDelaySeconds:0})})})),y)},w=()=>{if(!Pp(this._posthog)||!this.qi(c))return Mp.info(`Survey ${c.id} no longer eligible when its display delay elapsed; not displaying`),this.Ni(c);_()},k=i?null===(l=this._posthog.surveys)||void 0===l||null===(l=l._surveyEventReceiver)||void 0===l||null===(a=l.getActivationTimestamp)||void 0===a?void 0:a.call(l,c.id):void 0,S=Ee(k)?Math.max(0,Date.now()-k):0,x=Math.max(0,1e3*m-S);if(0>=x)return w();const C=Zg.setTimeout(()=>{this.wi.delete(c.id),w()},x);this.wi.set(c.id,C)},this.ji=t=>{var e;const{survey:i,language:n}=this.Ai(t),{shadow:s,isNewlyCreated:r}=Zp(i,this._posthog);this.xi.set(s,s.host),(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===ep&&this.Si.set(t.id,t),r&&If(gg(om,{posthog:this._posthog,survey:i,surveyLanguage:n},t.id),s)},this.Bi=t=>{const e=this.ki.get(t);e&&(e.element.removeEventListener("click",e.listener),e.element.removeAttribute(Kg),this.ki.delete(t),Mp.info(`Removed click listener for survey ${t}`))},this.Hi=t=>{this.Ui(t)||(this.zi(t),this.Bi(t.id))},this.Wi=t=>{this.Ui(t)||(this.zi(t),this.Si.delete(t.id))},this.Ui=t=>{try{var e;const i=Qg.querySelector(vg(t,!0));return!!(null==i||null===(e=i.shadowRoot)||void 0===e?void 0:e.querySelector(".ph-survey"))}catch(t){return!1}},this.Vi=(t,e)=>{const i=Qg.querySelector(e),n=this.ki.get(t.id);if(i){if(this.ji(t),n){if(i===n.element)return;Mp.info(`Selector element changed for survey ${t.id}. Re-attaching listener.`),this.Bi(t.id)}if(!i.hasAttribute(Kg)){const e=e=>{var i,n;e.stopPropagation();const s=(null===(i=t.appearance)||void 0===i?void 0:i.position)===rp?Yg(e.currentTarget,parseInt((null===(n=t.appearance)||void 0===n?void 0:n.maxWidth)||Up.maxWidth)):{};Zg.dispatchEvent(new CustomEvent(Jg,{detail:{surveyId:t.id,position:s}}))};Us(i,"click",e),i.setAttribute(Kg,"true"),this.ki.set(t.id,{element:i,listener:e,survey:t}),Mp.info(`Attached click listener for feedback button survey ${t.id}`)}}else n&&this.Hi(t)},this.renderPopover=t=>{if(!Pp(this._posthog))return;const{survey:e,language:i}=this.Ai(t),{shadow:n}=Zp(e,this._posthog);this.xi.set(n,n.host),If(gg(sm,{posthog:this._posthog,survey:e,removeSurveyFromFocus:this.Ni,surveyLanguage:i}),n)},this.renderSurvey=(t,e,i)=>{var n;if(!Pp(this._posthog))return;const{survey:s,language:r}=this.Ai(t);let o=!1;(null===(n=this._posthog.config)||void 0===n||null===(n=n.surveys)||void 0===n?void 0:n.prefillFromUrl)&&(o=this.Zi(s,r,i)),If(gg(sm,{posthog:this._posthog,survey:s,removeSurveyFromFocus:this.Ni,isPopup:!1,properties:i,isSurveyCompleted:o,surveyLanguage:r}),e)},this.getActiveMatchingSurveys=(t,e=!1)=>{var i;null===(i=this._posthog)||void 0===i||null===(i=i.surveys)||void 0===i||i.getSurveys(e=>{t(e.filter(t=>this.qi(t)))},e)},this.callSurveysAndEvaluateDisplayLogic=(t=!1)=>{this.getActiveMatchingSurveys(t=>{const e=Pp(this._posthog),i=t.filter(t=>e&&(t.type===op||t.type===lp)),n=new Set(i.map(t=>t.id));for(const t of Array.from(this.wi.keys()))n.has(t)||this.cancelSurvey(t);const s=this.Gi(i),r=new Set,o=new Set;s.forEach(t=>{if(t.type===lp){var e,i,n,s;if((null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===ep)return o.add(t.id),void this.ji(t);"selector"===(null===(i=t.appearance)||void 0===i?void 0:i.widgetType)&&(null===(n=t.appearance)||void 0===n?void 0:n.widgetSelector)&&(r.add(t.id),this.Vi(t,null===(s=t.appearance)||void 0===s?void 0:s.widgetSelector))}Ie(this.Qi)&&t.type===op&&this.handlePopoverSurvey(t,void 0,{resumeDelayFromActivation:!0})}),this.ki.forEach(({survey:t})=>{r.has(t.id)||this.Hi(t)}),this.Si.forEach((t,e)=>{o.has(e)||this.Wi(t)})},t)},this.Fi=t=>{Ie(this.Qi)||Mp.error(`Survey ${this.Qi} already in focus. Cannot add survey ${t.id}.`),this.Qi=t.id},this.Ni=t=>{this.Qi!==t.id&&Mp.error(`Survey ${t.id} is not in focus. Cannot remove survey ${t.id}.`),this.Pi(t.id),this.Qi=null,this.Mi=null,this.Ii=!1,this.$i=null,this.Oi=void 0,this.zi(t)},this._posthog=t,this.Qi=null,this.Ti=()=>this.Ji(),Us(Zg,"languagechange",this.Ti),this.Ri=t.onFeatureFlags(()=>this.Ji())}Ji(){if(Ie(this.Qi))return;const t=this._posthog.get_property(at),e=null==t?void 0:t.find(t=>t.id===this.Qi);if(!e)return;const{survey:i,language:n}=this.Ai(e);if(n===this.Mi)return;if(this.Mi=n,!this.Ii)return;const s=this.Li(i,this.Oi),{shadow:r}=Zp(s,this._posthog);If(gg(sm,le(le({},this.$i),{},{posthog:this._posthog,survey:s,removeSurveyFromFocus:this.Ni,surveyLanguage:n})),r)}get Ki(){var t,e,i;return null!==(t=null===(e=(i=this._posthog).getExtension)||void 0===e?void 0:e.call(i,"featureFlags"))&&void 0!==t?t:this._posthog.featureFlags}Li(t,e){return(null==e?void 0:e.position)||(null==e?void 0:e.selector)?le(le({},t),{},{appearance:le(le(le({},t.appearance),e.position&&{position:e.position}),e.selector&&{widgetSelector:e.selector})}):t}Pi(t){const e=this.wi.get(t);e&&(clearTimeout(e),this.wi.delete(t))}cancelSurvey(t){this.wi.has(t)&&(Mp.info(`Cancelled pending survey ${t}`),this.Pi(t),this.Qi===t&&(this.Qi=null,this.Mi=null,this.Ii=!1,this.$i=null,this.Oi=void 0))}setAutomaticDisplayDispose(t){this.Xi=t}dispose(){var t;null===(t=this.Xi)||void 0===t||t.call(this),this.Xi=void 0,this.Ti&&(Zg.removeEventListener("languagechange",this.Ti),this.Ti=null),this.Ri&&(this.Ri(),this.Ri=null),this.wi.forEach((t,e)=>this.Pi(e)),this.ki.forEach((t,e)=>this.Bi(e)),this.xi.forEach((t,e)=>{If(null,e),null==t||t.remove()}),this.xi.clear(),this.Si.clear(),this.Qi=null}Gi(t){return t.sort((t,e)=>{var i,n;const s=cg(t),r=cg(e);if(s&&!r)return-1;if(!s&&r)return 1;const o=t.schedule===fp,l=e.schedule===fp;return o&&!l?1:!o&&l?-1:((null===(i=t.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)-((null===(n=e.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)})}Ai(t){return Gg(t,this._posthog)}Zi(t,e,i){if(this.Ci.has(t.id))return!1;const{params:n}=function(t){const e={};let i=!1;const n=t.replace(/^\?/,"");if(!n)return{params:e,autoSubmit:i};const s=n.split("&");for(const t of s){const[n,s]=t.split("=");if(!n||Ce(s))continue;const r=decodeURIComponent(n),o=decodeURIComponent(s);if("auto_submit"===r&&"true"===o){i=!0;continue}const l=r.match(/^q(\d+)$/);if(l){const t=parseInt(l[1],10);e[t]||(e[t]=[]),e[t].push(o)}}return{params:e,autoSubmit:i}}(Zg.location.search);if(0===Object.keys(n).length)return!1;Mp.info("[Survey Prefill] Detected URL prefill parameters");const s=this.Yi(t,n,e);return!!s&&(this.tr(t,s,i,e),this.Ci.add(t.id),s.isSurveyCompleted)}tr(t,e,i,n){const{responses:s,submissionId:r,isSurveyCompleted:o,skippedResponses:l}=e;(Object.keys(l).length>0&&t.enable_partial_responses||o)&&Qp({responses:o?s:l,survey:t,surveySubmissionId:r,posthog:this._posthog,isSurveyCompleted:o,properties:i,surveyLanguage:n})}Di(t,e,i,n){const s={};for(const[t,i]of Object.entries(e))s[parseInt(t)]=we(i)?i.map(String):[String(i)];Mp.info("[Survey] Processing initial responses");const r=this.Yi(t,s,n);return!!r&&(this.tr(t,r,i,n),r.isSurveyCompleted)}Yi(t,e,i){try{const n=function(t,e){const i={};return t.questions.forEach((t,n)=>{if(!e[n]||!t.id)return;const s=e[n],r=Hl(t.id);try{switch(t.type){case cp:{if(!t.choices||0===t.choices.length)return void Rs.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 Rs.warn(`[Survey Prefill] Invalid choice index for q${n}: ${s[0]}`);i[r]=t.choices[e];break}case hp:{if(!t.choices||0===t.choices.length)return void Rs.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 Rs.warn(`[Survey Prefill] No valid choices for q${n}`);const o=[...new Set(e.map(e=>t.choices[e]))];e.length>o.length&&Rs.warn(`[Survey Prefill] Removed duplicate choices for q${n}`),i[r]=o;break}case dp:{const e=parseInt(s[0],10),o=t.scale||10;if(isNaN(e)||0>e||e>o)return void Rs.warn(`[Survey Prefill] Invalid rating for q${n}: ${s[0]} (scale: 0-${o})`);i[r]=e;break}default:Rs.info(`[Survey Prefill] Question type ${t.type} does not support prefill`)}}catch(t){Rs.error(`[Survey Prefill] Error converting q${n}:`,t)}}),i}(t,e);if(0===Object.keys(n).length)return Mp.warn("[Survey Prefill] No valid responses after conversion"),null;const s=ml(),{startQuestionIndex:r,skippedResponses:o,skippedIndices:l}=function(t,e,i){let n=0;const s={},r=[],o=t.questions.length+1;let l=0;for(;t.questions.length>n&&o>l&&(l++,e.includes(n));){const e=t.questions[n];if(!e||!("skipSubmitButton"in e)||!e.skipSubmitButton)break;if(e.id){const t=Hl(e.id);Ce(i[t])||(s[t]=i[t])}r.push(n);const o=Wg(t,n,e.id?i[Hl(e.id)]:null);if(o===vp)return{startQuestionIndex:t.questions.length,skippedResponses:s,skippedIndices:r};n=o}return{startQuestionIndex:n,skippedResponses:s,skippedIndices:r}}(t,Object.keys(e).map(t=>parseInt(t,10)),n),a=r>=t.questions.length;return ug(t,{surveySubmissionId:s,responses:n,lastQuestionIndex:r,questionOrder:eg(t.questions),visitedIndices:l,surveyLanguage:i}),Mp.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:n,submissionId:s,startQuestionIndex:r,isSurveyCompleted:a,skippedResponses:o}}catch(t){return Mp.error("[Survey Prefill] Error handling prefill:",t),null}}er(t,e=void 0){if(!t)return!0;const i=this.Ki,n=!!(null==i?void 0:i.isFeatureEnabled(t,{send_event:!t.startsWith("survey-targeting-")}));let s=!0;e&&(s=(null==i?void 0:i.getFeatureFlag(t,{send_event:!1}))===e||"any"===e);const r=n&&s;return r||this.nr(t),r}nr(t){var e;!this.Ei&&(null===(e=this._posthog.config)||void 0===e?void 0:e.advanced_disable_feature_flags)&&(this.Ei=!0,Mp.warn(`Survey feature flag "${t}" evaluated to false because advanced_disable_feature_flags is set. PostHog creates an internal targeting flag for almost every survey, so no survey can display while flags are disabled. To keep surveys working, replace advanced_disable_feature_flags with advanced_only_evaluate_survey_feature_flags, which evaluates survey flags only.`))}ir(e){return!e.conditions||lg(e,this._posthog)&&function(e){var n,s;return function(e,n){var s,r,o;if(!e||0===e.length)return!0;if(!u)return!1;const l=Zi(u,{userAgentDataPlatform:null==i||null===(s=i.userAgentData)||void 0===s?void 0:s.platform,maxTouchPoints:null==i?void 0:i.maxTouchPoints,screenWidth:null==t||null===(r=t.screen)||void 0===r?void 0:r.width,screenHeight:null==t||null===(o=t.screen)||void 0===o?void 0:o.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio});return ia[null!=n?n:"icontains"](e,[l])}(null===(n=e.conditions)||void 0===n?void 0:n.deviceTypes,null===(s=e.conditions)||void 0===s?void 0:s.deviceTypesMatchType)}(e)&&function(t){var e;return!(null===(e=t.conditions)||void 0===e?void 0:e.selector)||!!(null==Hp?void 0:Hp.querySelector(t.conditions.selector))}(e)}rr(t){var e;return ng(t)?{satisfied:!0}:t.internal_targeting_flag_key&&function(t){var e;return"recurring"===t.schedule||(null!==(e=t.current_iteration)&&void 0!==e?e:0)>0}(t)&&!(null===(e=this.Ki)||void 0===e?void 0:e.hasLoadedFlags)?(this.nr(t.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this.er(t.internal_targeting_flag_key)}}checkSurveyEligibility(t){var e,i;const n={eligible:!0,reason:void 0};if(!Rp(t))return n.eligible=!1,n.reason=`Survey is not running. It was completed on ${t.end_date}`,n;if(!Lp.includes(t.type))return n.eligible=!1,n.reason=`Surveys of type ${t.type} are never eligible to be shown in the app`,n;const s=null===(e=t.conditions)||void 0===e?void 0:e.linkedFlagVariant;if(!this.er(t.linked_flag_key,s))return n.eligible=!1,n.reason=s?`Survey linked feature flag is not enabled for variant ${s}`:"Survey linked feature flag is not enabled",n;if(!this.er(t.targeting_flag_key))return n.eligible=!1,n.reason="Survey targeting feature flag is not enabled",n;const r=this.rr(t);var o;return r.satisfied?function(t,e){if(!t||!e)return!0;const i="string"==typeof e?new Date(e):e,n=Math.abs((new Date).getTime()-i.getTime());return Math.ceil(n/864e5)>t}(null===(i=t.conditions)||void 0===i?void 0:i.seenSurveyWaitPeriodInDays,xl.Ot("lastSeenSurveyDate"))?(t=>!!xl.Ot(Op(t))&&!ng(t))(t)?(n.eligible=!1,n.reason="Survey has already been seen and it can't be activated again",n):n:(n.eligible=!1,n.reason="Survey wait period has not passed",n):(n.eligible=!1,n.reason=null!==(o=r.reason)&&void 0!==o?o:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",n)}checkSurveyCaptureEligibility(){return Pp(this._posthog)?{eligible:!0}:{eligible:!1,reason:Ep}}checkSurveyDisplayEligibility(t){const e=this.checkSurveyCaptureEligibility();return e.eligible?this.checkSurveyEligibility(t):e}checkSurveyRenderability(t){const e=this.checkSurveyDisplayEligibility(t);return e.eligible&&!this.sr(t)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:e}sr(t){var e;if(!Yl(t)&&!Ap(t))return!0;const i=null===(e=this._posthog.surveys)||void 0===e||null===(e=e._surveyEventReceiver)||void 0===e?void 0:e.getSurveys();return!!(null==i?void 0:i.includes(t.id))}ar(t){var e;return!(null===(e=t.feature_flag_keys)||void 0===e?void 0:e.length)||t.feature_flag_keys.every(({key:t,value:e})=>!t||!e||this.er(e))}qi(t){return this.checkSurveyEligibility(t).eligible&&this.ir(t)&&this.sr(t)&&this.ar(t)}zi(t){try{const e=Qg.querySelector(vg(t,!0));(null==e?void 0:e.shadowRoot)&&(If(null,e.shadowRoot),this.xi.delete(e.shadowRoot)),null==e||e.remove()}catch(e){Mp.warn(`Failed to remove survey ${t.id} from DOM:`,e)}}getTestAPI(){return{addSurveyToFocus:this.Fi,removeSurveyFromFocus:this.Ni,surveyInFocus:this.Qi,surveyTimeouts:this.wi,handleWidget:this.ji,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this.Vi,sortSurveysByAppearanceDelay:this.Gi,checkFlags:this.ar.bind(this),isSurveyFeatureFlagEnabled:this.er.bind(this),onLanguageChange:this.Ji.bind(this),currentLanguage:this.Mi,surveyIsRendered:this.Ii}}};function tm(t,e){if(!Qg||!Zg)return;const i=new Xg(t);if(t.config.disable_surveys_automatic_display)return Mp.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===e)return Mp.info("There are no surveys to load or Surveys is disabled in the project settings."),i;let n;i.callSurveysAndEvaluateDisplayLogic(!0);const s=()=>{Ce(n)&&(n=setInterval(()=>{i.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},r=()=>{Ce(n)||(clearInterval(n),n=void 0)};s();const o=()=>{Qg.hidden?r():(i.callSurveysAndEvaluateDisplayLogic(!1),s())};return Us(Qg,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{r(),Qg.removeEventListener("visibilitychange",o)}),i}function em({survey:t,removeSurveyFromFocus:e=()=>{},setSurveyVisible:i,isPreviewMode:n=!1,posthog:s}){jf(()=>{var r;if(n||!(null===(r=t.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var n;const r=t.type===lp,o=lg(t,s),l=(null===(n=t.appearance)||void 0===n?void 0:n.widgetType)===ep&&r;if(!o)return Mp.info(`Hiding survey ${t.id} because URL does not match`),i(!1),e(t);l&&(Mp.info(`Showing survey ${t.id} because it is a feedback button tab and URL matches`),i(!0))};Us(Zg,"popstate",o),Us(Zg,"hashchange",o);const l=Zg.history.pushState,a=Zg.history.replaceState;return Zg.history.pushState=function(...t){l.apply(this,t),o()},Zg.history.replaceState=function(...t){a.apply(this,t),o()},()=>{Zg.removeEventListener("popstate",o),Zg.removeEventListener("hashchange",o),Zg.history.pushState=l,Zg.history.replaceState=a}},[n,t,e,i,s])}const im=200;function nm(t="right"){switch(t){case"top":return{top:"0",left:"50%",transform:"translateX(-50%)"};case"left":return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case"bottom":return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function sm({survey:t,forceDisableHtml:e,posthog:i,style:n={},previewPageIndex:s,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:l=()=>{},onPreviewBack:a=()=>{},onPopupSurveyDismissed:u=()=>{},onCloseConfirmationMessage:h=()=>{},properties:c,isSurveyCompleted:d,skipShownEvent:v,surveyLanguage:f}){var p,g,m,y,b,_,w,k,S,x,C,T;const I=Bf(null),M=Number.isInteger(s),{isPopupVisible:E,isSurveySent:P,hidePopupWithAnimation:R}=function(t,e,i,n,s,r,o,l,a){const[u,h]=qf(n||0===i||t.type===ap),[c,d]=qf(!1),v=Bf(!1),f=()=>{const e=()=>{r&&s(t),h(!1)};if(v.current)return;const i=null==o?void 0:o.current;i?(v.current=!0,i.style.transition=`opacity ${im}ms ease-out`,i.style.opacity="0",setTimeout(()=>{v.current=!1,e()},250)):e()},p=e=>{e.detail.surveyId===t.id&&f()};return jf(()=>{if(!e)return void Mp.error("usePopupVisibility hook called without a PostHog instance.");if(n)return;let s;const r=e=>{var i,n;if(e.detail.surveyId===t.id){if(!(null===(i=t.appearance)||void 0===i?void 0:i.displayThankYouMessage))return f();d(!0),(null===(n=t.appearance)||void 0===n?void 0:n.autoDisappear)&&(s&&clearTimeout(s),s=setTimeout(f,5e3))}},o=()=>{if(lg(t,e)){var i;h(!0),Zg.dispatchEvent(new Event("PHSurveyShown")),l||e.capture(pp,le(le({[bp]:t.name,[yp]:t.id,[_p]:t.current_iteration,[wp]:t.current_iteration_start_date},a&&{[$p]:a}),{},{sessionRecordingUrl:null===(i=e.get_session_replay_url)||void 0===i?void 0:i.call(e)}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}};Us(Zg,"PHSurveyClosed",p),Us(Zg,"PHSurveySent",r);const u=i>0?setTimeout(o,i):void 0;return Ce(u)&&o(),()=>{Ce(u)||clearTimeout(u),Ce(s)||clearTimeout(s),Zg.removeEventListener("PHSurveyClosed",p),Zg.removeEventListener("PHSurveySent",r)}},[]),em({survey:t,removeSurveyFromFocus:s,setSurveyVisible:h,isPreviewMode:n,posthog:e}),{isPopupVisible:u,isSurveySent:c,setIsPopupVisible:h,hidePopupWithAnimation:f}}(t,i,(null===(p=t.appearance)||void 0===p?void 0:p.surveyPopupDelaySeconds)?1e3*t.appearance.surveyPopupDelaySeconds:0,M,r,o,I,v,f),A=P||s===t.questions.length||!0===d,[F,O]=qf(!1),D=Hf(()=>!!hg(t),[t]),L=!(!(null===(g=t.appearance)||void 0===g?void 0:g.introScreenHeader)&&!(null===(m=t.appearance)||void 0===m?void 0:m.introScreenDescription)),N=M?-1===s:!!(null===(y=t.appearance)||void 0===y?void 0:y.displayIntroScreen)&&L&&!F&&!D,q=Hf(()=>{const e=hg(t),n=(null==e?void 0:e.surveySubmissionId)||ml();return{isPreviewMode:M,previewPageIndex:s,onPopupSurveyDismissed(){f?Kp(t,i,M,f):Kp(t,i,M),u()},isPopup:o||!1,surveySubmissionId:n,onPreviewSubmit:l,onPreviewBack:a,posthog:i,properties:c,surveyLanguage:f}},[M,s,o,i,t,u,l,a,c,f]);return E?gg(sg.Provider,{value:q,children:gg("div",{className:"ph-survey",style:le(le({},fg(t.type,null===(b=t.appearance)||void 0===b?void 0:b.position,null===(_=t.appearance)||void 0===_?void 0:_.widgetType)),n),ref:I,children:A?gg(Pg,{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||Up,onClose(){R(),h()}}):N?gg(Rg,{header:(null===(x=t.appearance)||void 0===x?void 0:x.introScreenHeader)||"",description:(null===(C=t.appearance)||void 0===C?void 0:C.introScreenDescription)||"",forceDisableHtml:!!e,contentType:null===(T=t.appearance)||void 0===T?void 0:T.introScreenDescriptionContentType,appearance:t.appearance||Up,onStart:()=>O(!0)}):gg(rm,{survey:t,forceDisableHtml:!!e,posthog:i})})}):null}function rm({survey:t,forceDisableHtml:e,posthog:i}){var n,s;const r=Hf(()=>{const e=hg(t);if(!e)return null;const i=Ee(e.lastQuestionIndex);return!i||i&&e.lastQuestionIndex>=0&&t.questions.length>e.lastQuestionIndex?e:(dg(t),null)},[t]),[o,l]=qf(()=>((null==r?void 0:r.responses)&&Mp.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[a,u]=qf(!1),{previewPageIndex:h,onPopupSurveyDismissed:c,isPopup:d,onPreviewSubmit:v,onPreviewBack:f,surveySubmissionId:p,isPreviewMode:g,properties:m,surveyLanguage:y}=zf(sg),[b,_]=qf(()=>{const e=null==r?void 0:r.lastQuestionIndex,i=Ee(e)&&e>=0&&t.questions.length>e?e:0;return Ee(h)&&h>=0?h:i}),[w,k]=qf(()=>{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]=qf(()=>{var e;const i=hg(t);return null!==(e=null==i?void 0:i.questionSnapshots)&&void 0!==e?e:{}}),C=Hf(()=>eg(ig(t,r)),[t.id,r]),T=Hf(()=>{if(!C||new Set(C).size!==C.length)return ig(t,r);const e=new Map(t.questions.map(t=>[t.id,t])),i=C.map(t=>e.get(t)).filter(t=>!!t);return i.length===C.length?i:t.questions},[C,t.questions,t,r]);jf(()=>{!g||Ce(h)||0>h||_(h)},[h,g]);const I=!!(null===(n=t.appearance)||void 0===n?void 0:n.allowGoBack)&&(g?(null!=h?h:0)>0:w.length>0),M=T.at(b);return M?gg("form",{className:"survey-form",name:"surveyForm",children:[d&&!0!==(null===(s=t.appearance)||void 0===s?void 0:s.hideCancelButton)&&gg(Mg,{onClick(){c()}}),gg("div",{className:"survey-box","data-question-index":b,children:[a&&gg("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),lm({question:M,forceDisableHtml:e,displayQuestionIndex:b,appearance:t.appearance||Up,onSubmit:e=>(({res:e,displayQuestionIndex:n,questionId:s})=>{if(!i)return void Mp.error("onNextButtonClick called without a PostHog instance.");if(!Pp(i))return void u(!0);if(u(!1),!s)return void Mp.error("onNextButtonClick called without a questionId.");const r=Hl(s),a=le(le({},o),{},{[r]:e});l(a);const h=T[n],c=(null==h?void 0:h.id)?le(le({},S),{},{[h.id]:h.question}):S;x(c);const d=Wg(t,n,e),v=d===vp,f=[...w,n];if(v||(k(f),_(d),ug(t,{surveySubmissionId:p,responses:a,lastQuestionIndex:d,questionOrder:eg(T),visitedIndices:f,surveyLanguage:y,questionSnapshots:c})),t.enable_partial_responses||v){const e=new Set(f.map(t=>{var e;return null===(e=T[t])||void 0===e?void 0:e.id}).filter(t=>!!t).map(t=>Hl(t))),n=Object.fromEntries(Object.entries(a).filter(([t])=>e.has(t)));Qp({responses:n,survey:t,surveySubmissionId:p,isSurveyCompleted:v,posthog:i,properties:m,surveyLanguage:y,questionSnapshots:c})}})({res:e,displayQuestionIndex:b,questionId:M.id}),onPreviewSubmit:v,initialValue:M.id?o[Hl(M.id)]:void 0,canGoBack:I,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),ug(t,{surveySubmissionId:p,responses:o,lastQuestionIndex:e,questionOrder:eg(T),visitedIndices:i,surveyLanguage:y,questionSnapshots:S})}})]})]}):null}function om({survey:t,forceDisableHtml:e,posthog:i,readOnly:n,surveyLanguage:s}){var r,o,l,a,u,h,c;const[d,v]=qf(!0),[f,p]=qf(!1),[g,m]=qf({}),y=Bf(void 0),b=()=>{(f||!i||n||Pp(i))&&p(!f)};if(jf(()=>{var e;if(!i)return void Mp.error("FeedbackWidget called without a PostHog instance.");if(n)return;"tab"===(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)&&m({top:"50%",bottom:"auto"});const s=e=>{var i;const n=e;(null===(i=n.detail)||void 0===i?void 0:i.surveyId)===t.id&&(Mp.info(`Received show event for feedback button survey ${t.id}`),m(n.detail.position||{}),b())};return Us(Zg,Jg,s),()=>{Ce(y.current)||(clearTimeout(y.current),y.current=void 0),Zg.removeEventListener(Jg,s)}},[i,n,t.id,null===(r=t.appearance)||void 0===r?void 0:r.widgetType,null===(o=t.appearance)||void 0===o?void 0:o.widgetSelector,null===(l=t.appearance)||void 0===l?void 0:l.borderColor]),em({survey:t,setSurveyVisible:v,posthog:i}),!d)return null;const _=()=>{t.schedule!==fp&&v(!1),Ce(y.current)||clearTimeout(y.current),y.current=setTimeout(()=>{y.current=void 0,p(!1)},200)};return gg(af,{children:["tab"===(null===(a=t.appearance)||void 0===a?void 0:a.widgetType)&&gg("button",{className:"ph-survey-widget-tab "+("top"===(null===(u=t.appearance)||void 0===u?void 0:u.tabPosition)?"widget-tab-top":""),onClick:b,disabled:n,style:nm(null===(h=t.appearance)||void 0===h?void 0:h.tabPosition),children:(null===(c=t.appearance)||void 0===c?void 0:c.widgetLabel)||""}),f&&gg(sm,{posthog:i,survey:t,forceDisableHtml:e,style:g,onPopupSurveyDismissed:_,onCloseConfirmationMessage:_,surveyLanguage:s})]})}const lm=({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 up:return of(Fg,le(le({},u),{},{question:t,key:t.id}));case"link":return of(Og,le(le({},u),{},{question:t,key:t.id}));case dp:return of(Dg,le(le({},u),{},{question:t,key:t.id}));case cp:case hp:return of(Ng,le(le({},u),{},{question:t,key:t.id}));default:return Mp.error(`Unsupported question type: ${t.type}`),null}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.generateSurveys=tm,d.extendPostHogWithSurveys=tm;const am=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},um=1e4,hm=(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),cm=(t,e,i)=>{const n=JSON.stringify(t);if(i.remaining>=n.length)return hm(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 hm(e,JSON.stringify(t.slice(0,s)),i)},dm=t=>void 0!==t&&"function"!=typeof t&&"symbol"!=typeof t&&"bigint"!=typeof t,vm=(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}},fm=(t,e,i)=>{if(!i.truncated)if(Se(t)){if(i.seen.has(t))return void vm(e||"circular","[Circular]",i);i.seen.add(t);try{for(const n in t)try{if(!{}.hasOwnProperty.call(t,n))continue;if(fm(t[n],e?`${e}.${n}`:n,i),i.truncated)return}catch(t){continue}}catch(t){}}else vm(e,t,i)},pm=(t,e,i,n,s=!1,r)=>{if(!dm(t))return!s||hm(e,"null",i);if(Ie(t)||(t=>{try{return Ee(t)||Re(t)}catch(t){return!1}})(t))return hm(e,JSON.stringify(t),i);if("string"==typeof t)return cm(t,e,i);if(!Se(t)&&!we(t))return hm(e,JSON.stringify(t),i);if(n.has(t))return cm("[Circular]",e,i);n.add(t);try{const r=t.toJSON;if(ke(r))return pm(r.call(t),e,i,n,s)}catch(t){}try{const n={}.toString.call(t);if("[object String]"===n)return cm(String(t.valueOf()),e,i);if("[object Number]"===n||"[object Boolean]"===n)return hm(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 pm(o,e,i,n,s,r)}if(we(t)){if(!hm(e,"[",i))return!1;for(let s=0;t.length>s;s++){if(s>0&&!hm(e,",",i))return!1;let r;try{r=t[s]}catch(t){r=void 0}if(!pm(r,e,i,n,!0))return!1}return hm(e,"]",i)}if(!hm(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{fm(l,s,r)}catch(t){}if(!dm(l))continue;const a=`${o?"":","}${JSON.stringify(s)}:`;if(a.length>=i.remaining)return i.truncated=!0,!1;const u=e.length,h=i.remaining,c=i.truncated;if(!hm(e,a,i))return!1;const d=e.length,v=pm(l,e,i,n,!1),f=i.truncated;if(e.length!==d){if(o=!1,!v)return!1}else if(e.length=u,i.remaining=h,i.truncated=v?c:f,!v)return!1}}catch(t){}return hm(e,"}",i)},gm=(t,e)=>{const i=[],n={remaining:e,truncated:!1},s=Se(t[0])?{result:{},keysRemaining:50,sizeRemaining:um,truncated:!1,seen:new WeakSet([t[0]])}:void 0;for(let e=0;t.length>e&&(0>=e||hm(i," ",n))&&pm(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)||{}}},mm={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},ym=t=>"canCapture"in t,bm=t=>ym(t)?t.canCapture?t.getExtension(qp):void 0:t.is_capturing()?t.logs:void 0,_m=(t,e,i)=>{if(ym(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;ke(s)&&s.call(e,i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.logs={initializeLogs(t){let e=t;const i=[],n={host:d.location.host};let s=!1;for(const t of Object.keys(mm)){const r=i=>(...r)=>{let o=!1;try{const i=e;if(r.length>0&&!s&&i){const e=bm(i);if(e){s=!0,o=!0;const{body:l,truncated:a,attributes:u}=gm(r,um),h=le(le({},n),a?{body_truncated:"true"}:{}),c={level:mm[t],body:l,attributes:le(le({"log.source":`console.${t}`},h),u)};_m(i,e,c)}}}catch(t){}finally{o&&(s=!1),i.apply(d.console,r)}},o=d.console[t];i.push(av(d.console,t,t=>{const e=r(t);return e.__rrweb_original__=am(o),e}))}return()=>{e=void 0,i.forEach(t=>t())}},replayConsoleBuffer(t,e){const i=bm(t);if(i)for(const t of e)try{var n;const{body:e,truncated:s,attributes:r}=gm(t.args,um);null===(n=i.captureBufferedConsoleLog)||void 0===n||n.call(i,{level:mm[t.level],body:e,attributes:le(le({"log.source":`console.${t.level}`,host:d.location.host},s?{body_truncated:"true"}:{}),r)},t.context,t.occurredAtMs)}catch(t){}}};const wm=t=>Ne(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),km=As("[Error tracking]"),Sm="webkit-masked-url:",xm=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Cm=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Sm],$m=["__firefox__","__gCrWeb"];function Tm(){return new dn([new En,new jn,new Rn,new Pn,new Nn,new Ln,new Fn,new qn],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=kn.test(n)?n.replace(kn,"$1"):n;if(!o.match(/\S*Error: /)){for(const i of e){const e=i(o,t);if(e){s.push(e);const t=xn(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(In(s,l)>=50)break}}const a=[...l].sort((t,e)=>e.start-t.start),u=a[a.length-1];if(u){const t=$n(s,u);s.splice(u.start-t,t);for(const e of a)e.start-=t}for(const t of a)Cn(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++)Mn(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 le(le({},t),{},{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||"?"});var i})}(s)}}("web:javascript",yn,wn))}const Im=As("[ExceptionAutocapture]"),Mm=Tm(),Em=(t,e)=>{try{return t()}catch(t){return e}},Pm=(t,e)=>Em(()=>t(e()),void 0),Rm=t=>Em(()=>ke(t)&&ke(t.call),!1),Am=(t,e)=>Em(()=>{t[e].__POSTHOG_INSTRUMENTED__=!0},void 0),Fm=(t,e,i)=>{Em(()=>{var i;null===(i=t[e])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),Em(()=>{t[e]=i},void 0)},Om=e=>{const i=t;i||Im.info("window not available, cannot wrap onerror");const n=Em(()=>i.onerror,void 0);return i.onerror=function(...t){var i;return Pm(e,()=>Mm.buildFromUnknown((([t,e,i,n,s])=>{if(null!=s)return s;if($e(t)&&$e(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}})),!!Rm(n)&&null!==(i=n(...t))&&void 0!==i&&i},Am(i,"onerror"),()=>Fm(i,"onerror",n)},Dm=(e,i=!1)=>{const n=t;n||Im.info("window not available, cannot wrap onUnhandledRejection");const s=Em(()=>n.onunhandledrejection,void 0);return n.onunhandledrejection=function(t){var n;return Pm(e,()=>Mm.buildFromUnknown(t,{mechanism:{handled:!1}})),Rm(s)?null!==(n=s(t))&&void 0!==n&&n:i},Am(n,"onunhandledrejection"),()=>Fm(n,"onunhandledrejection",s)},Lm={wrapOnError:Om,wrapUnhandledRejection:Dm,wrapConsoleError(t){const e=console;e||Im.info("console not available, cannot wrap console.error");const i=Em(()=>e.error,void 0);return e.error=function(...e){Pm(t,()=>{let t;t=1==e.length?e[0]:e.join(" ");const i=e.find(t=>t instanceof Error);return Mm.buildFromUnknown(i||t,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),Rm(i)&&i(...e)},Am(e,"error"),()=>Fm(e,"error",i)}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.errorWrappingFunctions=Lm,d.posthogErrorWrappingFunctions=Lm;const Nm=(t,e)=>{if(!ke(null==t?void 0:t.capture))return;const i=null==e?void 0:e.autocaptureExceptions,n=!Ie(i)&&"object"==typeof i&&we(i.errors_to_ignore)?i.errors_to_ignore.reduce((t,e)=>{try{t.push(new RegExp(e))}catch(t){Im.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){Im.error("Failed to capture exception for a legacy client",t)}};Om(t=>{n.some(e=>t.$exception_list.some(t=>e.test(t.value||"")))||s(t)}),Dm(s,!0)};d.extendPostHogWithExceptionAutoCapture=Nm,d.extendPostHogWithExceptionAutocapture=Nm;const qm="X-POSTHOG-SESSION-ID",jm="X-POSTHOG-WINDOW-ID",Bm="X-POSTHOG-DISTINCT-ID",Hm=[qm,jm,Bm],zm=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],Um=(t,e)=>({}.hasOwnProperty.call(t,e)),Wm=t=>"object"==typeof t&&!Ie(t)||ke(t),Vm=t=>"undefined"!=typeof Request&&(t instanceof Request||"[object Request]"==={}.toString.call(t)),Gm=e=>{try{var i;return Vm(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}},Zm=(t,e,i,n,s)=>{let r;try{r=new URL(n).hostname}catch(t){return!1}if(!t)return!1;if(we(t)&&!t.includes(r))return!1;let o=!1;if(i){const{sessionId:t,windowId:e}=i.checkAndGetSessionAndWindowId(!0);s.set(qm,t),s.set(jm,e),o=!0}const l=(t=>ke(t)?t():t)(e);return l&&"$posthog_cookieless"!==l&&(s.set(Bm,l),o=!0),o};d.__PosthogExtensions__=d.__PosthogExtensions__||{};const Qm={_patchFetch:(e,i,n)=>av(t,"fetch",t=>function(s,r){const o=arguments.length>1?[s,r]:[s];let l=o;try{const t=Gm(s);if(t)if(Vm(s)){const t=new Request(s,r);Zm(e,i,n,t.url,t.headers),l=[t]}else{const o=new Headers(Wm(r)?r.headers:void 0);if(Zm(e,i,n,t,o)){const t=((t,e)=>{if(Ce(t)||Ie(t))return{headers:e};if(!Wm(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)=>Um(t,e)?Reflect.get(t,e):Reflect.get(i,e,i),has:(t,e)=>Um(t,e)||e in i,ownKeys(t){const e=new Set(Reflect.ownKeys(t));return Reflect.ownKeys(i).forEach(t=>e.add(t)),zm.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&&zm.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?le(le({},s),{},{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(i)})})(r,o);t&&(l=[s,t])}}}catch(t){l=o}return t.apply(this,l)}),_patchXHR:(e,i,n)=>av(t.XMLHttpRequest.prototype,"open",t=>function(s,r,o=!0,l,a){const u=this,h=new Headers,c=Gm(r);c&&Zm(e,i,n,c,h);const d=t.call(u,s,r,o,l,a);return Hm.forEach(t=>{const e=h.get(t);if(e)try{u.setRequestHeader(t,e)}catch(t){}}),d})};d.__PosthogExtensions__.tracingHeadersPatchFns=Qm,d.postHogTracingHeadersPatchFns=Qm,"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 Jm=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 Km=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Ym=t=>{if("loading"===document.readyState)return"loading";const e=Km();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"},Xm=t=>{const e=t.nodeName;return 1===t.nodeType?e.toLowerCase():e.toUpperCase().replace(/^#/,"")},ty=t=>{let e="";try{for(;9!==(null==t?void 0:t.nodeType);){var i;const n=t,s=n.id?"#"+n.id:[Xm(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},ey=new WeakMap;function iy(t,e){let i=ey.get(e);return i||(i=new WeakMap,ey.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}let ny=-1;const sy=()=>ny,ry=t=>{addEventListener("pageshow",e=>{e.persisted&&(ny=e.timeStamp,t(e))},!0)},oy=(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)))}},ly=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},ay=()=>{var t,e;return null!==(t=null===(e=Km())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let uy=-1;const hy=new Set,cy=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,dy=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of hy)t();isFinite(uy)||(uy="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",dy,!0))}},vy=(t=!1)=>{if(t&&(uy=1/0),0>uy){var e;const t=ay(),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;uy=null!=i?i:cy(),addEventListener("visibilitychange",dy,!0),addEventListener("prerenderingchange",dy,!0),ry(()=>{setTimeout(()=>{uy=cy()})})}return{get firstHiddenTime(){return uy},onHidden(t){hy.add(t)}}},fy=(t,e=-1,i,n=0,s,r,o)=>{const l=Km(),a=(null==l?void 0:l.navigationId)||0;let u="navigate";return i?u=i:0>sy()?l&&(document.prerendering||ay()>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}},py=(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(le({type:e,buffered:!0},i));return t}}catch(t){}},gy=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},my=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},yy=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var by=class{constructor(){this.u=void 0}};const _y=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},wy=[1800,3e3],ky=(t,e={})=>{const i=gy(e);_y(()=>{const n=iy(e,by),s=vy();let r,o=fy("FCP");const l=py(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(l.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-ay(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});l&&(r=oy(t,o,wy,e.reportAllChanges),ry(i=>{o=fy("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,sy()),r=oy(t,o,wy,e.reportAllChanges),ly(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&py(["soft-navigation"],i=>{i.forEach(i=>{n.u&&i.navigationId&&my(n.u,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=fy("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=oy(t,o,wy,e.reportAllChanges),r(!0)})},e)})},Sy=[.1,.25],xy=t=>t.find(t=>{var e;return 1===(null===(e=t.node)||void 0===e?void 0:e.nodeType)})||t[0],Cy=(t,e={})=>{const i=iy(e=Object.assign({},e),Jm),n=new WeakMap;i.t=t=>{var i;if(null==t||null===(i=t.sources)||void 0===i?void 0:i.length){const i=xy(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:ty(o);n.set(i,t)}}},((t,e={})=>{const i=vy();ky(yy(()=>{let n,s=fy("CLS",0);const r=iy(e,Jm),o=(i,o,l,a,u)=>{s=fy("CLS",0,i,o,l,a,u),r.o=0,n=oy(t,s,Sy,e.reportAllChanges)},l=(t=!1)=>{r.o>s.value&&(s.value=r.o,s.entries=r.i),n(t)},a=t=>{l(!0),o("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},u=t=>{for(const e of t)"soft-navigation"!==e.entryType?r.l(e):a(e);l()},h=["layout-shift"];gy(e)&&h.push("soft-navigation");const c=py(h,u);c&&(n=oy(t,s,Sy,e.reportAllChanges),i.onHidden(()=>{u(c.takeRecords()),n(!0)}),ry(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,sy()),ly(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=xy(s.sources);t&&(e={largestShiftTarget:n.get(t),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:t,largestShiftEntry:s,loadState:Ym(s.startTime)})}}return Object.assign(t,{attribution:e})})(e))},e)},$y=(t,e={})=>{const i=iy(e=Object.assign({},e),by);gy(e)&&(i.u=new Map),ky(e=>{t((t=>{let e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:Ym(sy())};if("soft-navigation"!==t.navigationType){if(t.entries.length){const i=Km(),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:Ym(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 Ty=0,Iy=1/0,My=0;const Ey=t=>{for(const e of t)e.interactionId&&(Iy=Math.min(Iy,e.interactionId),My=Math.max(My,e.interactionId),Ty=My?(My-Iy)/7+1:0)};let Py;const Ry=()=>{var t;return Py?Ty:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var Ay=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return Ry()-this.h}D(){this.h=Ry(),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 Fy=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=yy(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})}},Oy=[200,500],Dy=(t,e={})=>{const i=iy(e=Object.assign({},e),Ay);let n=[],s=[],r=0;const o=new WeakMap,l=new WeakMap;let a=!1;const u=()=>{a||(Fy(h),a=!0)},h=()=>{const t=new Set(i.v.map(t=>o.get(t.entries[0]))),e=s.length-10;s=s.filter((i,n)=>n>=e||t.has(i));const l=new Set;for(const t of s){const e=c(t.startTime,t.processingEnd);for(const t of e)l.add(t)}n=n.filter(t=>t.startTime>r||l.has(t)),a=!1};i.m=t=>{const i=t.startTime+t.duration;let n;r=Math.max(r,t.processingEnd);for(let r=s.length-1;r>=0;r--){const o=s[r];if(8>=Math.abs(i-o.renderTime)){n=o,n.startTime=Math.min(t.startTime,n.startTime),n.processingStart=Math.min(t.processingStart,n.processingStart),n.processingEnd=Math.max(t.processingEnd,n.processingEnd),e.includeProcessedEventEntries&&n.entries.push(t);break}}n||(n={startTime:t.startTime,processingStart:t.processingStart,processingEnd:t.processingEnd,renderTime:i,entries:e.includeProcessedEventEntries?[t]:[]},s.push(n)),t.interactionId&&o.set(t,n),u()},i.M=t=>{if(!l.get(t)){var i;const o=null===(i=t.entries.find(t=>t.target))||void 0===i?void 0:i.target;if(o){var n,s;const i=null!==(n=null===(s=e.generateTarget)||void 0===s?void 0:s.call(e,o))&&void 0!==n?n:ty(o);l.set(t,i)}else{var r;const e=null===(r=t.entries.find(t=>t.targetSelector))||void 0===r?void 0:r.targetSelector;e&&l.set(t,e)}}};const c=(t,e)=>{const i=[];for(const s of n)if(s.startTime+s.duration>=t){if(s.startTime>e)break;i.push(s)}return i};py(["long-animation-frame"],t=>{n=n.concat(t),u()},e),((t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=vy();_y(()=>{var n;"interactionCount"in performance||Py||(Py=py(["event"],Ey,{durationThreshold:0}));let s,r=fy("INP");const o=iy(e,Ay),l=(i,n,l,a,u)=>{o.D(),r=fy("INP",-1,i,n,l,a,u),s=oy(t,r,Oy,e.reportAllChanges)},a=()=>{const t=o.S(r.navigationType);t&&t.k!==r.value&&(r.value=t.k,r.entries=t.entries,s())},u=t=>{a(),s(!0),l("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},h=(t,e=!1)=>{Fy(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.l(e):u(e);a(),e&&s(!0)})},c=["event","first-input"];gy(e)&&c.push("soft-navigation");const d=py(c,h,le(le({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=oy(t,r,Oy,e.reportAllChanges),d&&(i.onHidden(()=>{h(d.takeRecords(),!0)}),ry(()=>{l("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,sy())}))})})(e=>{t((t=>{if(0===t.entries.length){const e={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:t.value,loadState:Ym(t.navigationStartTime||0)};return Object.assign(t,{attribution:e})}const e=t.entries[0],n=o.get(e),s=Math.max(n.processingStart,e.startTime),r=Math.max(e.startTime+e.duration,s),a=Math.min(n.processingEnd,r),u=n.entries.sort((t,e)=>t.processingStart-e.processingStart),h=c(e.startTime,a),d=i.p.get(e.interactionId),v={interactionTarget:l.get(d),interactionType:e.name.startsWith("key")?"keyboard":"pointer",interactionTime:e.startTime,nextPaintTime:r,processedEventEntries:u,longAnimationFrameEntries:h,inputDelay:s-e.startTime,processingDuration:a-s,presentationDelay:r-a,loadState:Ym(e.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(t=>{var e;const i=t.interactionTime,n=t.nextPaintTime;if(!(null===(e=t.longAnimationFrameEntries)||void 0===e?void 0:e.length)||!i||!n)return;const s=t.inputDelay,r=t.processingDuration;let o,l,a=0,u=0,h=0,c=0;for(const e of t.longAnimationFrameEntries){u=u+e.startTime+e.duration-e.styleAndLayoutStart;for(const t of e.scripts){const e=t.startTime+t.duration;if(i>e)continue;const n=e-Math.max(i,t.startTime),h=t.duration?n/t.duration*t.forcedStyleAndLayoutDuration:0;a+=n-h,u+=h,n>c&&(l=i+s>t.startTime?"input-delay":i+s+r>t.startTime?"processing-duration":"presentation-delay",o=t,c=n)}}const d=t.longAnimationFrameEntries.at(-1),v=d?d.startTime+d.duration:0;v>=i+s+r&&(h=n-v),o&&l&&(t.longestScript={entry:o,subpart:l,intersectingDuration:c}),t.totalScriptDuration=a,t.totalStyleAndLayoutDuration=u,t.totalPaintDuration=h,t.totalUnattributedDuration=n-i-a-u-h})(v),Object.assign(t,{attribution:v})})(e))},e)};var Ly=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 Ny=50;const qy=[];py(["resource"],t=>{for(const e of t)qy.push(e),qy.length>Ny&&qy.shift()});const jy=(t,e={})=>{null!=(e=Object.assign({},e)).resourceBufferSize&&(Ny=e.resourceBufferSize);const i=iy(e,Ly),n=new WeakMap;gy(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:ty(i);n.set(t,o)}else t.id&&n.set(t,`#${t.id}`)},((t,e={})=>{let i=!1;const n=gy(e);_y(()=>{let s,r=vy(),o=fy("LCP");const l=iy(e,Ly),a=(n,l,a,u,h)=>{o=fy("LCP",-1,n,l,a,u,h),s=oy(t,o,$,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=vy(!0))},u=t=>{var e;l.u&&t.navigationId&&my(l.u,t),i||s(!0),a("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime);const n=null===(e=t.getLargestInteractionContentfulPaint)||void 0===e?void 0:e.call(t);n&&h([n])},h=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],a=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-ay(),0),l.l(e),n=[e];else if("interaction-contentful-paint"===e.entryType){var i;const s=e;if(!o.navigationId)continue;if("interactionId"in s&&s.interactionId!=o.navigationInteractionId)continue;a=(null===(i=s.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,t=Math.max(a-e.startTime,0),s.largestContentfulPaint&&(l.l(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>a&&(o.value=t,o.entries=n,s())}},c=["largest-contentful-paint"];n&&c.push("interaction-contentful-paint","soft-navigation");const d=py(c,h);if(d){s=oy(t,o,$,e.reportAllChanges);const r=["keydown","click","visibilitychange"],l=t=>{if(t.isTrusted&&!i){const t=o.id;Fy(()=>{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});ry(n=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,sy()),s=oy(t,o,$,e.reportAllChanges),ly(()=>{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&&(qy.findLast(t=>t.name===l.url)||performance.getEntriesByType("resource").findLast(t=>t.name===l.url));let u;e.target=n.get(l),e.lcpEntry=l,l.url&&(e.url=l.url),a&&(e.lcpResourceEntry=a);let h=0,c=0;if("soft-navigation"!==t.navigationType?(u=Km(),h=null!==(s=null==u?void 0:u.activationStart)&&void 0!==s?s:0,c=null!==(r=null==u?void 0:u.responseStart)&&void 0!==r?r:0):(h=t.navigationStartTime||0,u=null===(o=i.u)||void 0===o?void 0:o.get(t.navigationId)),u){const i=Math.max(0,c-h),n=Math.max(i,a?(a.requestStart||a.startTime)-h:0),s=Math.min(t.value,Math.max(n,a?a.responseEnd-h:0));e=le(le({},e),{},{timeToFirstByte:i,resourceLoadDelay:n-i,resourceLoadDuration:s-n,elementRenderDelay:t.value-s,navigationEntry:u})}}return Object.assign(t,{attribution:e})})(e))},e)};let By=-1;const Hy=()=>By,zy=t=>{addEventListener("pageshow",e=>{e.persisted&&(By=e.timeStamp,t(e))},!0)},Uy=(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)))}},Wy=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},Vy=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Gy=()=>{var t,e;return null!==(t=null===(e=Vy())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let Zy=-1;const Qy=new Set,Jy=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Ky=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of Qy)t();isFinite(Zy)||(Zy="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",Ky,!0))}},Yy=(t=!1)=>{if(t&&(Zy=1/0),0>Zy){var e;const t=Gy(),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;Zy=null!=i?i:Jy(),addEventListener("visibilitychange",Ky,!0),addEventListener("prerenderingchange",Ky,!0),zy(()=>{setTimeout(()=>{Zy=Jy()})})}return{get firstHiddenTime(){return Zy},onHidden(t){Qy.add(t)}}},Xy=(t,e=-1,i,n=0,s,r,o)=>{const l=Vy(),a=(null==l?void 0:l.navigationId)||0;let u="navigate";return i?u=i:0>Hy()?l&&(document.prerendering||Gy()>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}},tb=new WeakMap;function eb(t,e){let i=tb.get(e);return i||(i=new WeakMap,tb.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}var ib=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 nb=(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(le({type:e,buffered:!0},i));return t}}catch(t){}},sb=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},rb=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},ob=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var lb=class{constructor(){this.l=void 0}};const ab=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},ub=[1800,3e3],hb=(t,e={})=>{const i=sb(e);ab(()=>{const n=eb(e,lb),s=Yy();let r,o=Xy("FCP");const l=nb(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(l.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-Gy(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});l&&(r=Uy(t,o,ub,e.reportAllChanges),zy(i=>{o=Xy("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Hy()),r=Uy(t,o,ub,e.reportAllChanges),Wy(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&nb(["soft-navigation"],i=>{i.forEach(i=>{n.l&&i.navigationId&&rb(n.l,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Xy("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Uy(t,o,ub,e.reportAllChanges),r(!0)})},e)})},cb=[.1,.25],db=(t,e={})=>{const i=Yy();hb(ob(()=>{let n,s=Xy("CLS",0);const r=eb(e,ib),o=(i,o,l,a,u)=>{s=Xy("CLS",0,i,o,l,a,u),r.i=0,n=Uy(t,s,cb,e.reportAllChanges)},l=(t=!1)=>{r.i>s.value&&(s.value=r.i,s.entries=r.o),n(t)},a=t=>{l(!0),o("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},u=t=>{for(const e of t)"soft-navigation"!==e.entryType?r.h(e):a(e);l()},h=["layout-shift"];sb(e)&&h.push("soft-navigation");const c=nb(h,u);c&&(n=Uy(t,s,cb,e.reportAllChanges),i.onHidden(()=>{u(c.takeRecords()),n(!0)}),zy(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Hy()),Wy(n)}),setTimeout(n))}))};let vb=0,fb=1/0,pb=0;const gb=t=>{for(const e of t)e.interactionId&&(fb=Math.min(fb,e.interactionId),pb=Math.max(pb,e.interactionId),vb=pb?(pb-fb)/7+1:0)};let mb;const yb=()=>{var t;return mb?vb:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var bb=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return yb()-this.u}M(){this.u=yb(),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 _b=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=ob(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})}},wb=[200,500],kb=(t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Yy();ab(()=>{var n;"interactionCount"in performance||mb||(mb=nb(["event"],gb,{durationThreshold:0}));let s,r=Xy("INP");const o=eb(e,bb),l=(i,n,l,a,u)=>{o.M(),r=Xy("INP",-1,i,n,l,a,u),s=Uy(t,r,wb,e.reportAllChanges)},a=()=>{const t=o.L(r.navigationType);t&&t.P!==r.value&&(r.value=t.P,r.entries=t.entries,s())},u=t=>{a(),s(!0),l("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},h=(t,e=!1)=>{_b(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.h(e):u(e);a(),e&&s(!0)})},c=["event","first-input"];sb(e)&&c.push("soft-navigation");const d=nb(c,h,le(le({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=Uy(t,r,wb,e.reportAllChanges),d&&(i.onHidden(()=>{h(d.takeRecords(),!0)}),zy(()=>{l("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Hy())}))})};var Sb=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 xb=[2500,4e3],Cb=(t,e={})=>{let i=!1;const n=sb(e);ab(()=>{let s,r=Yy(),o=Xy("LCP");const l=eb(e,Sb),a=(n,l,a,u,h)=>{o=Xy("LCP",-1,n,l,a,u,h),s=Uy(t,o,xb,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=Yy(!0))},u=t=>{var e;l.l&&t.navigationId&&rb(l.l,t),i||s(!0),a("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime);const n=null===(e=t.getLargestInteractionContentfulPaint)||void 0===e?void 0:e.call(t);n&&h([n])},h=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],a=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-Gy(),0),l.h(e),n=[e];else if("interaction-contentful-paint"===e.entryType){var i;const s=e;if(!o.navigationId)continue;if("interactionId"in s&&s.interactionId!=o.navigationInteractionId)continue;a=(null===(i=s.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,t=Math.max(a-e.startTime,0),s.largestContentfulPaint&&(l.h(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>a&&(o.value=t,o.entries=n,s())}},c=["largest-contentful-paint"];n&&c.push("interaction-contentful-paint","soft-navigation");const d=nb(c,h);if(d){s=Uy(t,o,xb,e.reportAllChanges);const r=["keydown","click","visibilitychange"],l=t=>{if(t.isTrusted&&!i){const t=o.id;_b(()=>{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});zy(n=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Hy()),s=Uy(t,o,xb,e.reportAllChanges),Wy(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})},$b={onLCP:jy,onCLS:Cy,onFCP:$y,onINP:Dy,withoutAttribution:{onLCP:Cb,onCLS:db,onFCP:hb,onINP:kb}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=$b,d.__PosthogExtensions__.postHogWebVitalsCallbacks=$b,d.postHogWebVitalsCallbacks=$b;const Tb={onLCP:Cb,onCLS:db,onFCP:hb,onINP:kb};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=Tb,d.__PosthogExtensions__.postHogWebVitalsCallbacks=Tb,d.postHogWebVitalsCallbacks=Tb,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Tb;const Ib={onLCP:jy,onCLS:Cy,onFCP:$y,onINP:Dy,withoutAttribution:{onLCP:Cb,onCLS:db,onFCP:hb,onINP:kb}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=Ib,d.__PosthogExtensions__.postHogWebVitalsCallbacks=Ib,d.postHogWebVitalsCallbacks=Ib;const Mb={onLCP:Cb,onCLS:db,onFCP:hb,onINP:kb};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=Mb,d.__PosthogExtensions__.postHogWebVitalsCallbacks=Mb,d.postHogWebVitalsCallbacks=Mb,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Mb;var Eb=class{constructor(t){this.disabled=!1===t;const e=Se(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 Pb="$copy_autocapture",Rb=As("[AutoCapture]");function Ab(t,e){return e.length>t?e.slice(0,t)+"...":e}function Fb(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do{e=e.previousSibling}while(e&&!sr(e));return e}function Ob(e,{e:i,maskAllElementAttributes:n,maskAllText:s,elementAttributeIgnoreList:r,elementsChainAsString:o,disableCaptureUrlHashes:l}){var a,u;if(!sr(e))return{props:{}};const h=[e],c=new Set([e]);let d=e;for(;d.parentNode&&!rr(d,"body")&&1e3>h.length;){if(lr(d.parentNode)){const t=d.parentNode.host;if(c.has(t))break;c.add(t),h.push(t),d=t;continue}if(!sr(d.parentNode))break;if(c.has(d.parentNode))break;c.add(d.parentNode),h.push(d.parentNode),d=d.parentNode}const v="click"===i.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?h.findIndex(t=>rr(t,"button")||rr(t,"a")):-1;v>0&&(s=s||h.slice(0,v+1).some(t=>!Mr(t)||Er(t)));const f=[],p={};let g,m=!1,y=!1;if(Os(h,t=>{const e=Mr(t);if(rr(t,"a")){const i=t.getAttribute("href");m=!!(e&&i&&Nr(i))&&(l?sn(i):i)}fe(hr(t),"ph-no-capture")&&(y=!0),f.push(function(t,e,i,n,s=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};fr.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?Ab(1024,qr(t)):Ab(1024,dr(t)));const l=hr(t);l.length>0&&(o.classes=l.filter(function(t){return""!==t})),Os(t.attributes,function(i){var r;if((!Er(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==n?void 0:n.includes(i.name))&&!e&&Nr(i.value)&&(!$e(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=i.value;"class"===i.name&&(t=ar(t).join(" ")),o["attr__"+i.name]=Ab(1024,"href"===i.name&&s?sn(t):t)}});let a=1,u=1,h=t;for(;h=Fb(h);)a++,h.tagName===t.tagName&&u++;return o.nth_child=a,o.nth_of_type=u,o}(t,n,s,r,l)),Os(function(t){if(!Mr(t))return{};const e={};return Os(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&&Nr(n)&&(e[i]=n)}}),e}(t),(t,e)=>{({}).hasOwnProperty.call(p,e)||(p[e]=t)})}),y)return{props:{},explicitNoCapture:y};if(v>0&&(e=h[v],f.splice(0,v)),s||(f[0].$el_text=rr(e,"a")||rr(e,"button")?qr(e):dr(e)),m){var b,_;f[0].attr__href=m;const e=null===(b=Zs(m))||void 0===b?void 0:b.host,i=null==t||null===(_=t.location)||void 0===_?void 0:_.host;e&&i&&e!==i&&(g=m)}return{props:Ds((k=i.type,{$event_type:k,$ce_version:1}),o?{}:{$elements:f},{$elements_chain:(w=f,we(w)?function(t){return t.map(t=>{var e,i;let n="";if(t.tag_name&&(n+=t.tag_name),t.attr_class){t.attr_class.sort();for(const e of t.attr_class)n+=`.${e.replace(/"/g,"")}`}const s=le(le(le(le({},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 Ls(s).sort(([t],[e])=>function(t,e){return e>t?-1:t>e?1:0}(t,e)).forEach(([t,e])=>r[Br(t.toString())]=Br(e.toString())),n+=":",n+=Ls(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:Hr(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Ls(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,e])=>n.attributes[t]=e),n})}(w)):"")},(null===(a=f[0])||void 0===a?void 0:a.$el_text)?{$el_text:null===(u=f[0])||void 0===u?void 0:u.$el_text}:{},g&&"click"===i.type?{$external_click_url:g}:{},p),target:e};var w,k}var Db=class{Js(){this.Ks=void 0,clearTimeout(this.Ys),this.Ys=void 0}Xs(t){var e;if(!Mr(t))return!0;const i=null!==(e=this.lo().css_selector_ignorelist)&&void 0!==e?e:yr,n=new Set;let s=t;for(;s;){if(n.size>=1e3||n.has(s))return!0;n.add(s);const t=s,e=hr(t);if(fe(e,"ph-no-capture")||fe(e,"ph-sensitive")||Er(t)||i.some(e=>pr(t,e)))return!0;const r=s.parentNode;s=lr(r)?r.host:r&&sr(r)?r:null}return!1}ao(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.Js();if("pointerdown"===t.type){this.Js();const i=vr(t);var e;return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&i&&sr(i)&&(this.Ks={target:i,excluded:this.Xs(i),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(e=this.uo)||void 0===e?void 0:e.distinctId}))}const i=this.Ks;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.Js():"pointerup"===t.type&&(i.released=!0,this.Ys=setTimeout(()=>this.Js(),0)))}ho(t){var e;const i=this.Ks;this.Js();const s=vr(t);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(e=this.uo)||void 0===e?void 0:e.distinctId)&&t.pointerId===i.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-i.x)&&5>=Math.abs(t.clientY-i.y)&&s&&(rr(s,"html")||rr(s,"body"))){var r;if(i.excluded)return null;const t=null!==(r=this.lo().css_selector_ignorelist)&&void 0!==r?r:yr;return[s,null==n?void 0:n.documentElement,null==n?void 0:n.body].some(e=>{if(!e)return!1;const i=hr(e);return fe(i,"ph-no-capture")||fe(i,"ph-sensitive")||!Mr(e)||Er(e)||t.some(t=>pr(e,t))})?null:i.target}}constructor(t){this.co=t,this.name="autocapture",this.do=!1,this.vo=null,this.fo=!1,this.po=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.mo=!1,this.co.refresh(this.Mr),this.rageclicks=new Eb(this.Mr.rageclick),this.yo=null}setup(t){this.bo(),this.uo=t;const e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.mo?e.dispose():(this._o=e,this.startIfEnabled())}dispose(){var t;this.mo||(this.mo=!0,this.uo=void 0,null===(t=this._o)||void 0===t||t.dispose(),this._o=void 0,this.wo())}lo(){return this.co.refresh(this.Mr),this.Mr}bo(){var t,e;return this.lo(),this.Mr.url_allowlist=null===(t=this.Mr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Mr.url_ignorelist=null===(e=this.Mr.url_ignorelist)||void 0===e?void 0:e.map(t=>new RegExp(t)),this.Mr}ko(){if(!this.isBrowserSupported())return void Rb.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!n)return;const e=this.So=e=>{e=e||(null==t?void 0:t.event);try{if("blur"===e.type)return void this.Js();if(0===e.type.indexOf("pointer"))return void this.ao(e);const t="click"===e.type?this.ho(e):void 0;if(Ie(t))return;this.xo(e,"$autocapture",t)}catch(t){Rb.error("Failed to capture event",t)}};if(Us(t,"blur",e),Us(n,"submit",e,{capture:!0}),Us(n,"change",e,{capture:!0}),Us(n,"click",e,{capture:!0}),Os(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Us(n,t,e,{capture:!0})}),this.lo().capture_copied_text){const e=this.Co=e=>{e=e||(null==t?void 0:t.event);try{this.xo(e,Pb)}catch(t){Rb.error("Failed to capture clipboard event",t)}};Us(n,"copy",e,{capture:!0}),Us(n,"cut",e,{capture:!0}),Us(n,"paste",e,{capture:!0})}}wo(){this.Js(),this.So&&(null==t||t.removeEventListener("blur",this.So),Os(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==n||n.removeEventListener(t,this.So,!0)}),null==n||n.removeEventListener("submit",this.So,!0),null==n||n.removeEventListener("change",this.So,!0),null==n||n.removeEventListener("click",this.So,!0),this.So=void 0),this.Co&&(null==n||n.removeEventListener("copy",this.Co,!0),null==n||n.removeEventListener("cut",this.Co,!0),null==n||n.removeEventListener("paste",this.Co,!0),this.Co=void 0),this.do=!1}startIfEnabled(){this.isEnabled||this.Js(),!this.mo&&this.uo&&this.isEnabled&&!this.do&&(this.ko(),this.do=!0)}onRemoteConfig(t){if(this.mo)return;if(this.fo=!0,!t.ok)return void this.startIfEnabled();const e=t.config;e.elementsChainAsString&&(this.po=e.elementsChainAsString);const i=e.autocapture_opt_out;var n;Re(i)&&(null===(n=this.uo)||void 0===n||n.kv.set("$autocapture_disabled_server_side",i),this.vo=i),this.startIfEnabled()}setElementSelectors(t){this.yo=t}getElementSelectors(t,e){var i;const s=[];return null===(i=this.yo)||void 0===i||i.forEach(i=>{const r=null==n?void 0:n.querySelectorAll(i);null==r||r.forEach(n=>{t!==n&&e!==n||fe(s,i)||s.push(i)})}),s}get isEnabled(){var t,e;if(this.mo)return!1;const i=null===(t=this.uo)||void 0===t?void 0:t.kv.get(k),n=this.vo,s=this.lo();if(!s.remoteRequestsDisabled&&!this.fo)return!1;const r=s.remoteRequestsDisabled&&!this.fo;if(Ie(n)&&!Re(i)&&!r)return!1;const o=null!==(e=this.vo)&&void 0!==e?e:!!i;return!!s.enabled&&!o}xo(e,i="$autocapture",n){if(!this.isEnabled)return void this.Js();let s=n||vr(e);or(s)&&(s=s.parentNode||null);const r=this.bo();var o;"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&r.rageclick&&(null===(o=this.rageclicks)||void 0===o?void 0:o.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&$r(s,r.rageclick)&&this.xo(e,"$rageclick",n);const l=i===Pb,a=l?le(le({},r),{},{dom_event_allowlist:void 0}):r;if(s&&function(e,i,n,s,r,o){var l;if(!t||Tr(e))return!1;if((null==n?void 0:n.url_allowlist)&&!ur(n.url_allowlist,o))return!1;if((null==n?void 0:n.url_ignorelist)&&ur(n.url_ignorelist,o))return!1;if(null==n?void 0:n.dom_event_allowlist){const t=n.dom_event_allowlist;if(t&&!t.some(t=>i.type===t))return!1}const{parentIsUsefulElement:a,targetElementList:u}=Ir(e,s);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,n))return!1;if(!gr(u,null==n?void 0:n.css_selector_allowlist))return!1;if(gr(u,null!==(l=null==n?void 0:n.css_selector_ignorelist)&&void 0!==l?l:yr))return!1;try{const n=t.getComputedStyle(e);if(n&&"pointer"===n.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}const h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(r||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(i.type)>=0;default:return a?(r||["click"]).indexOf(i.type)>=0:(r||["click"]).indexOf(i.type)>=0&&(fr.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,a,l,l?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var u;const{props:n,explicitNoCapture:o,target:l}=Ob(s,{e:e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.po,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(o)return!1;const a=this.getElementSelectors(s,l);if(a&&a.length>0&&(n.$element_selectors=a),i===Pb){const i=e.type||"clipboard";if("paste"!==i){var h,c;const e=null==t||null===(h=t.getSelection())||void 0===h?void 0:h.toString(),i=cr(e);if(!i)return!1;n.$selected_content=i,n.$clipboard_text_length=null!==(c=null==e?void 0:e.length)&&void 0!==c?c:0}n.$copy_type=i}return null===(u=this.uo)||void 0===u||u.capture(i,n).catch(t=>Rb.error("Failed to capture event",t)),!0}}isBrowserSupported(){return ke(null==n?void 0:n.querySelectorAll)}};const Lb={};function Nb(t,e){const i=vr(t);return i?le({node:i,originalEvent:t,timestamp:Date.now()},e):null}function qb(t,e){return Math.abs(t)<Math.abs(e)?0>e?"up":"down":0>t?"left":"right"}function jb(t){return"swipe"===t.type?"$dead_swipe":"$dead_click"}const Bb="canvas,video,audio,embed,object";function Hb(t,e){return Ee(t)&&t>=e}function zb(t,e=1e3){return t>=0&&e>t?t:void 0}function Ub(t,e,i=1e3){return Ee(e)?zb(t-e,i):void 0}var Wb=class{cr(t){var e,i,n,s,r,o,l,a;const u=this.dr((null==t?void 0:t.__onCapture)||this.hr.bind(this));return{element_attribute_ignorelist:null!==(e=null==t?void 0:t.element_attribute_ignorelist)&&void 0!==e?e:u.element_attribute_ignorelist,scroll_threshold_ms:null!==(i=null==t?void 0:t.scroll_threshold_ms)&&void 0!==i?i:u.scroll_threshold_ms,selection_change_threshold_ms:null!==(n=null==t?void 0:t.selection_change_threshold_ms)&&void 0!==n?n:u.selection_change_threshold_ms,mutation_threshold_ms:null!==(s=null==t?void 0:t.mutation_threshold_ms)&&void 0!==s?s:u.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(r=null==t?void 0:t.capture_clicks_with_modifier_keys)&&void 0!==r?r:u.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==t?void 0:t.capture_dead_swipes)&&void 0!==o?o:u.capture_dead_swipes,swipe_threshold_px:null!==(l=null==t?void 0:t.swipe_threshold_px)&&void 0!==l?l:u.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(a=null==t?void 0:t.max_dead_swipes_per_page_load)&&void 0!==a?a:u.max_dead_swipes_per_page_load,css_selector_ignorelist:null==t?void 0:t.css_selector_ignorelist,__onCapture:u.__onCapture}}constructor(t,e){this.instance=t,this.vr=!1,this.pr=[],this.mr=0,this.dr=t=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,capture_clicks_with_modifier_keys:!1,capture_dead_swipes:!0,swipe_threshold_px:30,max_dead_swipes_per_page_load:10,__onCapture:t}),this.gr=()=>{clearTimeout(this.yr),this.yr=void 0,this.br=void 0},this.wr=t=>{if(this.gr(),0===t.button){const e={path:t.composedPath(),trusted:t.isTrusted,selectionChanged:!1,selectionInitiallyRelated:!1},i=null==n?void 0:n.getSelection();e.selectionInitiallyRelated="Range"===(null==i?void 0:i.type)&&this.kr(i,e),this.br=e}},this._r=t=>{Ie(t.relatedTarget)&&this.gr()},this.Sr=t=>{const e=this.br,i=t;if(!e||0!==i.button||t.isTrusted!==e.trusted)return;const n=t.composedPath();for(const t of e.path)if(sr(t)&&-1!==n.indexOf(t)){e.clickTarget=t;break}e.clickDetail=i.detail,this.yr=d.setTimeout(this.gr,0)},this.Cr=t=>{const e=t,i=Nb(e,{type:"click"}),n=this.br;i&&n&&0===e.button&&e.detail>0&&e.detail===n.clickDetail&&t.isTrusted===n.trusted&&i.node===n.clickTarget&&(i.selectionChangedDuringGesture=n.selectionChanged&&this.Mr.selection_change_threshold_ms>0,this.gr()),Ie(i)||this.Ir(i)||this.Tr(i),this.Rr()},this.$r=()=>{const t=Date.now();this.Er=t,t%50==0&&this.pr.forEach(e=>{Ce(e.scrollDelayMs)&&(e.scrollDelayMs=t-e.timestamp)})},this.Ar=t=>{var e,i;const s=null==n?void 0:n.getSelection(),r=this.vr;this.vr="Range"===(null==s?void 0:s.type);const o=null==s?void 0:s.focusNode,l=o&&(sr(o)?o:o.parentElement),a=null==n?void 0:n.activeElement;let u=a;for(;null==u||null===(e=u.shadowRoot)||void 0===e?void 0:e.activeElement;)u=u.shadowRoot.activeElement;const h=Cr(vr(t))||Cr(null!=l?l:null)||Cr(null!==(i=u)&&void 0!==i?i:null),c="Caret"===(null==s?void 0:s.type)&&u&&!u.shadowRoot&&o&&o!==a&&o.contains(null!=a?a:null);if(!(r||this.vr||h||c))return;const d=Date.now();this.Or=d;const v=this.br;if(v&&(r||this.vr||h)){const e=vr(t);let i;if(Cr(e))i=e;else if("Caret"===(null==s?void 0:s.type)){var f;Cr(null!==(f=u)&&void 0!==f?f:null)||c?i=u:h&&(i=l)}const n=i?this.Lr(i,v):s&&(o||s.anchorNode)?this.kr(s,v):r&&!this.vr&&v.selectionInitiallyRelated;v.selectionChanged=v.selectionChanged||n}this.pr.forEach(t=>{const e=d-t.timestamp;0>e||!Ce(t.selectionChangedDelayMs)&&e>=t.selectionChangedDelayMs||(t.selectionChangedDelayMs=e)})},this.an=()=>{"hidden"===(null==n?void 0:n.visibilityState)&&this.gr();const t=Date.now();this.Pr=t,this.Dr("visibilityChangedDelayMs",t)},this.Fr=()=>{const t=Date.now();this.Nr=t,this.Dr("focusChangedDelayMs",t)},this.qr=t=>{const e=t.touches,i=1===(null==e?void 0:e.length)?e[0]:void 0;this.jr=i?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this.Br=()=>{this.jr=void 0},this.Hr=t=>{var e;const i=this.jr;if(this.jr=void 0,Ce(i)||this.mr>=this.Mr.max_dead_swipes_per_page_load)return;const s=t,r=null===(e=s.changedTouches)||void 0===e?void 0:e[0];if(!r)return;const o=r.clientX-i.x,l=r.clientY-i.y,a=o*o+l*l,u=this.Mr.swipe_threshold_px;if(u*u>a)return;if([this.Er,this.Ur,this.Or].some(t=>Ee(t)&&t>=i.timestamp))return;var h,c;if(this.zr()&&(null!==(h=null==n||null===(c=n.elementsFromPoint)||void 0===c?void 0:c.call(n,i.x,i.y))&&void 0!==h?h:[]).some(t=>{var e;return null===(e=t.matches)||void 0===e?void 0:e.call(t,Bb)}))return;const d=Nb(s,{type:"swipe",swipeDirection:qb(o,l),swipeDistancePx:Math.round(Math.sqrt(a))});Ie(d)||this.Ir(d)||this.Tr(d),this.Rr()},this.Mr=this.cr(e),this._onCapture=this.Mr.__onCapture}start(t){this.Wr(),this.Vr(),this.Zr(),this.Gr(),this.Qr(),this.Jr(t),this.Mr.capture_dead_swipes&&this.Kr()}Jr(e){if(!this.Xr){const i=function(e){return function(e,i){const n=Lb[e];if(n)return n;let s=i[e];if((t=>ke(t)&&-1!==t.toString().indexOf("[native code]"))(s)&&!(null==t?void 0:t.Zone))return Lb[e]=s.bind(i);const r=i.document;if(r&&ke(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 fe(t,"AppleWebKit")&&!fe(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){Rs.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&&ke(s)?Lb[e]=s.bind(i):s}("MutationObserver",e)}(d);this.Xr=new i(t=>{this.Yr(t)}),this.Xr.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var t;null===(t=this.Xr)||void 0===t||t.disconnect(),this.Xr=void 0,d.removeEventListener("click",this.Cr),d.removeEventListener("mousedown",this.wr,{capture:!0}),d.removeEventListener("mouseup",this.Sr,{capture:!0}),d.removeEventListener("mouseout",this._r,{capture:!0}),d.removeEventListener("dragstart",this.gr,{capture:!0}),d.removeEventListener("pointercancel",this.gr,{capture:!0}),d.removeEventListener("blur",this.gr),this.gr(),d.removeEventListener("scroll",this.$r,{capture:!0}),null==n||n.removeEventListener("selectionchange",this.Ar),d.removeEventListener("touchstart",this.qr,{capture:!0}),d.removeEventListener("touchend",this.Hr,{capture:!0}),d.removeEventListener("touchcancel",this.Br,{capture:!0}),null==n||n.removeEventListener("visibilitychange",this.an),d.removeEventListener("blur",this.Fr),d.removeEventListener("focus",this.Fr),this.jr=void 0}Yr(t){this.Ur=Date.now()}Wr(){Us(d,"click",this.Cr),Us(d,"mousedown",this.wr,{capture:!0}),Us(d,"mouseup",this.Sr,{capture:!0}),Us(d,"mouseout",this._r,{capture:!0}),Us(d,"dragstart",this.gr,{capture:!0}),Us(d,"pointercancel",this.gr,{capture:!0}),Us(d,"blur",this.gr)}Tr(t){t.selectionChangedDelayMs=Ub(t.timestamp,this.Or,this.Mr.selection_change_threshold_ms),t.visibilityChangedDelayMs=Ub(t.timestamp,this.Pr),t.focusChangedDelayMs=Ub(t.timestamp,this.Nr),this.pr.push(t)}Rr(){this.pr.length&&Ce(this.eo)&&(this.eo=d.setTimeout(()=>{this.no()},1e3))}Vr(){Us(d,"scroll",this.$r,{capture:!0})}Zr(){var t;this.vr="Range"===(null==n||null===(t=n.getSelection())||void 0===t?void 0:t.type),Us(n,"selectionchange",this.Ar)}Lr(t,e){const i=e.path[0];for(;t;){if(-1!==e.path.indexOf(t)||sr(i)&&i.contains(t))return!0;t=t.getRootNode().host}return!1}kr(t,e){const i=e.path[0],n=t.rangeCount>0?t.getRangeAt(0):void 0;if(n&&sr(i)&&n.startContainer.getRootNode()===i.getRootNode()){var s;if(!n.collapsed)return n.intersectsNode(i);const t=sr(n.startContainer)&&null!==(s=n.startContainer.childNodes[n.startOffset])&&void 0!==s?s:n.startContainer;return this.Lr(t,e)}return this.Lr(t.focusNode,e)||this.Lr(t.anchorNode,e)}Gr(){Us(n,"visibilitychange",this.an)}Qr(){Us(d,"blur",this.Fr),Us(d,"focus",this.Fr)}Dr(t,e){this.pr.forEach(i=>{const n=zb(e-i.timestamp);Ee(n)&&(Ce(i[t])||i[t]>n)&&(i[t]=n)})}Kr(){Us(d,"touchstart",this.qr,{capture:!0,passive:!0}),Us(d,"touchend",this.Hr,{capture:!0,passive:!0}),Us(d,"touchcancel",this.Br,{capture:!0,passive:!0})}zr(){const t=Ce(this.io)||Ee(this.Ur)&&this.Ur>this.io;return(Ce(this.ro)||t)&&(this.io=Date.now(),this.ro=!!(null==n?void 0:n.querySelector(Bb))),!!this.ro}Ir(t){return!t||("swipe"===t.type?this.oo(t):this.so(t))}oo(e){return!(!nr(e.node)&&!this.pr.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!rr(e.node,"html")&&sr(e.node)&&function(e,i){var n;if(!t||Tr(e))return!1;const s=Re(i)?kr:null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:kr,{targetElementList:r}=Ir(e,!1);return!gr(r,s)}(e.node,{css_selector_ignorelist:this.Mr.css_selector_ignorelist}))}so(e){return!(this.Mr.capture_clicks_with_modifier_keys||(i=e.originalEvent,!(i.ctrlKey||i.metaKey||i.altKey||i.shiftKey)))||!!this.oo(e)||function(e){if(!t||Tr(e))return!1;const{targetElementList:i}=Ir(e,!1);return i.some(t=>rr(t,"a"))}(e.node);var i}no(){if(!this.pr.length)return;clearTimeout(this.eo),this.eo=void 0;const t=this.pr;this.pr=[];for(const i of t){var e;i.mutationDelayMs=null!==(e=i.mutationDelayMs)&&void 0!==e?e:this.Ur&&this.Ur>=i.timestamp?this.Ur-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const t=Hb(i.scrollDelayMs,this.Mr.scroll_threshold_ms),n=Hb(i.selectionChangedDelayMs,this.Mr.selection_change_threshold_ms),s=Hb(i.mutationDelayMs,this.Mr.mutation_threshold_ms),r=Hb(i.absoluteDelayMs,1.1*this.Mr.mutation_threshold_ms),o=Ee(i.scrollDelayMs)&&this.Mr.scroll_threshold_ms>i.scrollDelayMs,l=Ee(i.mutationDelayMs)&&this.Mr.mutation_threshold_ms>i.mutationDelayMs,a=i.selectionChangedDuringGesture||Ee(i.selectionChangedDelayMs)&&this.Mr.selection_change_threshold_ms>i.selectionChangedDelayMs,u=Ee(i.visibilityChangedDelayMs),h=Ee(i.focusChangedDelayMs);if(!(o||l||a||u||h))if(t||s||r||n){const e=jb(i);if("$dead_swipe"===e){if(this.mr>=this.Mr.max_dead_swipes_per_page_load)continue;this.mr++}this._onCapture(i,{[`${e}_last_mutation_timestamp`]:this.Ur,[`${e}_event_timestamp`]:i.timestamp,[`${e}_scroll_timeout`]:t,[`${e}_mutation_timeout`]:s,[`${e}_absolute_timeout`]:r,[`${e}_selection_changed_timeout`]:n,[`${e}_visibility_changed_timeout`]:!1})}else this.Mr.mutation_threshold_ms>i.absoluteDelayMs&&this.pr.push(i)}this.Rr()}hr(t,e){const i=jb(t);this.instance.capture(i,le(le(le({},e),Ob(t.node,{e:t.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Mr.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:t.scrollDelayMs,[`${i}_mutation_delay_ms`]:t.mutationDelayMs,[`${i}_absolute_delay_ms`]:t.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:t.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:t.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:t.focusChangedDelayMs,$dead_swipe_direction:t.swipeDirection,$dead_swipe_distance_px:t.swipeDistancePx}),{timestamp:new Date(t.timestamp)})}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initDeadClicksAutocapture=(t,e)=>new Wb(t,e);const Vb=As("[ExternalScriptsLoader]"),Gb=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]},Zb=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return Vb.warn(`${e} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const s=Gb(e);if(s){if(s.__posthog_loading_callback_fired)return i();const t=s.__posthog_loading_error;return t?i(t):(s.addEventListener("load",t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)}),void s.addEventListener("error",t=>{s.__posthog_loading_error=t,i(t)}))}const r=()=>{if(!n)return i("document not found");if(Gb(e))return Zb(t,e,i);let s=n.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)n.head.appendChild(s);else{const t=n.querySelectorAll("body > script");var r;t.length>0?null===(r=t[0].parentNode)||void 0===r||r.insertBefore(s,t[0]):n.body.appendChild(s)}};(null==n?void 0:n.body)?r():null==n||n.addEventListener("DOMContentLoaded",r)},Qb={},Jb=(t,e)=>{let i=`/static/${e}.js?v=${t.version}`;if("toolbar"===e){const t=3e5;i=`${i}&t=${Math.floor(Date.now()/t)*t}`}return t.requestRouter.endpointFor("assets",i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"===e){const e=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void Zb(t,e,i)}const n=t.config.strict_script_versioning;if(n){const s=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=Qb[s];if("fallback"===n&&r){if(Gb(r))return void Zb(t,r,i);delete Qb[s]}return void Zb(t,s,"fallback"===n?(n,r)=>{if(n)if("string"==typeof n)i(n);else{var o;const n=Jb(t,e);Qb[s]=n;const r=Gb(s);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),Zb(t,n,i)}else i(void 0,r)}:i)}Zb(t,Jb(t,e),i)},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{const n=t.requestRouter.endpointFor("api",e);Zb(t,n,i)};var Kb=class{constructor(t){this._instance=t}get Mr(){return this._instance.config}get consent(){return this.$o()?0:this.To}isOptedOut(){return"always"===this.Mr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Mr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Mr.opt_out_capturing_by_default}optInOut(t){this.Io.At(this.Mo,t?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Io.Lt(this.Mo,this.Mr.cross_subdomain_cookie)}get Mo(){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 To(){const t=this.Io.Ot(this.Mo);return He(t)?1:fe(ze,t)?0:-1}get Io(){const t=this.Mr.opt_out_capturing_persistence_type,e="localStorage"===t?xl:kl,i=e.Et()?e:Dl;if(!this.Eo||this.Eo!==i){this.Eo=i;const e="localStorage"===t?kl:xl;e.Ot(this.Mo)&&(this.Eo.Ot(this.Mo)||this.optInOut(He(e.Ot(this.Mo))),e.Lt(this.Mo,this.Mr.cross_subdomain_cookie))}return this.Eo}$o(){return!!this.Mr.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(t=>He(t))}};const Yb=As("[Dead Clicks]"),Xb=()=>!0,t_=t=>{var e;const i=!!(null===(e=t.instance.persistence)||void 0===e?void 0:e.get_property(M)),n=t.instance.config.capture_dead_clicks;return Re(n)?n:!!Se(n)||i};var e_=class{get lazyLoadedDeadClicksAutocapture(){return this.Po}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({[M]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Ro(()=>{this.Ao()}):this.stop()}Ro(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this.instance,"dead-clicks-autocapture",e=>{e?Yb.error("failed to load script",e):t()})}Ao(){var t;if(n){if(!this.Po&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=Se(this.instance.config.capture_dead_clicks)?le({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Po=d.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Po.start(n),Yb.info("starting...")}}else Yb.error("`document` not found. Cannot start.")}stop(){this.Po&&(this.Po.stop(),this.Po=void 0,Yb.info("stopping..."))}};const i_=As("[SegmentIntegration]");function n_(t,e,i=!0){const n=t.config.segment;if(!n)return e();const{analytics:s,filterProperties:r}=(t=>ke(t.register))(o=n)?{analytics:o}:o;var o;!function(t,e,i,n){const s=e=>{const s=()=>e.anonymousId()||ml();t.config.get_device_id=s,n&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property(xt,Zt)),i(n?void 0:e.anonymousId()||void 0)},r=e.user();"then"in r&&ke(r.then)?r.then(s):s(r)}(t,s,i=>{s.register(((t,e,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||i_.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()||(i_.info("No userId set, resetting PostHog"),t.reset()),r||(e=void 0),n.event.userId&&n.event.userId!==t.get_distinct_id()&&(i_.info("UserId set, identifying with PostHog"),t.identify(n.event.userId));let o=t.calculateEventProperties(s,n.event.properties);if(!Me(i)){const t=n.event.properties||{},e={};for(const i of Object.keys(o))be.call(t,i)||(e[i]=o[i]);const s=((t,e)=>{const i=we(t)?t:[t];let n=le({},e);for(const t of i)try{if(n=t(n),Me(n))return null}catch(t){return i_.error("Error in Segment filterProperties:",t),null}return n})(i,e);if(Me(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,Yt)},identify(t){return n(t,te)},screen(t){return n(t,"$screen")}}})(t,i,{filterProperties:r})).then(()=>{e()},t=>{i_.error("Failed to register the Segment integration",t),e()})},i)}const s_="posthog-js";function r_(t,{organization:e,projectId:i,prefix:n,severityAllowList:s=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var l,a,u,h,c;if("*"!==s&&!s.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const d=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,t.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const v=(null===(l=o.exception)||void 0===l?void 0:l.values)||[],f=v.map(t=>le(le({},t),{},{stacktrace:t.stacktrace?le(le({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>le(le({},t),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:(null===(a=v[0])||void 0===a?void 0:a.value)||o.message,$exception_type:null===(u=v[0])||void 0===u?void 0:u.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(h=v[0])||void 0===h?void 0:h.value)||o.message,$sentry_exception_type:null===(c=v[0])||void 0===c?void 0:c.type,$sentry_tags:o.tags};var g;return e&&i&&(p.$sentry_url=(n||"https://sentry.io/organizations/")+e+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(g=t.exceptions)||void 0===g||g.sendExceptionEvent(p)),o}}var o_=class{constructor(t,e,i,n,s,r){this.name=s_,this.setupOnce=function(o){o(r_(t,{organization:e,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:null==r||r}))}}},l_=class{constructor(t){this.Fo=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Rs.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Oo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Do()}Do(){var t;this.Lo=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.Fo)}destroy(){var t;null===(t=this.Lo)||void 0===t||t.call(this),this.Lo=void 0}doPageView(e,i){var n;const s=this.No(e,i);return this.Oo={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.No(t,null===(e=this.Oo)||void 0===e?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.Oo)||void 0===t?void 0:t.pageViewId}}No(t,e){const i=this.Oo;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?Ve(e/t,0,1,Rs):1,a=t>1?Ve(i/t,0,1,Rs):1,u=r>1?Ve(o/r,0,1,Rs):1,h=r>1?Ve(l/r,0,1,Rs):1;n=Ds(n,{$prev_pageview_last_scroll:e,$prev_pageview_last_scroll_percentage:s,$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:a,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:u,$prev_pageview_max_content:l,$prev_pageview_max_content_percentage:h})}}return i.pathname&&(n.$prev_pageview_pathname=i.pathname),i.timestamp&&(n.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),n}};const a_=["flags","surveys"],u_={[v]:{exposure:"hidden"},[m]:{exposure:"hidden"},[y]:{exposure:"hidden"},[w]:{exposure:"hidden"},[_]:{exposure:"hidden"},[k]:{exposure:"event"},[S]:{exposure:"hidden"},[P]:{exposure:"hidden"},[x]:{exposure:"event"},[C]:{exposure:"hidden"},[T]:{exposure:"event"},[I]:{exposure:"event"},[M]:{exposure:"event"},[E]:{exposure:"hidden"},[R]:{exposure:"event"},[A]:{exposure:"hidden"},[F]:{exposure:"hidden"},[j]:{exposure:"hidden"},[B]:{exposure:"event"},[O]:{exposure:"event",shouldSkipFromEventProperties:t=>Ie(t)},[H]:{exposure:"event"},[z]:{exposure:"event"},[U]:{exposure:"event"},[Z]:{exposure:"event"},[Q]:{exposure:"hidden"},[J]:{exposure:"hidden",storageGroup:"flags"},[K]:{exposure:"hidden",storageGroup:"flags"},[Y]:{exposure:"hidden"},[X]:{exposure:"hidden",storageGroup:"flags"},[tt]:{exposure:"hidden",storageGroup:"flags"},[et]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[it]:{exposure:"hidden",storageGroup:"flags"},[nt]:{exposure:"hidden"},[st]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[ot]:{exposure:"hidden"},[at]:{exposure:"hidden",storageGroup:"surveys"},[ut]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ht]:{exposure:"event"},[ct]:{exposure:"hidden"},[dt]:{exposure:"hidden"},[vt]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[pt]:{exposure:"hidden"},[gt]:{exposure:"event"},[mt]:{exposure:"event"},[yt]:{exposure:"event"},[bt]:{exposure:"event"},[_t]:{exposure:"hidden"},[wt]:{exposure:"hidden"},[lt]:{exposure:"event"},[kt]:{exposure:"hidden"},[St]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[xt]:{exposure:"hidden"},[Ct]:{exposure:"hidden"},[$t]:{exposure:"hidden"},[Tt]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[Et]:{exposure:"hidden"},[D]:{exposure:"event"},[L]:{exposure:"event"},[N]:{exposure:"event"},[q]:{exposure:"event"},[At]:{exposure:"event"},[Ft]:{exposure:"event"},[Ot]:{exposure:"event"},[Dt]:{exposure:"event"},[Lt]:{exposure:"event"},[Nt]:{exposure:"event"},[qt]:{exposure:"event"},[jt]:{exposure:"event"},[Bt]:{exposure:"event"},[Ht]:{exposure:"event"},[Wt]:{exposure:"event"}},h_=[[W,{exposure:"hidden"}],[V,{exposure:"hidden"}],[G,{exposure:"hidden"}]],c_=t=>{const e=u_[t];if(e)return e;for(const[e,i]of h_)if(0===t.indexOf(e))return i},d_={flags:St,surveys:ut},v_=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],f_=t=>`${t}_cookie_identity_change_pending`,p_=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},g_="main",m_=[J,K,X,tt,et,St,it,rt],y_=t=>-1!==m_.indexOf(t),b_=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},__=t=>{if(!t)return{};const e=JSON.parse(t);return Se(e)?e:{}},w_=(t,e)=>{Os(t,(i,n)=>{const s=c_(n);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,n)||delete t[n]})};var k_=class{constructor(e,i,n=!0){if(this.qo={},this.jo=!1,this.Bo=!1,this.Ho=!1,this.zo=!1,this.Uo=!1,this.Wo=new Map,this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=new Set,this.Mr=e,this.Ko=n,this.props={},this.Yo=void 0,this.Xo=(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.Io=this.tl(e),this.Ho=this.el(e),this.load(),this.il(),e.debug&&Rs.info("Persistence loaded",e.persistence,le({},this.props)),this.update_config(e,e,i),this.save(),t){const e=()=>this.flush();Us(t,"beforeunload",e,{capture:!1}),Us(t,"pagehide",e,{capture:!1}),this.nl=e=>{if(this.jo&&(!e.storageArea||e.storageArea===(null==t?void 0:t.localStorage))&&e.key)if(e.key!==this.Xo){if(this.Ho){const t=a_.find(t=>e.key===this.sl(t));t&&this.rl(e.key,t)}}else this.rl(e.key,g_)},Us(t,"storage",this.nl)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,e])=>{const i=this.Wo.get(t);if(!y_(t)||!0===i)return;if(!0===e)return void this.ol(t,!0);const n=new Set(i||[]);e.forEach(t=>n.add(t)),n.size&&this.ol(t,n)})}onCrossTabFeatureFlagChange(t){return this.Jo.add(t),()=>this.Jo.delete(t)}destroy(){this.nl&&t&&(t.removeEventListener("storage",this.nl),this.nl=void 0),this.Jo.clear()}rl(t,e,i=!0){if(this.pi)return!1;let n,s;try{if(s=xl.Ot(t),Ie(s)){const t=this.ll(e);return t.storageValue=null,e!==g_&&(t.persisted=!1),!1}n=__(s)}catch(t){return!1}const r=e===g_?n:xl.Dt(this.Xo);if(r&&this.al(r))return!1;const o=this.ul(n,e,i);return e===g_&&this.Ho&&!b_(this.hl().main,n)||this.cl(n,e,!0,s),o}al(t){const e=this.props[f],i=t[f];return!Ce(e)&&!Ce(i)&&e!==i}cl(t,e,i,n){const s=this.ll(e);s.storageValue=n,e!==g_&&(s.persisted=i);try{s.fingerprint=this.dl(t,e)}catch(t){s.fingerprint=void 0}}ul(t,e,i){let n=!1;return m_.forEach(i=>{var s;const r=null===(s=c_(i))||void 0===s?void 0:s.storageGroup;if(e===g_&&this.Ho&&r||e!==g_&&r!==e)return;const o=i in t,l=this.vl(i,o?t[i]:void 0),a=this.Wo.has(i)?i in this.props:o;a===i in this.props&&b_(l,this.props[i])||(a?this.fl(i,l,!1):this.pl(i,!1),n=!0)}),n&&i&&this.Jo.forEach(t=>t()),n}gl(){if(!this.jo)return!1;try{this.Zo=!1;const t=xl.Ot(this.Xo),e=this.ll(g_);let i,n=!1,s=!1;if(t!==e.storageValue)if(Ie(t))e.storageValue=null;else{if(i=__(t),this.Zo=!this.Go&&this.al(i),this.Zo)return!1;s=this.ul(i,g_,!1),!this.Ho||b_(this.hl().main,i)?this.cl(i,g_,!0,t):e.storageValue=t,n=!0}return this.Ho&&a_.forEach(t=>{const e=xl.Ot(this.sl(t)),r=this.ll(t),o=i||{},l=n&&m_.some(e=>{var i;return(null===(i=c_(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.ul(o,t,!1)||s));const a=__(e);s=this.ul(a,t,!1)||s,this.cl(a,t,!0,e)}),s}catch(t){return!1}}ol(t,e){this.Wo.set(t,e);const i=c_(t);(null==i?void 0:i.volatile)||(this.ll((this.Ho?null==i?void 0:i.storageGroup:void 0)||g_).fingerprint=void 0,this.ml(t))}yl(){m_.forEach(t=>this.Wo.set(t,!0))}il(){if(this.jo)try{const t=xl.Ot(this.Xo),e=__(t);this.ll(g_).storageValue=t,m_.forEach(t=>{var i;const n=this.Ho?null===(i=c_(t))||void 0===i?void 0:i.storageGroup:void 0,s=n?xl.Ot(this.sl(n)):null;if(n){const t=this.ll(n);t.storageValue=s,t.persisted=!Ie(s)}const r=n&&!Ie(s)?__(s):e;t in this.props?this.bl(t,r[t],this.props[t]):t in r&&this.ol(t,!0)})}catch(t){}}vl(t,e){const i=this.Wo.get(t);if(!i)return e;if(!0===i)return this.props[t];if("$active_feature_flags"===t){const n=new Set(we(e)?e:[]),s=new Set(we(this.props[t])?this.props[t]:[]);return i.forEach(t=>s.has(t)?n.add(t):n.delete(t)),Array.from(n)}const n=Se(e)?le({},e):{},s=Se(this.props[t])?this.props[t]:{};return i.forEach(t=>{t in s?n[t]=s[t]:delete n[t]}),n}bl(t,e,i){if(!y_(t))return;const n=this.Wo.get(t);if(!0===n)return;let s=e;if(this.jo)try{var r;const e=this.Ho?null===(r=c_(t))||void 0===r?void 0:r.storageGroup:void 0,i=e?this.sl(e):this.Xo;s=__(xl.Ot(i))[t]}catch(t){}const o=new Set(n||[]);if("$active_feature_flags"===t){if(!Ce(e)&&!we(e)||!Ce(s)&&!we(s)||!we(i))return void this.ol(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(!Se(i))return void(b_(s,i)?this.Wo.delete(t):this.ol(t,!0));{if(!Ce(e)&&!Se(e)||Ce(e)&&xe(i)&&Ce(s))return void this.ol(t,!0);const n=Se(e)?e:{},r=Se(s)?s:{};new Set([...Object.keys(n),...Object.keys(i)]).forEach(t=>{t in n==t in i&&b_(n[t],i[t])||o.add(t)}),o.forEach(t=>{t in r==t in i&&b_(r[t],i[t])&&o.delete(t)})}}o.size?this.ol(t,o):this.Wo.delete(t)}_l(){var t;const e=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Ee(e)&&e>0?e:0}wl(t){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase())if(t)try{const e=El(t,this.Mr.cookie_persisted_properties||[]),i=Rl(e,this.Mr.cookie_persisted_properties||[]),n=JSON.stringify(e)+"|"+JSON.stringify(i),s=kl.Ot(this.Xo)||void 0;s&&Fl(this.Xo,s)===n&&(this.kl=n,this.Sl=s)}catch(t){}else try{const t=kl.Ot(this.Xo)||void 0;this.kl=t?Fl(this.Xo,t):void 0,this.Sl=t}catch(t){}}syncCookieProperties(){return this.xl(this.Mr)}xl(t,e=!1){if(this.pi&&!e||this.Uo||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let i;try{i=kl.Ot(this.Xo)||void 0}catch(t){}if(!i||i===this.Sl)return!1;const n=Fl(this.Xo,i);let s;try{s=Ml(JSON.parse(i))}catch(t){return!1}if((kl.Ot(this.Xo)||void 0)!==i)return!1;this.kl=n,this.Sl=i;const r=Al(this.Xo,i),o=[...$l,...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])}),xe(s))return!1;const a="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,u=this.props,h=u[f],c=u[xt],d=Ds({},u);[...$l,...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===$l.indexOf(t)||!1!==e&&0!==e)&&delete d[t]}}),this.props=Ds(d,s),m_.forEach(t=>{const e=t in this.props;t in u===e&&b_(u[t],this.props[t])||(e?this.bl(t,u[t],this.props[t]):this.ol(t,!0))}),!a||"$user_state"in s||"$user_state"in this.props||this.fl(xt,Gt);const v=this.props[f],p=this.props[xt];return!a||v===h&&p===c||(this.Go=!0,this.zo=!0,Nl.At(f_(this.Xo),!0),this.pl(rt),this.pl(K),this.pl(J),this.pl(X),this.pl(tt),this.pl(et),this.pl(St),this.pl(kt),this.pl(_t),"anonymous"!==p||"identified"!==c&&"anonymous"!==s.$user_state&&(Ce(h)||v===h)||(w_(this.props,s),this.pl(ot)),"identified"===p?this.props.$user_id=v:delete this.props.$user_id,this.pl(m)),!0}consumeCookieIdentityChange(){const t=f_(this.Xo),e=this.zo||!!Nl.Ot(t);return this.zo=!1,e&&Nl.Lt(t),e}Cl(t=!1){return!(this.Uo||this.pi&&!t||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.Uo=!0,0))}$l(){this.Uo&&(Ce(this.Tl)||(clearTimeout(this.Tl),this.Tl=void 0),delete this.qo[g_],this.Il(!0))}Ml(t=!0){if(this.Uo)try{t?this.$l():Ce(this.Tl)||(clearTimeout(this.Tl),this.Tl=void 0)}finally{this.Uo=!1}}isDisabled(){return!!this.pi}tl(e){-1===v_.indexOf(e.persistence.toLowerCase())&&(Rs.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const i=((e=[],i=!1)=>{const n=[...$l,...e];return le(le({},xl),{},{Dt(t){try{let s,r={};try{s=kl.Ot(t)||void 0,r=s?Ml(JSON.parse(s)):{}}catch(t){}const o=JSON.parse(xl.Ot(t)||"{}");let l;if(i){const i=Al(t,s),a=[...$l,...i.properties],u={};Object.keys(r).forEach(t=>{const e=r[t];Ie(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e||(u[t]=e)});const h="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var e;const t=o[f],s=null!==(e=o.$user_state)&&void 0!==e?e:Gt;n.forEach(t=>{if(-1!==a.indexOf(t)&&!(t in r)&&(h||"distinct_id"!==t&&"$user_state"!==t)){const e=o[t];(i.isValid||-1===$l.indexOf(t)||!1!==e&&0!==e)&&delete o[t]}}),!h||"$user_state"in r||"$user_state"in o||(o[xt]=Gt),!h||("distinct_id"in u?u[f]:o[f])===t&&("$user_state"in u?u[xt]:o[xt])===s||(Cl.forEach(t=>delete o[t]),"identified"===u.$user_state&&"distinct_id"in u?o.$user_id=u[f]:delete o.$user_id,"identified"!==u.$user_state&&(delete o[lt],delete o[ot]),delete o.__alias)}l=Ds(o,u)}else l=Ds(r,o);return xl.At(t,l),l}catch(t){}return null},At(t,n,s,r,o,l){const a=xl.At(t,n,void 0,void 0,l);try{const u=El(n,e);if(Object.keys(u).length){if(i){const i=Tl(t),h=Rl(u,e);if(kl.At(i,h,s,r,o,l),kl.Ot(i)!==JSON.stringify(h)){kl.Lt(i,r);const e=El(n);return kl.At(t,e,s,r,o,l),a}}kl.At(t,u,s,r,o,l)}}catch(t){xl.Pt(t)}return a},Lt(e,i){try{null==t||t.localStorage.removeItem(e),kl.Lt(e,i),kl.Lt(Tl(e),i)}catch(t){xl.Pt(t)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let n,s=!1,r=!1;const o=e.persistence.toLowerCase();return"localstorage"===o&&xl.Et()?(n=xl,r=!0):"localstorage+cookie"===o&&i.Et()?(n=i,r=!0,s=!0):"sessionstorage"===o&&Nl.Et()?n=Nl:"memory"===o?n=Dl:"cookie"===o&&kl.Et()?(n=kl,s=!0):i.Et()?(n=i,r=!0,s=!0):kl.Et()?(n=kl,s=!0):n=Dl,this.jo=r,this.Bo=s,n}sl(t){return`${this.Xo}__${t}`}el(t){return this.jo&&!!t.split_storage}properties(){const t={};return Os(this.props,(e,i)=>{const n=c_(i);if(!n||"event"===n.exposure){var s;if(null==n||null===(s=n.shouldSkipFromEventProperties)||void 0===s?void 0:s.call(n,e))return;t[i]=e}}),t}load(t=!1){if(this.pi&&!t)return;const e=this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase(),i=e?xl.Dt(this.Xo):null;let n={};if(e)try{n=Ml(kl.Dt(this.Xo)),Os(n,(t,e)=>{(Ce(t)||Ie(t)||""===t)&&delete n[e]})}catch(t){}const s=this.Io.Dt(this.Xo);if(s&&(this.props=Ds({},s)),this.Ho&&this.El(),e&&s){var r,o;const t=null==i?void 0:i[f],e=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Gt,l=s[f],a=null!==(o=s.$user_state)&&void 0!==o?o:Gt;if(l!==t||a!==e){this.zo=!0,Nl.At(f_(this.Xo),!0);const i=Ds({},this.props);Cl.forEach(t=>delete i[t]),"anonymous"!==a||"identified"!==e&&"anonymous"!==n.$user_state&&(Ce(t)||l===t)||(w_(i,n),delete i[ot]),this.props=i;const s=new Set;Cl.forEach(t=>{var e;const i=null===(e=c_(t))||void 0===e?void 0:e.storageGroup;i&&s.add(i)}),s.forEach(t=>{const e={};Os(this.props,(i,n)=>{var s;(null===(s=c_(n))||void 0===s?void 0:s.storageGroup)===t&&(e[n]=i)}),xe(e)?(xl.Lt(this.sl(t)),this.qo[t]={}):xl.At(this.sl(t),e)&&(this.qo[t]={persisted:!0,fingerprint:this.dl(e,t)})})}}Nl.Ot(f_(this.Xo))&&(this.zo=!0)}El(){for(const t of a_){const e=xl.Dt(this.sl(t));if(e&&!xe(e)){const i=this.ll(t);i.persisted=!0,this.Pl(t)||(i.fingerprint=this.dl(e,t)),this.Rl(t,e)||Ds(this.props,e)}}}Pl(t){return Object.keys(this.props).some(e=>{var i;return(null===(i=c_(e))||void 0===i?void 0:i.storageGroup)===t})}Rl(t,e){const i=d_[t];if(!i)return!1;const n=e[i],s=this.props[i];return Ee(n)&&Ee(s)&&s>n}refreshKey(t){var e;if(this.pi)return;if("$fbc_persistence"===t&&this.Qo)return;const i=this.Ho?null===(e=c_(t))||void 0===e?void 0:e.storageGroup:void 0,n=i?xl.Dt(this.sl(i)):this.Io.Dt(this.Xo);if(n&&t in n)this.fl(t,n[t],!1);else{if(i){const e=this.Io.Dt(this.Xo);if(e&&t in e)return void this.fl(t,e[t],!1)}this.pl(t,!1)}}save(){if(this.pi)return;const t=this._l();t>0?Ce(this.Tl)&&(this.Tl=setTimeout(()=>{this.Tl=void 0,this.Il()},t)):this.Il()}flush(){Ce(this.Tl)||(clearTimeout(this.Tl),this.Tl=void 0,this.Il())}Il(t=!1){if(this.pi||this.Uo&&!t)return;t||(this.syncCookieProperties(),this.Qo||this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||this.refreshKey(_));const e=!t&&!this.Vo;e||(this.Zo=!1);const i=!!e&&this.gl();if(this.Zo)return void(this.Mr.debug&&Rs.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Ho)return this.Al(),void(i&&this.Jo.forEach(t=>t()));const n=this.Fl(this.Io,this.Xo,this.props,g_);"written"===n&&this.wl(this.props),"failed"!==n&&(this.Wo.clear(),this.Go=!1,this.Qo=!1),i&&this.Jo.forEach(t=>t())}Al(){const{main:t,groups:e}=this.hl(),i=this.Fl(this.Io,this.Xo,t,g_);"written"===i&&this.wl(t),"failed"!==i&&(this.Go=!1,this.Qo=!1,m_.forEach(t=>{var e;(null===(e=c_(t))||void 0===e?void 0:e.storageGroup)||this.Wo.delete(t)}));for(const t of a_){var n;const i=e[t];if(xe(i)&&!(null===(n=this.qo[t])||void 0===n?void 0:n.persisted)){m_.forEach(e=>{var i;(null===(i=c_(e))||void 0===i?void 0:i.storageGroup)===t&&this.Wo.delete(e)});continue}const s=this.Fl(xl,this.sl(t),i,t);"failed"!==s&&m_.forEach(e=>{const i=c_(e);(null==i?void 0:i.storageGroup)!==t||"written"!==s&&i.volatile||this.Wo.delete(e)})}}hl(){const t={},e={flags:{},surveys:{}};return Os(this.props,(i,n)=>{var s;const r=null===(s=c_(n))||void 0===s?void 0:s.storageGroup;r?e[r][n]=i:t[n]=i}),{main:t,groups:e}}dl(t,e){if(e===g_)return JSON.stringify(t)+"|"+this.Ol+"|"+this.Dl+"|"+this.Ll;const i={};return Os(t,(t,e)=>{var n;i[e]=(null===(n=c_(e))||void 0===n?void 0:n.volatile)?"__volatile__":t}),JSON.stringify(i)}Fl(t,e,i,n){const s=this.ll(n);if(n!==g_&&!s.dirty&&!Ce(s.fingerprint))return"skipped";let r;try{if(r=this.dl(i,n),r===s.fingerprint)return s.dirty=!1,"skipped"}catch(t){r=void 0}return t.At(e,i,this.Ol,this.Dl,this.Ll,this.Mr.debug)?(s.dirty=!1,n!==g_&&(s.persisted=!0),Ce(r)||(s.fingerprint=r),this.jo&&(s.storageValue=xl.Ot(e)),"written"):(this.Mr.debug&&Rs.warn(`failed to persist storage entry "${e}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.yl(),Ce(this.Tl)||(clearTimeout(this.Tl),this.Tl=void 0),this.Io.Lt(this.Xo,!1),this.Io.Lt(this.Xo,!0),!t&&this.Ko)for(const t of a_)xl.Lt(this.sl(t));t?delete this.qo[g_]:this.qo={},this.kl=void 0,this.Sl=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(Se(t)){this.syncCookieProperties(),Ce(e)&&(e="None"),this.Ol=Ce(i)?this.Nl:i;let n=!1;if(Os(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.fl(i,t),n=!0)}),n)return this.save(),!0}return!1}register(t,e){if(Se(t)){this.syncCookieProperties(),this.Ol=Ce(e)?this.Nl:e;let i=!1;if(Os(t,(e,n)=>{t.hasOwnProperty(n)&&(this.props[n]!==e||Se(e)||we(e))&&(this.fl(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.pl(t),i=!0);i&&this.save()}update_campaign_params(){const t=null==n?void 0:n.URL;if(t===this.Yo)return;const e=ga(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),i=!xe(js(e));return i&&this.register(e),this.Yo=t,i?e:void 0}update_search_keyword(){this.register(function(){const t=null==n?void 0:n.referrer;return t?ya(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:ka(),$referring_domain:(null==n?void 0:n.referrer)&&(null===(t=Zs(n.referrer))||void 0===t?void 0:t.host)||wa},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Sa(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[Mt]:this.Bo?{r:p_(t.r),u:t.u?p_(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Os([It,Tt],e=>{const i=this.props[e];i&&Os(i,function(e,i){t["$initial_"+ge(i)]=e})});const e=this.props[Mt];if(e){const i=function(t,e=!1){const i=xa(t,e),n={};return Os(i,function(t,e){n[`$initial_${ge(e)}`]=t}),n}(e,this.Mr.disable_capture_url_hashes);Ds(t,i)}return t}safe_merge(t){return Os(this.props,function(e,i){i in t||(t[i]=e)}),t}update_config(t,e,i){const n=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;const i=[...t].sort(),n=[...e].sort();return i.every((t,e)=>t===n[e])})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),r=n||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,l=t.disable_persistence||!!i,a=!!this.pi&&!l;l||this.xl(e,a),this.Mr=t,!l&&(n||s||o)&&(this.kl=void 0,this.Sl=void 0,this.xl(le(le({},t),{},{cookie_persisted_properties:e.cookie_persisted_properties}),a));const u=r||o?this.tl(t):this.Io;this.ql();const h=this.el(t),c=r||h!==this.Ho,d=!l&&(c||t.cross_subdomain_cookie!==this.Dl||t.secure_cookie!==this.Ll)&&this.Cl(a);this.Vo=c;try{if(this.Nl=this.Ol=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),c){const t=this.props;this.clear(),this.Io=u,this.Ho=h,this.props=t,this.save()}else o&&(this.Io=u,l||(delete this.qo[g_],this.Il()))}finally{this.Vo=!1,d&&this.Ml()}}ql(){const t=this.props[Mt];if(!this.Bo||!Se(t)||"string"!=typeof t.r)return;const e=p_(t.r),i="string"==typeof t.u?p_(t.u):t.u;e===t.r&&i===t.u||this.fl(Mt,le(le({},t),{},{r:e,u:i}))}set_disabled(t){this.pi=t,this.pi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Dl&&(this.Dl=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Ll&&(this.Ll=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){const i=this.props.__timers||{};i[t]=e,this.fl(w,i),this.save()}remove_event_timer(t){const e=this.props.__timers||{},i=e[t];return Ce(i)||(delete e[t],this.fl(w,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.fl(t,e),this.save()}fl(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.Go=!0),"$fbc_persistence"!==t||b_(s,e)||(this.Qo=!0),this.bl(t,s,e),(null===(n=c_(t))||void 0===n?void 0:n.volatile)||this.ml(t))}pl(t,e=!0){delete this.props[t],e&&(y_(t)&&this.ol(t,!0),"$fbc_persistence"===t&&(this.Qo=!0),this.ml(t))}ml(t){var e;const i=null===(e=c_(t))||void 0===e?void 0:e.storageGroup;i&&(this.ll(i).dirty=!0)}ll(t){return this.qo[t]||(this.qo[t]={})}};const S_=As("[RateLimiter]");var x_=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=>{S_.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void S_.warn(`could not rate limit - continuing. Error: "${null==t?void 0:t.message}"`,{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t=!1){var e,i,n;const{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,o=(new Date).getTime(),l=null!==(e=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_property("$capture_rate_limit"))&&void 0!==e?e:{tokens:s,last:o};l.tokens+=(o-l.last)/1e3*r,l.last=o,l.tokens>s&&(l.tokens=s);const a=1>l.tokens;if(a||t||(l.tokens=Math.max(0,l.tokens-1)),a&&!t){const t=(Ee(l.dropped)?l.dropped:0)+1;l.dropped=t,!this.lastEventRateLimited&&this.jl(t)&&(l.dropped=0)}return this.lastEventRateLimited=a,null===(n=this.instance.persistence)||void 0===n||n.set_property("$capture_rate_limit",l),{isRateLimited:a,remainingTokens:l.tokens}}Bl(t){const e=this.instance.config.property_denylist;return!we(e)||!e.includes(t)}Hl(){var t;if(this.Bl("$current_url")&&this.Bl("$pathname")&&(null==s?void 0:s.pathname))return`${null!==(t=s.origin)&&void 0!==t?t:""}${s.pathname}`}jl(t){var e,i;const{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,r=this.Hl(),o=this.Bl("$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 C_=As("[RemoteConfig]");var $_=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=d._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}zl(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.loadExternalDependency)?null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Ul(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:t})}load(){try{if(this.remoteConfig)return C_.info("Using preloaded remote config",this.remoteConfig),void this.Wl(this.remoteConfig);if(this._instance.Vl())return void C_.warn("Remote config is disabled. Falling back to local config.");this.zl(t=>{if(!t)return C_.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ul(t=>{this.Wl(t.json,t)});this.Wl(t)})}catch(t){C_.error("Error loading remote config",t),this.Wl()}}Wl(t,e){!t&&e&&(0===e.statusCode?e.error||C_.warn("Failed to fetch remote config from PostHog."):C_.error("Failed to fetch remote config from PostHog."));try{this._instance.Wl(t?{ok:!0,config:t}:{ok:!1})}catch(t){C_.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){C_.error("Error loading feature flags",t)}}};const T_=!!o||!!r,I_="text/plain";let M_=!1;const E_=(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}`:""}`},P_=(t,e,i=!0)=>{var n;const[s,r]=t.split("?"),o=le({},e),l=null!==(n=null==r?void 0:r.split("&").map(t=>{var e;const[n,s]=t.split("="),r=i&&null!==(e=o[n])&&void 0!==e?e:s;return delete o[n],`${n}=${r}`}))&&void 0!==n?n:[],a=Qs(o);return a&&l.push(a),l.length>0?`${s}?${l.join("&")}`:s},R_=t=>{if(t.Gl)return t.Gl;const{data:e,compression:i}=t;if(!e)return;if(i===Kf){const t=ll(al(Gs(e)),{mtime:0});return{contentType:I_,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(i===Yf){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(Gs(e)),i=(t=>"data="+encodeURIComponent("string"==typeof t?t:Gs(t)))(t);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const n=Gs(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}},A_=t=>{const e=()=>"sendBeacon"===t.transport?{url:P_(t.url,{compression:Yf}),encodedBody:R_(le(le({},t),{},{compression:Yf,Gl:void 0}))}:{url:E_(t.url,"compression"),encodedBody:R_(le(le({},t),{},{compression:void 0,Gl:void 0}))};let i;try{i=R_(t)}catch(i){if(ts(t.compression,Js(t.url,"compression")))return Rs.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return i&&ts(t.compression,Js(t.url,"compression"))&&!((n=i.body)instanceof ArrayBuffer?Xn(new Uint8Array(n)):ArrayBuffer.isView(n)&&Xn(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(M_=!0,e()):{url:t.url,encodedBody:i};var n},F_=t=>{try{return A_(t)}catch(i){var e;return Rs.error(i),void(null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))}},O_=function(){var t=ne(function*(t){const e=yield ls(Gs(t.data),ql.DEBUG,{rethrow:!0});if(!e)return t;const i=yield e.arrayBuffer();return le(le({},t),{},{Gl:{contentType:I_,body:i,estimatedSize:i.byteLength}})});return function(e){return t.apply(this,arguments)}}(),D_=/Failed to fetch|NetworkError|Load failed/i,L_=t=>"TypeError"===(null==t?void 0:t.name)&&D_.test((null==t?void 0:t.message)||""),N_=t=>{const e=F_(t);if(!e)return;const i=new o,{url:n,encodedBody:s}=e;i.open(t.method||"GET",n,!0);const{contentType:r,body:l}=null!=s?s:{};Os(t.headers,function(t,e){i.setRequestHeader(e,t)}),r&&i.setRequestHeader("Content-Type",r),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e;const n={statusCode:i.status,text:i.responseText};if(200===i.status)try{n.json=JSON.parse(i.responseText)}catch(t){}null===(e=t.callback)||void 0===e||e.call(t,n)}},i.send(l)},q_=t=>{const e=F_(t);if(!e)return;const{url:i,encodedBody:n}=e,{contentType:s,body:o,estimatedSize:a}=null!=n?n:{},u=new Headers;Os(t.headers,function(t,e){u.append(e,t)}),s&&u.append("Content-Type",s);let h=null,c=!1;if(l){const e=new l;h={signal:e.signal,timeout:setTimeout(()=>{var i;c=!0,e.abort(nn("AbortError","PostHog request timed out"+((i=t.timeout)?` after ${i}ms`:"")))},t.timeout)}}const d=e=>{var i;c&&"AbortError"===(null==e?void 0:e.name)||L_(e)?Rs.warn(e):Rs.error(e),null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e})};try{r(i,le({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t.Zl&&52428.8>(a||0),body:o,signal:null==h?void 0:h.signal},t.fetchOptions)).then(e=>e.text().then(i=>{var n;const s={statusCode:e.status,text:i};if(200===e.status)try{s.json=JSON.parse(i)}catch(t){Rs.error(t)}null===(n=t.callback)||void 0===n||n.call(t,s)})).catch(d).finally(()=>h?clearTimeout(h.timeout):null)}catch(t){h&&clearTimeout(h.timeout),d(t)}},j_=t=>{try{var e;const{url:n,encodedBody:s}=A_(t),{contentType:o,body:l,estimatedSize:a}=null!=s?s:{};if(!l)return;const u=l instanceof Blob?l:new Blob([l],{type:o});if(i.sendBeacon(n,u))return;const h=we(t.data)?t.data:null===(e=t.data)||void 0===e?void 0:e.batch;if(we(h)&&h.length>1&&(null!=a?a:0)>16384){const e=Math.ceil(h.length/2),i=e=>we(t.data)?e:le(le({},t.data),{},{batch:e});return j_(le(le({},t),{},{data:i(h.slice(0,e))})),void j_(le(le({},t),{},{data:i(h.slice(e))}))}Rs.warn(`Beacon of ~${null!=a?a:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?q_(le(le({},t),{},{Zl:!0})):N_(t)}catch(t){Rs.warn("Beacon send failed",t)}},B_=(t,e,i,n)=>{const s="query"===n?"POST"===e?"sent_at":"_":void 0;return P_(i===Kf?E_(t,"compression"):t,le(le({},s?{[s]:Date.now().toString()}:{}),i===Kf?{}:{compression:i}))},H_=(()=>{const t=[];return r&&t.push({transport:"fetch",method:q_}),o&&t.push({transport:"XHR",method:N_}),(null==i?void 0:i.sendBeacon)&&t.push({transport:"sendBeacon",method:j_}),t})();var z_=class{constructor(t,e){this.Ql=!0,this.Jl=[],this.Kl=Ve((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,Rs.createLogger("flush interval"),3e3),this.Yl=t}enqueue(t){this.Jl.push(t),this.Xl||this.ta()}unload(){this.ea();const t=this.Jl.length>0?this.ia():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.na(le(le({},t),{},{transport:"sendBeacon"}))})}enable(){this.Ql=!1,this.ta()}ta(){this.Ql||(this.Xl=setTimeout(()=>{if(this.ea(),this.Jl.length>0){const t=this.ia();for(const e in t){const i=t[e],n=(new Date).getTime();i.data&&we(i.data)&&Os(i.data,t=>{t.offset=Math.abs(t.timestamp-n),delete t.timestamp}),this.na(i)}}},this.Kl))}na(t){try{this.Yl(t)}catch(t){Rs.error(t)}}ea(){clearTimeout(this.Xl),this.Xl=void 0}ia(){const t={};return Os(this.Jl,e=>{var i;const n=e,s=(n?n.batchKey:null)||n.url;Ce(t[s])&&(t[s]=le(le({},n),{},{data:[]})),null===(i=t[s].data)||void 0===i||i.push(n.data)}),this.Jl=[],t}};const U_=["retriesPerformedSoFar"];var W_=class{constructor(t){this._instance=t,this.sa=!1,this.ra=3e3,this.Jl=[],this.Jl=[],this.oa=!0,this.resume()}resume(){if(!Ce(t)&&"onLine"in t.navigator){if(this.oa=t.navigator.onLine,this.la)return;this.la=()=>{this.oa=!0,this.aa()},this.ua=()=>{this.oa=!1},Us(t,"online",this.la),Us(t,"offline",this.ua)}}get length(){return this.Jl.length}retriableRequest(t){let{retriesPerformedSoFar:e}=t,i=us(t,U_);Pe(e)&&(i.url=P_(i.url,{retry_count:e})),this._instance._send_request(le(le({},i),{},{callback:t=>{var n;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.Is(le({retriesPerformedSoFar:e},i));0===t.statusCode&&Rs.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!=e?e:0} retries.`)}null===(n=i.callback)||void 0===n||n.call(i,t)}}))}Is(t){const e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;const i=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)}(e),n=Date.now()+i;this.Jl.push({retryAt:n,requestOptions:t});let s=`Enqueued failed request for retry in ${i}`;navigator.onLine||(s+=" (Browser is offline)"),Rs.warn(s),this.sa||(this.sa=!0,this.ha())}ha(){if(this.ca&&clearTimeout(this.ca),0===this.Jl.length)return this.sa=!1,void(this.ca=void 0);this.ca=setTimeout(()=>{this.oa&&this.Jl.length>0&&this.aa(),this.ha()},this.ra)}aa(){const t=Date.now(),e=[],i=this.Jl.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.Jl=e,i.length>0)for(const{requestOptions:t}of i)this.retriableRequest(t)}unload(){this.ca&&(clearTimeout(this.ca),this.ca=void 0),this.sa=!1,Ce(t)||(this.la&&(t.removeEventListener("online",this.la),this.la=void 0),this.ua&&(t.removeEventListener("offline",this.ua),this.ua=void 0));for(const{requestOptions:t}of this.Jl)try{this._instance._send_request(le(le({},t),{},{transport:"sendBeacon"}))}catch(t){Rs.error(t)}this.Jl=[]}},V_=class{constructor(t){this._instance=t,this.da=()=>{var t,e,i,n;this.va||(this.va={});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.va.lastScrollY=Math.ceil(r),this.va.maxScrollY=Math.max(r,null!==(t=this.va.maxScrollY)&&void 0!==t?t:0),this.va.maxScrollHeight=Math.max(o,null!==(e=this.va.maxScrollHeight)&&void 0!==e?e:0),this.va.lastContentY=l,this.va.maxContentY=Math.max(l,null!==(i=this.va.maxContentY)&&void 0!==i?i:0),this.va.maxContentHeight=Math.max(a,null!==(n=this.va.maxContentHeight)&&void 0!==n?n:0)}}get fa(){return this._instance.config.scroll_root_selector}getContext(){return this.va}resetContext(){const t=this.va;return setTimeout(this.da,0),t}startMeasuringScrollPosition(){Us(t,"scroll",this.da,{capture:!0}),Us(t,"scrollend",this.da,{capture:!0}),Us(t,"resize",this.da)}scrollElement(){if(this.fa){const i=we(this.fa)?this.fa:[this.fa];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}pa(e){var i,n;const s="y"===e?"scrollTop":"scrollLeft";if(this.fa){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.pa("y")}scrollX(){return this.pa("x")}};const G_=t=>Sa(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 Z_=class{constructor(t,e,i,n){this.je=t=>{const e=this.ga();if(e&&e.sessionId===t)return;const i={sessionId:t,props:this.ma(this._instance)};this.ya.register({[Ct]:i})},this._instance=t,this.ba=e,this.ya=i,this.ma=n||G_,this.ba.onSessionId(this.je)}ga(){return this.ya.props[Ct]}getSetOnceProps(){var t;const e=null===(t=this.ga())||void 0===t?void 0:t.props;return e?"r"in e?xa(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){const t={};return Os(js(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t[`$session_entry_${ge(i)}`]=e}),t}},Q_=class{on(t,e){return this._a[t]||(this._a[t]=[]),this._a[t].push(e),()=>{this._a[t]=this._a[t].filter(t=>t!==e)}}emit(t,e){for(const i of this._a[t]||[])i(e);for(const i of this._a["*"]||[])i(t,e)}constructor(){this._a={}}};const J_=As("[SessionId]"),K_=864e5;var Y_=class{on(t,e){return this.wa.on(t,e)}constructor(t,e,i){var n;if(this.ka=null,this.Sa=null,this.xa=[],this.Ca=void 0,this.$a=!1,this.wa=new Q_,this.Ta=(t,e)=>!(!Pe(t)||!Pe(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=t.config,this.ya=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Ia=void 0,this._sessionActivityTimestamp=null,this.Ma=e||ml,this.Ea=i||ml;const s=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Ve(this.Mr.session_idle_timeout_seconds||1800,60,36e3,J_.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pa(),this.Ra="ph_"+s+"_window_id",this.Aa="ph_"+s+"_primary_window_exists",this.Fa()){const t=Nl.Dt(this.Ra),e=Nl.Dt(this.Aa);t&&!e?this.Be=t:Nl.Lt(this.Ra),Nl.At(this.Aa,!0)}(null===(n=this.Mr.bootstrap)||void 0===n?void 0:n.sessionID)&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Oa()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Ce(this.xa)&&(this.xa=[]),this.xa.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.xa=this.xa.filter(e=>e!==t)}}Fa(){return"memory"!==this.Mr.persistence&&!this.ya.pi&&Nl.Et()}Da(t){t!==this.Be&&(this.Be=t,this.Fa()&&Nl.At(this.Ra,t))}La(){return this.Be?this.Be:this.Fa()?Nl.Dt(this.Ra):null}Na(t){const e=this.ka;return!Ie(e)&&!Ie(t)&&5e3>Math.abs(t-e)}qa(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.Na(e)||(this.ka=e,this.ya.register({[j]:[e,t,i]}))}ja(){var t;const e=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Pe(e)&&e>0}Ba(){this.ja()?this.ya.refreshKey(j):(this.ya.flush(),this.ya.load())}Ha(){var t;if(Ie(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.ka)return;this.Ba();const[,e,i]=this.za();e===this.Xt&&i===this._sessionStartTimestamp&&(this.ka=this._sessionActivityTimestamp,this.ya.register({[j]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.ya.flush())}Ua(){const[t]=this.za(),e=Pe(t)?t:0,i=Pe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Wa(t){return this.Ba(),this.Ta(t,this.Ua())}za(){const t=this.ya.props[j];return we(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.ka=null,this.Ia=void 0,clearTimeout(this.Va),this.Va=void 0,this.qa(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 J_.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void J_.error("Invalid sessionID in bootstrap",t)}})(t);return!Ce(i)&&(e?this.Ia={sessionId:t,sessionStartTimestamp:i}:this.qa(t,(new Date).getTime(),i),!0)}destroy(){this.$a=!0,this.Ha(),clearTimeout(this.Va),this.Va=void 0,this.Ca&&t&&(t.removeEventListener(Kt,this.Ca,{capture:!1}),this.Ca=void 0),this.xa=[]}Oa(){this.Ca=()=>{this.Ha(),this.Fa()&&Nl.Lt(this.Aa)},Us(t,Kt,this.Ca,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,e=null,i=!1){if("always"===this.Mr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const n=e||(new Date).getTime(),s=this.Xt;if(i)this.Sa=n;else if(Ie(this.Sa)||this.Sa>n||n-this.Sa>=1e3){var r,o;null===(r=(o=this.ya).syncCookieProperties)||void 0===r||r.call(o),this.Sa=n}let[,l,a]=this.za();const u=!Ce(s)&&l!==s,h=this.Ua();let c=this.La();const d=this.Ia,v=!!d&&(d.sessionStartTimestamp>n+6e4||n-d.sessionStartTimestamp>K_),f=d?v:Pe(a)&&Math.abs(n-a)>K_;let p=!1,g=u;const m=!l||!!d,y=l;let b=!m&&!t&&this.Ta(n,h);if(b&&(b=this.Wa(n),b||J_.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,a]=this.za()),m||b||f){g=!1;const t=d&&!v;l=t?d.sessionId:this.Ma(),c=this.Ea(),J_.info("new session ID assigned",{sessionId:l,windowId:c,bootstrapped:!!t,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:f}}),a=t?d.sessionStartTimestamp:n,this.Ia=void 0,p=!0}else c||(c=this.Ea(),p=!0),g=g||l!==y,g&&(J_.info("adopted cross-tab session id",{sessionId:l,windowId:c}),p=!0);const _=Pe(h)&&t&&!f?h:n,w=Pe(a)?a:(new Date).getTime();this.Da(c),this.qa(l,_,w),t||this.Pa();const k={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.xa.forEach(t=>t(l,c,k)),{sessionId:l,windowId:c,sessionStartTimestamp:w,changeReason:p?k:void 0,lastActivityTimestamp:h}}Pa(){this.$a||(clearTimeout(this.Va),this.Va=setTimeout(()=>{if(!this.$a)if(this.Wa((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.wa.emit("forcedIdleReset",{idleSessionId:t})}else this.Pa()},1.1*this.sessionTimeoutMs))}};const X_=function(t,e){if(!t)return!1;const i=t.userAgent;if(i&&We(i,e))return!0;try{const i=null==t?void 0:t.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(t=>We(null==t?void 0:t.brand,e)))return!0}catch(t){}return!!t.webdriver};function tw(){return tw=ne(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 $e(i)&&i.length>0?i:void 0}catch(t){return void Rs.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}),tw.apply(this,arguments)}const ew="custom",iw="i.posthog.com",nw=/^\/static\//,sw=["/s/","/e/","/i/"];var rw=class{constructor(t){this.Ga={},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(`.${iw}`,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Ga[this.apiHost]||(this.Ga[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":ew),this.Ga[this.apiHost]}Za(t){if(!nw.test(t))return;const e=this.instance.config.asset_host;return"string"==typeof e&&e.trim().replace(/\/$/,"")||void 0}Qa(t){const e=Zs(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}Ja(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=Zs(i))||void 0===r?void 0:r.href)||i;n=s(new URL(t)).toString()}if(s&&"api"===t&&sw.some(t=>0===e.indexOf(t))){const t=this.Qa(n);if(t){const e=this.apiHost;let i=this.Ka;(null==i?void 0:i.apiHost)===e&&i.rewriteRequestPath===s||(i={apiHost:e,rewriteRequestPath:s,urls:new Set},this.Ka=i),i.urls.add(t)}}return n}isIngestionEndpoint(t){const e=this.Ka,i=this.Qa(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.Ja(t,e,this.uiHost+e);if("flags"===t)return this.Ja(t,e,this.flagsApiHost+e);if("assets"===t){const i=this.Za(e);if(i)return this.Ja(t,e,`${i}${e}`)}if(this.region===ew)return this.Ja(t,e,this.apiHost+e);const i=iw+e;switch(t){case"assets":return this.Ja(t,e,`https://${this.region}-assets.${i}`);case"api":return this.Ja(t,e,`https://${this.region}.${i}`)}}};const ow=As("[PostHog ExternalIntegrations]"),lw={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var aw=class{constructor(t){this._instance=t}Ro(t,e){var i,n;null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,t,t=>{if(t)return ow.error("failed to load script",t);e()})}startIfEnabledOrStop(){var t;for(const[s,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var e,i,n;r&&!(null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[s])&&this.Ro(lw[s],()=>{var t;null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[s])||void 0===t||t.start(this._instance)}),!r&&(null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[s])&&(null===(n=d.__PosthogExtensions__)||void 0===n||null===(n=n.integrations)||void 0===n||null===(n=n[s])||void 0===n||n.stop())}}},uw=class{constructor(t,e){this.$=t,this.uo=e,this.Ya=new Map,this.mo=!1}add(t){var e=this;return ne(function*(){if(e.mo)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.Ya.has(t.name))throw new Error(`Browser extension "${t.name}" is already registered`);e.Ya.set(t.name,t);try{const i=t.setup(e.uo);i&&(yield i)}catch(i){const n=e.Ya.get(t.name)===t;n&&e.Ya.delete(t.name),e.$.error(`Failed to set up browser extension "${t.name}"`,i),n&&e.Xa(t)}})()}getExtension(t){return this.Ya.get(t)}dispose(){if(this.mo)return;this.mo=!0;const t=Array.from(this.Ya.values()).reverse();this.Ya.clear();for(const e of t)this.Xa(e)}Xa(t){try{var e;const i=null===(e=t.dispose)||void 0===e?void 0:e.call(t);i&&ke(i.then)&&i.then(void 0,e=>{this.$.error(`Failed to dispose browser extension "${t.name}"`,e)})}catch(e){this.$.error(`Failed to dispose browser extension "${t.name}"`,e)}}},hw=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)}};const cw="extensionsRemoteConfig";var dw=class{constructor(t){this.instance=t,this.mo=!1,this.$=Rs,this.tu=t.eu,this.kv=new hw(t),this.onEvent=t=>Ip(this.instance.on("eventCaptured",e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.$.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.mo)return Ip(()=>{});const e=e=>{try{t(e)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},i=this.instance.iu.on(cw,e);return this.tu&&e(this.tu),Ip(i)},this.nu=new uw(Rs.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){const t=this.instance.get_property(p);return"string"==typeof t?t:void 0}get library(){return{name:ql.LIB_NAME,version:ql.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,n;const s=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(n=null==s?void 0:s.sessionStartTimestamp)&&void 0!==n?n:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.nu.add(t)}getExtension(t){return this.nu.getExtension(t)}capture(t,e,i){var n=this;return ne(function*(){i?n.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):n.instance.capture(t,e)})()}registerDynamicEventProperties(t){return Ip(this.instance.su(t))}handleRemoteConfig(t){this.mo||(this.tu=t,this.instance.iu.emit(cw,t))}sendRequest(t){var e=this;return ne(function*(t,i={}){var n;const s=e.instance.requestRouter.endpointFor(null!==(n=i.target)&&void 0!==n?n:"api",t),r={method:i.method,url:i.query?P_(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?ue.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(e.instance._send_request(r),{statusCode:202}):new Promise(t=>{r.callback=t,e.instance._send_request(r)})}).apply(this,arguments)}dispose(){this.mo||(this.mo=!0,this.nu.dispose())}};const vw={};let fw=0;const pw=()=>{},gw='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',mw="Surveys module not available",yw="sanitize_properties is deprecated. Use before_send instead",bw="Invalid value for property_denylist config: ",_w=/^[A-Za-z0-9_-]{1,400}$/,ww=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,kw=["token","distinct_id",Rt],Sw="posthog";let xw=!T_&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla"));const Cw=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 le({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:zs(null==n?void 0:n.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:pw,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&$e(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null===(i=t.location)||void 0===i?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Rs.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:Qt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:pw},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:_r,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Cw(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))},Tw=[["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"]],Iw=t=>{const e={};for(const[i,n]of Tw)Ce(t[i])||(e[n]=t[i]);const i=Ds({},e,t),n=t.__preview_external_dependency_versioned_paths;return Ce(n)||(Ce(t.strict_script_versioning)&&(i.strict_script_versioning=!!n),$e(n)&&Ce(t.asset_host)&&(i.asset_host=n)),we(t.property_blacklist)&&(Ce(t.property_denylist)?i.property_denylist=t.property_blacklist:we(t.property_denylist)?i.property_denylist=[...t.property_blacklist,...t.property_denylist]:Rs.error(bw+t.property_denylist)),i};var Mw=class{constructor(){this.__forceAllowLocalhost=!1}get ru(){return this.__forceAllowLocalhost}set ru(t){Rs.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Ew=class e{ou(t){if(!t)return;const e=this.Ya.indexOf(t);-1!==e&&this.Ya.splice(e,1)}lu(t,e){var i;return this.ou(t),this.Ya.push(e),null===(i=e.initialize)||void 0===i||i.call(e),e}au(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}uu(){if(this.hu)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.au())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.cu)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.hu=!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}`)}du(){if(this.au()||"$posthog_cookieless"!==this.get_distinct_id())return;const t=this.persistence;if(!t)return;this.vu()||t.load(!0);const e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){const e=this.config.get_device_id(ml());this.register({distinct_id:e,$device_id:e}),t.set_property(xt,Gt)}this.fu()}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.pu=!1,this.gu=!1,this.webPerformance=new Mw,this.mu=!1,this.version=ql.LIB_VERSION,this.yu=new Set,this.bu="",this.iu=new Q_,this.Ya=[],this._u=[],this.cu=!1,this.hu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=$w(),this.SentryIntegration=o_,this.sentryIntegration=t=>function(t,e){const i=r_(t,e);return{name:s_,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.wu=!1,this.ku=null,this.Su=null,this.xu=null,this.scrollManager=new V_(this),this.pageViewManager=new l_(this),this.rateLimiter=new x_(this),this.requestRouter=new rw(this),this.consent=new Kb(this),this.externalIntegrations=new aw(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=$e(t)?{[t]:e}:t;this.setPersonProperties(n),null==i||i({})},set_once:(t,e,i)=>{const n=$e(t)?{[t]:e}:t;this.setPersonProperties(void 0,n),null==i||i({})}},this.on("eventCaptured",t=>Rs.info(`send "${null==t?void 0:t.event}"`,t))}init(t,i,n){if(n&&n!==Sw){var s;const r=null!==(s=vw[n])&&void 0!==s?s:new e;return r._init(t,i,n),vw[n]=r,vw[Sw][n]=r,r}return this._init(t,i,n)}_init(e,i={},n){var s,r,o;const l=$e(e)?e.trim():"";if(!l)return Rs.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.Cu(i.debug),this.$u=i,this.Tu=[],i.person_profiles?this.Su=i.person_profiles:i.process_person&&(this.Su=i.process_person);const u=$w(i.defaults),h=Iw(i),c=Ds({},u,h,{name:n,token:l});Se(u.rageclick)&&Se(h.rageclick)&&(c.rageclick=Ds({},u.rageclick,h.rageclick)),Se(u.session_recording)&&Se(h.session_recording)&&(c.session_recording=Ds({},u.session_recording,h.session_recording)),this.set_config(c),this.config.on_xhr_error&&Rs.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Kf;const d=this.vu();if(this.persistence=new k_(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new k_(le(le({},this.config),{},{persistence:"sessionStorage"}),d,!1),this.bu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&Nl.Et()){const t=Nl.Dt(this.bu);we(t)&&t.forEach(t=>{$e(t)&&this.yu.add(t)})}else Nl.Lt(this.bu);const v=le({},this.persistence.props),f=le({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Iu=new z_(t=>this.Mu(t),this.config.request_queue_config),this.Eu=new W_(this),this.__request_queue=[];const p=this.au();p||(this.sessionManager=new Y_(this),this.sessionPropsManager=new Z_(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.Pu()})),this.Ru(),this.config.__preview_deferred_init_extensions?(Rs.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Au(p)},0)):(Rs.info("Initializing extensions synchronously"),this.Au(p)),ql.DEBUG=ql.DEBUG||this.config.debug,ql.DEBUG&&Rs.info("Starting in debug mode",{this:this,config:i,thisC:le({},this.config),p:v,s:f}),this.config.identity_distinct_id&&!(null===(s=i.bootstrap)||void 0===s?void 0:s.distinctID)&&(i.bootstrap=le(le({},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.cu=!!m&&!Te(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(xt);if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"anonymous"===n)this.identify(t);else if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"identified"===n)Rs.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const e=this.config.get_device_id(ml()),n=i.bootstrap.isIdentifiedID?e:t;this.persistence.set_property(xt,i.bootstrap.isIdentifiedID?Zt:Gt),this.register({distinct_id:t,$device_id:n})}}if(p)this.register_once({distinct_id:Pt,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(ml());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(xt,Gt)}return Us(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Us(t,"pageshow",()=>{var t;this.pu=!1,this.gu||null===(t=this.Eu)||void 0===t||t.resume()}),i.segment?n_(this,()=>this.Fu()):this.Fu(),ke(this.config._onCapture)&&this.config._onCapture!==pw&&(Rs.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Rs.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 tw.apply(this,arguments)}().then(t=>{t&&this.register({[g]:t})}).catch(pw),this}Ou(t){const e=t;return $e(e.name)&&ke(e.setup)}Du(t,e){this.Ou(t)?e.push(()=>{this.Lu().add(t).catch(()=>{var e;return null===(e=t.dispose)||void 0===e?void 0:e.call(t)}).catch(e=>{Rs.error(`Failed to dispose browser extension "${t.name}"`,e)})}):this.Ya.push(t)}Ru(){var t,i,n;const s=null!==(t=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:null===(n=e.__defaultExtensionClasses)||void 0===n?void 0:n.featureFlags;var r,o,l;s&&(this.featureFlags&&this.featureFlags instanceof s||(null===(r=this.Nu)||void 0===r||r.call(this),this.Nu=void 0,this.featureFlags=new s(this)),ke(this.featureFlags.onReloading)&&ke(this.featureFlags.setup)?this.Nu||(this.Nu=this.featureFlags.onReloading(()=>{this.iu.emit("featureFlagsReloading",!0)}),this.Lu().add(this.featureFlags)):null===(o=(l=this.featureFlags).initialize)||void 0===o||o.call(l))}Au(t){const i=performance.now(),n=le(le({},e.__defaultExtensionClasses),this.config.__extensionClasses),s=[];var r,o,l,a,u,h,c;n.exceptions&&this.Ya.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new n.exceptions(this)),n.historyAutocapture&&this.Ya.push(this.historyAutocapture=new n.historyAutocapture(this)),n.tracingHeaders&&this.Ya.push(this.tracingHeaders=new n.tracingHeaders(this)),n.siteApps&&this.Ya.push(this.siteApps=new n.siteApps(this)),n.sessionRecording&&!t&&this.Ya.push(this.sessionRecording=new n.sessionRecording(this)),this.config.disable_scroll_properties||s.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),n.autocapture&&this.Du(this.autocapture=new n.autocapture(this),s),n.surveys&&this.Du(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new n.surveys(this),s),n.logs&&this.Du(this.logs=null!==(l=this.logs)&&void 0!==l?l:new n.logs(this),s),n.metrics&&this.Ya.push(this.metrics=null!==(a=this.metrics)&&void 0!==a?a:new n.metrics(this)),n.conversations&&this.Ya.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new n.conversations(this)),n.productTours&&this.Ya.push(this.productTours=new n.productTours(this)),n.heatmaps&&this.Ya.push(this.heatmaps=new n.heatmaps(this)),n.webVitalsAutocapture&&this.Ya.push(this.webVitalsAutocapture=new n.webVitalsAutocapture(this)),n.exceptionObserver&&this.Ya.push(this.exceptionObserver=new n.exceptionObserver(this)),n.deadClicksAutocapture&&this.Ya.push(this.deadClicksAutocapture=new n.deadClicksAutocapture(this,t_)),n.toolbar&&this.Ya.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new n.toolbar(this)),n.experiments&&this.Ya.push(this.experiments=null!==(c=this.experiments)&&void 0!==c?c:new n.experiments(this)),this.Ya.forEach(t=>{t.initialize&&s.push(()=>{var e;null===(e=t.initialize)||void 0===e||e.call(t)})}),s.push(()=>{if(this.qu){const t=this.qu;this.qu=void 0,this.Ya.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}}),this.ju(s,i)}ju(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout(()=>{this.ju(t,e)},0);const i=t.shift();if(i)try{i()}catch(t){Rs.error("Error initializing extension:",t)}}const i=Math.round(performance.now()-e);this.register_for_session({[At]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ft]:i}),this.config.__preview_deferred_init_extensions&&Rs.info(`PostHog extensions initialized (${i}ms)`)}Wl(t){var e;if(!n||!n.body)return Rs.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Wl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.qu=t),this.eu=t,this.compression=void 0,t.ok){var i;const e=t.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=fe(e.supportedCompression,Kf)?Kf:fe(e.supportedCompression,Yf)?Yf:void 0),(null===(i=e.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=e.analytics.endpoint)}this.set_config({person_profiles:this.Su?this.Su:Qt}),null===(e=this.Bu)||void 0===e||e.handleRemoteConfig(t),this.Ya.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}Fu(){try{this.config.loaded(this)}catch(t){Rs.critical("`loaded` function failed",t)}if(this.Hu(),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.au())&&this.zu()},1),this.Uu=new $_(this),this.Uu.load()}Hu(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.Iu)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Fs(this.__request_queue,t=>this.Mu(t)),this.__request_queue=[],this.Hu()}_handle_unload(){var t,e,i,n,s,r;this.pu=!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.Wu()&&this.capture(Xt),null===(n=this.logs)||void 0===n||n.flushLogs("sendBeacon"),null===(s=this.Iu)||void 0===s||s.unload(),null===(r=this.Eu)||void 0===r||r.unload()):this.Wu()&&this.capture(Xt,null,{transport:"sendBeacon"})}_send_request(t){var e,i,n;this.__loaded?xw?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=le(le({},this.config.request_headers),t.headers),t.compression="best-available"===t.compression?null!==(e=this.compression)&&void 0!==e?e:t.compressionFallback:t.compression,(Ce(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,i,n;const s=le({},t);s.timeout=s.timeout||6e4;const r=null!==(e=s.transport)&&void 0!==e?e:"fetch";"sendBeacon"===r&&Ce(s.compression)&&s.data&&(s.compression=Yf),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data=(t=>{var e,i;const n=(we(t)?t:[t]).map(t=>le(le({},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()}})(s.data):"body"===s.timestampMode&&(s.data=((t,e=(new Date).toISOString())=>we(t)?t.map(t=>le(le({},t),{},{sent_at:e})):le(le({},t),{},{sent_at:e}))(s.data))),s.url=B_(s.url,s.method,s.compression,s.timestampMode);const o=H_.filter(t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport)),l=null!==(i=null===(n=function(t,e){for(let i=0;t.length>i;i++)if(e(t[i]))return t[i]}(o,t=>t.transport===r))||void 0===n?void 0:n.method)&&void 0!==i?i:o[0].method;if(!l)throw new Error("No available transport method");const u=t=>{try{l(t)}catch(t){var e;L_(t)?Rs.warn(t):Rs.error(t),null===(e=s.callback)||void 0===e||e.call(s,{statusCode:0,error:t})}};"sendBeacon"!==r&&s.data&&s.compression===Kf&&a&&"undefined"!=typeof Promise&&!M_?O_(s).then(t=>{u(t)}).catch(e=>{if(es(e))return M_=!0,void u(le(le({},s),{},{compression:void 0,url:B_(t.url,t.method,void 0,t.timestampMode)}));is(e)&&(M_=!0),u(s)}):l(s)})(le(le({},t),{},{callback:e=>{var i,n,s;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null===(n=(s=this.config).on_request_error)||void 0===n||n.call(s,e),null===(i=t.callback)||void 0===i||i.call(t,e)}}))):t.fireCallbackOnDrop&&(null===(n=t.callback)||void 0===n||n.call(t,{statusCode:0}))}Mu(t){this.Eu?this.Eu.retriableRequest(t):this._send_request(t)}_execute_array(t){fw++;try{let e;const i=[],n=[],s=[];Fs(t,t=>{if(t)if(e=t[0],we(e))s.push(t);else if(ke(t))try{t.call(this)}catch(e){Rs.error("Error executing queued PostHog call",t,e)}else we(t)&&"alias"===e?i.push(t):we(t)&&-1!==e.indexOf("capture")&&ke(this[e])?s.push(t):n.push(t)});const r=function(t,e){Fs(t,function(t){try{if(we(t[0])){let i=e;Os(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){Rs.error("Error executing queued PostHog call",t,e)}})};r(i,this),r(n,this),r(s,this)}finally{fw--}}push(t){if(fw>0&&we(t)&&$e(t[0])){const i=e.prototype[t[0]];return void(ke(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}Vu(){var t;const e=null===(t=this.persistence)||void 0===t?void 0:t.get_property(_);return $e(e)&&ww.test(e)?{value:e,delivered:!1}:Se(e)&&$e(e.value)&&ww.test(e.value)?{value:e.value,delivered:!0===e.delivered}:void 0}Gu(t,e,i,n){if(!this.persistence)return;this.persistence.refreshKey(_);const s=this.Vu();if(!n){if(i)return $e(e)&&ww.test(e)?(e!==(null==s?void 0:s.value)&&this.persistence.register({[_]:{value:e,delivered:!1}}),{value:e,pending:e!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(_);if($e(t)&&_w.test(t)){if((null==s?void 0:s.value.split(".")[3])===t)return{value:s.value,pending:!s.delivered};const e=`fb.1.${Date.now()}.${t}`;return this.persistence.register({[_]:{value:e,delivered:!1}}),{value:e,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(_)}Zu(t){if(!this.persistence)return;this.persistence.refreshKey(_);const e=this.Vu();(null==e?void 0:e.value)!==t||e.delivered||this.persistence.register({[_]:{value:t,delivered:!0}})}capture(t,e,i){var n,s,r,o,l;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Iu))return void Rs.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Ce(t)||!$e(t))return void Rs.error("No event name provided to posthog.capture");this.du();const a=!this.config.opt_out_useragent_filter&&this._is_bot();if(a&&!this.config.__preview_capture_bot_pageviews)return;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 Rs.critical("This capture call is ignored due to client rate limiting.");let h;(null==e?void 0:e.$current_url)&&!$e(null==e?void 0:e.$current_url)&&(Rs.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.Qu)||Rs.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(h=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 c=new Date,d=(null==i?void 0:i.timestamp)||c,v=en(null==i?void 0:i.uuid,ml);let f={uuid:v,event:t,properties:this.calculateEventProperties(t,e||{},d,v)};"$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 p="$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)&&!p&&(f.$set=null==i?void 0:i.$set);const g=Se(null==e?void 0:e.$set)?e.$set:void 0,m=!!(null==i?void 0:i.$set)&&"$fbc"in i.$set,y=m||!!g&&"$fbc"in g,_=m?null==i||null===(n=i.$set)||void 0===n?void 0:n[b]:null==g?void 0:g[b],w=we(null==e?void 0:e.$unset)?e.$unset:[],k=(null==i?void 0:i.$unset)||[],S=-1!==w.indexOf("$fbc")||-1!==k.indexOf("$fbc"),x=this.Gu(null==h?void 0:h.fbclid,_,y,S);x&&!0===f.properties.$process_person_profile&&x.pending&&!y&&!p&&(f.$set=le({[b]:x.value},f.$set));const C=null==i?void 0:i.$unset;C&&(f.$unset=C);const T=p?void 0:this.Ju(null==i?void 0:i.$set_once,t!==ee,t===te);if(T&&(f.$set_once=T),(null==i?void 0:i._noTruncate)||(I=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),we(n))r=[],Fs(n,e=>{r.push(t(e))});else{const e={};Os(Ne(n)?Bs(n):n,(n,s)=>{i.has(n)||(e[s]=t(n,s))}),r=e}return r}(t)}(f,t=>$e(t)?t.slice(0,I):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=c),p&&(f.properties=((t,e=[])=>{const i={},n=e=>{void 0!==t[e]&&(i[e]=t[e])};return Kn.forEach(n),e.forEach(n),i})(f.properties,kw)),t===gp||t===mp){const i=null==e?void 0:e[yp],n=null==e?void 0:e[_p];Dp({id:i,current_iteration:n}),f.$set=le(le({},f.$set),{},{[Vl({id:i,current_iteration:n},t===mp?"responded":"dismissed")]:!0})}else t===pp&&(f.$set=le(le({},f.$set),{},{[Cp]:(new Date).toISOString()}));var I;if("product tour shown"===t){const t=null==e?void 0:e.$product_tour_type;t&&(f.$set=le(le({},f.$set),{},{[`$product_tour_last_seen_date/${t}`]:(new Date).toISOString()}))}const M=le(le({},f.properties.$set),f.$set);if(xe(M)||this.setPersonPropertiesForFlags(M),!Me(this.config.before_send)){const t=this.$s(f);if(!t)return;f=t,f.uuid=en(f.uuid,ml)}const E=null!==(s=null===(r=f.$set)||void 0===r?void 0:r.$fbc)&&void 0!==s?s:Se(null===(o=f.properties)||void 0===o?void 0:o.$set)?f.properties.$set[b]:void 0,P=(null==x?void 0:x.pending)&&E===x.value?x.value:void 0;this.iu.emit("eventCaptured",f);const R=null!==(l=null==i?void 0:i._url)&&void 0!==l?l:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),A=le(le({method:"POST",url:R,data:f,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(R)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},(null==i?void 0:i.transport)?{transport:i.transport}:{}),P?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.Zu(P)}}:{});var F;return!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)||P?(!A.transport&&!A.callback&&xe(null!==(F=this.config.request_headers)&&void 0!==F?F:{})&&this.pu&&(A.transport="sendBeacon"),this.Mu(A)):this.Iu.enqueue(A),f}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null===(e=this.Bu)||void 0===e?void 0:e.getExtension(t)}Lu(){var t;return null!==(t=this.Bu)&&void 0!==t?t:this.Bu=new dw(this)}su(t){this._u.push(t);let e=!0;return()=>{if(!e)return;e=!1;const i=this._u.indexOf(t);-1!==i&&this._u.splice(i,1)}}Ku(t=!0){var e,i,n;return!!(null===(e=this.persistence)||void 0===e?void 0:e.consumeCookieIdentityChange())&&(this.xu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(n=this.sessionPersistence)||void 0===n||n.clear(),this.yu.clear(),this.Yu()),null===(i=this.featureFlags)||void 0===i||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,r,o,l){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.Ku();const a=l?void 0:this.persistence.remove_event_timer(e);let h=le({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.au()&&(h[Rt]=!0),"$snapshot"===e){const t=le(le({},this.persistence.properties()),this.sessionPersistence.properties());return h.distinct_id=t.distinct_id,(!$e(h.distinct_id)&&!Ee(h.distinct_id)||Te(h.distinct_id))&&Rs.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}const c=function(e,i,n,r=!1){var o,l,a,h;if(!u)return{};const c=e?[...da,...i||[]]:[],[d,v]=Vi(u),[f,p]=function(t){for(let e=0;Ji.length>e;e++){const[i,n,s]=Ji[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===(h=t.screen)||void 0===h?void 0:h.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=Ds(js({$os:d,$os_version:v,$browser:Hi(u,navigator.vendor,g,m),$webview_app:f,$webview_app_version:p,$device:Gi(u),$device_type:Zi(u,y),$timezone:Ca(),$timezone_offset:$a()}),{$current_url:Ks(r?sn(null==s?void 0:s.href):null==s?void 0:s.href,c,fa),$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:Ui(u,navigator.vendor,g,m),$browser_language:ba(),$browser_language_prefix:_a(),$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:Es.LIB_NAME,$lib_version:Es.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Es.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=Es.SDK_DIST_CHANNEL),x}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:t,windowId:e}=this.sessionManager.checkAndGetSessionAndWindowId(l,r.getTime(),!0);h.$session_id=t,h.$window_id=e}this.sessionPropsManager&&Ds(h,this.sessionPropsManager.getSessionProps());try{var d;this.sessionRecording&&Ds(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null===(d=this.Eu)||void 0===d?void 0:d.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}let v;if(this.requestRouter.region===ew&&(h.$lib_custom_api_host=this.config.api_host),v="$pageview"!==e||l?"$pageleave"!==e||l?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),h=Ds(h,v),"$pageview"===e&&n&&(h.title=n.title),!Ce(a)){const t=r.getTime()-a;h.$duration=parseFloat((t/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");const f=this.persistence.properties(),p=this.sessionPersistence.properties(),g=h.$groups,m=f.$groups;Se(g)&&!xe(g)&&(h.$groups=le(le({},Se(m)?m:{}),g)),Os(["$referrer","$referring_domain"],t=>{t in f&&delete p[t]});const y={};if(this._u.length>0)for(const t of this._u.slice())try{Ds(y,t())}catch(t){Rs.error("Failed to produce browser extension event properties",t)}h=Ds({},c,f,p,le(le({},y),h)),h.$is_identified=this._isIdentified(),we(this.config.property_denylist)?Os(this.config.property_denylist,function(t){delete h[t]}):Rs.error(bw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const b=this.config.sanitize_properties;b&&(Rs.error(yw),h=b(h,e));const _=this.Xu();return h.$process_person_profile=_,_&&!l&&this.th("_calculate_event_properties"),h}Ju(t,e=!0,i=!1){var n;if(!this.persistence||!this.Xu())return t;if(this.mu&&!i)return t;const s=this.persistence.get_initial_props(),r=null===(n=this.sessionPropsManager)||void 0===n?void 0:n.getSetOnceProps();let o=Ds({},s,r||{},t||{});const l=this.config.sanitize_properties;return l&&(Rs.error(yw),o=l(o,"$set_once")),e&&(this.mu=!0),xe(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.Ku(),null===(i=this.sessionPersistence)||void 0===i||i.register(t),Object.keys(t).forEach(t=>this.yu.add(t)),this.Yu()}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.yu.delete(t),this.Yu()}eh(t,e){this.register({[t]:e})}Pu(){this.yu.forEach(t=>{var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t)}),this.yu.clear(),this.Yu()}Yu(){var t;if(!this.bu)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.pi)||!Nl.Et())return void Nl.Lt(this.bu);const e=[];this.yu.forEach(t=>e.push(t)),e.length>0?Nl.At(this.bu,e):Nl.Lt(this.bu)}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.iu.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:mw}),()=>{})}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:mw})}getActiveMatchingSurveys(t,e=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:mw})}renderSurvey(t,e){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(t,e)}displaySurvey(t,e=Np){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:mw}}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:mw})}ih(t){return!t||Te(t)?(Rs.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Rs.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())||(Rs.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 Rs.uninitializedWarning("posthog.identify");if(Ee(t)&&(t=t.toString(),Rs.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.ih(t))return;if(!this.th("posthog.identify"))return;this.du();const n=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,r=this.Ku(!1),o=this.persistence.Cl();let l=!1;try{const n=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:n},""),t!==n&&t!==this.get_property("__alias")&&(this.unregister(m),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Gt,u=t!==n,h=!u&&o;if(u&&o){var a;const s=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:n};this.persistence.set_property(xt,Zt),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.$l(),this.capture(te,s,{$set:e||{},$set_once:i||{}}),this.xu=sa(t,e,i),null===(a=this.featureFlags)||void 0===a||a.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:n)}else if(h){this.persistence.set_property(xt,Zt);const n=e||{},s=i||{};this.setPersonPropertiesForFlags({$set:n,$set_once:s},!1),this.config.cookieWinsOnConflict&&this.persistence.$l(),this.capture("$set",{$set:n,$set_once:s}),this.xu=sa(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);u||s||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(_t)):h&&(e||i)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Ml(l)}}setPersonProperties(t,e){if(!t&&!e)return;if(!this.th("posthog.setPersonProperties"))return;const i=sa(this.get_distinct_id(),t,e);this.xu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.xu=i):Rs.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var e;const i=(we(t)?t:[t]).filter(t=>$e(t)&&t.length>0);0!==i.length&&this.th("posthog.unsetPersonProperties")&&(null===(e=this.featureFlags)||void 0===e||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.xu=null)}group(t,e,i){var n;if(!t||!e)return void Rs.error("posthog.group requires a group type and group key");null===(n=this.persistence)||void 0===n||n.syncCookieProperties(),this.Ku();const s=this.getGroups(),r=s[t]!==e;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:le(le({},s),{},{[t]:e})}),(r||i)&&this.Xu()){const n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(ee,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.th("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=Re(t)?t:null==t?void 0:t.resetDeviceID,i=Re(t)||null==t?void 0:t.bootstrap;this.nh(e,!1,i)}nh(t,e=!1,i){var n,s,r,o,l,a;if(Rs.info("reset"),!this.__loaded)return Rs.uninitializedWarning("posthog.reset");const u=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(n=this.$u)||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.Vl());const h=this.get_property(p),c=this.get_property(g),d=this.get_property(A);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();this.consent.reset(),e||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const f=null===(l=this.persistence)||void 0===l||null===(a=l.Cl)||void 0===a?void 0:a.call(l);let m=!1;try{var y,b,_,w,k,S,x,C,T,I,M,E,P;if(null===(y=this.persistence)||void 0===y||y.clear(),null===(b=this.sessionPersistence)||void 0===b||b.clear(),this.yu.clear(),this.Yu(),Ce(d)||null===(I=this.persistence)||void 0===I||I.register({$session_recording_remote_config:d}),null===(_=this.surveys)||void 0===_||_.reset(),null===(w=this.featureFlags)||void 0===w||w.reset(),null===(k=this.conversations)||void 0===k||k.reset(),null===(S=this.logs)||void 0===S||S.reset(),null===(x=this.metrics)||void 0===x||x.reset(),null===(C=this.persistence)||void 0===C||C.set_property("$user_state","anonymous"),null===(T=this.sessionManager)||void 0===T||T.resetSessionId(),this.xu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Pt,$device_id:null},"");else{const e=this.config.get_device_id(ml());this.register_once({distinct_id:e,$device_id:t?e:h},""),t||Ce(c)||this.register({[g]:c})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(i.distinctID&&!this.au()&&(null===(P=this.persistence)||void 0===P||P.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(M=this.featureFlags)||void 0===M||M.initialize(),!Me(u)&&!(null===(E=this.sessionManager)||void 0===E?void 0:E.setBootstrapSessionId(u,!0))){const t=le({},i);delete t.sessionID,this.config.bootstrap=t}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,m=!0}finally{var R,F;f&&(null===(R=this.persistence)||void 0===R||null===(F=R.Ml)||void 0===F||F.call(R,m))}this.reloadFeatureFlags()}shutdown(t){var e=this;return ne(function*(){var t,i,n,s,r,o,l;if(e.__loaded){e.gu=!0,e.Lu().dispose(),null===(t=e.sessionRecording)||void 0===t||t.dispose(),null===(i=e.logs)||void 0===i||i.flushLogs("sendBeacon"),null===(n=e.metrics)||void 0===n||n.flush("sendBeacon"),null===(s=e.Iu)||void 0===s||s.unload(),null===(r=e.Eu)||void 0===r||r.unload();try{var a;null===(a=e.featureFlags)||void 0===a||a.destroy()}catch(t){Rs.error("Error while destroying feature flags",t)}null===(o=e.persistence)||void 0===o||o.destroy(),null===(l=e.sessionPersistence)||void 0===l||l.destroy()}else Rs.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,e){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null===(i=this.conversations)||void 0===i||i.sh()}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.rh()}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")?(Rs.critical("Attempting to create alias for existing People user - aborting."),-2):this.th("posthog.alias")?(Ce(e)&&(e=this.get_distinct_id()),t!==e?(this.eh(m,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Rs.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const e=le({},this.config);if(Se(t)){var i,n,s,r,o,l,a,u,h,c,d,v,f;Ds(this.config,Iw(t));const g=this.vu();null===(i=this.persistence)||void 0===i||i.update_config(this.config,e,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new k_(le(le({},this.config),{},{persistence:"sessionStorage"}),g,!1);const m=this.Cu(this.config.debug);var p;Re(m)&&(this.config.debug=m),Re(this.config.debug)&&(this.config.debug?(ql.DEBUG=!0,xl.Et()&&xl.At("ph_debug",!0),Rs.info("set_config",{config:t,oldConfig:e,newConfig:le({},this.config)})):(ql.DEBUG=!1,xl.Et()&&xl.Lt("ph_debug"))),null===(n=this.featureFlags)||void 0===n||null===(s=n.updateConfig)||void 0===s||s.call(n,this.config,this.Vl()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(l=this.sessionRecording)||void 0===l||l.startIfEnabledOrStop(),null===(a=this.tracingHeaders)||void 0===a||a.startIfEnabledOrStop(),null===(u=this.autocapture)||void 0===u||u.startIfEnabled(),null===(h=this.heatmaps)||void 0===h||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(p=this.historyAutocapture)||void 0===p||p.startIfEnabledOrStop()),null===(c=this.exceptionObserver)||void 0===c||c.startIfEnabledOrStop(),null===(d=this.deadClicksAutocapture)||void 0===d||d.startIfEnabledOrStop(),null===(v=this.surveys)||void 0===v||v.loadIfEnabled(),this.fu(),null===(f=this.externalIntegrations)||void 0===f||f.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&n_(this,pw,!1)}}_overrideSDKInfo(t,e){ql.LIB_NAME=t,ql.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(le(le({},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.oh}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:Sw;return e!==Sw&&(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"))}Xu(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&xe(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))}Wu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.Xu()||this.th("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.th("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}th(t){return"never"===this.config.person_profiles?(Rs.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.uu(),this.eh(Et,!0),!0)}vu(){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)}fu(){var t,e;const i=this.vu();var n,s,r;return this.is_capturing()||null===(n=this.logs)||void 0===n||n.ah(),(null===(t=this.persistence)||void 0===t?void 0:t.pi)!==i&&(null===(s=this.persistence)||void 0===s||s.set_disabled(i)),(null===(e=this.sessionPersistence)||void 0===e?void 0:e.pi)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),i&&(this.yu.clear(),this.Yu()),i}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){if(this.au()){var n,s,r,o,l,a;null===(n=this.sessionRecording)||void 0===n||n.dispose({discardBufferedEvents:!0}),this.nh(!0,!0),null===(s=this.sessionManager)||void 0===s||s.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new Y_(this),this.pageViewManager=new l_(this),this.persistence&&(this.sessionPropsManager=new Z_(this,this.sessionManager,this.persistence));const t=null!==(o=null===(l=this.config.__extensionClasses)||void 0===l?void 0:l.sessionRecording)&&void 0!==o?o:null===(a=e.__defaultExtensionClasses)||void 0===a?void 0:a.sessionRecording;var u,h;t&&(this.sessionRecording=this.lu(this.sessionRecording,new t(this)),this.eu&&(null===(u=this.sessionRecording)||void 0===u||null===(h=u.onRemoteConfig)||void 0===h||h.call(u,this.eu)))}var c,d;this.consent.optInOut(!0),this.fu(),this.Hu(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(c=this.surveys)||void 0===c||c.loadIfEnabled()),(Ce(null==t?void 0:t.captureEventName)||(null==t?void 0:t.captureEventName))&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.zu()}else Rs.warn(gw)}opt_out_capturing(){if("always"===this.config.cookieless_mode)return void Rs.warn(gw);const t="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;var e,i;null==t||t.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.nh(!0,!0),this.consent.optInOut(!1),this.fu(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Pt,$device_id:null}),this.ou(t),this.sessionRecording=void 0,null===(e=this.sessionManager)||void 0===e||e.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.zu(),this.Hu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.fu()}_is_bot(){return i?X_(i,this.config.custom_blocked_useragents):void 0}zu(){n&&("visible"===n.visibilityState?this.wu||(this.wu=!0,this.capture(Yt,{title:n.title},{send_instantly:!0}),this.ku&&(n.removeEventListener(Jt,this.ku),this.ku=null)):this.ku||(this.ku=this.zu.bind(this),Us(n,Jt,this.ku)))}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}))}Vl(){const t=this.$u||{};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?(Rs.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&&!Me(t[e]),o=i in t&&!Me(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,Rs)}$s(t){var e;if(Me(this.config.before_send))return t;const i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(Oe),n=we(this.config.before_send)?this.config.before_send:[this.config.before_send];let s=t;for(const e of n)try{if(s=e(s),Me(s)){const e=`Event '${t.event}' was rejected in beforeSend function`;return Fe(t.event)?Rs.warn(`${e}. This can cause unexpected behavior.`):Rs.info(e),null}s.properties&&!xe(s.properties)||Rs.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(e){return Rs.error(`Error in beforeSend function for event '${t.event}':`,e),null}for(const e of i)if(s.properties&&Me(s.properties[e]))return Rs.warn(`Event '${t.event}' had its '${e}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return s}getPageViewId(){var t;return null===(t=this.pageViewManager.Oo)||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)})}Cu(t){const e=Re(t)&&!t,i=xl.Et()&&"true"===xl.Ot("ph_debug");return!e&&(!!i||t)}};Ew.__defaultExtensionClasses={},Ew.oh=(()=>{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]]=qs(t.prototype[e[i]])}(Ew,["identify"]);var Pw=class{constructor(t){this._instance=t}refresh(t){const e=this._instance.config,i=Se(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.Vl(),t.url_allowlist=null==i?void 0:i.url_allowlist,t.url_ignorelist=null==i?void 0:i.url_ignorelist,t.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,t.element_allowlist=null==i?void 0:i.element_allowlist,t.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,t.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,t.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,t.capture_copied_text=null==i?void 0:i.capture_copied_text}};const Rw=As("[ExceptionAutocapture]"),Aw=As("[TracingHeaders]"),Fw=As("[Web Vitals]"),Ow=9e5,Dw=["CLS","FCP","INP","LCP"],Lw=["INP","LCP"],Nw=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],qw=As("[SessionRecording]"),jw=As("[Heatmaps]");function Bw(t){return Se(t)&&"clientX"in t&&"clientY"in t&&Ee(t.clientX)&&Ee(t.clientY)}const Hw=As("[Product Tours]"),zw=t=>{var e;return!t.config.disable_product_tours&&!!(null===(e=t.persistence)||void 0===e?void 0:e.get_property(E))},Uw=["$set_once","$set"],Ww=As("[SiteApps]"),Vw="Error while initializing PostHog app with config id ",Gw=(t,e)=>(null==t?void 0:t.then)?t.then(e):e(t),Zw="SDK is not enabled or survey functionality is not yet loaded",Qw="Disabled. Not loading surveys.";var Jw=class{constructor(t,e){this.co=t,this.uh=e,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.hh=!1,this.dh=[],this.fh=null,this.ph=null,this.mo=!1,this.gh=new Set,this.onRemoteConfig=t=>{if(this.mo)return;if(this.Mr.disableSurveys)return;if(!t.ok)return Mp.warn("Remote config unavailable. Not loading surveys.");const e=t.config.surveys;if(Me(e))return Mp.warn("Flags not loaded yet. Not loading surveys.");this.mh=Re(e)?e:e.length>0,Mp.info(`flags response received, isSurveysEnabled: ${this.mh}`),this.loadIfEnabled()}}setup(t){if(!this.mo)return this.yh=t,Gw(t.kv.initialize(),()=>{if(this.yh!==t||this.mo)return;this.yh=void 0,this.uo=t;const e=t.onRemoteConfig(this.onRemoteConfig);this.mo?e.dispose():(this._o=e,this.loadIfEnabled())})}dispose(){var t,e,i,n;this.mo||(this.mo=!0,this.yh=void 0,this.uo=void 0,null===(t=this._o)||void 0===t||t.dispose(),this._o=void 0,null===(e=this._surveyEventReceiver)||void 0===e||e.dispose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(n=i.dispose)||void 0===n||n.call(i),this._surveyManager=null,this.dh=[],this.fh=null,this.gh.forEach(t=>clearTimeout(t)),this.gh.clear())}get Mr(){return this.co.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null===(t=this._surveyEventReceiver)||void 0===t||t.reset(),localStorage.removeItem("lastSeenSurveyDate");const e=[];for(let t=0;t<localStorage.length;t++){const i=localStorage.key(t);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&e.push(i)}e.forEach(t=>localStorage.removeItem(t))}catch(t){}}loadIfEnabled(){if(this.mo||!this.uo)return;const t=this.Mr;if(this._surveyManager)return;if(this.hh)return void Mp.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Mp.info(Qw);if(t.cookielessMode&&this.co.isOptedOut())return void Mp.info("Not loading surveys in cookieless mode without consent.");const e=this.co.getExtensions();if(!e)return void Mp.error("PostHog Extensions not found.");if(Ce(this.mh)&&!t.advancedEnableSurveys)return;const i=this.mh||t.advancedEnableSurveys;this.hh=!0;try{const t=e.generateSurveys;if(t)return this.bh(t,i),void(this.hh=!1);const n=e.loadExternalDependency;if(!n)return this._h(Vt),void(this.hh=!1);n(t=>{try{if(this.mo)return;const e=this.co.getExtensions();t||!(null==e?void 0:e.generateSurveys)?this._h("Could not load surveys script",t):this.bh(e.generateSurveys,i)}finally{this.hh=!1}})}catch(t){throw this.hh=!1,this._h("Error initializing surveys",t),t}}bh(t,e){this.mo||(this._surveyManager=t(e),this._surveyEventReceiver=this.co.createEventReceiver(),Mp.info("Surveys loaded successfully"),this.wh({isLoaded:!0}))}_h(t,e){Mp.error(t,e),this.wh({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.dh.push(t),this._surveyManager&&this.wh({isLoaded:!0}),()=>{this.dh=this.dh.filter(e=>e!==t)}}getSurveys(t,e=!1){var i;const n=null!==(i=this.uo)&&void 0!==i?i:this.uh;if(!n||this.mo)return;if(this.Mr.disableSurveys)return Mp.info(Qw),t([]);const s=n.kv.get(at);if(s&&!e)return t(s,{isLoaded:!0}),void(this.kh()&&this.getSurveys(()=>{},!0));if(this.fh)return void this.fh.then(({surveys:e,context:i})=>{this.mo||t(e,i)}).catch(t=>Mp.error("Error in survey callback",t));const r=this.Sh("/api/surveys/",{method:"GET",query:{token:n.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(t=>{try{return this.xh(n,t)}catch(t){return Mp.error("Error processing surveys response",t),this.xh(n,{statusCode:0,error:t})}},t=>this.xh(n,{statusCode:0,error:t}));this.fh=r;const o=()=>{this.fh===r&&(this.fh=null)};r.then(e=>{o(),this.mo||t(e.surveys,e.context)},o).catch(t=>Mp.error("Error in survey callback",t))}Sh(t,e){const i=this.uo;return i?i.sendRequest(t,e):new Promise(t=>t({statusCode:0,error:new Error(Zw)}))}xh(t,e){if(this.mo)return{surveys:[],context:{isLoaded:!1,error:Zw}};const i=e.statusCode;if(200!==i||!e.json){const t=`Surveys API could not be loaded, status: ${i}`;return 0!==i?Mp.error(t):e.error||Mp.warn(t),this.ph=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.ph=null;const n=e.json.surveys||[],s=n.filter(t=>Rp(t)&&(Yl(t)||Ap(t)));var r;return s.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(s)),t.kv.set({[at]:n,[ut]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}kh(){return this.Ch()&&!this.fh&&!this.$h()}Ch(){var t,e;const i=null===(t=null!==(e=this.uo)&&void 0!==e?e:this.uh)||void 0===t?void 0:t.kv.get(ut);return Ee(i)&&Date.now()-i>3e5}$h(){return Ee(this.ph)&&3e5>Date.now()-this.ph}markSurveyAsSeen(t,e){var i;const n={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};Dp(n);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}wh(t){for(const e of this.dh)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Mp.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e=!1){if(!Me(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Mp.warn("init was not called")}Th(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}Ih(t){if(Me(this._surveyManager))return{eligible:!1,reason:Zw};const e="string"==typeof t?this.Th(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Mh(t){if(!this.co.isCapturing())return{eligible:!1,reason:Ep};if(Me(this._surveyManager))return{eligible:!1,reason:Zw};const e="string"==typeof t?this.Th(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Me(this._surveyManager))return Mp.warn("init was not called"),{visible:!1,disabledReason:Zw};const e=this.Mh(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Me(this._surveyManager)?(Mp.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Zw})):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.Mh(s);i({visible:t.eligible,disabledReason:t.reason})}else i({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,i){var s;if(!this.co.isCapturing())return;if(Me(this._surveyManager))return void Mp.warn("init was not called");const r="string"==typeof t?this.Th(t):t;if(!(null==r?void 0:r.id))return void Mp.warn("Survey not found");if(!Lp.includes(r.type))return void Mp.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const o=null==n?void 0:n.querySelector(e);if(o){if(null===(s=r.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds){Mp.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var e,n;this.gh.delete(t),!this.mo&&this.co.isCapturing()&&(Mp.info(`Rendering survey ${r.id} with delay of ${null===(e=r.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds} seconds`),null===(n=this._surveyManager)||void 0===n||n.renderSurvey(r,o,i),Mp.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.gh.add(t)}this._surveyManager.renderSurvey(r,o,i)}else Mp.warn("Survey element not found")}displaySurvey(t,e){var i;if(!this.co.isCapturing())return;if(Me(this._surveyManager))return void Mp.warn("init was not called");const n=this.Th(t);if(!n)return void Mp.warn("Survey not found");let s=n;if((null===(i=n.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)&&e.ignoreDelay&&(s=le(le({},n),{},{appearance:le(le({},n.appearance),{},{surveyPopupDelaySeconds:0})})),e.displayType!==Tp&&e.initialResponses&&Mp.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){const t=this.Ih(n);if(!t.eligible)return void Mp.warn("Survey is not eligible to be displayed: ",t.reason)}"inline"!==e.displayType?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}cancelPendingSurvey(t){Me(this._surveyManager)?Mp.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t,e;null===(t=this._surveyManager)||void 0===t||null===(e=t.handlePageUnload)||void 0===e||e.call(t)}};function Kw(t,e,i){if(Me(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 Yw=class{constructor(t){this._instance=t,this.Eh=new Set,this.Ph=new Set,this.Rh=new Q_,this.Ah=(t,e)=>this.Fh(t,e)&&this.Oh(t,e)&&this.Dh(t,e)&&this.Lh(t,e),this.Fh=(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._instance)||void 0===t?void 0:t._addCaptureHook)||(this.Nh=null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook((t,e)=>{this.on(t,e)}))}dispose(){var t;null===(t=this.Nh)||void 0===t||t.call(this),this.Nh=void 0,this.Rh=new Q_}register(t){var e,i;if(!Ce(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)&&(t.forEach(t=>{var e;this.Eh.add(t),null===(e=t.steps)||void 0===e||e.forEach(t=>{this.Ph.add((null==t?void 0:t.event)||"")})}),null===(i=this._instance)||void 0===i?void 0:i.autocapture)){const t=new Set;this.Eh.forEach(e=>{var i;null===(i=e.steps)||void 0===i||i.forEach(e=>{(null==e?void 0:e.selector)&&t.add(e.selector)})}),this._instance.autocapture.setElementSelectors(t)}}replace(t){this.Eh.clear(),this.Ph.clear(),this.register(t)}on(t,e){null!=e&&0!=t.length&&(this.Ph.has(t)||this.Ph.has(e.event))&&this.Eh.forEach(t=>{this.qh(e,t)&&this.Rh.emit("actionCaptured",t.name)})}jh(t){this.onAction("actionCaptured",e=>t(e))}qh(t,e){if(null==(null==e?void 0:e.steps))return!1;for(const i of e.steps)if(this.Ah(t,i))return!0;return!1}onAction(t,e){return this.Rh.on(t,e)}Oh(t,e){if(null==e?void 0:e.url){var i;const n=null==t||null===(i=t.properties)||void 0===i?void 0:i.$current_url;if(!n||"string"!=typeof n)return!1;if(!Kw(n,e.url,e.url_matching||"contains"))return!1}return!0}Dh(t,e){return!!this.Bh(t,e)&&!!this.Hh(t,e)&&!!this.zh(t,e)}Bh(t,e){var i;if(!(null==e?void 0:e.href))return!0;const n=this.Uh(t);if(n.length>0)return n.some(t=>Kw(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&&Kw(function(t){const e=t.match(/(?::|")href="(.*?)"/);return e?e[1]:""}(s),e.href,e.href_matching||"exact")}Hh(t,e){var i;if(!(null==e?void 0:e.text))return!0;const n=this.Uh(t);if(n.length>0)return n.some(t=>Kw(t.text,e.text,e.text_matching||"exact")||Kw(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(;!Me(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=>Kw(t,o,l)));var r,o,l}zh(t,e){var i,n;if(!(null==e?void 0:e.selector))return!0;const s=null==t||null===(i=t.properties)||void 0===i?void 0:i.$element_selectors;if(null==s?void 0:s.includes(e.selector))return!0;const r=(null==t||null===(n=t.properties)||void 0===n?void 0:n.$elements_chain)||"";if(e.selector_regex&&r)try{return new RegExp(e.selector_regex).test(r)}catch(t){return!1}return!1}Uh(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}Lh(t,e){return!(null==e?void 0:e.properties)||0===e.properties.length||na(e.properties.reduce((t,e)=>{const i=we(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)}},Xw=class{constructor(t){var e,i;this.Wh=[],this._instance=t,this.Vh=new Map,this.Gh=new Map,this.Zh=new Map,this.Qh=null===(e=this._instance)||void 0===e||null===(i=e.onSessionId)||void 0===i?void 0:i.call(e,t=>this.Jh(t))}Kh(t){return!1}Yh(){return null}Xh(t){}tc(){}ec(t,e){return!!t&&na(t.propertyFilters,null==e?void 0:e.properties)}nc(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}sc(t,e,i){const n=(i===Xf?this.Vh:this.Gh).get(t);let s=[];return this.rc(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.ec(r,e)})}register(t){this.oc(t,!1)}replace(t){this.oc(t,!0)}oc(t,e){var i;Ce(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)||(this.lc(t,e),this.ac(t,e))}ac(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.Zh.clear(),0===i.length)return void(e&&(null===(n=this.uc)||void 0===n||n.replace([])));this.uc||(this.uc=new Yw(this._instance),this.uc.init(),this.uc.jh(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.Zh.get(e.name))&&void 0!==i?i:[];n.includes(t.id)||n.push(t.id),this.Zh.set(e.name,n)}})}),e?this.uc.replace(s):this.uc.register(s)}hc(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)})}lc(t,e){var i,n;const s=t.filter(t=>{var e,i;return(null===(e=t.conditions)||void 0===e?void 0:e.events)&&(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),r=t.filter(t=>{var e,i;return(null===(e=t.conditions)||void 0===e?void 0:e.cancelEvents)&&(null===(i=t.conditions)||void 0===i||null===(i=i.cancelEvents)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),o=this.nc(t,Xf),l=this.nc(t,tp);e?(this.Vh=o,this.Gh=l):(this.hc(this.Vh,o),this.hc(this.Gh,l)),(0!==s.length||0!==r.length)&&(null!==(i=this.Nh)&&void 0!==i||(this.Nh=null===(n=this._instance)||void 0===n?void 0:n._addCaptureHook((t,e)=>{this.onEvent(t,e)})))}onEvent(t,e){var i,n;const s=this.cc(),r=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$survey_id)||(null==e||null===(n=e.properties)||void 0===n?void 0:n.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const e=this.dc(t,r);if("consume"===e)return s.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.vc([r]);if("persist"===e)return s.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.fc(r),void this.gc([r])}if(this.Gh.has(t)){const i=this.sc(t,e,tp);i.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:i.map(t=>t.id)}),this.vc(i.map(t=>t.id)),i.forEach(t=>this.mc(t.id)))}if(!this.Vh.has(t))return;s.info("event name matched",{event:t,eventPayload:e,items:this.Vh.get(t)});const o=this.sc(t,e,Xf);this.yc(o.map(t=>t.id))}onAction(t){this.Zh.has(t)&&this.yc(this.Zh.get(t)||[])}yc(t){var e,i;if(0===t.length)return;const n=!!(null===(e=this._instance)||void 0===e||null===(i=e.get_session_id)||void 0===i?void 0:i.call(e)),s=[];for(const e of t)n&&this.Kh(e)?this.fc(e)&&this.bc(e):s.push(e);s.length>0&&(this.Wh=[...new Set([...this.Wh,...s])]),this.cc().info("updating activated items",{activatedItems:this.getActivatedIds()})}fc(t){this.Wh=this.Wh.filter(e=>e!==t);const e=this._c();return!e.includes(t)&&(this.wc([...e,t]),this.kc(),!0)}vc(t){const e=new Set(t);this.Wh=this.Wh.filter(t=>!e.has(t));const i=this.Sc(),n=i.filter(t=>!e.has(t));n.length!==i.length&&(this.wc(n),0===n.length&&this.xc()),this.gc(t)}Cc(){var t;const e=this.Yh();if(!e)return{};const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[e];return i&&"object"==typeof i?i:{}}bc(t){if(!this.Yh())return;const e=this.Cc();this.Xh(le(le({},e),{},{[t]:Date.now()}))}gc(t){if(!this.Yh())return;const e=this.Cc(),i={};let n=!1;for(const[s,r]of Object.entries(e))t.includes(s)?n=!0:i[s]=r;n&&(xe(i)?this.tc():this.Xh(i))}$c(){this.Yh()&&this.tc()}getActivationTimestamp(t){if(!this._c().includes(t))return;const e=this.Cc()[t];return Ee(e)?e:void 0}Sc(){var t;const e=this.Tc();return(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[e])||[]}_c(){var t,e,i;const n=this.Sc();if(0===n.length)return[];const s=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[this.Ic()],r=null===(e=this._instance)||void 0===e||null===(i=e.get_session_id)||void 0===i?void 0:i.call(e);return r&&s===r?n:[]}kc(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(e=t.get_session_id)||void 0===e?void 0:e.call(t);i&&this.Mc(i)}xc(){this.Ec()}Jh(t){var e;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[this.Ic()];if(i&&i!==t){const t=this.Sc(),e=this.Cc();t.length>0&&(this.wc([]),t.filter(t=>Ee(e[t])).forEach(t=>this.mc(t))),this.xc(),this.$c()}}getActivatedIds(){return[...new Set([...this._c(),...this.Wh])].filter(t=>!this.Pc(t))}dispose(){var t,e,i;null===(t=this.Qh)||void 0===t||t.call(this),this.Qh=void 0,null===(e=this.Nh)||void 0===e||e.call(this),this.Nh=void 0,null===(i=this.uc)||void 0===i||i.dispose(),this.uc=void 0}reset(){this.Wh=[],this.Sc().length>0&&this.wc([]),this.xc(),this.$c()}getEventToItemsMap(){return this.Vh}Rc(){return this.uc}},tk=class extends Xw{constructor(t){super(t)}Tc(){return ht}Ic(){return ct}Yh(){return dt}Xh(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_timestamps:t})}tc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_timestamps")}Kh(t){var e;let i;this.rc(e=>{i=e.find(e=>e.id===t)});const n=null==i||null===(e=i.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds;return Ee(n)&&n>0}Ac(){return pp}rc(t){var e;null===(e=this._instance)||void 0===e||e.getSurveys(t)}mc(t){var e;null===(e=this._instance)||void 0===e||e.cancelPendingSurvey(t)}cc(){return Mp}wc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated:t})}Mc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_session:t})}Ec(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_session")}Pc(){return!1}dc(t,e){let i;return this.rc(t=>{i=t.find(t=>t.id===e)}),!i||Xl(i)?t===pp?"consume":"ignore":t===pp?"persist":t===gp||t===mp?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},ek=class{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);const e={};for(const i of t){const t=this._instance.get_property(i);Ce(t)||(e[i]=t)}return e}set(t,e){this._instance.register("string"==typeof t?{[t]:e}:t)}remove(t){"string"!=typeof t?t.forEach(t=>this._instance.unregister(t)):this._instance.unregister(t)}},ik=class{constructor(t){this._instance=t}get(){const t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const t=null==d?void 0:d.__PosthogExtensions__;if(!t)return;const{generateSurveys:e,loadExternalDependency:i}=t;return{generateSurveys:e?t=>e(this._instance,t):void 0,loadExternalDependency:i?t=>i(this._instance,"surveys",t):void 0}}createEventReceiver(){return new tk(this._instance)}};const nk=(null==t?void 0:t.location)?Ys(t.location.hash,"__posthog")||Ys(location.hash,"state"):null,sk="_postHogToolbarParams",rk=As("[Toolbar]"),ok=As("[FeatureFlags]");var lk=class{constructor(t,e=!1){this.Fc=!1,this.update(t,e)}update(t,e){this.Oc=((t,e)=>{var i,n,s,r,o,l,a;return{bootstrap:{featureFlags:null!==(i=null===(n=t.bootstrap)||void 0===n?void 0:n.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(s=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:void 0},remoteRequestsDisabled:e,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=t.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(l=null!==(a=t.evaluation_contexts)&&void 0!==a?a:t.evaluation_environments)&&void 0!==l?l:[],flagKeys:we(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.Fc||(ok.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Fc=!0),Ce(t.flag_keys)||we(t.flag_keys)||ok.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Oc}};const ak=As("[FeatureFlags]"),uk=As("[FeatureFlags]",{debugEnabled:!0}),hk="\" failed. Feature flags didn't load in time.",ck="connection_error",dk=t=>{const e={};for(let i=0;t.length>i;i++)e[t[i]]=!0;return e},vk=t=>{const e={};for(const[i,n]of Ls(t||{}))n&&(e[i]=n);return e},fk="Refusing to render web experiment since the viewer is a likely bot",pk={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>ta(e,t),not_regex:(t,e)=>!ta(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},gk=As("[Conversations]"),mk="Conversations not available yet.";function yk(t,e){var n,s,r,o,l,a,u;const h=null!==(n=null==t?void 0:t.flushIntervalMs)&&void 0!==n?n:3e3,c=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,d=(null==e?void 0:e.consoleCapture)?void 0:null!==(r=null==t?void 0:t.maxLogsPerInterval)&&void 0!==r?r:1e3,v=Ce(d)?Math.max(c,2048):Math.max(c,d),f=le(le({},function(){let t="",e="";try{const n=null==i?void 0:i.userAgent;n&&([t,e]=Vi(n))}catch(t){}return function(t,e){const i=function(t){if(t)return{}.hasOwnProperty.call(gs,t)?gs[t]:t}(t);return le(le({},i?{"os.name":i}:{}),e?{"os.version":e}:{})}(t,e)}()),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(l=null==f?void 0:f["service.name"])&&void 0!==l?l:null==t?void 0:t.serviceName)&&void 0!==o?o:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(a=null==f?void 0:f["service.version"])&&void 0!==a?a:null==t?void 0:t.serviceVersion,environment:null!==(u=null==f?void 0:f["deployment.environment"])&&void 0!==u?u:null==t?void 0:t.environment,resourceAttributes:f,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:h,maxBufferSize:c,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const bk=["debug","log","warn","error","info"],_k="console",wk="__posthogHandledLogsRequestError",kk=(t,e)=>{const i=t instanceof Error?t:new Error(e);return i[wk]=!0,i},Sk=t=>!!t&&"object"==typeof t&&!0===t[wk],xk={featureFlags:class{constructor(t){this.name="featureFlags",this.Dc=!1,this.featureFlagEventHandlers=[],this.$=ak,this.Lc={},this.Nc={},this.qc=[],this.jc=!1,this.Bc=!1,this.Hc=0,this.zc=!1,this.Uc=!1,this.Wc=!1,this.Vc=!1,this.Gc=0,this.sn=()=>{const t=this.Zc();this.Gc=0,t&&this.reloadFeatureFlags()},this.Qc=()=>{var t;const e=this.Jc;Ce(e)||this.Mr.remoteRequestsDisabled||!n||"hidden"===n.visibilityState||Date.now()-(null!==(t=this.Kc)&&void 0!==t?t:0)<e||(this.reloadFeatureFlags(),this.Yc())},this.an=()=>{"visible"===(null==n?void 0:n.visibilityState)&&this.Qc()},"get"in t?this.co=t:(this._instance=t,this.Xc=new lk(t.config,t.Vl()),this.co=this.Xc)}updateConfig(t,e){var i;null===(i=this.Xc)||void 0===i||i.update(t,e),this.uo&&this.td()}setup(t){return this.yh=t,this.$=t.logger.createLogger("[FeatureFlags]"),Gw(t.kv.initialize(),()=>{this.yh===t&&(this.yh=void 0,this.uo=t,this.ed(t))})}ed(e){var i;if(this.uo===e)return t&&Us(t,"online",this.sn),this.td(),this.nd=e.registerDynamicEventProperties(()=>this.sd()?this.Lc:this.Nc),this.rd=null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.od(),this.ld(),this.ad()}),this.ld(),this.initialize()}td(){const t=this.Mr.refreshIntervalMs,e=!this.Mr.remoteRequestsDisabled&&n&&!Ce(t)&&t>0?t:void 0;e!==this.Jc&&(this.ud(),Ce(e)||(this.Jc=e,this.Yc(),(null==n?void 0:n.addEventListener)&&Us(n,Jt,this.an)))}Yc(){Ce(this.Jc)||(Ce(this.hd)||clearInterval(this.hd),this.Kc=Date.now(),this.hd=setInterval(this.Qc,this.Jc))}ud(){var t;Ce(this.hd)||(clearInterval(this.hd),this.hd=void 0,null==n||null===(t=n.removeEventListener)||void 0===t||t.call(n,"visibilitychange",this.an)),this.Jc=void 0,this.Kc=void 0}destroy(){this.dd()}dispose(){this.dd()}dd(){var e,i;this.ud(),this.Hc++,this.Uc=!1,this.yh=void 0,this.uo&&(this.vd(),null===(e=this.nd)||void 0===e||e.dispose(),this.nd=void 0,null===(i=this.rd)||void 0===i||i.call(this),this.rd=void 0,this.qc=[],null==t||t.removeEventListener("online",this.sn),this.uo=void 0)}get Mr(){return this.co.get()}fd(t){var e;return this.pd&&t in this.pd?this.pd[t]:null===(e=this.uo)||void 0===e?void 0:e.kv.get(t)}od(){return!!this.pd&&(this.pd=void 0,!0)}gd(){var t;return!Ce(null===(t=this.uo)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.od()}At(t){this.md(()=>{var e;return null===(e=this.uo)||void 0===e?void 0:e.kv.set(t)})}yd(t,e,i){var n;if(!(null===(n=this._instance)||void 0===n?void 0:n.persistence)||!t.$enabled_feature_flags)return;const s=this.fd("$enabled_feature_flags")||{},r=t.$enabled_feature_flags||{},o=e.flags||e.featureFlags,l=e.flags?Object.entries(e.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],a=!!e.errorsWhileComputingFlags&&!!e.flags,u=a?l:i&&!we(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(r)])),h=this.fd("$feature_flag_payloads")||{},c=t.$feature_flag_payloads||{},d=a||i?u:Array.from(new Set([...Object.keys(h),...Object.keys(c)])),v=!a&&!i,f=!!v||u,p=!!v||d,g={[K]:f,[J]:f,[tt]:p};t.$feature_flag_details&&(g[X]=f);for(const e of[et,St,it])Ce(t[e])||(g[e]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(g)}Lt(t){this.md(()=>{var e;return null===(e=this.uo)||void 0===e?void 0:e.kv.remove(t)})}md(t){try{t()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}ld(){const t={};for(const e of[K,tt,et,nt]){const i=this.fd(e);Ce(i)||(t[e]=i)}this.Lc=t;const e=le({},t),i=this.fd(J);if(i)for(const[t,n]of Object.entries(i))e[`$feature/${t}`]=n;this.Nc=e}sd(){const t=this.Mr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.fd(St);return"number"!=typeof e||Date.now()-e>t}bd(){return!!this.sd()&&(this.Vc||this.Bc||(this.Vc=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_d(){const t=this.Mr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),e}):[]}wd(){const t=this.Mr.flagKeys;if(!Ce(t))return t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),e})}initialize(){var t,e;const i=this.Mr,n=null!==(t=null===(e=i.bootstrap)||void 0===e?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(n).length){var s,r;const t=null!==(s=null===(r=i.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:{},e=Object.keys(n).filter(t=>!Ce(n[t])).reduce((t,e)=>(t[e]=n[e],t),{}),o=Object.keys(t).filter(t=>e[t]).reduce((e,i)=>(e[i]=t[i],e),{});return this.kd({featureFlags:e,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,e,i){var n,s;const r=(null==i?void 0:i.merge)&&null!==(n=this.fd("$enabled_feature_flags"))&&void 0!==n?n:{},o=(null==i?void 0:i.merge)&&null!==(s=this.fd("$feature_flag_payloads"))&&void 0!==s?s:{},l=le(le({},r),t),a=le(le({},o),e),u={};for(const[t,e]of Object.entries(l))u[t]={key:t,enabled:Qn(e),variant:Jn(e),reason:void 0,metadata:Ce(null==a?void 0:a[t])?void 0:{id:0,version:void 0,description:void 0,payload:a[t]}};this.kd({flags:u})}get hasLoadedFlags(){return this.jc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.fd(X),e=this.fd(nt),i=this.fd(st);if(!i&&!e)return t||{};const n=Ds({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(const t of s){var r;const s=n[t],l=null==e?void 0:e[t],a=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,h=null==i?void 0:i[t],c=le(le({},s),{},{enabled:a,variant:a?null!=u?u:null==s?void 0:s.variant:void 0});var o;a!==(null==s?void 0:s.enabled)&&(c.original_enabled=null==s?void 0:s.enabled),u!==(null==s?void 0:s.variant)&&(c.original_variant=null==s?void 0:s.variant),h&&(c.metadata=le(le({},null==s?void 0:s.metadata),{},{payload:h,original_payload:null==s||null===(o=s.metadata)||void 0===o?void 0:o.payload})),n[t]=c}return this.Dc||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:n}),this.Dc=!0),n}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(i=>{const n=t[i];return{key:i,enabled:Qn(n),variant:Jn(n),payload:Zn(e[i])}})}getFlagVariants(){const t=this.fd(J),e=this.fd(nt);if(!e)return t||{};const i=Ds({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.Dc||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Dc=!0),i}getFlagPayloads(){const t=this.fd(tt),e=this.fd(st);if(!e)return t||{};const i=Ds({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.Dc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Dc=!0),i}reloadFeatureFlags(){this.zc||this.Mr.featureFlagsDisabled||this.Zc()||(this.Bc&&(this.Uc=!0),this.Sd||(this.qc.slice().forEach(t=>{try{t()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.Sd=setTimeout(()=>{this.xd()},5)))}vd(){clearTimeout(this.Sd),this.Sd=void 0}onReloading(t){return this.qc.push(t),()=>{this.qc=this.qc.filter(e=>e!==t)}}ensureFlagsLoaded(){this.jc||this.Bc||this.Sd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.zc=t}resetFlagCallReported(){this.Lt(_t)}xd(t){this.vd();const e=this.uo;if(!e||this.Mr.remoteRequestsDisabled||this.Zc())return;if(this.Bc)return void(this.Uc=!0);const i={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:le(le(le({},e.initialPersonProperties),this.fd("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.fd(ot),timezone:Ca()};Ce(e.deviceId)||(i.$device_id=e.deviceId),((null==t?void 0:t.disableFlags)||this.Mr.featureFlagsDisabled)&&(i.disable_flags=!0);const n=this._d();n.length&&(i.evaluation_contexts=n);const s=this.wd();Ce(s)||(i.flag_keys=s);const r=this.Mr.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),l=this.Hc;this.Bc=!0;const a=()=>{this.Uc&&(this.Uc=!1,this.xd())},u=t=>{var e,n;const s=null!==(e=t.json)&&void 0!==e?e:{},o=200!==t.statusCode;if(this.Bc=!1,l!==this.Hc)return void a();if(this.Cd(t.statusCode),o||this.Uc||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.Uc)return;this.Wc=!o;const u=[];t.error?u.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?ck:"unknown_error"):200!==t.statusCode&&u.push(`api_error_${t.statusCode}`),s.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");const h=!!(null===(n=s.quotaLimited)||void 0===n?void 0:n.includes("feature_flags"));h&&u.push("quota_limited"),this.At({[kt]:u}),h?this.$.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):i.disable_flags||this.kd(s,o,{partialResponse:r}),a()},h=t=>{this.Bc=!1,l===this.Hc?(this.At({[kt]:[ck]}),this.$.error("Feature flag request failed",t),this.gd()&&this.ad(!0),a()):a()};try{e.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(u).catch(h)}catch(t){h(t)}}Zc(){return Xs(this.Gc,3)}Cd(t){this.Gc=tr(t,this.Gc,3,()=>this.$.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,e={}){var i;if(e.fresh&&!this.Wc)return;if(!(this.jc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+t+hk);if(this.bd())return;const n=this.getFeatureFlagResult(t,e);return null!==(i=null==n?void 0:n.variant)&&void 0!==i?i:null==n?void 0:n.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e={}){if(e.fresh&&!this.Wc)return;if(!(this.jc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+t+hk);if(this.bd())return;const i=this.getFlagVariants(),n=t in i,s=i[t],r=this.getFlagPayloads()[t],o=String(s),l=this.fd("$feature_flag_request_id")||void 0,a=this.fd("$feature_flag_evaluated_at")||void 0;let u,h=this.fd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var c;const t=null===(c=this.uo)||void 0===c?void 0:c.session.sessionId,e=this.fd(wt);t&&t!==e&&(h={},u=t)}if(e.send_event||!("send_event"in e))if(t in h&&h[t].includes(o))u&&this.At({[_t]:h,[wt]:u});else{var d,v,f,p,g,m,y,b,_,w,k,S;we(h[t])?h[t].push(o):h[t]=[o],this.At(le({[_t]:h},u?{[wt]:u}:{}));const e=this.getFeatureFlagDetails(t),i=[...null!==(d=this.fd("$feature_flag_errors"))&&void 0!==d?d:[]];Ce(s)&&i.push("flag_missing");const n={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:a,$feature_flag_bootstrapped_response:null!==(v=null===(f=this.Mr.bootstrap)||void 0===f||null===(f=f.featureFlags)||void 0===f?void 0:f[t])&&void 0!==v?v:null,$feature_flag_bootstrapped_payload:null!==(p=null===(g=this.Mr.bootstrap)||void 0===g||null===(g=g.featureFlagPayloads)||void 0===g?void 0:g[t])&&void 0!==p?p:null,$used_bootstrap_value:!this.Wc};Ce(null==e||null===(m=e.metadata)||void 0===m?void 0:m.has_experiment)||(n.$feature_flag_has_experiment=e.metadata.has_experiment),Ce(null==e||null===(y=e.metadata)||void 0===y?void 0:y.version)||(n.$feature_flag_version=e.metadata.version);const c=null!==(b=null==e||null===(_=e.reason)||void 0===_?void 0:_.description)&&void 0!==b?b:null==e||null===(w=e.reason)||void 0===w?void 0:w.code;var x;c&&(n.$feature_flag_reason=c),(null==e||null===(k=e.metadata)||void 0===k?void 0:k.id)&&(n.$feature_flag_id=e.metadata.id),Ce(null==e?void 0:e.original_variant)&&Ce(null==e?void 0:e.original_enabled)||(n.$feature_flag_original_response=Ce(e.original_variant)?e.original_enabled:e.original_variant),(null==e||null===(S=e.metadata)||void 0===S?void 0:S.original_payload)&&(n.$feature_flag_original_payload=null==e||null===(x=e.metadata)||void 0===x?void 0:x.original_payload),i.length&&(n.$feature_flag_error=i.join(",")),this.$d(n)}else u&&this.At({[_t]:h,[wt]:u});return n?{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:Zn(r)}:void 0}$d(t){try{var e;null===(e=this.uo)||void 0===e||e.capture("$feature_flag_called",t).catch(t=>{this.$.error("Failed to capture feature flag call",t)})}catch(t){this.$.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,e){this.Td(t,e)}Td(t,e){var i=this;return ne(function*(){const n=i.uo;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._d();r.length&&(s.evaluation_contexts=r);const o=i.wd();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.Mr.compression,sentAt:"body",timeoutMs:i.Mr.requestTimeoutMs})).json)||void 0===a?void 0:a.featureFlagPayloads;l=(null==e?void 0:e[t])||void 0}catch(t){return void i.$.error("Remote config feature flag request failed",t)}try{e(l)}catch(t){i.$.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.Wc)return e.defaultValue;if(!(this.jc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+hk),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.kd(t,e,i)}kd(t,e,i){if(!this.uo)return;this.jc=!0;const n=((t,e={},i={},n={},s,r=ak)=>{const o=((t,e)=>{const i=t.flags;if(i){const e=Object.fromEntries(Object.keys(i).map(t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]})),n=Object.fromEntries(Object.keys(i).filter(t=>i[t].enabled).filter(t=>{var e;return!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 le(le({},t),{},{featureFlags:e,featureFlagPayloads:n})}return t.featureFlags&&e.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t,r),l=o.flags,a=o.featureFlags,u=o.featureFlagPayloads;if(!a)return;const h=t.requestId,c=t.evaluatedAt;if(we(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{[K]:a,[J]:t,[it]:!1}}let d=a,v=u,f=l;if(null==s?void 0:s.partialResponse){const t=Object.keys(d),s=v||{};d=le(le({},e),d),v=le(le({},i),s),t.forEach(t=>{t in s||null==v||delete v[t]}),f=le(le({},n),f)}else if(t.errorsWhileComputingFlags)if(l){const t=new Set(Object.keys(l).filter(t=>{var e;return!(null===(e=l[t])||void 0===e?void 0:e.failed)}));d=le(le({},e),Object.fromEntries(Object.entries(d).filter(([e])=>t.has(e))));const s=Object.fromEntries(Object.entries(v||{}).filter(([e])=>t.has(e)));v=le(le({},i),s),t.forEach(t=>{t in s||null==v||delete v[t]}),f=le(le({},n),Object.fromEntries(Object.entries(f||{}).filter(([e])=>t.has(e))))}else d=le(le({},e),d),v=le(le({},i),v),f=le(le({},n),f);return le(le({[K]:Object.keys(vk(d)),[J]:d||{},[tt]:v||{},[X]:f||{},[it]:!0===t.minimalFlagCalledEvents},h?{[et]:h}:{}),c?{[St]:c}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.$);if(n)if(!1===(null==i?void 0:i.persist)){const t=!Ce(this.uo.kv.get(J));this.pd=n,t||this.At(n)}else this.od(),this.yd(n,t,!!(null==i?void 0:i.partialResponse)),this.At(n);else e&&this.gd();e||(this.Vc=!1),this.ad(e)}override(t,e=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.Id(t)}Id(t){if(this.uo){if(!1===t)return this.Lt([nt,st]),this.ad(),void uk.info("All overrides cleared");if(we(t))return this.At({[nt]:dk(t)}),this.ad(),void uk.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e;const i=t;this.Dc=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);const n={},s=i.flags,r=i.payloads;return s&&(n[nt]=we(s)?dk(s):s),r&&(n[st]=r),Object.keys(n).length&&this.At(n),!1===s&&!1===r?this.Lt([nt,st]):!1===s?this.Lt(nt):!1===r&&this.Lt(st),this.ad(),!1===s?uk.info("Flag overrides cleared"):s&&uk.info("Flag overrides set",{flags:s}),void(!1===r?uk.info("Payload overrides cleared"):r&&uk.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.At({[nt]:t}),this.ad(),void uk.info("Flag overrides set",{flags:t});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.jc){const{flags:e,flagVariants:i}=this.Md();try{t(e,i)}catch(t){this.$.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var n;const s=(this.fd("$early_access_features")||[]).find(e=>e.flagKey===t),r={[`$feature_enrollment/${t}`]:e},o={$feature_flag:t,$feature_enrollment:e,$set:r};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i);const l=le(le({},this.getFlagVariants()),{},{[t]:e});null===(n=this._instance)||void 0===n||null===(n=n.persistence)||void 0===n||n.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.At({[K]:Object.keys(vk(l)),[J]:l,[rt]:le(le({},this.fd("$stored_person_properties")||{}),r)}),this.ad();try{var a;null===(a=this.uo)||void 0===a||a.capture("$feature_enrollment_update",o).catch(t=>{this.$.error("Failed to capture early access feature enrollment",t)})}catch(t){this.$.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,e=!1,i){const n=this.fd(Y);!n||e?this.Ed(t,i):t(n)}Ed(t,e){var i=this;return ne(function*(){const n=i.uo;if(!n)return;const s=e?`&${e.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${s}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,i.At({[Y]:r})}catch(t){return void i.$.error("Early access feature request failed",t)}try{t(r)}catch(t){i.$.error("Early access feature callback failed",t)}})()}Md(){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),{})}}ad(t){this.ld();const{flags:e,flagVariants:i}=this.Md();this.featureFlagEventHandlers.forEach(n=>{try{n(e,i,{errorsLoading:t})}catch(t){this.$.error("Error while running feature flags callback",t)}})}setPersonPropertiesForFlags(t,e=!0){this.Pd(t,e)}Pd(t,e=!0){const i=this.fd("$stored_person_properties")||{},n=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),s=null==t?void 0:t.$set_once,r={};if(s)for(const t in s)({}).hasOwnProperty.call(s,t)&&(t in i||(r[t]=s[t]));this.At({[rt]:le(le(le({},i),r),n)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const i=le({},this.fd("$stored_person_properties")||{});t.forEach(t=>{delete i[t]}),this.At({[rt]:i}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(rt),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const i=this.fd("$stored_group_properties")||{},n=le({},i);for(const e of Object.keys(t))n[e]=le(le({},i[e]),t[e]);this.At({[ot]:n}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.fd("$stored_group_properties")||{};this.At({[ot]:le(le({},e),{},{[t]:{}})})}else this.Lt(ot)}reset(){this.Hc++,this.Uc=!1,this.Lc={},this.Nc={},this.pd=void 0,this.jc=!1,this.zc=!1,this.Wc=!1,this.$anon_distinct_id=void 0,this.vd(),this.Dc=!1,this.Gc=0}}},Ck={sessionRecording:class{get Mr(){return this._instance.config}get ya(){return this._instance.persistence}get started(){var t;return!!(null===(t=this.Rd)||void 0===t?void 0:t.isStarted)}get status(){var t,e;return"awaiting_config"===this.Ad||"missing_config"===this.Ad?this.Ad:null!==(t=null===(e=this.Rd)||void 0===e?void 0:e.status)&&void 0!==t?t:this.Ad}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.Ad=to,this.Fd=void 0,this.Od=!1,this.Ke=(()=>{var e,i;if(!(null==n?void 0:n.visibilityState)||"visible"===n.visibilityState)return!0;const s=null==t||null===(e=t.performance)||void 0===e||null===(i=e.getEntriesByType)||void 0===i?void 0:i.call(e,"visibility-state");return!(null==s?void 0:s.length)||s.some(t=>"visible"===t.name)})(),this.an=()=>{var t,e;"visible"===(null==n?void 0:n.visibilityState)&&(this.Ke=!0,null===(t=this.Rd)||void 0===t||null===(e=t.setDocumentWasEverVisible)||void 0===e||e.call(t,!0))},!this._instance.sessionManager)throw qw.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Mr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==n?void 0:n.addEventListener)&&Us(n,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.Od=!0,null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,"visibilitychange",this.an),t?this.Dd(!0):this.stopRecording()}get Ld(){var e;const i=!!(null===(e=this._instance.get_property("$session_recording_remote_config"))||void 0===e?void 0:e.enabled),n=!this.Mr.disable_session_recording,s=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&n&&!s}startIfEnabledOrStop(t){var e;if(this.Od)return;if(this.Ld&&(null===(e=this.Rd)||void 0===e?void 0:e.isStarted))return;const i=!Ce(Object.assign)&&!Ce(Array.from);this.Ld&&i?(this.Nd(t),qw.info("starting")):(this.Ad=to,this.stopRecording())}Nd(t){var e,i;if(this.Ld)if("awaiting_config"!==this.Ad&&"missing_config"!==this.Ad&&(this.Ad=ro),(null==d||null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.rrweb)||void 0===e?void 0:e.record)&&(null===(i=d.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this.qd(t);else{var n,s;const e=this._instance.sessionManager;null===(n=d.__PosthogExtensions__)||void 0===n||null===(s=n.loadExternalDependency)||void 0===s||s.call(n,this._instance,this.jd,i=>{if(!this.Od&&this.Ld&&this._instance.sessionManager===e)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),qw.error("could not load recorder",i)):void this.qd(t);this.Ad="disabled"})}}stopRecording(){var t,e;null===(t=this.Fd)||void 0===t||t.call(this),this.Fd=void 0,null===(e=this.Rd)||void 0===e||e.stop()}Dd(t=!1){var e,i;null===(e=this.Fd)||void 0===e||e.call(this),this.Fd=void 0,null===(i=this.Rd)||void 0===i||i.discard({discardProducerEvents:t})}Bd(){var t,e;null===(t=this.ya)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this.ya)||void 0===e||e.unregister("$replay_sample_rate")}Hd(t,e){if(Me(t))return null;const i=Ee(t)?t:parseFloat(t);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(qw.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):i;var n}zd(t){if(this.ya){var e,i;const n=this.ya,s=()=>{var e;const i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Hd(null===(e=this.Mr.session_recording)||void 0===e?void 0:e.sampleRate,"session_recording.sampleRate"),r=this.Hd(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:r;Me(o)&&this.Bd();const l=null==i?void 0:i.minimumDurationMilliseconds;n.register({[A]:le(le({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:le({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.Fd)||void 0===e||e.call(this),this.Fd=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.zd(e),void this.Dd()):(this.zd(e),void this.startIfEnabledOrStop()):("awaiting_config"===this.Ad&&(this.Ad="missing_config",qw.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var i;(null===(i=this.Rd)||void 0===i?void 0:i.log)?this.Rd.log(t,e):qw.warn("log called before recorder was ready")}get jd(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(A);return(null==i||null===(e=i.scriptConfig)||void 0===e?void 0:e.script)||"lazy-recorder"}Ud(){const t=this._instance.get_property(A);if(!t)return!1;let e;try{e="object"==typeof t?t:JSON.parse(t)}catch(t){return qw.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!Me(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}qd(t){var e,i,n;if(!this.Od&&this.Ld&&this._instance.sessionManager){if(!(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))return qw.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Ot]:!0});var s;if(this.Rd||(this.Rd=null===(s=d.__PosthogExtensions__)||void 0===s?void 0:s.initSessionRecording(this._instance,this.Ke),this.Rd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ud()){if("missing_config"===this.Ad||"awaiting_config"===this.Ad)return;return this.Ad="awaiting_config",qw.info("persisted remote config is stale, requesting fresh config before starting"),void new $_(this._instance).load()}this.Ad=ro,null===(i=(n=this.Rd).setDocumentWasEverVisible)||void 0===i||i.call(n,this.Ke),this.Rd.start(t)}else this.Ad=to}onRRwebEmit(t){var e,i;null===(e=this.Rd)||void 0===e||null===(i=e.onRRwebEmit)||void 0===i||i.call(e,t)}overrideLinkedFlag(){var t,e;this.Rd||null===(e=this.ya)||void 0===e||e.register({$replay_override_linked_flag:!0}),null===(t=this.Rd)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Rd||null===(e=this.ya)||void 0===e||e.register({$replay_override_sampling:!0}),null===(t=this.Rd)||void 0===t||t.overrideSampling()}overrideTrigger(t){var e,i;this.Rd||null===(i=this.ya)||void 0===i||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(e=this.Rd)||void 0===e||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null===(t=this.Rd)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!!(null===(i=this.Rd)||void 0===i?void 0:i.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;null===(t=this.Rd)||void 0===t||null===(e=t.flushBeforeIdentityReset)||void 0===e||e.call(t)}}},$k={autocapture:class extends Db{constructor(t){super(new Pw(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.Wd=this.Vd()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.Gd();return!!(t.path||t.search||this.Zd(t))}startIfEnabled(){this.isEnabled&&(Rs.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Wd=this.Vd(),this.startIfEnabled()}stop(){this.Qd&&this.Qd(),this.Qd=void 0,this.Jd&&this.Jd(),this.Jd=void 0,Rs.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.Kd("pushState"),this.Kd("replaceState"),this.Yd(),this.Zd()&&this.Xd())}Kd(e){var i;if(!t||(null===(i=t.history[e])||void 0===i?void 0:i.__posthog_wrapped__))return;const n=this;av(t.history,e,t=>function(i,s,r){t.call(this,i,s,r),n.tv(e)})}Vd(){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}}Gd(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:Se(t)?t:{}}Zd(t=this.Gd()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}ev(t){const e=this.Gd(),i=this.Wd;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.Zd(e)&&t.hash!==i.hash))}tv(t){try{const e=this.Vd();if(!e)return;this.ev(e)&&this._instance.capture(Yt,{navigation_type:t}),this.Wd=e}catch(e){Rs.error(`Error capturing ${t} pageview`,e)}}Yd(){if(this.Qd)return;const e=()=>{this.tv("popstate")};Us(t,"popstate",e),this.Qd=()=>{t&&t.removeEventListener("popstate",e)}}Xd(){if(this.Jd)return;const e=()=>{this.tv("hashchange")};Us(t,"hashchange",e),this.Jd=()=>{t&&t.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(t){var e;this.iv=!1,this.do=!1,this.nv=null,this.instance=t,this.iv=!!(null===(e=this.instance.persistence)||void 0===e?void 0:e.props[S]),this.rageclicks=new Eb(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return Se(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Mr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Me(this.Mr.capture_heatmaps)?Me(this.Mr.enable_heatmaps)?this.iv:this.Mr.enable_heatmaps:!1!==this.Mr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.do)return;jw.info("starting..."),this.sv(),this.an()}else{var t;clearInterval(null!==(t=this.nv)&&void 0!==t?t:void 0),this.rv(),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({[S]:i}),this.iv=i,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}ov(t){Bw(t.originalEvent)&&this.Cr(t.originalEvent,"deadclick")}an(){this.nv&&clearInterval(this.nv),this.nv=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(n)?setInterval(this.aa.bind(this),this.flushIntervalMilliseconds):null}sv(){t&&n&&(this.lv=this.aa.bind(this),Us(t,Kt,this.lv),this.av=e=>this.Cr(e||(null==t?void 0:t.event)),Us(n,"click",this.av,{capture:!0}),this.uv=e=>this.hv(e||(null==t?void 0:t.event)),Us(n,"mousemove",this.uv,{capture:!0}),this.dv=new e_(this.instance,Xb,this.ov.bind(this)),this.dv.startIfEnabledOrStop(),this.vv=this.an.bind(this),Us(n,Jt,this.vv),this.do=!0)}rv(){var e;t&&n&&(this.lv&&t.removeEventListener(Kt,this.lv),this.av&&n.removeEventListener("click",this.av,{capture:!0}),this.uv&&n.removeEventListener("mousemove",this.uv,{capture:!0}),this.vv&&n.removeEventListener(Jt,this.vv),clearTimeout(this.fv),null===(e=this.dv)||void 0===e||e.stop(),this.do=!1)}pv(e,i){const n=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(e,i,n){let s=e;for(;s&&sr(s)&&!rr(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(fe(i,e))return!0;s=mr(s)}return!1}(vr(e),["fixed","sticky"],r);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:n),target_fixed:o,type:i}}Cr(t,e="click"){var i;if(nr(t.target)||!Bw(t))return;const n=this.pv(t,e);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&$r(vr(t),this.instance.config.rageclick)&&this.Hs(le(le({},n),{},{type:"rageclick"})),this.Hs(n)}hv(t){!nr(t.target)&&Bw(t)&&(clearTimeout(this.fv),this.fv=setTimeout(()=>{this.Hs(this.pv(t,"mousemove"))},500))}Hs(e){if(!t)return;const i=this.Mr.disable_capture_url_hashes?sn(t.location.href):t.location.href,n=this.Mr.custom_personal_data_properties,s=this.Mr.mask_personal_data_properties?[...da,...n||[]]:[],r=Ks(i,s,fa);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}aa(){this.Rt&&!xe(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:e_,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.iv=!1,this.do=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.gv=()=>{clearTimeout(this.mv),this.mv=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",le({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,e)=>le(le({},t),{},{[`$web_vitals_${e.name}_event`]:le({},e),[`$web_vitals_${e.name}_value`]:e.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.yv=t=>{var e;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Me(null==t?void 0:t.name)||Me(null==t?void 0:t.value))return void Fw.error("Invalid metric received",t);const i="string"==typeof t.navigationURL?t.navigationURL:void 0,n=this.bv(i);if(Ce(n))return;const s=Ee(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${n}`;if(this._v&&t.value>=this._v)return void Fw.error("Ignoring metric with value >= "+this._v,t);this.Rt.navigationKey!==s&&(this.gv(),this.mv=setTimeout(this.gv,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=le(le(le({},t),i?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete o.entries,Se(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const e={};for(const i of Nw){const n="url"===i&&"string"==typeof t.attribution[i]?this.bv(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.gv()},this.wv=()=>{if(this.do)return;let t,e,i,n,s=!1;const r=d.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,l=(null==o?void 0:o[this.Sv])||("web-vitals"===this.Sv&&Ce(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!Ce(l)){const r=l.withoutAttribution,o=this.attributionMetrics;s=!Ce(r),t=o.indexOf("LCP")>-1?l.onLCP:(null==r?void 0:r.onLCP)||l.onLCP,e=o.indexOf("CLS")>-1?l.onCLS:(null==r?void 0:r.onCLS)||l.onCLS,i=o.indexOf("FCP")>-1?l.onFCP:(null==r?void 0:r.onFCP)||l.onFCP,n=o.indexOf("INP")>-1?l.onINP:(null==r?void 0:r.onINP)||l.onINP}if(!(t&&e&&i&&n))return void Fw.error("web vitals callbacks not loaded - not starting");const a={reportSoftNavs:this.useSoftNavs},u=s&&this.attributionMetrics.indexOf("INP")>-1?le(le({},a),{},{includeProcessedEventEntries:!1}):a;this.allowedMetrics.indexOf("LCP")>-1&&t(this.yv.bind(this),a),this.allowedMetrics.indexOf("CLS")>-1&&e(this.yv.bind(this),a),this.allowedMetrics.indexOf("FCP")>-1&&i(this.yv.bind(this),a),this.allowedMetrics.indexOf("INP")>-1&&n(this.yv.bind(this),u),this.do=!0},this.iv=!!(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[I]),this.startIfEnabled()}get xv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const i=Se(this.xv)?null===(t=this.xv)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return Me(i)?(null===(e=this._instance.persistence)||void 0===e?void 0:e.props.$web_vitals_allowed_metrics)||Dw:i}get flushToCaptureTimeoutMs(){return(Se(this.xv)?this.xv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=Se(this.xv)?this.xv.web_vitals_attribution:void 0;return Re(t)?t?Dw:[]:we(t)?t:Lw}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=Se(this.xv)?this.xv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get _v(){const t=Se(this.xv)&&Ee(this.xv.__web_vitals_max_value)?this.xv.__web_vitals_max_value:Ow;return t>0&&6e4>=t?Ow:t}get isEnabled(){const t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Fw.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=Se(this.xv)?this.xv.web_vitals:Re(this.xv)?this.xv:void 0;return Re(e)?e:this.iv}startIfEnabled(){this.isEnabled&&!this.do&&(Fw.info("enabled, starting..."),this.Ro(this.wv))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const i=Se(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Se(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[I]:i}),this._instance.persistence.register({[R]:n})),this.iv=i,this.startIfEnabled()}get Sv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ro(t){var e;const i=d.__PosthogExtensions__,n=this.Sv,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==i||null===(e=i.loadExternalDependency)||void 0===e||e.call(i,this._instance,n,e=>{e?Fw.error("failed to load script",e):t()})}bv(e){const i=e||(null==t?void 0:t.location.href);if(!i)return void Fw.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?sn(i):i,s=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...da,...s||[]]:[];return Ks(n,r,fa)}}},Tk={exceptionObserver:class{constructor(e){var i;this.wv=()=>{var e;if(!t||!this.isEnabled||!(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions))return;const i=d.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=d.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=d.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Cv&&this.Mr.capture_unhandled_errors&&(this.Cv=i(this.captureException.bind(this))),!this.$v&&this.Mr.capture_unhandled_rejections&&(this.$v=n(this.captureException.bind(this))),!this.Tv&&this.Mr.capture_console_errors&&(this.Tv=s(this.captureException.bind(this)))}catch(t){Rw.error("failed to start",t),this.Iv()}},this._instance=e,this.Mv=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[x]),this.wt=new Ge(le(le({},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,$:Rw})),this.Mr=this.Ev(),this.startIfEnabledOrStop()}Ev(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Se(t)?e=le(le({},e),t):(Ce(t)?this.Mv:t)&&(e=le(le({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Rw.info("enabled"),this.Iv(),this.Ro(this.wv)):this.Iv()}Ro(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"exception-autocapture",e=>{if(e)return Rw.error("failed to load script",e);t()})}Iv(){var t,e,i;null===(t=this.Cv)||void 0===t||t.call(this),this.Cv=void 0,null===(e=this.$v)||void 0===e||e.call(this),this.$v=void 0,null===(i=this.Tv)||void 0===i||i.call(this),this.Tv=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.Mv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[x]:this.Mv}),this.Mr=this.Ev(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.Ev()}captureException(t){try{var e,i,n;const s=null!==(e=null==t||null===(i=t.$exception_list)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.type)&&void 0!==e?e:"Exception";if(this.wt.consumeRateLimit(s))return void Rw.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.Pv=[],this.Rv=Tm(),this._instance=t,this.Pv=null!==(e=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==e?e:[],this.Av=Wn(this.Fv()),this.Ov=new Vn(this.Av)}onConfigChange(){this.Av=Wn(this.Fv()),this.Ov.setConfig(this.Av)}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.Pv=r,this._instance.persistence&&this._instance.persistence.register({[C]:this.Pv,[T]:o})}get Dv(){var t;const e=!!this._instance.get_property(T),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.Rv.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.Av.enabled)try{if(!$e(t)||0===t.trim().length)return void km.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)=>zn.has(n)?(e.push(n),i):(i[n]=t[n],i),{}),droppedKeys:e}}(this.Lv(e));n.length>0&&km.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Ov.add(le({[Bn]:t,[Hn]:(new Date).toISOString()},i))}catch(t){km.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.Nv(e)){if(this.qv(e))return this.jv("Exception dropped: matched a suppression rule"),void km.info("Skipping exception capture because a suppression rule matched");if(!this.Dv&&this.Bv(e))return this.jv("Exception dropped: thrown by a browser extension"),void km.info("Skipping exception capture because it was thrown by an extension");if(!this.Dv&&this.Hv(e))return this.jv("Exception dropped: thrown by an injected browser script"),void km.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.zv(e))return this.jv("Exception dropped: thrown by the PostHog SDK"),void km.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this.Av.enabled&&Me(t.$exception_steps)?this.Uv(t):t,n=function(){const t=globalThis._posthogReleaseId;return"string"==typeof t&&t.length>0?t:void 0}();n&&(i.$release_id=n);try{const t=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Qu:!0});return t&&this.Ov.clear(),t}catch(t){return wm(t)||km.error("Failed to capture exception event. Dropping this exception.",t),void this.Ov.clear()}}catch(t){return void(wm(t)||km.error("Failed to process exception event. Ignoring this exception.",t))}}Uv(t){try{const e=this.Ov.getAttachable();return 0===e.length?t:le(le({},t),{},{$exception_steps:e})}catch(e){return km.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}jv(t){this.Av.enabled&&this.Ov.add({[Bn]:t,[Hn]:(new Date).toISOString()})}Lv(t){return Se(t)?le({},t):{}}Fv(){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:{}}qv(t){if(0===t.length)return!1;try{const e=t.reduce((t,{type:e,value:i})=>($e(e)&&e.length>0&&t.$exception_types.push(e),$e(i)&&i.length>0&&t.$exception_values.push(i),t),{$exception_types:[],$exception_values:[]});return this.Pv.some(t=>{const i=t.values.map(t=>{const i=ia[t.operator],n=e[t.key];if(!i||!n)return!1;const s=we(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 km.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Bv(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&&Cm.some(e=>t.startsWith(e)));return 0!==i.length&&(!i.every(({filename:t})=>!!t&&t.startsWith(Sm))||t.some(({type:t,value:e})=>"NoResponse"===t||$e(e)&&xm.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(Sm))))}Hv(t){return t.some(({value:t})=>$e(t)&&$m.some(e=>t.includes(e)))}zv(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}Nv(t){return!Me(t)&&we(t)}}},Ik=le({productTours:class{get ya(){return this._instance.persistence}constructor(t){this.Wv=null,this.Vv=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.ya&&this.ya.register({[E]:!!e.productTours}),!zw(this._instance))return!this.Wv&&Me(null===(i=this.ya)||void 0===i?void 0:i.props.ph_product_tours)||Hw.info("product tours disabled; stopping and clearing cached tours"),null===(n=this.Wv)||void 0===n||n.stop(),this.Wv=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Wv&&zw(this._instance)&&this.Ro(()=>this.Gv())}Ro(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"product-tours",e=>{e?Hw.error("Could not load product tours script",e):t()})}Gv(){var t;!this.Wv&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.Wv=d.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(we(this.Vv)&&!e)return void t(this.Vv,{isLoaded:!0});const i=this.ya;if(i){const n=i.props[vt];if(we(n)&&!e)return this.Vv=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(!zw(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||Hw.warn(i):Hw.error(i),void t([],{isLoaded:!1,error:i})}const s=we(e.json.product_tours)?e.json.product_tours:[];this.Vv=s,i&&i.register({[vt]:s}),t(s,{isLoaded:!0})}})}getActiveProductTours(t){Me(this.Wv)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Wv.getActiveProductTours(t)}showProductTour(t){var e;null===(e=this.Wv)||void 0===e||e.showTourById(t)}previewTour(t){this.Wv?this.Wv.previewTour(t):this.Ro(()=>{var e;this.Gv(),null===(e=this.Wv)||void 0===e||e.previewTour(t)})}dismissProductTour(){var t;null===(t=this.Wv)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.Wv)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.Wv)||void 0===t||t.previousStep()}clearCache(){var t;this.Vv=null,null===(t=this.ya)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var e;null===(e=this.Wv)||void 0===e||e.resetTour(t)}resetAllTours(){var t;null===(t=this.Wv)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var e;null===(e=this.Wv)||void 0===e||e.cancelPendingTour(t)}}},xk),Mk={siteApps:class{constructor(t){this._instance=t,this.Zv=0,this.Qv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Jv(t,e){if(!e)return;const i=this.globalsForEvent(e);this.Qv.push(i),this.Qv.length>1e3&&(this.Qv=this.Qv.slice(10))}get siteAppLoaders(){var t;return null===(t=d._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.Jv.bind(this));this.Kv=()=>{t(),this.Qv=[],this.Kv=void 0}}}globalsForEvent(t){var e,i,n,s,r,o,l;if(!t)throw new Error("Event payload is required");const a={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(const[t,e]of Object.entries(h))a[t]={id:u[t],type:t,properties:e};const{$set_once:c,$set:d}=t;return{event:le(le({},us(t,Uw)),{},{properties:le(le(le({},t.properties),d?{$set:le(le({},null!==(e=null===(i=t.properties)||void 0===i?void 0:i.$set)&&void 0!==e?e:{}),d)}:{}),c?{$set_once:le(le({},null!==(n=null===(s=t.properties)||void 0===s?void 0:s.$set_once)&&void 0!==n?n:{}),c)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(l=t.properties)||void 0===l?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:a}}Yv(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)||(Ww.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)||(Ww.error("prepare_external_dependency_script returned null"),null)}return t}Xv(){var t,e,i,s,r,o,l,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const u=null==n?void 0:n.defaultView,h=null==u||null===(t=u.Node)||void 0===t?void 0:t.prototype;if(!u||!h)return()=>{};if(this.Zv++,this.tf)return this.ef();const c=[],d=this,v=new WeakSet,f=(t,e,i)=>{if(!(null==t?void 0:t[e]))return;const n=t[e];t[e]=i(n),c.push(()=>{t[e]=n})},p=t=>{if(v.has(t))return t;const e=d.Yv(t);return e&&v.add(e),e},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!Ie(t));return f(h,"appendChild",t=>function(e){const i=p(e);return i?t.call(this,i):e}),f(h,"insertBefore",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):e}),f(h,"replaceChild",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):i}),[null===(e=u.Element)||void 0===e?void 0:e.prototype,null===(i=u.Document)||void 0===i?void 0:i.prototype,null===(s=u.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(t=>{f(t,"append",t=>function(...e){return t.apply(this,g(e))}),f(t,"prepend",t=>function(...e){return t.apply(this,g(e))})}),[null===(r=u.Element)||void 0===r?void 0:r.prototype,null===(o=u.CharacterData)||void 0===o?void 0:o.prototype,null===(l=u.DocumentType)||void 0===l?void 0:l.prototype].forEach(t=>{f(t,"before",t=>function(...e){return t.apply(this,g(e))}),f(t,"after",t=>function(...e){return t.apply(this,g(e))}),f(t,"replaceWith",t=>function(...e){const i=g(e);return e.length&&!i.length?void 0:t.apply(this,i)})}),f(null===(a=u.Element)||void 0===a?void 0:a.prototype,"insertAdjacentElement",t=>function(e,i){const n=p(i);return n?t.call(this,e,n):null}),this.tf=()=>{c.forEach(t=>t()),this.tf=void 0},this.ef()}ef(){let t=!1;return()=>{var e;t||(t=!0,this.Zv--,0===this.Zv&&(null===(e=this.tf)||void 0===e||e.call(this)))}}if(t,e=!0){const i=this.Xv();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.Qv.length&&(Ww.info(`Processing ${this.Qv.length} events for site app with id ${t.id}`),this.Qv.forEach(t=>this.if(()=>{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.Kv)||void 0===i||i.call(this))};let n=!1;const s=s=>{e.errored=!s,e.loaded=!0,Ww.info(`Site app with id ${t.id} ${s?"loaded":"errored"}`),n&&i()};try{const{processEvent:i}=this.if(e=>t.init({posthog:this._instance,callback(t){e(),s(t)}}),!1);i&&(e.processEvent=i),n=!0}catch(e){Ww.error(Vw+t.id,e),s(!1)}if(n&&e.loaded)try{i()}catch(i){Ww.error(`Error while processing buffered events PostHog app with config id ${t.id}`,i),e.errored=!0}}nf(){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)}sf(t){if(0===Object.keys(this.apps).length)return;const e=this.globalsForEvent(t);for(const i of Object.values(this.apps))try{this.if(()=>{var t;return null===(t=i.processEvent)||void 0===t?void 0:t.call(i,e)})}catch(e){Ww.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.nf(),void this._instance.on("eventCaptured",t=>this.sf(t))):void Ww.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this.Kv)||void 0===i||i.call(this),!t.ok)return;const s=t.config;if(null===(n=s.siteApps)||void 0===n?void 0:n.length)if(this.isEnabled)for(const{id:t,url:e}of s.siteApps){var r,o;d[`__$$ph_site_app_${t}`]=this._instance,null===(r=d.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,e,e=>{if(e)return Ww.error(Vw+t,e)})}else Ww.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Ek={tracingHeaders:class{constructor(t){this._instance=t,this.rf=void 0,this.lf=void 0,this.af=void 0,this.wv=()=>{const t=this.uf();var e,i;t?(Ce(this.rf)&&(this.rf=null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Ce(this.lf)&&(this.lf=null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Iv()}}initialize(){this.startIfEnabledOrStop()}Ro(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.tracingHeadersPatchFns)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"tracing-headers",e=>{if(e)return Aw.error("failed to load script",e);t()})}hf(){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}uf(){const t=this.hf();return we(t)?(we(this.af)?this.af.splice(0,this.af.length,...t):this.af=[...t],t.length>0?this.af:void 0):(we(this.af)&&this.af.splice(0),this.af=t||void 0,this.af)}Iv(){var t,e;null===(t=this.rf)||void 0===t||t.call(this),null===(e=this.lf)||void 0===e||e.call(this),this.rf=void 0,this.lf=void 0}startIfEnabledOrStop(){this.uf()?this.Ro(this.wv):this.Iv()}}},Pk=le({surveys:class extends Jw{constructor(t){var e;super(new ik(t),(e=t,{get projectToken(){return e.config.token},kv:new ek(e)})),this._instance=t}Sh(t,e){const i=e.query?P_(t,e.query):t;return new Promise(t=>{var n;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor(null!==(n=e.target)&&void 0!==n?n:"api",i),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:t})})}}},xk),Rk={toolbar:class{constructor(t){this.instance=t}cf(t){d.ph_toolbar_state=t}df(){var t;return null!==(t=d.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,i=void 0,s=void 0){var r,o;if(Ws(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=nk||Ys(e.hash,"__posthog")||Ys(e.hash,"state");let r;const o=n?Ns(()=>JSON.parse(atob(decodeURIComponent(n))))||Ns(()=>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(sk)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}vf(t){const e=d.ph_load_toolbar||d.ph_load_editor;!Me(e)&&ke(e)?e(t,this.instance):rk.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=le(le({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(sk,JSON.stringify(le(le({},r),{},{source:void 0}))),2===this.df())this.vf(r);else if(0===this.df()){var o,l;this.cf(1),null===(o=d.__PosthogExtensions__)||void 0===o||null===(l=o.loadExternalDependency)||void 0===l||l.call(o,this.instance,"toolbar",t=>{if(t)return rk.error("[Toolbar] Failed to load",t),void this.cf(0);this.cf(2),this.vf(r)}),Us(t,"turbolinks:load",()=>{this.cf(0),this.loadToolbar(r)})}return!0}ff(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,i=void 0){return this.maybeLoadToolbar(t,e,i)}}},Ak=le({experiments:class e{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.pf("retrieved web experiments from the server"),this.gf=new Map,t.forEach(t=>{if(t.feature_flag_key){var i;this.gf&&(e.pf("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=this.gf)||void 0===i||i.set(t.feature_flag_key,t));const n=this._instance.getFeatureFlag(t.feature_flag_key);$e(n)&&t.variants[n]&&this.mf(t.name,n,t.variants[n].transforms)}else if(t.variants)for(const i in t.variants){const n=t.variants[i];e.yf(n,this._instance)&&this.mf(t.name,i,n.transforms)}})},t)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.pf(fk);else if(!this.Mr.disable_web_experiments){if(Me(this.gf))return this.gf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.pf("applying feature flags",t),t.forEach(t=>{var e;if(this.gf&&(null===(e=this.gf)||void 0===e?void 0:e.has(t))){var i;const e=this._instance.getFeatureFlag(t),n=null===(i=this.gf)||void 0===i?void 0:i.get(t);e&&(null==n?void 0:n.variants[e])&&this.mf(n.name,e,n.variants[e].transforms)}})}}previewWebExperiment(){const t=e.getWindowLocation();if(null==t?void 0:t.search){const i=Js(null==t?void 0:t.search,"__experiment_id"),n=Js(null==t?void 0:t.search,"__experiment_variant");i&&n&&(e.pf(`previewing web experiments ${i} && ${n}`),this.getWebExperiments(t=>{this.bf(parseInt(i),n,t)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Mr.disable_web_experiments&&!i)return t([]);const n=this._instance.get_property("$web_experiments");if(n&&!e)return t(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Mr.token}`),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}bf(t,i,n){const s=n.filter(e=>e.id===t);s&&s.length>0&&(e.pf(`Previewing web experiment [${s[0].name}] with variant [${i}]`),this.mf(s[0].name,i,s[0].variants[i].transforms))}static yf(t,i){return!Me(t.conditions)&&e._f(t,i)&&e.wf(t)}static _f(t,i){var n;if(Me(t.conditions)||Me(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=er(i,s.href);return!(null===(r=t.conditions)||void 0===r?void 0:r.url)||pk[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 wf(t){var e;if(Me(t.conditions)||Me(null===(e=t.conditions)||void 0===e?void 0:e.utm))return!0;const i=ga();if(i.utm_source){var n,s,r,o,l,a,u,h;const e=!(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)||(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)==i.utm_campaign,c=!(null===(r=t.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=t.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==i.utm_source,d=!(null===(l=t.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)||(null===(a=t.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)==i.utm_medium,v=!(null===(u=t.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)||(null===(h=t.conditions)||void 0===h||null===(h=h.utm)||void 0===h?void 0:h.utm_term)==i.utm_term;return e&&d&&v&&c}return!1}static pf(t,...e){Rs.info(`[WebExperiments] ${t}`,e)}mf(t,i,n){this._is_bot()?e.pf(fk):"control"!==i?n.forEach(n=>{if(n.selector){var s;e.pf(`applying transform of variant ${i} for experiment ${t} `,n);const r=null===(s=document)||void 0===s?void 0:s.querySelectorAll(n.selector);null==r||r.forEach(t=>{const e=t;n.html&&(e.innerHTML=n.html),n.css&&e.setAttribute("style",n.css)})}}):e.pf("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?X_(i,this.Mr.custom_blocked_useragents):void 0}}},xk),Fk={conversations:class{constructor(t){this._instance=t,this.kf=void 0,this._conversationsManager=null,this.Sf=!1,this.ne=null,this.xf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return;if(this.Cf=t.ok,!t.ok)return;const e=t.config.conversations;Me(e)||(Re(e)?this.kf=e:(this.kf=e.enabled,this.ne=e),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.kf=void 0,this.ne=null,this.Cf=void 0,this.xf=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this.Sf)return;if(this._instance.config.disable_conversations)return;if(Ws(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==d?void 0:d.__PosthogExtensions__;if(t&&!Ce(this.kf)&&this.kf)if(this.ne&&this.ne.token){this.Sf=!0;try{const e=t.initConversations;if(e)return this.$f(e),void(this.Sf=!1);const i=t.loadExternalDependency;if(!i)return void this.Tf(Vt);i(this._instance,"conversations",e=>{e||!t.initConversations?this.Tf("Could not load conversations script",e):this.$f(t.initConversations),this.Sf=!1})}catch(t){this.Tf("Error initializing conversations",t),this.Sf=!1}}else gk.error("Conversations enabled but missing token in remote config.")}$f(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.xf=!1,gk.info("Conversations loaded successfully")}catch(t){this.Tf("Error completing conversations initialization",t)}else gk.error("Cannot complete initialization: remote config is null")}Tf(t,e){gk.error(t,e),this._conversationsManager=null,this.Sf=!1,this.xf=!0}show(){this._conversationsManager?this._conversationsManager.show():gk.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.kf&&!Ie(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Ws(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Cf?"remote_config_failed":Ce(this.kf)?this.Cf?"disabled_in_project":"remote_config_pending":this.kf?Me(this.ne)||!this.ne.token?"missing_token":(null==d?void 0:d.__PosthogExtensions__)?this.Sf?"initializing":this.xf?"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 ne(function*(){return n._conversationsManager?n._conversationsManager.sendMessage(t,e,i):(gk.warn(mk),null)})()}getMessages(t,e){var i=this;return ne(function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(gk.warn(mk),null)})()}markAsRead(t){var e=this;return ne(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(gk.warn(mk),null)})()}getTickets(t){var e=this;return ne(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(gk.warn(mk),null)})()}requestRestoreLink(t){var e=this;return ne(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(gk.warn(mk),null)})()}restoreFromToken(t){var e=this;return ne(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(gk.warn(mk),null)})()}restoreFromUrlToken(){var t=this;return ne(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(gk.warn(mk),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}sh(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}rh(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}}},Ok={logs:class{constructor(e){var i;this._instance=e,this.name=qp,this.If=!1,this.Mf=!1,this.Ef=!1,this.$=As("[logs]"),this.Pf=le(le({},this.$),{},{error:(...t)=>{t.some(Sk)||this.$.error(...t)}}),this.Jl=[],this.Rf=[],this.Gc=0,this.mo=!1,this.Af=[],this.Ff=[],this.Of=!1,this.Df=!1,this.Lf=()=>{var t,e;this.mo||(this.Gc=0,null===(t=this.Nf)||void 0===t||t.onReconnect(),null===(e=this.qf)||void 0===e||e.onReconnect())},this._instance&&(null===(i=this._instance.config.logs)||void 0===i?void 0:i.captureConsoleLogs)&&(this.If=!0),t&&Us(t,"online",this.Lf)}jf(t,e,i,n){var s;const r=yk(null===(s=this._instance)||void 0===s||null===(s=s.config)||void 0===s?void 0:s.logs,i);return[new Ss(this.Bf(t,e),r,this.Pf,()=>this.Hf(),t=>t(),void 0,n),r]}zf(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs;var i;return this.Nf&&this.Uf===e||(null===(i=this.Nf)||void 0===i||i.reset(),this.Uf=e,[this.Nf,this.Wf]=this.jf(()=>this.Jl,t=>{this.Jl=t})),this.Nf}Vf(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs;var i;return this.qf&&this.Gf===e||(null===(i=this.qf)||void 0===i||i.reset(),this.Gf=e,[this.qf,this.Zf]=this.jf(()=>this.Rf,t=>{this.Rf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},_k)),this.qf}setup(t){var e;if(this.mo)return;this.uo=t,(null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.logs)||void 0===e?void 0:e.captureConsoleLogs)&&(this.If=!0),(this.If||this.Qf()&&this.Jf())&&this.Kf();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.mo?n.dispose():(this._o=n,i||this.loadIfEnabled())}dispose(){var e,i,n,s;this.mo||(this.mo=!0,this.Yf(),null===(e=this._o)||void 0===e||e.dispose(),this._o=void 0,this.uo=void 0,this.Ef=!1,null==t||t.removeEventListener("online",this.Lf),null===(i=this.Xf)||void 0===i||i.call(this),this.Xf=void 0,null===(n=this.Nf)||void 0===n||n.reset(),null===(s=this.qf)||void 0===s||s.reset())}onRemoteConfig(t){var e,i;if(this.mo)return;const n=t.ok?null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs:void 0;Me(n)?this.tp():(null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$logs_capture_enabled_server_side:!!n}),n?(this.If=!0,this.Mf||this.Kf(),this.loadIfEnabled()):this.tp())}reset(){var t,e,i,n;this.Yf(),null===(t=this.Nf)||void 0===t||t.clearQueue(),this.Jl=[],null===(e=this.Nf)||void 0===e||e.reset(),null===(i=this.qf)||void 0===i||i.clearQueue(),this.Rf=[],null===(n=this.qf)||void 0===n||n.reset(),this.Gc=0}captureLog(t){this.mo||this.zf().captureLog(t)}captureConsoleLog(t){this.mo||this.Vf().captureLog(t)}captureBufferedConsoleLog(t,e,i){this.mo||this.Vf().captureLog(t,{context:e,occurredAtMs:i})}Jf(){var t;return!!(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t[P])}Qf(){var t,e,i;return!(null===(t=this._instance)||void 0===t||null===(e=t.Vl)||void 0===e?void 0:e.call(t))||!!(null===(i=d._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[this._instance.config.token])||void 0===i?void 0:i.config)}ah(){var t;this.Yf(),null===(t=this.qf)||void 0===t||t.clearQueue(),this.Rf=[]}tp(){this.If||this.Yf()}Kf(){var t;if(this.Of||!(null==d?void 0:d.console))return;const e=yk(null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs).maxBufferSize;for(const t of bk){let i;try{i=am(d.console[t])}catch(t){continue}i&&this.Ff.push(av(d.console,t,n=>{const s=(...i)=>{try{this.ep(t,i,e)}catch(t){}return n.apply(d.console,i)};return s.__rrweb_original__=i,s}))}this.Of=!0,this.np=setTimeout(()=>{this.Yf()},3e4)}ep(t,e,i){var n;if(this.Of&&!this.Df&&0!==e.length)if(null===(n=this._instance)||void 0===n?void 0:n.is_capturing()){if(i>this.Af.length){this.Df=!0;try{this.Af.push({level:t,args:e,occurredAtMs:Date.now(),context:this.Hf()})}finally{this.Df=!1}}}else this.Yf()}Yf(){if(this.Af=[],this.Of){this.Of=!1,this.np&&(clearTimeout(this.np),this.np=void 0);for(const t of this.Ff)t();this.Ff=[]}}sp(){const t=this.Af;return this.Yf(),t}get logger(){return this.rp||(this.rp={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.rp}flushLogs(t){t?this.op(t):(this.Nf&&this.Nf.flush().catch(t=>this.lp(t)),this.qf&&this.qf.flush().catch(t=>this.lp(t)))}lp(t){Sk(t)||this.$.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.mo||!this.If||this.Mf||this.Ef)return;const t=null==d?void 0:d.__PosthogExtensions__;if(!t)return this.$.error("PostHog Extensions not found."),void this.Yf();const e=t.loadExternalDependency;if(!e)return this.$.error(Vt),void this.Yf();this.Ef=!0;try{e(this._instance,"logs",e=>{if(this.Ef=!1,this.mo||!this.If)return;const i=t.logs;if(e||!(null==i?void 0:i.initializeLogs))this.$.error("Could not load logs script",e),this.Yf();else{var n;const t=this.sp();var s,r;this.Xf=i.initializeLogs(null!==(n=this.uo)&&void 0!==n?n:this._instance),this.Mf=!0,t.length>0&&(null===(s=i.replayConsoleBuffer)||void 0===s||s.call(i,null!==(r=this.uo)&&void 0!==r?r:this._instance,t))}})}catch(t){throw this.Ef=!1,t}}Bf(t,e){const i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===ae.LogsQueue?t():void 0,setPersistedProperty(t,i){var n;t===ae.LogsQueue&&e(null!==(n=i)&&void 0!==n?n:[])},Ps:t=>this.Ps(t),getLibraryId:()=>ql.LIB_NAME,getLibraryVersion:()=>ql.LIB_VERSION}}Ps(t){return new Promise(e=>{if(Xs(this.Gc,3))return void e({kind:"fatal",error:kk(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const n=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),n({kind:"retry-later",error:kk(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.ap(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{const e=t.statusCode;if(this.up(e),e>=200&&300>e)n({kind:"ok"});else if(413===e)n({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)n({kind:"fatal",error:new Error(`logs request failed with status ${e}`)});else{var i;0===e?(t.error||this.$.warn("Logs request failed before receiving an HTTP response"),n({kind:"retry-later",error:kk(t.error,"logs request failed before receiving an HTTP response")})):n({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`logs request failed with status ${e}`)})}}})})}up(t){(0!==t||this._instance.__loaded)&&(this.Gc=tr(t,this.Gc,3,()=>this.$.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}op(t){this.Jl.length>0&&this.hp(t,this.Jl,this.Wf,ql.LIB_NAME,t=>{this.Jl=t}),this.Rf.length>0&&this.hp(t,this.Rf,this.Zf,_k,t=>{this.Rf=t})}hp(t,e,i,n,s){if(0===e.length)return;const r=e.map(t=>t.record);s([]);const o=ks(r,ws(i,ql.LIB_NAME,ql.LIB_VERSION),n,ql.LIB_VERSION);this._instance._send_request({method:"POST",url:this.ap(),data:o,compression:"best-available",batchKey:"logs",transport:t})}ap(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Hf(){var t;const e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:t,windowId:i,sessionStartTimestamp:n,lastActivityTimestamp:s}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=t,e.windowId=i,Me(n)||(e.sessionStartTimestamp=n),Me(s)||(e.lastActivityTimestamp=s)}if((null==d||null===(t=d.location)||void 0===t?void 0:t.href)&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?sn(d.location.href):d.location.href),this._instance.featureFlags){const t=this._instance.featureFlags.getFlags();t&&t.length>0&&(e.activeFeatureFlags=t)}return e}}},Dk={metrics:class{constructor(t){this._instance=t,this.$=As("[metrics]")}initialize(){}zf(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;var i;return this.Nf&&this.Uf===e||(null===(i=this.Nf)||void 0===i||i.reset(),this.Uf=e,this.Nf=new Ts(this.Bf(),function(t){var e,i,n,s,r;const o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(e=null==o?void 0:o["service.name"])&&void 0!==e?e:null==t?void 0:t.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==t?void 0:t.serviceVersion,environment:null!==(n=null==o?void 0:o["deployment.environment"])&&void 0!==n?n:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(r=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(e),this.$)),this.Nf}count(t,e=1,i){this.zf().count(t,e,i)}gauge(t,e,i){this.zf().gauge(t,e,i)}histogram(t,e,i){this.zf().histogram(t,e,i)}flush(t){if(!this.Nf)return Promise.resolve();if(t){const e=this.Nf.drainWindow();return e&&this.Gs(e,t),Promise.resolve()}return this.Nf.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.Nf)||void 0===t||t.reset()}Bf(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Gs:t=>e.Gs(t),getLibraryId:()=>ql.LIB_NAME,getLibraryVersion:()=>ql.LIB_VERSION}}Gs(t,e){return new Promise(i=>{let n=!1;const s=t=>{n||(n=!0,clearTimeout(r),i(t))},r=setTimeout(()=>s({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(le(le({method:"POST",url:this.cp(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e}),{},{fireCallbackOnDrop:!0,callback(t){const e=t.statusCode;if(e>=200&&300>e)s({kind:"ok"});else if(413===e)s({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)s({kind:"fatal",error:new Error(`metrics request failed with status ${e}`)});else{var i;s({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`metrics request failed with status ${e}`)})}}}))})}cp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};Ew.__defaultExtensionClasses=le({},le(le(le(le(le(le(le(le(le(le(le(le(le({},xk),Ck),$k),Tk),Ik),Mk),Pk),Ek),Rk),Ak),Fk),Ok),Dk)),function(){ql.SDK_DIST_CHANNEL="cdn";const e=d.posthog;if(e&&!we(e._i))return;const i=vw[Sw]=new Ew;if(e){const t=[];Os(e._i,function(n){if(n&&we(n)){const s=i.init(n[0],n[1],n[2]),r=e[n[2]]||e;s.__loaded&&-1===t.indexOf(r)&&(t.push(r),s._execute_array.call(s.people,r.people),s._execute_array(r))}})}i.__SV=1,d.posthog=i,function(){function e(){e.done||(e.done=!0,xw=!1,Os(vw,function(t){t._dom_loaded()}))}(null==n?void 0:n.addEventListener)?"complete"===n.readyState?e():Us(n,"DOMContentLoaded",e,{capture:!1}):t&&Rs.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}()}();
2
2
  //# sourceMappingURL=array.full.js.map