posthog-js 1.431.2 → 1.431.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/module.full.cjs +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.no-external.cjs +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.no-external.cjs +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/rrweb.js +1 -1
- package/dist/rrweb.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +5 -5
package/dist/module.full.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const t="u">typeof window?window:void 0,e="u">typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,n=null==e?void 0:e.document,s=null==e?void 0:e.location,r=null==e?void 0:e.fetch,o=(null==e?void 0:e.XMLHttpRequest)&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,l=null==e?void 0:e.AbortController,a=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent;function h(){return!(!t||!1===t.navigator.onLine)}const c="undefined"!=typeof globalThis?globalThis:t;c&&"undefined"==typeof self&&(c.self=c),c&&"undefined"==typeof File&&(c.File=function(){});const d=null!=t?t:{},v="$people_distinct_id",f="distinct_id",p="$device_id",g="$device_model",m="__alias",y="__cmpns",_="$fbc",b="$fbc_persistence",w="__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",E="$web_vitals_enabled_server_side",I="$dead_clicks_enabled_server_side",M="$product_tours_enabled_server_side",R="$logs_capture_enabled_server_side",P="$web_vitals_allowed_metrics",O="$session_recording_remote_config",A="$session_recording_enabled_server_side",F="$replay_sample_rate",D="$replay_override_sampling",L="$replay_override_linked_flag",N="$replay_override_url_trigger",q="$replay_override_event_trigger",B="$sesid",j="$session_is_sampled",H="$session_past_minimum_duration",U="$session_recording_url_trigger_activated_session",z="$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",_t="$conversations_user_traits",bt="$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",Et="$initial_referrer_info",It="$initial_person_info",Mt="$epp",Rt="$posthog_cookieless",Pt="$cookieless_mode",Ot="$sdk_debug_extensions_init_method",At="$sdk_debug_extensions_init_time_ms",Ft="$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",Bt="$sdk_debug_replay_remote_trigger_matching_config",jt="$sdk_debug_replay_trigger_groups_count",Ht="$sdk_debug_replay_url_trigger_status",Ut="$sdk_debug_rrweb_attached",zt="$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,_e=ye.hasOwnProperty,be=ye.toString,we=Array.isArray||function(t){return"[object Array]"===be.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(_e.call(t,e))return!1;return!0}return!1},Ce=t=>void 0===t,$e=t=>"[object String]"==be.call(t),Te=t=>$e(t)&&0===t.trim().length,Ee=t=>null===t,Ie=t=>Ce(t)||Ee(t),Me=t=>"[object Number]"==be.call(t)&&t==t,Re=t=>Me(t)&&t>0,Pe=t=>"[object Boolean]"===be.call(t),Oe=t=>t instanceof FormData,Ae=t=>fe(de,t),Fe=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 Be(t,Error)}}function qe(t){return"u">typeof Event&&Be(t,Event)}function Be(t,e){try{return t instanceof e}catch(t){return!1}}const je=[!0,"true",1,"1","yes"],He=t=>fe(je,t),Ue=[!1,"false",0,"0","no"],ze=["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 ze.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),Me(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",_i="Ouya",bi="Generic "+Ze.toLowerCase(),wi="Generic "+Je.toLowerCase(),ki="Konqueror",Si="Oculus Browser",xi="Vivaldi",Ci="Yandex",$i="Whale",Ti="DuckDuckGo",Ei="Pale Moon",Ii="Waterfox",Mi="Brave",Ri="Claude",Pi="Codex",Oi="ChatGPT",Ai="Google Search App",Fi=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"),Bi=new RegExp("BlackBerry|PlayBook|BB10","i"),ji={"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)?Mi:null}(i);return s||((null==n?void 0:n.detectGoogleSearchApp)&&fe(t,"GSA/")?Ai:fe(t," OPR/")&&fe(t,"Mini")?"Opera Mini":fe(t," OPR/")?li:Bi.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/")?Ri:fe(t,"Codex/")?Pi:fe(t,"ChatGPT/")?Oi: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/")?Mi:((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/")?Ei:fe(t,"Waterfox/")?Ii:fe(t,ui)?ui:fe(t,"MSIE")||fe(t,"Trident/")?ri:fe(t,"Gecko")?ui:"")},Ui={[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]:[Fi],[pi]:[Fi],[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+)?)"),Fi],[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+)?)")],[Mi]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ri]:[Di],[Pi]:[Di],[Oi]:[Di],[Ti]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ei]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Ai]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ri]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},zi=function(t,e,i,n){const s=Hi(t,e,i,n),r=Ui[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,""]],[Bi,[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=ji[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(_i,"i").test(t)?_i: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:Bi.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)?bi: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===_i?"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}function tn(t,e){if(!e)return t;let i=[];try{i=Object.keys(e)}catch(t){i=[]}for(const n of i){let i;try{i=e[n]}catch(t){i=Yi}Object.defineProperty(t,n,{value:i,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;const en=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function nn(t,e){return"string"==typeof(i=t)&&en.test(i)?t:e();var i}function sn(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 rn(t){return t?t.split("#")[0]:t}function on(t){try{return t()}catch(t){return}}function ln(t,e){const i=setTimeout(t,e);return null!=i&&i.unref&&(null==i||i.unref()),i}function an(t,e,i){return un.apply(this,arguments)}function un(){return(un=ne(function*(t,e,i){let n;try{return yield Promise.race([t,new Promise((t,s)=>{n=ln(()=>{try{null==i||i(),t()}catch(t){s(t)}},e)})])}finally{clearTimeout(n)}})).apply(this,arguments)}let hn,cn,dn;function vn(t){const e=globalThis._posthogChunkIds;if(!e)return;const i=Object.keys(e);return dn&&i.length===cn||(cn=i.length,dn=i.reduce((i,n)=>{hn||(hn={});const s=hn[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,hn[n]=[o,l];break}}}return i},{})),dn}var fn=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:vn(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)})}};const pn=/^([a-z][a-z0-9.+-]+):/i,gn=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function mn(t){if(!t||"<anonymous>"===t)return!1;const e=pn.exec(t);return!e||gn.includes(e[1].toLowerCase())}function yn(t,e,i,n,s){const r={platform:t,filename:e,function:"<anonymous>"===i?"?":i,in_app:mn(e)};return Ce(n)||(r.lineno=n),Ce(s)||(r.colno=s),r}const _n=(t,e)=>{const i=-1!==t.indexOf("safari-extension"),n=-1!==t.indexOf("safari-web-extension");return i||n?[-1!==t.indexOf("@")?t.split("@")[0]:"?",i?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},bn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,wn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,kn=/\((\S*)(?::(\d+))(?::(\d+))\)/,Sn=(t,e)=>{const i=bn.exec(t);if(i){const[,t,n,s]=i;return yn(e,t,"?",+n,+s)}const n=wn.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){const t=kn.exec(n[2]);t&&(n[2]=t[1],n[3]=t[2],n[4]=t[3])}const[t,i]=_n(n[1]||"?",n[2]);return yn(e,i,t,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},xn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Cn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,$n=(t,e)=>{const i=xn.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const t=Cn.exec(i[3]);t&&(i[1]=i[1]||"eval",i[3]=t[1],i[4]=t[2],i[5]="")}let t=i[3],n=i[1]||"?";return[n,t]=_n(n,t),yn(e,t,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Tn=/\(error: (.*)\)/;function En(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function In(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(!En(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 Mn(t,e){const i=e.start+e.length,n=Pn(t,e);n&&t.splice(i+n===t.length?i:e.start,n)}function Rn(t,e){let i=e.start;for(;i>0&&En(t[i-1],t[i-1+e.length]);)i--;return e.start-i}function Pn(t,e){const i=e.start+e.length;let n=i;for(;t.length>n&&En(t[n],t[n-e.length]);)n++;return n-i}function On(t,e){const i=e[0];let n=t.length-(i?Rn(t,i):0);for(const i of e)n-=Pn(t,i);return n}function An(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 Fn=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")}},Dn=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}},Ln=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 Nn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var qn=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(Nn);return n&&(e=n[1],i=n[2]),[e,i]}};const Bn=["fatal","error","warning","log","info","debug"];function jn(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 Hn=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: ${jn(t)}`}isSeverityLevel(t){return $e(t)&&!Te(t)&&Bn.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}}},Un=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: ${jn(t)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},zn=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}}},Wn=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 Vn="$message",Gn="$timestamp",Zn=new Set([Vn,Gn]),Qn={enabled:!0,max_bytes:32768};function Jn(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Qn.enabled,max_bytes:Yn(t.max_bytes,Qn.max_bytes)}:le({},Qn)}var Kn=class{constructor(t){this.ts=[],this.es=0,this.Mr=Jn(t)}setConfig(t){this.Mr=Jn(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[Vn],s=i[Gn];if(!$e(n)||0===n.trim().length)return;if(!$e(s)&&!Me(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 Yn(t,e){if(!Me(t)||1/0===t||-1/0===t)return e;const i=Math.floor(t);return 0>i?e:i}const Xn=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function ts(t){return"string"==typeof t||t}function es(t){return"string"==typeof t?t:void 0}const is=["$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"],ns="NativeGzipValidationError",ss=t=>t.length>=2&&31===t[0]&&139===t[1],rs=(t,e)=>t===ue.GZipJS||e===ue.GZipJS||"gzip"===e,os=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),ls=t=>{if(!t||"object"!=typeof t)return!1;const e="name"in t?String(t.name):"";return os(t)||e===ns};let as;const us=t=>{throw sn(ns,`Native gzip produced invalid output: ${t}`)},hs=(cs=ne(function*(t,e){18>t.size&&us("too-short");const i=new Uint8Array(yield t.slice(0,10).arrayBuffer());ss(i)&&8===i[2]||us("invalid-header");const n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{const e=(()=>{if(as)return as;as=[];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;as[t]=e>>>0}return as})();let i=4294967295;for(let n=0;t.length>n;n++)i=e[255&(i^t[n])]^i>>>8;return(4294967295^i)>>>0})(e)&&us("invalid-crc");const s=e.length>>>0;n.getUint32(4,!0)!==s&&us("invalid-size")}),function(t,e){return cs.apply(this,arguments)});var cs;function ds(t){return vs.apply(this,arguments)}function vs(){return vs=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 hs(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}),vs.apply(this,arguments)}const fs=3e5;var ps=class{record(t){if("too-large"===t.kind)return;if("retry-later"!==t.kind)return void this.reset();if(!t.retryAfterMs)return;const e=this.isOpen(),i=Date.now(),n=Math.min(t.retryAfterMs,fs);if(!e)return this.ss=i,void(this.rs=i+n);this.rs=Math.max(this.rs,Math.min(i+n,this.ss+fs))}remainingMs(){const t=Date.now();if(this.ss-5e3>t)return this.reset(),0;const e=Math.min(fs,Math.max(0,this.rs-t));return 0===e&&this.reset(),e}isOpen(){return this.remainingMs()>0}reset(){this.rs=0,this.ss=0}constructor(){this.rs=0,this.ss=0}};function gs(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 ms={}.propertyIsEnumerable;function ys(t,e){try{return ws(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function _s(t,e,i,n){if(0>=i.remainingNodes)return{stringValue:Ki};if(i.remainingNodes--,Pe(t))return{boolValue:t};if("bigint"==typeof t)return function(t,e){const i=t.toString(),n=BigInt("9223372036854775808");return t>=n||-n>t?(null==e||e.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}(t,e);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const i=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==e||e.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:t}}if("string"==typeof t)return{stringValue: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 _s(s.call(t),e,i,n+1)}catch(t){}return we(t)?{arrayValue:{values:bs(t,e,i,n+1)}}:{kvlistValue:{values:ws(t,e,i,n+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:Xi(String(t))}}function bs(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(Ie(r))continue;s.push(_s(r,e,i,n))}catch(t){s.push({stringValue:Yi})}return t.length>o&&s.push({stringValue:Ki}),s}function ws(t,e,i,n){const s=[];for(const r in t)if(ms.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(Ee(o)||Ce(o))continue;s.push({key:Xi(r),value:_s(o,e,i,n)})}catch(t){s.push({key:Xi(r),value:{stringValue:Yi}})}}return s}function ks(t,e,i){return le(le(le(le({},tn({},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 Ss=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function xs(t,e){const i=tn({},t),n={};for(const t of Ss)({}).hasOwnProperty.call(i,t)&&(n[t]=i[t],delete i[t]);return[...ys(i,e),...ys(n,e)]}const Cs={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"};const $s={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}},Ts=$s.info;function Es(t){try{return Xi(String(t))}catch(t){return Yi}}function Is(t,e,i,n){const s=t.level||"info",{text:r,number:o}=$s[s]||Ts,l=function(t=Date.now()){return String(t)+"000000"}(Me(n)?n:void 0),a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),Ie(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),Ie(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:Es(t.body)},attributes:ys(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 Ms(t,e,i){return ks(t,e,i)}function Rs(t,e,i,n){return{resourceLogs:[{resource:{attributes:xs(e)},scopeLogs:[{scope:{name:i,version:n},logRecords:t}]}]}}var Ps=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.hs}arm(t){this.clear(),this.us=Date.now()+t,this.hs=ln(()=>{this.hs=void 0,this.ls()},t)}armNoEarlierThan(t){this.hs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function Os(){return.75+.5*Math.random()}function As(t,e,i,n){const s=Math.min(Math.max(0,e-1),6),r=t*Math.pow(2,s);return Math.round((void 0===n?r:Math.min(r,Math.max(n,t)))*i)}var Fs=class{constructor(t,e,i,n,s,r=()=>Promise.resolve(),o){var l;this._instance=t,this.Mr=e,this.$=i,this.cs=n,this.ds=s,this.vs=r,this.fs=o,this.ps=new Ps(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new ps,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=e.maxBufferSize,this.Is=Math.max(null!==(l=e.maxQueueSize)&&void 0!==l?l:e.maxBufferSize,e.maxBufferSize),this.Ms=e.flushIntervalMs,this.Es=e.maxBatchRecordsPerPost,this.Ps=e.rateCapWindowMs,this.Rs=e.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(ae.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(t,e){var i;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==t?void 0:t.body))return;const n=this.Os(t);if(null===n)return;if(!n.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const s={record:Is(n,null!==(i=null==e?void 0:e.context)&&void 0!==i?i:this.cs(),this.$,null==e?void 0:e.occurredAtMs)};this.ds(()=>this.Ls(s))}Os(t){const e=this.Mr.beforeSend;if(!e)return t;const i=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}Ds(){if(void 0===this.Rs)return!0;const t=Date.now(),e=t-this.xs;return this.Ps>e&&e>=0||(this.xs=t,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var t=this;return ne(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null})),t.ys})()}Ns(){var t=this;return ne(function*(){var e;t.ps.clear();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._s;t.bs=0;const n=Math.min(i.length,t.Es),l=i.slice(0,n),a=Rs(l.map(t=>t.record),t.qs(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.js(a);if(t._s!==e)return;if("too-large"===u.kind&&l.length>1)t.Es=Math.max(1,Math.floor(l.length/2)),t.$.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${t.Es}`);else{if(t.ws.record(u),t.ps.pending&&t.ps.arm(Math.max(t.Ms,t.ws.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.Mr.maxBatchRecordsPerPost>t.Es&&(t.Es=Math.min(t.Mr.maxBatchRecordsPerPost,t.Es+1)),yield t.Bs(l.length),i=null!==(o=t._instance.getPersistedProperty(ae.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===u.kind)throw u.error}}})()}Bs(t){var e=this;return ne(function*(){var i;const n=Math.max(0,t-e.bs),s=null!==(i=e._instance.getPersistedProperty(ae.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(ae.LogsQueue,s.slice(n)),yield e.vs()})()}qs(){return Ms(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var e;if(this._instance.optedOut)return;const i=null!==(e=this._instance.getPersistedProperty(ae.LogsQueue))&&void 0!==e?e:[];this.Is>i.length||(i.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(ae.LogsQueue,i),this.Ts>i.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(As(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const t=this._instance.getPersistedProperty(ae.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return ne(function*(){e.ps.clear();const i=e.flush().catch(()=>{});void 0!==t?yield an(i,t):yield i})()}flushWithTimeout(t){var e=this;return ne(function*(){const i=e.flush();yield an(i,t,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},t=>{this.ks++,this.Ss=Os(),this.$.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const Ds=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Ls(t){return String(t)+"000000"}function Ns(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 qs=class{constructor(t,e,i){this._instance=t,this.Mr=e,this.$=i,this.zs=new Map,this.ps=new Ps(()=>this.flush().catch(t=>{this.$.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new ps,this.ks=0,this.Ss=1,this.Gs=0}count(t,e=1,i){this.Zs({name:t,type:"count",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(t,e,i){this.Zs({name:t,type:"gauge",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(t,e,i){this.Zs({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var t=this;const e=this.ys,i=function(){var i=ne(function*(){e&&(yield e.catch(()=>{})),yield t.Qs()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this.ys===i&&(this.ys=null)});return this.ys=i,i}drainWindow(){if(0===this.zs.size)return null;const t=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const e=this.Os(t);if(null===e)return;if(!e.name||"string"!=typeof e.name)return void this.$.warn("Dropping metric with empty name");if("number"!=typeof e.value||!Number.isFinite(e.value))return void this.$.warn(`Dropping metric '${e.name}': value must be a finite number`);if("count"===e.type&&0>e.value)return void this.$.warn(`Dropping count '${e.name}': counters are monotonic, value must be >= 0`);let i,n;try{i=e.attributes?le({},e.attributes):void 0,n=Ns(e.type,e.name,e.unit,i)}catch(t){return void this.$.warn(`Dropping metric '${e.name}': attributes could not be serialized`,t)}let s=this.zs.get(n);if(!s){if(!this.Ks())return;s={name:e.name,type:e.type,unit:e.unit,attributes:i,windowStartMs:Date.now()},this.zs.set(n,s)}const r=this.Ws.get(e.name);void 0===r?this.Ws.set(e.name,e.type):r===e.type||this.Vs.has(e.name)||(this.Vs.add(e.name),this.$.warn(`Metric name '${e.name}' is already used as a ${r}; recording it as a ${e.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(s,e.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(t,e){switch(t.type){case"count":var i;t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case"gauge":t.last=e;break;case"histogram":{t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(Ds.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,Ds)]+=1;break}}}Os(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}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(As(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var t=this;return ne(function*(){if(t.ps.clear(),0===t.zs.size)return;const e=t.zs;t.zs=new Map,t.Us=!1,t.Ws=new Map,t.Vs=new Set;const i=t.Gs,n=yield t._instance.Ys(t.Js(e));if(i===t.Gs)switch(t.ws.record(n),"retry-later"===n.kind?(t.ks++,t.Ss=Os()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.Hs()),n.kind){case"ok":return;case"retry-later":return t.lo(e),void t.ps.armNoEarlierThan(t.Hs());case"too-large":return void t.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.$.error("Failed to send metrics batch:",n.error)}})()}Js(t){return e=this.ao(t),i=function(t,e,i){return ks(t,e,i)}(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:xs(i)},scopeMetrics:[{scope:{name:n,version:s},metrics:e}]}]};var e,i,n,s}ao(t){const e=Ls(Date.now()),i=new Map;for(const o of t.values()){var n;const t=Ns(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=ys(null!==(n=o.attributes)&&void 0!==n?n:{},this.$),u=Ls(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:Ds})}return Array.from(i.values())}lo(t){for(const[n,s]of t){const t=this.zs.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,s.windowStartMs),t.type){case"count":var e,i;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(i=s.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(s.hist)if(t.hist){t.hist.count+=s.hist.count,t.hist.sum+=s.hist.sum,t.hist.min=Math.min(t.hist.min,s.hist.min),t.hist.max=Math.max(t.hist.max,s.hist.max);for(let e=0;t.hist.bucketCounts.length>e;e++)t.hist.bucketCounts[e]+=s.hist.bucketCounts[e]}else t.hist=s.hist}else this.Ks()&&this.zs.set(n,s)}}};function Bs(t,e){if(!t)return;const i=t.find(t=>t.type===e);return null==i?void 0:i.value}const js="0.8.3",Hs={DEBUG:!1,LIB_VERSION:js,LIB_NAME:"browser-common",JS_SDK_VERSION:js},Us=(e,{debugEnabled:i}={})=>{const n={N(n,...s){t&&(Hs.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)=>Us(`${e} ${t}`,i)};return n},zs=Us("[PostHog.js]"),Ws=zs.createLogger;function Vs(t,e){we(t)&&t.forEach(e)}function Gs(t,e){if(!Ie(t))if(we(t))t.forEach(e);else if(Oe(t))t.forEach((t,i)=>e(t,i));else for(const i in t)_e.call(t,i)&&e(t[i],i)}const Zs=function(t,...e){for(const i of e)for(const e in i)void 0!==i[e]&&(t[e]=i[e]);return t};function Qs(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 Js=function(t){return function(...e){try{return t.apply(this,e)}catch(t){zs.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),zs.critical(t)}}},Ks=function(t){const e={};return Gs(t,function(t,i){($e(t)&&t.length>0||Me(t))&&(e[i]=t)}),e};function Ys(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 Xs=["herokuapp.com","vercel.app","netlify.app"];function tr(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 Xs)if(i===t)return!1;return!0}function er(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 ir(t){return"ph_toolbar_internal"===t.name}const nr=["localhost","127.0.0.1"],sr=(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,Ys(e)),i.get(e)):"bigint"==typeof e?e.toString():e},e)}catch(e){return me(t)}},rr=t=>{const e=null==n?void 0:n.createElement("a");return Ce(e)?null:(e.href=t,e)},or=function(t,e="&"){let i,n;const s=[];return Gs(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)},lr=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){zs.error("Skipping decoding for malformed query param: "+t)}return t.replace(/\+/g," ")}},ar=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},ur=function(t,e){const i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},hr=(t,e)=>t>=e&&h(),cr=(t,e,i,n)=>{if(0===t){if(h()){const t=e+1;return t===i&&n(),t}return e}return 0};function dr(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 zs.error("Error in get_current_url, falling back to window.location.href",t),e}}function vr(e){var i;const n=null==t||null===(i=t.location)||void 0===i?void 0:i.href;return Ce(n)?void 0:dr(e,n)}function fr(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 pr(t){return!!t&&1===t.nodeType}function gr(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function mr(t){return!!t&&3===t.nodeType}function yr(t){return!!t&&11===t.nodeType&&pr(t.host)}function _r(t){return t?pe(t).split(/\s+/):[]}function br(t,e){const i=vr(e);return!!(i&&t&&t.some(t=>i.match(t)))}function wr(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 _r(e)}function kr(t){return Ie(t)?null:pe(t).split(/(\s+)/).filter(t=>Qr(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Sr(t){let e="";return Br(t)&&!jr(t)&&t.childNodes&&t.childNodes.length&&Gs(t.childNodes,function(t){var i;mr(t)&&t.textContent&&(e+=null!==(i=kr(t.textContent))&&void 0!==i?i:"")}),pe(e)}function xr(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 Cr=["a","button","form","input","select","textarea","label"];function $r(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 Tr(t,e){if(Ce(e))return!0;for(const i of t)if(e.some(t=>$r(i,t)))return!0;return!1}function Er(t){const e=t.parentNode;return!(!e||!pr(e))&&e}const Ir=[".ph-no-autocapture","[data-ph-no-autocapture]"],Mr=["next","previous","prev",">","<"],Rr=[...Mr,"+","-","−","–"],Pr=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Or=[".ph-no-deadclick",".ph-no-capture"],Ar=[".ph-no-rageclick",".ph-no-capture"],Fr=["","text","search","email","password","url","tel","number"];function Dr(t){return!(!t||!pr(t))&&(!!gr(t,"textarea")||(gr(t,"input")?fe(Fr,(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 Lr(e,i){if(!t||Nr(e))return!1;let n,s,r;var o,l;if(Pe(i)?(n=!!i&&Ar,s=void 0,r=!1):(n=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Ar,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&&Dr(e))return!1;const{targetElementList:a}=qr(e,!1);return!function(t,e){if(!1===t||Ce(t))return!1;let i;if(!0===t)i=Mr;else{if(!we(t))return!1;if(t.length>10)return zs.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=>Pr(t,i)||Pr(e,i)))}(s,a.map(t=>{var e;return{safeText:Sr(t).toLowerCase(),ariaLabel:(null===(e=t.getAttribute("aria-label"))||void 0===e?void 0:e.toLowerCase().trim())||""}}))&&!Tr(a,n)}const Nr=t=>!t||gr(t,"html")||!pr(t),qr=(e,i)=>{if(!t||Nr(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const s=[e];let r=e;for(;r.parentNode&&!gr(r,"body");){if(yr(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}const e=Er(r);if(!e)break;if(i||Cr.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 Br(t){const e=new Set;let i=0;for(let n=t;n.parentNode&&!gr(n,"body");n=n.parentNode){if(i++>=1e3||e.has(n))return!1;e.add(n);const t=wr(n);if(fe(t,"ph-sensitive")||fe(t,"ph-no-capture"))return!1}if(fe(wr(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 jr(t){return!!(gr(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||gr(t,"select")||gr(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const Hr=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}))$"),Ur=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,zr=[16,15,14,13],Wr=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Vr=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Gr=/[0-9A-Za-z_]/;function Zr(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 Qr(t,e=!0){if(Ie(t))return!1;if($e(t)){if(t=pe(t),e?Hr.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(Ur.lastIndex=0;e=Ur.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 zr){const n=t+e;if(i.length>=n){const e=i.slice(t,n);if(Hr.test(e)&&Zr(e))return!0}}}return!1}(t))return!1;if(e?Wr.test(t):function(t){let e;for(Vr.lastIndex=0;e=Vr.exec(t);){const t=e[1],i=e[3];if(!(t&&i&&Gr.test(t)&&Gr.test(i)))return!0}return!1}(t))return!1}return!0}function Jr(t){let e=Sr(t);return e=`${e} ${Kr(t)}`.trim(),Qr(e)?e:""}function Kr(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Gs(t.childNodes,function(t){var i;if(t&&"span"===(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=Sr(t);e=`${e} ${i}`.trim(),t.childNodes&&t.childNodes.length&&(e=`${e} ${Kr(t)}`.trim())}catch(t){zs.error("[AutoCapture]",t)}}),e}function Yr(t){return t.replace(/"|\\"/g,'\\"')}function Xr(t){const e=t.attr__class;if(e)return we(e)?e:_r(e)}const to=1e6;function eo(t){var e;return Math.min(to,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:to)}const io={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:to,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},no=["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"],so=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ro=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],oo=t=>{Ie(t)||Gs(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return no.includes(e)||ro.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},lo=["/s/","/e/","/i/"];function ao(t,e,i,n){if(Ie(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 uo(t,e){if(Ie(t))return t;let i=t;return Qr(i,!1)||(i="[SessionRecording] "+e+" body redacted"),Gs(so,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 ho=new WeakSet,co="disabled",vo="sampled",fo="active",po="buffering",go="paused",mo="lazy_loading",yo="rrweb_error",_o="trigger_activated",bo="trigger_pending",wo="trigger_disabled";function ko(t,e,i,n,s,r){return 0===e?wo:(null==t?void 0:t.get_property(i?n+i:s))===r?_o:bo}function So(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 xo(t){return t.includes("trigger_activated")?_o:t.includes("trigger_pending")?bo:wo}function Co(t){const e=new Set(t);switch(e.delete(wo),e.size){case 0:return wo;case 1:return Array.from(e)[0];default:return bo}}var $o=class{constructor(t){this.q=t}triggerStatus(t){return xo(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return xo(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},To=class{constructor(t){this.q=t}triggerStatus(t){return Co(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return Co(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},Eo=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return _o}stop(){}};const Io=t=>"sessionRecording"in t;var Mo=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=(Io(t)?Se(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.B=(Io(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){zs.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){zs.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}G(t){return ko(this._instance,this.j.length,this.V,V,U,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=vr(this._instance);if(!t)return!1;try{return So(t,this.B,this.U)}catch(t){return!0}}checkUrlBlocklist(t,e){const i=vr(this._instance);if(!i)return;if(i===this.W)return;this.W=i;const n=this.urlBlocked,s=So(i,this.B,this.U);n&&s||(s&&!n?t():!s&&n&&e())}checkUrlTriggerConditions(t,e,i,n){const s=vr(this._instance);if(!s)return;if(s===this.W)return;this.W=s;const r=this.urlBlocked,o=So(s,this.B,this.U);o&&!r?t():!o&&r&&e();const l=this.G(n)===_o,a=So(s,this.j,this.H);!l&&a&&i("url",s)}stop(){this.W=""}},Ro=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=bo;return Ie(this.linkedFlag)&&(t=wo),this.linkedFlagSeen&&(t=_o),t}onConfig(t,e){var i;if(this.linkedFlag=(Io(t)?Se(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!Ie(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=Pe(e)?!0===e:i?e===i:!!e}const o=r&&!this.linkedFlagSeen;this.linkedFlagSeen=r,o&&e(t,i)})}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.J()}},Po=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(Io(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 ko(this._instance,this.K.length,this.V,W,z,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)===_o,s=this.K.includes(t);!n&&s&&e("event",t)}stop(){}},Oo=class{constructor(t,e,i){if(this._instance=t,this.group=e,this.Y=new Mo(t,e.id),this.tt=new Po(t,e.id),this.et=new Ro(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 $o(s):new To(s)}else this.nt=new Eo}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===bo).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 Ao(t){if(t.rrwebError)return yo;if(!t.receivedFlags)return po;if(!t.isRecordingEnabled)return co;if(t.urlTriggerMatching.urlBlocked)return go;const e=!0===t.isSampled,i=new $o([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?vo:"trigger_activated"===i?fo:"trigger_pending"===i?po:!1===t.isSampled?co:fo}function Fo(t){if(t.rrwebError)return yo;if(!t.receivedFlags)return po;if(!t.isRecordingEnabled)return co;if(t.urlTriggerMatching.urlBlocked)return go;const e=new To([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),i=e!==wo,n=Pe(t.isSampled);return i&&"trigger_pending"===e?po:i&&"trigger_disabled"===e||n&&!t.isSampled?co:!0===t.isSampled?vo:fo}function Do(){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 Lo(t){const e=JSON.stringify(t,Do());return e?new Blob([e]).size:0}function No(t){if(Ee(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)||Ee(n)?4:No(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+No(s))}return i}default:return 0}}function qo(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[qo({size:i.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),qo({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 Bo=Uint8Array,jo=Uint16Array,Ho=Uint32Array,Uo=new Bo([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]),zo=new Bo([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]),Wo=new Bo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Vo=function(t,e){for(var i=new jo(31),n=0;31>n;++n)i[n]=e+=1<<t[n-1];var s=new Ho(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]},Go=Vo(Uo,2),Zo=Go[1];Go[0][28]=258,Zo[258]=28;for(var Qo=Vo(zo,0)[1],Jo=new jo(32768),Ko=0;32768>Ko;++Ko){var Yo=(43690&Ko)>>>1|(21845&Ko)<<1;Jo[Ko]=((65280&(Yo=(61680&(Yo=(52428&Yo)>>>2|(13107&Yo)<<2))>>>4|(3855&Yo)<<4))>>>8|(255&Yo)<<8)>>>1}var Xo=function(t,e,i){for(var n=t.length,s=0,r=new jo(e);n>s;++s)++r[t[s]-1];var o,l=new jo(e);for(s=0;e>s;++s)l[s]=l[s-1]+r[s-1]<<1;if(i){o=new jo(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[Jo[c]>>>a]=u}else for(o=new jo(n),s=0;n>s;++s)o[s]=Jo[l[t[s]-1]++]>>>15-t[s];return o},tl=new Bo(288);for(Ko=0;144>Ko;++Ko)tl[Ko]=8;for(Ko=144;256>Ko;++Ko)tl[Ko]=9;for(Ko=256;280>Ko;++Ko)tl[Ko]=7;for(Ko=280;288>Ko;++Ko)tl[Ko]=8;var el=new Bo(32);for(Ko=0;32>Ko;++Ko)el[Ko]=5;var il=Xo(tl,9,0),nl=Xo(el,5,0),sl=function(t){return(t/8|0)+(7&t&&1)},rl=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var n=new(t instanceof jo?jo:t instanceof Ho?Ho:Bo)(i-e);return n.set(t.subarray(e,i)),n},ol=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8},ll=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8,t[n+2]|=i>>>16},al=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 Bo(0),0];if(1==s){var o=new Bo(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 jo(d+1),f=ul(i[h-1],v,0);if(f>e){n=0;var p=0,g=f-e,m=1<<g;for(r.sort(function(t,e){return v[e.s]-v[t.s]||t.f-e.f});s>n;++n){var y=r[n].s;if(e>=v[y])break;p+=m-(1<<f-v[y]),v[y]=e}for(p>>>=g;p>0;){var _=r[n].s;e>v[_]?p-=1<<e-v[_]++-1:++n}for(;n>=0&&p;--n){var b=r[n].s;v[b]==e&&(--v[b],++p)}f=e}return[new Bo(v),f]},ul=function(t,e,i){return-1==t.s?Math.max(ul(t.l,e,i+1),ul(t.r,e,i+1)):e[t.s]=i},hl=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new jo(++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]},cl=function(t,e){for(var i=0,n=0;e.length>n;++n)i+=t[n]*e[n];return i},dl=function(t,e,i){var n=i.length,s=sl(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)},vl=function(t,e,i,n,s,r,o,l,a,u,h){ol(e,h++,i),++s[256];for(var c=al(s,15),d=c[0],v=c[1],f=al(r,15),p=f[0],g=f[1],m=hl(d),y=m[0],_=m[1],b=hl(p),w=b[0],k=b[1],S=new jo(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=al(S,7),T=C[0],E=C[1],I=19;I>4&&!T[Wo[I-1]];--I);var M,R,P,O,A=u+5<<3,F=cl(s,tl)+cl(r,el)+o,D=cl(s,d)+cl(r,p)+o+14+3*I+cl(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(F>=A&&D>=A)return dl(e,h,t.subarray(a,a+u));if(ol(e,h,1+(F>D)),h+=2,F>D){M=Xo(d,v,0),R=d,P=Xo(p,g,0),O=p;var L=Xo(T,E,0);for(ol(e,h,_-257),ol(e,h+5,k-1),ol(e,h+10,I-4),h+=14,x=0;I>x;++x)ol(e,h+3*x,T[Wo[x]]);h+=3*I;for(var N=[y,w],q=0;2>q;++q){var B=N[q];for(x=0;B.length>x;++x)ol(e,h,L[j=31&B[x]]),h+=T[j],j>15&&(ol(e,h,B[x]>>>5&127),h+=B[x]>>>12)}}else M=il,R=tl,P=nl,O=el;for(x=0;l>x;++x)if(n[x]>255){var j;ll(e,h,M[257+(j=n[x]>>>18&31)]),h+=R[j+257],j>7&&(ol(e,h,n[x]>>>23&31),h+=Uo[j]);var H=31&n[x];ll(e,h,P[H]),h+=O[H],H>3&&(ll(e,h,n[x]>>>5&8191),h+=zo[H])}else ll(e,h,M[n[x]]),h+=R[n[x]];return ll(e,h,M[256]),h+R[256]},fl=new Ho([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),pl=new Bo(0),gl=function(){for(var t=new Ho(256),e=0;256>e;++e){for(var i=e,n=9;--n;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),ml=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function yl(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=gl[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 Bo(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=dl(a,u,t.subarray(h,c)):(a[h]=r,u=dl(a,u,t.subarray(h,o)))}else{for(var d=fl[e-1],v=d>>>13,f=8191&d,p=(1<<i)-1,g=new jo(32768),m=new jo(p+1),y=Math.ceil(i/3),_=2*y,b=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<_)&p},w=new Ho(25e3),k=new jo(288),S=new jo(32),x=0,C=0,T=(h=0,0),E=0,I=0;o>h;++h){var M=b(h),R=32767&h,P=m[M];if(g[R]=P,m[M]=R,h>=E){var O=o-h;if((x>7e3||T>24576)&&O>423){u=vl(t,a,0,w,k,S,C,T,I,h-I,u),T=x=C=0,I=h;for(var A=0;286>A;++A)k[A]=0;for(A=0;30>A;++A)S[A]=0}var F=2,D=0,L=f,N=R-P&32767;if(O>2&&M==b(h-N))for(var q=Math.min(v,O)-1,B=Math.min(32767,h),j=Math.min(258,O);B>=N&&--L&&R!=P;){if(t[h+F]==t[h+F-N]){for(var H=0;j>H&&t[h+H]==t[h+H-N];++H);if(H>F){if(F=H,D=N,H>q)break;var U=Math.min(N,H-2),z=0;for(A=0;U>A;++A){var W=h-N+A+32768&32767,V=W-g[W]+32768&32767;V>z&&(z=V,P=W)}}}N+=(R=P)-(P=g[R])+32768&32767}if(D){w[T++]=268435456|Zo[F]<<18|Qo[D];var G=31&Zo[F],Z=31&Qo[D];C+=Uo[G]+zo[Z],++k[257+G],++S[Z],E=h+F,++x}else w[T++]=t[h],++k[t[h]]}}u=vl(t,a,r,w,k,S,C,T,I,h-I,u),r||(u=dl(a,u,pl))}return rl(l,0,n+sl(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&&ml(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),ml(u,h-8,i.d()),ml(u,h-4,n),u}function _l(t,e){var i=t.length;if(!e&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new Bo(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 Bo(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 rl(n,0,s)}function bl(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 wl=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=No(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,$:zs}),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=Me(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 kl=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 Me(t)&&isFinite(t)&&Math.floor(t)===t});var Sl=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}},xl=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 Me(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 Sl.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 $l}};let Cl=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&&(Cl=t=>crypto.getRandomValues(t));var $l=class{nextUint32(){return this.Rt.length>this.$t||(Cl(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let Tl;const El=()=>Il().toString(),Il=()=>(Tl||(Tl=new xl)).generate();let Ml="";const Rl=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Pl=null;const Ol={Et(){if(!Ee(Pl))return Pl;if(Pl=!1,n)try{const t=`__ph_cookie_support_${El()}`;Ol.At(t,"xyz"),Pl='"xyz"'===kl(t),Ol.Lt(t)}catch(t){Pl=!1}return Pl},Pt(t){zs.error("cookieStore error: "+t)},Ot:kl,Dt(t){let e;try{e=JSON.parse(Ol.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(Ml)return Ml;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_"+El();for(;!Ml&&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",Ml=t)}return Ml}(t);if(!e){const i=(t=>{const e=t.match(Rl);return e?e[0]:""})(t);i!==e&&zs.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&&zs.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{Ol.At(t,"",-1,e)}catch(t){return}}};let Al=null;const Fl={Et(){if(!Ee(Al))return Al;let e=!0;if(Ce(t))e=!1;else try{const t="__mplssupport__";Fl.At(t,"xyz"),'"xyz"'!==Fl.Ot(t)&&(e=!1),Fl.Lt(t)}catch(t){e=!1}return e||zs.error("localStorage unsupported; falling back to cookie store"),Al=e,e},Pt(t){zs.error("localStorage error: "+t)},Ot(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Fl.Pt(t)}return null},Dt(t){try{return JSON.parse(Fl.Ot(t))||{}}catch(t){}return null},At(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Fl.Pt(t)}return!1},Lt(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Fl.Pt(t)}}},Dl=[rt,K,J,X,tt,et,St,kt,bt],Ll=[p,f,B,j,Mt,It,b,xt],Nl=t=>t+"_cpm",ql=["__proto__","constructor","prototype"],Bl=t=>{if(!Se(t))return{};const e={};return Object.keys(t).forEach(i=>{-1===ql.indexOf(i)&&(e[i]=t[i])}),e},jl=(t,e=[])=>{const i={};return[...Ll,...e].forEach(e=>{const n=t[e];Ce(n)||Ee(n)||""===n||(i[e]=n)}),i},Hl=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)},Ul=(t,e)=>({p:e,f:Hl(JSON.stringify(t))}),zl=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const i=Ol.Dt(Nl(t)),n=(null==i?void 0:i.f)===Hl(e)&&we(i.p);return{properties:n?i.p:[],isValid:n}}catch(t){return{properties:[],isValid:!1}}},Wl=(t,e)=>e+"|"+(Ol.Ot(Nl(t))||""),Vl={},Gl={Et:()=>!0,Pt(t){zs.error("memoryStorage error: "+t)},Ot:t=>t in Vl?Vl[t]:null,Dt:t=>t in Vl?Vl[t]:null,At:(t,e)=>(Vl[t]=e,!0),Lt(t){delete Vl[t]}};let Zl=null;const Ql={Et(){if(!Ee(Zl))return Zl;if(Zl=!0,Ce(t))Zl=!1;else try{const t="__support__";Ql.At(t,"xyz"),'"xyz"'!==Ql.Ot(t)&&(Zl=!1),Ql.Lt(t)}catch(t){Zl=!1}return Zl},Pt(t){zs.error("sessionStorage error: ",t)},Ot(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Ql.Pt(t)}return null},Dt(t){try{return JSON.parse(Ql.Ot(t))||null}catch(t){}return null},At(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Ql.Pt(t)}return!1},Lt(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Ql.Pt(t)}}};Hs.DEBUG=!1,Hs.LIB_VERSION="1.431.2",Hs.LIB_NAME="web";var Jl=Hs,Kl=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)&&Me(i.size)&&e.sessionId===t?e.size:0;var i}};function Yl(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,zs)}function Xl(t){return`$survey_response_${t}`}function ta(t,e){if(!e)return null;const i=t[Xl(e)];return we(i)?[...i]:i}function ea(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=ta(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:ta(t,e.id)}})},t),n)}function ia(t={}){return Object.values(t).some(t=>!Ie(t))}function na(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 sa(t){return"string"==typeof t&&t.trim()?t.trim():null}function ra(t){return t.toLowerCase()}function oa(t,e,i){if(!t||!e)return null;const n=ra(e),s=Object.keys(t).find(t=>ra(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=>ra(t)===s);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${e})`),r}return null}const la=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function aa(t,e,i){var n;const s=oa(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 la){const n=e[i];Ce(n)||(t[i]=n,o=!0)}r.appearance=t}else(function(t){return la.some(e=>!Ce(t[e]))})(e)&&(o=!0)}const a=t.questions.map(t=>function(t,e,i){var n;const s=oa(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 ua(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 ha(t){var e;return ua(t)&&!!(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e?void 0:e.repeatedActivation)||"always"===t.schedule}const ca=(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}},da=t=>t.toLowerCase(),va={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=>ca(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!ca(e,t))),icontains:(t,e)=>e.map(da).some(e=>t.map(da).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(da).every(e=>t.map(da).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 fa(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=va[i.operator];return!!s&&s(i.values,[String(n)])})}function pa(t,e,i){return sr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}const ga=new Set(["is_not","not_icontains","not_regex"]);function ma(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)||Ee(s))return ga.has(r);const o=va[r];return!!o&&!Ce(t.value)&&!Ee(t.value)&&o(we(t.value)?t.value.map(String):[String(t.value)],we(s)?s.map(String):[String(s)])})}const ya=Ws("[SessionRecording]");function _a(t,e){return e?t:"!"+t}function ba(t,e){return t===e||t!=="!"+e&&null}var wa=class{constructor(t,e,i,n,s,r,o){this._instance=t,this.Y=e,this.tt=i,this.et=n,this.qt=s,this.jt=r,this.Bt=o,this.Ht=null,this.zt=Fo}onRemoteConfig(t){this.Ht=Me(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ut=new $o([this.tt,this.Y]),this.zt=Ao):(this.Ut=new To([this.tt,this.Y]),this.zt=Fo),this._instance.register_for_session({[Bt]:t.triggerMatchType}),this.Y.onConfig(t),this.tt.onConfig(t),this.et.onConfig(t,(t,e)=>{this.qt("linked_flag_matched",{flag:t,variant:e}),this.Bt()})}getStatus(t){return this.zt({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){const e=this._instance.get_property("$session_recording_remote_config"),i=null==e?void 0:e.minimumDurationMilliseconds;return Me(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&&Ie(this.Wt))return this.Wt=t(t=>{try{this.tt.checkEventTriggerConditions(t.event,i,e)}catch(t){ya.error("Could not activate event trigger",t)}}),this.Wt}makeSamplingDecisions(t){var e;const i=this.Ht;var n,s;if(!Me(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(j),o=this._instance.get_property(F),l=ba(r,t),a=Me(o)&&o!==i,u=Ce(o)&&r===t,h=a||u||!Pe(l),c=h?Yl(t,i):l;h&&(c?this.qt("sampled"):ya.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:_a(t,c),$replay_sample_rate:Ee(o)&&r===t?null:i})}ensureSamplingDecision(t){if(!Me(this.Ht))return;const e=this._instance.get_property(j);Pe(ba(e,t))||this.makeSamplingDecisions(t)}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,i,n,s;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_recording_event_trigger_activated_session"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_recording_url_trigger_activated_session"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_is_sampled"),null===(n=this._instance.persistence)||void 0===n||n.unregister("$replay_sample_rate"),null===(s=this._instance.persistence)||void 0===s||s.unregister("$session_past_minimum_duration")}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null===(e=this.Ut)||void 0===e?void 0:e.triggerStatus(t))===bo}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===bo).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()}},ka=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({[Bt]:"v2_trigger_groups",[jt]:t.triggerGroups.length}),this.Y.onConfig(t)):ya.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return yo;if(!t.receivedFlags)return po;if(!t.isRecordingEnabled)return co;if(t.urlTriggerMatching.urlBlocked)return go;const e=t.triggerGroupMatchers,i=t.triggerGroupSamplingResults;if(0===e.length)return co;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)?zs.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(s=!0)}else"trigger_pending"===e&&(n=!0)}return s?vo:n?po:co}({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;Me(t)&&(Ee(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 ya.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||ma(e.properties,t.properties,r))&&(i.activateTrigger(n,e),this.updateActiveTriggers(e),this.Bt(n))},e)}catch(t){ya.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=Me(i)&&i!==r,a=e===t&&Me(i)&&i===r&&Pe(n)?n:null}else a=l===t||null,u="string"==typeof l&&l!==t,c=l===t;const d=u||h||c||!Pe(a),v=d?Yl(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||ma(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 Oo(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 Sa=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],xa=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Sa],Ca="<masked>",$a=["li_fat_id"];function Ta(t,e,i){if(!n)return{};const s=e?[...Sa,...i||[]]:[],r=Ea(ar(n.URL,s,Ca),t),o=function(){const t={};return Gs($a,function(e){const i=kl(e);t[e]=i||null}),t}();return Zs(o,r)}function Ea(t,e){const i=xa.concat(e||[]),n={};return Gs(i,function(e){const i=lr(t,e);n[e]=i||null}),n}function Ia(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(!Ee(e)){s.$search_engine=e;const t=n?lr(n.referrer,i):"";t.length&&(s.ph_keyword=t)}return s}function Ma(){return navigator.language||navigator.userLanguage}function Ra(){const t=Ma();return"string"==typeof t?t.split("-")[0]:void 0}const Pa="$direct";function Oa(){return(null==n?void 0:n.referrer)||Pa}function Aa(t,e,i=!1){const n=t?[...Sa,...e||[]]:[],r=i?rn(null==s?void 0:s.href):null==s?void 0:s.href,o=null==r?void 0:r.substring(0,1e3);return{r:Oa().substring(0,1e3),u:o?ar(o,n,Ca):void 0}}function Fa(t,e=!1){var i;const{r:n,u:s}=t,r=e?rn(s):s,o={$referrer:n,$referring_domain:null==n?void 0:n==Pa?Pa:null===(i=rr(n))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const t=rr(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const e=Ea(r);Zs(o,e)}if(n){const t=Ia(n);Zs(o,t)}return o}function Da(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function La(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const Na=1e5,qa=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Ba=[],ja=()=>!1,Ha="@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(" "),Ua="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),za="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(" "),Wa="Accommodation AdministrativeArea Country Place State".split(" "),Va={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:Ua,publisher:za},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Ba},Offer:{seller:za},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:za,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:za,areaServed:Wa,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Ba}},Ga=[["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(" "),Va.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Va.Event],[za,Va.Organization],[Wa,Va.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Va.Product]];function Za(t,e){return _e.call(t,e)?t[e]:void 0}function Qa(t){const e=typeof t;return Ee(t)||"string"===e||"number"===e||"boolean"===e}function Ja(t,e){return e&&function(t){return $e(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function Ka(t,e){return we(t)&&t.every(Qa)?t.map(t=>Ja(t,e)).filter(t=>!Ce(t)):Qa(t)?Ja(t,e):void 0}function Ya(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 Xa(t){if(_e.call(Va,t))return Va[t];for(const[e,i]of Ga)if(e.includes(t))return i}function tu(t,e,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0})}function eu(t,e,i,n){if(we(t)){const s=t.map(t=>eu(t,e,i,n)).filter(t=>!Ce(t));return s.length?s:void 0}return iu(t,e,i,n)||void 0}function iu(t,e,i,n){if(!Se(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(i))return null;const s=Za(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&&qa.test(i)&&!e.has(i)&&(e.add(i),n.push(i),20===n.length))break}return n}(s),o=r.filter(t=>!!Xa(t)&&(!n||!n.length||n.includes(t))),l={};for(const n of Ha){const o="@type"===n?r.length?"string"==typeof s?r[0]:r:void 0:"@id"===n?Ya(Za(t,n),e):Ka(Za(t,n),i.maskUrl);Ce(o)||tu(l,n,o)}for(const n of o){const s=Xa(n);for(const n of Object.keys(s)){const r=Za(t,n),o=s[n];if(!0===o){const t=Ka(r,i.maskUrl);Ce(t)||tu(l,n,t)}else{const t=eu(r,e,i,o);Ce(t)||tu(l,n,t)}}}const a=eu(Za(t,"@graph"),e,i);return Ce(a)||tu(l,"@graph",a),Object.keys(l).length?l:null}function nu(t,e,i){if(!Se(t))return null;const n=Za(t,"@context");if("string"!=typeof n||!/^https?:\/\/schema\.org\/?$/.test(n))return null;const s=iu(t,e,i);return s?le({"@context":"https://schema.org"},s):null}function su(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function ru(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 ou(t,e,i){for(let n=t;n;){if(ru(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 lu(t){return su(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(su)}function au(t){return Ce(t)?void 0:Math.round(t)}function uu(t){return Se(t)?t.network_timing:t}const hu=Ws("[SessionRecording]"),cu=[1,2,3,4,5,6,7,12],du=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function vu(){var t;return null==d||null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function fu(){var t;return null===(t=vu())||void 0===t?void 0:t.record}function pu(t){try{return JSON.stringify(t)}catch(e){return JSON.stringify(t,Do())}}function gu(t){return bl(yl(_l(pu(t))),!0)}function mu(t){return yu.apply(this,arguments)}function yu(){return(yu=ne(function*(t){const e=yield ds(pu(t),Jl.DEBUG,{rethrow:!0});return bl(new Uint8Array(yield e.arrayBuffer()),!0)})).apply(this,arguments)}let _u,bu;const wu="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let ku=!1;function Su(t){var e;return we(t)&&0===t.length?(_u=null!==(e=_u)&&void 0!==e?e:gu([]),_u):gu(t)}function xu(t){return Cu.apply(this,arguments)}function Cu(){return(Cu=ne(function*(t){var e;return we(t)&&0===t.length?_u||(bu=null!==(e=bu)&&void 0!==e?e:mu([]).then(t=>(_u=t,t)).catch(t=>{throw _u=void 0,bu=void 0,t}),bu):mu(t)})).apply(this,arguments)}function $u(t){return wu&&!ku&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function Tu(t){return{event:t,size:No(t)}}function Eu(t,e){return le(le({},t),{},{data:e,cv:"2024-10"})}function Iu(t,e){return le(le({},t),{},{cv:"2024-10",data:le(le({},t.data),e)})}function Mu(t){try{if(2===t.type)return Tu(Eu(t,gu(t.data)));if(3===t.type&&0===t.data.source)return Tu(Iu(t,{texts:Su(t.data.texts),attributes:Su(t.data.attributes),removes:Su(t.data.removes),adds:Su(t.data.adds)}));if(3===t.type&&8===t.data.source)return Tu(Iu(t,{adds:t.data.adds?gu(t.data.adds):void 0,removes:t.data.removes?gu(t.data.removes):void 0}))}catch(t){hu.error("could not compress event - will use uncompressed event",t)}return{event:t,size:Lo(t)}}function Ru(){return Ru=ne(function*(t){try{if(2===t.type)return Tu(Eu(t,yield mu(t.data)));if(3===t.type&&0===t.data.source){const[e,i,n,s]=yield Promise.all([xu(t.data.texts),xu(t.data.attributes),xu(t.data.removes),xu(t.data.adds)]);return Tu(Iu(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?mu(t.data.adds):void 0,t.data.removes?mu(t.data.removes):void 0]);return Tu(Iu(t,{adds:e,removes:i}))}}catch(e){return ls(e)&&(ku=!0),hu.error("could not compress event asynchronously - trying synchronous compression",e),Mu(t)}return{event:t,size:Lo(t)}}),Ru.apply(this,arguments)}function Pu(t,e){return 5===t.type&&t.data.tag===e}function Ou(t){return Pu(t,"sessionIdle")}function Au(t){return Pu(t,"$session_ending")}function Fu(t){return Pu(t,"$session_starting")}var Du=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 ba(this._instance.get_property(j),this.sessionId)}get Ht(){var t;const e=null===(t=this.ne)||void 0===t?void 0:t.sampleRate;return Me(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=vu())||void 0===s||null===(r=s.resetMaxDepthState)||void 0===r||r.call(s),this.Vt("$session_id_change",{sessionId:t,windowId:e,changeReason:i}),this.ze(),!(!1===this.de&&this.isStarted||this.Xt===t&&this.Be===e)){const e=this.Xt!==t&&!1!==this.de;this.de="unknown",this.Ue(e)}l&&this.Vt("$session_starting",{previousSessionId:a,previousWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le}),null===(o=this.re)||void 0===o||o.makeSamplingDecisions(t)},this.We=!1,this.Ve=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[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 Me(i)&&Me(n)?n-i:null},this.Ge=()=>{var t,e;const i=this.ie;if(!Me(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 Me(t)&&t>=0&&i>t}if(this.Ve())return!1;const n=this.Ze();return!!Ee(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 Ro(this._instance),this.Y=new Mo(this._instance),this.tt=new Po(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||hu.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 Kl(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(Ie(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,hu.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,Ws("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,Ws("canvas recording fps"),4),quality:Ve(c,0,1,Ws("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=uu(this._instance.config.capture_performance),a=uu(null==n?void 0:n.capturePerformance),u=!!(Pe(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(!nr.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:io.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...io.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...io.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=eo(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=ao(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=ao(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=rr(t.name);let r=0===e.indexOf("http")?null===(n=rr(e))||void 0===n?void 0:n.pathname:e;"/"===r&&(r="");const o=null==s?void 0:s.pathname.replace(r||"","");return s&&o&&lo.some(t=>0===o.indexOf(t))?void 0:t})((oo((n=e).requestHeaders),oo(n.responseHeaders),n),t.api_host,i));var n},u=ke(t.session_recording.maskNetworkRequestFn);return u&&ke(t.session_recording.maskCapturedNetworkRequestFn)&&zs.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 Ie(o)&&r?(ho.add(r),r):null!=o?o:void 0}:t=>function(t){if(!Ce(t))return t.requestBody=uo(t.requestBody,"Request"),t.responseBody=uo(t.responseBody,"Response"),t}(a(t)),le(le(le({},io),n),{},{recordHeaders:s,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.vn,t)))}else hu.info("NetworkCapture not started because we are on localhost.");return i}mn(t){return this._instance.config.disable_capture_url_hashes?rn(t):t}gn(t,e=!1){const i=e?rn(t):this.mn(t),n=this._instance.config.mask_personal_data_properties?[...Sa,...this._instance.config.custom_personal_data_properties||[]]:[];return this.yn(ar(i,n,Ca))}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}):hu.warn("could not emit queued rrweb event.",e,t),!1}}Vt(t,e){return this.bn(du(()=>fu().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=fu();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(du(()=>fu().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 Me(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),hu.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"}),hu.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?U:z;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(O);if(!t)return;let e;try{e=Se(t)?t:JSON.parse(t)}catch(t){return void hu.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.We){var i;const n=null!==(i=e.cache_timestamp)&&void 0!==i?i:Date.now();if(Date.now()-n>36e5)return void hu.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t})}return e}Ln(t,e,i){this._instance.get_property(t)&&(e(),i())}start(e){var i,s;const r=this.ne;if(!r)return void hu.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 ka(this._instance,this.Y,this.qt.bind(this),this.Vt.bind(this),this.Bt.bind(this)):new wa(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||(er(t,"beforeunload",this.Je),er(t,"pagehide",this.nn),er(t,"offline",this.rn),er(t,"online",this.sn),er(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.ze(),this.de="unknown",this.stop(),this.qe=this.Yt.onSessionId((t,e,i)=>{var n;null===(n=this.qe)||void 0===n||n.call(this),this.qe=void 0,this.je(t,e,i)})}):ke(this.Yt.on)||hu.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Ie(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){hu.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){hu.warn("could not stop rrweb",t)}this.se=void 0}zn(){if(!this.Bn||0===this.Oe)return!1;if(this.Pe)return!0;this.Pe=!0,this.Un=void 0;const t=this.Le;return this.qn(),this.jn(),this.Bn.catch(()=>{}).then(()=>{t===this.Le&&(this.Pe=!1,this.tn(),this.en(),this.Wn(),this.Nn(),hu.info("stopped"))}).catch(()=>{this.Pe=!1,this.Wn(),this.Nn(),hu.info("stopped")}),!0}stop(){if(this.jn(),this.We)this.Ye();else if(this.zn())return;this.tn(),this.en(),this.Wn(),this.Nn(),hu.info("stopped")}Wn(){this.Xe(void 0,{preserveLogDedup:this.We}),this.ge=!1}flushBeforeIdentityReset(){(this.isStarted||this.Pe)&&(this.Ye(),this.tn())}Ue(t){this.We=!0,this.le=Date.now();try{var e,i;this.stop(),this.Vn=void 0,this.Zn=void 0,this.fe=0,this.ve=0,this.pe=0,null===(e=vu())||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.Un=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,hu.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(),hu.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,hu.error("could not track full snapshot cost",t))}}ti(){var t,e;const i=null===(t=vu())||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||hu.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,hu.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=Lo(t.event);if(t.compressionEnabled)try{({event:e,size:i}=Mu(t.event))}catch(t){hu.error("could not process queued compression event - will use uncompressed event",t)}try{this.ni(t,e,i)}catch(t){hu.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?$u(t)?yield function(t){return Ru.apply(this,arguments)}(t):Mu(t):{event:t,size:Lo(t)};i=s.event,n=s.size}catch(e){hu.error("could not process queued compression event - will use uncompressed event",e),i=t,n=Lo(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=vu())||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 Au(t)?t.data.payload:null}(m),_=function(t){return Fu(t)?t.data.payload:null}(m),b=function(t){return Ou(t)?t.data.payload:null}(m);y||_?(null==y?void 0:y.lastActivityTimestamp)&&(m.timestamp=y.lastActivityTimestamp):(null==b?void 0:b.sessionId)||this.si(m),2===e.type&&(this.Te.push([this.Xt,e.timestamp]),this.Te.length>6&&(this.Te=this.Te.slice(-6)));const w=null!==(s=null!==(r=null!==(o=null==y?void 0:y.currentSessionId)&&void 0!==o?o:null==_?void 0:_.nextSessionId)&&void 0!==r?r:null==b?void 0:b.sessionId)&&void 0!==s?s:this.Xt,k=null!==(l=null!==(a=null!==(u=null==y?void 0:y.currentWindowId)&&void 0!==u?u:null==_?void 0:_.nextWindowId)&&void 0!==a?a:null==b?void 0:b.windowId)&&void 0!==l?l:this.Be;if(!0===this.de&&!function(t){return Ou(t)||Au(t)||Fu(t)}(m))return void(function(t){return 2===t.type||4===t.type||3===t.type&&9!==t.data.source}(m)&&this.he++);2===m.type&&(this.he=0),b&&(m.timestamp=b.lastActivityTimestamp+b.threshold);const S=this.ae;this.ae=!0,p?this._n(!0):S||this._n();const x=null===(h=this._instance.config.session_recording.compress_events)||void 0===h||h;if(5===m.type&&"$json_ld"===m.data.tag){let e;try{e=t?this.gn(t.location.href):void 0}catch(t){}m.data.href=e}if(this.Oe>0||x&&$u(m))return void this.ri(m,x,w,k);const{event:C,size:T}=x?Mu(m):{event:m,size:Lo(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}):co}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)&&!Au(t)&&!Fu(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}),hu.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)&&Ql.Et()}mi(){0!==this.Rt.data.length&&this.Rt.size!==this.gi&&943718.4>=this.Rt.size&&this.fi()&&(this.gi=this.Rt.size,Ql.At(this.ln,this.Rt))}Dn(){if(this.Ee||!this.fi())return;this.Ee=!0;const t=Ql.Dt(this.ln);Ql.Lt(this.ln),Se(t)&&we(t.data)&&0!==t.data.length&&we(t.sizes)&&t.sizes.length===t.data.length&&Me(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();qo(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:Jl.LIB_NAME,$lib_version:Jl.LIB_VERSION,$snapshot_host:t})}catch(t){hu.warn("could not capture snapshot chunk - skipping it",t)}}),Ce(this.gi)||(Ql.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}),hu.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!==cu.indexOf(null===(e=t.data)||void 0===e?void 0:e.source)}si(t){const e=this.bi(t);e||!0===this.de||t.timestamp-this.le>this.te&&(this.de=!0,clearInterval(this.Rn),this.Vt("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.le,threshold:this.te,bufferLength:this.Rt.data.length,bufferSize:this.Rt.size,sessionId:this.Xt,windowId:this.Be}),this.tn());const{windowId:i,sessionId:n}=this.Yt.checkAndGetSessionAndWindowId(!e,t.timestamp);let s=!1;if(e&&(this.le=t.timestamp,this.de)){const e="unknown"===this.de;this.de=!1,e||(this.Vt("sessionNoLongerIdle",{reason:"user activity",type:t.type}),s=!0)}const r=this.Xt!==n,o=this.Be!==i;if(this.Be=i,this.Xt=n,r||o){const t=r&&!1!==this.de;t&&(this.de="unknown"),this.Ue(t)}else if(e&&this.$n(),s){var l;const t=["sampled","active"].includes(this.status)||(null===(l=this.re)||void 0===l?void 0:l.hasPendingTriggers(this.sessionId));this.he>0&&t&&this.jt(),this._n(),this.Tn()}}ze(){var t;null===(t=this.re)||void 0===t||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e,i,n,s,r,o,l,a,u,h,c;const d=null===(t=vu())||void 0===t||null===(e=t.getDeferredStylesheetStats)||void 0===e?void 0:e.call(t);return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this.Un,$sdk_debug_replay_internal_buffer_length:this.Rt.data.length,$sdk_debug_replay_internal_buffer_size:this.Rt.size,$sdk_debug_current_session_duration:this.Qe,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(i=this.He)||void 0===i?void 0:i.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Te,$snapshot_max_depth_exceeded:this._e,$sdk_debug_replay_slowest_full_snapshot_ms:au(null===(n=this.Vn)||void 0===n?void 0:n.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:au(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:au(null==d?void 0:d.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:au(null==d?void 0:d.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:au(null===(a=vu())||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=vu())||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,[Ut]:!!this.se,[zt]: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,hu.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,hu.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=fu();if(!u)return void hu.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 wl(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`;hu.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,hu.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},i)),!this.se)return this.we=!0,void hu.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=Na;const o=function(t,e){const i=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?ja:i=>{const n=t.getElementById(i);return!!n&&"SCRIPT"!==n.nodeName&&(!e.isRecordedElement||e.isRecordedElement(n))&&!ou(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 ou(t,e.blockClass,e.blockSelector)||ou(t,e.maskTextClass,e.maskTextSelector)}(e,i))return;const a=function(t,e=ja,i){if(!t||t.length>Na)return null;try{const n=JSON.parse(t),s={maskUrl:i,remainingNodes:2048,exceeded:!1},r=we(n)?n.map(t=>nu(t,e,s)):nu(n,e,s);if(s.exceeded||Ee(r)||we(r)&&(!r.length||r.some(Ee)))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(Ee(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 lu(t))l(e)};for(const i of t)if("childList"===i.type)su(i.target)&&l(i.target),i.addedNodes.forEach(e);else if("characterData"===i.type){const t=i.target.parentNode;t&&su(t)&&l(t)}else"attributes"===i.type&&su(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()&&lu(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=Pe(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 Lu=["type"];var Nu=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}({}),qu=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}({}),Bu=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}({}),ju=function(t){return t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t}({}),Hu=function(t){return t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t}({}),Uu=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}({}),zu=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 Wu(t,e){return-1!==t.indexOf(e)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var Vu={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Gu={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Zu={};function Qu(t){if(Zu[t])return Zu[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 Vu?Vu[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 Gu?Gu[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 Zu[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 Wu(t,"AppleWebKit")&&!Wu(t,"Chrome")}(navigator.userAgent)&&(l.classList.add("rr-block","ph-no-capture"),l.setAttribute("__rrwebUntaintedPrototype",t),a=!0),Zu[t]=s):i}catch(t){return i}finally{!a&&l.parentNode&&document.body.removeChild(l)}}var Ju=Object.create(null);function Ku(t,e,i){var n;const s=Ju[t],r=s[i];if(r)return r.call(e);const o=Qu(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]}Ju.Node=Object.create(null),Ju.ShadowRoot=Object.create(null),Ju.MutationObserver=Object.create(null),Ju.Element=Object.create(null);var Yu,Xu={};function th(t,e,i){const n=`${t}.${String(i)}`;if(Xu[n])return Xu[n].bind(e);const s=Qu(t)[i];return"function"!=typeof s?e[i]:(Xu[n]=s,s.bind(e))}function eh(){return Qu("MutationObserver").constructor}function ih(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 nh={childNodes:t=>Ku("Node",t,"childNodes"),parentNode:t=>Ku("Node",t,"parentNode"),parentElement:t=>Ku("Node",t,"parentElement"),textContent:t=>Ku("Node",t,"textContent"),isConnected(t){if(void 0===Yu){var e;const t=null===(e=Object.getOwnPropertyDescriptor(Qu("Node"),"isConnected"))||void 0===e?void 0:e.get;Yu=(null==t?void 0:t.toString().includes("[native code]"))?t:null}return null==Yu?void 0:Yu.call(t)},contains:(t,e)=>th("Node",t,"contains")(e),getRootNode:t=>th("Node",t,"getRootNode")(),host:t=>t&&"host"in t?Ku("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?Ku("Element",t,"shadowRoot"):null,querySelector:(t,e)=>th("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>th("Element",t,"querySelectorAll")(e),mutationObserver:eh,patch:ih};function sh(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var rh=0;function oh(){rh+=1}function lh(){return rh}function ah(t,e){return(e!==rh||t>6e4)&&!0}var uh=0,hh=0,ch=0,dh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},vh=null,fh=null,ph=[],gh=0,mh=0,yh={slowestBatchMs:0},_h={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function bh(t){(uh+=1)>1||(dh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},ph=[],gh=0,fh=(t=>t&&t>0?t:null)(t),hh=sh(),ch=rh)}function wh(){return 0===uh?vh||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(uh-=1)>0?dh:(dh.durationMs=sh()-hh,dh.deferredStylesheetCount=gh,_h.deferredCount+=gh,fh=null,ah(dh.durationMs,ch)?dh:vh=dh)}function kh(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+=kh(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+=kh(s,e,i+1))}}}catch(t){}}return n}function Sh(t){if(0===uh)return;const e=kh(t,null,0);dh.cssRuleCount+=e,mh>0&&(dh.nonDeferrableCssRuleCount+=e)}function xh(t){mh+=1;try{return t()}finally{mh-=1}}function Ch(t){uh>0&&(dh.stylesheetMs+=t)}function $h(t){if(0===uh||null===fh)return!1;const e=dh.cssRuleCount-dh.nonDeferrableCssRuleCount;return e>=fh||e+function(t){try{const e=t&&(t.rules||t.cssRules);if(!e)return 0;const i=new WeakSet;return i.add(t),kh(e,i,0)}catch(t){return 0}}(t)>fh}function Th(){const t=ph;return ph=[],t}function Eh(){_h.failedCount+=1}function Ih(t){t>0&&(_h.abandonedCount+=t)}function Mh(t){return Mh="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},Mh(t)}function Rh(t,e,i){return(e=function(t){var e=function(t){if("object"!=Mh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Mh(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Mh(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ph(t){return t.nodeType===t.ELEMENT_NODE}function Oh(t){const e=t&&"host"in t&&"mode"in t&&nh.host(t)||null;return Boolean(e&&"shadowRoot"in e&&nh.shadowRoot(e)===t)}function Ah(t){return"[object ShadowRoot]"==={}.toString.call(t)}function Fh(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 Dh(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 Lh=0;function Nh(t){const e=0===Lh,i=e?sh():0;Lh+=1;try{const e=t.rules||t.cssRules;if(!e)return null;Sh(e);let i=t.href;return!i&&t.ownerNode&&(i=t.ownerNode.baseURI),Fh(Array.from(e,t=>qh(t,i)).join(""))}catch(t){return null}finally{Lh-=1,e&&Ch(sh()-i)}}function qh(t,e){if(jh(t)){let e;try{e=Nh(t.styleSheet)||Dh(t)}catch(i){e=t.cssText}try{var i;if(e&&(null===(i=t.styleSheet)||void 0===i?void 0:i.href))return nc(e,t.styleSheet.href)}catch(t){}return e}{let i=t.cssText;return Hh(t)&&t.selectorText.includes(":")&&(i=Bh(i)),e?nc(i,e):i}}function Bh(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function jh(t){return"styleSheet"in t}function Hh(t){return"selectorText"in t}var Uh=/^-?[A-Za-z_][\w-]*$/,zh=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Wh(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||Dh(e)}catch(t){s=e.cssText}try{var n;s&&(null===(n=e.styleSheet)||void 0===n?void 0:n.href)&&(s=nc(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&&jh(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(Hh(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&&!Uh.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]?Uh.test(e.name)?`@keyframes ${e.name} {`:null:""===e.name?"@layer {":zh.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?nc(n,s):n,fixColons:"sheet"===i.kind&&Hh(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(i,t))return;let n=i.cssText;"sheet"===t.kind&&Hh(i)&&i.selectorText.includes(":")&&(n=Bh(n)),t.parts.push(t.sheetHref?nc(n,t.sheetHref):n),t.index+=1}return function(t){try{const i=t.rules||t.cssRules;if(!i)return!1;Sh(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,!jh(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;Sh(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=sh();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?Bh(i):i}else e=Fh(t.parts.join(""))}catch(t){}r(e);continue}o-=1;try{l(t)}catch(t){r(null)}}}catch(t){i=!0,n=null}finally{Ch(sh()-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 Vh=class{constructor(){Rh(this,"idNodeMap",new Map),Rh(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)),Ph(t)){const e=nh.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 Gh({element:t,maskInputOptions:e,tagName:i,type:n,value:s,maskInputFn:r}){let o=s||"";const l=n&&Zh(n);return(e[i.toLowerCase()]||l&&e[l])&&(o=r?r(o,t):"*".repeat(o.length)),o}function Zh(t){return t.toLowerCase()}var Qh=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 Jh({element:t,name:e,value:i,maskAllElementAttributes:n,maskAttributeFn:s,isGenerated:r=!1}){return i?n?r&&Qh.has(Zh(e))?i:"*".repeat(i.length):s?s(e,i,t):i:i}var Kh="__rrweb_original__";function Yh(t){try{const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?Zh(e):null}catch(t){return null}}var Xh=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,tc=/^(?:[a-z+]+:)?\/\//i,ec=/^www\..*/i,ic=/^(data:)([^,]*),(.*)/i;function nc(t,e){return(t||"").replace(Xh,(t,i,n,s,r,o)=>{const l=n||r||o,a=i||s||"";if(!l)return t;if(tc.test(l)||ec.test(l))return`url(${a}${l}${a})`;if(ic.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 sc,rc,oc=new Map,lc=1,ac=new RegExp("[^a-z0-9-_:]");function uc(){return lc++}var hc=/^[^ \t\n\r\u000c]+/,cc=/^[, \t\n\r\u000c]+/,dc=new WeakMap;function vc(t,e){return e&&""!==e.trim()?fc(t,e):e}function fc(t,e){let i=dc.get(t);if(i||(i=t.createElement("a"),dc.set(t,i)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return i.setAttribute("href",e),i.href}function pc(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 gc(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=vc(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=oc.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(oc.size>=10){const t=oc.keys().next().value;void 0!==t&&oc.delete(t)}return oc.set(e,{type:i,quality:n,result:l}),l}catch(t){return e}}(s,i,r.type,r.quality)),pc(t,r)}if("image"===e)return pc(i,r)}return i}if("xlink:href"===i&&"#"!==n[0]){const i=vc(t,n);return"image"===e&&i.startsWith("data:")?pc(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(cc),e.length>i;){let r=n(hc);if(","===r.slice(-1))r=vc(t,r.substring(0,r.length-1)),s.push(r);else{let n="";r=vc(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?nc(n,fc(t)):"object"===e&&"data"===i?vc(t,n):n:vc(t,n)}function mc(t,e,i){return("video"===t||"audio"===t)&&"autoplay"===Zh(e)}function yc(t,e,i){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!i&&yc(nh.parentNode(t),e,i);for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!i&&yc(nh.parentNode(t),e,i)}function _c(t,e,i,n){let s;if(Ph(t)){if(s=t,!nh.childNodes(s).length)return!1}else{if(null===nh.parentElement(t))return!1;s=nh.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(yc(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 bc(t,e,i){const n=t.removeEventListener;"function"==typeof n&&n.call(t,e,i)}var wc=new Map;function kc(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function Sc(t){return null==t?"":t.toLowerCase()}var xc=!1,Cc=!1;function $c(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,maskTextClass:o,maskTextSelector:l,skipChild:a=!1,inlineStylesheet:u=!0,maskInputOptions:h={},maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v=!1,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g={},inlineImages:m=!1,recordCanvas:y=!1,canvasMaskingConfigured:_,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k=5e3,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:T=()=>!1,newlyAddedElement:E=!1,depth:I=0,maxDepth:M=50}=e;let{needsMask:R}=e,{preserveWhiteSpace:P=!0}=e;if(I>=M)return Cc=!0,xc||(xc=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${M}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;R||(R=_c(t,o,l,void 0===R)),uh>0&&(dh.nodeCount+=1);const O=function(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:o,inlineStylesheet:l,maskInputOptions:a={},maskTextFn:u,maskInputFn:h,maskAllElementAttributes:c=!1,maskAttributeFn:d,dataURLOptions:v={},inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y=!1}=e,_=function(t,e){if(!e.hasNode(t))return;const i=e.getId(t);return 1===i?void 0:i}(i,n);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:zu.Document,childNodes:[],compatMode:t.compatMode}:{type:zu.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:zu.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:_};case t.ELEMENT_NODE:return function(t,e){const{doc:i,blockClass:n,blockSelector:s,inlineStylesheet:r,maskInputOptions:o={},maskInputFn:l,maskAllElementAttributes:a=!1,maskAttributeFn:u,dataURLOptions:h={},inlineImages:c,recordCanvas:d,canvasMaskingConfigured:v,keepIframeSrcFn:f,newlyAddedElement:p=!1,rootId:g}=e,m=function(t,e,i){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(i)return t.matches(i)}catch(t){}return!1}(t,n,s),y=function(t){if(t instanceof HTMLFormElement)return"form";const e=Zh(t.tagName);return ac.test(e)?"div":e}(t),_=new Set;let b={};const w=t.attributes.length;for(let e=0;w>e;e++){const n=t.attributes[e];mc(y,n.name)||(b[n.name]=gc(i,y,Zh(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=kc(i,n),!e&&n.includes(".css"))&&(e=kc(i,window.location.origin+"/"+n.replace(window.location.href,"")))}let n=null;e&&($h(e)?uh>0&&(ph.push(t),gh+=1):n=Nh(e)),n&&(delete b.rel,delete b.href,b._cssText=n)}if("style"===y&&t.sheet&&!(t.innerText||nh.textContent(t)||"").trim().length){const e=xh(()=>Nh(t.sheet));e&&(b._cssText=e)}if("input"===y||"textarea"===y||"select"===y){const e=t.value,i=t.checked;"radio"!==b.type&&"checkbox"!==b.type&&"submit"!==b.type&&"button"!==b.type&&e?b.value=Gh({element:t,type:Yh(t),tagName:y,value:e,maskInputOptions:o,maskInputFn:l}):i&&(b.checked=i)}if("option"===y&&(t.selected&&!o.select?b.selected=!0:delete b.selected),"dialog"===y&&t.open){try{b.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){b.rr_open_mode="modal",b.ph_rr_could_not_detect_modal=!0}_.add("rr_open_mode")}if("canvas"===y&&d&&!(null==v?void 0:v()))if("2d"===t.__context)(function(t){const e=t.getContext("2d");if(!e)return!0;for(let i=0;t.width>i;i+=50)for(let n=0;t.height>n;n+=50){const s=e.getImageData;if(new Uint32Array((Kh in s?s[Kh]:s).call(e,i,n,Math.min(50,t.width-i),Math.min(50,t.height-n)).data.buffer).some(t=>0!==t))return!1}return!0})(t)||(b.rr_dataURL=t.toDataURL(h.type,h.quality));else if(!("__context"in t)){const e=t.toDataURL(h.type,h.quality),n=i.createElement("canvas");n.width=t.width,n.height=t.height,e!==n.toDataURL(h.type,h.quality)&&(b.rr_dataURL=e)}let k,S=!1;if("img"===y&&c){sc||(sc=i.createElement("canvas"),rc=sc.getContext("2d"));const e=t,n=e.currentSrc||e.getAttribute("src")||"<unknown-src>",s=e.crossOrigin,r=(e,i)=>S?Jh({element:t,name:e,value:i,maskAllElementAttributes:a,maskAttributeFn:u}):i,o=()=>{bc(e,"load",o);try{sc.width=e.naturalWidth,sc.height=e.naturalHeight,rc.drawImage(e,0,0);const t=sc.toDataURL(h.type,h.quality);b.rr_dataURL=r("rr_dataURL",t)}catch(t){if("anonymous"!==e.crossOrigin)return e.crossOrigin="anonymous",void(e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o));console.warn(`Cannot inline img src=${n}! Error: ${t}`)}"anonymous"===e.crossOrigin&&(s?b.crossOrigin=r("crossOrigin",s):e.removeAttribute("crossorigin"))};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if("audio"===y||"video"===y){const e=b;e.rr_mediaState=t.paused?"paused":"played",_.add("rr_mediaState"),e.rr_mediaCurrentTime=t.currentTime,e.rr_mediaPlaybackRate=t.playbackRate,e.rr_mediaMuted=t.muted,e.rr_mediaLoop=t.loop,e.rr_mediaVolume=t.volume}if(p||(t.scrollLeft&&(b.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(b.rr_scrollTop=t.scrollTop)),m){var x,C,T;const{width:e,height:n,left:s,top:r}=t.getBoundingClientRect(),o=null===(x=i.defaultView)||void 0===x?void 0:x.getComputedStyle(t);b={class:b.class,rr_width:`${e}px`,rr_height:`${n}px`,rr_left:`${Math.floor(s+((null===(C=i.defaultView)||void 0===C?void 0:C.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(T=i.defaultView)||void 0===T?void 0:T.scrollY)||0))}px`},_.add("rr_width"),_.add("rr_height"),_.add("rr_left"),_.add("rr_top"),o&&(b.rr_position=o.position||"static",_.add("rr_position"),o.transform&&"none"!==o.transform&&(b.rr_transform=o.transform,_.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(b.rr_display=o.display,_.add("rr_display")))}if("iframe"!==y||f(b.src)||(t.contentDocument||(b.rr_src=b.src),delete b.src),a||u)for(const[e,i]of Object.entries(b))"string"!=typeof i&&null!==i||(b[e]=Jh({element:t,name:e,value:i,maskAllElementAttributes:a,maskAttributeFn:u,isGenerated:_.has(e)}));S=!0;try{customElements.get(y)&&(k=!0)}catch(t){}return{type:zu.Element,tagName:y,attributes:b,childNodes:[],isSVG:(E=t,Boolean("svg"===E.tagName||E.ownerSVGElement)||void 0),needBlock:m,rootId:g,isCustom:k};var E}(t,{doc:i,blockClass:s,blockSelector:r,inlineStylesheet:l,maskInputOptions:a,maskInputFn:h,maskAllElementAttributes:c,maskAttributeFn:d,dataURLOptions:v,inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y,rootId:_});case t.TEXT_NODE:return function(t,e){const{needsMask:i,maskTextFn:n,rootId:s}=e,r=nh.parentNode(t),o=r&&r.tagName;let l=nh.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($h(r.sheet));else if(null===(h=r.sheet)||void 0===h?void 0:h.cssRules){const t=Nh(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=nc(l,fc(e.doc))}return u&&(l="SCRIPT_PLACEHOLDER"),!a&&!u&&l&&i&&(l=n?n(l,nh.parentElement(t)):l.replace(/[\S]/g,"*")),{type:zu.Text,textContent:l||"",isStyle:a,rootId:s}}(t,{doc:i,needsMask:o,maskTextFn:u,rootId:_});case t.CDATA_SECTION_NODE:return{type:zu.CDATA,textContent:"",rootId:_};case t.COMMENT_NODE:return{type:zu.Comment,textContent:nh.textContent(t)||"",rootId:_};default:return!1}}(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:_,keepIframeSrcFn:T,newlyAddedElement:E});if(!O)return console.warn(t,"not serialized"),null;let A;A=n.hasNode(t)?n.getId(t):function(t,e){if(e.comment&&t.type===zu.Comment)return!0;if(t.type===zu.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&&(Sc(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Sc(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Sc(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&Sc(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Sc(t.attributes.property).match(/^(og|twitter|fb):/)||Sc(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===Sc(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(Sc(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(Sc(t.attributes.name))||Sc(t.attributes.property).match(/^article:/)||Sc(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(Sc(t.attributes.name)))return!0}}return!1}(O,p)||!P&&O.type===zu.Text&&!O.isStyle&&!O.textContent.replace(/^\s+|\s+$/gm,"").length?-2:uc();const F=Object.assign(O,{id:A});if(n.add(t,F),-2===A)return null;b&&b(t);let D=!a;if(F.type===zu.Element){D=D&&!F.needBlock,delete F.needBlock;const e=nh.shadowRoot(t);e&&Ah(e)&&(F.isShadowHost=!0)}if((F.type===zu.Document||F.type===zu.Element)&&D){p.headWhitespace&&F.type===zu.Element&&"head"===F.tagName&&(P=!1);const e={doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:l,skipChild:a,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:_,preserveWhiteSpace:P,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I+1,maxDepth:M};if(F.type===zu.Element&&"textarea"===F.tagName&&void 0!==F.attributes.value);else for(const i of Array.from(nh.childNodes(t))){const t=$c(i,e);t&&F.childNodes.push(t)}let E=null;if(Ph(t)&&(E=nh.shadowRoot(t)))for(const t of Array.from(nh.childNodes(E))){const i=$c(t,e);i&&(Ah(E)&&(i.isShadow=!0),F.childNodes.push(i))}}const L=nh.parentNode(t);if(L&&Oh(L)&&Ah(L)&&(F.isShadow=!0),F.type===zu.Element&&"iframe"===F.tagName){const e=function(t,e,i){const n=()=>{},s=t.contentWindow;if(!s)return n;let r;try{r=s.document.readyState}catch(t){return n}const o=()=>e();if("complete"!==r){let n=!1,s=null;const r=()=>{n||(n=!0,null!==s&&(clearTimeout(s),s=null),bc(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?bc(t,"load",o):(n=!0,bc(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),bc(t,"load",o)}}return t.addEventListener("load",o),()=>{bc(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&w){const i=$c(e,{doc:e,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:_,preserveWhiteSpace:P,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I+1,maxDepth:M});i&&w(t,i)}},k);null==S||S(t,e)}return F.type===zu.Element&&"link"===F.tagName&&"stylesheet"===F.attributes.rel&&function(e,a,S){if(wc.has(e))return;let E;try{E=e.sheet}catch(t){return}if(E)return;const O=new AbortController;let A=!1;const F=()=>{if(!A){A=!0;try{(()=>{if(x){const e=$c(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:_,preserveWhiteSpace:P,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I,maxDepth:M});e&&x(t,e)}})()}finally{wc.delete(e),O.abort()}}},D=setTimeout(F,S);O.signal.addEventListener("abort",()=>clearTimeout(D),{once:!0}),e.addEventListener("load",F,{signal:O.signal,once:!0}),wc.set(e,O)}(t,0,C),F}function Tc(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 Ec=class t{constructor(...t){Rh(this,"parentElement",null),Rh(this,"parentNode",null),Rh(this,"ownerDocument",void 0),Rh(this,"firstChild",null),Rh(this,"lastChild",null),Rh(this,"previousSibling",null),Rh(this,"nextSibling",null),Rh(this,"ELEMENT_NODE",1),Rh(this,"TEXT_NODE",3),Rh(this,"nodeType",void 0),Rh(this,"nodeName",void 0),Rh(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 Ic(t,e,i=document){const n={capture:!0,passive:!0};return i.addEventListener(t,e,n),()=>Mc(i,t,e,n)}function Mc(t,e,i,n){Rc(()=>{const s=t.removeEventListener;"function"==typeof s&&(void 0!==n?s.call(t,e,i,n):s.call(t,e,i))})}function Rc(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function Pc(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var Oc="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.",Ac={map:{},getId(){return console.warn(Oc),-1},getNode(){return console.warn(Oc),null},removeNodeFromMap(){console.warn(Oc)},has(){return console.warn(Oc),!1},reset(){console.warn(Oc)}};function Fc(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 Dc(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)}}}),()=>Dc(t,e,r||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Ac=new Proxy(Ac,{get(t,e,i){return"map"===e&&console.warn(Oc),Reflect.get(t,e,i)}}));var Lc=Date.now;function Nc(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=nh.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=nh.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 qc(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Bc(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function jc(t){return t?t.nodeType===t.ELEMENT_NODE?t:nh.parentElement(t):null}function Hc(t,e,i,n){if(!t)return!1;const s=jc(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(yc(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 Uc(t,e,i){return!("TITLE"!==t.tagName||!i.headTitleMutations)||-2===e.getId(t)}function zc(t,e){if(Oh(t))return!1;const i=e.getId(t);if(!e.has(i))return!0;const n=nh.parentNode(t);return(!n||n.nodeType!==t.DOCUMENT_NODE)&&(!n||zc(n,e))}function Wc(t){return Boolean(t.changedTouches)}function Vc(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Gc(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Zc(t){return!!t&&(t instanceof Ec&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(nh.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Lc=()=>(new Date).getTime());var Qc=class{constructor(){Rh(this,"id",1),Rh(this,"styleIDMap",new WeakMap),Rh(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 Jc(t){var e;let i=null;return"getRootNode"in t&&(null===(e=nh.getRootNode(t))||void 0===e?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&nh.host(nh.getRootNode(t))&&(i=nh.host(nh.getRootNode(t))),i}function Kc(t){const e=t.ownerDocument;if(!e)return!1;if(nh.contains(e,t))return!0;const i=nh.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=Jc(i);)i=e;return i}(t);return nh.contains(e,i)}(t)}function Yc(t){return"__ln"in t}var Xc,td=class{constructor(){Rh(this,"length",0),Rh(this,"head",null),Rh(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&&Yc(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&&Yc(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--)}},ed=(t,e)=>`${t}@${e}`,id=class{constructor(){Rh(this,"frozen",!1),Rh(this,"locked",!1),Rh(this,"texts",[]),Rh(this,"attributes",[]),Rh(this,"attributeMap",new WeakMap),Rh(this,"generatedAttributes",new WeakMap),Rh(this,"removes",[]),Rh(this,"mapRemoves",new Set),Rh(this,"movedMap",{}),Rh(this,"addedSet",new Set),Rh(this,"movedSet",new Set),Rh(this,"droppedSet",new Set),Rh(this,"removesSubTreeCache",new Set),Rh(this,"mutationCb",void 0),Rh(this,"blockClass",void 0),Rh(this,"blockSelector",void 0),Rh(this,"maskTextClass",void 0),Rh(this,"maskTextSelector",void 0),Rh(this,"inlineStylesheet",void 0),Rh(this,"maskInputOptions",void 0),Rh(this,"maskTextFn",void 0),Rh(this,"maskInputFn",void 0),Rh(this,"maskAllElementAttributes",void 0),Rh(this,"maskAttributeFn",void 0),Rh(this,"keepIframeSrcFn",void 0),Rh(this,"recordCanvas",void 0),Rh(this,"canvasMaskingConfigured",void 0),Rh(this,"inlineImages",void 0),Rh(this,"slimDOMOptions",void 0),Rh(this,"dataURLOptions",void 0),Rh(this,"doc",void 0),Rh(this,"mirror",void 0),Rh(this,"iframeManager",void 0),Rh(this,"stylesheetManager",void 0),Rh(this,"shadowDomManager",void 0),Rh(this,"canvasManager",void 0),Rh(this,"processedNodeManager",void 0),Rh(this,"unattachedDoc",void 0),Rh(this,"canvasManagerReleased",!1),Rh(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),Rh(this,"emit",()=>{if(this.frozen||this.locked)return;const t=sh(),e=lh();try{this.processBufferedMutations()}finally{i=sh()-t,n=e,uh>0||ah(i,null!=n?n:rh)||i>yh.slowestBatchMs&&(yh.slowestBatchMs=i)}var i,n}),Rh(this,"processBufferedMutations",()=>{const t=[],e=new Set,i=new td,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=nh.parentNode(r);if(!l||!Kc(r)||"TEXTAREA"===l.tagName)return;if(this.isBlockedAtEmission(l))return;const a=Oh(l)?this.mirror.getId(Jc(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=>{Vc(t,this.mirror)&&this.iframeManager.addIframe(t),Gc(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Zc(t)&&!Hc(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(nh.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=$c(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)sd(this.removesSubTreeCache,t)&&!this.movedSet.has(nh.parentNode(t))||r(t);for(const t of this.addedSet)rd(this.droppedSet,t)||sd(this.removesSubTreeCache,t)?rd(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(nh.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(nh.parentNode(i.value));if(-1===n(i.value))continue;if(-1!==e){t=i;break}{const e=nh.parentNode(i.value);if(e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=nh.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=nh.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]=Jh({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)}),Rh(this,"bufferBelongsToIframe",t=>this.doc===t.contentDocument),Rh(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(nh.childNodes(t),t=>nh.textContent(t)||"").join("");e.attributes.value=Gh({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Yh(t),value:i,maskInputFn:this.maskInputFn})}),Rh(this,"processMutation",t=>{if(!Uc(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const e=nh.textContent(t.target);Hc(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:_c(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,jc(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break}case"attributes":{var e;const n=t.target,s=Zh(n.tagName),r=t.attributeName,o=null!==(e=t.attributeNamespace)&&void 0!==e?e:null;let l=function(t,e,i){if(!i)return e;const n=t.getAttributeNodeNS(i,e);if(n)return n.name;if("http://www.w3.org/1999/xlink"===i)return`xlink:${e}`;if("http://www.w3.org/XML/1998/namespace"===i)return`xml:${e}`;if("http://www.w3.org/2000/xmlns/"===i)return"xmlns"===e?e:`xmlns:${e}`;const s=t.lookupPrefix(i);return s?`${s}:${e}`:e}(n,r,o),a=o?n.getAttributeNS(o,r):t.target.getAttribute(r);if("value"===l){const t=n,e=Yh(t);a=Gh({element:t,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:a,maskInputFn:this.maskInputFn})}if(Hc(t.target,this.blockClass,this.blockSelector,!1)||a===t.oldValue)return;let u=this.attributeMap.get(t.target);const h="iframe"===s&&"src"===l;if(h&&!this.keepIframeSrcFn(a)&&n.contentDocument)return;if("type"===l&&"input"===s&&"password"===(t.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!mc(s,l)){var i;u||(u={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(u),this.attributeMap.set(t.target,u));const e=gc(this.doc,s,Zh(l),a,n,this.dataURLOptions);if(h&&!this.keepIframeSrcFn(a)&&(l="rr_src"),u.attributes[l]=e,null===(i=this.generatedAttributes.get(t.target))||void 0===i||i.delete(l),"style"===l){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const e=this.unattachedDoc.createElement("span"),i=n.style;t.oldValue&&(e.style.cssText=t.oldValue);for(const t of Array.from(i)){const n=i.getPropertyValue(t),s=i.getPropertyPriority(t);n!==e.style.getPropertyValue(t)||s!==e.style.getPropertyPriority(t)?u.styleDiff[t]=""===s?n:[n,s]:u._unchangedStyles[t]=[n,s]}for(const t of Array.from(e.style))""===i.getPropertyValue(t)&&(u.styleDiff[t]=!1)}else if("open"===l&&"dialog"===s){u.attributes.rr_open_mode=n.matches("dialog:modal")?"modal":"non-modal";let e=this.generatedAttributes.get(t.target);e||(e=new Set,this.generatedAttributes.set(t.target,e)),e.add("rr_open_mode")}}break}case"childList":if(Hc(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=Oh(t.target)?this.mirror.getId(nh.host(t.target)):this.mirror.getId(t.target);Hc(t.target,this.blockClass,this.blockSelector,!1)||Uc(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(nd(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===i||zc(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[ed(i,n)]?nd(this.movedSet,e):(this.removes.push({parentId:n,id:i,isShadow:!(!Oh(t.target)||!Ah(t.target))||void 0}),function(t,e){const i=[t];for(;i.length;){const t=i.pop();e.has(t)||(e.add(t),nh.childNodes(t).forEach(t=>i.push(t)))}}(e,this.removesSubTreeCache))),this.mapRemoves.add(e))})}}),Rh(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(Uc(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[ed(this.mirror.getId(t),i)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!Hc(t,this.blockClass,this.blockSelector,!1)){if(t.nodeType===t.TEXT_NODE)return;const e=nh.childNodes(t);for(let t=0,i=e.length;i>t;t++){const i=e[t];i&&this.genAdds(i)}if(Zc(t)){const e=nh.childNodes(nh.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),Hc(t,i||e,this.blockSelector,!0))return!0;const n="getRootNode"in t?nh.getRootNode(t):null;t=(null==n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?nh.host(n):null}return!1}};function nd(t,e){const i=[e];for(;i.length;){const e=i.pop();if(t.delete(e),e.nodeType===e.TEXT_NODE)continue;const n=nh.childNodes(e);for(let t=0,e=n.length;e>t;t++){const e=n[t];e&&i.push(e)}}}function sd(t,e,i){return 0!==t.size&&function(t,e){const i=nh.parentNode(e);return!!i&&t.has(i)}(t,e)}function rd(t,e){if(0===t.size)return!1;let i=nh.parentNode(e);for(;i;){if(t.has(i))return!0;i=nh.parentNode(i)}return!1}function od(t){Xc=t}function ld(){Xc=void 0}var ad=(t,e="rrweb")=>Xc?(...i)=>{try{return t(...i)}catch(t){if(Xc&&!0===Xc(t,e))return;throw t}}:t,ud=[];function hd(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 cd(t,e){const i=new id;let n;i.init(t);try{n=new(eh())(ad(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),ud.push(i),{observer:n,buffer:i}}catch(t){try{null==n||n.disconnect(),i.destroy(),i.reset()}catch(t){}throw t}}function dd({scrollCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){const o=new Map,l=r=>{const l=hd(r);if(!l||Hc(l,n,s,!0))return;const a=i.getId(l);let u,h;if(l===e&&e.defaultView){const t=Nc(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=[Ic("scroll",ad(Fc(ad(t=>l(t)),r.scroll||100)),e)];return"onscrollend"in e&&a.push(Ic("scrollend",ad(l),e)),()=>a.forEach(t=>t())}function vd(t,e){for(let i=ud.length-1;i>=0;i--){const n=ud[i];if(!n)continue;let s=n.bufferBelongsToIframe(t);!s&&e&&e.has(n.bufferDoc())&&(s=!0),s&&(n.reset(),ud.splice(i,1))}}var fd=["INPUT","TEXTAREA","SELECT"],pd=new WeakMap;function gd(t){return function t(e,i){if(bd("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||bd("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||bd("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||bd("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 md(t,e,i){let n,s;return t?(t.ownerNode?n=e.getId(t.ownerNode):s=i.getId(t),{styleId:s,id:n}):{}}function yd({mirror:t,stylesheetManager:e},i){var n,s;let r=null;r=t.getId("#document"===i.nodeName?i:nh.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}}),ad(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function _d(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=ad(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=ud.indexOf(s);-1!==t&&ud.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==n||n.disconnect()}finally{Pc(r)}});try{if(t.recordDOM){const e=cd(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=Fc(ad(e=>{const i=Date.now()-o;t(l.map(t=>(t.timeOffset-=i,t)),e),l=[],o=null}),r),u=ad(Fc(ad(t=>{const e=hd(t),{clientX:i,clientY:s}=Wc(t)?t.changedTouches[0]:t;o||(o=Lc()),l.push({x:i,y:s,id:n.getId(e),timeOffset:Lc()-o}),a("undefined"!=typeof DragEvent&&t instanceof DragEvent?qu.Drag:t instanceof MouseEvent?qu.MouseMove:qu.TouchMove)}),s,{trailing:!1})),h=[Ic("mousemove",u,i),Ic("touchmove",u,i),Ic("drag",u,i)];return ad(()=>{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(Bu).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t]).forEach(r=>{let o=Zh(r);const u=(e=>r=>{const o=hd(r);if(Hc(o,n,s,!0))return;let l=null,u=e;if("pointerType"in r){switch(r.pointerType){case"mouse":l=ju.Mouse;break;case"touch":l=ju.Touch;break;case"pen":l=ju.Pen}l===ju.Touch&&(Bu[e]===Bu.MouseDown?u="TouchStart":Bu[e]===Bu.MouseUp&&(u="TouchEnd"))}else Wc(r)&&(l=ju.Touch);null!==l?(a=l,(u.startsWith("Touch")&&l===ju.Touch||u.startsWith("Mouse")&&l===ju.Mouse)&&(l=null)):Bu[e]===Bu.Click&&(l=a,a=null);const h=Wc(r)?r.changedTouches[0]:r;if(!h)return;const c=i.getId(o),{clientX:d,clientY:v}=h;ad(t)(le({type:Bu[u],id:c,x:d,y:v},null!==l&&{pointerType:l}))})(r);if(window.PointerEvent)switch(Bu[r]){case Bu.MouseDown:case Bu.MouseUp:o=o.replace("mouse","pointer");break;case Bu.TouchStart:case Bu.TouchEnd:return}l.push(Ic(o,u,e))}),ad(()=>{l.forEach(t=>t())})}(t)),r.push(dd(t)),r.push(function({viewportResizeCb:t},{win:e}){let i=-1,n=-1;return Ic("resize",ad(Fc(ad(()=>{const e=qc(),s=Bc();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=hd(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=nh.parentElement(i)),!i||!v||0>fd.indexOf(v)||Hc(i,n,s,!0))return;if(i.classList.contains(r)||o&&i.matches(o))return;let f=i.value,p=!1;const g=Yh(i)||"";"radio"===g||"checkbox"===g?p=i.checked:(l[v.toLowerCase()]||l[g])&&(f=Gh({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=pd.get(e);if(!s||s.text!==n.text||s.isChecked!==n.isChecked){pd.set(e,n);const s=i.getId(e);ad(t)(le(le({},n),{},{id:s}))}}const v=("last"===u.input?["change"]:["input","change"]).map(t=>Ic(t,ad(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=>Dc(t[0],t[1],{set(){ad(c)({target:this,isTrusted:!1})}},!1,f))),ad(()=>{Pc(v)})}(t)),r.push(function({mediaInteractionCb:t,blockClass:e,blockSelector:i,mirror:n,sampling:s,doc:r}){const o=ad(r=>Fc(ad(s=>{const o=hd(s);if(!o||Hc(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=[Ic("play",o(Uu.Play),r),Ic("pause",o(Uu.Pause),r),Ic("seeked",o(Uu.Seeked),r),Ic("volumechange",o(Uu.VolumeChange),r),Ic("ratechange",o(Uu.RateChange),r)];return ad(()=>{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:ad((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=md(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:ad((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=md(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:ad((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}=md(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=Nh(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:ad((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=md(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={};wd("CSSGroupingRule")?u.CSSGroupingRule=n.CSSGroupingRule:(wd("CSSMediaRule")&&(u.CSSMediaRule=n.CSSMediaRule),wd("CSSConditionRule")&&(u.CSSConditionRule=n.CSSConditionRule),wd("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:ad((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:h}=md(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||h&&-1!==h)){const e=[...gd(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:ad((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:h}=md(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||h&&-1!==h)){const e=[...gd(r),l];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:h,removes:[{index:e}]}))}return a},"host")})}),ad(()=>{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(yd(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:ad((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}=md(v,e,n.styleMirror);if(f&&-1!==f||p&&-1!==p){const e=gd(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:ad((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}=md(c,e,n.styleMirror);if(d&&-1!==d||v&&-1!==v){const e=gd(o.parentRule);r.queueMutation(c,()=>t({id:d,styleId:v,remove:{property:u},index:e}))}return h},"host")}),ad(()=>{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=ih(e.fonts,"add",function(e){return function(i){return setTimeout(ad(()=>{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),ad(()=>{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=ad(()=>{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);Hc(r,n,s,!0)||Hc(a,n,s,!0)||l.push({start:i.getId(r),startOffset:o,end:i.getId(a),endOffset:u})}r({ranges:l})});return l(),Ic("selectionchange",l)}(t)),r.push(function({doc:t,customElementCb:e}){const i=t.defaultView;return i&&i.customElements?ih(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 bd(t){return void 0!==window[t]}function wd(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var kd=class{constructor(t){Rh(this,"generateIdFn",void 0),Rh(this,"iframeRemoteIdToLocalIdMap",new WeakMap),Rh(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}},Sd=class{constructor(t){Rh(this,"iframes",new WeakMap),Rh(this,"crossOriginIframeMap",new WeakMap),Rh(this,"crossOriginIframeMirror",new kd(uc)),Rh(this,"crossOriginIframeStyleMirror",void 0),Rh(this,"crossOriginIframeRootIdMap",new WeakMap),Rh(this,"mirror",void 0),Rh(this,"mutationCb",void 0),Rh(this,"wrappedEmit",void 0),Rh(this,"loadListener",void 0),Rh(this,"pageHideListener",void 0),Rh(this,"stylesheetManager",void 0),Rh(this,"recordCrossOriginIframes",void 0),Rh(this,"messageHandler",void 0),Rh(this,"nestedIframeListeners",new Map),Rh(this,"attachedWindows",new WeakMap),Rh(this,"attachedDocuments",new WeakMap),Rh(this,"attachedIframes",new Map),Rh(this,"loadListenerDisposers",new WeakMap),Rh(this,"iframeElementsById",new Map),Rh(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new kd(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=>Rc(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{Mc(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);Rc(()=>{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)})}Rc(()=>{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 Nu.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:Nu.IncrementalSnapshot,data:{source:qu.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Nu.Meta:case Nu.Load:case Nu.DomContentLoaded:return!1;case Nu.Plugin:return e;case Nu.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case Nu.IncrementalSnapshot:switch(e.data.source){case qu.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 qu.Drag:case qu.TouchMove:case qu.MouseMove:return e.data.positions.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case qu.ViewportResize:return!1;case qu.MediaInteraction:case qu.MouseInteraction:case qu.Scroll:case qu.CanvasMutation:case qu.Input:return this.replaceIds(e.data,t,["id"]),e;case qu.StyleSheetRule:case qu.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case qu.Font:return e;case qu.Selection:return e.data.ranges.forEach(e=>{this.replaceIds(e,t,["start","end"])}),e;case qu.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===zu.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&&(Mc(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(i)),t&&this.nestedIframeListeners.has(t)&&(Mc(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=>{Rc(()=>this.mirror.removeNodeFromMap(t))}),Rc(()=>vd(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&&Mc(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{Mc(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}},xd=class{constructor(t){Rh(this,"shadowDoms",new WeakSet),Rh(this,"mutationCb",void 0),Rh(this,"scrollCb",void 0),Rh(this,"bypassOptions",void 0),Rh(this,"mirror",void 0),Rh(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(!Ah(t))return;if(this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=null!==(i=null===(n=nh.host(t))||void 0===n?void 0:n.ownerDocument)&&void 0!==i?i:e,{observer:r,buffer:o}=cd(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=ud.indexOf(o);-1!==t&&ud.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:dd(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(nh.host(t))),this.restoreHandlers.push({doc:s,handler:yd({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:ih(t.prototype,"attachShadow",function(t){return function(n){const s=t.call(this,n),r=nh.shadowRoot(this);return r&&Kc(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}},Cd="skip-frame";function $d(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 Td="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ed="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Id=0;64>Id;Id++)Ed[Td.charCodeAt(Id)]=Id;var Md=function(t){var e,i=new Uint8Array(t),n=i.length,s="";for(e=0;n>e;e+=3)s+=Td[i[e]>>2],s+=Td[(3&i[e])<<4|i[e+1]>>4],s+=Td[(15&i[e+1])<<2|i[e+2]>>6],s+=Td[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},Rd=new Map,Pd=(t,e,i)=>{if(!t||!Fd(t,e)&&"object"!=typeof t)return;const n=function(t,e){let i=Rd.get(t);return i||(i=new Map,Rd.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 Od(t,e,i,n){if(t instanceof Array)return t.map(t=>Od(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:Md(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Od(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:[Od(t.data,e,i,n),t.width,t.height]}:Fd(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:Pd(t,e,i)}:t}var Ad=(t,e,i,n)=>t.map(t=>Od(t,e,i,n)),Fd=(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]))},Dd=["webgl","webgl2"];function Ld(t){return"nodeType"in t}function Nd(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 ih(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||Ld(r)&&Hc(r,e,i,!0))return n.call(this,s);Ld(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=ih(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(s,...r){const o=function(t){return"experimental-webgl"===t?"webgl":t}(s);if(!Hc(this,e,i,!0)&&("__context"in this||(this.__context=o),n&&Dd.includes(o)))if(r[0]&&"object"==typeof r[0]){const t=r[0];t.preserveDrawingBuffer||(t.preserveDrawingBuffer=!0)}else r.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[s,...r])}});s.push(r)}catch(t){console.warn("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(t=>t())}}function qd(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=ih(t,u,function(t){return function(...l){const a=t.apply(this,l);if(Pd(a,r,this),this.canvas&&"tagName"in this.canvas&&!Hc(this.canvas,n,s,!0)){const t=Ad(l,r,this,o);i(this.canvas,{type:e,property:u,args:t})}return a}});l.push(a)}catch(r){const o=Dc(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!Hc(this.canvas,n,s,!0)&&i(this.canvas,{type:e,property:u,args:[t],setter:!0})}});l.push(o)}return l}var Bd='(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',jd="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Bd],{type:"text/javascript;charset=utf-8"});function Hd(t){let e;try{if(e=jd&&(self.URL||self.webkitURL).createObjectURL(jd),!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(Bd),{name:null==t?void 0:t.name})}}var Ud,zd,Wd,Vd=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){Rh(this,"pendingCanvasMutations",new Map),Rh(this,"rafStamps",{latestId:0,invokeId:null}),Rh(this,"mirror",void 0),Rh(this,"mutationCb",void 0),Rh(this,"resetObservers",void 0),Rh(this,"frozen",!1),Rh(this,"locked",!1),Rh(this,"rafIdTimestamp",null),Rh(this,"rafIdFlush",null),Rh(this,"refCount",0),Rh(this,"torndown",!1),Rh(this,"resetFrameDedup",null),Rh(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=Nd(e,i,n,!0),a=new Map;let u;try{u=new Hd}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:Hu["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=>{Hc(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 Cd}if(void 0===o)return;if(!Array.isArray(o)||!o.every($d))return Cd;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=Nd(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=ih(e.CanvasRenderingContext2D.prototype,l,function(r){return function(...o){return Hc(this.canvas,i,n,!0)||setTimeout(()=>{const i=Ad(o,e,this,s);t(this.canvas,{type:Hu["2D"],property:l,args:i})},0),r.apply(this,o)}});r.push(o)}catch(s){const o=Dc(e.CanvasRenderingContext2D.prototype,l,{set(e){Hc(this.canvas,i,n,!0)||t(this.canvas,{type:Hu["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(...qd(e.WebGLRenderingContext.prototype,Hu.WebGL,t,i,n,e,s)),void 0!==e.WebGL2RenderingContext&&r.push(...qd(e.WebGL2RenderingContext.prototype,Hu.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=>gs(t,Lu)),{type:s}=i[0];this.mutationCb({id:e,type:s,commands:n}),this.pendingCanvasMutations.delete(t)}},Gd=class{constructor(t){var e;Rh(this,"trackedLinkElements",new WeakSet),Rh(this,"pendingDeferredSheets",new Set),Rh(this,"mutationCb",void 0),Rh(this,"adoptedStyleSheetCb",void 0),Rh(this,"maskAllElementAttributes",void 0),Rh(this,"maskAttributeFn",void 0),Rh(this,"styleMirror",new Qc),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=Wh(n))}catch(t){}if(!i||!n)return Eh(),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=sh(),u=lh();let h=!0;try{if(r)return l=!0,Eh(),!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?(Eh(),!0):o?(this.emitCssTextMutation(t,e,o),!0):(Eh(),!0)}finally{h&&this.pendingDeferredSheets.delete(o),ah(c=sh()-a,null!=(d=u)?d:rh)||(_h.totalMs+=c,c>_h.slowestSliceMs&&(_h.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:Jh({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=sh();try{xh(()=>{try{const t=e.rules||e.cssRules;t&&Sh(t)}catch(t){}n.push({styleId:i,rules:Array.from(e.rules||CSSRule,(t,i)=>({rule:qh(t,e.href),index:i}))})})}finally{Ch(sh()-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(),wc.forEach(t=>t.abort()),wc.clear()}trackStylesheetInLinkElement(t){}},Zd=class{constructor(){Rh(this,"nodeMap",new WeakMap),Rh(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(){}},Qd=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var Jd;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(Jd=t.contentWindow)||void 0===Jd?void 0:Jd.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var Kd=new Vh,Yd=new Set([qu.Mutation,qu.MediaInteraction,qu.StyleSheetRule,qu.CanvasMutation,qu.Font,qu.Log,qu.StyleDeclaration,qu.AdoptedStyleSheet]);function Xd(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 tv(t={}){let e;const{emit:i,checkoutEveryNms:n,checkoutEveryNth:s,blockClass:r="rr-block",blockSelector:o=null,ignoreClass:l="rr-ignore",ignoreSelector:a=null,maskTextClass:u="rr-mask",maskTextSelector:h=null,inlineStylesheet:c=!0,inlineStylesheetBudgetRules:d,maskAllInputs:v,maskInputOptions:f,slimDOMOptions:p,maskInputFn:g,maskTextFn:m,maskAllElementAttributes:y=!1,maskAttributeFn:_,hooks:b,packFn:w,sampling:k={},dataURLOptions:S={},canvasResolutionScale:x,canvasMasking:C,mousemoveWait:T,recordDOM:E=!0,recordCanvas:I=!1,recordCrossOriginIframes:M=!1,recordAfter:R=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:P=!1,collectFonts:O=!1,inlineImages:A=!1,plugins:F,keepIframeSrcFn:D=()=>!1,ignoreCSSAttributes:L=new Set([]),attributeFilter:N,errorHandler:q}=t;od(q);const B=le({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},S),j=!M||window.parent===window;let H=!1;if(!j)try{window.parent.document&&(H=!1)}catch(t){H=!0}if(j&&!i)throw new Error("emit function is required");if(!j&&!H)return()=>{};void 0!==T&&void 0===k.mousemove&&(k.mousemove=T),Kd.reset();const U=!0===v?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==f?f:{password:!0},z=Tc(void 0!==p&&p);let W;!function(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();let V=0;const G=new Map;let Z,Q;const J=t=>{for(const e of F||[])e.eventProcessor&&(t=e.eventProcessor(t));return w&&!H&&(t=w(t)),t};Ud=(t,e)=>{var r;const o=t;if(o.timestamp=Lc(),!(null===(r=ud[0])||void 0===r?void 0:r.isFrozen())||o.type===Nu.FullSnapshot||o.type===Nu.IncrementalSnapshot&&Yd.has(o.data.source)||ud.forEach(t=>t.unfreeze()),j)null==i||i(J(o),e);else if(H){const t={type:"rrweb",event:J(o),origin:window.location.origin,isCheckout:e};window.parent.postMessage(t,"*")}if(o.type===Nu.FullSnapshot)W=o,V=0;else if(o.type===Nu.IncrementalSnapshot){if(o.data.source===qu.Mutation&&o.data.isAttachIframe)return;V++,(s&&V>=s||n&&o.timestamp-W.timestamp>n)&&zd(!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=Kd.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()}Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.Mutation},t)})},Y=t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.Scroll},t)}),X=t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.CanvasMutation},t)}),tt=new Gd({mutationCb:K,adoptedStyleSheetCb:t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.AdoptedStyleSheet},t)}),maskAllElementAttributes:y,maskAttributeFn:_}),et=new Sd({mirror:Kd,mutationCb:K,stylesheetManager:tt,recordCrossOriginIframes:M,wrappedEmit:Ud});for(const t of F||[])t.getMirror&&t.getMirror({nodeMirror:Kd,crossOriginIframeMirror:et.crossOriginIframeMirror,crossOriginIframeStyleMirror:et.crossOriginIframeStyleMirror});const it=new Zd,nt=null==C?void 0:C.configured;Wd=new Vd({recordCanvas:I,mutationCb:X,win:window,blockClass:r,blockSelector:o,mirror:Kd,sampling:k.canvas,dataURLOptions:B,resolutionScale:x,canvasMasking:C});const st=new xd({mutationCb:K,scrollCb:Y,bypassOptions:{blockClass:r,blockSelector:o,maskTextClass:u,maskTextSelector:h,inlineStylesheet:c,maskInputOptions:U,dataURLOptions:B,maskTextFn:m,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:_,recordCanvas:I,canvasMaskingConfigured:nt,inlineImages:A,sampling:k,slimDOMOptions:z,iframeManager:et,stylesheetManager:tt,canvasManager:Wd,keepIframeSrcFn:D,processedNodeManager:it,attributeFilter:N},mirror:Kd});zd=(t=!1)=>{if(E){bh(d);try{Ud({type:Nu.Meta,data:{href:window.location.href,width:Bc(),height:qc()}},t),null==e||e.cancel(),e=void 0,tt.reset(),st.init(),ud.forEach(t=>t.lock());let i=null,n=[];try{i=function(t,e){const{mirror:i=new Vh,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:u=!1,canvasMaskingConfigured:h,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f=!1,maskAttributeFn:p,slimDOM:g=!1,dataURLOptions:m,preserveWhiteSpace:y,onSerialize:_,onIframeLoad:b,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C=()=>!1,maxDepth:T,inlineStylesheetBudgetRules:E}=e||{},I=!0===c?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===c?{password:!0}:c,M=Tc(g);bh(E);try{return $c(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:I,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f,maskAttributeFn:p,slimDOMOptions:M,dataURLOptions:m,inlineImages:a,recordCanvas:u,canvasMaskingConfigured:h,preserveWhiteSpace:y,onSerialize:_,onIframeLoad:b,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C,newlyAddedElement:!1,maxDepth:T})}finally{wh()}}(document,{mirror:Kd,blockClass:r,blockSelector:o,maskTextClass:u,maskTextSelector:h,inlineStylesheet:c,maskAllInputs:U,inlineStylesheetBudgetRules:d,maskTextFn:m,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:_,slimDOM:z,dataURLOptions:B,recordCanvas:I,canvasMaskingConfigured:nt,inlineImages:A,onSerialize(t){Vc(t,Kd)&&et.addIframe(t),Gc(t,Kd)&&tt.trackLinkElement(t),Zc(t)&&st.addShadowRoot(nh.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=Th()}if(!i)return console.warn("Failed to snapshot the document");if(Ud({type:Nu.FullSnapshot,data:{node:i,initialOffset:Nc(window)}},t),ud.forEach(t=>t.unlock()),Wd.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&&Rc(()=>{o=e.beginDeferredLinkInlining(i,Kd.getId(i))})},u=()=>{if(!o)return;const t=o;let e=!0;Rc(()=>{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,Ih(1)}e+=1}while(!n&&l()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));n||(l()?s=Xd(c):i())};return s=Xd(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);Ih(e),null==o||o.discard(),o=null}i()}}}(n,tt,()=>{e===t&&(e=void 0)});e=t}M&&et.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&tt.adoptStyleSheets(document.adoptedStyleSheets,Kd.getId(document))}finally{wh()}}};try{const t=[];t.push(Ic("pagehide",()=>{try{null==e||e.flush()}catch(t){}e=void 0},window));for(const e of["visibilitychange","freeze","resume"])t.push(Ic(e,oh,document));Z=e=>{const i=G.get(e);i&&(i.forEach(e=>{Rc(e);const i=t.indexOf(e);-1!==i&&t.splice(i,1)}),G.delete(e))},Q=()=>{for(const[t]of G){const e=Kd.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 ad(_d)({mutationCb:K,mousemoveCb:(t,e)=>Ud({type:Nu.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.MouseInteraction},t)}),scrollCb:Y,viewportResizeCb:t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.ViewportResize},t)}),inputCb:t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.Input},t)}),mediaInteractionCb:t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.MediaInteraction},t)}),styleSheetRuleCb:t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.StyleSheetRule},t)}),styleDeclarationCb:t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.StyleDeclaration},t)}),canvasMutationCb:X,fontCb:t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.Font},t)}),selectionCb(t){Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.Selection},t)})},customElementCb(t){Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.CustomElement},t)})},blockClass:r,ignoreClass:l,ignoreSelector:a,maskTextClass:u,maskTextSelector:h,maskInputOptions:U,inlineStylesheet:c,sampling:k,recordDOM:E,recordCanvas:I,canvasMaskingConfigured:nt,inlineImages:A,userTriggeredOnInput:P,collectFonts:O,doc:t,maskInputFn:g,maskTextFn:m,maskAllElementAttributes:y,maskAttributeFn:_,keepIframeSrcFn:D,blockSelector:o,slimDOMOptions:z,dataURLOptions:B,mirror:Kd,iframeManager:et,stylesheetManager:tt,shadowDomManager:st,processedNodeManager:it,canvasManager:Wd,ignoreCSSAttributes:L,attributeFilter:N,plugins:(null==F||null===(e=F.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({observer:t.observer,options:t.options,callback:e=>Ud({type:Nu.Plugin,data:{plugin:t.name,payload:e}})})))||[]},b)};et.addLoadListener(e=>{try{const n=Kd.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=Kd.getId(t);null==Z||Z(e),vd(t)});let n=-1;const s=t=>Ud({type:Nu.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?Kd.getId(l):-1;a!==n&&(-1!==n&&s({id:n,enter:!1}),n=a,-1!==a&&s({id:a,enter:!0}))},v=()=>{zd();const e=i(document);"function"==typeof e&&t.push(e),t.push(Ic("fullscreenchange",d)),t.push(Ic("webkitfullscreenchange",d)),t.push(Ic("mozfullscreenchange",d)),t.push(Ic("MSFullscreenChange",d)),Qd=!0};return["interactive","complete"].includes(document.readyState)?v():(t.push(Ic("DOMContentLoaded",()=>{Ud({type:Nu.DomContentLoaded,data:{}}),"DOMContentLoaded"===R&&v()})),t.push(Ic("load",()=>{Ud({type:Nu.Load,data:{}}),"load"===R&&v()},window))),()=>{try{null==e||e.flush()}catch(t){}e=void 0,Pc(t),it.destroy(),et.removeLoadListener(),et.destroy(),G.clear(),st.reset(),Kd.reset(),Qd=!1,ld()}}catch(t){console.warn(t)}}tv.addCustomEvent=(t,e)=>{if(!Qd)throw new Error("please add custom event after start recording");Ud({type:Nu.Custom,data:{tag:t,payload:e}})},tv.freezePage=()=>{ud.forEach(t=>t.freeze())},tv.takeFullSnapshot=t=>{if(!Qd)throw new Error("please take full snapshot after start recording");zd(t)},tv.mirror=Kd,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var ev=Object.create(null);function iv(t){return iv="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},iv(t)}function nv(t,e,i){return(e=function(t){var e=function(t){if("object"!=iv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=iv(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==iv(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}ev.Node=Object.create(null),ev.ShadowRoot=Object.create(null),ev.MutationObserver=Object.create(null),ev.Element=Object.create(null);var sv=class{constructor(t){nv(this,"fileName",void 0),nv(this,"functionName",void 0),nv(this,"lineNumber",void 0),nv(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}`}},rv=/(^|@)\S+:\d+/,ov=/^\s*at .*(\S+:\d+|\(native\))/m,lv=/^(eval@)?(\[native code])?$/,av={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(ov)?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(ov)},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 sv({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(lv)},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 sv({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(e),n=i&&i[1]?i[1]:void 0,s=this.extractLocation(t.replace(e,""));return new sv({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 sv({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 sv({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(rv)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),i=this.extractLocation(e.pop());return new sv({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function uv(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 hv(t){return Array.isArray(t)}function cv(t){return"object"==typeof t&&null!==t&&!hv(t)}function dv(t,e){if(0===e)return!0;const i=Object.keys(t);for(const n of i)if(cv(t[n])&&dv(t[n],e-1))return!0;return!1}function vv(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(cv(r=e)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||cv(r)&&dv(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]=hv(n)?uv(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 fv={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 pv(t,e,i){const n=i?Object.assign({},fv,i):fv,s=n.logger;if(!s)return()=>{};let r;r="string"==typeof s?e[s]:s;let o=0,l=!1,a=!0;const u=[];if(n.level.includes("error")){const i=e=>{const i=e.message;t({level:"error",trace:av.parse(e.error).map(t=>t.toString()),payload:[vv(i,n.stringifyOptions)]})};e.addEventListener("error",i),u.push(()=>{e.removeEventListener("error",i)});const s=e=>{let i,s;e.reason instanceof Error?(i=e.reason,s=[vv(`Uncaught (in promise) ${i.name}: ${i.message}`,n.stringifyOptions)]):(i=new Error,s=[vv("Uncaught (in promise)",n.stringifyOptions),vv(e.reason,n.stringifyOptions)]),t({level:"error",trace:av.parse(i).map(t=>t.toString()),payload:s})};e.addEventListener("unhandledrejection",s),u.push(()=>{e.removeEventListener("unhandledrejection",s)})}for(const t of n.level)u.push(h(r,t));return()=>{a=!1,u.forEach(t=>t())};function h(e,i){return e[i]?function(s,r){try{if(!(r in s))return()=>{};const u=s[r],h={next:u},c=(s=>(...r)=>{if(s.apply(e,r),a&&!("assert"===i&&r[0]||l)){l=!0;try{const e=av.parse(new Error).map(t=>t.toString()).splice(1),s=("assert"===i?r.slice(1):r).map(t=>vv(t,n.stringifyOptions));o++,n.lengthThreshold>o?t({level:i,trace:e,payload:s}):o===n.lengthThreshold&&t({level:"warn",trace:[],payload:[vv("The number of log records reached the threshold.")]})}catch(t){s.apply(e,["rrweb logger error:",t,...r])}finally{l=!1}}})(function(...t){return h.next.apply(this,t)});return"function"==typeof c&&(c.prototype=c.prototype||{},Object.defineProperties(c,{__rrweb_original__:{enumerable:!1,value:u},__rrweb_layer__:{enumerable:!1,value:h}})),s[r]=c,()=>{if(s[r]===c)return void(s[r]=h.next);const t=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let e=s[r],i=t(e);for(;i;){if(i.next===c)return void(i.next=h.next);e=i.next,i=t(e)}}}catch(t){return()=>{}}}(e,i):()=>{}}}var gv=t=>({name:"rrweb/console@1",observer:pv,options:t});const mv=()=>{},yv=t=>{var e;if(ke(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function _v(t,e,i){try{if(!(e in t))return mv;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=yv(i);for(;r;){if(r.next===s)return void(r.next=n.next);i=r.next,r=yv(i)}}}catch(t){return mv}}function bv(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 wv=Ws("[Recorder]"),kv=t=>"navigation"===t.entryType,Sv=t=>"resource"===t.entryType;function xv(t,e){return!!e&&(Pe(e)||e[t])}function Cv(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 $v=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function Tv({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:!!Cv(e)&&t(e.url)}catch(t){return!1}}(n))return!1;if(s($v))return!1;if(Pe(e))return!0;if(we(e))return s(e);const r=e[t];return Pe(r)?r:s(r)}function Ev(t,e,i,n,s){return Iv.apply(this,arguments)}function Iv(){return Iv=ne(function*(t,e,i,n,s,r=0){if(r>10)return wv.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=>Sv(t)&&t.initiatorType===e&&(Ce(n)||t.startTime>=n)&&(Ce(s)||s>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*r)),Ev(t,e,i,n,s,r+1))}),Iv.apply(this,arguments)}function Mv({body:t,options:e,url:i}){if(Ie(t))return null;const{hostname:n,isHostDenied:s}=bv(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(Oe(t))return or(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 Rv=t=>!Ee(t)&&("navigation"===t.entryType||"resource"===t.entryType);function Pv({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(Rv(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 Ov=["video/","audio/"];function Av(t){return Se(t)&&ke(t.getReader)&&ke(t.tee)}const Fv="[SessionReplay] Timeout while trying to read body",Dv="[SessionReplay] Failed to read body";function Lv(t){return`${Dv}: ${t}`}function Nv(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function qv(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const i=setTimeout(()=>e(Fv),500);try{t.clone().text().then(t=>e(t),t=>e(Lv(t))).finally(()=>clearTimeout(i))}catch(t){clearTimeout(i),e(Dv)}})}(t);const i=eo(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(Nv(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(Fv),500);let a;try{a=t.clone()}catch(t){return void o(Dv)}const u=a.body;if(!Av(u)||"undefined"==typeof TextDecoder){try{a.text().then(t=>o(t),t=>o(Lv(t)))}catch(t){o(Dv)}return}try{n=u.getReader()}catch(t){return void o(Dv)}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(Nv(e));c+=n.byteLength,h.push(n)}t()}},t=>o(Lv(t)))}()})}(t,i)}function Bv(){return Bv=ne(function*({r:t,options:e,url:i}){const{hostname:n,isHostDenied:s}=bv(i,e);return s?Promise.resolve(n+" is in deny list"):qv(t,e)}),Bv.apply(this,arguments)}function jv(){return jv=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=Ov.some(t=>null==s?void 0:s.startsWith(t));if(s&&r)return`Content-Type ${s} is not supported`;const{hostname:o,isHostDenied:l}=bv(i,e);return l?o+" is in deny list":null}({r:t,options:e,url:i});return Ee(n)?qv(t,e):Promise.resolve(n)}),jv.apply(this,arguments)}let Hv=null;function Uv(t,e,i){if(!("performance"in e))return()=>{};if(Hv)return wv.warn("Network observer already initialised, doing nothing"),()=>{};const n=i?Object.assign({},io,i):io,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&&ho.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=>kv(t)||Sv(t)&&i.initiatorTypes.includes(t.initiatorType)).flatMap(t=>Pv({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=>kv(t)||Sv(t)&&i.initiatorTypes.includes(t.initiatorType)&&(t=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>Pv({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=xv("request",i.recordHeaders),s=xv("response",i.recordHeaders),r=_v(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=>(Tv({type:"request",headers:d,url:l,recordBody:i.recordBody})&&(a.requestBody=Mv({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),Tv({type:"response",headers:n,url:l,recordBody:i.recordBody})&&(a.responseBody=Mv({body:c.response,options:i,url:l})),Ev(e,"xmlhttprequest",r.url,u,h).then(e=>{t({requests:Pv({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){wv.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=xv("request",i.recordHeaders),s=xv("response",i.recordHeaders),r=_v(e,"fetch",r=>function(){var o=ne(function*(o,l){let a,u;try{a=new Request(o,l)}catch(t){return wv.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),!Av(null==l?void 0:l.body)&&Tv({type:"request",headers:t,url:o,recordBody:i.recordBody})&&(h.requestBody=yield function(t){return Bv.apply(this,arguments)}({r:a,options:i,url:o}))}catch(t){wv.error("Failed to record fetch request for network capture",t)}c=e.performance.now(),u=Cv(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),Tv({type:"response",headers:t,url:o,recordBody:i.recordBody})&&(h.responseBody=yield function(t){return jv.apply(this,arguments)}({r:u,options:i,url:o}))}catch(t){wv.error("Failed to record fetch response for network capture",t)}return u}finally{Ev(e,"fetch",a.url,c,d).then(e=>{t({requests:Pv({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)),Hv=()=>{r(),o(),l(),Hv=null},Hv}const zv=t=>({name:"rrweb/network@1",observer:Uv,options:t});var Wv,Vv,Gv,Zv,Qv,Jv,Kv,Yv,Xv,tf,ef,nf,sf,rf,of;d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:gv,getRecordNetworkPlugin:zv},d.__PosthogExtensions__.rrweb={record:tv,version:"v2",wasMaxDepthReached:()=>Cc,resetMaxDepthState(){Cc=!1,xc=!1},getLastSnapshotCost:()=>vh,getMutationCost:()=>le({},yh),resetSnapshotCostState(){uh=0,hh=0,ch=0,rh=0,dh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},vh=null,fh=null,ph=[],gh=0,mh=0,yh={slowestBatchMs:0},_h={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},d.rrweb={record:tv,version:"v2"},d.rrwebConsoleRecord={getRecordConsolePlugin:gv},d.getRecordNetworkPlugin=zv,d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initSessionRecording=(t,e)=>new Du(t,e);var lf,af,uf,hf,cf={},df=[],vf=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ff=Array.isArray;function pf(t,e){for(var i in e)t[i]=e[i];return t}function gf(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function mf(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?Wv.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 yf(t,o,n,s,null)}function yf(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?++Gv:s,__i:-1,__u:0};return null==s&&null!=Vv.vnode&&Vv.vnode(r),r}function _f(t){return t.children}function bf(t,e){this.props=t,this.context=e}function wf(t,e){if(null==e)return t.__?wf(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?wf(t):null}function kf(t){if(t.__P&&t.__d){var e=t.__v,i=e.__e,n=[],s=[],r=pf({},e);r.__v=e.__v+1,Vv.vnode&&Vv.vnode(r),Pf(t.__P,r,e,t.__n,t.__P.namespaceURI,32&e.__u?[i]:null,n,null==i?wf(e):i,!!(32&e.__u),s),r.__v=e.__v,r.__.__k[r.__i]=r,Af(n,r,s),e.__e=e.__=null,r.__e!=i&&Sf(r)}}function Sf(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}),Sf(t)}function xf(t){(!t.__d&&(t.__d=!0)&&Zv.push(t)&&!Cf.__r++||Qv!=Vv.debounceRendering)&&((Qv=Vv.debounceRendering)||Jv)(Cf)}function Cf(){try{for(var t,e=1;Zv.length;)Zv.length>e&&Zv.sort(Kv),t=Zv.shift(),e=Zv.length,kf(t)}finally{Zv.length=Cf.__r=0}}function $f(t,e,i,n,s,r,o,l,a,u,h){var c,d,v,f,p,g,m,y=n&&n.__k||df,_=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]=yf(null,o,null,null,null):ff(o)?o=t.__k[r]=yf(_f,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=t.__k[r]=yf(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=Ef(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=wf(l)),Lf(l,l));return n}(i,e,y,a,_),c=0;_>c;c++)null!=(v=i.__k[c])&&(d=-1!=v.__i&&y[v.__i]||cf,v.__i=c,g=Pf(t,v,d,s,r,o,l,a,u,h),f=v.__e,v.ref&&d.ref!=v.ref&&(d.ref&&Df(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=Tf(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 Tf(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=Tf(s[r],e,i,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=wf(t)),i.insertBefore(t.__e,e||null)),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function Ef(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 If(t,e,i){"-"==e[0]?t.setProperty(e,null==i?"":i):t[e]=null==i?"":"number"!=typeof i||vf.test(e)?i:i+"px"}function Mf(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||If(t.style,e,"");if(i)for(e in i)n&&i[e]==n[e]||If(t.style,e,i[e])}else if("o"==e[0]&&"n"==e[1])r=e!=(e=e.replace(ef,"$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[tf]=n[tf]:(i[tf]=nf,t.addEventListener(e,r?rf:sf,r)):t.removeEventListener(e,r?rf:sf,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 Rf(t){return function(e){if(this.l){var i=this.l[e.type+t];if(null==e[Xv])e[Xv]=nf++;else if(i[tf]>e[Xv])return;return i(Vv.event?Vv.event(e):e)}}}function Pf(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=Vv.__b)&&h(e);t:if("function"==typeof C){c=o.length;try{if(y=e.props,_=C.prototype&&C.prototype.render,$=(h=C.contextType)&&n[h.__c],b=h?$?$.props.value:h.__:n,i.__c?m=(d=e.__c=i.__c).__=d.__E:(_?e.__c=d=new C(y,b):(e.__c=d=new bf(y,b),d.constructor=C,d.render=Nf),$&&$.sub(d),d.state||(d.state={}),d.__n=n,v=d.__d=!0,d.__h=[],d._sb=[]),_&&null==d.__s&&(d.__s=d.state),_&&null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=pf({},d.__s)),pf(d.__s,C.getDerivedStateFromProps(y,d.__s))),f=d.props,p=d.state,d.__v=e,v)_&&null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),_&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(_&&null==C.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,b),e.__v==i.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,b)){e.__v!=i.__v&&(d.props=y,d.state=d.__s,d.__d=!1),e.__e=i.__e,e.__k=i.__k,e.__k.some(function(t){t&&(t.__=e)}),df.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break t}null!=d.componentWillUpdate&&d.componentWillUpdate(y,d.__s,b),_&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(f,p,g)})}if(d.context=b,d.props=y,d.__P=t,d.__e=!1,w=Vv.__r,k=0,_)d.state=d.__s,d.__d=!1,w&&w(e),h=d.render(d.props,d.state,d.context),df.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=pf(pf({},n),d.getChildContext())),_&&!v&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(f,p)),S=null!=h&&h.type===_f&&null==h.key?Ff(h.props.children):h,l=$f(t,ff(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--;)gf(r[x]);Of(e)}else e.__e=i.__e,!e.__k&&i.__k&&(e.__k=i.__k),t.then||Of(e);Vv.__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||cf,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&&(Vv.__m&&Vv.__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&&Wv.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||Mf(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||Mf(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=""),$f("template"==e.type?t.content:t,ff(d)?d:[d],e,i,n,"foreignObject"==y?"http://www.w3.org/1999/xhtml":s,r,o,r?r[0]:i.__k&&wf(i,0),l,a),null!=r)for(u=r.length;u--;)gf(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])&&Mf(t,u,f,g[u],s),u="checked",null!=p&&p!=t[u]&&Mf(t,u,p,g[u],s))}return t}(i.__e,e,i,n,s,r,o,a,u);return(h=Vv.diffed)&&h(e),128&e.__u?void 0:l}function Of(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(Of))}function Af(t,e,i){for(var n=0;i.length>n;n++)Df(i[n],i[++n],i[++n]);Vv.__c&&Vv.__c(e,t),t.some(function(e){try{t=e.__h,e.__h=[],t.some(function(t){t.call(e)})}catch(t){Vv.__e(t,e.__v)}})}function Ff(t){return"object"!=typeof t||null==t||t.__b>0?t:ff(t)?t.map(Ff):void 0!==t.constructor?null:pf({},t)}function Df(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){Vv.__e(t,i)}}function Lf(t,e,i){var n,s;if(Vv.unmount&&Vv.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Df(n,null,e)),null!=(n=t.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(t){Vv.__e(t,e)}n.base=n.__P=n.__n=null}if(n=t.__k)for(s=0;n.length>s;s++)n[s]&&Lf(n[s],e,i||"function"!=typeof t.type);i||gf(t.__e),t.__c=t.__=t.__e=void 0}function Nf(t,e,i){return this.constructor(t,i)}function qf(t,e,i){var n,s,r,o;e==document&&(e=document.documentElement),Vv.__&&Vv.__(t,e),s=(n="function"==typeof i)?null:i&&i.__k||e.__k,r=[],o=[],Pf(e,t=(!n&&i||e).__k=mf(_f,null,[t]),s||cf,cf,e.namespaceURI,!n&&i?[i]:s?null:e.firstChild?Wv.call(e.childNodes):null,r,!n&&i?i:s?s.__e:e.firstChild,n,o),Af(r,t,o),t.props.children=null}Wv=df.slice,Vv={__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}},Gv=0,bf.prototype.setState=function(t,e){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=pf({},this.state);"function"==typeof t&&(t=t(pf({},i),this.props)),t&&pf(i,t),null!=t&&this.__v&&(e&&this._sb.push(e),xf(this))},bf.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),xf(this))},bf.prototype.render=_f,Zv=[],Jv="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Kv=function(t,e){return t.__v.__b-e.__v.__b},Cf.__r=0,Yv=Math.random().toString(8),Xv="__d"+Yv,tf="__a"+Yv,ef=/(PointerCapture)$|Capture$/i,nf=0,sf=Rf(!1),rf=Rf(!0),of=0;var Bf=0,jf=[],Hf=Vv,Uf=Hf.__b,zf=Hf.__r,Wf=Hf.diffed,Vf=Hf.__c,Gf=Hf.unmount,Zf=Hf.__;function Qf(t,e){Hf.__h&&Hf.__h(af,t,Bf||e),Bf=0;var i=af.__H||(af.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function Jf(t){return Bf=1,function(t,e){var i=Qf(lf++,2);if(i.t=t,!i.__c&&(i.__=[lp(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=af,!af.__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};af.__f=!0;var s=af.shouldComponentUpdate,r=af.componentWillUpdate;af.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)},af.shouldComponentUpdate=n}return i.__N||i.__}(lp,t)}function Kf(t,e){var i=Qf(lf++,3);!Hf.__s&&op(i.__H,e)&&(i.__=t,i.u=e,af.__H.__h.push(i))}function Yf(t){return Bf=5,Xf(function(){return{current:t}},[])}function Xf(t,e){var i=Qf(lf++,7);return op(i.__H,e)&&(i.__=t(),i.__H=e,i.__h=t),i.__}function tp(t){var e=af.context[t.__c],i=Qf(lf++,9);return i.c=t,e?(null==i.__&&(i.__=!0,e.sub(af)),e.props.value):t.__}function ep(){for(var t;t=jf.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(sp),e.__h.some(rp),e.__h=[]}catch(i){e.__h=[],Hf.__e(i,t.__v)}}}Hf.__b=function(t){af=null,Uf&&Uf(t)},Hf.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Zf&&Zf(t,e)},Hf.__r=function(t){zf&&zf(t),lf=0;var e=(af=t.__c).__H;e&&(uf===af?(e.__h=[],af.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.length&&ep(),lf=0)),uf=af},Hf.diffed=function(t){Wf&&Wf(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==jf.push(e)&&hf===Hf.requestAnimationFrame||((hf=Hf.requestAnimationFrame)||np)(ep)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),uf=af=null},Hf.__c=function(t,e){e.some(function(t){try{t.__h.some(sp),t.__h=t.__h.filter(function(t){return!t.__||rp(t)})}catch(i){e.some(function(t){t.__h&&(t.__h=[])}),e=[],Hf.__e(i,t.__v)}}),Vf&&Vf(t,e)},Hf.unmount=function(t){Gf&&Gf(t);var e,i=t.__c;i&&i.__H&&(i.__H.__.some(function(t){try{sp(t)}catch(t){e=t}}),i.__H=void 0,e&&Hf.__e(e,i.__v))};var ip="function"==typeof requestAnimationFrame;function np(t){var e,i=function(){clearTimeout(n),ip&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(i,35);ip&&(e=requestAnimationFrame(i))}function sp(t){var e=af,i=t.__c;"function"==typeof i&&(t.__c=void 0,i()),af=e}function rp(t){var e=af;t.__c=t.__(),af=e}function op(t,e){return!t||t.length!==e.length||e.some(function(e,i){return e!==t[i]})}function lp(t,e){return"function"==typeof e?e(t):e}const ap={GZipJS:"gzip-js",Base64:"base64"},up={Activation:"events",Cancellation:"cancelEvents"},hp={Button:"button",Tab:"tab",Selector:"selector"},cp={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},dp={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},vp={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},fp={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},pp={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},gp={Once:"once",Recurring:"recurring",Always:"always"},mp={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},yp={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},_p={Popover:"popover",Inline:"inline"};function bp(t){let e=!0;return{dispose(){if(e){e=!1;const i=t();i&&ke(i.then)&&i.then(void 0,()=>{})}}}}const wp=Ws("[Surveys]"),kp="PostHog is not capturing, so a survey response cannot be recorded";function Sp(t){return ke(t.is_capturing)?t.is_capturing():!t.has_opted_out_capturing()}function xp(t){return!(!t.start_date||t.end_date)}function Cp(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 $p=(t,e)=>`${t}${function(t){return t.current_iteration&&t.current_iteration>0?`${t.id}_${t.current_iteration}`:t.id}(e)}`,Tp=t=>$p("seenSurvey_",t),Ep=t=>{try{const e=Tp(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){wp.error("Failed to persist survey seen state",t)}},Ip=[vp.Popover,vp.Widget,vp.API],Mp={ignoreConditions:!1,ignoreDelay:!1,displayType:_p.Popover},Rp="logs",Pp=Ws("[Stylesheet Loader]"),Op=t,Ap=n,Fp="#020617",Dp={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:cp.Right,widgetType:hp.Tab,widgetLabel:"Feedback",widgetColor:"black",zIndex:String(2147483645),disabledButtonOpacity:"0.6",maxWidth:"300px",textSubtleColor:"#939393",boxPadding:"20px 24px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"10px",shuffleQuestions:!1,surveyPopupDelaySeconds:void 0,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:Fp,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},Lp=[cp.Center,cp.Left,cp.Right];function Np(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 qp(t=Dp.backgroundColor){let e;"#"===t[0]&&(e=Np(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=Np(i)),!e)return Fp;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?Fp:"white"}return Fp}const Bp=(t,e,i)=>{const n=rg(t),s=Ap.querySelector(`.${n}`);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};const r=Ap.createElement("div");((t,e,i)=>{const n=le(le({},Dp),i),s=t.style,r=!Lp.includes(n.position)||e===vp.Widget&&(null==i?void 0:i.widgetType)===hp.Tab;s.setProperty("--ph-survey-font-family",function(t){if("inherit"===t)return"inherit";const e='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return t?`${t}, ${e}`:`-apple-system, ${e}`}(n.fontFamily)),s.setProperty("--ph-survey-box-padding",n.boxPadding),s.setProperty("--ph-survey-max-width",n.maxWidth),s.setProperty("--ph-survey-z-index",n.zIndex),s.setProperty("--ph-survey-border-color",n.borderColor),r?(s.setProperty("--ph-survey-border-radius",n.borderRadius),s.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(s.setProperty("--ph-survey-border-bottom","none"),s.setProperty("--ph-survey-border-radius",`${n.borderRadius} ${n.borderRadius} 0 0`)),s.setProperty("--ph-survey-background-color",n.backgroundColor),s.setProperty("--ph-survey-box-shadow",n.boxShadow),s.setProperty("--ph-survey-disabled-button-opacity",n.disabledButtonOpacity),s.setProperty("--ph-survey-submit-button-color",n.submitButtonColor),s.setProperty("--ph-survey-submit-button-text-color",(null==i?void 0:i.submitButtonTextColor)||qp(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",qp(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||qp(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",qp(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)||qp(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||(Pp.error("prepare_external_dependency_stylesheet returned null"),null)})(Ap,':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||Ap.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},jp=({responses:t,survey:e,surveySubmissionId:i,posthog:n,isSurveyCompleted:s,properties:r,surveyLanguage:o,questionSnapshots:l})=>{var a;n?Sp(n)&&(Ep(e),n.capture(mp.SENT,le(le(le(le({[yp.SURVEY_NAME]:e.name,[yp.SURVEY_ID]:e.id,[yp.SURVEY_ITERATION]:e.current_iteration,[yp.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,[yp.SURVEY_SUBMISSION_ID]:i,[yp.SURVEY_COMPLETED]:s},o&&{[yp.SURVEY_LANGUAGE]:o}),{},{sessionRecordingUrl:null===(a=n.get_session_replay_url)||void 0===a?void 0:a.call(n)},ea(t,e,l)),r),{},{$set:{[na(e,"responded")]:!0}})),s&&(Op.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:e.id}})),sg(e),n.reloadFeatureFlags())):wp.error("[survey sent] event not captured, PostHog instance not found.")},Hp=(t,e,i)=>{var n;return le(le({[yp.SURVEY_NAME]:t.name,[yp.SURVEY_ID]:t.id,[yp.SURVEY_ITERATION]:t.current_iteration,[yp.SURVEY_ITERATION_START_DATE]:t.current_iteration_start_date,[yp.SURVEY_PARTIALLY_COMPLETED]:ia(null==e?void 0:e.responses)},(null==e?void 0:e.surveyLanguage)&&{[yp.SURVEY_LANGUAGE]:e.surveyLanguage}),{},{sessionRecordingUrl:null===(n=i.get_session_replay_url)||void 0===n?void 0:n.call(i),[yp.SURVEY_SUBMISSION_ID]:null==e?void 0:e.surveySubmissionId},ea(null==e?void 0:e.responses,t,null==e?void 0:e.questionSnapshots))},Up=(t,e,i,n)=>{if(!e)return void wp.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const s=ig(t),r=s?s.surveyLanguage:n;e.capture(mp.DISMISSED,le(le(le({},Hp(t,s,e)),r&&{[yp.SURVEY_LANGUAGE]:r}),{},{$set:{[na(t,"dismissed")]:!0}})),sg(t),Ep(t),Op.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:t.id}}))},zp=(t,e)=>{if(!e)return void wp.error("[survey abandoned] event not captured, PostHog instance not found.");const i=(t=>$p("abandonedSurvey_",t))(t);try{if("true"===localStorage.getItem(i))return}catch(t){return}const n=ig(t);if(n){try{localStorage.setItem(i,"true")}catch(t){}e.capture(mp.ABANDONED,Hp(t,n,e),{transport:"sendBeacon"})}},Wp=t=>t.map(t=>({sort:Math.floor(10*Math.random()),value:t})).sort((t,e)=>t.sort-e.sort).map(t=>t.value),Vp=(t,e)=>t.length===e.length&&t.every((t,i)=>t===e[i])?e.reverse():e,Gp=t=>{const e=t.map(t=>t.id);return e.every(t=>!!t)?e:void 0},Zp=(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?Vp(t.questions,Wp(t.questions)):t.questions;var i},Qp=t=>ha(t)||ng(t),Jp=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,xf(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"+of++,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}),Kp=()=>tp(Jp),Yp=({component:t,children:e,renderAsHtml:i,style:n})=>function(t,e,i){var n,s,r,o,l=pf({},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?Wv.call(arguments,2):i),yf(t.type,l,n||t.key,s||t.ref,null)}(t,i?{dangerouslySetInnerHTML:{__html:e},style:n}:{children:e,style:n});function Xp(t,e){var i,n;if(!(null===(i=t.conditions)||void 0===i?void 0:i.url))return!0;const s=vr(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 va[o](r,[s])}const tg=t=>$p("inProgressSurvey_",t),eg=(t,e)=>{try{localStorage.setItem(tg(t),JSON.stringify(e))}catch(t){wp.error("Error setting in-progress survey state in localStorage",t)}},ig=t=>{try{const e=localStorage.getItem(tg(t));if(e)return JSON.parse(e)}catch(t){wp.error("Error getting in-progress survey state from localStorage",t)}return null},ng=t=>{const e=ig(t);return!Ie(null==e?void 0:e.surveySubmissionId)},sg=t=>{try{localStorage.removeItem(tg(t))}catch(t){wp.error("Error clearing in-progress survey state from localStorage",t)}};function rg(t,e=!1){const i=`PostHogSurvey-${t.id}`;return e?`.${i}`:i}function og(t,e=cp.Right,i){if(t===vp.ExternalSurvey)return{};switch(e){case cp.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case cp.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case cp.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case cp.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case cp.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case cp.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case cp.Left:return{left:"30px"};case cp.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:t===vp.Widget&&i===hp.Tab?"60px":"30px"}}}var lg=0;function ag(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:--lg,__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 Vv.vnode&&Vv.vnode(u),u}const ug=ag("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ag("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"})}),hg=ag("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ag("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"})}),cg=ag("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ag("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"})}),dg=ag("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ag("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"})}),vg=ag("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ag("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"})}),fg=ag("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:ag("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"})}),pg=ag("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:ag("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"})}),gg=({fill:t="currentColor"}={})=>ag("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:[ag("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),ag("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})]}),mg=ag("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ag("g",{"clip-path":"url(#clip0_2415_6911)",children:[ag("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:ag("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),ag("g",{mask:"url(#mask0_2415_6911)",children:[ag("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"}),ag("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"}),ag("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"}),ag("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"}),ag("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"}),ag("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"})]})]}),ag("defs",{children:ag("clipPath",{id:"clip0_2415_6911",children:ag("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function yg({urlParams:t}){const e=t?Object.entries(t).map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"):"";return ag("a",{href:"https://posthog.com/surveys"+(e?`?${e}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",mg]})}function _g({text:e,submitDisabled:i,appearance:n,onSubmit:s,link:r,onPreviewSubmit:o,skipSubmitButton:l,canGoBack:a,onBack:u}){const{isPreviewMode:h}=tp(Jp),c=!!a&&!!u,d=!l&&ag("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 ag("div",{className:"bottom-section",children:[c?ag("div",{className:"form-buttons form-buttons-with-back",children:[ag("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:u,children:n.backButtonText||"Back"}),d]}):d,!n.whiteLabel&&ag(yg,{urlParams:{utm_source:"survey-footer"}})]})}function bg({question:t,forceDisableHtml:e,htmlFor:i}){return ag("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[ag(t.type===fp.Open?"label":"h3",{className:"survey-question",htmlFor:i,children:t.question}),t.description&&Yp({component:mf("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!e&&"text"!==t.descriptionContentType})]})}function wg({onClick:t}){const{isPreviewMode:e}=tp(Jp);return ag("button",{className:"form-cancel",onClick:t,disabled:e,"aria-label":"Close survey",type:"button",children:gg({fill:"black"})})}const kg=t;function Sg({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onClose:r}){const{isPopup:o}=tp(Jp);return Kf(()=>{const t=t=>{"Enter"!==t.key&&"Escape"!==t.key||(t.preventDefault(),r())};return er(kg,"keydown",t),()=>{kg.removeEventListener("keydown",t)}},[r]),ag("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&ag(wg,{onClick:()=>r()}),ag("h3",{className:"thank-you-message-header",children:t}),e&&Yp({component:mf("p",{className:"thank-you-message-body"}),children:e,renderAsHtml:!n&&"text"!==i}),o&&ag(_g,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>r()})]})}function xg({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onStart:r}){const{isPopup:o,onPreviewSubmit:l,onPopupSurveyDismissed:a}=tp(Jp);return ag("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&ag(wg,{onClick:()=>a()}),t&&ag("h3",{className:"intro-screen-header",children:t}),e&&Yp({component:mf("p",{className:"intro-screen-body"}),children:e,renderAsHtml:!n&&"text"!==i}),ag(_g,{text:s.introScreenButtonText||"Get started",submitDisabled:!1,appearance:s,onSubmit:r,onPreviewSubmit:()=>l(null)})]})}const Cg=t=>we(t)&&t.every(t=>$e(t));function $g({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,displayQuestionIndex:r,initialValue:o,canGoBack:l,onBack:a}){const{isPreviewMode:u}=Kp(),h=Yf(null),[c,d]=Jf(()=>$e(o)?o:""),v=null==i?void 0:i.disableAutofocus;Kf(()=>{v||setTimeout(()=>{var t;u||null===(t=h.current)||void 0===t||t.focus()},100)},[u,v]);const f=`surveyQuestion${r}`,p=Xf(()=>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=Bs(t.validation,he),m=Bs(t.validation,ce),y=Xf(()=>function(t,e){const i=1===t?void 0:t;return i&&e?`Enter ${i}-${e} characters`:i?`Enter at least ${i} ${1===i?"character":"characters"}`:e?`Maximum ${e} ${1===e?"character":"characters"}`:void 0}(g,m),[g,m]),_=()=>{p||n(c.trim())},b=()=>{p||s(c.trim())};return ag(_f,{children:[ag("div",{className:"question-container",children:[ag(bg,{question:t,forceDisableHtml:e,htmlFor:f}),ag("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&&ag("div",{className:"validation-hint",children:y})]}),ag(_g,{text:t.buttonText||"Submit",submitDisabled:!!p,appearance:i,onSubmit:_,onPreviewSubmit:b,canGoBack:l,onBack:a})]})}function Tg({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,canGoBack:r,onBack:o}){return ag(_f,{children:[ag("div",{className:"question-container",children:ag(bg,{question:t,forceDisableHtml:e})}),ag(_g,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:()=>n("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:r,onBack:o})]})}function Eg({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]=Jf(()=>Me(o)?o:we(o)&&o.length>0&&Me(parseInt(o[0]))?parseInt(o[0]):$e(o)&&Me(parseInt(o))?parseInt(o):null),f="emoji"===t.display&&2===t.scale,{isPreviewMode:p}=Kp(),g=t=>p?r(t):s(t);return ag(_f,{children:[ag("div",{className:"question-container",children:[ag(bg,{question:t,forceDisableHtml:e}),ag("div",{className:"rating-section",children:[ag("div",{className:"rating-options",children:["emoji"===t.display&&ag("div",{className:"rating-options-emoji"+(f?" rating-options-emoji-2":""),children:null===(u=Ag[t.scale])||void 0===u?void 0:u.map((e,n)=>ag("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&&ag("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${h-c+1}, minmax(0, 1fr))`},children:Fg(t.scale).map((e,s)=>ag(Ig,{displayQuestionIndex:i,active:d===e,appearance:n,num:e,setActiveNumber(e){v(e),t.skipSubmitButton&&g(e)}},s))})]}),!f&&ag("div",{className:"rating-text",children:[ag("div",{children:t.lowerBoundLabel}),ag("div",{children:t.upperBoundLabel})]})]})]}),ag(_g,{text:t.buttonText||(null==n?void 0:n.submitButtonText)||"Submit",submitDisabled:Ee(d)&&!t.optional,appearance:n,onSubmit:()=>s(d),onPreviewSubmit:()=>r(d),skipSubmitButton:t.skipSubmitButton,canGoBack:l,onBack:a})]})}function Ig({num:t,active:e,displayQuestionIndex:i,setActiveNumber:n}){return ag("button",{"aria-label":`Rate ${t}`,className:`ratings-number question-${i}-rating-${t} ${e?"rating-active":""}`,type:"button",onClick(){n(t)},children:t})}function Mg({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:l,onBack:a}){const u=Yf(null),h=Xf(()=>(t=>{if(!t.shuffleOptions)return t.choices;const e=t.choices;let i="";t.hasOpenChoice&&(i=e.pop());const n=Vp(e,Wp(e));return t.hasOpenChoice&&(t.choices.push(i),n.push(i)),n})(t),[t]),[c,d]=Jf(()=>((t,e)=>$e(t)||Cg(t)?t:e===fp.SingleChoice?null:[])(o,t.type)),[v,f]=Jf(()=>((t,e)=>{if($e(t)&&!e.includes(t))return{isSelected:!0,inputValue:t};if(Cg(t)){const i=t.find(t=>!e.includes(t));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,h)),{isPreviewMode:p}=Kp(),g=t.type===fp.SingleChoice,m=t.type===fp.MultipleChoice,y=t.skipSubmitButton&&g&&!t.hasOpenChoice,_=(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]))},b=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||!Ee(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 ag(_f,{children:[ag("div",{className:"question-container",children:[ag(bg,{question:t,forceDisableHtml:e}),ag("fieldset",{className:"multiple-choice-options limit-height",children:[ag("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 ag("label",{className:s?"choice-option-open":"",children:[ag("div",{className:"response-choice",children:[ag("input",{type:g?"radio":"checkbox",name:r,checked:l,onChange:()=>_(e,s),id:r,"aria-controls":o}),ag("span",{children:s?`${e}:`:e})]}),s&&ag("input",{type:"text",ref:u,id:o,name:`question${i}Open`,value:v.inputValue,onKeyDown:w,onInput:b,onClick(t){v.isSelected||_(e,!0),t.stopPropagation()},"aria-label":`${e} - please specify`})]},n)})]})]}),ag(_g,{text:t.buttonText||"Submit",submitDisabled:k(),appearance:n,onSubmit:S,onPreviewSubmit:S,skipSubmitButton:y,canGoBack:l,onBack:a})]})}const Rg=[1,2,3,4,5],Pg=[1,2,3,4,5,6,7],Og=[0,1,2,3,4,5,6,7,8,9,10],Ag={2:[fg,pg],3:[cg,hg,ug],5:[dg,cg,hg,ug,vg]};function Fg(t){switch(t){case 5:default:return Rg;case 7:return Pg;case 10:return Og}}const Dg=Ws("[Surveys]");function Lg(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?pp.End:r;if(s.branching.type===pp.End)return pp.End;if(s.branching.type===pp.SpecificQuestion){if(Number.isInteger(s.branching.index))return s.branching.index}else if(s.branching.type===pp.ResponseBased){if(s.type===fp.SingleChoice){var o;let t=s.choices.indexOf(`${i}`);if(-1===t&&s.hasOpenChoice&&(t=s.choices.length-1),null===(o=s.branching)||void 0===o||null===(o=o.responseValues)||void 0===o?void 0:o.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===pp.End?pp.End:r}}else if(s.type===fp.Rating){var l;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const t=function(t,e){if(2===e){if(1>t||t>2)throw new Error("The response must be in range 1-2");return 1===t?"positive":"negative"}if(3===e){if(1>t||t>3)throw new Error("The response must be in range 1-3");return 1===t?"negative":2===t?"neutral":"positive"}if(5===e){if(1>t||t>5)throw new Error("The response must be in range 1-5");return t>2?3===t?"neutral":"positive":"negative"}if(7===e){if(1>t||t>7)throw new Error("The response must be in range 1-7");return t>3?4===t?"neutral":"positive":"negative"}if(10===e){if(0>t||t>10)throw new Error("The response must be in range 0-10");return t>6?t>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(i,s.scale);if(null===(l=s.branching)||void 0===l||null===(l=l.responseValues)||void 0===l?void 0:l.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===pp.End?pp.End:r}}return r}return Dg.warn("Falling back to next question index due to unexpected branching type"),r}const Ng=Ws("[SurveyTranslations]");function qg(t,e){const i=function(t){return function({overrideLanguage:t,storedPersonProperties:e,locale:i},n){const s=sa(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?sa(t.language):null}(e);if(r)return null==n||n.info(`Using person property language: ${r}`),r;const o=sa(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:Ma()},Ng)}(e);if(!i)return Ng.info("No user language detected"),{survey:t,language:null};const n=aa(t,i,Ng);return{survey:n.survey,language:n.matchedKey}}const Bg=t,jg=n,Hg="ph:show_survey_widget",Ug="PHWidgetSurveyClickListener";function zg(t,e){try{const i=t.getBoundingClientRect(),n=Bg.innerHeight,s=Bg.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:Dp.zIndex}}catch(t){return wp.warn("Failed to calculate trigger position:",t),null}}var Wg=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)ng(e)&&zp(e,this._posthog)},this.handlePopoverSurvey=(t,e,{resumeDelayFromActivation:i=!1}={})=>{var n,s,r,o,l,a;if(!Sp(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)===cp.NextToTrigger&&(null===(r=c.appearance)||void 0===r?void 0:r.widgetSelector)){const t=jg.querySelector(c.appearance.widgetSelector);var g;t&&(p=zg(t,parseInt((null===(g=c.appearance)||void 0===g?void 0:g.maxWidth)||Dp.maxWidth))||{})}const m=(null===(o=c.appearance)||void 0===o?void 0:o.surveyPopupDelaySeconds)||0,{shadow:y}=Bp(c,this._posthog);this.xi.set(y,y.host);const _={posthog:this._posthog,survey:c,removeSurveyFromFocus:this.Ni,properties:d,style:p,isSurveyCompleted:f,skipShownEvent:null==e?void 0:e.skipShownEvent,surveyLanguage:h};if(this.$i=_,0>=m)return this.Ii=!0,qf(ag(Jg,le({},_)),y);const b=()=>{this.Ii=!0;const{survey:i,language:n}=this.Ai(t);this.Mi=n;const s=this.Li(i,e),r=le(le({},_),{},{survey:s,surveyLanguage:n});this.$i=r,qf(ag(Jg,le(le({},r),{},{survey:le(le({},s),{},{appearance:le(le({},s.appearance),{},{surveyPopupDelaySeconds:0})})})),y)},w=()=>{if(!Sp(this._posthog)||!this.qi(c))return wp.info(`Survey ${c.id} no longer eligible when its display delay elapsed; not displaying`),this.Ni(c);b()},k=i?null===(l=this._posthog.surveys)||void 0===l||null===(l=l._surveyEventReceiver)||void 0===l||null===(a=l.getActivationTimestamp)||void 0===a?void 0:a.call(l,c.id):void 0,S=Me(k)?Math.max(0,Date.now()-k):0,x=Math.max(0,1e3*m-S);if(0>=x)return w();const C=Bg.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}=Bp(i,this._posthog);this.xi.set(s,s.host),(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===hp.Tab&&this.Si.set(t.id,t),r&&qf(ag(Yg,{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(Ug),this.ki.delete(t),wp.info(`Removed click listener for survey ${t}`))},this.Hi=t=>{this.zi(t)||(this.Ui(t),this.Bi(t.id))},this.Wi=t=>{this.zi(t)||(this.Ui(t),this.Si.delete(t.id))},this.zi=t=>{try{var e;const i=jg.querySelector(rg(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=jg.querySelector(e),n=this.ki.get(t.id);if(i){if(this.ji(t),n){if(i===n.element)return;wp.info(`Selector element changed for survey ${t.id}. Re-attaching listener.`),this.Bi(t.id)}if(!i.hasAttribute(Ug)){const e=e=>{var i,n;e.stopPropagation();const s=(null===(i=t.appearance)||void 0===i?void 0:i.position)===cp.NextToTrigger?zg(e.currentTarget,parseInt((null===(n=t.appearance)||void 0===n?void 0:n.maxWidth)||Dp.maxWidth)):{};Bg.dispatchEvent(new CustomEvent(Hg,{detail:{surveyId:t.id,position:s}}))};er(i,"click",e),i.setAttribute(Ug,"true"),this.ki.set(t.id,{element:i,listener:e,survey:t}),wp.info(`Attached click listener for feedback button survey ${t.id}`)}}else n&&this.Hi(t)},this.renderPopover=t=>{if(!Sp(this._posthog))return;const{survey:e,language:i}=this.Ai(t),{shadow:n}=Bp(e,this._posthog);this.xi.set(n,n.host),qf(ag(Jg,{posthog:this._posthog,survey:e,removeSurveyFromFocus:this.Ni,surveyLanguage:i}),n)},this.renderSurvey=(t,e,i)=>{var n;if(!Sp(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)),qf(ag(Jg,{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=Sp(this._posthog),i=t.filter(t=>e&&(t.type===vp.Popover||t.type===vp.Widget)),n=new Set(i.map(t=>t.id));for(const t of Array.from(this.wi.keys()))n.has(t)||this.cancelSurvey(t);const s=this.Gi(i),r=new Set,o=new Set;s.forEach(t=>{if(t.type===vp.Widget){var e,i,n,s;if((null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===hp.Tab)return o.add(t.id),void this.ji(t);(null===(i=t.appearance)||void 0===i?void 0:i.widgetType)===hp.Selector&&(null===(n=t.appearance)||void 0===n?void 0:n.widgetSelector)&&(r.add(t.id),this.Vi(t,null===(s=t.appearance)||void 0===s?void 0:s.widgetSelector))}Ee(this.Qi)&&t.type===vp.Popover&&this.handlePopoverSurvey(t,void 0,{resumeDelayFromActivation:!0})}),this.ki.forEach(({survey:t})=>{r.has(t.id)||this.Hi(t)}),this.Si.forEach((t,e)=>{o.has(e)||this.Wi(t)})},t)},this.Fi=t=>{Ee(this.Qi)||wp.error(`Survey ${this.Qi} already in focus. Cannot add survey ${t.id}.`),this.Qi=t.id},this.Ni=t=>{this.Qi!==t.id&&wp.error(`Survey ${t.id} is not in focus. Cannot remove survey ${t.id}.`),this.Pi(t.id),this.Qi=null,this.Mi=null,this.Ii=!1,this.$i=null,this.Oi=void 0,this.Ui(t)},this._posthog=t,this.Qi=null,this.Ti=()=>this.Ji(),er(Bg,"languagechange",this.Ti),this.Ri=t.onFeatureFlags(()=>this.Ji())}Ji(){if(Ee(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}=Bp(s,this._posthog);qf(ag(Jg,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)&&(wp.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&&(Bg.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)=>{qf(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=ng(t),r=ng(e);if(s&&!r)return-1;if(!s&&r)return 1;const o=t.schedule===gp.Always,l=e.schedule===gp.Always;return o&&!l?1:!o&&l?-1:((null===(i=t.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)-((null===(n=e.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)})}Ai(t){return qg(t,this._posthog)}Zi(t,e,i){if(this.Ci.has(t.id))return!1;const{params:n}=function(){const t={};let e=!1;const i=Bg.location.search.replace(/^\?/,"");if(!i)return{params:t,autoSubmit:e};const n=i.split("&");for(const i of n){const[n,s]=i.split("=");if(!n||Ce(s))continue;const r=decodeURIComponent(n),o=decodeURIComponent(s);if("auto_submit"===r&&"true"===o){e=!0;continue}const l=r.match(/^q(\d+)$/);if(l){const e=parseInt(l[1],10);t[e]||(t[e]=[]),t[e].push(o)}}return{params:t,autoSubmit:e}}();if(0===Object.keys(n).length)return!1;wp.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)&&jp({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)];wp.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=Xl(t.id);try{switch(t.type){case fp.SingleChoice:{if(!t.choices||0===t.choices.length)return void zs.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 zs.warn(`[Survey Prefill] Invalid choice index for q${n}: ${s[0]}`);i[r]=t.choices[e];break}case fp.MultipleChoice:{if(!t.choices||0===t.choices.length)return void zs.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 zs.warn(`[Survey Prefill] No valid choices for q${n}`);const o=[...new Set(e.map(e=>t.choices[e]))];e.length>o.length&&zs.warn(`[Survey Prefill] Removed duplicate choices for q${n}`),i[r]=o;break}case fp.Rating:{const e=parseInt(s[0],10),o=t.scale||10;if(isNaN(e)||0>e||e>o)return void zs.warn(`[Survey Prefill] Invalid rating for q${n}: ${s[0]} (scale: 0-${o})`);i[r]=e;break}default:zs.info(`[Survey Prefill] Question type ${t.type} does not support prefill`)}}catch(t){zs.error(`[Survey Prefill] Error converting q${n}:`,t)}}),i}(t,e);if(0===Object.keys(n).length)return wp.warn("[Survey Prefill] No valid responses after conversion"),null;const s=El(),{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=Xl(e.id);Ce(i[t])||(s[t]=i[t])}r.push(n);const o=Lg(t,n,e.id?i[Xl(e.id)]:null);if(o===pp.End)return{startQuestionIndex:t.questions.length,skippedResponses:s,skippedIndices:r};n=o}return{startQuestionIndex:n,skippedResponses:s,skippedIndices:r}}(t,Object.keys(e).map(t=>parseInt(t,10)),n),a=r>=t.questions.length;return eg(t,{surveySubmissionId:s,responses:n,lastQuestionIndex:r,questionOrder:Gp(t.questions),visitedIndices:l,surveyLanguage:i}),wp.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:n,submissionId:s,startQuestionIndex:r,isSurveyCompleted:a,skippedResponses:o}}catch(t){return wp.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,wp.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||Xp(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 va[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==Ap?void 0:Ap.querySelector(t.conditions.selector))}(e)}rr(t){var e;return Qp(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(!xp(t))return n.eligible=!1,n.reason=`Survey is not running. It was completed on ${t.end_date}`,n;if(!Ip.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,Fl.Ot("lastSeenSurveyDate"))?(t=>!!Fl.Ot(Tp(t))&&!Qp(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 Sp(this._posthog)?{eligible:!0}:{eligible:!1,reason:kp}}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(!ua(t)&&!Cp(t))return!0;const i=null===(e=this._posthog.surveys)||void 0===e||null===(e=e._surveyEventReceiver)||void 0===e?void 0:e.getSurveys();return!!(null==i?void 0:i.includes(t.id))}ar(t){var e;return!(null===(e=t.feature_flag_keys)||void 0===e?void 0:e.length)||t.feature_flag_keys.every(({key:t,value:e})=>!t||!e||this.er(e))}qi(t){return this.checkSurveyEligibility(t).eligible&&this.ir(t)&&this.sr(t)&&this.ar(t)}Ui(t){try{const e=jg.querySelector(rg(t,!0));(null==e?void 0:e.shadowRoot)&&(qf(null,e.shadowRoot),this.xi.delete(e.shadowRoot)),null==e||e.remove()}catch(e){wp.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 Vg(t,e){if(!jg||!Bg)return;const i=new Wg(t);if(t.config.disable_surveys_automatic_display)return wp.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===e)return wp.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=()=>{jg.hidden?r():(i.callSurveysAndEvaluateDisplayLogic(!1),s())};return er(jg,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{r(),jg.removeEventListener("visibilitychange",o)}),i}function Gg({survey:t,removeSurveyFromFocus:e=()=>{},setSurveyVisible:i,isPreviewMode:n=!1,posthog:s}){Kf(()=>{var r;if(n||!(null===(r=t.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var n;const r=t.type===vp.Widget,o=Xp(t,s),l=(null===(n=t.appearance)||void 0===n?void 0:n.widgetType)===hp.Tab&&r;if(!o)return wp.info(`Hiding survey ${t.id} because URL does not match`),i(!1),e(t);l&&(wp.info(`Showing survey ${t.id} because it is a feedback button tab and URL matches`),i(!0))};er(Bg,"popstate",o),er(Bg,"hashchange",o);const l=Bg.history.pushState,a=Bg.history.replaceState;return Bg.history.pushState=function(...t){l.apply(this,t),o()},Bg.history.replaceState=function(...t){a.apply(this,t),o()},()=>{Bg.removeEventListener("popstate",o),Bg.removeEventListener("hashchange",o),Bg.history.pushState=l,Bg.history.replaceState=a}},[n,t,e,i,s])}const Zg=200;function Qg(t=dp.Right){switch(t){case dp.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case dp.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case dp.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function Jg({survey:t,forceDisableHtml:e,posthog:i,style:n={},previewPageIndex:s,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:l=()=>{},onPreviewBack:a=()=>{},onPopupSurveyDismissed:u=()=>{},onCloseConfirmationMessage:h=()=>{},properties:c,isSurveyCompleted:d,skipShownEvent:v,surveyLanguage:f}){var p,g,m,y,_,b,w,k,S,x,C,T;const E=Yf(null),I=Number.isInteger(s),{isPopupVisible:M,isSurveySent:R,hidePopupWithAnimation:P}=function(t,e,i,n,s,r,o,l,a){const[u,h]=Jf(n||0===i||t.type===vp.ExternalSurvey),[c,d]=Jf(!1),v=Yf(!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 ${Zg}ms ease-out`,i.style.opacity="0",setTimeout(()=>{v.current=!1,e()},250)):e()},p=e=>{e.detail.surveyId===t.id&&f()};return Kf(()=>{if(!e)return void wp.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(Xp(t,e)){var i;h(!0),Bg.dispatchEvent(new Event("PHSurveyShown")),l||e.capture(mp.SHOWN,le(le({[yp.SURVEY_NAME]:t.name,[yp.SURVEY_ID]:t.id,[yp.SURVEY_ITERATION]:t.current_iteration,[yp.SURVEY_ITERATION_START_DATE]:t.current_iteration_start_date},a&&{[yp.SURVEY_LANGUAGE]:a}),{},{sessionRecordingUrl:null===(i=e.get_session_replay_url)||void 0===i?void 0:i.call(e)}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}};er(Bg,"PHSurveyClosed",p),er(Bg,"PHSurveySent",r);const u=i>0?setTimeout(o,i):void 0;return Ce(u)&&o(),()=>{Ce(u)||clearTimeout(u),Ce(s)||clearTimeout(s),Bg.removeEventListener("PHSurveyClosed",p),Bg.removeEventListener("PHSurveySent",r)}},[]),Gg({survey:t,removeSurveyFromFocus:s,setSurveyVisible:h,isPreviewMode:n,posthog:e}),{isPopupVisible:u,isSurveySent:c,setIsPopupVisible:h,hidePopupWithAnimation:f}}(t,i,(null===(p=t.appearance)||void 0===p?void 0:p.surveyPopupDelaySeconds)?1e3*t.appearance.surveyPopupDelaySeconds:0,I,r,o,E,v,f),O=R||s===t.questions.length||!0===d,[A,F]=Jf(!1),D=Xf(()=>!!ig(t),[t]),L=!(!(null===(g=t.appearance)||void 0===g?void 0:g.introScreenHeader)&&!(null===(m=t.appearance)||void 0===m?void 0:m.introScreenDescription)),N=I?-1===s:!!(null===(y=t.appearance)||void 0===y?void 0:y.displayIntroScreen)&&L&&!A&&!D,q=Xf(()=>{const e=ig(t),n=(null==e?void 0:e.surveySubmissionId)||El();return{isPreviewMode:I,previewPageIndex:s,onPopupSurveyDismissed(){f?Up(t,i,I,f):Up(t,i,I),u()},isPopup:o||!1,surveySubmissionId:n,onPreviewSubmit:l,onPreviewBack:a,posthog:i,properties:c,surveyLanguage:f}},[I,s,o,i,t,u,l,a,c,f]);return M?ag(Jp.Provider,{value:q,children:ag("div",{className:"ph-survey",style:le(le({},og(t.type,null===(_=t.appearance)||void 0===_?void 0:_.position,null===(b=t.appearance)||void 0===b?void 0:b.widgetType)),n),ref:E,children:O?ag(Sg,{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||Dp,onClose(){P(),h()}}):N?ag(xg,{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||Dp,onStart:()=>F(!0)}):ag(Kg,{survey:t,forceDisableHtml:!!e,posthog:i})})}):null}function Kg({survey:t,forceDisableHtml:e,posthog:i}){var n,s;const r=Xf(()=>{const e=ig(t);if(!e)return null;const i=Me(e.lastQuestionIndex);return!i||i&&e.lastQuestionIndex>=0&&t.questions.length>e.lastQuestionIndex?e:(sg(t),null)},[t]),[o,l]=Jf(()=>((null==r?void 0:r.responses)&&wp.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[a,u]=Jf(!1),{previewPageIndex:h,onPopupSurveyDismissed:c,isPopup:d,onPreviewSubmit:v,onPreviewBack:f,surveySubmissionId:p,isPreviewMode:g,properties:m,surveyLanguage:y}=tp(Jp),[_,b]=Jf(()=>{const e=null==r?void 0:r.lastQuestionIndex,i=Me(e)&&e>=0&&t.questions.length>e?e:0;return Me(h)&&h>=0?h:i}),[w,k]=Jf(()=>{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]=Jf(()=>{var e;const i=ig(t);return null!==(e=null==i?void 0:i.questionSnapshots)&&void 0!==e?e:{}}),C=Xf(()=>Gp(Zp(t,r)),[t.id,r]),T=Xf(()=>{if(!C||new Set(C).size!==C.length)return Zp(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]);Kf(()=>{!g||Ce(h)||0>h||b(h)},[h,g]);const E=!!(null===(n=t.appearance)||void 0===n?void 0:n.allowGoBack)&&(g?(null!=h?h:0)>0:w.length>0),I=T.at(_);return I?ag("form",{className:"survey-form",name:"surveyForm",children:[d&&!0!==(null===(s=t.appearance)||void 0===s?void 0:s.hideCancelButton)&&ag(wg,{onClick(){c()}}),ag("div",{className:"survey-box","data-question-index":_,children:[a&&ag("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),Xg({question:I,forceDisableHtml:e,displayQuestionIndex:_,appearance:t.appearance||Dp,onSubmit:e=>(({res:e,displayQuestionIndex:n,questionId:s})=>{if(!i)return void wp.error("onNextButtonClick called without a PostHog instance.");if(!Sp(i))return void u(!0);if(u(!1),!s)return void wp.error("onNextButtonClick called without a questionId.");const r=Xl(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=Lg(t,n,e),v=d===pp.End,f=[...w,n];if(v||(k(f),b(d),eg(t,{surveySubmissionId:p,responses:a,lastQuestionIndex:d,questionOrder:Gp(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=>Xl(t))),n=Object.fromEntries(Object.entries(a).filter(([t])=>e.has(t)));jp({responses:n,survey:t,surveySubmissionId:p,isSurveyCompleted:v,posthog:i,properties:m,surveyLanguage:y,questionSnapshots:c})}})({res:e,displayQuestionIndex:_,questionId:I.id}),onPreviewSubmit:v,initialValue:I.id?o[Xl(I.id)]:void 0,canGoBack:E,onBack(){if(g)return void f();if(0===w.length)return;const e=w[w.length-1],i=w.slice(0,-1);k(i),b(e),eg(t,{surveySubmissionId:p,responses:o,lastQuestionIndex:e,questionOrder:Gp(T),visitedIndices:i,surveyLanguage:y,questionSnapshots:S})}})]})]}):null}function Yg({survey:t,forceDisableHtml:e,posthog:i,readOnly:n,surveyLanguage:s}){var r,o,l,a,u,h,c;const[d,v]=Jf(!0),[f,p]=Jf(!1),[g,m]=Jf({}),y=Yf(void 0),_=()=>{(f||!i||n||Sp(i))&&p(!f)};if(Kf(()=>{var e;if(!i)return void wp.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&&(wp.info(`Received show event for feedback button survey ${t.id}`),m(n.detail.position||{}),_())};return er(Bg,Hg,s),()=>{Ce(y.current)||(clearTimeout(y.current),y.current=void 0),Bg.removeEventListener(Hg,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]),Gg({survey:t,setSurveyVisible:v,posthog:i}),!d)return null;const b=()=>{t.schedule!==gp.Always&&v(!1),Ce(y.current)||clearTimeout(y.current),y.current=setTimeout(()=>{y.current=void 0,p(!1)},200)};return ag(_f,{children:["tab"===(null===(a=t.appearance)||void 0===a?void 0:a.widgetType)&&ag("button",{className:"ph-survey-widget-tab "+((null===(u=t.appearance)||void 0===u?void 0:u.tabPosition)===dp.Top?"widget-tab-top":""),onClick:_,disabled:n,style:Qg(null===(h=t.appearance)||void 0===h?void 0:h.tabPosition),children:(null===(c=t.appearance)||void 0===c?void 0:c.widgetLabel)||""}),f&&ag(Jg,{posthog:i,survey:t,forceDisableHtml:e,style:g,onPopupSurveyDismissed:b,onCloseConfirmationMessage:b,surveyLanguage:s})]})}const Xg=({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 fp.Open:return mf($g,le(le({},u),{},{question:t,key:t.id}));case fp.Link:return mf(Tg,le(le({},u),{},{question:t,key:t.id}));case fp.Rating:return mf(Eg,le(le({},u),{},{question:t,key:t.id}));case fp.SingleChoice:case fp.MultipleChoice:return mf(Mg,le(le({},u),{},{question:t,key:t.id}));default:return wp.error(`Unsupported question type: ${t.type}`),null}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.generateSurveys=Vg,d.extendPostHogWithSurveys=Vg;const tm=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},em=1e4,im=(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),nm=(t,e,i)=>{const n=JSON.stringify(t);if(i.remaining>=n.length)return im(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 im(e,JSON.stringify(t.slice(0,s)),i)},sm=t=>void 0!==t&&"function"!=typeof t&&"symbol"!=typeof t&&"bigint"!=typeof t,rm=(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}},om=(t,e,i)=>{if(!i.truncated)if(Se(t)){if(i.seen.has(t))return void rm(e||"circular","[Circular]",i);i.seen.add(t);try{for(const n in t)try{if(!{}.hasOwnProperty.call(t,n))continue;if(om(t[n],e?`${e}.${n}`:n,i),i.truncated)return}catch(t){continue}}catch(t){}}else rm(e,t,i)},lm=(t,e,i,n,s=!1,r)=>{if(!sm(t))return!s||im(e,"null",i);if(Ee(t)||(t=>{try{return Me(t)||Pe(t)}catch(t){return!1}})(t))return im(e,JSON.stringify(t),i);if("string"==typeof t)return nm(t,e,i);if(!Se(t)&&!we(t))return im(e,JSON.stringify(t),i);if(n.has(t))return nm("[Circular]",e,i);n.add(t);try{const r=t.toJSON;if(ke(r))return lm(r.call(t),e,i,n,s)}catch(t){}try{const n={}.toString.call(t);if("[object String]"===n)return nm(String(t.valueOf()),e,i);if("[object Number]"===n||"[object Boolean]"===n)return im(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 lm(o,e,i,n,s,r)}if(we(t)){if(!im(e,"[",i))return!1;for(let s=0;t.length>s;s++){if(s>0&&!im(e,",",i))return!1;let r;try{r=t[s]}catch(t){r=void 0}if(!lm(r,e,i,n,!0))return!1}return im(e,"]",i)}if(!im(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{om(l,s,r)}catch(t){}if(!sm(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(!im(e,a,i))return!1;const d=e.length,v=lm(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 im(e,"}",i)},am=(t,e)=>{const i=[],n={remaining:e,truncated:!1},s=Se(t[0])?{result:{},keysRemaining:50,sizeRemaining:em,truncated:!1,seen:new WeakSet([t[0]])}:void 0;for(let e=0;t.length>e&&(0>=e||im(i," ",n))&&lm(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)||{}}},um={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},hm=t=>"canCapture"in t,cm=t=>hm(t)?t.canCapture?t.getExtension(Rp):void 0:t.is_capturing()?t.logs:void 0,dm=(t,e,i)=>{if(hm(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(um)){const r=i=>(...r)=>{let o=!1;try{const i=e;if(r.length>0&&!s&&i){const e=cm(i);if(e){s=!0,o=!0;const{body:l,truncated:a,attributes:u}=am(r,em),h=le(le({},n),a?{body_truncated:"true"}:{}),c={level:um[t],body:l,attributes:le(le({"log.source":`console.${t}`},h),u)};dm(i,e,c)}}}catch(t){}finally{o&&(s=!1),i.apply(d.console,r)}},o=d.console[t];i.push(_v(d.console,t,t=>{const e=r(t);return e.__rrweb_original__=tm(o),e}))}return()=>{e=void 0,i.forEach(t=>t())}},replayConsoleBuffer(t,e){const i=cm(t);if(i)for(const t of e)try{var n;const{body:e,truncated:s,attributes:r}=am(t.args,em);null===(n=i.captureBufferedConsoleLog)||void 0===n||n.call(i,{level:um[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 vm=t=>Ne(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),fm=Ws("[Error tracking]"),pm="webkit-masked-url:",gm=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],mm=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",pm],ym=["__firefox__","__gCrWeb"];function _m(){return new fn([new Fn,new Wn,new Ln,new Dn,new Un,new Hn,new qn,new zn],function(t,...e){return(i,n=0)=>{const s=[],r=i.split("\n"),o=Math.min(r.length,n+1e3),l=[];for(let i=n;o>i;i++){const n=r[i];if(n.length>1024)continue;const o=Tn.test(n)?n.replace(Tn,"$1"):n;if(!o.match(/\S*Error: /)){for(const i of e){const e=i(o,t);if(e){s.push(e);const t=In(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(On(s,l)>=50)break}}const a=[...l].sort((t,e)=>e.start-t.start),u=a[a.length-1];if(u){const t=Rn(s,u);s.splice(u.start-t,t);for(const e of a)e.start-=t}for(const t of a)Mn(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++)An(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",Sn,$n))}const bm=Ws("[ExceptionAutocapture]"),wm=_m(),km=(t,e)=>{try{return t()}catch(t){return e}},Sm=(t,e)=>km(()=>t(e()),void 0),xm=t=>km(()=>ke(t)&&ke(t.call),!1),Cm=(t,e)=>km(()=>{t[e].__POSTHOG_INSTRUMENTED__=!0},void 0),$m=(t,e,i)=>{km(()=>{var i;null===(i=t[e])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),km(()=>{t[e]=i},void 0)},Tm=e=>{const i=t;i||bm.info("window not available, cannot wrap onerror");const n=km(()=>i.onerror,void 0);return i.onerror=function(...t){var i;return Sm(e,()=>wm.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}})),!!xm(n)&&null!==(i=n(...t))&&void 0!==i&&i},Cm(i,"onerror"),()=>$m(i,"onerror",n)},Em=(e,i=!1)=>{const n=t;n||bm.info("window not available, cannot wrap onUnhandledRejection");const s=km(()=>n.onunhandledrejection,void 0);return n.onunhandledrejection=function(t){var n;return Sm(e,()=>wm.buildFromUnknown(t,{mechanism:{handled:!1}})),xm(s)?null!==(n=s(t))&&void 0!==n&&n:i},Cm(n,"onunhandledrejection"),()=>$m(n,"onunhandledrejection",s)},Im={wrapOnError:Tm,wrapUnhandledRejection:Em,wrapConsoleError(t){const e=console;e||bm.info("console not available, cannot wrap console.error");const i=km(()=>e.error,void 0);return e.error=function(...e){km(()=>e.length>1&&$e(e[0])&&(/^\[PostHog\.js\](?: |$)/.test(e[0])||"rrweb logger error:"===e[0]),!1)||Sm(t,()=>{let t;t=1==e.length?e[0]:e.join(" ");const i=e.find(t=>t instanceof Error);return wm.buildFromUnknown(i||t,{mechanism:{handled:!0,type:"onconsole"},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),xm(i)&&i(...e)},Cm(e,"error"),()=>$m(e,"error",i)}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.errorWrappingFunctions=Im,d.posthogErrorWrappingFunctions=Im;const Mm=(t,e)=>{if(!ke(null==t?void 0:t.capture))return;const i=null==e?void 0:e.autocaptureExceptions,n=!Ee(i)&&"object"==typeof i&&we(i.errors_to_ignore)?i.errors_to_ignore.reduce((t,e)=>{try{t.push(new RegExp(e))}catch(t){bm.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){bm.error("Failed to capture exception for a legacy client",t)}};Tm(t=>{n.some(e=>t.$exception_list.some(t=>e.test(t.value||"")))||s(t)}),Em(s,!0)};d.extendPostHogWithExceptionAutoCapture=Mm,d.extendPostHogWithExceptionAutocapture=Mm;const Rm="X-POSTHOG-SESSION-ID",Pm="X-POSTHOG-WINDOW-ID",Om="X-POSTHOG-DISTINCT-ID",Am=[Rm,Pm,Om],Fm=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],Dm=(t,e)=>({}.hasOwnProperty.call(t,e)),Lm=t=>"object"==typeof t&&!Ee(t)||ke(t),Nm=t=>"undefined"!=typeof Request&&(t instanceof Request||"[object Request]"==={}.toString.call(t)),qm=e=>{try{var i;return Nm(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}},Bm=(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(Rm,t),s.set(Pm,e),o=!0}const l=(t=>ke(t)?t():t)(e);return l&&"$posthog_cookieless"!==l&&(s.set(Om,l),o=!0),o};d.__PosthogExtensions__=d.__PosthogExtensions__||{};const jm={_patchFetch:(e,i,n)=>_v(t,"fetch",t=>function(s,r){const o=arguments.length>1?[s,r]:[s];let l=o;try{const t=qm(s);if(t)if(Nm(s)){const t=new Request(s,r);Bm(e,i,n,t.url,t.headers),l=[t]}else{const o=new Headers(Lm(r)?r.headers:void 0);if(Bm(e,i,n,t,o)){const t=((t,e)=>{if(Ce(t)||Ee(t))return{headers:e};if(!Lm(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)=>Dm(t,e)?Reflect.get(t,e):Reflect.get(i,e,i),has:(t,e)=>Dm(t,e)||e in i,ownKeys(t){const e=new Set(Reflect.ownKeys(t));return Reflect.ownKeys(i).forEach(t=>e.add(t)),Fm.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&&Fm.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)=>_v(t.XMLHttpRequest.prototype,"open",t=>function(s,r,o=!0,l,a){const u=this,h=new Headers,c=qm(r);c&&Bm(e,i,n,c,h);const d=t.call(u,s,r,o,l,a);return Am.forEach(t=>{const e=h.get(t);if(e)try{u.setRequestHeader(t,e)}catch(t){}}),d})};d.__PosthogExtensions__.tracingHeadersPatchFns=jm,d.postHogTracingHeadersPatchFns=jm,"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 Hm=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 Um=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},zm=t=>{if("loading"===document.readyState)return"loading";const e=Um();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"},Wm=t=>{const e=t.nodeName;return 1===t.nodeType?e.toLowerCase():e.toUpperCase().replace(/^#/,"")},Vm=t=>{let e="";try{for(;9!==(null==t?void 0:t.nodeType);){var i;const n=t,s=n.id?"#"+n.id:[Wm(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},Gm=new WeakMap;function Zm(t,e){let i=Gm.get(e);return i||(i=new WeakMap,Gm.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}let Qm=-1;const Jm=()=>Qm,Km=t=>{addEventListener("pageshow",e=>{e.persisted&&(Qm=e.timeStamp,t(e))},!0)},Ym=(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)))}},Xm=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},ty=()=>{var t,e;return null!==(t=null===(e=Um())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let ey=-1;const iy=new Set,ny=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,sy=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of iy)t();isFinite(ey)||(ey="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",sy,!0))}},ry=(t=!1)=>{if(t&&(ey=1/0),0>ey){var e;const t=ty(),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;ey=null!=i?i:ny(),addEventListener("visibilitychange",sy,!0),addEventListener("prerenderingchange",sy,!0),Km(()=>{setTimeout(()=>{ey=ny()})})}return{get firstHiddenTime(){return ey},onHidden(t){iy.add(t)}}},oy=(t,e=-1,i,n=0,s,r,o)=>{const l=Um(),a=(null==l?void 0:l.navigationId)||0;let u="navigate";return i?u=i:0>Jm()?l&&(document.prerendering||ty()>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}},ly=(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){}},ay=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},uy=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},hy=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var cy=class{constructor(){this.u=void 0}};const dy=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},vy=[1800,3e3],fy=(t,e={})=>{const i=ay(e);dy(()=>{const n=Zm(e,cy),s=ry();let r,o=oy("FCP");const l=ly(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(l.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-ty(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});l&&(r=Ym(t,o,vy,e.reportAllChanges),Km(i=>{o=oy("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Jm()),r=Ym(t,o,vy,e.reportAllChanges),Xm(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&ly(["soft-navigation"],i=>{i.forEach(i=>{n.u&&i.navigationId&&uy(n.u,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=oy("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Ym(t,o,vy,e.reportAllChanges),r(!0)})},e)})},py=[.1,.25],gy=t=>t.find(t=>{var e;return 1===(null===(e=t.node)||void 0===e?void 0:e.nodeType)})||t[0],my=(t,e={})=>{const i=Zm(e=Object.assign({},e),Hm),n=new WeakMap;i.t=t=>{var i;if(null==t||null===(i=t.sources)||void 0===i?void 0:i.length){const i=gy(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:Vm(o);n.set(i,t)}}},((t,e={})=>{const i=ry();fy(hy(()=>{let n,s=oy("CLS",0);const r=Zm(e,Hm),o=(i,o,l,a,u)=>{s=oy("CLS",0,i,o,l,a,u),r.o=0,n=Ym(t,s,py,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"];ay(e)&&h.push("soft-navigation");const c=ly(h,u);c&&(n=Ym(t,s,py,e.reportAllChanges),i.onHidden(()=>{u(c.takeRecords()),n(!0)}),Km(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Jm()),Xm(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=gy(s.sources);t&&(e={largestShiftTarget:n.get(t),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:t,largestShiftEntry:s,loadState:zm(s.startTime)})}}return Object.assign(t,{attribution:e})})(e))},e)},yy=(t,e={})=>{const i=Zm(e=Object.assign({},e),cy);ay(e)&&(i.u=new Map),fy(e=>{t((t=>{let e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:zm(Jm())};if("soft-navigation"!==t.navigationType){if(t.entries.length){const i=Um(),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:zm(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 _y=0,by=1/0,wy=0;const ky=t=>{for(const e of t)e.interactionId&&(by=Math.min(by,e.interactionId),wy=Math.max(wy,e.interactionId),_y=wy?(wy-by)/7+1:0)};let Sy;const xy=()=>{var t;return Sy?_y:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var Cy=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return xy()-this.h}D(){this.h=xy(),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 $y=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=hy(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})}},Ty=[200,500],Ey=(t,e={})=>{const i=Zm(e=Object.assign({},e),Cy);let n=[],s=[],r=0;const o=new WeakMap,l=new WeakMap;let a=!1;const u=()=>{a||($y(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:Vm(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};ly(["long-animation-frame"],t=>{n=n.concat(t),u()},e),((t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=ry();dy(()=>{var n;"interactionCount"in performance||Sy||(Sy=ly(["event"],ky,{durationThreshold:0}));let s,r=oy("INP");const o=Zm(e,Cy),l=(i,n,l,a,u)=>{o.D(),r=oy("INP",-1,i,n,l,a,u),s=Ym(t,r,Ty,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)=>{$y(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.l(e):u(e);a(),e&&s(!0)})},c=["event","first-input"];ay(e)&&c.push("soft-navigation");const d=ly(c,h,le(le({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=Ym(t,r,Ty,e.reportAllChanges),d&&(i.onHidden(()=>{h(d.takeRecords(),!0)}),Km(()=>{l("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Jm())}))})})(e=>{t((t=>{if(0===t.entries.length){const e={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:t.value,loadState:zm(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:zm(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 Iy=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 My=50;const Ry=[];ly(["resource"],t=>{for(const e of t)Ry.push(e),Ry.length>My&&Ry.shift()});const Py=(t,e={})=>{null!=(e=Object.assign({},e)).resourceBufferSize&&(My=e.resourceBufferSize);const i=Zm(e,Iy),n=new WeakMap;ay(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:Vm(i);n.set(t,o)}else t.id&&n.set(t,`#${t.id}`)},((t,e={})=>{let i=!1;const n=ay(e);dy(()=>{let s,r=ry(),o=oy("LCP");const l=Zm(e,Iy),a=(n,l,a,u,h)=>{o=oy("LCP",-1,n,l,a,u,h),s=Ym(t,o,$,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=ry(!0))},u=t=>{var e;l.u&&t.navigationId&&uy(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-ty(),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=ly(c,h);if(d){s=Ym(t,o,$,e.reportAllChanges);const r=["keydown","click","visibilitychange"],l=t=>{if(t.isTrusted&&!i){const t=o.id;$y(()=>{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});Km(n=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Jm()),s=Ym(t,o,$,e.reportAllChanges),Xm(()=>{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&&(Ry.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=Um(),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 Oy=-1;const Ay=()=>Oy,Fy=t=>{addEventListener("pageshow",e=>{e.persisted&&(Oy=e.timeStamp,t(e))},!0)},Dy=(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()))},Ny=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},qy=()=>{var t,e;return null!==(t=null===(e=Ny())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let By=-1;const jy=new Set,Hy=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Uy=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of jy)t();isFinite(By)||(By="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",Uy,!0))}},zy=(t=!1)=>{if(t&&(By=1/0),0>By){var e;const t=qy(),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;By=null!=i?i:Hy(),addEventListener("visibilitychange",Uy,!0),addEventListener("prerenderingchange",Uy,!0),Fy(()=>{setTimeout(()=>{By=Hy()})})}return{get firstHiddenTime(){return By},onHidden(t){jy.add(t)}}},Wy=(t,e=-1,i,n=0,s,r,o)=>{const l=Ny(),a=(null==l?void 0:l.navigationId)||0;let u="navigate";return i?u=i:0>Ay()?l&&(document.prerendering||qy()>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}},Vy=new WeakMap;function Gy(t,e){let i=Vy.get(e);return i||(i=new WeakMap,Vy.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}var Zy=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 Qy=(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){}},Jy=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},Ky=(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 Xy=class{constructor(){this.l=void 0}};const t_=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},e_=[1800,3e3],i_=(t,e={})=>{const i=Jy(e);t_(()=>{const n=Gy(e,Xy),s=zy();let r,o=Wy("FCP");const l=Qy(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(l.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-qy(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});l&&(r=Dy(t,o,e_,e.reportAllChanges),Fy(i=>{o=Wy("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Ay()),r=Dy(t,o,e_,e.reportAllChanges),Ly(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Qy(["soft-navigation"],i=>{i.forEach(i=>{n.l&&i.navigationId&&Ky(n.l,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Wy("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Dy(t,o,e_,e.reportAllChanges),r(!0)})},e)})},n_=[.1,.25],s_=(t,e={})=>{const i=zy();i_(Yy(()=>{let n,s=Wy("CLS",0);const r=Gy(e,Zy),o=(i,o,l,a,u)=>{s=Wy("CLS",0,i,o,l,a,u),r.i=0,n=Dy(t,s,n_,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"];Jy(e)&&h.push("soft-navigation");const c=Qy(h,u);c&&(n=Dy(t,s,n_,e.reportAllChanges),i.onHidden(()=>{u(c.takeRecords()),n(!0)}),Fy(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Ay()),Ly(n)}),setTimeout(n))}))};let r_=0,o_=1/0,l_=0;const a_=t=>{for(const e of t)e.interactionId&&(o_=Math.min(o_,e.interactionId),l_=Math.max(l_,e.interactionId),r_=l_?(l_-o_)/7+1:0)};let u_;const h_=()=>{var t;return u_?r_:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var c_=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return h_()-this.u}M(){this.u=h_(),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 d_=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})}},v_=[200,500],f_=(t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=zy();t_(()=>{var n;"interactionCount"in performance||u_||(u_=Qy(["event"],a_,{durationThreshold:0}));let s,r=Wy("INP");const o=Gy(e,c_),l=(i,n,l,a,u)=>{o.M(),r=Wy("INP",-1,i,n,l,a,u),s=Dy(t,r,v_,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)=>{d_(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.h(e):u(e);a(),e&&s(!0)})},c=["event","first-input"];Jy(e)&&c.push("soft-navigation");const d=Qy(c,h,le(le({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=Dy(t,r,v_,e.reportAllChanges),d&&(i.onHidden(()=>{h(d.takeRecords(),!0)}),Fy(()=>{l("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Ay())}))})};var p_=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 g_=[2500,4e3],m_=(t,e={})=>{let i=!1;const n=Jy(e);t_(()=>{let s,r=zy(),o=Wy("LCP");const l=Gy(e,p_),a=(n,l,a,u,h)=>{o=Wy("LCP",-1,n,l,a,u,h),s=Dy(t,o,g_,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=zy(!0))},u=t=>{var e;l.l&&t.navigationId&&Ky(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-qy(),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=Qy(c,h);if(d){s=Dy(t,o,g_,e.reportAllChanges);const r=["keydown","click","visibilitychange"],l=t=>{if(t.isTrusted&&!i){const t=o.id;d_(()=>{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});Fy(n=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Ay()),s=Dy(t,o,g_,e.reportAllChanges),Ly(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})},y_={onLCP:Py,onCLS:my,onFCP:yy,onINP:Ey,withoutAttribution:{onLCP:m_,onCLS:s_,onFCP:i_,onINP:f_}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=y_,d.__PosthogExtensions__.postHogWebVitalsCallbacks=y_,d.postHogWebVitalsCallbacks=y_;const __={onLCP:m_,onCLS:s_,onFCP:i_,onINP:f_};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=__,d.__PosthogExtensions__.postHogWebVitalsCallbacks=__,d.postHogWebVitalsCallbacks=__,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>__;const b_={onLCP:Py,onCLS:my,onFCP:yy,onINP:Ey,withoutAttribution:{onLCP:m_,onCLS:s_,onFCP:i_,onINP:f_}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=b_,d.__PosthogExtensions__.postHogWebVitalsCallbacks=b_,d.postHogWebVitalsCallbacks=b_;const w_={onLCP:m_,onCLS:s_,onFCP:i_,onINP:f_};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=w_,d.__PosthogExtensions__.postHogWebVitalsCallbacks=w_,d.postHogWebVitalsCallbacks=w_,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>w_;var k_=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 S_="$copy_autocapture",x_=Ws("[AutoCapture]");function C_(t,e){return e.length>t?e.slice(0,t)+"...":e}function $_(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do{e=e.previousSibling}while(e&&!pr(e));return e}function T_(e,{e:i,maskAllElementAttributes:n,maskAllText:s,elementAttributeIgnoreList:r,elementsChainAsString:o,disableCaptureUrlHashes:l}){var a,u;if(!pr(e))return{props:{}};const h=[e],c=new Set([e]);let d=e;for(;d.parentNode&&!gr(d,"body")&&1e3>h.length;){if(yr(d.parentNode)){const t=d.parentNode.host;if(c.has(t))break;c.add(t),h.push(t),d=t;continue}if(!pr(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=>gr(t,"button")||gr(t,"a")):-1;v>0&&(s=s||h.slice(0,v+1).some(t=>!Br(t)||jr(t)));const f=[],p={};let g,m=!1,y=!1;if(Gs(h,t=>{const e=Br(t);if(gr(t,"a")){const i=t.getAttribute("href");m=!!(e&&i&&Qr(i))&&(l?rn(i):i)}fe(wr(t),"ph-no-capture")&&(y=!0),f.push(function(t,e,i,n,s=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};Cr.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?C_(1024,Jr(t)):C_(1024,Sr(t)));const l=wr(t);l.length>0&&(o.classes=l.filter(function(t){return""!==t})),Gs(t.attributes,function(i){var r;if((!jr(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==n?void 0:n.includes(i.name))&&!e&&Qr(i.value)&&(!$e(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=i.value;"class"===i.name&&(t=_r(t).join(" ")),o["attr__"+i.name]=C_(1024,"href"===i.name&&s?rn(t):t)}});let a=1,u=1,h=t;for(;h=$_(h);)a++,h.tagName===t.tagName&&u++;return o.nth_child=a,o.nth_of_type=u,o}(t,n,s,r,l)),Gs(function(t){if(!Br(t))return{};const e={};return Gs(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&&Qr(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=gr(e,"a")||gr(e,"button")?Jr(e):Sr(e)),m){var _,b;f[0].attr__href=m;const e=null===(_=rr(m))||void 0===_?void 0:_.host,i=null==t||null===(b=t.location)||void 0===b?void 0:b.host;e&&i&&e!==i&&(g=m)}return{props:Zs((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 Qs(s).sort(([t],[e])=>function(t,e){return e>t?-1:t>e?1:0}(t,e)).forEach(([t,e])=>r[Yr(t.toString())]=Yr(e.toString())),n+=":",n+=Qs(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:Xr(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Qs(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 E_=class{uo(){this.ho=void 0,clearTimeout(this.co),this.co=void 0}do(t){var e;if(!Br(t))return!0;const i=null!==(e=this.vo().css_selector_ignorelist)&&void 0!==e?e:Ir,n=new Set;let s=t;for(;s;){if(n.size>=1e3||n.has(s))return!0;n.add(s);const t=s,e=wr(t);if(fe(e,"ph-no-capture")||fe(e,"ph-sensitive")||jr(t)||i.some(e=>$r(t,e)))return!0;const r=s.parentNode;s=yr(r)?r.host:r&&pr(r)?r:null}return!1}fo(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.uo();if("pointerdown"===t.type){this.uo();const i=xr(t);var e;return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&i&&pr(i)&&(this.ho={target:i,excluded:this.do(i),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(e=this.po)||void 0===e?void 0:e.distinctId}))}const i=this.ho;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.uo():"pointerup"===t.type&&(i.released=!0,this.co=setTimeout(()=>this.uo(),0)))}mo(t){var e;const i=this.ho;this.uo();const s=xr(t);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(e=this.po)||void 0===e?void 0:e.distinctId)&&t.pointerId===i.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-i.x)&&5>=Math.abs(t.clientY-i.y)&&s&&(gr(s,"html")||gr(s,"body"))){var r;if(i.excluded)return null;const t=null!==(r=this.vo().css_selector_ignorelist)&&void 0!==r?r:Ir;return[s,null==n?void 0:n.documentElement,null==n?void 0:n.body].some(e=>{if(!e)return!1;const i=wr(e);return fe(i,"ph-no-capture")||fe(i,"ph-sensitive")||!Br(e)||jr(e)||t.some(t=>$r(e,t))})?null:i.target}}constructor(t){this.yo=t,this.name="autocapture",this.bo=!1,this._o=null,this.wo=!1,this.ko=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.So=!1,this.yo.refresh(this.Mr),this.rageclicks=new k_(this.Mr.rageclick),this.xo=null}setup(t){this.Co(),this.po=t;const e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.So?e.dispose():(this.$o=e,this.startIfEnabled())}dispose(){var t;this.So||(this.So=!0,this.po=void 0,null===(t=this.$o)||void 0===t||t.dispose(),this.$o=void 0,this.To())}vo(){return this.yo.refresh(this.Mr),this.Mr}Co(){var t,e;return this.vo(),this.Mr.url_allowlist=null===(t=this.Mr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Mr.url_ignorelist=null===(e=this.Mr.url_ignorelist)||void 0===e?void 0:e.map(t=>new RegExp(t)),this.Mr}Io(){if(!this.isBrowserSupported())return void x_.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!n)return;const e=this.Mo=e=>{e=e||(null==t?void 0:t.event);try{if("blur"===e.type)return void this.uo();if(0===e.type.indexOf("pointer"))return void this.fo(e);const t="click"===e.type?this.mo(e):void 0;if(Ee(t))return;this.Eo(e,"$autocapture",t)}catch(t){x_.error("Failed to capture event",t)}};if(er(t,"blur",e),er(n,"submit",e,{capture:!0}),er(n,"change",e,{capture:!0}),er(n,"click",e,{capture:!0}),Gs(["pointerdown","pointermove","pointerup","pointercancel"],t=>{er(n,t,e,{capture:!0})}),this.vo().capture_copied_text){const e=this.Po=e=>{e=e||(null==t?void 0:t.event);try{this.Eo(e,S_)}catch(t){x_.error("Failed to capture clipboard event",t)}};er(n,"copy",e,{capture:!0}),er(n,"cut",e,{capture:!0}),er(n,"paste",e,{capture:!0})}}To(){this.uo(),this.Mo&&(null==t||t.removeEventListener("blur",this.Mo),Gs(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==n||n.removeEventListener(t,this.Mo,!0)}),null==n||n.removeEventListener("submit",this.Mo,!0),null==n||n.removeEventListener("change",this.Mo,!0),null==n||n.removeEventListener("click",this.Mo,!0),this.Mo=void 0),this.Po&&(null==n||n.removeEventListener("copy",this.Po,!0),null==n||n.removeEventListener("cut",this.Po,!0),null==n||n.removeEventListener("paste",this.Po,!0),this.Po=void 0),this.bo=!1}startIfEnabled(){this.isEnabled||this.uo(),!this.So&&this.po&&this.isEnabled&&!this.bo&&(this.Io(),this.bo=!0)}onRemoteConfig(t){if(this.So)return;if(this.wo=!0,!t.ok)return void this.startIfEnabled();const e=t.config;e.elementsChainAsString&&(this.ko=e.elementsChainAsString);const i=e.autocapture_opt_out;var n;Pe(i)&&(null===(n=this.po)||void 0===n||n.kv.set("$autocapture_disabled_server_side",i),this._o=i),this.startIfEnabled()}setElementSelectors(t){this.xo=t}getElementSelectors(t,e){var i;const s=[];return null===(i=this.xo)||void 0===i||i.forEach(i=>{const r=null==n?void 0:n.querySelectorAll(i);null==r||r.forEach(n=>{t!==n&&e!==n||fe(s,i)||s.push(i)})}),s}get isEnabled(){var t,e;if(this.So)return!1;const i=null===(t=this.po)||void 0===t?void 0:t.kv.get(k),n=this._o,s=this.vo();if(!s.remoteRequestsDisabled&&!this.wo)return!1;const r=s.remoteRequestsDisabled&&!this.wo;if(Ee(n)&&!Pe(i)&&!r)return!1;const o=null!==(e=this._o)&&void 0!==e?e:!!i;return!!s.enabled&&!o}Eo(e,i="$autocapture",n){if(!this.isEnabled)return void this.uo();let s=n||xr(e);mr(s)&&(s=s.parentNode||null);const r=this.Co();var o;"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&r.rageclick&&(null===(o=this.rageclicks)||void 0===o?void 0:o.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&Lr(s,r.rageclick)&&this.Eo(e,"$rageclick",n);const l=i===S_,a=l?le(le({},r),{},{dom_event_allowlist:void 0}):r;if(s&&function(e,i,n,s,r,o){var l;if(!t||Nr(e))return!1;if((null==n?void 0:n.url_allowlist)&&!br(n.url_allowlist,o))return!1;if((null==n?void 0:n.url_ignorelist)&&br(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}=qr(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(!Tr(u,null==n?void 0:n.css_selector_allowlist))return!1;if(Tr(u,null!==(l=null==n?void 0:n.css_selector_ignorelist)&&void 0!==l?l:Ir))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&&(Cr.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}=T_(s,{e:e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.ko,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(o)return!1;const a=this.getElementSelectors(s,l);if(a&&a.length>0&&(n.$element_selectors=a),i===S_){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=kr(e);if(!i)return!1;n.$selected_content=i,n.$clipboard_text_length=null!==(c=null==e?void 0:e.length)&&void 0!==c?c:0}n.$copy_type=i}return null===(u=this.po)||void 0===u||u.capture(i,n).catch(t=>x_.error("Failed to capture event",t)),!0}}isBrowserSupported(){return ke(null==n?void 0:n.querySelectorAll)}};const I_={};function M_(t,e){const i=xr(t);return i?le({node:i,originalEvent:t,timestamp:Date.now()},e):null}function R_(t,e){return Math.abs(t)<Math.abs(e)?0>e?"up":"down":0>t?"left":"right"}function P_(t){return"swipe"===t.type?"$dead_swipe":"$dead_click"}const O_="canvas,video,audio,embed,object";function A_(t,e){return Me(t)&&t>=e}function F_(t,e=1e3){return t>=0&&e>t?t:void 0}function D_(t,e,i=1e3){return Me(e)?F_(t-e,i):void 0}var L_=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=>{Ee(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(pr(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=M_(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()),Ee(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&&(pr(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=Dr(xr(t))||Dr(null!=l?l:null)||Dr(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=xr(t);let i;if(Dr(e))i=e;else if("Caret"===(null==s?void 0:s.type)){var f;Dr(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.zr,this.Or].some(t=>Me(t)&&t>=i.timestamp))return;var h,c;if(this.Ur()&&(null!==(h=null==n||null===(c=n.elementsFromPoint)||void 0===c?void 0:c.call(n,i.x,i.y))&&void 0!==h?h:[]).some(t=>{var e;return null===(e=t.matches)||void 0===e?void 0:e.call(t,O_)}))return;const d=M_(s,{type:"swipe",swipeDirection:R_(o,l),swipeDistancePx:Math.round(Math.sqrt(a))});Ee(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=I_[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 I_[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){zs.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)?I_[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.zr=Date.now()}Wr(){er(d,"click",this.Cr),er(d,"mousedown",this.wr,{capture:!0}),er(d,"mouseup",this.Sr,{capture:!0}),er(d,"mouseout",this._r,{capture:!0}),er(d,"dragstart",this.gr,{capture:!0}),er(d,"pointercancel",this.gr,{capture:!0}),er(d,"blur",this.gr)}Tr(t){t.selectionChangedDelayMs=D_(t.timestamp,this.Or,this.Mr.selection_change_threshold_ms),t.visibilityChangedDelayMs=D_(t.timestamp,this.Pr),t.focusChangedDelayMs=D_(t.timestamp,this.Nr),this.pr.push(t)}Rr(){this.pr.length&&Ce(this.eo)&&(this.eo=d.setTimeout(()=>{this.no()},1e3))}Vr(){er(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),er(n,"selectionchange",this.Ar)}Lr(t,e){const i=e.path[0];for(;t;){if(-1!==e.path.indexOf(t)||pr(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&&pr(i)&&n.startContainer.getRootNode()===i.getRootNode()){var s;if(!n.collapsed)return n.intersectsNode(i);const t=pr(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(){er(n,"visibilitychange",this.an)}Qr(){er(d,"blur",this.Fr),er(d,"focus",this.Fr)}Dr(t,e){this.pr.forEach(i=>{const n=F_(e-i.timestamp);Me(n)&&(Ce(i[t])||i[t]>n)&&(i[t]=n)})}Kr(){er(d,"touchstart",this.qr,{capture:!0,passive:!0}),er(d,"touchend",this.Hr,{capture:!0,passive:!0}),er(d,"touchcancel",this.Br,{capture:!0,passive:!0})}Ur(){const t=Ce(this.io)||Me(this.zr)&&this.zr>this.io;return(Ce(this.ro)||t)&&(this.io=Date.now(),this.ro=!!(null==n?void 0:n.querySelector(O_))),!!this.ro}Ir(t){return!t||("swipe"===t.type?this.oo(t):this.so(t))}oo(e){return!(!fr(e.node)&&!this.pr.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!gr(e.node,"html")&&pr(e.node)&&function(e,i){var n;if(!t||Nr(e))return!1;const s=Pe(i)?Or:null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:Or,{targetElementList:r}=qr(e,!1);return!Tr(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||Nr(e))return!1;const{targetElementList:i}=qr(e,!1);return i.some(t=>gr(t,"a"))}(e.node);var i}no(){if(!this.pr.length)return;clearTimeout(this.eo),this.eo=void 0;const t=this.pr;this.pr=[];for(const i of t){var e;i.mutationDelayMs=null!==(e=i.mutationDelayMs)&&void 0!==e?e:this.zr&&this.zr>=i.timestamp?this.zr-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const t=A_(i.scrollDelayMs,this.Mr.scroll_threshold_ms),n=A_(i.selectionChangedDelayMs,this.Mr.selection_change_threshold_ms),s=A_(i.mutationDelayMs,this.Mr.mutation_threshold_ms),r=A_(i.absoluteDelayMs,1.1*this.Mr.mutation_threshold_ms),o=Me(i.scrollDelayMs)&&this.Mr.scroll_threshold_ms>i.scrollDelayMs,l=Me(i.mutationDelayMs)&&this.Mr.mutation_threshold_ms>i.mutationDelayMs,a=i.selectionChangedDuringGesture||Me(i.selectionChangedDelayMs)&&this.Mr.selection_change_threshold_ms>i.selectionChangedDelayMs,u=Me(i.visibilityChangedDelayMs),h=Me(i.focusChangedDelayMs);if(!(o||l||a||u||h))if(t||s||r||n){const e=P_(i);if("$dead_swipe"===e){if(this.mr>=this.Mr.max_dead_swipes_per_page_load)continue;this.mr++}this._onCapture(i,{[`${e}_last_mutation_timestamp`]:this.zr,[`${e}_event_timestamp`]:i.timestamp,[`${e}_scroll_timeout`]:t,[`${e}_mutation_timeout`]:s,[`${e}_absolute_timeout`]:r,[`${e}_selection_changed_timeout`]:n,[`${e}_visibility_changed_timeout`]:!1})}else this.Mr.mutation_threshold_ms>i.absoluteDelayMs&&this.pr.push(i)}this.Rr()}hr(t,e){const i=P_(t);this.instance.capture(i,le(le(le({},e),T_(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 L_(t,e);const N_=Ws("[ExternalScriptsLoader]"),q_=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]},B_=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return N_.warn(`${e} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const s=q_(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(q_(e))return B_(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)},j_={},H_=(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 B_(t,e,i)}const n=t.config.strict_script_versioning;if(n){const s=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=j_[s];if("fallback"===n&&r){if(q_(r))return void B_(t,r,i);delete j_[s]}return void B_(t,s,"fallback"===n?(n,r)=>{if(n)if("string"==typeof n)i(n);else{var o;const n=H_(t,e);j_[s]=n;const r=q_(s);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),B_(t,n,i)}else i(void 0,r)}:i)}B_(t,H_(t,e),i)},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{const n=t.requestRouter.endpointFor("api",e);B_(t,n,i)};var U_=class{constructor(t){this._instance=t}get Mr(){return this._instance.config}get consent(){return this.Ro()?0:this.Ao}isOptedOut(){return"always"===this.Mr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Mr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Mr.opt_out_capturing_by_default}optInOut(t){this.Fo.At(this.Oo,t?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Fo.Lt(this.Oo,this.Mr.cross_subdomain_cookie)}get Oo(){const{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get Ao(){const t=this.Fo.Ot(this.Oo);return He(t)?1:fe(Ue,t)?0:-1}get Fo(){const t=this.Mr.opt_out_capturing_persistence_type,e="localStorage"===t?Fl:Ol,i=e.Et()?e:Gl;if(!this.Do||this.Do!==i){this.Do=i;const e="localStorage"===t?Ol:Fl;e.Ot(this.Oo)&&(this.Do.Ot(this.Oo)||this.optInOut(He(e.Ot(this.Oo))),e.Lt(this.Oo,this.Mr.cross_subdomain_cookie))}return this.Do}Ro(){return!!this.Mr.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(t=>He(t))}};const z_=Ws("[Dead Clicks]"),W_=()=>!0,V_=t=>{var e;const i=!!(null===(e=t.instance.persistence)||void 0===e?void 0:e.get_property(I)),n=t.instance.config.capture_dead_clicks;return Pe(n)?n:!!Se(n)||i};var G_=class{get lazyLoadedDeadClicksAutocapture(){return this.Lo}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[I]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.No(()=>{this.qo()}):this.stop()}No(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this.instance,"dead-clicks-autocapture",e=>{e?z_.error("failed to load script",e):t()})}qo(){var t;if(n){if(!this.Lo&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=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.Lo=d.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Lo.start(n),z_.info("starting...")}}else z_.error("`document` not found. Cannot start.")}stop(){this.Lo&&(this.Lo.stop(),this.Lo=void 0,z_.info("stopping..."))}};const Z_=Ws("[SegmentIntegration]");function Q_(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()||El();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||Z_.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()||(Z_.info("No userId set, resetting PostHog"),t.reset()),r||(e=void 0),n.event.userId&&n.event.userId!==t.get_distinct_id()&&(Z_.info("UserId set, identifying with PostHog"),t.identify(n.event.userId));let o=t.calculateEventProperties(s,n.event.properties);if(!Ie(i)){const t=n.event.properties||{},e={};for(const i of Object.keys(o))_e.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),Ie(n))return null}catch(t){return Z_.error("Error in Segment filterProperties:",t),null}return n})(i,e);if(Ie(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=>{Z_.error("Failed to register the Segment integration",t),e()})},i)}const J_="posthog-js";function K_(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 Y_=class{constructor(t,e,i,n,s,r){this.name=J_,this.setupOnce=function(o){o(K_(t,{organization:e,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:null==r||r}))}}},X_=class{constructor(t){this.jo=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(zs.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Bo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ho()}Ho(){var t;this.zo=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.jo)}destroy(){var t;null===(t=this.zo)||void 0===t||t.call(this),this.zo=void 0}doPageView(e,i){var n;const s=this.Uo(e,i);return this.Bo={pathname:null!==(n=null==t?void 0:t.location.pathname)&&void 0!==n?n:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.Uo(t,null===(e=this.Bo)||void 0===e?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.Bo)||void 0===t?void 0:t.pageViewId}}Uo(t,e){const i=this.Bo;if(!i)return{$pageview_id:e};let n={$pageview_id:e,$prev_pageview_id:i.pageViewId};const s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:t,lastScrollY:e,maxScrollY:i,maxContentHeight:r,lastContentY:o,maxContentY:l}=s;if(!(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,zs):1,a=t>1?Ve(i/t,0,1,zs):1,u=r>1?Ve(o/r,0,1,zs):1,h=r>1?Ve(l/r,0,1,zs):1;n=Zs(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 tb=["flags","surveys"],eb={[v]:{exposure:"hidden"},[m]:{exposure:"hidden"},[y]:{exposure:"hidden"},[w]:{exposure:"hidden"},[b]:{exposure:"hidden"},[k]:{exposure:"event"},[S]:{exposure:"hidden"},[R]:{exposure:"hidden"},[x]:{exposure:"event"},[C]:{exposure:"hidden"},[T]:{exposure:"event"},[E]:{exposure:"event"},[I]:{exposure:"event"},[M]:{exposure:"hidden"},[P]:{exposure:"event"},[O]:{exposure:"hidden"},[A]:{exposure:"hidden"},[B]:{exposure:"hidden"},[j]:{exposure:"event"},[F]:{exposure:"event",shouldSkipFromEventProperties:t=>Ee(t)},[H]:{exposure:"event"},[U]:{exposure:"event"},[z]:{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"},[_t]:{exposure:"event"},[bt]:{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"},[Et]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[D]:{exposure:"event"},[L]:{exposure:"event"},[N]:{exposure:"event"},[q]:{exposure:"event"},[Ot]:{exposure:"event"},[At]:{exposure:"event"},[Ft]:{exposure:"event"},[Dt]:{exposure:"event"},[Lt]:{exposure:"event"},[Nt]:{exposure:"event"},[qt]:{exposure:"event"},[Bt]:{exposure:"event"},[jt]:{exposure:"event"},[Ht]:{exposure:"event"},[Wt]:{exposure:"event"}},ib=[[W,{exposure:"hidden"}],[V,{exposure:"hidden"}],[G,{exposure:"hidden"}]],nb=t=>{const e=eb[t];if(e)return e;for(const[e,i]of ib)if(0===t.indexOf(e))return i},sb={flags:St,surveys:ut},rb=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ob=t=>`${t}_cookie_identity_change_pending`,lb=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},ab="main",ub=[J,K,X,tt,et,St,it,rt],hb=t=>-1!==ub.indexOf(t),cb=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},db=t=>{if(!t)return{};const e=JSON.parse(t);return Se(e)?e:{}},vb=(t,e)=>{Gs(t,(i,n)=>{const s=nb(n);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,n)||delete t[n]})};var fb=class{constructor(e,i,n=!0){if(this.Wo={},this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=new Map,this.Xo=!1,this.Yo=!1,this.tl=!1,this.el=!1,this.il=new Set,this.Mr=e,this.nl=n,this.props={},this.sl=void 0,this.rl=(t=>{let e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(e),this.Fo=this.ol(e),this.Zo=this.ll(e),this.load(),this.al(),e.debug&&zs.info("Persistence loaded",e.persistence,le({},this.props)),this.update_config(e,e,i),this.save(),t){const e=()=>this.flush();er(t,"beforeunload",e,{capture:!1}),er(t,"pagehide",e,{capture:!1}),this.ul=e=>{if(this.Vo&&(!e.storageArea||e.storageArea===(null==t?void 0:t.localStorage))&&e.key)if(e.key!==this.rl){if(this.Zo){const t=tb.find(t=>e.key===this.hl(t));t&&this.cl(e.key,t)}}else this.cl(e.key,ab)},er(t,"storage",this.ul)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,e])=>{const i=this.Ko.get(t);if(!hb(t)||!0===i)return;if(!0===e)return void this.dl(t,!0);const n=new Set(i||[]);e.forEach(t=>n.add(t)),n.size&&this.dl(t,n)})}onCrossTabFeatureFlagChange(t){return this.il.add(t),()=>this.il.delete(t)}destroy(){this.ul&&t&&(t.removeEventListener("storage",this.ul),this.ul=void 0),this.il.clear()}cl(t,e,i=!0){if(this.pi)return!1;let n,s;try{if(s=Fl.Ot(t),Ee(s)){const t=this.vl(e);return t.storageValue=null,e!==ab&&(t.persisted=!1),!1}n=db(s)}catch(t){return!1}const r=e===ab?n:Fl.Dt(this.rl);if(r&&this.fl(r))return!1;const o=this.pl(n,e,i);return e===ab&&this.Zo&&!cb(this.gl().main,n)||this.ml(n,e,!0,s),o}fl(t){const e=this.props[f],i=t[f];return!Ce(e)&&!Ce(i)&&e!==i}ml(t,e,i,n){const s=this.vl(e);s.storageValue=n,e!==ab&&(s.persisted=i);try{s.fingerprint=this.yl(t,e)}catch(t){s.fingerprint=void 0}}pl(t,e,i){let n=!1;return ub.forEach(i=>{var s;const r=null===(s=nb(i))||void 0===s?void 0:s.storageGroup;if(e===ab&&this.Zo&&r||e!==ab&&r!==e)return;const o=i in t,l=this.bl(i,o?t[i]:void 0),a=this.Ko.has(i)?i in this.props:o;a===i in this.props&&cb(l,this.props[i])||(a?this._l(i,l,!1):this.wl(i,!1),n=!0)}),n&&i&&this.il.forEach(t=>t()),n}kl(){if(!this.Vo)return!1;try{this.tl=!1;const t=Fl.Ot(this.rl),e=this.vl(ab);let i,n=!1,s=!1;if(t!==e.storageValue)if(Ee(t))e.storageValue=null;else{if(i=db(t),this.tl=!this.Yo&&this.fl(i),this.tl)return!1;s=this.pl(i,ab,!1),!this.Zo||cb(this.gl().main,i)?this.ml(i,ab,!0,t):e.storageValue=t,n=!0}return this.Zo&&tb.forEach(t=>{const e=Fl.Ot(this.hl(t)),r=this.vl(t),o=i||{},l=n&&ub.some(e=>{var i;return(null===(i=nb(e))||void 0===i?void 0:i.storageGroup)===t&&e in o});if(e===r.storageValue&&!l)return;if(Ee(e))return r.storageValue=null,r.persisted=!1,void(l&&(s=this.pl(o,t,!1)||s));const a=db(e);s=this.pl(a,t,!1)||s,this.ml(a,t,!0,e)}),s}catch(t){return!1}}dl(t,e){this.Ko.set(t,e);const i=nb(t);(null==i?void 0:i.volatile)||(this.vl((this.Zo?null==i?void 0:i.storageGroup:void 0)||ab).fingerprint=void 0,this.Sl(t))}xl(){ub.forEach(t=>this.Ko.set(t,!0))}al(){if(this.Vo)try{const t=Fl.Ot(this.rl),e=db(t);this.vl(ab).storageValue=t,ub.forEach(t=>{var i;const n=this.Zo?null===(i=nb(t))||void 0===i?void 0:i.storageGroup:void 0,s=n?Fl.Ot(this.hl(n)):null;if(n){const t=this.vl(n);t.storageValue=s,t.persisted=!Ee(s)}const r=n&&!Ee(s)?db(s):e;t in this.props?this.Cl(t,r[t],this.props[t]):t in r&&this.dl(t,!0)})}catch(t){}}bl(t,e){const i=this.Ko.get(t);if(!i)return e;if(!0===i)return this.props[t];if("$active_feature_flags"===t){const n=new Set(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}Cl(t,e,i){if(!hb(t))return;const n=this.Ko.get(t);if(!0===n)return;let s=e;if(this.Vo)try{var r;const e=this.Zo?null===(r=nb(t))||void 0===r?void 0:r.storageGroup:void 0,i=e?this.hl(e):this.rl;s=db(Fl.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.dl(t,!0);const n=new Set(e||[]),r=new Set(s||[]),l=new Set(i);new Set([...n,...l]).forEach(t=>{n.has(t)!==l.has(t)&&o.add(t)}),o.forEach(t=>{r.has(t)===l.has(t)&&o.delete(t)})}else{if(!Se(i))return void(cb(s,i)?this.Ko.delete(t):this.dl(t,!0));{if(!Ce(e)&&!Se(e)||Ce(e)&&xe(i)&&Ce(s))return void this.dl(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&&cb(n[t],i[t])||o.add(t)}),o.forEach(t=>{t in r==t in i&&cb(r[t],i[t])&&o.delete(t)})}}o.size?this.dl(t,o):this.Ko.delete(t)}$l(){var t;const e=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Me(e)&&e>0?e:0}Tl(t){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase())if(t)try{const e=jl(t,this.Mr.cookie_persisted_properties||[]),i=Ul(e,this.Mr.cookie_persisted_properties||[]),n=JSON.stringify(e)+"|"+JSON.stringify(i),s=Ol.Ot(this.rl)||void 0;s&&Wl(this.rl,s)===n&&(this.Il=n,this.Ml=s)}catch(t){}else try{const t=Ol.Ot(this.rl)||void 0;this.Il=t?Wl(this.rl,t):void 0,this.Ml=t}catch(t){}}syncCookieProperties(){return this.El(this.Mr)}El(t,e=!1){if(this.pi&&!e||this.Jo||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let i;try{i=Ol.Ot(this.rl)||void 0}catch(t){}if(!i||i===this.Ml)return!1;const n=Wl(this.rl,i);let s;try{s=Bl(JSON.parse(i))}catch(t){return!1}if((Ol.Ot(this.rl)||void 0)!==i)return!1;this.Il=n,this.Ml=i;const r=zl(this.rl,i),o=[...Ll,...r.properties],l={};if(Object.keys(s).forEach(t=>{const e=s[t];(Ce(e)||Ee(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=Zs({},u);[...Ll,...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===Ll.indexOf(t)||!1!==e&&0!==e)&&delete d[t]}}),this.props=Zs(d,s),ub.forEach(t=>{const e=t in this.props;t in u===e&&cb(u[t],this.props[t])||(e?this.Cl(t,u[t],this.props[t]):this.dl(t,!0))}),!a||"$user_state"in s||"$user_state"in this.props||this._l(xt,Gt);const v=this.props[f],p=this.props[xt];return!a||v===h&&p===c||(this.Yo=!0,this.Qo=!0,Ql.At(ob(this.rl),!0),this.wl(rt),this.wl(K),this.wl(J),this.wl(X),this.wl(tt),this.wl(et),this.wl(St),this.wl(kt),this.wl(bt),"anonymous"!==p||"identified"!==c&&"anonymous"!==s.$user_state&&(Ce(h)||v===h)||(vb(this.props,s),this.wl(ot)),"identified"===p?this.props.$user_id=v:delete this.props.$user_id,this.wl(m)),!0}consumeCookieIdentityChange(){const t=ob(this.rl),e=this.Qo||!!Ql.Ot(t);return this.Qo=!1,e&&Ql.Lt(t),e}Pl(t=!1){return!(this.Jo||this.pi&&!t||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.Jo=!0,0))}Rl(){this.Jo&&(Ce(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[ab],this.Fl(!0))}Ol(t=!0){if(this.Jo)try{t?this.Rl():Ce(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}isDisabled(){return!!this.pi}ol(e){-1===rb.indexOf(e.persistence.toLowerCase())&&(zs.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const i=((e=[],i=!1)=>{const n=[...Ll,...e];return le(le({},Fl),{},{Dt(t){try{let s,r={};try{s=Ol.Ot(t)||void 0,r=s?Bl(JSON.parse(s)):{}}catch(t){}const o=JSON.parse(Fl.Ot(t)||"{}");let l;if(i){const i=zl(t,s),a=[...Ll,...i.properties],u={};Object.keys(r).forEach(t=>{const e=r[t];Ee(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===Ll.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||(Dl.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=Zs(o,u)}else l=Zs(r,o);return Fl.At(t,l),l}catch(t){}return null},At(t,n,s,r,o,l){const a=Fl.At(t,n,void 0,void 0,l);try{const u=jl(n,e);if(Object.keys(u).length){if(i){const i=Nl(t),h=Ul(u,e);if(Ol.At(i,h,s,r,o,l),Ol.Ot(i)!==JSON.stringify(h)){Ol.Lt(i,r);const e=jl(n);return Ol.At(t,e,s,r,o,l),a}}Ol.At(t,u,s,r,o,l)}}catch(t){Fl.Pt(t)}return a},Lt(e,i){try{null==t||t.localStorage.removeItem(e),Ol.Lt(e,i),Ol.Lt(Nl(e),i)}catch(t){Fl.Pt(t)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let n,s=!1,r=!1;const o=e.persistence.toLowerCase();return"localstorage"===o&&Fl.Et()?(n=Fl,r=!0):"localstorage+cookie"===o&&i.Et()?(n=i,r=!0,s=!0):"sessionstorage"===o&&Ql.Et()?n=Ql:"memory"===o?n=Gl:"cookie"===o&&Ol.Et()?(n=Ol,s=!0):i.Et()?(n=i,r=!0,s=!0):Ol.Et()?(n=Ol,s=!0):n=Gl,this.Vo=r,this.Go=s,n}hl(t){return`${this.rl}__${t}`}ll(t){return this.Vo&&!!t.split_storage}properties(){const t={};return Gs(this.props,(e,i)=>{const n=nb(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?Fl.Dt(this.rl):null;let n={};if(e)try{n=Bl(Ol.Dt(this.rl)),Gs(n,(t,e)=>{(Ce(t)||Ee(t)||""===t)&&delete n[e]})}catch(t){}const s=this.Fo.Dt(this.rl);if(s&&(this.props=Zs({},s)),this.Zo&&this.Dl(),e&&s){var r,o;const t=null==i?void 0:i[f],e=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Gt,l=s[f],a=null!==(o=s.$user_state)&&void 0!==o?o:Gt;if(l!==t||a!==e){this.Qo=!0,Ql.At(ob(this.rl),!0);const i=Zs({},this.props);Dl.forEach(t=>delete i[t]),"anonymous"!==a||"identified"!==e&&"anonymous"!==n.$user_state&&(Ce(t)||l===t)||(vb(i,n),delete i[ot]),this.props=i;const s=new Set;Dl.forEach(t=>{var e;const i=null===(e=nb(t))||void 0===e?void 0:e.storageGroup;i&&s.add(i)}),s.forEach(t=>{const e={};Gs(this.props,(i,n)=>{var s;(null===(s=nb(n))||void 0===s?void 0:s.storageGroup)===t&&(e[n]=i)}),xe(e)?(Fl.Lt(this.hl(t)),this.Wo[t]={}):Fl.At(this.hl(t),e)&&(this.Wo[t]={persisted:!0,fingerprint:this.yl(e,t)})})}}Ql.Ot(ob(this.rl))&&(this.Qo=!0)}Dl(){for(const t of tb){const e=Fl.Dt(this.hl(t));if(e&&!xe(e)){const i=this.vl(t);i.persisted=!0,this.Ll(t)||(i.fingerprint=this.yl(e,t)),this.Nl(t,e)||Zs(this.props,e)}}}Ll(t){return Object.keys(this.props).some(e=>{var i;return(null===(i=nb(e))||void 0===i?void 0:i.storageGroup)===t})}Nl(t,e){const i=sb[t];if(!i)return!1;const n=e[i],s=this.props[i];return Me(n)&&Me(s)&&s>n}refreshKey(t){var e;if(this.pi)return;if("$fbc_persistence"===t&&this.el)return;const i=this.Zo?null===(e=nb(t))||void 0===e?void 0:e.storageGroup:void 0,n=i?Fl.Dt(this.hl(i)):this.Fo.Dt(this.rl);if(n&&t in n)this._l(t,n[t],!1);else{if(i){const e=this.Fo.Dt(this.rl);if(e&&t in e)return void this._l(t,e[t],!1)}this.wl(t,!1)}}save(){if(this.pi)return;const t=this.$l();t>0?Ce(this.Al)&&(this.Al=setTimeout(()=>{this.Al=void 0,this.Fl()},t)):this.Fl()}flush(){Ce(this.Al)||(clearTimeout(this.Al),this.Al=void 0,this.Fl())}Fl(t=!1){if(this.pi||this.Jo&&!t)return;t||(this.syncCookieProperties(),this.el||this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||this.refreshKey(b));const e=!t&&!this.Xo;e||(this.tl=!1);const i=!!e&&this.kl();if(this.tl)return void(this.Mr.debug&&zs.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Zo)return this.ql(),void(i&&this.il.forEach(t=>t()));const n=this.jl(this.Fo,this.rl,this.props,ab);"written"===n&&this.Tl(this.props),"failed"!==n&&(this.Ko.clear(),this.Yo=!1,this.el=!1),i&&this.il.forEach(t=>t())}ql(){const{main:t,groups:e}=this.gl(),i=this.jl(this.Fo,this.rl,t,ab);"written"===i&&this.Tl(t),"failed"!==i&&(this.Yo=!1,this.el=!1,ub.forEach(t=>{var e;(null===(e=nb(t))||void 0===e?void 0:e.storageGroup)||this.Ko.delete(t)}));for(const t of tb){var n;const i=e[t];if(xe(i)&&!(null===(n=this.Wo[t])||void 0===n?void 0:n.persisted)){ub.forEach(e=>{var i;(null===(i=nb(e))||void 0===i?void 0:i.storageGroup)===t&&this.Ko.delete(e)});continue}const s=this.jl(Fl,this.hl(t),i,t);"failed"!==s&&ub.forEach(e=>{const i=nb(e);(null==i?void 0:i.storageGroup)!==t||"written"!==s&&i.volatile||this.Ko.delete(e)})}}gl(){const t={},e={flags:{},surveys:{}};return Gs(this.props,(i,n)=>{var s;const r=null===(s=nb(n))||void 0===s?void 0:s.storageGroup;r?e[r][n]=i:t[n]=i}),{main:t,groups:e}}yl(t,e){if(e===ab)return JSON.stringify(t)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;const i={};return Gs(t,(t,e)=>{var n;i[e]=(null===(n=nb(e))||void 0===n?void 0:n.volatile)?"__volatile__":t}),JSON.stringify(i)}jl(t,e,i,n){const s=this.vl(n);if(n!==ab&&!s.dirty&&!Ce(s.fingerprint))return"skipped";let r;try{if(r=this.yl(i,n),r===s.fingerprint)return s.dirty=!1,"skipped"}catch(t){r=void 0}return t.At(e,i,this.Bl,this.Hl,this.zl,this.Mr.debug)?(s.dirty=!1,n!==ab&&(s.persisted=!0),Ce(r)||(s.fingerprint=r),this.Vo&&(s.storageValue=Fl.Ot(e)),"written"):(this.Mr.debug&&zs.warn(`failed to persist storage entry "${e}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.xl(),Ce(this.Al)||(clearTimeout(this.Al),this.Al=void 0),this.Fo.Lt(this.rl,!1),this.Fo.Lt(this.rl,!0),!t&&this.nl)for(const t of tb)Fl.Lt(this.hl(t));t?delete this.Wo[ab]:this.Wo={},this.Il=void 0,this.Ml=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(Se(t)){this.syncCookieProperties(),Ce(e)&&(e="None"),this.Bl=Ce(i)?this.Ul:i;let n=!1;if(Gs(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this._l(i,t),n=!0)}),n)return this.save(),!0}return!1}register(t,e){if(Se(t)){this.syncCookieProperties(),this.Bl=Ce(e)?this.Ul:e;let i=!1;if(Gs(t,(e,n)=>{t.hasOwnProperty(n)&&(this.props[n]!==e||Se(e)||we(e))&&(this._l(n,e),i=!0)}),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();const e="string"==typeof t?[t]:t;let i=!1;for(const t of e)t in this.props&&(this.wl(t),i=!0);i&&this.save()}update_campaign_params(){const t=null==n?void 0:n.URL;if(t===this.sl)return;const e=Ta(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),i=!xe(Ks(e));return i&&this.register(e),this.sl=t,i?e:void 0}update_search_keyword(){this.register(function(){const t=null==n?void 0:n.referrer;return t?Ia(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:Oa(),$referring_domain:(null==n?void 0:n.referrer)&&(null===(t=rr(n.referrer))||void 0===t?void 0:t.host)||Pa},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Aa(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[It]:this.Go?{r:lb(t.r),u:t.u?lb(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Gs([Et,Tt],e=>{const i=this.props[e];i&&Gs(i,function(e,i){t["$initial_"+ge(i)]=e})});const e=this.props[It];if(e){const i=function(t,e=!1){const i=Fa(t,e),n={};return Gs(i,function(t,e){n[`$initial_${ge(e)}`]=t}),n}(e,this.Mr.disable_capture_url_hashes);Zs(t,i)}return t}safe_merge(t){return Gs(this.props,function(e,i){i in t||(t[i]=e)}),t}update_config(t,e,i){const n=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;const i=[...t].sort(),n=[...e].sort();return i.every((t,e)=>t===n[e])})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),r=n||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,l=t.disable_persistence||!!i,a=!!this.pi&&!l;l||this.El(e,a),this.Mr=t,!l&&(n||s||o)&&(this.Il=void 0,this.Ml=void 0,this.El(le(le({},t),{},{cookie_persisted_properties:e.cookie_persisted_properties}),a));const u=r||o?this.ol(t):this.Fo;this.Wl();const h=this.ll(t),c=r||h!==this.Zo,d=!l&&(c||t.cross_subdomain_cookie!==this.Hl||t.secure_cookie!==this.zl)&&this.Pl(a);this.Xo=c;try{if(this.Ul=this.Bl=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),c){const t=this.props;this.clear(),this.Fo=u,this.Zo=h,this.props=t,this.save()}else o&&(this.Fo=u,l||(delete this.Wo[ab],this.Fl()))}finally{this.Xo=!1,d&&this.Ol()}}Wl(){const t=this.props[It];if(!this.Go||!Se(t)||"string"!=typeof t.r)return;const e=lb(t.r),i="string"==typeof t.u?lb(t.u):t.u;e===t.r&&i===t.u||this._l(It,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.Hl&&(this.Hl=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.zl&&(this.zl=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){const i=this.props.__timers||{};i[t]=e,this._l(w,i),this.save()}remove_event_timer(t){const e=this.props.__timers||{},i=e[t];return Ce(i)||(delete e[t],this._l(w,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this._l(t,e),this.save()}_l(t,e,i=!0){var n;const s=this.props[t];this.props[t]=e,i&&("distinct_id"!==t&&"$user_state"!==t||s===e||(this.Yo=!0),"$fbc_persistence"!==t||cb(s,e)||(this.el=!0),this.Cl(t,s,e),(null===(n=nb(t))||void 0===n?void 0:n.volatile)||this.Sl(t))}wl(t,e=!0){delete this.props[t],e&&(hb(t)&&this.dl(t,!0),"$fbc_persistence"===t&&(this.el=!0),this.Sl(t))}Sl(t){var e;const i=null===(e=nb(t))||void 0===e?void 0:e.storageGroup;i&&(this.vl(i).dirty=!0)}vl(t){return this.Wo[t]||(this.Wo[t]={})}};const pb={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},gb={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},mb={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},yb=Ws("[RateLimiter]");var _b=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=>{yb.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void yb.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=(Me(l.dropped)?l.dropped:0)+1;l.dropped=t,!this.lastEventRateLimited&&this.Vl(t)&&(l.dropped=0)}return this.lastEventRateLimited=a,null===(n=this.instance.persistence)||void 0===n||n.set_property("$capture_rate_limit",l),{isRateLimited:a,remainingTokens:l.tokens}}Gl(t){const e=this.instance.config.property_denylist;return!we(e)||!e.includes(t)}Zl(){var t;if(this.Gl("$current_url")&&this.Gl("$pathname")&&(null==s?void 0:s.pathname))return`${null!==(t=s.origin)&&void 0!==t?t:""}${s.pathname}`}Vl(t){var e,i;const{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,r=this.Zl(),o=this.Gl("$session_id")?null===(e=(i=this.instance).get_session_id)||void 0===e?void 0:e.call(i):void 0,l=[`${t} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${l}. Config is set to ${s} events per second and ${n} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(t){const e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}};const bb=Ws("[RemoteConfig]");var wb=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=d._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Ql(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.loadExternalDependency)?null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Jl(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:t})}load(){try{if(this.remoteConfig)return bb.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance.Xl())return void bb.warn("Remote config is disabled. Falling back to local config.");this.Ql(t=>{if(!t)return bb.info("No config found after loading remote JS config. Falling back to JSON."),void this.Jl(t=>{this.Kl(t.json,t)});this.Kl(t)})}catch(t){bb.error("Error loading remote config",t),this.Kl()}}Kl(t,e){!t&&e&&(0===e.statusCode?e.error||bb.warn("Failed to fetch remote config from PostHog."):bb.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(t?{ok:!0,config:t}:{ok:!1})}catch(t){bb.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){bb.error("Error loading feature flags",t)}}};const kb=["fatal","error","warning","log","info","debug"],Sb=!!o||!!r,xb=new WeakMap,Cb="text/plain";let $b=!1;const Tb=(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}`:""}`},Eb=(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=or(o);return a&&l.push(a),l.length>0?`${s}?${l.join("&")}`:s},Ib=t=>{if(t.Yl)return t.Yl;const{data:e,compression:i}=t;if(!e)return;if(i===ap.GZipJS){const t=yl(_l(sr(e)),{mtime:0});return{contentType:Cb,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(i===ap.Base64){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(sr(e)),i=(t=>"data="+encodeURIComponent("string"==typeof t?t:sr(t)))(t);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const n=sr(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}},Mb=t=>{const e=()=>"sendBeacon"===t.transport?{url:Eb(t.url,{compression:ap.Base64}),encodedBody:Ib(le(le({},t),{},{compression:ap.Base64,Yl:void 0}))}:{url:Tb(t.url,"compression"),encodedBody:Ib(le(le({},t),{},{compression:void 0,Yl:void 0}))};let i;try{i=Ib(t)}catch(i){if(rs(t.compression,lr(t.url,"compression")))return zs.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return i&&rs(t.compression,lr(t.url,"compression"))&&!((n=i.body)instanceof ArrayBuffer?ss(new Uint8Array(n)):ArrayBuffer.isView(n)&&ss(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?($b=!0,e()):{url:t.url,encodedBody:i};var n},Rb=t=>{try{return Mb(t)}catch(i){var e;return zs.error(i),void(null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))}},Pb=function(){var t=ne(function*(t){const e=yield ds(sr(t.data),Jl.DEBUG,{rethrow:!0});if(!e)return t;const i=yield e.arrayBuffer();return le(le({},t),{},{Yl:{contentType:Cb,body:i,estimatedSize:i.byteLength}})});return function(e){return t.apply(this,arguments)}}(),Ob=/Failed to fetch|NetworkError|Load failed/i,Ab=t=>"TypeError"===(null==t?void 0:t.name)&&Ob.test((null==t?void 0:t.message)||""),Fb=t=>{const e=Rb(t);if(!e)return;const i=new o;xb.set(i,!0);const{url:n,encodedBody:s}=e;i.open(t.method||"GET",n,!0);const{contentType:r,body:l}=null!=s?s:{};Gs(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)},Db=t=>{const e=Rb(t);if(!e)return;const{url:i,encodedBody:n}=e,{contentType:s,body:o,estimatedSize:a}=null!=n?n:{},u=new Headers;Gs(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(sn("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)||Ab(e)?zs.warn(e):zs.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.ta&&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){zs.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)}},Lb=t=>{try{var e;const{url:n,encodedBody:s}=Mb(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 Lb(le(le({},t),{},{data:i(h.slice(0,e))})),void Lb(le(le({},t),{},{data:i(h.slice(e))}))}zs.warn(`Beacon of ~${null!=a?a:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?Db(le(le({},t),{},{ta:!0})):Fb(t)}catch(t){zs.warn("Beacon send failed",t)}},Nb=(t,e,i,n)=>{const s="query"===n?"POST"===e?"sent_at":"_":void 0;return Eb(i===ap.GZipJS?Tb(t,"compression"):t,le(le({},s?{[s]:Date.now().toString()}:{}),i===ap.GZipJS?{}:{compression:i}))},qb=(()=>{const t=[];return r&&t.push({transport:"fetch",method:Db}),o&&t.push({transport:"XHR",method:Fb}),(null==i?void 0:i.sendBeacon)&&t.push({transport:"sendBeacon",method:Lb}),t})();var Bb=class{constructor(t,e){this.ea=!0,this.ia=[],this.na=Ve((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,zs.createLogger("flush interval"),3e3),this.sa=t}enqueue(t){this.ia.push(t),this.ra||this.oa()}unload(){this.la();const t=this.ia.length>0?this.aa():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.ua(le(le({},t),{},{transport:"sendBeacon"}))})}enable(){this.ea=!1,this.oa()}oa(){this.ea||(this.ra=setTimeout(()=>{if(this.la(),this.ia.length>0){const t=this.aa();for(const e in t)this.ua(t[e])}},this.na))}ua(t){try{this.sa(t)}catch(t){zs.error(t)}}la(){clearTimeout(this.ra),this.ra=void 0}aa(){const t={};return Gs(this.ia,e=>{var i;const n=e,s=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");Ce(t[s])&&(t[s]=le(le({},n),{},{data:[]})),null===(i=t[s].data)||void 0===i||i.push(n.data)}),this.ia=[],t}};const jb=["retriesPerformedSoFar"];var Hb=class{constructor(t){this._instance=t,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}resume(){if(!Ce(t)&&"onLine"in t.navigator){if(this.da=t.navigator.onLine,this.va)return;this.va=()=>{this.da=!0,this.fa()},this.pa=()=>{this.da=!1},er(t,"online",this.va),er(t,"offline",this.pa)}}get length(){return this.ia.length}retriableRequest(t){let{retriesPerformedSoFar:e}=t,i=gs(t,jb);Re(e)&&(i.url=Eb(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.Ls(le({retriesPerformedSoFar:e},i));0===t.statusCode&&zs.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)}}))}Ls(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.ia.push({retryAt:n,requestOptions:t});let s=`Enqueued failed request for retry in ${i}`;navigator.onLine||(s+=" (Browser is offline)"),zs.warn(s),this.ha||(this.ha=!0,this.ga())}ga(){if(this.ma&&clearTimeout(this.ma),0===this.ia.length)return this.ha=!1,void(this.ma=void 0);this.ma=setTimeout(()=>{this.da&&this.ia.length>0&&this.fa(),this.ga()},this.ca)}fa(){const t=Date.now(),e=[],i=this.ia.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.ia=e,i.length>0)for(const{requestOptions:t}of i)this.retriableRequest(t)}unload(){this.ma&&(clearTimeout(this.ma),this.ma=void 0),this.ha=!1,Ce(t)||(this.va&&(t.removeEventListener("online",this.va),this.va=void 0),this.pa&&(t.removeEventListener("offline",this.pa),this.pa=void 0));for(const{requestOptions:t}of this.ia)try{this._instance._send_request(le(le({},t),{},{transport:"sendBeacon"}))}catch(t){zs.error(t)}this.ia=[]}},Ub=class{constructor(t){this._instance=t,this.ya=()=>{var t,e,i,n;this.ba||(this.ba={});const s=this.scrollElement(),r=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,l=r+((null==s?void 0:s.clientHeight)||0),a=(null==s?void 0:s.scrollHeight)||0;this.ba.lastScrollY=Math.ceil(r),this.ba.maxScrollY=Math.max(r,null!==(t=this.ba.maxScrollY)&&void 0!==t?t:0),this.ba.maxScrollHeight=Math.max(o,null!==(e=this.ba.maxScrollHeight)&&void 0!==e?e:0),this.ba.lastContentY=l,this.ba.maxContentY=Math.max(l,null!==(i=this.ba.maxContentY)&&void 0!==i?i:0),this.ba.maxContentHeight=Math.max(a,null!==(n=this.ba.maxContentHeight)&&void 0!==n?n:0)}}get _a(){return this._instance.config.scroll_root_selector}getContext(){return this.ba}resetContext(){const t=this.ba;return this.ba=void 0,setTimeout(this.ya,0),t}startMeasuringScrollPosition(){er(t,"scroll",this.ya,{capture:!0}),er(t,"scrollend",this.ya,{capture:!0}),er(t,"resize",this.ya)}scrollElement(){if(this._a){const i=we(this._a)?this._a:[this._a];for(const n of i){var e;const i=null==t||null===(e=t.document)||void 0===e?void 0:e.querySelector(n);if(i)return i}return}var i;return null==t||null===(i=t.document)||void 0===i?void 0:i.documentElement}wa(e){var i,n;const s="y"===e?"scrollTop":"scrollLeft";if(this._a){const t=this.scrollElement();return t&&t[s]||0}return t?"y"===e?t.scrollY||t.pageYOffset||(null===(i=t.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:t.scrollX||t.pageXOffset||(null===(n=t.document)||void 0===n||null===(n=n.documentElement)||void 0===n?void 0:n.scrollLeft)||0:0}scrollY(){return this.wa("y")}scrollX(){return this.wa("x")}};const zb=t=>Aa(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 Wb=class{constructor(t,e,i,n){this.je=t=>{const e=this.ka();if(e&&e.sessionId===t)return;const i={sessionId:t,props:this.Sa(this._instance)};this.xa.register({[Ct]:i})},this._instance=t,this.Ca=e,this.xa=i,this.Sa=n||zb,this.Ca.onSessionId(this.je)}ka(){return this.xa.props[Ct]}getSetOnceProps(){var t;const e=null===(t=this.ka())||void 0===t?void 0:t.props;return e?"r"in e?Fa(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 Gs(Ks(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t[`$session_entry_${ge(i)}`]=e}),t}},Vb=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 Gb=Ws("[SessionId]"),Zb=864e5;var Qb=class{on(t,e){return this.Ta.on(t,e)}constructor(t,e,i){var n;if(this.Ia=null,this.Ma=null,this.Ea=[],this.Pa=void 0,this.Ra=!1,this.Ta=new Vb,this.Aa=(t,e)=>!(!Re(t)||!Re(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=t.config,this.xa=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=e||El,this.Da=i||El;const s=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Ve(this.Mr.session_idle_timeout_seconds||1800,60,36e3,Gb.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.La(),this.Na="ph_"+s+"_window_id",this.qa="ph_"+s+"_primary_window_exists",this.ja()){const t=Ql.Dt(this.Na),e=Ql.Dt(this.qa);t&&!e?this.Be=t:Ql.Lt(this.Na),Ql.At(this.qa,!0)}(null===(n=this.Mr.bootstrap)||void 0===n?void 0:n.sessionID)&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Ba()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Ce(this.Ea)&&(this.Ea=[]),this.Ea.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.Ea=this.Ea.filter(e=>e!==t)}}ja(){return"memory"!==this.Mr.persistence&&!this.xa.pi&&Ql.Et()}Ha(t){t!==this.Be&&(this.Be=t,this.ja()&&Ql.At(this.Na,t))}za(){return this.Be?this.Be:this.ja()?Ql.Dt(this.Na):null}Ua(t){const e=this.Ia;return!Ee(e)&&!Ee(t)&&5e3>Math.abs(t-e)}Wa(t,e,i){const n=e!==this._sessionActivityTimestamp,s=!(t!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Xt=t,s&&!n||s&&this.Ua(e)||(this.Ia=e,this.xa.register({[B]:[e,t,i]}))}Va(){var t;const e=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Re(e)&&e>0}Ga(){this.Va()?this.xa.refreshKey(B):(this.xa.flush(),this.xa.load())}Za(){var t;if(Ee(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ia)return;this.Ga();const[,e,i]=this.Qa();e===this.Xt&&i===this._sessionStartTimestamp&&(this.Ia=this._sessionActivityTimestamp,this.xa.register({[B]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.xa.flush())}Ja(){const[t]=this.Qa(),e=Re(t)?t:0,i=Re(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Ka(t){return this.Ga(),this.Aa(t,this.Ja())}Qa(){const t=this.xa.props[B];return we(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Xa),this.Xa=void 0,this.Wa(null,null,null)}setBootstrapSessionId(t,e=!1){const i=((t,e=(new Date).getTime())=>{try{const i=(t=>{const e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void Gb.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void Gb.error("Invalid sessionID in bootstrap",t)}})(t);return!Ce(i)&&(e?this.Fa={sessionId:t,sessionStartTimestamp:i}:this.Wa(t,(new Date).getTime(),i),!0)}destroy(){this.Ra=!0,this.Za(),clearTimeout(this.Xa),this.Xa=void 0,this.Pa&&t&&(t.removeEventListener(Kt,this.Pa,{capture:!1}),this.Pa=void 0),this.Ea=[]}Ba(){this.Pa=()=>{this.Za(),this.ja()&&Ql.Lt(this.qa)},er(t,Kt,this.Pa,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,e=null,i=!1){if("always"===this.Mr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const n=e||(new Date).getTime(),s=this.Xt;if(i)this.Ma=n;else if(Ee(this.Ma)||this.Ma>n||n-this.Ma>=1e3){var r,o;null===(r=(o=this.xa).syncCookieProperties)||void 0===r||r.call(o),this.Ma=n}let[,l,a]=this.Qa();const u=!Ce(s)&&l!==s,h=this.Ja();let c=this.za();const d=this.Fa,v=!!d&&(d.sessionStartTimestamp>n+6e4||n-d.sessionStartTimestamp>Zb),f=d?v:Re(a)&&Math.abs(n-a)>Zb;let p=!1,g=u;const m=!l||!!d,y=l;let _=!m&&!t&&this.Aa(n,h);if(_&&(_=this.Ka(n),_||Gb.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,a]=this.Qa()),m||_||f){g=!1;const t=d&&!v;l=t?d.sessionId:this.Oa(),c=this.Da(),Gb.info("new session ID assigned",{sessionId:l,windowId:c,bootstrapped:!!t,changeReason:{noSessionId:m,activityTimeout:_,sessionPastMaximumLength:f}}),a=t?d.sessionStartTimestamp:n,this.Fa=void 0,p=!0}else c||(c=this.Da(),p=!0),g=g||l!==y,g&&(Gb.info("adopted cross-tab session id",{sessionId:l,windowId:c}),p=!0);const b=Re(h)&&t&&!f?h:n,w=Re(a)?a:(new Date).getTime();this.Ha(c),this.Wa(l,b,w),t||this.La();const k={noSessionId:m,activityTimeout:_,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.Ea.forEach(t=>t(l,c,k)),{sessionId:l,windowId:c,sessionStartTimestamp:w,changeReason:p?k:void 0,lastActivityTimestamp:h}}La(){this.Ra||(clearTimeout(this.Xa),this.Xa=setTimeout(()=>{if(!this.Ra)if(this.Ka((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.Ta.emit("forcedIdleReset",{idleSessionId:t})}else this.La()},1.1*this.sessionTimeoutMs))}};const Jb=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 Kb(){return Kb=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 zs.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}),Kb.apply(this,arguments)}const Yb="custom",Xb="i.posthog.com",tw=/^\/static\//,ew=["/s/","/e/","/i/"];var iw=class{constructor(t){this.Ya={},this.instance=t}get apiHost(){const t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){const t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t;let e=null===(t=this.instance.config.ui_host)||void 0===t?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace(`.${Xb}`,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Ya[this.apiHost]||(this.Ya[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":Yb),this.Ya[this.apiHost]}tu(t){if(!tw.test(t))return;const e=this.instance.config.asset_host;return"string"==typeof e&&e.trim().replace(/\/$/,"")||void 0}eu(t){const e=rr(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}iu(t,e,i){if("ui"===t)return i;let n=i;const s=this.instance.config.rewriteRequestPath;if(s){var r;const t=(null===(r=rr(i))||void 0===r?void 0:r.href)||i;n=s(new URL(t)).toString()}if(s&&"api"===t&&ew.some(t=>0===e.indexOf(t))){const t=this.eu(n);if(t){const e=this.apiHost;let i=this.nu;(null==i?void 0:i.apiHost)===e&&i.rewriteRequestPath===s||(i={apiHost:e,rewriteRequestPath:s,urls:new Set},this.nu=i),i.urls.add(t)}}return n}isIngestionEndpoint(t){const e=this.nu,i=this.eu(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e=""){if(e&&(e="/"===e[0]?e:`/${e}`),"ui"===t)return this.iu(t,e,this.uiHost+e);if("flags"===t)return this.iu(t,e,this.flagsApiHost+e);if("assets"===t){const i=this.tu(e);if(i)return this.iu(t,e,`${i}${e}`)}if(this.region===Yb)return this.iu(t,e,this.apiHost+e);const i=Xb+e;switch(t){case"assets":return this.iu(t,e,`https://${this.region}-assets.${i}`);case"api":return this.iu(t,e,`https://${this.region}.${i}`)}}};const nw=Ws("[PostHog ExternalIntegrations]"),sw={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var rw=class{constructor(t){this._instance=t}No(t,e){var i,n;null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,t,t=>{if(t)return nw.error("failed to load script",t);e()})}startIfEnabledOrStop(){var t;for(const[s,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var e,i,n;r&&!(null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[s])&&this.No(sw[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())}}},ow=class{constructor(t,e){this.$=t,this.po=e,this.su=new Map,this.So=!1}add(t){var e=this;return ne(function*(){if(e.So)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.su.has(t.name))throw new Error(`Browser extension "${t.name}" is already registered`);e.su.set(t.name,t);try{const i=t.setup(e.po);i&&(yield i)}catch(i){const n=e.su.get(t.name)===t;n&&e.su.delete(t.name),e.$.error(`Failed to set up browser extension "${t.name}"`,i),n&&e.ru(t)}})()}getExtension(t){return this.su.get(t)}dispose(){if(this.So)return;this.So=!0;const t=Array.from(this.su.values()).reverse();this.su.clear();for(const e of t)this.ru(e)}ru(t){try{var e;const i=null===(e=t.dispose)||void 0===e?void 0:e.call(t);i&&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)}}},lw=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 aw="extensionsRemoteConfig";var uw=class{constructor(t){this.instance=t,this.So=!1,this.$=zs,this.ou=t.lu,this.kv=new lw(t),this.onEvent=t=>bp(this.instance.on("eventCaptured",e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.$.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.So)return bp(()=>{});const e=e=>{try{t(e)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},i=this.instance.au.on(aw,e);return this.ou&&e(this.ou),bp(i)},this.uu=new ow(zs.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:Jl.LIB_NAME,version:Jl.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,n;const s=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(n=null==s?void 0:s.sessionStartTimestamp)&&void 0!==n?n:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.uu.add(t)}getExtension(t){return this.uu.getExtension(t)}capture(t,e,i){var n=this;return 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 bp(this.instance.hu(t))}handleRemoteConfig(t){this.So||(this.ou=t,this.instance.au.emit(aw,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?Eb(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.So||(this.So=!0,this.uu.dispose())}};const hw={};let cw=0;const dw=()=>{},vw='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',fw="Surveys module not available",pw="sanitize_properties is deprecated. Use before_send instead",gw="Invalid value for property_denylist config: ",mw=/^[A-Za-z0-9_-]{1,400}$/,yw=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,_w=["token","distinct_id",Pt],bw="posthog";let ww=!Sb&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla"));const kw=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},Sw=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:tr(null==n?void 0:n.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:dw,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){zs.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:dw},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Rr,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:kw(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))},xw=[["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"]],Cw=t=>{const e={};for(const[i,n]of xw)Ce(t[i])||(e[n]=t[i]);const i=Zs({},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]:zs.error(gw+t.property_denylist)),i};var $w=class{constructor(){this.__forceAllowLocalhost=!1}get cu(){return this.__forceAllowLocalhost}set cu(t){zs.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Tw=class e{du(t){if(!t)return;const e=this.su.indexOf(t);-1!==e&&this.su.splice(e,1)}vu(t,e){var i;return this.du(t),this.su.push(e),null===(i=e.initialize)||void 0===i||i.call(e),e}fu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}pu(){if(this.gu)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.fu())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.mu)return;let e,i,n;t?(e=`persistence is set to '${this.config.persistence}'`,i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",n="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(e="persistence is disabled (disable_persistence is true)",i="on every page load",n="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.gu=!0,console.warn("[PostHog.js]",`${e} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${n}`)}yu(){if(this.fu()||"$posthog_cookieless"!==this.get_distinct_id())return;const t=this.persistence;if(!t)return;this.bu()||t.load(!0);const e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){const e=this.config.get_device_id(El());this.register({distinct_id:e,$device_id:e}),t.set_property(xt,Gt)}this._u()}get decideEndpointWasHit(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.wu=!1,this.ku=!1,this.webPerformance=new $w,this.Su=!1,this.version=Jl.LIB_VERSION,this.xu=new Set,this.Cu="",this.au=new Vb,this.su=[],this.$u=[],this.mu=!1,this.gu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Sw(),this.SentryIntegration=Y_,this.sentryIntegration=t=>function(t,e){const i=K_(t,e);return{name:J_,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tu=!1,this.Iu=null,this.Mu=null,this.Eu=null,this.scrollManager=new Ub(this),this.pageViewManager=new X_(this),this.rateLimiter=new _b(this),this.requestRouter=new iw(this),this.consent=new U_(this),this.externalIntegrations=new rw(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=>zs.info(`send "${null==t?void 0:t.event}"`,t))}init(t,i,n){if(n&&n!==bw){var s;const r=null!==(s=hw[n])&&void 0!==s?s:new e;return r._init(t,i,n),hw[n]=r,hw[bw][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 zs.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=Sw(i.defaults),i.debug=this.Pu(i.debug),this.Ru=i,this.Au=[],i.person_profiles?this.Mu=i.person_profiles:i.process_person&&(this.Mu=i.process_person);const u=Sw(i.defaults),h=Cw(i),c=Zs({},u,h,{name:n,token:l});Se(u.rageclick)&&Se(h.rageclick)&&(c.rageclick=Zs({},u.rageclick,h.rageclick)),Se(u.session_recording)&&Se(h.session_recording)&&(c.session_recording=Zs({},u.session_recording,h.session_recording)),this.set_config(c),this.config.on_xhr_error&&zs.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:ap.GZipJS;const d=this.bu();if(this.persistence=new fb(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new fb(le(le({},this.config),{},{persistence:"sessionStorage"}),d,!1),this.Cu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&Ql.Et()){const t=Ql.Dt(this.Cu);we(t)&&t.forEach(t=>{$e(t)&&this.xu.add(t)})}else Ql.Lt(this.Cu);const v=le({},this.persistence.props),f=le({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Fu=new Bb(t=>this.Ou(t),this.config.request_queue_config),this.Du=new Hb(this),this.__request_queue=[];const p=this.fu();p||(this.sessionManager=new Qb(this),this.sessionPropsManager=new Wb(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,e,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this.Lu()})),this.Nu(),this.config.__preview_deferred_init_extensions?(zs.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.qu(p)},0)):(zs.info("Initializing extensions synchronously"),this.qu(p)),Jl.DEBUG=Jl.DEBUG||this.config.debug,Jl.DEBUG&&zs.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.mu=!!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)zs.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(El()),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:Rt,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(El());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(xt,Gt)}return er(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),er(t,"pageshow",()=>{var t;this.wu=!1,this.ku||null===(t=this.Du)||void 0===t||t.resume()}),i.segment?Q_(this,()=>this.ju()):this.ju(),ke(this.config._onCapture)&&this.config._onCapture!==dw&&(zs.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&zs.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 Kb.apply(this,arguments)}().then(t=>{t&&this.register({[g]:t})}).catch(dw),this}Bu(t){const e=t;return $e(e.name)&&ke(e.setup)}Hu(t,e){this.Bu(t)?e.push(()=>{this.zu().add(t).catch(()=>{var e;return null===(e=t.dispose)||void 0===e?void 0:e.call(t)}).catch(e=>{zs.error(`Failed to dispose browser extension "${t.name}"`,e)})}):this.su.push(t)}Nu(){var t,i,n;const s=null!==(t=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:null===(n=e.__defaultExtensionClasses)||void 0===n?void 0:n.featureFlags;var r,o,l;s&&(this.featureFlags&&this.featureFlags instanceof s||(null===(r=this.Uu)||void 0===r||r.call(this),this.Uu=void 0,this.featureFlags=new s(this)),ke(this.featureFlags.onReloading)&&ke(this.featureFlags.setup)?this.Uu||(this.Uu=this.featureFlags.onReloading(()=>{this.au.emit("featureFlagsReloading",!0)}),this.zu().add(this.featureFlags)):null===(o=(l=this.featureFlags).initialize)||void 0===o||o.call(l))}qu(t){const i=performance.now(),n=le(le({},e.__defaultExtensionClasses),this.config.__extensionClasses),s=[];var r,o,l,a,u,h,c;n.exceptions&&this.su.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new n.exceptions(this)),n.historyAutocapture&&this.su.push(this.historyAutocapture=new n.historyAutocapture(this)),n.tracingHeaders&&this.su.push(this.tracingHeaders=new n.tracingHeaders(this)),n.siteApps&&this.su.push(this.siteApps=new n.siteApps(this)),n.sessionRecording&&!t&&this.su.push(this.sessionRecording=new n.sessionRecording(this)),this.config.disable_scroll_properties||s.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),n.autocapture&&this.Hu(this.autocapture=new n.autocapture(this),s),n.surveys&&this.Hu(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new n.surveys(this),s),n.logs&&this.Hu(this.logs=null!==(l=this.logs)&&void 0!==l?l:new n.logs(this),s),n.metrics&&this.su.push(this.metrics=null!==(a=this.metrics)&&void 0!==a?a:new n.metrics(this)),n.conversations&&this.su.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new n.conversations(this)),n.productTours&&this.su.push(this.productTours=new n.productTours(this)),n.heatmaps&&this.su.push(this.heatmaps=new n.heatmaps(this)),n.webVitalsAutocapture&&this.su.push(this.webVitalsAutocapture=new n.webVitalsAutocapture(this)),n.exceptionObserver&&this.su.push(this.exceptionObserver=new n.exceptionObserver(this)),n.deadClicksAutocapture&&this.su.push(this.deadClicksAutocapture=new n.deadClicksAutocapture(this,V_)),n.toolbar&&this.su.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new n.toolbar(this)),n.experiments&&this.su.push(this.experiments=null!==(c=this.experiments)&&void 0!==c?c:new n.experiments(this)),this.su.forEach(t=>{t.initialize&&s.push(()=>{var e;null===(e=t.initialize)||void 0===e||e.call(t)})}),s.push(()=>{if(this.Wu){const t=this.Wu;this.Wu=void 0,this.su.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}}),this.Vu(s,i)}Vu(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout(()=>{this.Vu(t,e)},0);const i=t.shift();if(i)try{i()}catch(t){zs.error("Error initializing extension:",t)}}const i=Math.round(performance.now()-e);this.register_for_session({[Ot]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[At]:i}),this.config.__preview_deferred_init_extensions&&zs.info(`PostHog extensions initialized (${i}ms)`)}Kl(t){var e;if(!n||!n.body)return zs.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Kl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Wu=t),this.lu=t,this.compression=void 0,t.ok){var i;const e=t.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=fe(e.supportedCompression,ap.GZipJS)?ap.GZipJS:fe(e.supportedCompression,ap.Base64)?ap.Base64:void 0),(null===(i=e.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=e.analytics.endpoint)}this.set_config({person_profiles:this.Mu?this.Mu:Qt}),null===(e=this.Gu)||void 0===e||e.handleRemoteConfig(t),this.su.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}ju(){try{this.config.loaded(this)}catch(t){zs.critical("`loaded` function failed",t)}if(this.Zu(),this.config.internal_or_test_user_hostname&&(null==s?void 0:s.hostname)){const t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.fu())&&this.Qu()},1),this.Ju=new wb(this),this.Ju.load()}Zu(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.Fu)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Vs(this.__request_queue,t=>this.Ou(t)),this.__request_queue=[],this.Zu()}_handle_unload(){var t,e,i,n,s,r;this.wu=!0,null===(t=this.surveys)||void 0===t||null===(e=t.handlePageUnload)||void 0===e||e.call(t),null===(i=this.metrics)||void 0===i||i.flush("sendBeacon"),this.config.request_batching?(this.Ku()&&this.capture(Xt),null===(n=this.logs)||void 0===n||n.flushLogs("sendBeacon"),null===(s=this.Fu)||void 0===s||s.unload(),null===(r=this.Du)||void 0===r||r.unload()):this.Ku()&&this.capture(Xt,null,{transport:"sendBeacon"})}_send_request(t){var e,i,n;this.__loaded?ww?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=ap.Base64),"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=Nb(s.url,s.method,s.compression,s.timestampMode);const o=qb.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;Ab(t)?zs.warn(t):zs.error(t),null===(e=s.callback)||void 0===e||e.call(s,{statusCode:0,error:t})}};"sendBeacon"!==r&&s.data&&s.compression===ap.GZipJS&&a&&"undefined"!=typeof Promise&&!$b?Pb(s).then(t=>{u(t)}).catch(e=>{if(os(e))return $b=!0,void u(le(le({},s),{},{compression:void 0,url:Nb(t.url,t.method,void 0,t.timestampMode)}));ls(e)&&($b=!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}))}Ou(t){this.Du?this.Du.retriableRequest(t):this._send_request(t)}_execute_array(t){cw++;try{let e;const i=[],n=[],s=[];Vs(t,t=>{if(t)if(e=t[0],we(e))s.push(t);else if(ke(t))try{t.call(this)}catch(e){zs.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){Vs(t,function(t){try{if(we(t[0])){let i=e;Gs(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){zs.error("Error executing queued PostHog call",t,e)}})};r(i,this),r(n,this),r(s,this)}finally{cw--}}push(t){if(cw>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])}Xu(){var t;const e=null===(t=this.persistence)||void 0===t?void 0:t.get_property(b);return $e(e)&&yw.test(e)?{value:e,delivered:!1}:Se(e)&&$e(e.value)&&yw.test(e.value)?{value:e.value,delivered:!0===e.delivered}:void 0}Yu(t,e,i,n){if(!this.persistence)return;this.persistence.refreshKey(b);const s=this.Xu();if(!n){if(i)return $e(e)&&yw.test(e)?(e!==(null==s?void 0:s.value)&&this.persistence.register({[b]:{value:e,delivered:!1}}),{value:e,pending:e!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(b);if($e(t)&&mw.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({[b]:{value:e,delivered:!1}}),{value:e,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(b)}th(t){if(!this.persistence)return;this.persistence.refreshKey(b);const e=this.Xu();(null==e?void 0:e.value)!==t||e.delivered||this.persistence.register({[b]:{value:t,delivered:!0}})}capture(t,e,i){var n,s,r,o,l,a;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu))return void zs.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Ce(t)||!$e(t))return void zs.error("No event name provided to posthog.capture");this.yu();const u=!this.config.opt_out_useragent_filter&&this._is_bot();if(u&&!this.config.__preview_capture_bot_pageviews)return;const h=(null==i?void 0:i.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==h?void 0:h.isRateLimited)return void zs.critical("This capture call is ignored due to client rate limiting.");let c;(null==e?void 0:e.$current_url)&&!$e(null==e?void 0:e.$current_url)&&(zs.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.eh)||zs.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&&(c=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const d=new Date,v=(null==i?void 0:i.timestamp)||d,f=nn(null==i?void 0:i.uuid,El);let p={uuid:f,event:t,properties:this.calculateEventProperties(t,e||{},v,f)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&u&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),h&&(p.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);const g="$feature_flag_called"===t&&!1===p.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!g&&(p.$set=null==i?void 0:i.$set);const m=Se(null==e?void 0:e.$set)?e.$set:void 0,y=!!(null==i?void 0:i.$set)&&"$fbc"in i.$set,b=y||!!m&&"$fbc"in m,w=y?null==i||null===(n=i.$set)||void 0===n?void 0:n[_]:null==m?void 0:m[_],k=we(null==e?void 0:e.$unset)?e.$unset:[],S=(null==i?void 0:i.$unset)||[],x=-1!==k.indexOf("$fbc")||-1!==S.indexOf("$fbc"),C=this.Yu(null==c?void 0:c.fbclid,w,b,x);C&&!0===p.properties.$process_person_profile&&C.pending&&!b&&!g&&(p.$set=le({[_]:C.value},p.$set));const T=null==i?void 0:i.$unset;T&&(p.$unset=T);const E=g?void 0:this.ih(null==i?void 0:i.$set_once,t!==ee,t===te);if(E&&(p.$set_once=E),(null==i?void 0:i._noTruncate)||(I=this.config.properties_string_max_length,p=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=[],Vs(n,e=>{r.push(t(e))});else{const e={};Gs(Ne(n)?Ys(n):n,(n,s)=>{i.has(n)||(e[s]=t(n,s))}),r=e}return r}(t)}(p,t=>$e(t)?t.slice(0,I):t)),p.timestamp=v,Ce(null==i?void 0:i.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),g&&(p.properties=((t,e=[])=>{const i={},n=e=>{void 0!==t[e]&&(i[e]=t[e])};return is.forEach(n),e.forEach(n),i})(p.properties,_w)),t===mp.DISMISSED||t===mp.SENT){const i=null==e?void 0:e[yp.SURVEY_ID],n=null==e?void 0:e[yp.SURVEY_ITERATION];Ep({id:i,current_iteration:n}),p.$set=le(le({},p.$set),{},{[na({id:i,current_iteration:n},t===mp.SENT?"responded":"dismissed")]:!0})}else t===mp.SHOWN&&(p.$set=le(le({},p.$set),{},{[yp.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var I;if(t===gb.SHOWN){const t=null==e?void 0:e[mb.TOUR_TYPE];t&&(p.$set=le(le({},p.$set),{},{[`${mb.TOUR_LAST_SEEN_DATE}/${t}`]:(new Date).toISOString()}))}const M=le(le({},p.properties.$set),p.$set);if(xe(M)||this.setPersonPropertiesForFlags(M),!Ie(this.config.before_send)){const t=this.Os(p);if(!t)return;p=t,p.uuid=nn(p.uuid,El)}const R=null!==(s=null===(r=p.$set)||void 0===r?void 0:r.$fbc)&&void 0!==s?s:Se(null===(o=p.properties)||void 0===o?void 0:o.$set)?p.properties.$set[_]:void 0,P=(null==C?void 0:C.pending)&&R===C.value?C.value:void 0;this.au.emit("eventCaptured",p);const O=null!==(l=null==i?void 0:i._url)&&void 0!==l?l:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),A="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(O),F=le(le(le({method:"POST",url:O,data:p,compression:"best-available",timestampMode:A?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},A&&(null===(a=p.properties)||void 0===a?void 0:a.$session_id)?{batchGroup:p.properties.$session_id}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),P?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.th(P)}}:{});var D;return!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)||P?(!F.transport&&!F.callback&&xe(null!==(D=this.config.request_headers)&&void 0!==D?D:{})&&this.wu&&(F.transport="sendBeacon"),this.Ou(F)):this.Fu.enqueue(F),p}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null===(e=this.Gu)||void 0===e?void 0:e.getExtension(t)}zu(){var t;return null!==(t=this.Gu)&&void 0!==t?t:this.Gu=new uw(this)}hu(t){this.$u.push(t);let e=!0;return()=>{if(!e)return;e=!1;const i=this.$u.indexOf(t);-1!==i&&this.$u.splice(i,1)}}nh(t=!0){var e,i,n;return!!(null===(e=this.persistence)||void 0===e?void 0:e.consumeCookieIdentityChange())&&(this.Eu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(n=this.sessionPersistence)||void 0===n||n.clear(),this.xu.clear(),this.sh()),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.nh();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.fu()&&(h[Pt]=!0),"$snapshot"===e){const t=le(le({},this.persistence.properties()),this.sessionPersistence.properties());return h.distinct_id=t.distinct_id,(!$e(h.distinct_id)&&!Me(h.distinct_id)||Te(h.distinct_id))&&zs.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?[...Sa,...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={},_=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,b=null===(l=navigator)||void 0===l?void 0:l.maxTouchPoints,w=null==t||null===(a=t.screen)||void 0===a?void 0:a.width,k=null==t||null===(h=t.screen)||void 0===h?void 0:h.height,S=null==t?void 0:t.devicePixelRatio;Ce(_)||(y.userAgentDataPlatform=_),Ce(b)||(y.maxTouchPoints=b),Ce(w)||(y.screenWidth=w),Ce(k)||(y.screenHeight=k),Ce(S)||(y.devicePixelRatio=S);const x=Zs(Ks({$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:Da(),$timezone_offset:La()}),{$current_url:ar(r?rn(null==s?void 0:s.href):null==s?void 0:s.href,c,Ca),$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:zi(u,navigator.vendor,g,m),$browser_language:Ma(),$browser_language_prefix:Ra(),$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:Hs.LIB_NAME,$lib_version:Hs.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Hs.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=Hs.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&&Zs(h,this.sessionPropsManager.getSessionProps());try{var d;this.sessionRecording&&Zs(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null===(d=this.Du)||void 0===d?void 0:d.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}let v;if(this.requestRouter.region===Yb&&(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=Zs(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)),Gs(["$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{Zs(y,t())}catch(t){zs.error("Failed to produce browser extension event properties",t)}h=Zs({},c,f,p,le(le({},y),h)),h.$is_identified=this._isIdentified(),we(this.config.property_denylist)?Gs(this.config.property_denylist,function(t){delete h[t]}):zs.error(gw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const _=this.config.sanitize_properties;_&&(zs.error(pw),h=_(h,e));const b=this.rh();return h.$process_person_profile=b,b&&!l&&this.oh("_calculate_event_properties"),h}ih(t,e=!0,i=!1){var n;if(!this.persistence||!this.rh())return t;if(this.Su&&!i)return t;const s=this.persistence.get_initial_props(),r=null===(n=this.sessionPropsManager)||void 0===n?void 0:n.getSetOnceProps();let o=Zs({},s,r||{},t||{});const l=this.config.sanitize_properties;return l&&(zs.error(pw),o=l(o,"$set_once")),e&&(this.Su=!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.nh(),null===(i=this.sessionPersistence)||void 0===i||i.register(t),Object.keys(t).forEach(t=>this.xu.add(t)),this.sh()}unregister(t){var e;null===(e=this.persistence)||void 0===e||e.unregister(t)}unregister_for_session(t){var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t),this.xu.delete(t),this.sh()}ah(t,e){this.register({[t]:e})}Lu(){this.xu.forEach(t=>{var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t)}),this.xu.clear(),this.sh()}sh(){var t;if(!this.Cu)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.pi)||!Ql.Et())return void Ql.Lt(this.Cu);const e=[];this.xu.forEach(t=>e.push(t)),e.length>0?Ql.At(this.Cu,e):Ql.Lt(this.Cu)}getFeatureFlag(t,e){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,n;return null!==(i=null===(n=this.featureFlags)||void 0===n?void 0:n.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null===(t=this.featureFlags)||void 0===t||t.reloadFeatureFlags()}updateFlags(t,e,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e=!1,i){var n;return null===(n=this.featureFlags)||void 0===n?void 0:n.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.au.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:fw}),()=>{})}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:fw})}getActiveMatchingSurveys(t,e=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:fw})}renderSurvey(t,e){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(t,e)}displaySurvey(t,e=Mp){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:fw}}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:fw})}uh(t){return!t||Te(t)?(zs.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(zs.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())||(zs.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 zs.uninitializedWarning("posthog.identify");if(Me(t)&&(t=t.toString(),zs.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.uh(t))return;if(!this.oh("posthog.identify"))return;this.yu();const n=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,r=this.nh(!1),o=this.persistence.Pl();let l=!1;try{const n=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:n},""),t!==n&&t!==this.get_property("__alias")&&(this.unregister(m),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===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.Rl(),this.capture(te,s,{$set:e||{},$set_once:i||{}}),this.Eu=pa(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.Rl(),this.capture("$set",{$set:n,$set_once:s}),this.Eu=pa(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);u||s||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(bt)):h&&(e||i)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Ol(l)}}setPersonProperties(t,e){if(!t&&!e)return;if(!this.oh("posthog.setPersonProperties"))return;const i=pa(this.get_distinct_id(),t,e);this.Eu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Eu=i):zs.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.oh("posthog.unsetPersonProperties")&&(null===(e=this.featureFlags)||void 0===e||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Eu=null)}group(t,e,i){var n;if(!t||!e)return void zs.error("posthog.group requires a group type and group key");null===(n=this.persistence)||void 0===n||n.syncCookieProperties(),this.nh();const s=this.getGroups(),r=s[t]!==e;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:le(le({},s),{},{[t]:e})}),(r||i)&&this.rh()){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.oh("posthog.setGroupPropertiesForFlags")&&(null===(i=this.featureFlags)||void 0===i||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null===(e=this.featureFlags)||void 0===e||e.resetGroupPropertiesForFlags(t)}reset(t){const e=Pe(t)?t:null==t?void 0:t.resetDeviceID,i=Pe(t)||null==t?void 0:t.bootstrap;this.hh(e,!1,i)}hh(t,e=!1,i){var n,s,r,o,l,a;if(zs.info("reset"),!this.__loaded)return zs.uninitializedWarning("posthog.reset");const u=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(n=this.Ru)||void 0===n?void 0:n.bootstrap)||{},null===(s=this.featureFlags)||void 0===s||null===(r=s.updateConfig)||void 0===r||r.call(s,this.config,this.Xl());const h=this.get_property(p),c=this.get_property(g),d=this.get_property(O);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();this.consent.reset(),e||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const f=null===(l=this.persistence)||void 0===l||null===(a=l.Pl)||void 0===a?void 0:a.call(l);let m=!1;try{var y,_,b,w,k,S,x,C,T,E,I,M,R;if(null===(y=this.persistence)||void 0===y||y.clear(),null===(_=this.sessionPersistence)||void 0===_||_.clear(),this.xu.clear(),this.sh(),Ce(d)||null===(E=this.persistence)||void 0===E||E.register({$session_recording_remote_config:d}),null===(b=this.surveys)||void 0===b||b.reset(),null===(w=this.featureFlags)||void 0===w||w.reset(),null===(k=this.conversations)||void 0===k||k.reset(),null===(S=this.logs)||void 0===S||S.reset(),null===(x=this.metrics)||void 0===x||x.reset(),null===(C=this.persistence)||void 0===C||C.set_property("$user_state","anonymous"),null===(T=this.sessionManager)||void 0===T||T.resetSessionId(),this.Eu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Rt,$device_id:null},"");else{const e=this.config.get_device_id(El());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.fu()&&(null===(R=this.persistence)||void 0===R||R.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(I=this.featureFlags)||void 0===I||I.initialize(),!Ie(u)&&!(null===(M=this.sessionManager)||void 0===M?void 0:M.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 P,A;f&&(null===(P=this.persistence)||void 0===P||null===(A=P.Ol)||void 0===A||A.call(P,m))}this.reloadFeatureFlags()}shutdown(t){var e=this;return ne(function*(){var t,i,n,s,r,o,l,a;if(e.__loaded){e.ku=!0,e.zu().dispose(),null===(t=e.sessionRecording)||void 0===t||t.dispose(),null===(i=e.logs)||void 0===i||i.flushLogs("sendBeacon"),null===(n=e.metrics)||void 0===n||n.flush("sendBeacon"),null===(s=e.metrics)||void 0===s||s.dispose(),null===(r=e.Fu)||void 0===r||r.unload(),null===(o=e.Du)||void 0===o||o.unload();try{var u;null===(u=e.featureFlags)||void 0===u||u.destroy()}catch(t){zs.error("Error while destroying feature flags",t)}null===(l=e.persistence)||void 0===l||l.destroy(),null===(a=e.sessionPersistence)||void 0===a||a.destroy()}else zs.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.dh()}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.fh()}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")?(zs.critical("Attempting to create alias for existing People user - aborting."),-2):this.oh("posthog.alias")?(Ce(e)&&(e=this.get_distinct_id()),t!==e?(this.ah(m,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(zs.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,p;Zs(this.config,Cw(t));const m=this.bu();null===(i=this.persistence)||void 0===i||i.update_config(this.config,e,m),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new fb(le(le({},this.config),{},{persistence:"sessionStorage"}),m,!1);const y=this.Pu(this.config.debug);var g;Pe(y)&&(this.config.debug=y),Pe(this.config.debug)&&(this.config.debug?(Jl.DEBUG=!0,Fl.Et()&&Fl.At("ph_debug",!0),zs.info("set_config",{config:t,oldConfig:e,newConfig:le({},this.config)})):(Jl.DEBUG=!1,Fl.Et()&&Fl.Lt("ph_debug"))),null===(n=this.featureFlags)||void 0===n||null===(s=n.updateConfig)||void 0===s||s.call(n,this.config,this.Xl()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(l=this.metrics)||void 0===l||l.onConfigChange(),null===(a=this.sessionRecording)||void 0===a||a.startIfEnabledOrStop(),null===(u=this.tracingHeaders)||void 0===u||u.startIfEnabledOrStop(),null===(h=this.autocapture)||void 0===h||h.startIfEnabled(),null===(c=this.heatmaps)||void 0===c||c.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(g=this.historyAutocapture)||void 0===g||g.startIfEnabledOrStop()),null===(d=this.exceptionObserver)||void 0===d||d.startIfEnabledOrStop(),null===(v=this.deadClicksAutocapture)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.surveys)||void 0===f||f.loadIfEnabled(),this._u(),null===(p=this.externalIntegrations)||void 0===p||p.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&Q_(this,dw,!1)}}_overrideSDKInfo(t,e){Jl.LIB_NAME=t,Jl.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.ph}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:bw;return e!==bw&&(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"))}rh(){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))}Ku(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.rh()||this.oh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.oh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}oh(t){return"never"===this.config.person_profiles?(zs.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ah(Mt,!0),!0)}bu(){if("always"===this.config.cookieless_mode)return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_u(){var t,e;const i=this.bu();var n,s,r;return this.is_capturing()||null===(n=this.logs)||void 0===n||n.gh(),(null===(t=this.persistence)||void 0===t?void 0:t.pi)!==i&&(null===(s=this.persistence)||void 0===s||s.set_disabled(i)),(null===(e=this.sessionPersistence)||void 0===e?void 0:e.pi)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),i&&(this.xu.clear(),this.sh()),i}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){if(this.fu()){var n,s,r,o,l,a;null===(n=this.sessionRecording)||void 0===n||n.dispose({discardBufferedEvents:!0}),this.hh(!0,!0),null===(s=this.sessionManager)||void 0===s||s.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new Qb(this),this.pageViewManager=new X_(this),this.persistence&&(this.sessionPropsManager=new Wb(this,this.sessionManager,this.persistence));const t=null!==(o=null===(l=this.config.__extensionClasses)||void 0===l?void 0:l.sessionRecording)&&void 0!==o?o:null===(a=e.__defaultExtensionClasses)||void 0===a?void 0:a.sessionRecording;var u,h;t&&(this.sessionRecording=this.vu(this.sessionRecording,new t(this)),this.lu&&(null===(u=this.sessionRecording)||void 0===u||null===(h=u.onRemoteConfig)||void 0===h||h.call(u,this.lu)))}var c,d;this.consent.optInOut(!0),this._u(),this.Zu(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(c=this.surveys)||void 0===c||c.loadIfEnabled()),(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.Qu()}else zs.warn(vw)}opt_out_capturing(){if("always"===this.config.cookieless_mode)return void zs.warn(vw);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.hh(!0,!0),this.consent.optInOut(!1),this._u(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Rt,$device_id:null}),this.du(t),this.sessionRecording=void 0,null===(e=this.sessionManager)||void 0===e||e.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Qu(),this.Zu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._u()}_is_bot(){return i?Jb(i,this.config.custom_blocked_useragents):void 0}Qu(){n&&("visible"===n.visibilityState?this.Tu||(this.Tu=!0,this.capture(Yt,{title:n.title},{send_instantly:!0}),this.Iu&&(n.removeEventListener(Jt,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),er(n,Jt,this.Iu)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Xl(){const t=this.Ru||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(zs.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&&!Ie(t[e]),o=i in t&&!Ie(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,zs)}Os(t){var e;if(Ie(this.config.before_send))return t;const i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(Fe),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),Ie(s)){const e=`Event '${t.event}' was rejected in beforeSend function`;return Ae(t.event)?zs.warn(`${e}. This can cause unexpected behavior.`):zs.info(e),null}s.properties&&!xe(s.properties)||zs.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(e){return zs.error(`Error in beforeSend function for event '${t.event}':`,e),null}for(const e of i)if(s.properties&&Ie(s.properties[e]))return zs.warn(`Event '${t.event}' had its '${e}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return s}getPageViewId(){var t;return null===(t=this.pageViewManager.Bo)||void 0===t?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Pu(t){const e=Pe(t)&&!t,i=Fl.Et()&&"true"===Fl.Ot("ph_debug");return!e&&(!!i||t)}};Tw.__defaultExtensionClasses={},Tw.ph=(()=>{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]]=Js(t.prototype[e[i]])}(Tw,["identify"]);var Ew=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.Xl(),t.url_allowlist=null==i?void 0:i.url_allowlist,t.url_ignorelist=null==i?void 0:i.url_ignorelist,t.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,t.element_allowlist=null==i?void 0:i.element_allowlist,t.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,t.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,t.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,t.capture_copied_text=null==i?void 0:i.capture_copied_text}};const Iw=Ws("[ExceptionAutocapture]"),Mw=Ws("[TracingHeaders]"),Rw=Ws("[Web Vitals]"),Pw=9e5,Ow=["CLS","FCP","INP","LCP"],Aw=["INP","LCP"],Fw=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Dw=Ws("[SessionRecording]"),Lw=Ws("[Heatmaps]");function Nw(t){return Se(t)&&"clientX"in t&&"clientY"in t&&Me(t.clientX)&&Me(t.clientY)}const qw=Ws("[Product Tours]"),Bw=t=>{var e;return!t.config.disable_product_tours&&!!(null===(e=t.persistence)||void 0===e?void 0:e.get_property(M))},jw=["$set_once","$set"],Hw=Ws("[SiteApps]"),Uw="Error while initializing PostHog app with config id ",zw=(t,e)=>(null==t?void 0:t.then)?t.then(e):e(t),Ww="SDK is not enabled or survey functionality is not yet loaded",Vw="Disabled. Not loading surveys.";var Gw=class{constructor(t,e){this.yo=t,this.mh=e,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.yh=!1,this.bh=[],this._h=null,this.wh=null,this.So=!1,this.kh=new Set,this.onRemoteConfig=t=>{if(this.So)return;if(this.Mr.disableSurveys)return;if(!t.ok)return wp.warn("Remote config unavailable. Not loading surveys.");const e=t.config.surveys;if(Ie(e))return wp.warn("Flags not loaded yet. Not loading surveys.");this.Sh=Pe(e)?e:e.length>0,wp.info(`flags response received, isSurveysEnabled: ${this.Sh}`),this.loadIfEnabled()}}setup(t){if(!this.So)return this.xh=t,zw(t.kv.initialize(),()=>{if(this.xh!==t||this.So)return;this.xh=void 0,this.po=t;const e=t.onRemoteConfig(this.onRemoteConfig);this.So?e.dispose():(this.$o=e,this.loadIfEnabled())})}dispose(){var t,e,i,n;this.So||(this.So=!0,this.xh=void 0,this.po=void 0,null===(t=this.$o)||void 0===t||t.dispose(),this.$o=void 0,null===(e=this._surveyEventReceiver)||void 0===e||e.dispose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(n=i.dispose)||void 0===n||n.call(i),this._surveyManager=null,this.bh=[],this._h=null,this.kh.forEach(t=>clearTimeout(t)),this.kh.clear())}get Mr(){return this.yo.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null===(t=this._surveyEventReceiver)||void 0===t||t.reset(),localStorage.removeItem("lastSeenSurveyDate");const e=[];for(let t=0;t<localStorage.length;t++){const i=localStorage.key(t);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&e.push(i)}e.forEach(t=>localStorage.removeItem(t))}catch(t){}}loadIfEnabled(){if(this.So||!this.po)return;const t=this.Mr;if(this._surveyManager)return;if(this.yh)return void wp.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void wp.info(Vw);if(t.cookielessMode&&this.yo.isOptedOut())return void wp.info("Not loading surveys in cookieless mode without consent.");const e=this.yo.getExtensions();if(!e)return void wp.error("PostHog Extensions not found.");if(Ce(this.Sh)&&!t.advancedEnableSurveys)return;const i=this.Sh||t.advancedEnableSurveys;this.yh=!0;try{const t=e.generateSurveys;if(t)return this.Ch(t,i),void(this.yh=!1);const n=e.loadExternalDependency;if(!n)return this.$h(Vt),void(this.yh=!1);n(t=>{try{if(this.So)return;const e=this.yo.getExtensions();t||!(null==e?void 0:e.generateSurveys)?this.$h("Could not load surveys script",t):this.Ch(e.generateSurveys,i)}finally{this.yh=!1}})}catch(t){throw this.yh=!1,this.$h("Error initializing surveys",t),t}}Ch(t,e){this.So||(this._surveyManager=t(e),this._surveyEventReceiver=this.yo.createEventReceiver(),wp.info("Surveys loaded successfully"),this.Th({isLoaded:!0}))}$h(t,e){wp.error(t,e),this.Th({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.bh.push(t),this._surveyManager&&this.Th({isLoaded:!0}),()=>{this.bh=this.bh.filter(e=>e!==t)}}getSurveys(t,e=!1){var i;const n=null!==(i=this.po)&&void 0!==i?i:this.mh;if(!n||this.So)return;if(this.Mr.disableSurveys)return wp.info(Vw),t([]);const s=n.kv.get(at);if(s&&!e)return t(s,{isLoaded:!0}),void(this.Ih()&&this.getSurveys(()=>{},!0));if(this._h)return void this._h.then(({surveys:e,context:i})=>{this.So||t(e,i)}).catch(t=>wp.error("Error in survey callback",t));const r=this.Mh("/api/surveys/",{method:"GET",query:{token:n.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(t=>{try{return this.Eh(n,t)}catch(t){return wp.error("Error processing surveys response",t),this.Eh(n,{statusCode:0,error:t})}},t=>this.Eh(n,{statusCode:0,error:t}));this._h=r;const o=()=>{this._h===r&&(this._h=null)};r.then(e=>{o(),this.So||t(e.surveys,e.context)},o).catch(t=>wp.error("Error in survey callback",t))}Mh(t,e){const i=this.po;return i?i.sendRequest(t,e):new Promise(t=>t({statusCode:0,error:new Error(Ww)}))}Eh(t,e){if(this.So)return{surveys:[],context:{isLoaded:!1,error:Ww}};const i=e.statusCode;if(200!==i||!e.json){const t=`Surveys API could not be loaded, status: ${i}`;return 0!==i?wp.error(t):e.error||wp.warn(t),this.wh=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.wh=null;const n=e.json.surveys||[],s=n.filter(t=>xp(t)&&(ua(t)||Cp(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}}}Ih(){return this.Ph()&&!this._h&&!this.Rh()}Ph(){var t,e;const i=null===(t=null!==(e=this.po)&&void 0!==e?e:this.mh)||void 0===t?void 0:t.kv.get(ut);return Me(i)&&Date.now()-i>3e5}Rh(){return Me(this.wh)&&3e5>Date.now()-this.wh}markSurveyAsSeen(t,e){var i;const n={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};Ep(n);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Th(t){for(const e of this.bh)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){wp.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e=!1){if(!Ie(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);wp.warn("init was not called")}Ah(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}Fh(t){if(Ie(this._surveyManager))return{eligible:!1,reason:Ww};const e="string"==typeof t?this.Ah(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Oh(t){if(!this.yo.isCapturing())return{eligible:!1,reason:kp};if(Ie(this._surveyManager))return{eligible:!1,reason:Ww};const e="string"==typeof t?this.Ah(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Ie(this._surveyManager))return wp.warn("init was not called"),{visible:!1,disabledReason:Ww};const e=this.Oh(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Ie(this._surveyManager)?(wp.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ww})):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.Oh(s);i({visible:t.eligible,disabledReason:t.reason})}else i({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,i){var s;if(!this.yo.isCapturing())return;if(Ie(this._surveyManager))return void wp.warn("init was not called");const r="string"==typeof t?this.Ah(t):t;if(!(null==r?void 0:r.id))return void wp.warn("Survey not found");if(!Ip.includes(r.type))return void wp.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){wp.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var e,n;this.kh.delete(t),!this.So&&this.yo.isCapturing()&&(wp.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),wp.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.kh.add(t)}this._surveyManager.renderSurvey(r,o,i)}else wp.warn("Survey element not found")}displaySurvey(t,e){var i;if(!this.yo.isCapturing())return;if(Ie(this._surveyManager))return void wp.warn("init was not called");const n=this.Ah(t);if(!n)return void wp.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!==_p.Popover&&e.initialResponses&&wp.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){const t=this.Fh(n);if(!t.eligible)return void wp.warn("Survey is not eligible to be displayed: ",t.reason)}e.displayType!==_p.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}cancelPendingSurvey(t){Ie(this._surveyManager)?wp.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 Zw(t,e,i){if(Ie(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 Qw=class{constructor(t){this._instance=t,this.Dh=new Set,this.Lh=new Set,this.Nh=new Vb,this.qh=(t,e)=>this.jh(t,e)&&this.Bh(t,e)&&this.Hh(t,e)&&this.zh(t,e),this.jh=(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.Uh=null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook((t,e)=>{this.on(t,e)}))}dispose(){var t;null===(t=this.Uh)||void 0===t||t.call(this),this.Uh=void 0,this.Nh=new Vb}register(t){var e,i;if(!Ce(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)&&(t.forEach(t=>{var e;this.Dh.add(t),null===(e=t.steps)||void 0===e||e.forEach(t=>{this.Lh.add((null==t?void 0:t.event)||"")})}),null===(i=this._instance)||void 0===i?void 0:i.autocapture)){const t=new Set;this.Dh.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.Dh.clear(),this.Lh.clear(),this.register(t)}on(t,e){null!=e&&0!=t.length&&(this.Lh.has(t)||this.Lh.has(e.event))&&this.Dh.forEach(t=>{this.Wh(e,t)&&this.Nh.emit("actionCaptured",t.name)})}Vh(t){this.onAction("actionCaptured",e=>t(e))}Wh(t,e){if(null==(null==e?void 0:e.steps))return!1;for(const i of e.steps)if(this.qh(t,i))return!0;return!1}onAction(t,e){return this.Nh.on(t,e)}Bh(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(!Zw(n,e.url,e.url_matching||"contains"))return!1}return!0}Hh(t,e){return!!this.Gh(t,e)&&!!this.Zh(t,e)&&!!this.Qh(t,e)}Gh(t,e){var i;if(!(null==e?void 0:e.href))return!0;const n=this.Jh(t);if(n.length>0)return n.some(t=>Zw(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&&Zw(function(t){const e=t.match(/(?::|")href="(.*?)"/);return e?e[1]:""}(s),e.href,e.href_matching||"exact")}Zh(t,e){var i;if(!(null==e?void 0:e.text))return!0;const n=this.Jh(t);if(n.length>0)return n.some(t=>Zw(t.text,e.text,e.text_matching||"exact")||Zw(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(;!Ie(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=>Zw(t,o,l)));var r,o,l}Qh(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}Jh(t){var e;return null==(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}zh(t,e){return!(null==e?void 0:e.properties)||0===e.properties.length||fa(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)}},Jw=class{constructor(t){var e,i;this.Kh=[],this._instance=t,this.Xh=new Map,this.Yh=new Map,this.tc=new Map,this.ec=null===(e=this._instance)||void 0===e||null===(i=e.onSessionId)||void 0===i?void 0:i.call(e,t=>this.nc(t))}sc(t){return!1}rc(){return null}oc(t){}lc(){}ac(t,e){return!!t&&fa(t.propertyFilters,null==e?void 0:e.properties)}uc(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}hc(t,e,i){const n=(i===up.Activation?this.Xh:this.Yh).get(t);let s=[];return this.cc(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.ac(r,e)})}register(t){this.dc(t,!1)}replace(t){this.dc(t,!0)}dc(t,e){var i;Ce(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)||(this.vc(t,e),this.fc(t,e))}fc(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.tc.clear(),0===i.length)return void(e&&(null===(n=this.gc)||void 0===n||n.replace([])));this.gc||(this.gc=new Qw(this._instance),this.gc.init(),this.gc.Vh(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.tc.get(e.name))&&void 0!==i?i:[];n.includes(t.id)||n.push(t.id),this.tc.set(e.name,n)}})}),e?this.gc.replace(s):this.gc.register(s)}mc(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)})}vc(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.uc(t,up.Activation),l=this.uc(t,up.Cancellation);e?(this.Xh=o,this.Yh=l):(this.mc(this.Xh,o),this.mc(this.Yh,l)),(0!==s.length||0!==r.length)&&(null!==(i=this.Uh)&&void 0!==i||(this.Uh=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.yc(),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.bc(t,r);if("consume"===e)return s.info("event consumed activated item, removing it",{event:t,itemId:r}),void this._c([r]);if("persist"===e)return s.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.wc(r),void this.kc([r])}if(this.Yh.has(t)){const i=this.hc(t,e,up.Cancellation);i.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:i.map(t=>t.id)}),this._c(i.map(t=>t.id)),i.forEach(t=>this.Sc(t.id)))}if(!this.Xh.has(t))return;s.info("event name matched",{event:t,eventPayload:e,items:this.Xh.get(t)});const o=this.hc(t,e,up.Activation);this.xc(o.map(t=>t.id))}onAction(t){this.tc.has(t)&&this.xc(this.tc.get(t)||[])}xc(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.sc(e)?this.wc(e)&&this.Cc(e):s.push(e);s.length>0&&(this.Kh=[...new Set([...this.Kh,...s])]),this.yc().info("updating activated items",{activatedItems:this.getActivatedIds()})}wc(t){this.Kh=this.Kh.filter(e=>e!==t);const e=this.$c();return!e.includes(t)&&(this.Tc([...e,t]),this.Ic(),!0)}_c(t){const e=new Set(t);this.Kh=this.Kh.filter(t=>!e.has(t));const i=this.Mc(),n=i.filter(t=>!e.has(t));n.length!==i.length&&(this.Tc(n),0===n.length&&this.Ec()),this.kc(t)}Pc(){var t;const e=this.rc();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:{}}Cc(t){if(!this.rc())return;const e=this.Pc();this.oc(le(le({},e),{},{[t]:Date.now()}))}kc(t){if(!this.rc())return;const e=this.Pc(),i={};let n=!1;for(const[s,r]of Object.entries(e))t.includes(s)?n=!0:i[s]=r;n&&(xe(i)?this.lc():this.oc(i))}Rc(){this.rc()&&this.lc()}getActivationTimestamp(t){if(!this.$c().includes(t))return;const e=this.Pc()[t];return Me(e)?e:void 0}Mc(){var t;const e=this.Ac();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.Mc();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.Fc()],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:[]}Ic(){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.Oc(i)}Ec(){this.Dc()}nc(t){var e;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[this.Fc()];if(i&&i!==t){const t=this.Mc(),e=this.Pc();t.length>0&&(this.Tc([]),t.filter(t=>Me(e[t])).forEach(t=>this.Sc(t))),this.Ec(),this.Rc()}}getActivatedIds(){return[...new Set([...this.$c(),...this.Kh])].filter(t=>!this.Lc(t))}dispose(){var t,e,i;null===(t=this.ec)||void 0===t||t.call(this),this.ec=void 0,null===(e=this.Uh)||void 0===e||e.call(this),this.Uh=void 0,null===(i=this.gc)||void 0===i||i.dispose(),this.gc=void 0}reset(){this.Kh=[],this.Mc().length>0&&this.Tc([]),this.Ec(),this.Rc()}getEventToItemsMap(){return this.Xh}Nc(){return this.gc}},Kw=class extends Jw{constructor(t){super(t)}Ac(){return ht}Fc(){return ct}rc(){return dt}oc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_timestamps:t})}lc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_timestamps")}sc(t){var e;let i;this.cc(e=>{i=e.find(e=>e.id===t)});const n=null==i||null===(e=i.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds;return Me(n)&&n>0}qc(){return mp.SHOWN}cc(t){var e;null===(e=this._instance)||void 0===e||e.getSurveys(t)}Sc(t){var e;null===(e=this._instance)||void 0===e||e.cancelPendingSurvey(t)}yc(){return wp}Tc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated:t})}Oc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_session:t})}Dc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_session")}Lc(){return!1}bc(t,e){let i;return this.cc(t=>{i=t.find(t=>t.id===e)}),!i||ha(i)?t===mp.SHOWN?"consume":"ignore":t===mp.SHOWN?"persist":t===mp.DISMISSED||t===mp.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Yw=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)}},Xw=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 Kw(this._instance)}};const tk=(null==t?void 0:t.location)?ur(t.location.hash,"__posthog")||ur(location.hash,"state"):null,ek="_postHogToolbarParams",ik=Ws("[Toolbar]"),nk=Ws("[FeatureFlags]");var sk=class{constructor(t,e=!1){this.jc=!1,this.update(t,e)}update(t,e){this.Bc=((t,e)=>{var i,n,s,r,o,l,a;return{bootstrap:{featureFlags:null!==(i=null===(n=t.bootstrap)||void 0===n?void 0:n.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(s=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:void 0},remoteRequestsDisabled:e,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=t.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:Ce(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(l=null!==(a=t.evaluation_contexts)&&void 0!==a?a:t.evaluation_environments)&&void 0!==l?l:[],flagKeys:we(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.jc||(nk.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.jc=!0),Ce(t.flag_keys)||we(t.flag_keys)||nk.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Bc}};const rk=Ws("[FeatureFlags]"),ok=Ws("[FeatureFlags]",{debugEnabled:!0}),lk="\" failed. Feature flags didn't load in time.",ak=["click","keydown","wheel","touchstart","pointerdown"],uk="connection_error",hk=t=>{const e={};for(let i=0;t.length>i;i++)e[t[i]]=!0;return e},ck=t=>{const e={};for(const[i,n]of Qs(t||{}))n&&(e[i]=n);return e},dk="Refusing to render web experiment since the viewer is a likely bot",vk={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>ca(e,t),not_regex:(t,e)=>!ca(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},fk=Ws("[Conversations]"),pk="Conversations not available yet.";function gk(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(Cs,t)?Cs[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 mk=["debug","log","warn","error","info"],yk="console",_k="__posthogHandledLogsRequestError",bk=(t,e)=>{const i=t instanceof Error?t:new Error(e);return i[_k]=!0,i},wk=t=>!!t&&"object"==typeof t&&!0===t[_k],kk=Ws("[NetworkMetrics]"),Sk=()=>{var e;return(null==t||null===(e=t.performance)||void 0===e?void 0:e.now)?t.performance.now():Date.now()},xk=t=>t?`${Math.floor(t/100)}xx`:"missing",Ck=(t,e)=>{var i;const n=String(e);return{method:String(t).toUpperCase(),url:(null===(i=rr(n))||void 0===i?void 0:i.href)||n}},$k=(t,e,i,n,s)=>{try{var r,o,l;const u=s();if(!u)return;const h=i||void 0,c=Sk()-n,d=rr(e.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;const v={url:(null==d?void 0:d.href)||e.url,method:e.method},f=ke(u.name)?u.name(v):$e(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=le({method:v.method,host:null!==(r=null==d?void 0:d.hostname)&&void 0!==r?r:"",path:d?(a=d.pathname,a.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/")):"",status_class:xk(h)},null===(o=u.attributes)||void 0===o?void 0:o.call(u,v,{status:h,durationMs:c}));null===(l=t.metrics)||void 0===l||l.histogram(f,c,{unit:"ms",attributes:p})}catch(t){kk.error("Failed to record network metric",t)}var a},Tk=()=>{},Ek=(e,i)=>ke(null==t?void 0:t.fetch)?_v(t,"fetch",t=>function(...n){const s=Sk(),r=t.apply(this,n);if(!i())return r;try{var o,l,a;const[t,u]=n,h=Ck(null!==(o=null!==(l=null==u?void 0:u.method)&&void 0!==l?l:null==t?void 0:t.method)&&void 0!==o?o:"GET",null!==(a=null==t?void 0:t.url)&&void 0!==a?a:t);return r.then(t=>($k(e,h,null==t?void 0:t.status,s,i),t),t=>{throw $k(e,h,void 0,s,i),t})}catch(t){return kk.error("Failed to observe fetch",t),r}}):Tk,Ik=(e,i)=>{var n;const s=null==t||null===(n=t.XMLHttpRequest)||void 0===n?void 0:n.prototype;if(!s)return Tk;const r=new WeakMap,o=_v(s,"open",t=>function(...e){try{(()=>xb.has(this))()||r.set(this,Ck(e[0],e[1]))}catch(t){kk.error("Failed to observe XHR open",t)}return t.apply(this,e)}),l=_v(s,"send",t=>function(...n){let s;try{const t=r.get(this);if(t&&i()){const n=Sk();s=()=>{this.removeEventListener("loadend",s),$k(e,t,this.status,n,i)},er(this,"loadend",s)}}catch(t){kk.error("Failed to observe XHR send",t)}try{return t.apply(this,n)}catch(t){throw s&&this.removeEventListener("loadend",s),t}});return()=>{o(),l()}},Mk={featureFlags:class{constructor(t){this.name="featureFlags",this.Hc=!1,this.featureFlagEventHandlers=[],this.$=rk,this.zc={},this.Uc={},this.Wc=[],this.Vc=!1,this.Gc=!1,this.Zc=0,this.Qc=!1,this.Jc=!1,this.Kc=!1,this.Xc=!1,this.Yc=0,this.td=!1,this.sn=()=>{const t=this.ed();this.Yc=0,t&&this.reloadFeatureFlags()},this.nd=()=>{var t,e;const i=this.sd,s=null!==(t=this.rd)&&void 0!==t?t:i;Ce(i)||Ce(s)||this.Mr.remoteRequestsDisabled||!n||"hidden"===n.visibilityState||Date.now()-(null!==(e=this.od)&&void 0!==e?e:0)<s||(this.rd=this.td||!this.Mr.idleRefreshBackoff?i:Math.min(2*s,36e5),this.td=!1,this.reloadFeatureFlags(),this.ld())},this.ad=()=>{this.td&&this.rd===this.sd||this.ud()},this.an=()=>{"visible"===(null==n?void 0:n.visibilityState)&&this.ud()},"get"in t?this.yo=t:(this._instance=t,this.hd=new sk(t.config,t.Xl()),this.yo=this.hd)}updateConfig(t,e){var i;null===(i=this.hd)||void 0===i||i.update(t,e),this.po&&this.dd()}setup(t){return this.xh=t,this.$=t.logger.createLogger("[FeatureFlags]"),zw(t.kv.initialize(),()=>{this.xh===t&&(this.xh=void 0,this.po=t,this.vd(t))})}vd(e){var i;if(this.po===e)return t&&er(t,"online",this.sn),this.dd(),this.fd=e.registerDynamicEventProperties(()=>this.pd()?this.zc:this.Uc),this.gd=null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.md(),this.yd(),this.bd()}),this.yd(),this.initialize()}ud(){this.td=!0,this.rd=this.sd,this.nd()}dd(){const t=this.Mr.refreshIntervalMs,e=!this.Mr.remoteRequestsDisabled&&n&&!Ce(t)&&t>0?t:void 0;this.Mr.idleRefreshBackoff||(this.rd=e),e!==this.sd&&(this._d(),Ce(e)||(this.sd=e,this.rd=e,this.ld(),(null==n?void 0:n.addEventListener)&&(er(n,Jt,this.an),Vs(ak,t=>{er(n,t,this.ad,{capture:!0})}))))}ld(){Ce(this.sd)||(Ce(this.wd)||clearInterval(this.wd),this.od=Date.now(),this.wd=setInterval(this.nd,this.sd))}_d(){var t;Ce(this.wd)||(clearInterval(this.wd),this.wd=void 0,null==n||null===(t=n.removeEventListener)||void 0===t||t.call(n,"visibilitychange",this.an),Vs(ak,t=>{var e;null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,t,this.ad,{capture:!0})})),this.sd=void 0,this.rd=void 0,this.td=!1,this.od=void 0}destroy(){this.kd()}dispose(){this.kd()}kd(){var e,i;this._d(),this.Zc++,this.Jc=!1,this.xh=void 0,this.po&&(this.Sd(),null===(e=this.fd)||void 0===e||e.dispose(),this.fd=void 0,null===(i=this.gd)||void 0===i||i.call(this),this.gd=void 0,this.Wc=[],null==t||t.removeEventListener("online",this.sn),this.po=void 0)}get Mr(){return this.yo.get()}xd(t){var e;return this.Cd&&t in this.Cd?this.Cd[t]:null===(e=this.po)||void 0===e?void 0:e.kv.get(t)}md(){return!!this.Cd&&(this.Cd=void 0,!0)}$d(){var t;return!Ce(null===(t=this.po)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.md()}At(t){this.Td(()=>{var e;return null===(e=this.po)||void 0===e?void 0:e.kv.set(t)})}Id(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.xd("$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.xd("$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.Td(()=>{var e;return null===(e=this.po)||void 0===e?void 0:e.kv.remove(t)})}Td(t){try{t()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}yd(){const t={};for(const e of[K,tt,et,nt]){const i=this.xd(e);Ce(i)||(t[e]=i)}this.zc=t;const e=le({},t),i=this.xd(J);if(i)for(const[t,n]of Object.entries(i))e[`$feature/${t}`]=n;this.Uc=e}pd(){const t=this.Mr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.xd(St);return"number"!=typeof e||Date.now()-e>t}Md(){return!!this.pd()&&(this.Xc||this.Gc||(this.Xc=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ed(){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}):[]}Pd(){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.Rd({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.xd("$enabled_feature_flags"))&&void 0!==n?n:{},o=(null==i?void 0:i.merge)&&null!==(s=this.xd("$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:ts(e),variant:es(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.Rd({flags:u})}get hasLoadedFlags(){return this.Vc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.xd(X),e=this.xd(nt),i=this.xd(st);if(!i&&!e)return t||{};const n=Zs({},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.Hc||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:n}),this.Hc=!0),n}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(i=>{const n=t[i];return{key:i,enabled:ts(n),variant:es(n),payload:Xn(e[i])}})}getFlagVariants(){const t=this.xd(J),e=this.xd(nt);if(!e)return t||{};const i=Zs({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.Hc||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Hc=!0),i}getFlagPayloads(){const t=this.xd(tt),e=this.xd(st);if(!e)return t||{};const i=Zs({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.Hc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Hc=!0),i}reloadFeatureFlags(){this.Qc||this.Mr.featureFlagsDisabled||this.ed()||(this.Gc&&(this.Jc=!0),this.Ad||(this.Wc.slice().forEach(t=>{try{t()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.Ad=setTimeout(()=>{this.Fd()},5)))}Sd(){clearTimeout(this.Ad),this.Ad=void 0}onReloading(t){return this.Wc.push(t),()=>{this.Wc=this.Wc.filter(e=>e!==t)}}ensureFlagsLoaded(){this.Vc||this.Gc||this.Ad||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Qc=t}resetFlagCallReported(){this.Lt(bt)}Fd(t){this.Sd();const e=this.po;if(!e||this.Mr.remoteRequestsDisabled||this.ed())return;if(this.Gc)return void(this.Jc=!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.xd("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.xd(ot),timezone:Da()};Ce(e.deviceId)||(i.$device_id=e.deviceId),((null==t?void 0:t.disableFlags)||this.Mr.featureFlagsDisabled)&&(i.disable_flags=!0);const n=this.Ed();n.length&&(i.evaluation_contexts=n);const s=this.Pd();Ce(s)||(i.flag_keys=s);const r=this.Mr.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),l=this.Zc;this.Gc=!0;const a=()=>{this.Jc&&(this.Jc=!1,this.Fd())},u=t=>{var e,n;const s=null!==(e=t.json)&&void 0!==e?e:{},o=200!==t.statusCode;if(this.Gc=!1,l!==this.Zc)return void a();if(this.Od(t.statusCode),o||this.Jc||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.Jc)return;this.Kc=!o;const u=[];t.error?u.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?uk:"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.Rd(s,o,{partialResponse:r}),a()},h=t=>{this.Gc=!1,l===this.Zc?(this.At({[kt]:[uk]}),this.$.error("Feature flag request failed",t),this.$d()&&this.bd(!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)}}ed(){return hr(this.Yc,3)}Od(t){this.Yc=cr(t,this.Yc,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.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+t+lk);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.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+t+lk);if(this.Md())return;const i=this.getFlagVariants(),n=t in i,s=i[t],r=this.getFlagPayloads()[t],o=String(s),l=this.xd("$feature_flag_request_id")||void 0,a=this.xd("$feature_flag_evaluated_at")||void 0;let u,h=this.xd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var c;const t=null===(c=this.po)||void 0===c?void 0:c.session.sessionId,e=this.xd(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({[bt]: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({[bt]:h},u?{[wt]:u}:{}));const e=this.getFeatureFlagDetails(t),i=[...null!==(d=this.xd("$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.Kc};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!==(_=null==e||null===(b=e.reason)||void 0===b?void 0:b.description)&&void 0!==_?_:null==e||null===(w=e.reason)||void 0===w?void 0:w.code;var x;c&&(n.$feature_flag_reason=c),(null==e||null===(k=e.metadata)||void 0===k?void 0:k.id)&&(n.$feature_flag_id=e.metadata.id),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.Dd(n)}else u&&this.At({[bt]:h,[wt]:u});return n?{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:Xn(r)}:void 0}Dd(t){try{var e;null===(e=this.po)||void 0===e||e.capture("$feature_flag_called",t).catch(t=>{this.$.error("Failed to capture feature flag call",t)})}catch(t){this.$.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,e){this.Ld(t,e)}Ld(t,e){var i=this;return ne(function*(){const n=i.po;if(!n)return;const s={distinct_id:n.distinctId,token:n.projectToken,person_properties:{$lib:n.library.name,$lib_version:n.library.version}},r=i.Ed();r.length&&(s.evaluation_contexts=r);const o=i.Pd();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.Kc)return e.defaultValue;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+lk),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.Rd(t,e,i)}Rd(t,e,i){if(!this.po)return;this.Vc=!0;const n=((t,e={},i={},n={},s,r=rk)=>{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(ck(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.po.kv.get(J));this.Cd=n,t||this.At(n)}else this.md(),this.Id(n,t,!!(null==i?void 0:i.partialResponse)),this.At(n);else e&&this.$d();e||(this.Xc=!1),this.bd(e)}override(t,e=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.Nd(t)}Nd(t){if(this.po){if(!1===t)return this.Lt([nt,st]),this.bd(),void ok.info("All overrides cleared");if(we(t))return this.At({[nt]:hk(t)}),this.bd(),void ok.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e;const i=t;this.Hc=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);const n={},s=i.flags,r=i.payloads;return s&&(n[nt]=we(s)?hk(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.bd(),!1===s?ok.info("Flag overrides cleared"):s&&ok.info("Flag overrides set",{flags:s}),void(!1===r?ok.info("Payload overrides cleared"):r&&ok.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.At({[nt]:t}),this.bd(),void ok.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.Vc){const{flags:e,flagVariants:i}=this.qd();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.xd("$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(ck(l)),[J]:l,[rt]:le(le({},this.xd("$stored_person_properties")||{}),r)}),this.bd();try{var a;null===(a=this.po)||void 0===a||a.capture("$feature_enrollment_update",o).catch(t=>{this.$.error("Failed to capture early access feature enrollment",t)})}catch(t){this.$.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,e=!1,i){const n=this.xd(Y);!n||e?this.jd(t,i):t(n)}jd(t,e){var i=this;return ne(function*(){const n=i.po;if(!n)return;const s=e?`&${e.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${s}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,i.At({[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)}})()}qd(){const t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(t=>e[t]),flagVariants:Object.keys(e).filter(t=>e[t]).reduce((t,i)=>(t[i]=e[i],t),{})}}bd(t){this.yd();const{flags:e,flagVariants:i}=this.qd();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.Bd(t,e)}Bd(t,e=!0){const i=this.xd("$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.xd("$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.xd("$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.xd("$stored_group_properties")||{};this.At({[ot]:le(le({},e),{},{[t]:{}})})}else this.Lt(ot)}reset(){this.Zc++,this.Jc=!1,this.zc={},this.Uc={},this.Cd=void 0,this.Vc=!1,this.Qc=!1,this.Kc=!1,this.$anon_distinct_id=void 0,this.Sd(),this.Hc=!1,this.Yc=0}}},Rk={sessionRecording:class{get Mr(){return this._instance.config}get xa(){return this._instance.persistence}get started(){var t;return!!(null===(t=this.Hd)||void 0===t?void 0:t.isStarted)}get status(){var t,e;return"awaiting_config"===this.zd||"missing_config"===this.zd?this.zd:null!==(t=null===(e=this.Hd)||void 0===e?void 0:e.status)&&void 0!==t?t:this.zd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.zd=co,this.Ud=void 0,this.Wd=!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.Hd)||void 0===t||null===(e=t.setDocumentWasEverVisible)||void 0===e||e.call(t,!0))},!this._instance.sessionManager)throw Dw.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)&&er(n,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.Wd=!0,null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,"visibilitychange",this.an),t?this.Vd(!0):this.stopRecording()}get Gd(){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.Wd)return;if(this.Gd&&(null===(e=this.Hd)||void 0===e?void 0:e.isStarted))return;const i=!Ce(Object.assign)&&!Ce(Array.from);this.Gd&&i?(this.Zd(t),Dw.info("starting")):(this.zd=co,this.stopRecording())}Zd(t){var e,i;if(this.Gd)if("awaiting_config"!==this.zd&&"missing_config"!==this.zd&&(this.zd=mo),(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.Wd&&this.Gd&&this._instance.sessionManager===e)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Dw.error("could not load recorder",i)):void this.Qd(t);this.zd="disabled"})}}stopRecording(){var t,e;null===(t=this.Ud)||void 0===t||t.call(this),this.Ud=void 0,null===(e=this.Hd)||void 0===e||e.stop()}Vd(t=!1){var e,i;null===(e=this.Ud)||void 0===e||e.call(this),this.Ud=void 0,null===(i=this.Hd)||void 0===i||i.discard({discardProducerEvents:t})}Kd(){var t,e;null===(t=this.xa)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this.xa)||void 0===e||e.unregister("$replay_sample_rate")}Xd(t,e){if(Ie(t))return null;const i=Me(t)?t:parseFloat(t);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(Dw.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):i;var n}Yd(t){if(this.xa){var e,i;const n=this.xa,s=()=>{var e;const i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Xd(null===(e=this.Mr.session_recording)||void 0===e?void 0:e.sampleRate,"session_recording.sampleRate"),r=this.Xd(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:r;Ie(o)&&this.Kd();const l=null==i?void 0:i.minimumDurationMilliseconds;n.register({[O]: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.Ud)||void 0===e||e.call(this),this.Ud=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.Yd(e),void this.Vd()):(this.Yd(e),void this.startIfEnabledOrStop()):("awaiting_config"===this.zd&&(this.zd="missing_config",Dw.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var i;(null===(i=this.Hd)||void 0===i?void 0:i.log)?this.Hd.log(t,e):Dw.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(O);return(null==i||null===(e=i.scriptConfig)||void 0===e?void 0:e.script)||"lazy-recorder"}tv(){const t=this._instance.get_property(O);if(!t)return!1;let e;try{e="object"==typeof t?t:JSON.parse(t)}catch(t){return Dw.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!Ie(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}Qd(t){var e,i,n;if(!this.Wd&&this.Gd&&this._instance.sessionManager){if(!(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))return Dw.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Ft]:!0});var s;if(this.Hd||(this.Hd=null===(s=d.__PosthogExtensions__)||void 0===s?void 0:s.initSessionRecording(this._instance,this.Ke),this.Hd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.tv()){if("missing_config"===this.zd||"awaiting_config"===this.zd)return;return this.zd="awaiting_config",Dw.info("persisted remote config is stale, requesting fresh config before starting"),void new wb(this._instance).load()}this.zd=mo,null===(i=(n=this.Hd).setDocumentWasEverVisible)||void 0===i||i.call(n,this.Ke),this.Hd.start(t)}else this.zd=co}onRRwebEmit(t){var e,i;null===(e=this.Hd)||void 0===e||null===(i=e.onRRwebEmit)||void 0===i||i.call(e,t)}overrideLinkedFlag(){var t,e;this.Hd||null===(e=this.xa)||void 0===e||e.register({$replay_override_linked_flag:!0}),null===(t=this.Hd)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Hd||null===(e=this.xa)||void 0===e||e.register({$replay_override_sampling:!0}),null===(t=this.Hd)||void 0===t||t.overrideSampling()}overrideTrigger(t){var e,i;this.Hd||null===(i=this.xa)||void 0===i||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(e=this.Hd)||void 0===e||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null===(t=this.Hd)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!!(null===(i=this.Hd)||void 0===i?void 0:i.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;null===(t=this.Hd)||void 0===t||null===(e=t.flushBeforeIdentityReset)||void 0===e||e.call(t)}}},Pk={autocapture:class extends E_{constructor(t){super(new Ew(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.ev=this.iv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.nv();return!!(t.path||t.search||this.sv(t))}startIfEnabled(){this.isEnabled&&(zs.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.ev=this.iv(),this.startIfEnabled()}stop(){this.rv&&this.rv(),this.rv=void 0,this.ov&&this.ov(),this.ov=void 0,zs.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.lv("pushState"),this.lv("replaceState"),this.av(),this.sv()&&this.uv())}lv(e){var i;if(!t||(null===(i=t.history[e])||void 0===i?void 0:i.__posthog_wrapped__))return;const n=this;_v(t.history,e,t=>function(i,s,r){t.call(this,i,s,r),n.hv(e)})}iv(){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}}nv(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:Se(t)?t:{}}sv(t=this.nv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}dv(t){const e=this.nv(),i=this.ev;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.sv(e)&&t.hash!==i.hash))}hv(t){try{const e=this.iv();if(!e)return;this.dv(e)&&this._instance.capture(Yt,{navigation_type:t}),this.ev=e}catch(e){zs.error(`Error capturing ${t} pageview`,e)}}av(){if(this.rv)return;const e=()=>{this.hv("popstate")};er(t,"popstate",e),this.rv=()=>{t&&t.removeEventListener("popstate",e)}}uv(){if(this.ov)return;const e=()=>{this.hv("hashchange")};er(t,"hashchange",e),this.ov=()=>{t&&t.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(t){var e;this.vv=!1,this.bo=!1,this.fv=null,this.instance=t,this.vv=!!(null===(e=this.instance.persistence)||void 0===e?void 0:e.props[S]),this.rageclicks=new k_(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 Ie(this.Mr.capture_heatmaps)?Ie(this.Mr.enable_heatmaps)?this.vv:this.Mr.enable_heatmaps:!1!==this.Mr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.bo)return;Lw.info("starting..."),this.pv(),this.an()}else{var t;clearInterval(null!==(t=this.fv)&&void 0!==t?t:void 0),this.gv(),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.vv=i,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}mv(t){Nw(t.originalEvent)&&this.Cr(t.originalEvent,"deadclick")}an(){this.fv&&clearInterval(this.fv),this.fv="visible"===(null==n?void 0:n.visibilityState)?setInterval(this.fa.bind(this),this.flushIntervalMilliseconds):null}pv(){t&&n&&(this.yv=this.fa.bind(this),er(t,Kt,this.yv),this.bv=e=>this.Cr(e||(null==t?void 0:t.event)),er(n,"click",this.bv,{capture:!0}),this._v=e=>this.wv(e||(null==t?void 0:t.event)),er(n,"mousemove",this._v,{capture:!0}),this.Sv=new G_(this.instance,W_,this.mv.bind(this)),this.Sv.startIfEnabledOrStop(),this.xv=this.an.bind(this),er(n,Jt,this.xv),this.bo=!0)}gv(){var e;t&&n&&(this.yv&&t.removeEventListener(Kt,this.yv),this.bv&&n.removeEventListener("click",this.bv,{capture:!0}),this._v&&n.removeEventListener("mousemove",this._v,{capture:!0}),this.xv&&n.removeEventListener(Jt,this.xv),clearTimeout(this.Cv),null===(e=this.Sv)||void 0===e||e.stop(),this.bo=!1)}$v(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&&pr(s)&&!gr(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=Er(s)}return!1}(xr(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(fr(t.target)||!Nw(t))return;const n=this.$v(t,e);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&Lr(xr(t),this.instance.config.rageclick)&&this.Zs(le(le({},n),{},{type:"rageclick"})),this.Zs(n)}wv(t){!fr(t.target)&&Nw(t)&&(clearTimeout(this.Cv),this.Cv=setTimeout(()=>{this.Zs(this.$v(t,"mousemove"))},500))}Zs(e){if(!t)return;const i=this.Mr.disable_capture_url_hashes?rn(t.location.href):t.location.href,n=this.Mr.custom_personal_data_properties,s=this.Mr.mask_personal_data_properties?[...Sa,...n||[]]:[],r=ar(i,s,Ca);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}fa(){this.Rt&&!xe(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:G_,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.vv=!1,this.bo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Tv=()=>{clearTimeout(this.Iv),this.Iv=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.Mv=t=>{var e;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Ie(null==t?void 0:t.name)||Ie(null==t?void 0:t.value))return void Rw.error("Invalid metric received",t);const i="string"==typeof t.navigationURL?t.navigationURL:void 0,n=this.Ev(i);if(Ce(n))return;const s=Me(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${n}`;if(this.Pv&&t.value>=this.Pv)return void Rw.error("Ignoring metric with value >= "+this.Pv,t);this.Rt.navigationKey!==s&&(this.Tv(),this.Iv=setTimeout(this.Tv,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 Fw){const n="url"===i&&"string"==typeof t.attribution[i]?this.Ev(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.Tv()},this.Rv=()=>{if(this.bo)return;let t,e,i,n,s=!1;const r=d.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,l=(null==o?void 0:o[this.Av])||("web-vitals"===this.Av&&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 Rw.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.Mv.bind(this),a),this.allowedMetrics.indexOf("CLS")>-1&&e(this.Mv.bind(this),a),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Mv.bind(this),a),this.allowedMetrics.indexOf("INP")>-1&&n(this.Mv.bind(this),u),this.bo=!0},this.vv=!!(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[E]),this.startIfEnabled()}get Fv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const i=Se(this.Fv)?null===(t=this.Fv)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return Ie(i)?(null===(e=this._instance.persistence)||void 0===e?void 0:e.props.$web_vitals_allowed_metrics)||Ow:i}get flushToCaptureTimeoutMs(){return(Se(this.Fv)?this.Fv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=Se(this.Fv)?this.Fv.web_vitals_attribution:void 0;return Pe(t)?t?Ow:[]:we(t)?t:Aw}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=Se(this.Fv)?this.Fv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Pv(){const t=Se(this.Fv)&&Me(this.Fv.__web_vitals_max_value)?this.Fv.__web_vitals_max_value:Pw;return t>0&&6e4>=t?Pw:t}get isEnabled(){const t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Rw.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=Se(this.Fv)?this.Fv.web_vitals:Pe(this.Fv)?this.Fv:void 0;return Pe(e)?e:this.vv}startIfEnabled(){this.isEnabled&&!this.bo&&(Rw.info("enabled, starting..."),this.No(this.Rv))}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({[E]:i}),this._instance.persistence.register({[P]:n})),this.vv=i,this.startIfEnabled()}get Av(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}No(t){var e;const i=d.__PosthogExtensions__,n=this.Av,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?Rw.error("failed to load script",e):t()})}Ev(e){const i=e||(null==t?void 0:t.location.href);if(!i)return void Rw.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?rn(i):i,s=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Sa,...s||[]]:[];return ar(n,r,Ca)}}},Ok={exceptionObserver:class{constructor(e){var i;this.Rv=()=>{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.Ov&&this.Mr.capture_unhandled_errors&&(this.Ov=i(this.captureException.bind(this))),!this.Dv&&this.Mr.capture_unhandled_rejections&&(this.Dv=n(this.captureException.bind(this))),!this.Lv&&this.Mr.capture_console_errors&&(this.Lv=s(this.captureException.bind(this)))}catch(t){Iw.error("failed to start",t),this.Nv()}},this._instance=e,this.qv=!!(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,$:Iw})),this.Mr=this.jv(),this.startIfEnabledOrStop()}jv(){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.qv: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?(Iw.info("enabled"),this.Nv(),this.No(this.Rv)):this.Nv()}No(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"exception-autocapture",e=>{if(e)return Iw.error("failed to load script",e);t()})}Nv(){var t,e,i;null===(t=this.Ov)||void 0===t||t.call(this),this.Ov=void 0,null===(e=this.Dv)||void 0===e||e.call(this),this.Dv=void 0,null===(i=this.Lv)||void 0===i||i.call(this),this.Lv=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.qv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[x]:this.qv}),this.Mr=this.jv(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.jv()}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 Iw.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.Bv=[],this.Hv=_m(),this._instance=t,this.Bv=null!==(e=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==e?e:[],this.zv=Jn(this.Uv()),this.Wv=new Kn(this.zv)}onConfigChange(){this.zv=Jn(this.Uv()),this.Wv.setConfig(this.zv)}onRemoteConfig(t){var e,i,n;if(!t.ok)return;const s=t.config;if(!("errorTracking"in s))return;const r=null!==(e=null===(i=s.errorTracking)||void 0===i?void 0:i.suppressionRules)&&void 0!==e?e:[],o=null===(n=s.errorTracking)||void 0===n?void 0:n.captureExtensionExceptions;this.Bv=r,this._instance.persistence&&this._instance.persistence.register({[C]:this.Bv,[T]:o})}get Vv(){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.Hv.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.zv.enabled)try{if(!$e(t)||0===t.trim().length)return void fm.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.Gv(e));n.length>0&&fm.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Wv.add(le({[Vn]:t,[Gn]:(new Date).toISOString()},i))}catch(t){fm.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.Zv(e)){if(this.Qv(e))return this.Jv("Exception dropped: matched a suppression rule"),void fm.info("Skipping exception capture because a suppression rule matched");if(!this.Vv&&this.Kv(e))return this.Jv("Exception dropped: thrown by a browser extension"),void fm.info("Skipping exception capture because it was thrown by an extension");if(!this.Vv&&this.Xv(e))return this.Jv("Exception dropped: thrown by an injected browser script"),void fm.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Yv(e))return this.Jv("Exception dropped: thrown by the PostHog SDK"),void fm.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this.zv.enabled&&Ie(t.$exception_steps)?this.tf(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",eh:!0});return t&&this.Wv.clear(),t}catch(t){return vm(t)||fm.error("Failed to capture exception event. Dropping this exception.",t),void this.Wv.clear()}}catch(t){return void(vm(t)||fm.error("Failed to process exception event. Ignoring this exception.",t))}}tf(t){try{const e=this.Wv.getAttachable();return 0===e.length?t:le(le({},t),{},{$exception_steps:e})}catch(e){return fm.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Jv(t){this.zv.enabled&&this.Wv.add({[Vn]:t,[Gn]:(new Date).toISOString()})}Gv(t){return Se(t)?le({},t):{}}Uv(){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.Bv.some(t=>{const i=t.values.map(t=>{const i=va[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 fm.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Kv(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&&mm.some(e=>t.startsWith(e)));return 0!==i.length&&(!i.every(({filename:t})=>!!t&&t.startsWith(pm))||t.some(({type:t,value:e})=>"NoResponse"===t||$e(e)&&gm.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(pm))))}Xv(t){return t.some(({value:t})=>$e(t)&&ym.some(e=>t.includes(e)))}Yv(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}Zv(t){return!Ie(t)&&we(t)}}},Ak=le({productTours:class{get xa(){return this._instance.persistence}constructor(t){this.ef=null,this.if=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if("productTours"in e){var i,n;if(this.xa&&this.xa.register({[M]:!!e.productTours}),!Bw(this._instance))return!this.ef&&Ie(null===(i=this.xa)||void 0===i?void 0:i.props.ph_product_tours)||qw.info("product tours disabled; stopping and clearing cached tours"),null===(n=this.ef)||void 0===n||n.stop(),this.ef=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.ef&&Bw(this._instance)&&this.No(()=>this.nf())}No(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"product-tours",e=>{e?qw.error("Could not load product tours script",e):t()})}nf(){var t;!this.ef&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.ef=d.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(we(this.if)&&!e)return void t(this.if,{isLoaded:!0});const i=this.xa;if(i){const n=i.props[vt];if(we(n)&&!e)return this.if=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(!Bw(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||qw.warn(i):qw.error(i),void t([],{isLoaded:!1,error:i})}const s=we(e.json.product_tours)?e.json.product_tours:[];this.if=s,i&&i.register({[vt]:s}),t(s,{isLoaded:!0})}})}getActiveProductTours(t){Ie(this.ef)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.ef.getActiveProductTours(t)}showProductTour(t){var e;null===(e=this.ef)||void 0===e||e.showTourById(t)}previewTour(t){this.ef?this.ef.previewTour(t):this.No(()=>{var e;this.nf(),null===(e=this.ef)||void 0===e||e.previewTour(t)})}dismissProductTour(){var t;null===(t=this.ef)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.ef)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.ef)||void 0===t||t.previousStep()}clearCache(){var t;this.if=null,null===(t=this.xa)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var e;null===(e=this.ef)||void 0===e||e.resetTour(t)}resetAllTours(){var t;null===(t=this.ef)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var e;null===(e=this.ef)||void 0===e||e.cancelPendingTour(t)}}},Mk),Fk={siteApps:class{constructor(t){this._instance=t,this.sf=0,this.rf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}lf(t,e){if(!e)return;const i=this.globalsForEvent(e);this.rf.push(i),this.rf.length>1e3&&(this.rf=this.rf.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.lf.bind(this));this.af=()=>{t(),this.rf=[],this.af=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({},gs(t,jw)),{},{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}}uf(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)||(Hw.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)||(Hw.error("prepare_external_dependency_script returned null"),null)}return t}hf(){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.sf++,this.cf)return this.df();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.uf(t);return e&&v.add(e),e},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!Ee(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.cf=()=>{c.forEach(t=>t()),this.cf=void 0},this.df()}df(){let t=!1;return()=>{var e;t||(t=!0,this.sf--,0===this.sf&&(null===(e=this.cf)||void 0===e||e.call(this)))}}vf(t,e=!0){const i=this.hf();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.rf.length&&(Hw.info(`Processing ${this.rf.length} events for site app with id ${t.id}`),this.rf.forEach(t=>this.vf(()=>{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.af)||void 0===i||i.call(this))};let n=!1;const s=s=>{e.errored=!s,e.loaded=!0,Hw.info(`Site app with id ${t.id} ${s?"loaded":"errored"}`),n&&i()};try{const{processEvent:i}=this.vf(e=>t.init({posthog:this._instance,callback(t){e(),s(t)}}),!1);i&&(e.processEvent=i),n=!0}catch(e){Hw.error(Uw+t.id,e),s(!1)}if(n&&e.loaded)try{i()}catch(i){Hw.error(`Error while processing buffered events PostHog app with config id ${t.id}`,i),e.errored=!0}}ff(){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)}pf(t){if(0===Object.keys(this.apps).length)return;const e=this.globalsForEvent(t);for(const i of Object.values(this.apps))try{this.vf(()=>{var t;return null===(t=i.processEvent)||void 0===t?void 0:t.call(i,e)})}catch(e){Hw.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.ff(),void this._instance.on("eventCaptured",t=>this.pf(t))):void Hw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this.af)||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 Hw.error(Uw+t,e)})}else Hw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Dk={tracingHeaders:class{constructor(t){this._instance=t,this.gf=void 0,this.mf=void 0,this.yf=void 0,this.Rv=()=>{const t=this.bf();var e,i;t?(Ce(this.gf)&&(this.gf=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.mf)&&(this.mf=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.Nv()}}initialize(){this.startIfEnabledOrStop()}No(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.tracingHeadersPatchFns)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"tracing-headers",e=>{if(e)return Mw.error("failed to load script",e);t()})}_f(){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}bf(){const t=this._f();return we(t)?(we(this.yf)?this.yf.splice(0,this.yf.length,...t):this.yf=[...t],t.length>0?this.yf:void 0):(we(this.yf)&&this.yf.splice(0),this.yf=t||void 0,this.yf)}Nv(){var t,e;null===(t=this.gf)||void 0===t||t.call(this),null===(e=this.mf)||void 0===e||e.call(this),this.gf=void 0,this.mf=void 0}startIfEnabledOrStop(){this.bf()?this.No(this.Rv):this.Nv()}}},Lk=le({surveys:class extends Gw{constructor(t){var e;super(new Xw(t),(e=t,{get projectToken(){return e.config.token},kv:new Yw(e)})),this._instance=t}Mh(t,e){const i=e.query?Eb(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})})}}},Mk),Nk={toolbar:class{constructor(t){this.instance=t}wf(t){d.ph_toolbar_state=t}kf(){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(ir(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=tk||ur(e.hash,"__posthog")||ur(e.hash,"state");let r;const o=n?on(()=>JSON.parse(atob(decodeURIComponent(n))))||on(()=>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(ek)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Sf(t){const e=d.ph_load_toolbar||d.ph_load_editor;!Ie(e)&&ke(e)?e(t,this.instance):ik.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(ek,JSON.stringify(le(le({},r),{},{source:void 0}))),2===this.kf())this.Sf(r);else if(0===this.kf()){var o,l;this.wf(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 ik.error("[Toolbar] Failed to load",t),void this.wf(0);this.wf(2),this.Sf(r)}),er(t,"turbolinks:load",()=>{this.wf(0),this.loadToolbar(r)})}return!0}xf(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,i=void 0){return this.maybeLoadToolbar(t,e,i)}}},qk=le({experiments:class e{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.Cf("retrieved web experiments from the server"),this.$f=new Map,t.forEach(t=>{if(t.feature_flag_key){var i;this.$f&&(e.Cf("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=this.$f)||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.Tf(t.name,n,t.variants[n].transforms)}else if(t.variants)for(const i in t.variants){const n=t.variants[i];e.If(n,this._instance)&&this.Tf(t.name,i,n.transforms)}})},t)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.Cf(dk);else if(!this.Mr.disable_web_experiments){if(Ie(this.$f))return this.$f=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Cf("applying feature flags",t),t.forEach(t=>{var e;if(this.$f&&(null===(e=this.$f)||void 0===e?void 0:e.has(t))){var i;const e=this._instance.getFeatureFlag(t),n=null===(i=this.$f)||void 0===i?void 0:i.get(t);e&&(null==n?void 0:n.variants[e])&&this.Tf(n.name,e,n.variants[e].transforms)}})}}previewWebExperiment(){const t=e.getWindowLocation();if(null==t?void 0:t.search){const i=lr(null==t?void 0:t.search,"__experiment_id"),n=lr(null==t?void 0:t.search,"__experiment_variant");i&&n&&(e.Cf(`previewing web experiments ${i} && ${n}`),this.getWebExperiments(t=>{this.Mf(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||[])})}Mf(t,i,n){const s=n.filter(e=>e.id===t);s&&s.length>0&&(e.Cf(`Previewing web experiment [${s[0].name}] with variant [${i}]`),this.Tf(s[0].name,i,s[0].variants[i].transforms))}static If(t,i){return!Ie(t.conditions)&&e.Ef(t,i)&&e.Pf(t)}static Ef(t,i){var n;if(Ie(t.conditions)||Ie(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=dr(i,s.href);return!(null===(r=t.conditions)||void 0===r?void 0:r.url)||vk[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 Pf(t){var e;if(Ie(t.conditions)||Ie(null===(e=t.conditions)||void 0===e?void 0:e.utm))return!0;const i=Ta();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 Cf(t,...e){zs.info(`[WebExperiments] ${t}`,e)}Tf(t,i,n){this._is_bot()?e.Cf(dk):"control"!==i?n.forEach(n=>{if(n.selector){var s;e.Cf(`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.Cf("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?Jb(i,this.Mr.custom_blocked_useragents):void 0}}},Mk),Bk={conversations:class{constructor(t){this._instance=t,this.Rf=void 0,this._conversationsManager=null,this.Af=!1,this.ne=null,this.Ff=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return;if(this.Of=t.ok,!t.ok)return;const e=t.config.conversations;Ie(e)||(Pe(e)?this.Rf=e:(this.Rf=e.enabled,this.ne=e),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.Rf=void 0,this.ne=null,this.Of=void 0,this.Ff=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this.Af)return;if(this._instance.config.disable_conversations)return;if(ir(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.Rf)&&this.Rf)if(this.ne&&this.ne.token){this.Af=!0;try{const e=t.initConversations;if(e)return this.Df(e),void(this.Af=!1);const i=t.loadExternalDependency;if(!i)return void this.Lf(Vt);i(this._instance,"conversations",e=>{e||!t.initConversations?this.Lf("Could not load conversations script",e):this.Df(t.initConversations),this.Af=!1})}catch(t){this.Lf("Error initializing conversations",t),this.Af=!1}}else fk.error("Conversations enabled but missing token in remote config.")}Df(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.Ff=!1,fk.info("Conversations loaded successfully")}catch(t){this.Lf("Error completing conversations initialization",t)}else fk.error("Cannot complete initialization: remote config is null")}Lf(t,e){fk.error(t,e),this._conversationsManager=null,this.Af=!1,this.Ff=!0}show(){this._conversationsManager?this._conversationsManager.show():fk.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Rf&&!Ee(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":ir(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Of?"remote_config_failed":Ce(this.Rf)?this.Of?"disabled_in_project":"remote_config_pending":this.Rf?Ie(this.ne)||!this.ne.token?"missing_token":(null==d?void 0:d.__PosthogExtensions__)?this.Af?"initializing":this.Ff?"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):(fk.warn(pk),null)})()}getMessages(t,e){var i=this;return ne(function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(fk.warn(pk),null)})()}markAsRead(t){var e=this;return ne(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(fk.warn(pk),null)})()}getTickets(t){var e=this;return ne(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(fk.warn(pk),null)})()}requestRestoreLink(t){var e=this;return ne(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(fk.warn(pk),null)})()}restoreFromToken(t){var e=this;return ne(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(fk.warn(pk),null)})()}restoreFromUrlToken(){var t=this;return ne(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(fk.warn(pk),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}dh(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}fh(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}}},jk={logs:class{constructor(e){var i;this._instance=e,this.name=Rp,this.Nf=!1,this.qf=!1,this.jf=!1,this.$=Ws("[logs]"),this.Bf=le(le({},this.$),{},{error:(...t)=>{t.some(wk)||this.$.error(...t)}}),this.ia=[],this.Hf=[],this.Yc=0,this.So=!1,this.zf=[],this.Uf=[],this.Wf=!1,this.Vf=!1,this.Gf=()=>{var t,e;this.So||(this.Yc=0,null===(t=this.Zf)||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.Nf=!0),t&&er(t,"online",this.Gf)}Jf(t,e,i,n){var s;const r=gk(null===(s=this._instance)||void 0===s||null===(s=s.config)||void 0===s?void 0:s.logs,i);return[new Fs(this.Kf(t,e),r,this.Bf,()=>this.Xf(),t=>t(),void 0,n),r]}Yf(){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.Zf&&this.tp===e||(null===(i=this.Zf)||void 0===i||i.reset(),this.tp=e,[this.Zf,this.ep]=this.Jf(()=>this.ia,t=>{this.ia=t})),this.Zf}np(){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.sp===e||(null===(i=this.Qf)||void 0===i||i.reset(),this.sp=e,[this.Qf,this.rp]=this.Jf(()=>this.Hf,t=>{this.Hf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},yk)),this.Qf}setup(t){var e;if(this.So)return;this.po=t,(null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.logs)||void 0===e?void 0:e.captureConsoleLogs)&&(this.Nf=!0),(this.Nf||this.op()&&this.lp())&&this.ap();let i=!1;const n=t.onRemoteConfig(t=>{var e;i=t.ok&&!0===(null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs),this.onRemoteConfig(t)});this.So?n.dispose():(this.$o=n,i||this.loadIfEnabled())}dispose(){var e,i,n,s;this.So||(this.So=!0,this.up(),null===(e=this.$o)||void 0===e||e.dispose(),this.$o=void 0,this.po=void 0,this.jf=!1,null==t||t.removeEventListener("online",this.Gf),null===(i=this.hp)||void 0===i||i.call(this),this.hp=void 0,null===(n=this.Zf)||void 0===n||n.reset(),null===(s=this.Qf)||void 0===s||s.reset())}onRemoteConfig(t){var e,i;if(this.So)return;const n=t.ok?null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs:void 0;Ie(n)?this.cp():(null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$logs_capture_enabled_server_side:!!n}),n?(this.Nf=!0,this.qf||this.ap(),this.loadIfEnabled()):this.cp())}reset(){var t,e,i,n;this.up(),null===(t=this.Zf)||void 0===t||t.clearQueue(),this.ia=[],null===(e=this.Zf)||void 0===e||e.reset(),null===(i=this.Qf)||void 0===i||i.clearQueue(),this.Hf=[],null===(n=this.Qf)||void 0===n||n.reset(),this.Yc=0}captureLog(t){this.So||this.Yf().captureLog(t)}captureConsoleLog(t){this.So||this.np().captureLog(t)}captureBufferedConsoleLog(t,e,i){this.So||this.np().captureLog(t,{context:e,occurredAtMs:i})}lp(){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[R])}op(){var t,e,i;return!(null===(t=this._instance)||void 0===t||null===(e=t.Xl)||void 0===e?void 0:e.call(t))||!!(null===(i=d._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[this._instance.config.token])||void 0===i?void 0:i.config)}gh(){var t;this.up(),null===(t=this.Qf)||void 0===t||t.clearQueue(),this.Hf=[]}cp(){this.Nf||this.up()}ap(){var t;if(this.Wf||!(null==d?void 0:d.console))return;const e=gk(null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs).maxBufferSize;let i=!0;this.Uf.push(()=>{i=!1});for(const t of mk){let n;try{n=tm(d.console[t])}catch(t){continue}n&&this.Uf.push(_v(d.console,t,s=>{const r=(...n)=>{try{i&&this.dp(t,n,e)}catch(t){}return s.apply(d.console,n)};return r.__rrweb_original__=n,r}))}this.Wf=!0,this.vp=setTimeout(()=>{this.up()},3e4)}dp(t,e,i){var n;if(this.Wf&&!this.Vf&&0!==e.length)if(null===(n=this._instance)||void 0===n?void 0:n.is_capturing()){if(i>this.zf.length){this.Vf=!0;try{this.zf.push({level:t,args:e,occurredAtMs:Date.now(),context:this.Xf()})}finally{this.Vf=!1}}}else this.up()}up(){if(this.zf=[],this.Wf){this.Wf=!1,this.vp&&(clearTimeout(this.vp),this.vp=void 0);for(const t of this.Uf)t();this.Uf=[]}}fp(){const t=this.zf;return this.up(),t}get logger(){return this.pp||(this.pp={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.pp}flushLogs(t){t?this.gp(t):(this.Zf&&this.Zf.flush().catch(t=>this.mp(t)),this.Qf&&this.Qf.flush().catch(t=>this.mp(t)))}mp(t){wk(t)||this.$.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.So||!this.Nf||this.qf||this.jf)return;const t=null==d?void 0:d.__PosthogExtensions__;if(!t)return this.$.error("PostHog Extensions not found."),void this.up();const e=t.loadExternalDependency;if(!e)return this.$.error(Vt),void this.up();this.jf=!0;try{e(this._instance,"logs",e=>{if(this.jf=!1,this.So||!this.Nf)return;const i=t.logs;if(e||!(null==i?void 0:i.initializeLogs))this.$.error("Could not load logs script",e),this.up();else{var n;const t=this.fp();var s,r;this.hp=i.initializeLogs(null!==(n=this.po)&&void 0!==n?n:this._instance),this.qf=!0,t.length>0&&(null===(s=i.replayConsoleBuffer)||void 0===s||s.call(i,null!==(r=this.po)&&void 0!==r?r:this._instance,t))}})}catch(t){throw this.jf=!1,t}}Kf(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:[])},js:t=>this.js(t),getLibraryId:()=>Jl.LIB_NAME,getLibraryVersion:()=>Jl.LIB_VERSION}}js(t){return new Promise(e=>{if(hr(this.Yc,3))return void e({kind:"fatal",error:bk(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:bk(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.yp(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{const e=t.statusCode;if(this.bp(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:bk(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}`)})}}})})}bp(t){(0!==t||this._instance.__loaded)&&(this.Yc=cr(t,this.Yc,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.")))}gp(t){this.ia.length>0&&this._p(t,this.ia,this.ep,Jl.LIB_NAME,t=>{this.ia=t}),this.Hf.length>0&&this._p(t,this.Hf,this.rp,yk,t=>{this.Hf=t})}_p(t,e,i,n,s){if(0===e.length)return;const r=e.map(t=>t.record);s([]);const o=Rs(r,Ms(i,Jl.LIB_NAME,Jl.LIB_VERSION),n,Jl.LIB_VERSION);this._instance._send_request({method:"POST",url:this.yp(),data:o,compression:"best-available",batchKey:"logs",transport:t})}yp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Xf(){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,Ie(n)||(e.sessionStartTimestamp=n),Ie(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?rn(d.location.href):d.location.href),this._instance.featureFlags){const t=this._instance.featureFlags.getFlags();t&&t.length>0&&(e.activeFeatureFlags=t)}return e}}},Hk={metrics:class{constructor(t){this._instance=t,this.$=Ws("[metrics]"),this.So=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.So)return;const e=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);e&&!this.wp?this.wp=(t=>{let e=!0;const i=()=>e?(t=>{var e;const i=null===(e=t.config.metrics)||void 0===e?void 0:e.network;return!0===i?{}:i||void 0})(t):void 0,n=Ek(t,i),s=Ik(t,i);return()=>{e=!1,n(),s()}})(this._instance):!e&&this.wp&&(this.wp(),this.wp=void 0)}Yf(){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.Zf&&this.tp===e||(null===(i=this.Zf)||void 0===i||i.reset(),this.tp=e,this.Zf=new qs(this.Kf(),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.Zf}count(t,e=1,i){this.Yf().count(t,e,i)}gauge(t,e,i){this.Yf().gauge(t,e,i)}histogram(t,e,i){this.Yf().histogram(t,e,i)}flush(t){if(!this.Zf)return Promise.resolve();if(t){const e=this.Zf.drainWindow();return e&&this.Ys(e,t),Promise.resolve()}return this.Zf.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.Zf)||void 0===t||t.reset()}dispose(){var t,e;this.So=!0,null===(t=this.wp)||void 0===t||t.call(this),this.wp=void 0,null===(e=this.Zf)||void 0===e||e.reset()}Kf(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ys:t=>e.Ys(t),getLibraryId:()=>Jl.LIB_NAME,getLibraryVersion:()=>Jl.LIB_VERSION}}Ys(t,e){return new Promise(i=>{let n=!1;const s=t=>{n||(n=!0,clearTimeout(r),i(t))},r=setTimeout(()=>s({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(le(le({method:"POST",url:this.kp(),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}`)})}}}))})}kp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};Tw.__defaultExtensionClasses=le({},le(le(le(le(le(le(le(le(le(le(le(le(le({},Mk),Rk),Pk),Ok),Ak),Fk),Lk),Dk),Nk),qk),Bk),jk),Hk));const Uk=function(){Jl.SDK_DIST_CHANNEL="npm";const e=hw[bw]=new Tw;return function(){function e(){e.done||(e.done=!0,ww=!1,Gs(hw,function(t){t._dom_loaded()}))}(null==n?void 0:n.addEventListener)?"complete"===n.readyState?e():er(n,"DOMContentLoaded",e,{capture:!1}):t&&zs.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();var zk=Uk;export{ap as Compression,pb as DEFAULT_PRODUCT_TOUR_APPEARANCE,_p as DisplaySurveyType,Tw as PostHog,gb as ProductTourEventName,mb as ProductTourEventProperties,mp as SurveyEventName,yp as SurveyEventProperties,up as SurveyEventType,cp as SurveyPosition,pp as SurveyQuestionBranchingType,fp as SurveyQuestionType,gp as SurveySchedule,dp as SurveyTabPosition,vp as SurveyType,hp as SurveyWidgetType,zk as default,Uk as posthog,kb as severityLevels};
|
|
1
|
+
const t="u">typeof window?window:void 0,e="u">typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,n=null==e?void 0:e.document,s=null==e?void 0:e.location,r=null==e?void 0:e.fetch,o=(null==e?void 0:e.XMLHttpRequest)&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,l=null==e?void 0:e.AbortController,a=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent;function h(){return!(!t||!1===t.navigator.onLine)}const c="undefined"!=typeof globalThis?globalThis:t;c&&"undefined"==typeof self&&(c.self=c),c&&"undefined"==typeof File&&(c.File=function(){});const d=null!=t?t:{},v="$people_distinct_id",f="distinct_id",p="$device_id",g="$device_model",m="__alias",y="__cmpns",_="$fbc",b="$fbc_persistence",w="__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",E="$web_vitals_enabled_server_side",I="$dead_clicks_enabled_server_side",M="$product_tours_enabled_server_side",R="$logs_capture_enabled_server_side",P="$web_vitals_allowed_metrics",O="$session_recording_remote_config",A="$session_recording_enabled_server_side",F="$replay_sample_rate",D="$replay_override_sampling",L="$replay_override_linked_flag",N="$replay_override_url_trigger",q="$replay_override_event_trigger",B="$sesid",j="$session_is_sampled",H="$session_past_minimum_duration",U="$session_recording_url_trigger_activated_session",z="$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",_t="$conversations_user_traits",bt="$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",Et="$initial_referrer_info",It="$initial_person_info",Mt="$epp",Rt="$posthog_cookieless",Pt="$cookieless_mode",Ot="$sdk_debug_extensions_init_method",At="$sdk_debug_extensions_init_time_ms",Ft="$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",Bt="$sdk_debug_replay_remote_trigger_matching_config",jt="$sdk_debug_replay_trigger_groups_count",Ht="$sdk_debug_replay_url_trigger_status",Ut="$sdk_debug_rrweb_attached",zt="$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,_e=ye.hasOwnProperty,be=ye.toString,we=Array.isArray||function(t){return"[object Array]"===be.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(_e.call(t,e))return!1;return!0}return!1},Ce=t=>void 0===t,$e=t=>"[object String]"==be.call(t),Te=t=>$e(t)&&0===t.trim().length,Ee=t=>null===t,Ie=t=>Ce(t)||Ee(t),Me=t=>"[object Number]"==be.call(t)&&t==t,Re=t=>Me(t)&&t>0,Pe=t=>"[object Boolean]"===be.call(t),Oe=t=>t instanceof FormData,Ae=t=>fe(de,t),Fe=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 Be(t,Error)}}function qe(t){return"u">typeof Event&&Be(t,Event)}function Be(t,e){try{return t instanceof e}catch(t){return!1}}const je=[!0,"true",1,"1","yes"],He=t=>fe(je,t),Ue=[!1,"false",0,"0","no"],ze=["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 ze.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),Me(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",_i="Ouya",bi="Generic "+Ze.toLowerCase(),wi="Generic "+Je.toLowerCase(),ki="Konqueror",Si="Oculus Browser",xi="Vivaldi",Ci="Yandex",$i="Whale",Ti="DuckDuckGo",Ei="Pale Moon",Ii="Waterfox",Mi="Brave",Ri="Claude",Pi="Codex",Oi="ChatGPT",Ai="Google Search App",Fi=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"),Bi=new RegExp("BlackBerry|PlayBook|BB10","i"),ji={"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)?Mi:null}(i);return s||((null==n?void 0:n.detectGoogleSearchApp)&&fe(t,"GSA/")?Ai:fe(t," OPR/")&&fe(t,"Mini")?"Opera Mini":fe(t," OPR/")?li:Bi.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/")?Ri:fe(t,"Codex/")?Pi:fe(t,"ChatGPT/")?Oi: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/")?Mi:((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/")?Ei:fe(t,"Waterfox/")?Ii:fe(t,ui)?ui:fe(t,"MSIE")||fe(t,"Trident/")?ri:fe(t,"Gecko")?ui:"")},Ui={[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]:[Fi],[pi]:[Fi],[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+)?)"),Fi],[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+)?)")],[Mi]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ri]:[Di],[Pi]:[Di],[Oi]:[Di],[Ti]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ei]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Ai]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ri]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},zi=function(t,e,i,n){const s=Hi(t,e,i,n),r=Ui[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,""]],[Bi,[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=ji[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(_i,"i").test(t)?_i: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:Bi.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)?bi: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===_i?"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}function tn(t,e){if(!e)return t;let i=[];try{i=Object.keys(e)}catch(t){i=[]}for(const n of i){let i;try{i=e[n]}catch(t){i=Yi}Object.defineProperty(t,n,{value:i,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;const en=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function nn(t,e){return"string"==typeof(i=t)&&en.test(i)?t:e();var i}function sn(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 rn(t){return t?t.split("#")[0]:t}function on(t){try{return t()}catch(t){return}}function ln(t,e){const i=setTimeout(t,e);return null!=i&&i.unref&&(null==i||i.unref()),i}function an(t,e,i){return un.apply(this,arguments)}function un(){return(un=ne(function*(t,e,i){let n;try{return yield Promise.race([t,new Promise((t,s)=>{n=ln(()=>{try{null==i||i(),t()}catch(t){s(t)}},e)})])}finally{clearTimeout(n)}})).apply(this,arguments)}let hn,cn,dn;function vn(t){const e=globalThis._posthogChunkIds;if(!e)return;const i=Object.keys(e);return dn&&i.length===cn||(cn=i.length,dn=i.reduce((i,n)=>{hn||(hn={});const s=hn[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,hn[n]=[o,l];break}}}return i},{})),dn}var fn=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:vn(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)})}};const pn=/^([a-z][a-z0-9.+-]+):/i,gn=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function mn(t){if(!t||"<anonymous>"===t)return!1;const e=pn.exec(t);return!e||gn.includes(e[1].toLowerCase())}function yn(t,e,i,n,s){const r={platform:t,filename:e,function:"<anonymous>"===i?"?":i,in_app:mn(e)};return Ce(n)||(r.lineno=n),Ce(s)||(r.colno=s),r}const _n=(t,e)=>{const i=-1!==t.indexOf("safari-extension"),n=-1!==t.indexOf("safari-web-extension");return i||n?[-1!==t.indexOf("@")?t.split("@")[0]:"?",i?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},bn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,wn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,kn=/\((\S*)(?::(\d+))(?::(\d+))\)/,Sn=(t,e)=>{const i=bn.exec(t);if(i){const[,t,n,s]=i;return yn(e,t,"?",+n,+s)}const n=wn.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){const t=kn.exec(n[2]);t&&(n[2]=t[1],n[3]=t[2],n[4]=t[3])}const[t,i]=_n(n[1]||"?",n[2]);return yn(e,i,t,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},xn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Cn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,$n=(t,e)=>{const i=xn.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const t=Cn.exec(i[3]);t&&(i[1]=i[1]||"eval",i[3]=t[1],i[4]=t[2],i[5]="")}let t=i[3],n=i[1]||"?";return[n,t]=_n(n,t),yn(e,t,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Tn=/\(error: (.*)\)/;function En(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function In(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(!En(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 Mn(t,e){const i=e.start+e.length,n=Pn(t,e);n&&t.splice(i+n===t.length?i:e.start,n)}function Rn(t,e){let i=e.start;for(;i>0&&En(t[i-1],t[i-1+e.length]);)i--;return e.start-i}function Pn(t,e){const i=e.start+e.length;let n=i;for(;t.length>n&&En(t[n],t[n-e.length]);)n++;return n-i}function On(t,e){const i=e[0];let n=t.length-(i?Rn(t,i):0);for(const i of e)n-=Pn(t,i);return n}function An(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 Fn=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")}},Dn=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}},Ln=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 Nn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var qn=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(Nn);return n&&(e=n[1],i=n[2]),[e,i]}};const Bn=["fatal","error","warning","log","info","debug"];function jn(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 Hn=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: ${jn(t)}`}isSeverityLevel(t){return $e(t)&&!Te(t)&&Bn.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}}},Un=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: ${jn(t)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},zn=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}}},Wn=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 Vn="$message",Gn="$timestamp",Zn=new Set([Vn,Gn]),Qn={enabled:!0,max_bytes:32768};function Jn(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Qn.enabled,max_bytes:Yn(t.max_bytes,Qn.max_bytes)}:le({},Qn)}var Kn=class{constructor(t){this.ts=[],this.es=0,this.Mr=Jn(t)}setConfig(t){this.Mr=Jn(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[Vn],s=i[Gn];if(!$e(n)||0===n.trim().length)return;if(!$e(s)&&!Me(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 Yn(t,e){if(!Me(t)||1/0===t||-1/0===t)return e;const i=Math.floor(t);return 0>i?e:i}const Xn=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function ts(t){return"string"==typeof t||t}function es(t){return"string"==typeof t?t:void 0}const is=["$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"],ns="NativeGzipValidationError",ss=t=>t.length>=2&&31===t[0]&&139===t[1],rs=(t,e)=>t===ue.GZipJS||e===ue.GZipJS||"gzip"===e,os=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),ls=t=>{if(!t||"object"!=typeof t)return!1;const e="name"in t?String(t.name):"";return os(t)||e===ns};let as;const us=t=>{throw sn(ns,`Native gzip produced invalid output: ${t}`)},hs=(cs=ne(function*(t,e){18>t.size&&us("too-short");const i=new Uint8Array(yield t.slice(0,10).arrayBuffer());ss(i)&&8===i[2]||us("invalid-header");const n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{const e=(()=>{if(as)return as;as=[];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;as[t]=e>>>0}return as})();let i=4294967295;for(let n=0;t.length>n;n++)i=e[255&(i^t[n])]^i>>>8;return(4294967295^i)>>>0})(e)&&us("invalid-crc");const s=e.length>>>0;n.getUint32(4,!0)!==s&&us("invalid-size")}),function(t,e){return cs.apply(this,arguments)});var cs;function ds(t){return vs.apply(this,arguments)}function vs(){return vs=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 hs(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}),vs.apply(this,arguments)}const fs=3e5;var ps=class{record(t){if("too-large"===t.kind)return;if("retry-later"!==t.kind)return void this.reset();if(!t.retryAfterMs)return;const e=this.isOpen(),i=Date.now(),n=Math.min(t.retryAfterMs,fs);if(!e)return this.ss=i,void(this.rs=i+n);this.rs=Math.max(this.rs,Math.min(i+n,this.ss+fs))}remainingMs(){const t=Date.now();if(this.ss-5e3>t)return this.reset(),0;const e=Math.min(fs,Math.max(0,this.rs-t));return 0===e&&this.reset(),e}isOpen(){return this.remainingMs()>0}reset(){this.rs=0,this.ss=0}constructor(){this.rs=0,this.ss=0}};function gs(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 ms={}.propertyIsEnumerable;function ys(t,e){try{return ws(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function _s(t,e,i,n){if(0>=i.remainingNodes)return{stringValue:Ki};if(i.remainingNodes--,Pe(t))return{boolValue:t};if("bigint"==typeof t)return function(t,e){const i=t.toString(),n=BigInt("9223372036854775808");return t>=n||-n>t?(null==e||e.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}(t,e);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const i=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==e||e.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:t}}if("string"==typeof t)return{stringValue: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 _s(s.call(t),e,i,n+1)}catch(t){}return we(t)?{arrayValue:{values:bs(t,e,i,n+1)}}:{kvlistValue:{values:ws(t,e,i,n+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:Xi(String(t))}}function bs(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(Ie(r))continue;s.push(_s(r,e,i,n))}catch(t){s.push({stringValue:Yi})}return t.length>o&&s.push({stringValue:Ki}),s}function ws(t,e,i,n){const s=[];for(const r in t)if(ms.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(Ee(o)||Ce(o))continue;s.push({key:Xi(r),value:_s(o,e,i,n)})}catch(t){s.push({key:Xi(r),value:{stringValue:Yi}})}}return s}function ks(t,e,i){return le(le(le(le({},tn({},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 Ss=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function xs(t,e){const i=tn({},t),n={};for(const t of Ss)({}).hasOwnProperty.call(i,t)&&(n[t]=i[t],delete i[t]);return[...ys(i,e),...ys(n,e)]}const Cs={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"};const $s={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}},Ts=$s.info;function Es(t){try{return Xi(String(t))}catch(t){return Yi}}function Is(t,e,i,n){const s=t.level||"info",{text:r,number:o}=$s[s]||Ts,l=function(t=Date.now()){return String(t)+"000000"}(Me(n)?n:void 0),a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),Ie(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),Ie(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:Es(t.body)},attributes:ys(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 Ms(t,e,i){return ks(t,e,i)}function Rs(t,e,i,n){return{resourceLogs:[{resource:{attributes:xs(e)},scopeLogs:[{scope:{name:i,version:n},logRecords:t}]}]}}var Ps=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.hs}arm(t){this.clear(),this.us=Date.now()+t,this.hs=ln(()=>{this.hs=void 0,this.ls()},t)}armNoEarlierThan(t){this.hs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function Os(){return.75+.5*Math.random()}function As(t,e,i,n){const s=Math.min(Math.max(0,e-1),6),r=t*Math.pow(2,s);return Math.round((void 0===n?r:Math.min(r,Math.max(n,t)))*i)}var Fs=class{constructor(t,e,i,n,s,r=()=>Promise.resolve(),o){var l;this._instance=t,this.Mr=e,this.$=i,this.cs=n,this.ds=s,this.vs=r,this.fs=o,this.ps=new Ps(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new ps,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=e.maxBufferSize,this.Is=Math.max(null!==(l=e.maxQueueSize)&&void 0!==l?l:e.maxBufferSize,e.maxBufferSize),this.Ms=e.flushIntervalMs,this.Es=e.maxBatchRecordsPerPost,this.Ps=e.rateCapWindowMs,this.Rs=e.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(ae.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(t,e){var i;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==t?void 0:t.body))return;const n=this.Os(t);if(null===n)return;if(!n.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const s={record:Is(n,null!==(i=null==e?void 0:e.context)&&void 0!==i?i:this.cs(),this.$,null==e?void 0:e.occurredAtMs)};this.ds(()=>this.Ls(s))}Os(t){const e=this.Mr.beforeSend;if(!e)return t;const i=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}Ds(){if(void 0===this.Rs)return!0;const t=Date.now(),e=t-this.xs;return this.Ps>e&&e>=0||(this.xs=t,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var t=this;return ne(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null})),t.ys})()}Ns(){var t=this;return ne(function*(){var e;t.ps.clear();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._s;t.bs=0;const n=Math.min(i.length,t.Es),l=i.slice(0,n),a=Rs(l.map(t=>t.record),t.qs(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.js(a);if(t._s!==e)return;if("too-large"===u.kind&&l.length>1)t.Es=Math.max(1,Math.floor(l.length/2)),t.$.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${t.Es}`);else{if(t.ws.record(u),t.ps.pending&&t.ps.arm(Math.max(t.Ms,t.ws.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.Mr.maxBatchRecordsPerPost>t.Es&&(t.Es=Math.min(t.Mr.maxBatchRecordsPerPost,t.Es+1)),yield t.Bs(l.length),i=null!==(o=t._instance.getPersistedProperty(ae.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===u.kind)throw u.error}}})()}Bs(t){var e=this;return ne(function*(){var i;const n=Math.max(0,t-e.bs),s=null!==(i=e._instance.getPersistedProperty(ae.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(ae.LogsQueue,s.slice(n)),yield e.vs()})()}qs(){return Ms(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var e;if(this._instance.optedOut)return;const i=null!==(e=this._instance.getPersistedProperty(ae.LogsQueue))&&void 0!==e?e:[];this.Is>i.length||(i.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(ae.LogsQueue,i),this.Ts>i.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(As(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const t=this._instance.getPersistedProperty(ae.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return ne(function*(){e.ps.clear();const i=e.flush().catch(()=>{});void 0!==t?yield an(i,t):yield i})()}flushWithTimeout(t){var e=this;return ne(function*(){const i=e.flush();yield an(i,t,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},t=>{this.ks++,this.Ss=Os(),this.$.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const Ds=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Ls(t){return String(t)+"000000"}function Ns(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 qs=class{constructor(t,e,i){this._instance=t,this.Mr=e,this.$=i,this.zs=new Map,this.ps=new Ps(()=>this.flush().catch(t=>{this.$.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new ps,this.ks=0,this.Ss=1,this.Gs=0}count(t,e=1,i){this.Zs({name:t,type:"count",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(t,e,i){this.Zs({name:t,type:"gauge",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(t,e,i){this.Zs({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var t=this;const e=this.ys,i=function(){var i=ne(function*(){e&&(yield e.catch(()=>{})),yield t.Qs()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this.ys===i&&(this.ys=null)});return this.ys=i,i}drainWindow(){if(0===this.zs.size)return null;const t=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const e=this.Os(t);if(null===e)return;if(!e.name||"string"!=typeof e.name)return void this.$.warn("Dropping metric with empty name");if("number"!=typeof e.value||!Number.isFinite(e.value))return void this.$.warn(`Dropping metric '${e.name}': value must be a finite number`);if("count"===e.type&&0>e.value)return void this.$.warn(`Dropping count '${e.name}': counters are monotonic, value must be >= 0`);let i,n;try{i=e.attributes?le({},e.attributes):void 0,n=Ns(e.type,e.name,e.unit,i)}catch(t){return void this.$.warn(`Dropping metric '${e.name}': attributes could not be serialized`,t)}let s=this.zs.get(n);if(!s){if(!this.Ks())return;s={name:e.name,type:e.type,unit:e.unit,attributes:i,windowStartMs:Date.now()},this.zs.set(n,s)}const r=this.Ws.get(e.name);void 0===r?this.Ws.set(e.name,e.type):r===e.type||this.Vs.has(e.name)||(this.Vs.add(e.name),this.$.warn(`Metric name '${e.name}' is already used as a ${r}; recording it as a ${e.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(s,e.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(t,e){switch(t.type){case"count":var i;t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case"gauge":t.last=e;break;case"histogram":{t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(Ds.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,Ds)]+=1;break}}}Os(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}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(As(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var t=this;return ne(function*(){if(t.ps.clear(),0===t.zs.size)return;const e=t.zs;t.zs=new Map,t.Us=!1,t.Ws=new Map,t.Vs=new Set;const i=t.Gs,n=yield t._instance.Ys(t.Js(e));if(i===t.Gs)switch(t.ws.record(n),"retry-later"===n.kind?(t.ks++,t.Ss=Os()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.Hs()),n.kind){case"ok":return;case"retry-later":return t.lo(e),void t.ps.armNoEarlierThan(t.Hs());case"too-large":return void t.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.$.error("Failed to send metrics batch:",n.error)}})()}Js(t){return e=this.ao(t),i=function(t,e,i){return ks(t,e,i)}(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:xs(i)},scopeMetrics:[{scope:{name:n,version:s},metrics:e}]}]};var e,i,n,s}ao(t){const e=Ls(Date.now()),i=new Map;for(const o of t.values()){var n;const t=Ns(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=ys(null!==(n=o.attributes)&&void 0!==n?n:{},this.$),u=Ls(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:Ds})}return Array.from(i.values())}lo(t){for(const[n,s]of t){const t=this.zs.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,s.windowStartMs),t.type){case"count":var e,i;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(i=s.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(s.hist)if(t.hist){t.hist.count+=s.hist.count,t.hist.sum+=s.hist.sum,t.hist.min=Math.min(t.hist.min,s.hist.min),t.hist.max=Math.max(t.hist.max,s.hist.max);for(let e=0;t.hist.bucketCounts.length>e;e++)t.hist.bucketCounts[e]+=s.hist.bucketCounts[e]}else t.hist=s.hist}else this.Ks()&&this.zs.set(n,s)}}};function Bs(t,e){if(!t)return;const i=t.find(t=>t.type===e);return null==i?void 0:i.value}const js="0.8.3",Hs={DEBUG:!1,LIB_VERSION:js,LIB_NAME:"browser-common",JS_SDK_VERSION:js},Us=(e,{debugEnabled:i}={})=>{const n={N(n,...s){t&&(Hs.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)=>Us(`${e} ${t}`,i)};return n},zs=Us("[PostHog.js]"),Ws=zs.createLogger;function Vs(t,e){we(t)&&t.forEach(e)}function Gs(t,e){if(!Ie(t))if(we(t))t.forEach(e);else if(Oe(t))t.forEach((t,i)=>e(t,i));else for(const i in t)_e.call(t,i)&&e(t[i],i)}const Zs=function(t,...e){for(const i of e)for(const e in i)void 0!==i[e]&&(t[e]=i[e]);return t};function Qs(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 Js=function(t){return function(...e){try{return t.apply(this,e)}catch(t){zs.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),zs.critical(t)}}},Ks=function(t){const e={};return Gs(t,function(t,i){($e(t)&&t.length>0||Me(t))&&(e[i]=t)}),e};function Ys(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 Xs=["herokuapp.com","vercel.app","netlify.app"];function tr(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 Xs)if(i===t)return!1;return!0}function er(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 ir(t){return"ph_toolbar_internal"===t.name}const nr=["localhost","127.0.0.1"],sr=(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,Ys(e)),i.get(e)):"bigint"==typeof e?e.toString():e},e)}catch(e){return me(t)}},rr=t=>{const e=null==n?void 0:n.createElement("a");return Ce(e)?null:(e.href=t,e)},or=function(t,e="&"){let i,n;const s=[];return Gs(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)},lr=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){zs.error("Skipping decoding for malformed query param: "+t)}return t.replace(/\+/g," ")}},ar=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},ur=function(t,e){const i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},hr=(t,e)=>t>=e&&h(),cr=(t,e,i,n)=>{if(0===t){if(h()){const t=e+1;return t===i&&n(),t}return e}return 0};function dr(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 zs.error("Error in get_current_url, falling back to window.location.href",t),e}}function vr(e){var i;const n=null==t||null===(i=t.location)||void 0===i?void 0:i.href;return Ce(n)?void 0:dr(e,n)}function fr(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 pr(t){return!!t&&1===t.nodeType}function gr(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function mr(t){return!!t&&3===t.nodeType}function yr(t){return!!t&&11===t.nodeType&&pr(t.host)}function _r(t){return t?pe(t).split(/\s+/):[]}function br(t,e){const i=vr(e);return!!(i&&t&&t.some(t=>i.match(t)))}function wr(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 _r(e)}function kr(t){return Ie(t)?null:pe(t).split(/(\s+)/).filter(t=>Qr(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Sr(t){let e="";return Br(t)&&!jr(t)&&t.childNodes&&t.childNodes.length&&Gs(t.childNodes,function(t){var i;mr(t)&&t.textContent&&(e+=null!==(i=kr(t.textContent))&&void 0!==i?i:"")}),pe(e)}function xr(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 Cr=["a","button","form","input","select","textarea","label"];function $r(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 Tr(t,e){if(Ce(e))return!0;for(const i of t)if(e.some(t=>$r(i,t)))return!0;return!1}function Er(t){const e=t.parentNode;return!(!e||!pr(e))&&e}const Ir=[".ph-no-autocapture","[data-ph-no-autocapture]"],Mr=["next","previous","prev",">","<"],Rr=[...Mr,"+","-","−","–"],Pr=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Or=[".ph-no-deadclick",".ph-no-capture"],Ar=[".ph-no-rageclick",".ph-no-capture"],Fr=["","text","search","email","password","url","tel","number"];function Dr(t){return!(!t||!pr(t))&&(!!gr(t,"textarea")||(gr(t,"input")?fe(Fr,(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 Lr(e,i){if(!t||Nr(e))return!1;let n,s,r;var o,l;if(Pe(i)?(n=!!i&&Ar,s=void 0,r=!1):(n=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Ar,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&&Dr(e))return!1;const{targetElementList:a}=qr(e,!1);return!function(t,e){if(!1===t||Ce(t))return!1;let i;if(!0===t)i=Mr;else{if(!we(t))return!1;if(t.length>10)return zs.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=>Pr(t,i)||Pr(e,i)))}(s,a.map(t=>{var e;return{safeText:Sr(t).toLowerCase(),ariaLabel:(null===(e=t.getAttribute("aria-label"))||void 0===e?void 0:e.toLowerCase().trim())||""}}))&&!Tr(a,n)}const Nr=t=>!t||gr(t,"html")||!pr(t),qr=(e,i)=>{if(!t||Nr(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const s=[e];let r=e;for(;r.parentNode&&!gr(r,"body");){if(yr(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}const e=Er(r);if(!e)break;if(i||Cr.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 Br(t){const e=new Set;let i=0;for(let n=t;n.parentNode&&!gr(n,"body");n=n.parentNode){if(i++>=1e3||e.has(n))return!1;e.add(n);const t=wr(n);if(fe(t,"ph-sensitive")||fe(t,"ph-no-capture"))return!1}if(fe(wr(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 jr(t){return!!(gr(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||gr(t,"select")||gr(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const Hr=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}))$"),Ur=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,zr=[16,15,14,13],Wr=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Vr=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Gr=/[0-9A-Za-z_]/;function Zr(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 Qr(t,e=!0){if(Ie(t))return!1;if($e(t)){if(t=pe(t),e?Hr.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(Ur.lastIndex=0;e=Ur.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 zr){const n=t+e;if(i.length>=n){const e=i.slice(t,n);if(Hr.test(e)&&Zr(e))return!0}}}return!1}(t))return!1;if(e?Wr.test(t):function(t){let e;for(Vr.lastIndex=0;e=Vr.exec(t);){const t=e[1],i=e[3];if(!(t&&i&&Gr.test(t)&&Gr.test(i)))return!0}return!1}(t))return!1}return!0}function Jr(t){let e=Sr(t);return e=`${e} ${Kr(t)}`.trim(),Qr(e)?e:""}function Kr(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Gs(t.childNodes,function(t){var i;if(t&&"span"===(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=Sr(t);e=`${e} ${i}`.trim(),t.childNodes&&t.childNodes.length&&(e=`${e} ${Kr(t)}`.trim())}catch(t){zs.error("[AutoCapture]",t)}}),e}function Yr(t){return t.replace(/"|\\"/g,'\\"')}function Xr(t){const e=t.attr__class;if(e)return we(e)?e:_r(e)}const to=1e6;function eo(t){var e;return Math.min(to,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:to)}const io={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:to,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},no=["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"],so=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ro=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],oo=t=>{Ie(t)||Gs(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return no.includes(e)||ro.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},lo=["/s/","/e/","/i/"];function ao(t,e,i,n){if(Ie(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 uo(t,e){if(Ie(t))return t;let i=t;return Qr(i,!1)||(i="[SessionRecording] "+e+" body redacted"),Gs(so,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 ho=new WeakSet,co="disabled",vo="sampled",fo="active",po="buffering",go="paused",mo="lazy_loading",yo="rrweb_error",_o="trigger_activated",bo="trigger_pending",wo="trigger_disabled";function ko(t,e,i,n,s,r){return 0===e?wo:(null==t?void 0:t.get_property(i?n+i:s))===r?_o:bo}function So(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 xo(t){return t.includes("trigger_activated")?_o:t.includes("trigger_pending")?bo:wo}function Co(t){const e=new Set(t);switch(e.delete(wo),e.size){case 0:return wo;case 1:return Array.from(e)[0];default:return bo}}var $o=class{constructor(t){this.q=t}triggerStatus(t){return xo(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return xo(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},To=class{constructor(t){this.q=t}triggerStatus(t){return Co(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return Co(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},Eo=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return _o}stop(){}};const Io=t=>"sessionRecording"in t;var Mo=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=(Io(t)?Se(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.B=(Io(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){zs.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){zs.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}G(t){return ko(this._instance,this.j.length,this.V,V,U,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=vr(this._instance);if(!t)return!1;try{return So(t,this.B,this.U)}catch(t){return!0}}checkUrlBlocklist(t,e){const i=vr(this._instance);if(!i)return;if(i===this.W)return;this.W=i;const n=this.urlBlocked,s=So(i,this.B,this.U);n&&s||(s&&!n?t():!s&&n&&e())}checkUrlTriggerConditions(t,e,i,n){const s=vr(this._instance);if(!s)return;if(s===this.W)return;this.W=s;const r=this.urlBlocked,o=So(s,this.B,this.U);o&&!r?t():!o&&r&&e();const l=this.G(n)===_o,a=So(s,this.j,this.H);!l&&a&&i("url",s)}stop(){this.W=""}},Ro=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=bo;return Ie(this.linkedFlag)&&(t=wo),this.linkedFlagSeen&&(t=_o),t}onConfig(t,e){var i;if(this.linkedFlag=(Io(t)?Se(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!Ie(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=Pe(e)?!0===e:i?e===i:!!e}const o=r&&!this.linkedFlagSeen;this.linkedFlagSeen=r,o&&e(t,i)})}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.J()}},Po=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(Io(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 ko(this._instance,this.K.length,this.V,W,z,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)===_o,s=this.K.includes(t);!n&&s&&e("event",t)}stop(){}},Oo=class{constructor(t,e,i){if(this._instance=t,this.group=e,this.Y=new Mo(t,e.id),this.tt=new Po(t,e.id),this.et=new Ro(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 $o(s):new To(s)}else this.nt=new Eo}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===bo).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 Ao(t){if(t.rrwebError)return yo;if(!t.receivedFlags)return po;if(!t.isRecordingEnabled)return co;if(t.urlTriggerMatching.urlBlocked)return go;const e=!0===t.isSampled,i=new $o([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?vo:"trigger_activated"===i?fo:"trigger_pending"===i?po:!1===t.isSampled?co:fo}function Fo(t){if(t.rrwebError)return yo;if(!t.receivedFlags)return po;if(!t.isRecordingEnabled)return co;if(t.urlTriggerMatching.urlBlocked)return go;const e=new To([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),i=e!==wo,n=Pe(t.isSampled);return i&&"trigger_pending"===e?po:i&&"trigger_disabled"===e||n&&!t.isSampled?co:!0===t.isSampled?vo:fo}function Do(){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 Lo(t){const e=JSON.stringify(t,Do());return e?new Blob([e]).size:0}function No(t){if(Ee(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)||Ee(n)?4:No(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+No(s))}return i}default:return 0}}function qo(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[qo({size:i.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),qo({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 Bo=Uint8Array,jo=Uint16Array,Ho=Uint32Array,Uo=new Bo([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]),zo=new Bo([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]),Wo=new Bo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Vo=function(t,e){for(var i=new jo(31),n=0;31>n;++n)i[n]=e+=1<<t[n-1];var s=new Ho(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]},Go=Vo(Uo,2),Zo=Go[1];Go[0][28]=258,Zo[258]=28;for(var Qo=Vo(zo,0)[1],Jo=new jo(32768),Ko=0;32768>Ko;++Ko){var Yo=(43690&Ko)>>>1|(21845&Ko)<<1;Jo[Ko]=((65280&(Yo=(61680&(Yo=(52428&Yo)>>>2|(13107&Yo)<<2))>>>4|(3855&Yo)<<4))>>>8|(255&Yo)<<8)>>>1}var Xo=function(t,e,i){for(var n=t.length,s=0,r=new jo(e);n>s;++s)++r[t[s]-1];var o,l=new jo(e);for(s=0;e>s;++s)l[s]=l[s-1]+r[s-1]<<1;if(i){o=new jo(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[Jo[c]>>>a]=u}else for(o=new jo(n),s=0;n>s;++s)o[s]=Jo[l[t[s]-1]++]>>>15-t[s];return o},tl=new Bo(288);for(Ko=0;144>Ko;++Ko)tl[Ko]=8;for(Ko=144;256>Ko;++Ko)tl[Ko]=9;for(Ko=256;280>Ko;++Ko)tl[Ko]=7;for(Ko=280;288>Ko;++Ko)tl[Ko]=8;var el=new Bo(32);for(Ko=0;32>Ko;++Ko)el[Ko]=5;var il=Xo(tl,9,0),nl=Xo(el,5,0),sl=function(t){return(t/8|0)+(7&t&&1)},rl=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var n=new(t instanceof jo?jo:t instanceof Ho?Ho:Bo)(i-e);return n.set(t.subarray(e,i)),n},ol=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8},ll=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8,t[n+2]|=i>>>16},al=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 Bo(0),0];if(1==s){var o=new Bo(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 jo(d+1),f=ul(i[h-1],v,0);if(f>e){n=0;var p=0,g=f-e,m=1<<g;for(r.sort(function(t,e){return v[e.s]-v[t.s]||t.f-e.f});s>n;++n){var y=r[n].s;if(e>=v[y])break;p+=m-(1<<f-v[y]),v[y]=e}for(p>>>=g;p>0;){var _=r[n].s;e>v[_]?p-=1<<e-v[_]++-1:++n}for(;n>=0&&p;--n){var b=r[n].s;v[b]==e&&(--v[b],++p)}f=e}return[new Bo(v),f]},ul=function(t,e,i){return-1==t.s?Math.max(ul(t.l,e,i+1),ul(t.r,e,i+1)):e[t.s]=i},hl=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new jo(++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]},cl=function(t,e){for(var i=0,n=0;e.length>n;++n)i+=t[n]*e[n];return i},dl=function(t,e,i){var n=i.length,s=sl(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)},vl=function(t,e,i,n,s,r,o,l,a,u,h){ol(e,h++,i),++s[256];for(var c=al(s,15),d=c[0],v=c[1],f=al(r,15),p=f[0],g=f[1],m=hl(d),y=m[0],_=m[1],b=hl(p),w=b[0],k=b[1],S=new jo(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=al(S,7),T=C[0],E=C[1],I=19;I>4&&!T[Wo[I-1]];--I);var M,R,P,O,A=u+5<<3,F=cl(s,tl)+cl(r,el)+o,D=cl(s,d)+cl(r,p)+o+14+3*I+cl(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(F>=A&&D>=A)return dl(e,h,t.subarray(a,a+u));if(ol(e,h,1+(F>D)),h+=2,F>D){M=Xo(d,v,0),R=d,P=Xo(p,g,0),O=p;var L=Xo(T,E,0);for(ol(e,h,_-257),ol(e,h+5,k-1),ol(e,h+10,I-4),h+=14,x=0;I>x;++x)ol(e,h+3*x,T[Wo[x]]);h+=3*I;for(var N=[y,w],q=0;2>q;++q){var B=N[q];for(x=0;B.length>x;++x)ol(e,h,L[j=31&B[x]]),h+=T[j],j>15&&(ol(e,h,B[x]>>>5&127),h+=B[x]>>>12)}}else M=il,R=tl,P=nl,O=el;for(x=0;l>x;++x)if(n[x]>255){var j;ll(e,h,M[257+(j=n[x]>>>18&31)]),h+=R[j+257],j>7&&(ol(e,h,n[x]>>>23&31),h+=Uo[j]);var H=31&n[x];ll(e,h,P[H]),h+=O[H],H>3&&(ll(e,h,n[x]>>>5&8191),h+=zo[H])}else ll(e,h,M[n[x]]),h+=R[n[x]];return ll(e,h,M[256]),h+R[256]},fl=new Ho([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),pl=new Bo(0),gl=function(){for(var t=new Ho(256),e=0;256>e;++e){for(var i=e,n=9;--n;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),ml=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function yl(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=gl[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 Bo(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=dl(a,u,t.subarray(h,c)):(a[h]=r,u=dl(a,u,t.subarray(h,o)))}else{for(var d=fl[e-1],v=d>>>13,f=8191&d,p=(1<<i)-1,g=new jo(32768),m=new jo(p+1),y=Math.ceil(i/3),_=2*y,b=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<_)&p},w=new Ho(25e3),k=new jo(288),S=new jo(32),x=0,C=0,T=(h=0,0),E=0,I=0;o>h;++h){var M=b(h),R=32767&h,P=m[M];if(g[R]=P,m[M]=R,h>=E){var O=o-h;if((x>7e3||T>24576)&&O>423){u=vl(t,a,0,w,k,S,C,T,I,h-I,u),T=x=C=0,I=h;for(var A=0;286>A;++A)k[A]=0;for(A=0;30>A;++A)S[A]=0}var F=2,D=0,L=f,N=R-P&32767;if(O>2&&M==b(h-N))for(var q=Math.min(v,O)-1,B=Math.min(32767,h),j=Math.min(258,O);B>=N&&--L&&R!=P;){if(t[h+F]==t[h+F-N]){for(var H=0;j>H&&t[h+H]==t[h+H-N];++H);if(H>F){if(F=H,D=N,H>q)break;var U=Math.min(N,H-2),z=0;for(A=0;U>A;++A){var W=h-N+A+32768&32767,V=W-g[W]+32768&32767;V>z&&(z=V,P=W)}}}N+=(R=P)-(P=g[R])+32768&32767}if(D){w[T++]=268435456|Zo[F]<<18|Qo[D];var G=31&Zo[F],Z=31&Qo[D];C+=Uo[G]+zo[Z],++k[257+G],++S[Z],E=h+F,++x}else w[T++]=t[h],++k[t[h]]}}u=vl(t,a,r,w,k,S,C,T,I,h-I,u),r||(u=dl(a,u,pl))}return rl(l,0,n+sl(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&&ml(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),ml(u,h-8,i.d()),ml(u,h-4,n),u}function _l(t,e){var i=t.length;if(!e&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new Bo(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 Bo(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 rl(n,0,s)}function bl(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 wl=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=No(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,$:zs}),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=Me(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 kl=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 Me(t)&&isFinite(t)&&Math.floor(t)===t});var Sl=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}},xl=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 Me(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 Sl.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 $l}};let Cl=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&&(Cl=t=>crypto.getRandomValues(t));var $l=class{nextUint32(){return this.Rt.length>this.$t||(Cl(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let Tl;const El=()=>Il().toString(),Il=()=>(Tl||(Tl=new xl)).generate();let Ml="";const Rl=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Pl=null;const Ol={Et(){if(!Ee(Pl))return Pl;if(Pl=!1,n)try{const t=`__ph_cookie_support_${El()}`;Ol.At(t,"xyz"),Pl='"xyz"'===kl(t),Ol.Lt(t)}catch(t){Pl=!1}return Pl},Pt(t){zs.error("cookieStore error: "+t)},Ot:kl,Dt(t){let e;try{e=JSON.parse(Ol.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(Ml)return Ml;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_"+El();for(;!Ml&&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",Ml=t)}return Ml}(t);if(!e){const i=(t=>{const e=t.match(Rl);return e?e[0]:""})(t);i!==e&&zs.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&&zs.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{Ol.At(t,"",-1,e)}catch(t){return}}};let Al=null;const Fl={Et(){if(!Ee(Al))return Al;let e=!0;if(Ce(t))e=!1;else try{const t="__mplssupport__";Fl.At(t,"xyz"),'"xyz"'!==Fl.Ot(t)&&(e=!1),Fl.Lt(t)}catch(t){e=!1}return e||zs.error("localStorage unsupported; falling back to cookie store"),Al=e,e},Pt(t){zs.error("localStorage error: "+t)},Ot(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Fl.Pt(t)}return null},Dt(t){try{return JSON.parse(Fl.Ot(t))||{}}catch(t){}return null},At(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Fl.Pt(t)}return!1},Lt(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Fl.Pt(t)}}},Dl=[rt,K,J,X,tt,et,St,kt,bt],Ll=[p,f,B,j,Mt,It,b,xt],Nl=t=>t+"_cpm",ql=["__proto__","constructor","prototype"],Bl=t=>{if(!Se(t))return{};const e={};return Object.keys(t).forEach(i=>{-1===ql.indexOf(i)&&(e[i]=t[i])}),e},jl=(t,e=[])=>{const i={};return[...Ll,...e].forEach(e=>{const n=t[e];Ce(n)||Ee(n)||""===n||(i[e]=n)}),i},Hl=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)},Ul=(t,e)=>({p:e,f:Hl(JSON.stringify(t))}),zl=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const i=Ol.Dt(Nl(t)),n=(null==i?void 0:i.f)===Hl(e)&&we(i.p);return{properties:n?i.p:[],isValid:n}}catch(t){return{properties:[],isValid:!1}}},Wl=(t,e)=>e+"|"+(Ol.Ot(Nl(t))||""),Vl={},Gl={Et:()=>!0,Pt(t){zs.error("memoryStorage error: "+t)},Ot:t=>t in Vl?Vl[t]:null,Dt:t=>t in Vl?Vl[t]:null,At:(t,e)=>(Vl[t]=e,!0),Lt(t){delete Vl[t]}};let Zl=null;const Ql={Et(){if(!Ee(Zl))return Zl;if(Zl=!0,Ce(t))Zl=!1;else try{const t="__support__";Ql.At(t,"xyz"),'"xyz"'!==Ql.Ot(t)&&(Zl=!1),Ql.Lt(t)}catch(t){Zl=!1}return Zl},Pt(t){zs.error("sessionStorage error: ",t)},Ot(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Ql.Pt(t)}return null},Dt(t){try{return JSON.parse(Ql.Ot(t))||null}catch(t){}return null},At(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Ql.Pt(t)}return!1},Lt(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Ql.Pt(t)}}};Hs.DEBUG=!1,Hs.LIB_VERSION="1.431.3",Hs.LIB_NAME="web";var Jl=Hs,Kl=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)&&Me(i.size)&&e.sessionId===t?e.size:0;var i}};function Yl(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,zs)}function Xl(t){return`$survey_response_${t}`}function ta(t,e){if(!e)return null;const i=t[Xl(e)];return we(i)?[...i]:i}function ea(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=ta(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:ta(t,e.id)}})},t),n)}function ia(t={}){return Object.values(t).some(t=>!Ie(t))}function na(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 sa(t){return"string"==typeof t&&t.trim()?t.trim():null}function ra(t){return t.toLowerCase()}function oa(t,e,i){if(!t||!e)return null;const n=ra(e),s=Object.keys(t).find(t=>ra(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=>ra(t)===s);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${e})`),r}return null}const la=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function aa(t,e,i){var n;const s=oa(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 la){const n=e[i];Ce(n)||(t[i]=n,o=!0)}r.appearance=t}else(function(t){return la.some(e=>!Ce(t[e]))})(e)&&(o=!0)}const a=t.questions.map(t=>function(t,e,i){var n;const s=oa(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 ua(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 ha(t){var e;return ua(t)&&!!(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e?void 0:e.repeatedActivation)||"always"===t.schedule}const ca=(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}},da=t=>t.toLowerCase(),va={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=>ca(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!ca(e,t))),icontains:(t,e)=>e.map(da).some(e=>t.map(da).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(da).every(e=>t.map(da).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 fa(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=va[i.operator];return!!s&&s(i.values,[String(n)])})}function pa(t,e,i){return sr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}const ga=new Set(["is_not","not_icontains","not_regex"]);function ma(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)||Ee(s))return ga.has(r);const o=va[r];return!!o&&!Ce(t.value)&&!Ee(t.value)&&o(we(t.value)?t.value.map(String):[String(t.value)],we(s)?s.map(String):[String(s)])})}const ya=Ws("[SessionRecording]");function _a(t,e){return e?t:"!"+t}function ba(t,e){return t===e||t!=="!"+e&&null}var wa=class{constructor(t,e,i,n,s,r,o){this._instance=t,this.Y=e,this.tt=i,this.et=n,this.qt=s,this.jt=r,this.Bt=o,this.Ht=null,this.zt=Fo}onRemoteConfig(t){this.Ht=Me(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ut=new $o([this.tt,this.Y]),this.zt=Ao):(this.Ut=new To([this.tt,this.Y]),this.zt=Fo),this._instance.register_for_session({[Bt]:t.triggerMatchType}),this.Y.onConfig(t),this.tt.onConfig(t),this.et.onConfig(t,(t,e)=>{this.qt("linked_flag_matched",{flag:t,variant:e}),this.Bt()})}getStatus(t){return this.zt({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){const e=this._instance.get_property("$session_recording_remote_config"),i=null==e?void 0:e.minimumDurationMilliseconds;return Me(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&&Ie(this.Wt))return this.Wt=t(t=>{try{this.tt.checkEventTriggerConditions(t.event,i,e)}catch(t){ya.error("Could not activate event trigger",t)}}),this.Wt}makeSamplingDecisions(t){var e;const i=this.Ht;var n,s;if(!Me(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(j),o=this._instance.get_property(F),l=ba(r,t),a=Me(o)&&o!==i,u=Ce(o)&&r===t,h=a||u||!Pe(l),c=h?Yl(t,i):l;h&&(c?this.qt("sampled"):ya.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:_a(t,c),$replay_sample_rate:Ee(o)&&r===t?null:i})}ensureSamplingDecision(t){if(!Me(this.Ht))return;const e=this._instance.get_property(j);Pe(ba(e,t))||this.makeSamplingDecisions(t)}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,i,n,s;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_recording_event_trigger_activated_session"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_recording_url_trigger_activated_session"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_is_sampled"),null===(n=this._instance.persistence)||void 0===n||n.unregister("$replay_sample_rate"),null===(s=this._instance.persistence)||void 0===s||s.unregister("$session_past_minimum_duration")}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null===(e=this.Ut)||void 0===e?void 0:e.triggerStatus(t))===bo}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===bo).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()}},ka=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({[Bt]:"v2_trigger_groups",[jt]:t.triggerGroups.length}),this.Y.onConfig(t)):ya.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return yo;if(!t.receivedFlags)return po;if(!t.isRecordingEnabled)return co;if(t.urlTriggerMatching.urlBlocked)return go;const e=t.triggerGroupMatchers,i=t.triggerGroupSamplingResults;if(0===e.length)return co;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)?zs.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(s=!0)}else"trigger_pending"===e&&(n=!0)}return s?vo:n?po:co}({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;Me(t)&&(Ee(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 ya.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||ma(e.properties,t.properties,r))&&(i.activateTrigger(n,e),this.updateActiveTriggers(e),this.Bt(n))},e)}catch(t){ya.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=Me(i)&&i!==r,a=e===t&&Me(i)&&i===r&&Pe(n)?n:null}else a=l===t||null,u="string"==typeof l&&l!==t,c=l===t;const d=u||h||c||!Pe(a),v=d?Yl(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||ma(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 Oo(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 Sa=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],xa=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Sa],Ca="<masked>",$a=["li_fat_id"];function Ta(t,e,i){if(!n)return{};const s=e?[...Sa,...i||[]]:[],r=Ea(ar(n.URL,s,Ca),t),o=function(){const t={};return Gs($a,function(e){const i=kl(e);t[e]=i||null}),t}();return Zs(o,r)}function Ea(t,e){const i=xa.concat(e||[]),n={};return Gs(i,function(e){const i=lr(t,e);n[e]=i||null}),n}function Ia(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(!Ee(e)){s.$search_engine=e;const t=n?lr(n.referrer,i):"";t.length&&(s.ph_keyword=t)}return s}function Ma(){return navigator.language||navigator.userLanguage}function Ra(){const t=Ma();return"string"==typeof t?t.split("-")[0]:void 0}const Pa="$direct";function Oa(){return(null==n?void 0:n.referrer)||Pa}function Aa(t,e,i=!1){const n=t?[...Sa,...e||[]]:[],r=i?rn(null==s?void 0:s.href):null==s?void 0:s.href,o=null==r?void 0:r.substring(0,1e3);return{r:Oa().substring(0,1e3),u:o?ar(o,n,Ca):void 0}}function Fa(t,e=!1){var i;const{r:n,u:s}=t,r=e?rn(s):s,o={$referrer:n,$referring_domain:null==n?void 0:n==Pa?Pa:null===(i=rr(n))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const t=rr(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const e=Ea(r);Zs(o,e)}if(n){const t=Ia(n);Zs(o,t)}return o}function Da(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function La(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const Na=1e5,qa=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Ba=[],ja=()=>!1,Ha="@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(" "),Ua="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),za="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(" "),Wa="Accommodation AdministrativeArea Country Place State".split(" "),Va={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:Ua,publisher:za},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Ba},Offer:{seller:za},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:za,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:za,areaServed:Wa,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Ba}},Ga=[["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(" "),Va.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Va.Event],[za,Va.Organization],[Wa,Va.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Va.Product]];function Za(t,e){return _e.call(t,e)?t[e]:void 0}function Qa(t){const e=typeof t;return Ee(t)||"string"===e||"number"===e||"boolean"===e}function Ja(t,e){return e&&function(t){return $e(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function Ka(t,e){return we(t)&&t.every(Qa)?t.map(t=>Ja(t,e)).filter(t=>!Ce(t)):Qa(t)?Ja(t,e):void 0}function Ya(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 Xa(t){if(_e.call(Va,t))return Va[t];for(const[e,i]of Ga)if(e.includes(t))return i}function tu(t,e,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0})}function eu(t,e,i,n){if(we(t)){const s=t.map(t=>eu(t,e,i,n)).filter(t=>!Ce(t));return s.length?s:void 0}return iu(t,e,i,n)||void 0}function iu(t,e,i,n){if(!Se(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(i))return null;const s=Za(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&&qa.test(i)&&!e.has(i)&&(e.add(i),n.push(i),20===n.length))break}return n}(s),o=r.filter(t=>!!Xa(t)&&(!n||!n.length||n.includes(t))),l={};for(const n of Ha){const o="@type"===n?r.length?"string"==typeof s?r[0]:r:void 0:"@id"===n?Ya(Za(t,n),e):Ka(Za(t,n),i.maskUrl);Ce(o)||tu(l,n,o)}for(const n of o){const s=Xa(n);for(const n of Object.keys(s)){const r=Za(t,n),o=s[n];if(!0===o){const t=Ka(r,i.maskUrl);Ce(t)||tu(l,n,t)}else{const t=eu(r,e,i,o);Ce(t)||tu(l,n,t)}}}const a=eu(Za(t,"@graph"),e,i);return Ce(a)||tu(l,"@graph",a),Object.keys(l).length?l:null}function nu(t,e,i){if(!Se(t))return null;const n=Za(t,"@context");if("string"!=typeof n||!/^https?:\/\/schema\.org\/?$/.test(n))return null;const s=iu(t,e,i);return s?le({"@context":"https://schema.org"},s):null}function su(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function ru(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 ou(t,e,i){for(let n=t;n;){if(ru(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 lu(t){return su(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(su)}function au(t){return Ce(t)?void 0:Math.round(t)}function uu(t){return Se(t)?t.network_timing:t}const hu=Ws("[SessionRecording]"),cu=[1,2,3,4,5,6,7,12],du=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function vu(){var t;return null==d||null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function fu(){var t;return null===(t=vu())||void 0===t?void 0:t.record}function pu(t){try{return JSON.stringify(t)}catch(e){return JSON.stringify(t,Do())}}function gu(t){return bl(yl(_l(pu(t))),!0)}function mu(t){return yu.apply(this,arguments)}function yu(){return(yu=ne(function*(t){const e=yield ds(pu(t),Jl.DEBUG,{rethrow:!0});return bl(new Uint8Array(yield e.arrayBuffer()),!0)})).apply(this,arguments)}let _u,bu;const wu="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let ku=!1;function Su(t){var e;return we(t)&&0===t.length?(_u=null!==(e=_u)&&void 0!==e?e:gu([]),_u):gu(t)}function xu(t){return Cu.apply(this,arguments)}function Cu(){return(Cu=ne(function*(t){var e;return we(t)&&0===t.length?_u||(bu=null!==(e=bu)&&void 0!==e?e:mu([]).then(t=>(_u=t,t)).catch(t=>{throw _u=void 0,bu=void 0,t}),bu):mu(t)})).apply(this,arguments)}function $u(t){return wu&&!ku&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function Tu(t){return{event:t,size:No(t)}}function Eu(t,e){return le(le({},t),{},{data:e,cv:"2024-10"})}function Iu(t,e){return le(le({},t),{},{cv:"2024-10",data:le(le({},t.data),e)})}function Mu(t){try{if(2===t.type)return Tu(Eu(t,gu(t.data)));if(3===t.type&&0===t.data.source)return Tu(Iu(t,{texts:Su(t.data.texts),attributes:Su(t.data.attributes),removes:Su(t.data.removes),adds:Su(t.data.adds)}));if(3===t.type&&8===t.data.source)return Tu(Iu(t,{adds:t.data.adds?gu(t.data.adds):void 0,removes:t.data.removes?gu(t.data.removes):void 0}))}catch(t){hu.error("could not compress event - will use uncompressed event",t)}return{event:t,size:Lo(t)}}function Ru(){return Ru=ne(function*(t){try{if(2===t.type)return Tu(Eu(t,yield mu(t.data)));if(3===t.type&&0===t.data.source){const[e,i,n,s]=yield Promise.all([xu(t.data.texts),xu(t.data.attributes),xu(t.data.removes),xu(t.data.adds)]);return Tu(Iu(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?mu(t.data.adds):void 0,t.data.removes?mu(t.data.removes):void 0]);return Tu(Iu(t,{adds:e,removes:i}))}}catch(e){return ls(e)&&(ku=!0),hu.error("could not compress event asynchronously - trying synchronous compression",e),Mu(t)}return{event:t,size:Lo(t)}}),Ru.apply(this,arguments)}function Pu(t,e){return 5===t.type&&t.data.tag===e}function Ou(t){return Pu(t,"sessionIdle")}function Au(t){return Pu(t,"$session_ending")}function Fu(t){return Pu(t,"$session_starting")}var Du=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 ba(this._instance.get_property(j),this.sessionId)}get Ht(){var t;const e=null===(t=this.ne)||void 0===t?void 0:t.sampleRate;return Me(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=vu())||void 0===s||null===(r=s.resetMaxDepthState)||void 0===r||r.call(s),this.Vt("$session_id_change",{sessionId:t,windowId:e,changeReason:i}),this.ze(),!(!1===this.de&&this.isStarted||this.Xt===t&&this.Be===e)){const e=this.Xt!==t&&!1!==this.de;this.de="unknown",this.Ue(e)}l&&this.Vt("$session_starting",{previousSessionId:a,previousWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le}),null===(o=this.re)||void 0===o||o.makeSamplingDecisions(t)},this.We=!1,this.Ve=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[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 Me(i)&&Me(n)?n-i:null},this.Ge=()=>{var t,e;const i=this.ie;if(!Me(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 Me(t)&&t>=0&&i>t}if(this.Ve())return!1;const n=this.Ze();return!!Ee(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 Ro(this._instance),this.Y=new Mo(this._instance),this.tt=new Po(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||hu.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 Kl(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(Ie(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,hu.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,Ws("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,Ws("canvas recording fps"),4),quality:Ve(c,0,1,Ws("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=uu(this._instance.config.capture_performance),a=uu(null==n?void 0:n.capturePerformance),u=!!(Pe(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(!nr.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:io.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...io.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...io.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=eo(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=ao(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=ao(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=rr(t.name);let r=0===e.indexOf("http")?null===(n=rr(e))||void 0===n?void 0:n.pathname:e;"/"===r&&(r="");const o=null==s?void 0:s.pathname.replace(r||"","");return s&&o&&lo.some(t=>0===o.indexOf(t))?void 0:t})((oo((n=e).requestHeaders),oo(n.responseHeaders),n),t.api_host,i));var n},u=ke(t.session_recording.maskNetworkRequestFn);return u&&ke(t.session_recording.maskCapturedNetworkRequestFn)&&zs.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 Ie(o)&&r?(ho.add(r),r):null!=o?o:void 0}:t=>function(t){if(!Ce(t))return t.requestBody=uo(t.requestBody,"Request"),t.responseBody=uo(t.responseBody,"Response"),t}(a(t)),le(le(le({},io),n),{},{recordHeaders:s,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.vn,t)))}else hu.info("NetworkCapture not started because we are on localhost.");return i}mn(t){return this._instance.config.disable_capture_url_hashes?rn(t):t}gn(t,e=!1){const i=e?rn(t):this.mn(t),n=this._instance.config.mask_personal_data_properties?[...Sa,...this._instance.config.custom_personal_data_properties||[]]:[];return this.yn(ar(i,n,Ca))}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}):hu.warn("could not emit queued rrweb event.",e,t),!1}}Vt(t,e){return this.bn(du(()=>fu().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=fu();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(du(()=>fu().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 Me(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),hu.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"}),hu.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?U:z;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(O);if(!t)return;let e;try{e=Se(t)?t:JSON.parse(t)}catch(t){return void hu.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.We){var i;const n=null!==(i=e.cache_timestamp)&&void 0!==i?i:Date.now();if(Date.now()-n>36e5)return void hu.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t})}return e}Ln(t,e,i){this._instance.get_property(t)&&(e(),i())}start(e){var i,s;const r=this.ne;if(!r)return void hu.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 ka(this._instance,this.Y,this.qt.bind(this),this.Vt.bind(this),this.Bt.bind(this)):new wa(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||(er(t,"beforeunload",this.Je),er(t,"pagehide",this.nn),er(t,"offline",this.rn),er(t,"online",this.sn),er(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.ze(),this.de="unknown",this.stop(),this.qe=this.Yt.onSessionId((t,e,i)=>{var n;null===(n=this.qe)||void 0===n||n.call(this),this.qe=void 0,this.je(t,e,i)})}):ke(this.Yt.on)||hu.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Ie(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){hu.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){hu.warn("could not stop rrweb",t)}this.se=void 0}zn(){if(!this.Bn||0===this.Oe)return!1;if(this.Pe)return!0;this.Pe=!0,this.Un=void 0;const t=this.Le;return this.qn(),this.jn(),this.Bn.catch(()=>{}).then(()=>{t===this.Le&&(this.Pe=!1,this.tn(),this.en(),this.Wn(),this.Nn(),hu.info("stopped"))}).catch(()=>{this.Pe=!1,this.Wn(),this.Nn(),hu.info("stopped")}),!0}stop(){if(this.jn(),this.We)this.Ye();else if(this.zn())return;this.tn(),this.en(),this.Wn(),this.Nn(),hu.info("stopped")}Wn(){this.Xe(void 0,{preserveLogDedup:this.We}),this.ge=!1}flushBeforeIdentityReset(){(this.isStarted||this.Pe)&&(this.Ye(),this.tn())}Ue(t){this.We=!0,this.le=Date.now();try{var e,i;this.stop(),this.Vn=void 0,this.Zn=void 0,this.fe=0,this.ve=0,this.pe=0,null===(e=vu())||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.Un=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,hu.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(),hu.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,hu.error("could not track full snapshot cost",t))}}ti(){var t,e;const i=null===(t=vu())||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||hu.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,hu.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=Lo(t.event);if(t.compressionEnabled)try{({event:e,size:i}=Mu(t.event))}catch(t){hu.error("could not process queued compression event - will use uncompressed event",t)}try{this.ni(t,e,i)}catch(t){hu.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?$u(t)?yield function(t){return Ru.apply(this,arguments)}(t):Mu(t):{event:t,size:Lo(t)};i=s.event,n=s.size}catch(e){hu.error("could not process queued compression event - will use uncompressed event",e),i=t,n=Lo(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=vu())||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 Au(t)?t.data.payload:null}(m),_=function(t){return Fu(t)?t.data.payload:null}(m),b=function(t){return Ou(t)?t.data.payload:null}(m);y||_?(null==y?void 0:y.lastActivityTimestamp)&&(m.timestamp=y.lastActivityTimestamp):(null==b?void 0:b.sessionId)||this.si(m),2===e.type&&(this.Te.push([this.Xt,e.timestamp]),this.Te.length>6&&(this.Te=this.Te.slice(-6)));const w=null!==(s=null!==(r=null!==(o=null==y?void 0:y.currentSessionId)&&void 0!==o?o:null==_?void 0:_.nextSessionId)&&void 0!==r?r:null==b?void 0:b.sessionId)&&void 0!==s?s:this.Xt,k=null!==(l=null!==(a=null!==(u=null==y?void 0:y.currentWindowId)&&void 0!==u?u:null==_?void 0:_.nextWindowId)&&void 0!==a?a:null==b?void 0:b.windowId)&&void 0!==l?l:this.Be;if(!0===this.de&&!function(t){return Ou(t)||Au(t)||Fu(t)}(m))return void(function(t){return 2===t.type||4===t.type||3===t.type&&9!==t.data.source}(m)&&this.he++);2===m.type&&(this.he=0),b&&(m.timestamp=b.lastActivityTimestamp+b.threshold);const S=this.ae;this.ae=!0,p?this._n(!0):S||this._n();const x=null===(h=this._instance.config.session_recording.compress_events)||void 0===h||h;if(5===m.type&&"$json_ld"===m.data.tag){let e;try{e=t?this.gn(t.location.href):void 0}catch(t){}m.data.href=e}if(this.Oe>0||x&&$u(m))return void this.ri(m,x,w,k);const{event:C,size:T}=x?Mu(m):{event:m,size:Lo(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}):co}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)&&!Au(t)&&!Fu(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}),hu.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)&&Ql.Et()}mi(){0!==this.Rt.data.length&&this.Rt.size!==this.gi&&943718.4>=this.Rt.size&&this.fi()&&(this.gi=this.Rt.size,Ql.At(this.ln,this.Rt))}Dn(){if(this.Ee||!this.fi())return;this.Ee=!0;const t=Ql.Dt(this.ln);Ql.Lt(this.ln),Se(t)&&we(t.data)&&0!==t.data.length&&we(t.sizes)&&t.sizes.length===t.data.length&&Me(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();qo(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:Jl.LIB_NAME,$lib_version:Jl.LIB_VERSION,$snapshot_host:t})}catch(t){hu.warn("could not capture snapshot chunk - skipping it",t)}}),Ce(this.gi)||(Ql.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}),hu.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!==cu.indexOf(null===(e=t.data)||void 0===e?void 0:e.source)}si(t){const e=this.bi(t);e||!0===this.de||t.timestamp-this.le>this.te&&(this.de=!0,clearInterval(this.Rn),this.Vt("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.le,threshold:this.te,bufferLength:this.Rt.data.length,bufferSize:this.Rt.size,sessionId:this.Xt,windowId:this.Be}),this.tn());const{windowId:i,sessionId:n}=this.Yt.checkAndGetSessionAndWindowId(!e,t.timestamp);let s=!1;if(e&&(this.le=t.timestamp,this.de)){const e="unknown"===this.de;this.de=!1,e||(this.Vt("sessionNoLongerIdle",{reason:"user activity",type:t.type}),s=!0)}const r=this.Xt!==n,o=this.Be!==i;if(this.Be=i,this.Xt=n,r||o){const t=r&&!1!==this.de;t&&(this.de="unknown"),this.Ue(t)}else if(e&&this.$n(),s){var l;const t=["sampled","active"].includes(this.status)||(null===(l=this.re)||void 0===l?void 0:l.hasPendingTriggers(this.sessionId));this.he>0&&t&&this.jt(),this._n(),this.Tn()}}ze(){var t;null===(t=this.re)||void 0===t||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e,i,n,s,r,o,l,a,u,h,c;const d=null===(t=vu())||void 0===t||null===(e=t.getDeferredStylesheetStats)||void 0===e?void 0:e.call(t);return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this.Un,$sdk_debug_replay_internal_buffer_length:this.Rt.data.length,$sdk_debug_replay_internal_buffer_size:this.Rt.size,$sdk_debug_current_session_duration:this.Qe,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(i=this.He)||void 0===i?void 0:i.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Te,$snapshot_max_depth_exceeded:this._e,$sdk_debug_replay_slowest_full_snapshot_ms:au(null===(n=this.Vn)||void 0===n?void 0:n.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:au(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:au(null==d?void 0:d.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:au(null==d?void 0:d.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:au(null===(a=vu())||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=vu())||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,[Ut]:!!this.se,[zt]: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,hu.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,hu.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=fu();if(!u)return void hu.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 wl(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`;hu.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,hu.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},i)),!this.se)return this.we=!0,void hu.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=Na;const o=function(t,e){const i=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?ja:i=>{const n=t.getElementById(i);return!!n&&"SCRIPT"!==n.nodeName&&(!e.isRecordedElement||e.isRecordedElement(n))&&!ou(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 ou(t,e.blockClass,e.blockSelector)||ou(t,e.maskTextClass,e.maskTextSelector)}(e,i))return;const a=function(t,e=ja,i){if(!t||t.length>Na)return null;try{const n=JSON.parse(t),s={maskUrl:i,remainingNodes:2048,exceeded:!1},r=we(n)?n.map(t=>nu(t,e,s)):nu(n,e,s);if(s.exceeded||Ee(r)||we(r)&&(!r.length||r.some(Ee)))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(Ee(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 lu(t))l(e)};for(const i of t)if("childList"===i.type)su(i.target)&&l(i.target),i.addedNodes.forEach(e);else if("characterData"===i.type){const t=i.target.parentNode;t&&su(t)&&l(t)}else"attributes"===i.type&&su(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()&&lu(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=Pe(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 Lu=["type"];var Nu=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}({}),qu=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}({}),Bu=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}({}),ju=function(t){return t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t}({}),Hu=function(t){return t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t}({}),Uu=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}({}),zu=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 Wu(t,e){return-1!==t.indexOf(e)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var Vu={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Gu={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Zu={};function Qu(t){if(Zu[t])return Zu[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 Vu?Vu[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 Gu?Gu[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 Zu[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 Wu(t,"AppleWebKit")&&!Wu(t,"Chrome")}(navigator.userAgent)&&(l.classList.add("rr-block","ph-no-capture"),l.setAttribute("__rrwebUntaintedPrototype",t),a=!0),Zu[t]=s):i}catch(t){return i}finally{!a&&l.parentNode&&document.body.removeChild(l)}}var Ju=Object.create(null);function Ku(t,e,i){var n;const s=Ju[t],r=s[i];if(r)return r.call(e);const o=Qu(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]}Ju.Node=Object.create(null),Ju.ShadowRoot=Object.create(null),Ju.MutationObserver=Object.create(null),Ju.Element=Object.create(null);var Yu,Xu={};function th(t,e,i){const n=`${t}.${String(i)}`;if(Xu[n])return Xu[n].bind(e);const s=Qu(t)[i];return"function"!=typeof s?e[i]:(Xu[n]=s,s.bind(e))}function eh(){return Qu("MutationObserver").constructor}function ih(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 nh={childNodes:t=>Ku("Node",t,"childNodes"),parentNode:t=>Ku("Node",t,"parentNode"),parentElement:t=>Ku("Node",t,"parentElement"),textContent:t=>Ku("Node",t,"textContent"),isConnected(t){if(void 0===Yu){var e;const t=null===(e=Object.getOwnPropertyDescriptor(Qu("Node"),"isConnected"))||void 0===e?void 0:e.get;Yu=(null==t?void 0:t.toString().includes("[native code]"))?t:null}return null==Yu?void 0:Yu.call(t)},contains:(t,e)=>th("Node",t,"contains")(e),getRootNode:t=>th("Node",t,"getRootNode")(),host:t=>t&&"host"in t?Ku("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?Ku("Element",t,"shadowRoot"):null,querySelector:(t,e)=>th("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>th("Element",t,"querySelectorAll")(e),mutationObserver:eh,patch:ih};function sh(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var rh=0;function oh(){rh+=1}function lh(){return rh}function ah(t,e){return(e!==rh||t>6e4)&&!0}var uh=0,hh=0,ch=0,dh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},vh=null,fh=null,ph=[],gh=0,mh=0,yh={slowestBatchMs:0},_h={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function bh(t){(uh+=1)>1||(dh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},ph=[],gh=0,fh=(t=>t&&t>0?t:null)(t),hh=sh(),ch=rh)}function wh(){return 0===uh?vh||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(uh-=1)>0?dh:(dh.durationMs=sh()-hh,dh.deferredStylesheetCount=gh,_h.deferredCount+=gh,fh=null,ah(dh.durationMs,ch)?dh:vh=dh)}function kh(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+=kh(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+=kh(s,e,i+1))}}}catch(t){}}return n}function Sh(t){if(0===uh)return;const e=kh(t,null,0);dh.cssRuleCount+=e,mh>0&&(dh.nonDeferrableCssRuleCount+=e)}function xh(t){mh+=1;try{return t()}finally{mh-=1}}function Ch(t){uh>0&&(dh.stylesheetMs+=t)}function $h(t){if(0===uh||null===fh)return!1;const e=dh.cssRuleCount-dh.nonDeferrableCssRuleCount;return e>=fh||e+function(t){try{const e=t&&(t.rules||t.cssRules);if(!e)return 0;const i=new WeakSet;return i.add(t),kh(e,i,0)}catch(t){return 0}}(t)>fh}function Th(){const t=ph;return ph=[],t}function Eh(){_h.failedCount+=1}function Ih(t){t>0&&(_h.abandonedCount+=t)}function Mh(t){return Mh="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},Mh(t)}function Rh(t,e,i){return(e=function(t){var e=function(t){if("object"!=Mh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Mh(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Mh(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ph(t){return t.nodeType===t.ELEMENT_NODE}function Oh(t){const e=t&&"host"in t&&"mode"in t&&nh.host(t)||null;return Boolean(e&&"shadowRoot"in e&&nh.shadowRoot(e)===t)}function Ah(t){return"[object ShadowRoot]"==={}.toString.call(t)}function Fh(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 Dh(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 Lh=0;function Nh(t){const e=0===Lh,i=e?sh():0;Lh+=1;try{const e=t.rules||t.cssRules;if(!e)return null;Sh(e);let i=t.href;return!i&&t.ownerNode&&(i=t.ownerNode.baseURI),Fh(Array.from(e,t=>qh(t,i)).join(""))}catch(t){return null}finally{Lh-=1,e&&Ch(sh()-i)}}function qh(t,e){if(jh(t)){let e;try{e=Nh(t.styleSheet)||Dh(t)}catch(i){e=t.cssText}try{var i;if(e&&(null===(i=t.styleSheet)||void 0===i?void 0:i.href))return nc(e,t.styleSheet.href)}catch(t){}return e}{let i=t.cssText;return Hh(t)&&t.selectorText.includes(":")&&(i=Bh(i)),e?nc(i,e):i}}function Bh(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function jh(t){return"styleSheet"in t}function Hh(t){return"selectorText"in t}var Uh=/^-?[A-Za-z_][\w-]*$/,zh=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Wh(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||Dh(e)}catch(t){s=e.cssText}try{var n;s&&(null===(n=e.styleSheet)||void 0===n?void 0:n.href)&&(s=nc(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&&jh(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(Hh(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&&!Uh.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]?Uh.test(e.name)?`@keyframes ${e.name} {`:null:""===e.name?"@layer {":zh.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?nc(n,s):n,fixColons:"sheet"===i.kind&&Hh(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(i,t))return;let n=i.cssText;"sheet"===t.kind&&Hh(i)&&i.selectorText.includes(":")&&(n=Bh(n)),t.parts.push(t.sheetHref?nc(n,t.sheetHref):n),t.index+=1}return function(t){try{const i=t.rules||t.cssRules;if(!i)return!1;Sh(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,!jh(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;Sh(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=sh();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?Bh(i):i}else e=Fh(t.parts.join(""))}catch(t){}r(e);continue}o-=1;try{l(t)}catch(t){r(null)}}}catch(t){i=!0,n=null}finally{Ch(sh()-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 Vh=class{constructor(){Rh(this,"idNodeMap",new Map),Rh(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)),Ph(t)){const e=nh.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 Gh({element:t,maskInputOptions:e,tagName:i,type:n,value:s,maskInputFn:r}){let o=s||"";const l=n&&Zh(n);return(e[i.toLowerCase()]||l&&e[l])&&(o=r?r(o,t):"*".repeat(o.length)),o}function Zh(t){return t.toLowerCase()}var Qh=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 Jh({element:t,name:e,value:i,maskAllElementAttributes:n,maskAttributeFn:s,isGenerated:r=!1}){return i?n?r&&Qh.has(Zh(e))?i:"*".repeat(i.length):s?s(e,i,t):i:i}var Kh="__rrweb_original__";function Yh(t){try{const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?Zh(e):null}catch(t){return null}}var Xh=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,tc=/^(?:[a-z+]+:)?\/\//i,ec=/^www\..*/i,ic=/^(data:)([^,]*),(.*)/i;function nc(t,e){return(t||"").replace(Xh,(t,i,n,s,r,o)=>{const l=n||r||o,a=i||s||"";if(!l)return t;if(tc.test(l)||ec.test(l))return`url(${a}${l}${a})`;if(ic.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 sc,rc,oc=new Map,lc=1,ac=new RegExp("[^a-z0-9-_:]");function uc(){return lc++}var hc=/^[^ \t\n\r\u000c]+/,cc=/^[, \t\n\r\u000c]+/,dc=new WeakMap;function vc(t,e){return e&&""!==e.trim()?fc(t,e):e}function fc(t,e){let i=dc.get(t);if(i||(i=t.createElement("a"),dc.set(t,i)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return i.setAttribute("href",e),i.href}function pc(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 gc(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=vc(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=oc.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(oc.size>=10){const t=oc.keys().next().value;void 0!==t&&oc.delete(t)}return oc.set(e,{type:i,quality:n,result:l}),l}catch(t){return e}}(s,i,r.type,r.quality)),pc(t,r)}if("image"===e)return pc(i,r)}return i}if("xlink:href"===i&&"#"!==n[0]){const i=vc(t,n);return"image"===e&&i.startsWith("data:")?pc(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(cc),e.length>i;){let r=n(hc);if(","===r.slice(-1))r=vc(t,r.substring(0,r.length-1)),s.push(r);else{let n="";r=vc(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?nc(n,fc(t)):"object"===e&&"data"===i?vc(t,n):n:vc(t,n)}function mc(t,e,i){return("video"===t||"audio"===t)&&"autoplay"===Zh(e)}function yc(t,e,i){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!i&&yc(nh.parentNode(t),e,i);for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!i&&yc(nh.parentNode(t),e,i)}function _c(t,e,i,n){let s;if(Ph(t)){if(s=t,!nh.childNodes(s).length)return!1}else{if(null===nh.parentElement(t))return!1;s=nh.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(yc(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 bc(t,e,i){const n=t.removeEventListener;"function"==typeof n&&n.call(t,e,i)}var wc=new Map;function kc(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function Sc(t){return null==t?"":t.toLowerCase()}var xc=!1,Cc=!1;function $c(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,maskTextClass:o,maskTextSelector:l,skipChild:a=!1,inlineStylesheet:u=!0,maskInputOptions:h={},maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v=!1,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g={},inlineImages:m=!1,recordCanvas:y=!1,canvasMaskingConfigured:_,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k=5e3,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:T=()=>!1,newlyAddedElement:E=!1,depth:I=0,maxDepth:M=50}=e;let{needsMask:R}=e,{preserveWhiteSpace:P=!0}=e;if(I>=M)return Cc=!0,xc||(xc=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${M}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;R||(R=_c(t,o,l,void 0===R)),uh>0&&(dh.nodeCount+=1);const O=function(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:o,inlineStylesheet:l,maskInputOptions:a={},maskTextFn:u,maskInputFn:h,maskAllElementAttributes:c=!1,maskAttributeFn:d,dataURLOptions:v={},inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y=!1}=e,_=function(t,e){if(!e.hasNode(t))return;const i=e.getId(t);return 1===i?void 0:i}(i,n);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:zu.Document,childNodes:[],compatMode:t.compatMode}:{type:zu.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:zu.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:_};case t.ELEMENT_NODE:return function(t,e){const{doc:i,blockClass:n,blockSelector:s,inlineStylesheet:r,maskInputOptions:o={},maskInputFn:l,maskAllElementAttributes:a=!1,maskAttributeFn:u,dataURLOptions:h={},inlineImages:c,recordCanvas:d,canvasMaskingConfigured:v,keepIframeSrcFn:f,newlyAddedElement:p=!1,rootId:g}=e,m=function(t,e,i){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(i)return t.matches(i)}catch(t){}return!1}(t,n,s),y=function(t){if(t instanceof HTMLFormElement)return"form";const e=Zh(t.tagName);return ac.test(e)?"div":e}(t),_=new Set;let b={};const w=t.attributes.length;for(let e=0;w>e;e++){const n=t.attributes[e];mc(y,n.name)||(b[n.name]=gc(i,y,Zh(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=kc(i,n),!e&&n.includes(".css"))&&(e=kc(i,window.location.origin+"/"+n.replace(window.location.href,"")))}let n=null;e&&($h(e)?uh>0&&(ph.push(t),gh+=1):n=Nh(e)),n&&(delete b.rel,delete b.href,b._cssText=n)}if("style"===y&&t.sheet&&!(t.innerText||nh.textContent(t)||"").trim().length){const e=xh(()=>Nh(t.sheet));e&&(b._cssText=e)}if("input"===y||"textarea"===y||"select"===y){const e=t.value,i=t.checked;"radio"!==b.type&&"checkbox"!==b.type&&"submit"!==b.type&&"button"!==b.type&&e?b.value=Gh({element:t,type:Yh(t),tagName:y,value:e,maskInputOptions:o,maskInputFn:l}):i&&(b.checked=i)}if("option"===y&&(t.selected&&!o.select?b.selected=!0:delete b.selected),"dialog"===y&&t.open){try{b.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){b.rr_open_mode="modal",b.ph_rr_could_not_detect_modal=!0}_.add("rr_open_mode")}if("canvas"===y&&d&&!(null==v?void 0:v()))if("2d"===t.__context)(function(t){const e=t.getContext("2d");if(!e)return!0;for(let i=0;t.width>i;i+=50)for(let n=0;t.height>n;n+=50){const s=e.getImageData;if(new Uint32Array((Kh in s?s[Kh]:s).call(e,i,n,Math.min(50,t.width-i),Math.min(50,t.height-n)).data.buffer).some(t=>0!==t))return!1}return!0})(t)||(b.rr_dataURL=t.toDataURL(h.type,h.quality));else if(!("__context"in t)){const e=t.toDataURL(h.type,h.quality),n=i.createElement("canvas");n.width=t.width,n.height=t.height,e!==n.toDataURL(h.type,h.quality)&&(b.rr_dataURL=e)}let k,S=!1;if("img"===y&&c){sc||(sc=i.createElement("canvas"),rc=sc.getContext("2d"));const e=t,n=e.currentSrc||e.getAttribute("src")||"<unknown-src>",s=e.crossOrigin,r=(e,i)=>S?Jh({element:t,name:e,value:i,maskAllElementAttributes:a,maskAttributeFn:u}):i,o=()=>{bc(e,"load",o);try{sc.width=e.naturalWidth,sc.height=e.naturalHeight,rc.drawImage(e,0,0);const t=sc.toDataURL(h.type,h.quality);b.rr_dataURL=r("rr_dataURL",t)}catch(t){if("anonymous"!==e.crossOrigin)return e.crossOrigin="anonymous",void(e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o));console.warn(`Cannot inline img src=${n}! Error: ${t}`)}"anonymous"===e.crossOrigin&&(s?b.crossOrigin=r("crossOrigin",s):e.removeAttribute("crossorigin"))};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if("audio"===y||"video"===y){const e=b;e.rr_mediaState=t.paused?"paused":"played",_.add("rr_mediaState"),e.rr_mediaCurrentTime=t.currentTime,e.rr_mediaPlaybackRate=t.playbackRate,e.rr_mediaMuted=t.muted,e.rr_mediaLoop=t.loop,e.rr_mediaVolume=t.volume}if(p||(t.scrollLeft&&(b.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(b.rr_scrollTop=t.scrollTop)),m){var x,C,T;const{width:e,height:n,left:s,top:r}=t.getBoundingClientRect(),o=null===(x=i.defaultView)||void 0===x?void 0:x.getComputedStyle(t);b={class:b.class,rr_width:`${e}px`,rr_height:`${n}px`,rr_left:`${Math.floor(s+((null===(C=i.defaultView)||void 0===C?void 0:C.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(T=i.defaultView)||void 0===T?void 0:T.scrollY)||0))}px`},_.add("rr_width"),_.add("rr_height"),_.add("rr_left"),_.add("rr_top"),o&&(b.rr_position=o.position||"static",_.add("rr_position"),o.transform&&"none"!==o.transform&&(b.rr_transform=o.transform,_.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(b.rr_display=o.display,_.add("rr_display")))}if("iframe"!==y||f(b.src)||(t.contentDocument||(b.rr_src=b.src),delete b.src),a||u)for(const[e,i]of Object.entries(b))"string"!=typeof i&&null!==i||(b[e]=Jh({element:t,name:e,value:i,maskAllElementAttributes:a,maskAttributeFn:u,isGenerated:_.has(e)}));S=!0;try{customElements.get(y)&&(k=!0)}catch(t){}return{type:zu.Element,tagName:y,attributes:b,childNodes:[],isSVG:(E=t,Boolean("svg"===E.tagName||E.ownerSVGElement)||void 0),needBlock:m,rootId:g,isCustom:k};var E}(t,{doc:i,blockClass:s,blockSelector:r,inlineStylesheet:l,maskInputOptions:a,maskInputFn:h,maskAllElementAttributes:c,maskAttributeFn:d,dataURLOptions:v,inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y,rootId:_});case t.TEXT_NODE:return function(t,e){const{needsMask:i,maskTextFn:n,rootId:s}=e,r=nh.parentNode(t),o=r&&r.tagName;let l=nh.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($h(r.sheet));else if(null===(h=r.sheet)||void 0===h?void 0:h.cssRules){const t=Nh(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=nc(l,fc(e.doc))}return u&&(l="SCRIPT_PLACEHOLDER"),!a&&!u&&l&&i&&(l=n?n(l,nh.parentElement(t)):l.replace(/[\S]/g,"*")),{type:zu.Text,textContent:l||"",isStyle:a,rootId:s}}(t,{doc:i,needsMask:o,maskTextFn:u,rootId:_});case t.CDATA_SECTION_NODE:return{type:zu.CDATA,textContent:"",rootId:_};case t.COMMENT_NODE:return{type:zu.Comment,textContent:nh.textContent(t)||"",rootId:_};default:return!1}}(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:_,keepIframeSrcFn:T,newlyAddedElement:E});if(!O)return console.warn(t,"not serialized"),null;let A;A=n.hasNode(t)?n.getId(t):function(t,e){if(e.comment&&t.type===zu.Comment)return!0;if(t.type===zu.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&&(Sc(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Sc(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Sc(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&Sc(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Sc(t.attributes.property).match(/^(og|twitter|fb):/)||Sc(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===Sc(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(Sc(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(Sc(t.attributes.name))||Sc(t.attributes.property).match(/^article:/)||Sc(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(Sc(t.attributes.name)))return!0}}return!1}(O,p)||!P&&O.type===zu.Text&&!O.isStyle&&!O.textContent.replace(/^\s+|\s+$/gm,"").length?-2:uc();const F=Object.assign(O,{id:A});if(n.add(t,F),-2===A)return null;b&&b(t);let D=!a;if(F.type===zu.Element){D=D&&!F.needBlock,delete F.needBlock;const e=nh.shadowRoot(t);e&&Ah(e)&&(F.isShadowHost=!0)}if((F.type===zu.Document||F.type===zu.Element)&&D){p.headWhitespace&&F.type===zu.Element&&"head"===F.tagName&&(P=!1);const e={doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:l,skipChild:a,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:_,preserveWhiteSpace:P,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I+1,maxDepth:M};if(F.type===zu.Element&&"textarea"===F.tagName&&void 0!==F.attributes.value);else for(const i of Array.from(nh.childNodes(t))){const t=$c(i,e);t&&F.childNodes.push(t)}let E=null;if(Ph(t)&&(E=nh.shadowRoot(t)))for(const t of Array.from(nh.childNodes(E))){const i=$c(t,e);i&&(Ah(E)&&(i.isShadow=!0),F.childNodes.push(i))}}const L=nh.parentNode(t);if(L&&Oh(L)&&Ah(L)&&(F.isShadow=!0),F.type===zu.Element&&"iframe"===F.tagName){const e=function(t,e,i){const n=()=>{},s=t.contentWindow;if(!s)return n;let r;try{r=s.document.readyState}catch(t){return n}const o=()=>e();if("complete"!==r){let n=!1,s=null;const r=()=>{n||(n=!0,null!==s&&(clearTimeout(s),s=null),bc(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?bc(t,"load",o):(n=!0,bc(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),bc(t,"load",o)}}return t.addEventListener("load",o),()=>{bc(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&w){const i=$c(e,{doc:e,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:_,preserveWhiteSpace:P,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I+1,maxDepth:M});i&&w(t,i)}},k);null==S||S(t,e)}return F.type===zu.Element&&"link"===F.tagName&&"stylesheet"===F.attributes.rel&&function(e,a,S){if(wc.has(e))return;let E;try{E=e.sheet}catch(t){return}if(E)return;const O=new AbortController;let A=!1;const F=()=>{if(!A){A=!0;try{(()=>{if(x){const e=$c(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:_,preserveWhiteSpace:P,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:k,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I,maxDepth:M});e&&x(t,e)}})()}finally{wc.delete(e),O.abort()}}},D=setTimeout(F,S);O.signal.addEventListener("abort",()=>clearTimeout(D),{once:!0}),e.addEventListener("load",F,{signal:O.signal,once:!0}),wc.set(e,O)}(t,0,C),F}function Tc(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 Ec=class t{constructor(...t){Rh(this,"parentElement",null),Rh(this,"parentNode",null),Rh(this,"ownerDocument",void 0),Rh(this,"firstChild",null),Rh(this,"lastChild",null),Rh(this,"previousSibling",null),Rh(this,"nextSibling",null),Rh(this,"ELEMENT_NODE",1),Rh(this,"TEXT_NODE",3),Rh(this,"nodeType",void 0),Rh(this,"nodeName",void 0),Rh(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 Ic(t,e,i=document){const n={capture:!0,passive:!0};return i.addEventListener(t,e,n),()=>Mc(i,t,e,n)}function Mc(t,e,i,n){Rc(()=>{const s=t.removeEventListener;"function"==typeof s&&(void 0!==n?s.call(t,e,i,n):s.call(t,e,i))})}function Rc(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function Pc(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var Oc="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.",Ac={map:{},getId(){return console.warn(Oc),-1},getNode(){return console.warn(Oc),null},removeNodeFromMap(){console.warn(Oc)},has(){return console.warn(Oc),!1},reset(){console.warn(Oc)}};function Fc(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 Dc(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)}}}),()=>Dc(t,e,r||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Ac=new Proxy(Ac,{get(t,e,i){return"map"===e&&console.warn(Oc),Reflect.get(t,e,i)}}));var Lc=Date.now;function Nc(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=nh.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=nh.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 qc(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Bc(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function jc(t){return t?t.nodeType===t.ELEMENT_NODE?t:nh.parentElement(t):null}function Hc(t,e,i,n){if(!t)return!1;const s=jc(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(yc(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 Uc(t,e,i){return!("TITLE"!==t.tagName||!i.headTitleMutations)||-2===e.getId(t)}function zc(t,e){if(Oh(t))return!1;const i=e.getId(t);if(!e.has(i))return!0;const n=nh.parentNode(t);return(!n||n.nodeType!==t.DOCUMENT_NODE)&&(!n||zc(n,e))}function Wc(t){return Boolean(t.changedTouches)}function Vc(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Gc(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Zc(t){return!!t&&(t instanceof Ec&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(nh.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Lc=()=>(new Date).getTime());var Qc=class{constructor(){Rh(this,"id",1),Rh(this,"styleIDMap",new WeakMap),Rh(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 Jc(t){var e;let i=null;return"getRootNode"in t&&(null===(e=nh.getRootNode(t))||void 0===e?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&nh.host(nh.getRootNode(t))&&(i=nh.host(nh.getRootNode(t))),i}function Kc(t){const e=t.ownerDocument;if(!e)return!1;if(nh.contains(e,t))return!0;const i=nh.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=Jc(i);)i=e;return i}(t);return nh.contains(e,i)}(t)}function Yc(t){return"__ln"in t}var Xc,td=class{constructor(){Rh(this,"length",0),Rh(this,"head",null),Rh(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&&Yc(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&&Yc(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--)}},ed=(t,e)=>`${t}@${e}`,id=class{constructor(){Rh(this,"frozen",!1),Rh(this,"locked",!1),Rh(this,"texts",[]),Rh(this,"attributes",[]),Rh(this,"attributeMap",new WeakMap),Rh(this,"generatedAttributes",new WeakMap),Rh(this,"removes",[]),Rh(this,"mapRemoves",new Set),Rh(this,"movedMap",{}),Rh(this,"addedSet",new Set),Rh(this,"movedSet",new Set),Rh(this,"droppedSet",new Set),Rh(this,"removesSubTreeCache",new Set),Rh(this,"mutationCb",void 0),Rh(this,"blockClass",void 0),Rh(this,"blockSelector",void 0),Rh(this,"maskTextClass",void 0),Rh(this,"maskTextSelector",void 0),Rh(this,"inlineStylesheet",void 0),Rh(this,"maskInputOptions",void 0),Rh(this,"maskTextFn",void 0),Rh(this,"maskInputFn",void 0),Rh(this,"maskAllElementAttributes",void 0),Rh(this,"maskAttributeFn",void 0),Rh(this,"keepIframeSrcFn",void 0),Rh(this,"recordCanvas",void 0),Rh(this,"canvasMaskingConfigured",void 0),Rh(this,"inlineImages",void 0),Rh(this,"slimDOMOptions",void 0),Rh(this,"dataURLOptions",void 0),Rh(this,"doc",void 0),Rh(this,"mirror",void 0),Rh(this,"iframeManager",void 0),Rh(this,"stylesheetManager",void 0),Rh(this,"shadowDomManager",void 0),Rh(this,"canvasManager",void 0),Rh(this,"processedNodeManager",void 0),Rh(this,"unattachedDoc",void 0),Rh(this,"canvasManagerReleased",!1),Rh(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),Rh(this,"emit",()=>{if(this.frozen||this.locked)return;const t=sh(),e=lh();try{this.processBufferedMutations()}finally{i=sh()-t,n=e,uh>0||ah(i,null!=n?n:rh)||i>yh.slowestBatchMs&&(yh.slowestBatchMs=i)}var i,n}),Rh(this,"processBufferedMutations",()=>{const t=[],e=new Set,i=new td,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=nh.parentNode(r);if(!l||!Kc(r)||"TEXTAREA"===l.tagName)return;if(this.isBlockedAtEmission(l))return;const a=Oh(l)?this.mirror.getId(Jc(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=>{Vc(t,this.mirror)&&this.iframeManager.addIframe(t),Gc(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Zc(t)&&!Hc(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(nh.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=$c(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)sd(this.removesSubTreeCache,t)&&!this.movedSet.has(nh.parentNode(t))||r(t);for(const t of this.addedSet)rd(this.droppedSet,t)||sd(this.removesSubTreeCache,t)?rd(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(nh.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(nh.parentNode(i.value));if(-1===n(i.value))continue;if(-1!==e){t=i;break}{const e=nh.parentNode(i.value);if(e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=nh.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=nh.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]=Jh({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)}),Rh(this,"bufferBelongsToIframe",t=>this.doc===t.contentDocument),Rh(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(nh.childNodes(t),t=>nh.textContent(t)||"").join("");e.attributes.value=Gh({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Yh(t),value:i,maskInputFn:this.maskInputFn})}),Rh(this,"processMutation",t=>{if(!Uc(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const e=nh.textContent(t.target);Hc(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:_c(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,jc(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break}case"attributes":{var e;const n=t.target,s=Zh(n.tagName),r=t.attributeName,o=null!==(e=t.attributeNamespace)&&void 0!==e?e:null;let l=function(t,e,i){if(!i)return e;const n=t.getAttributeNodeNS(i,e);if(n)return n.name;if("http://www.w3.org/1999/xlink"===i)return`xlink:${e}`;if("http://www.w3.org/XML/1998/namespace"===i)return`xml:${e}`;if("http://www.w3.org/2000/xmlns/"===i)return"xmlns"===e?e:`xmlns:${e}`;const s=t.lookupPrefix(i);return s?`${s}:${e}`:e}(n,r,o),a=o?n.getAttributeNS(o,r):t.target.getAttribute(r);if("value"===l){const t=n,e=Yh(t);a=Gh({element:t,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:a,maskInputFn:this.maskInputFn})}if(Hc(t.target,this.blockClass,this.blockSelector,!1)||a===t.oldValue)return;let u=this.attributeMap.get(t.target);const h="iframe"===s&&"src"===l;if(h&&!this.keepIframeSrcFn(a)&&n.contentDocument)return;if("type"===l&&"input"===s&&"password"===(t.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!mc(s,l)){var i;u||(u={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(u),this.attributeMap.set(t.target,u));const e=gc(this.doc,s,Zh(l),a,n,this.dataURLOptions);if(h&&!this.keepIframeSrcFn(a)&&(l="rr_src"),u.attributes[l]=e,null===(i=this.generatedAttributes.get(t.target))||void 0===i||i.delete(l),"style"===l){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const e=this.unattachedDoc.createElement("span"),i=n.style;t.oldValue&&(e.style.cssText=t.oldValue);for(const t of Array.from(i)){const n=i.getPropertyValue(t),s=i.getPropertyPriority(t);n!==e.style.getPropertyValue(t)||s!==e.style.getPropertyPriority(t)?u.styleDiff[t]=""===s?n:[n,s]:u._unchangedStyles[t]=[n,s]}for(const t of Array.from(e.style))""===i.getPropertyValue(t)&&(u.styleDiff[t]=!1)}else if("open"===l&&"dialog"===s){u.attributes.rr_open_mode=n.matches("dialog:modal")?"modal":"non-modal";let e=this.generatedAttributes.get(t.target);e||(e=new Set,this.generatedAttributes.set(t.target,e)),e.add("rr_open_mode")}}break}case"childList":if(Hc(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=Oh(t.target)?this.mirror.getId(nh.host(t.target)):this.mirror.getId(t.target);Hc(t.target,this.blockClass,this.blockSelector,!1)||Uc(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(nd(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===i||zc(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[ed(i,n)]?nd(this.movedSet,e):(this.removes.push({parentId:n,id:i,isShadow:!(!Oh(t.target)||!Ah(t.target))||void 0}),function(t,e){const i=[t];for(;i.length;){const t=i.pop();e.has(t)||(e.add(t),nh.childNodes(t).forEach(t=>i.push(t)))}}(e,this.removesSubTreeCache))),this.mapRemoves.add(e))})}}),Rh(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(Uc(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[ed(this.mirror.getId(t),i)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!Hc(t,this.blockClass,this.blockSelector,!1)){if(t.nodeType===t.TEXT_NODE)return;const e=nh.childNodes(t);for(let t=0,i=e.length;i>t;t++){const i=e[t];i&&this.genAdds(i)}if(Zc(t)){const e=nh.childNodes(nh.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),Hc(t,i||e,this.blockSelector,!0))return!0;const n="getRootNode"in t?nh.getRootNode(t):null;t=(null==n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?nh.host(n):null}return!1}};function nd(t,e){const i=[e];for(;i.length;){const e=i.pop();if(t.delete(e),e.nodeType===e.TEXT_NODE)continue;const n=nh.childNodes(e);for(let t=0,e=n.length;e>t;t++){const e=n[t];e&&i.push(e)}}}function sd(t,e,i){return 0!==t.size&&function(t,e){const i=nh.parentNode(e);return!!i&&t.has(i)}(t,e)}function rd(t,e){if(0===t.size)return!1;let i=nh.parentNode(e);for(;i;){if(t.has(i))return!0;i=nh.parentNode(i)}return!1}function od(t){Xc=t}function ld(){Xc=void 0}var ad=(t,e="rrweb")=>Xc?(...i)=>{try{return t(...i)}catch(t){if(Xc&&!0===Xc(t,e))return;throw t}}:t,ud=[];function hd(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 cd(t,e){const i=new id;let n;i.init(t);try{n=new(eh())(ad(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),ud.push(i),{observer:n,buffer:i}}catch(t){try{null==n||n.disconnect(),i.destroy(),i.reset()}catch(t){}throw t}}function dd({scrollCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){const o=new Map,l=r=>{const l=hd(r);if(!l||Hc(l,n,s,!0))return;const a=i.getId(l);let u,h;if(l===e&&e.defaultView){const t=Nc(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=[Ic("scroll",ad(Fc(ad(t=>l(t)),r.scroll||100)),e)];return"onscrollend"in e&&a.push(Ic("scrollend",ad(l),e)),()=>a.forEach(t=>t())}function vd(t,e){for(let i=ud.length-1;i>=0;i--){const n=ud[i];if(!n)continue;let s=n.bufferBelongsToIframe(t);!s&&e&&e.has(n.bufferDoc())&&(s=!0),s&&(n.reset(),ud.splice(i,1))}}var fd=["INPUT","TEXTAREA","SELECT"],pd=new WeakMap;function gd(t){return function t(e,i){if(bd("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||bd("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||bd("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||bd("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 md(t,e,i){let n,s;return t?(t.ownerNode?n=e.getId(t.ownerNode):s=i.getId(t),{styleId:s,id:n}):{}}function yd({mirror:t,stylesheetManager:e},i){var n,s;let r=null;r=t.getId("#document"===i.nodeName?i:nh.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}}),ad(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function _d(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=ad(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=ud.indexOf(s);-1!==t&&ud.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==n||n.disconnect()}finally{Pc(r)}});try{if(t.recordDOM){const e=cd(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=Fc(ad(e=>{const i=Date.now()-o;t(l.map(t=>(t.timeOffset-=i,t)),e),l=[],o=null}),r),u=ad(Fc(ad(t=>{const e=hd(t),{clientX:i,clientY:s}=Wc(t)?t.changedTouches[0]:t;o||(o=Lc()),l.push({x:i,y:s,id:n.getId(e),timeOffset:Lc()-o}),a("undefined"!=typeof DragEvent&&t instanceof DragEvent?qu.Drag:t instanceof MouseEvent?qu.MouseMove:qu.TouchMove)}),s,{trailing:!1})),h=[Ic("mousemove",u,i),Ic("touchmove",u,i),Ic("drag",u,i)];return ad(()=>{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(Bu).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t]).forEach(r=>{let o=Zh(r);const u=(e=>r=>{const o=hd(r);if(Hc(o,n,s,!0))return;let l=null,u=e;if("pointerType"in r){switch(r.pointerType){case"mouse":l=ju.Mouse;break;case"touch":l=ju.Touch;break;case"pen":l=ju.Pen}l===ju.Touch&&(Bu[e]===Bu.MouseDown?u="TouchStart":Bu[e]===Bu.MouseUp&&(u="TouchEnd"))}else Wc(r)&&(l=ju.Touch);null!==l?(a=l,(u.startsWith("Touch")&&l===ju.Touch||u.startsWith("Mouse")&&l===ju.Mouse)&&(l=null)):Bu[e]===Bu.Click&&(l=a,a=null);const h=Wc(r)?r.changedTouches[0]:r;if(!h)return;const c=i.getId(o),{clientX:d,clientY:v}=h;ad(t)(le({type:Bu[u],id:c,x:d,y:v},null!==l&&{pointerType:l}))})(r);if(window.PointerEvent)switch(Bu[r]){case Bu.MouseDown:case Bu.MouseUp:o=o.replace("mouse","pointer");break;case Bu.TouchStart:case Bu.TouchEnd:return}l.push(Ic(o,u,e))}),ad(()=>{l.forEach(t=>t())})}(t)),r.push(dd(t)),r.push(function({viewportResizeCb:t},{win:e}){let i=-1,n=-1;return Ic("resize",ad(Fc(ad(()=>{const e=qc(),s=Bc();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=hd(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=nh.parentElement(i)),!i||!v||0>fd.indexOf(v)||Hc(i,n,s,!0))return;if(i.classList.contains(r)||o&&i.matches(o))return;let f=i.value,p=!1;const g=Yh(i)||"";"radio"===g||"checkbox"===g?p=i.checked:(l[v.toLowerCase()]||l[g])&&(f=Gh({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=pd.get(e);if(!s||s.text!==n.text||s.isChecked!==n.isChecked){pd.set(e,n);const s=i.getId(e);ad(t)(le(le({},n),{},{id:s}))}}const v=("last"===u.input?["change"]:["input","change"]).map(t=>Ic(t,ad(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=>Dc(t[0],t[1],{set(){ad(c)({target:this,isTrusted:!1})}},!1,f))),ad(()=>{Pc(v)})}(t)),r.push(function({mediaInteractionCb:t,blockClass:e,blockSelector:i,mirror:n,sampling:s,doc:r}){const o=ad(r=>Fc(ad(s=>{const o=hd(s);if(!o||Hc(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=[Ic("play",o(Uu.Play),r),Ic("pause",o(Uu.Pause),r),Ic("seeked",o(Uu.Seeked),r),Ic("volumechange",o(Uu.VolumeChange),r),Ic("ratechange",o(Uu.RateChange),r)];return ad(()=>{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:ad((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=md(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:ad((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=md(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:ad((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}=md(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=Nh(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:ad((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=md(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={};wd("CSSGroupingRule")?u.CSSGroupingRule=n.CSSGroupingRule:(wd("CSSMediaRule")&&(u.CSSMediaRule=n.CSSMediaRule),wd("CSSConditionRule")&&(u.CSSConditionRule=n.CSSConditionRule),wd("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:ad((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:h}=md(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||h&&-1!==h)){const e=[...gd(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:ad((n,r,o)=>{const[l]=o,a=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:h}=md(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||h&&-1!==h)){const e=[...gd(r),l];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:h,removes:[{index:e}]}))}return a},"host")})}),ad(()=>{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(yd(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:ad((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}=md(v,e,n.styleMirror);if(f&&-1!==f||p&&-1!==p){const e=gd(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:ad((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}=md(c,e,n.styleMirror);if(d&&-1!==d||v&&-1!==v){const e=gd(o.parentRule);r.queueMutation(c,()=>t({id:d,styleId:v,remove:{property:u},index:e}))}return h},"host")}),ad(()=>{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=ih(e.fonts,"add",function(e){return function(i){return setTimeout(ad(()=>{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),ad(()=>{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=ad(()=>{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);Hc(r,n,s,!0)||Hc(a,n,s,!0)||l.push({start:i.getId(r),startOffset:o,end:i.getId(a),endOffset:u})}r({ranges:l})});return l(),Ic("selectionchange",l)}(t)),r.push(function({doc:t,customElementCb:e}){const i=t.defaultView;return i&&i.customElements?ih(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 bd(t){return void 0!==window[t]}function wd(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var kd=class{constructor(t){Rh(this,"generateIdFn",void 0),Rh(this,"iframeRemoteIdToLocalIdMap",new WeakMap),Rh(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}},Sd=class{constructor(t){Rh(this,"iframes",new WeakMap),Rh(this,"crossOriginIframeMap",new WeakMap),Rh(this,"crossOriginIframeMirror",new kd(uc)),Rh(this,"crossOriginIframeStyleMirror",void 0),Rh(this,"crossOriginIframeRootIdMap",new WeakMap),Rh(this,"mirror",void 0),Rh(this,"mutationCb",void 0),Rh(this,"wrappedEmit",void 0),Rh(this,"loadListener",void 0),Rh(this,"pageHideListener",void 0),Rh(this,"stylesheetManager",void 0),Rh(this,"recordCrossOriginIframes",void 0),Rh(this,"messageHandler",void 0),Rh(this,"nestedIframeListeners",new Map),Rh(this,"attachedWindows",new WeakMap),Rh(this,"attachedDocuments",new WeakMap),Rh(this,"attachedIframes",new Map),Rh(this,"loadListenerDisposers",new WeakMap),Rh(this,"iframeElementsById",new Map),Rh(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new kd(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=>Rc(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{Mc(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);Rc(()=>{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)})}Rc(()=>{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 Nu.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:Nu.IncrementalSnapshot,data:{source:qu.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Nu.Meta:case Nu.Load:case Nu.DomContentLoaded:return!1;case Nu.Plugin:return e;case Nu.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case Nu.IncrementalSnapshot:switch(e.data.source){case qu.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 qu.Drag:case qu.TouchMove:case qu.MouseMove:return e.data.positions.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case qu.ViewportResize:return!1;case qu.MediaInteraction:case qu.MouseInteraction:case qu.Scroll:case qu.CanvasMutation:case qu.Input:return this.replaceIds(e.data,t,["id"]),e;case qu.StyleSheetRule:case qu.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case qu.Font:return e;case qu.Selection:return e.data.ranges.forEach(e=>{this.replaceIds(e,t,["start","end"])}),e;case qu.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===zu.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&&(Mc(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(i)),t&&this.nestedIframeListeners.has(t)&&(Mc(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=>{Rc(()=>this.mirror.removeNodeFromMap(t))}),Rc(()=>vd(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&&Mc(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{Mc(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}},xd=class{constructor(t){Rh(this,"shadowDoms",new WeakSet),Rh(this,"mutationCb",void 0),Rh(this,"scrollCb",void 0),Rh(this,"bypassOptions",void 0),Rh(this,"mirror",void 0),Rh(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(!Ah(t))return;if(this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=null!==(i=null===(n=nh.host(t))||void 0===n?void 0:n.ownerDocument)&&void 0!==i?i:e,{observer:r,buffer:o}=cd(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=ud.indexOf(o);-1!==t&&ud.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:dd(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(nh.host(t))),this.restoreHandlers.push({doc:s,handler:yd({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:ih(t.prototype,"attachShadow",function(t){return function(n){const s=t.call(this,n),r=nh.shadowRoot(this);return r&&Kc(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}},Cd="skip-frame";function $d(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 Td="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ed="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Id=0;64>Id;Id++)Ed[Td.charCodeAt(Id)]=Id;var Md=function(t){var e,i=new Uint8Array(t),n=i.length,s="";for(e=0;n>e;e+=3)s+=Td[i[e]>>2],s+=Td[(3&i[e])<<4|i[e+1]>>4],s+=Td[(15&i[e+1])<<2|i[e+2]>>6],s+=Td[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},Rd=new Map,Pd=(t,e,i)=>{if(!t||!Fd(t,e)&&"object"!=typeof t)return;const n=function(t,e){let i=Rd.get(t);return i||(i=new Map,Rd.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 Od(t,e,i,n){if(t instanceof Array)return t.map(t=>Od(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:Md(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Od(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:[Od(t.data,e,i,n),t.width,t.height]}:Fd(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:Pd(t,e,i)}:t}var Ad=(t,e,i,n)=>t.map(t=>Od(t,e,i,n)),Fd=(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]))},Dd=["webgl","webgl2"];function Ld(t){return"nodeType"in t}function Nd(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 ih(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||Ld(r)&&Hc(r,e,i,!0))return n.call(this,s);Ld(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=ih(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(s,...r){const o=function(t){return"experimental-webgl"===t?"webgl":t}(s);if(!Hc(this,e,i,!0)&&("__context"in this||(this.__context=o),n&&Dd.includes(o)))if(r[0]&&"object"==typeof r[0]){const t=r[0];t.preserveDrawingBuffer||(t.preserveDrawingBuffer=!0)}else r.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[s,...r])}});s.push(r)}catch(t){console.warn("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(t=>t())}}function qd(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=ih(t,u,function(t){return function(...l){const a=t.apply(this,l);if(Pd(a,r,this),this.canvas&&"tagName"in this.canvas&&!Hc(this.canvas,n,s,!0)){const t=Ad(l,r,this,o);i(this.canvas,{type:e,property:u,args:t})}return a}});l.push(a)}catch(r){const o=Dc(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!Hc(this.canvas,n,s,!0)&&i(this.canvas,{type:e,property:u,args:[t],setter:!0})}});l.push(o)}return l}var Bd='(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',jd="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Bd],{type:"text/javascript;charset=utf-8"});function Hd(t){let e;try{if(e=jd&&(self.URL||self.webkitURL).createObjectURL(jd),!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(Bd),{name:null==t?void 0:t.name})}}var Ud,zd,Wd,Vd=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){Rh(this,"pendingCanvasMutations",new Map),Rh(this,"rafStamps",{latestId:0,invokeId:null}),Rh(this,"mirror",void 0),Rh(this,"mutationCb",void 0),Rh(this,"resetObservers",void 0),Rh(this,"frozen",!1),Rh(this,"locked",!1),Rh(this,"rafIdTimestamp",null),Rh(this,"rafIdFlush",null),Rh(this,"refCount",0),Rh(this,"torndown",!1),Rh(this,"resetFrameDedup",null),Rh(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=Nd(e,i,n,!0),a=new Map;let u;try{u=new Hd}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:Hu["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=>{Hc(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 Cd}if(void 0===o)return;if(!Array.isArray(o)||!o.every($d))return Cd;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=Nd(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=ih(e.CanvasRenderingContext2D.prototype,l,function(r){return function(...o){return Hc(this.canvas,i,n,!0)||setTimeout(()=>{const i=Ad(o,e,this,s);t(this.canvas,{type:Hu["2D"],property:l,args:i})},0),r.apply(this,o)}});r.push(o)}catch(s){const o=Dc(e.CanvasRenderingContext2D.prototype,l,{set(e){Hc(this.canvas,i,n,!0)||t(this.canvas,{type:Hu["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(...qd(e.WebGLRenderingContext.prototype,Hu.WebGL,t,i,n,e,s)),void 0!==e.WebGL2RenderingContext&&r.push(...qd(e.WebGL2RenderingContext.prototype,Hu.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=>gs(t,Lu)),{type:s}=i[0];this.mutationCb({id:e,type:s,commands:n}),this.pendingCanvasMutations.delete(t)}},Gd=class{constructor(t){var e;Rh(this,"trackedLinkElements",new WeakSet),Rh(this,"pendingDeferredSheets",new Set),Rh(this,"mutationCb",void 0),Rh(this,"adoptedStyleSheetCb",void 0),Rh(this,"maskAllElementAttributes",void 0),Rh(this,"maskAttributeFn",void 0),Rh(this,"styleMirror",new Qc),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=Wh(n))}catch(t){}if(!i||!n)return Eh(),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=sh(),u=lh();let h=!0;try{if(r)return l=!0,Eh(),!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?(Eh(),!0):o?(this.emitCssTextMutation(t,e,o),!0):(Eh(),!0)}finally{h&&this.pendingDeferredSheets.delete(o),ah(c=sh()-a,null!=(d=u)?d:rh)||(_h.totalMs+=c,c>_h.slowestSliceMs&&(_h.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:Jh({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=sh();try{xh(()=>{try{const t=e.rules||e.cssRules;t&&Sh(t)}catch(t){}n.push({styleId:i,rules:Array.from(e.rules||CSSRule,(t,i)=>({rule:qh(t,e.href),index:i}))})})}finally{Ch(sh()-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(),wc.forEach(t=>t.abort()),wc.clear()}trackStylesheetInLinkElement(t){}},Zd=class{constructor(){Rh(this,"nodeMap",new WeakMap),Rh(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(){}},Qd=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var Jd;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(Jd=t.contentWindow)||void 0===Jd?void 0:Jd.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var Kd=new Vh,Yd=new Set([qu.Mutation,qu.MediaInteraction,qu.StyleSheetRule,qu.CanvasMutation,qu.Font,qu.Log,qu.StyleDeclaration,qu.AdoptedStyleSheet]);function Xd(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 tv(t={}){let e;const{emit:i,checkoutEveryNms:n,checkoutEveryNth:s,blockClass:r="rr-block",blockSelector:o=null,ignoreClass:l="rr-ignore",ignoreSelector:a=null,maskTextClass:u="rr-mask",maskTextSelector:h=null,inlineStylesheet:c=!0,inlineStylesheetBudgetRules:d,maskAllInputs:v,maskInputOptions:f,slimDOMOptions:p,maskInputFn:g,maskTextFn:m,maskAllElementAttributes:y=!1,maskAttributeFn:_,hooks:b,packFn:w,sampling:k={},dataURLOptions:S={},canvasResolutionScale:x,canvasMasking:C,mousemoveWait:T,recordDOM:E=!0,recordCanvas:I=!1,recordCrossOriginIframes:M=!1,recordAfter:R=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:P=!1,collectFonts:O=!1,inlineImages:A=!1,plugins:F,keepIframeSrcFn:D=()=>!1,ignoreCSSAttributes:L=new Set([]),attributeFilter:N,errorHandler:q}=t;od(q);const B=le({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},S),j=!M||window.parent===window;let H=!1;if(!j)try{window.parent.document&&(H=!1)}catch(t){H=!0}if(j&&!i)throw new Error("emit function is required");if(!j&&!H)return()=>{};void 0!==T&&void 0===k.mousemove&&(k.mousemove=T),Kd.reset();const U=!0===v?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==f?f:{password:!0},z=Tc(void 0!==p&&p);let W;!function(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();let V=0;const G=new Map;let Z,Q;const J=t=>{for(const e of F||[])e.eventProcessor&&(t=e.eventProcessor(t));return w&&!H&&(t=w(t)),t};Ud=(t,e)=>{var r;const o=t;if(o.timestamp=Lc(),!(null===(r=ud[0])||void 0===r?void 0:r.isFrozen())||o.type===Nu.FullSnapshot||o.type===Nu.IncrementalSnapshot&&Yd.has(o.data.source)||ud.forEach(t=>t.unfreeze()),j)null==i||i(J(o),e);else if(H){const t={type:"rrweb",event:J(o),origin:window.location.origin,isCheckout:e};window.parent.postMessage(t,"*")}if(o.type===Nu.FullSnapshot)W=o,V=0;else if(o.type===Nu.IncrementalSnapshot){if(o.data.source===qu.Mutation&&o.data.isAttachIframe)return;V++,(s&&V>=s||n&&o.timestamp-W.timestamp>n)&&zd(!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=Kd.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()}Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.Mutation},t)})},Y=t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.Scroll},t)}),X=t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.CanvasMutation},t)}),tt=new Gd({mutationCb:K,adoptedStyleSheetCb:t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.AdoptedStyleSheet},t)}),maskAllElementAttributes:y,maskAttributeFn:_}),et=new Sd({mirror:Kd,mutationCb:K,stylesheetManager:tt,recordCrossOriginIframes:M,wrappedEmit:Ud});for(const t of F||[])t.getMirror&&t.getMirror({nodeMirror:Kd,crossOriginIframeMirror:et.crossOriginIframeMirror,crossOriginIframeStyleMirror:et.crossOriginIframeStyleMirror});const it=new Zd,nt=null==C?void 0:C.configured;Wd=new Vd({recordCanvas:I,mutationCb:X,win:window,blockClass:r,blockSelector:o,mirror:Kd,sampling:k.canvas,dataURLOptions:B,resolutionScale:x,canvasMasking:C});const st=new xd({mutationCb:K,scrollCb:Y,bypassOptions:{blockClass:r,blockSelector:o,maskTextClass:u,maskTextSelector:h,inlineStylesheet:c,maskInputOptions:U,dataURLOptions:B,maskTextFn:m,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:_,recordCanvas:I,canvasMaskingConfigured:nt,inlineImages:A,sampling:k,slimDOMOptions:z,iframeManager:et,stylesheetManager:tt,canvasManager:Wd,keepIframeSrcFn:D,processedNodeManager:it,attributeFilter:N},mirror:Kd});zd=(t=!1)=>{if(E){bh(d);try{Ud({type:Nu.Meta,data:{href:window.location.href,width:Bc(),height:qc()}},t),null==e||e.cancel(),e=void 0,tt.reset(),st.init(),ud.forEach(t=>t.lock());let i=null,n=[];try{i=function(t,e){const{mirror:i=new Vh,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:u=!1,canvasMaskingConfigured:h,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f=!1,maskAttributeFn:p,slimDOM:g=!1,dataURLOptions:m,preserveWhiteSpace:y,onSerialize:_,onIframeLoad:b,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C=()=>!1,maxDepth:T,inlineStylesheetBudgetRules:E}=e||{},I=!0===c?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===c?{password:!0}:c,M=Tc(g);bh(E);try{return $c(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:I,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f,maskAttributeFn:p,slimDOMOptions:M,dataURLOptions:m,inlineImages:a,recordCanvas:u,canvasMaskingConfigured:h,preserveWhiteSpace:y,onSerialize:_,onIframeLoad:b,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C,newlyAddedElement:!1,maxDepth:T})}finally{wh()}}(document,{mirror:Kd,blockClass:r,blockSelector:o,maskTextClass:u,maskTextSelector:h,inlineStylesheet:c,maskAllInputs:U,inlineStylesheetBudgetRules:d,maskTextFn:m,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:_,slimDOM:z,dataURLOptions:B,recordCanvas:I,canvasMaskingConfigured:nt,inlineImages:A,onSerialize(t){Vc(t,Kd)&&et.addIframe(t),Gc(t,Kd)&&tt.trackLinkElement(t),Zc(t)&&st.addShadowRoot(nh.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=Th()}if(!i)return console.warn("Failed to snapshot the document");if(Ud({type:Nu.FullSnapshot,data:{node:i,initialOffset:Nc(window)}},t),ud.forEach(t=>t.unlock()),Wd.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&&Rc(()=>{o=e.beginDeferredLinkInlining(i,Kd.getId(i))})},u=()=>{if(!o)return;const t=o;let e=!0;Rc(()=>{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,Ih(1)}e+=1}while(!n&&l()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));n||(l()?s=Xd(c):i())};return s=Xd(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);Ih(e),null==o||o.discard(),o=null}i()}}}(n,tt,()=>{e===t&&(e=void 0)});e=t}M&&et.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&tt.adoptStyleSheets(document.adoptedStyleSheets,Kd.getId(document))}finally{wh()}}};try{const t=[];t.push(Ic("pagehide",()=>{try{null==e||e.flush()}catch(t){}e=void 0},window));for(const e of["visibilitychange","freeze","resume"])t.push(Ic(e,oh,document));Z=e=>{const i=G.get(e);i&&(i.forEach(e=>{Rc(e);const i=t.indexOf(e);-1!==i&&t.splice(i,1)}),G.delete(e))},Q=()=>{for(const[t]of G){const e=Kd.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 ad(_d)({mutationCb:K,mousemoveCb:(t,e)=>Ud({type:Nu.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.MouseInteraction},t)}),scrollCb:Y,viewportResizeCb:t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.ViewportResize},t)}),inputCb:t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.Input},t)}),mediaInteractionCb:t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.MediaInteraction},t)}),styleSheetRuleCb:t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.StyleSheetRule},t)}),styleDeclarationCb:t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.StyleDeclaration},t)}),canvasMutationCb:X,fontCb:t=>Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.Font},t)}),selectionCb(t){Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.Selection},t)})},customElementCb(t){Ud({type:Nu.IncrementalSnapshot,data:le({source:qu.CustomElement},t)})},blockClass:r,ignoreClass:l,ignoreSelector:a,maskTextClass:u,maskTextSelector:h,maskInputOptions:U,inlineStylesheet:c,sampling:k,recordDOM:E,recordCanvas:I,canvasMaskingConfigured:nt,inlineImages:A,userTriggeredOnInput:P,collectFonts:O,doc:t,maskInputFn:g,maskTextFn:m,maskAllElementAttributes:y,maskAttributeFn:_,keepIframeSrcFn:D,blockSelector:o,slimDOMOptions:z,dataURLOptions:B,mirror:Kd,iframeManager:et,stylesheetManager:tt,shadowDomManager:st,processedNodeManager:it,canvasManager:Wd,ignoreCSSAttributes:L,attributeFilter:N,plugins:(null==F||null===(e=F.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({observer:t.observer,options:t.options,callback:e=>Ud({type:Nu.Plugin,data:{plugin:t.name,payload:e}})})))||[]},b)};et.addLoadListener(e=>{try{const n=Kd.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=Kd.getId(t);null==Z||Z(e),vd(t)});let n=-1;const s=t=>Ud({type:Nu.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?Kd.getId(l):-1;a!==n&&(-1!==n&&s({id:n,enter:!1}),n=a,-1!==a&&s({id:a,enter:!0}))},v=()=>{zd();const e=i(document);"function"==typeof e&&t.push(e),t.push(Ic("fullscreenchange",d)),t.push(Ic("webkitfullscreenchange",d)),t.push(Ic("mozfullscreenchange",d)),t.push(Ic("MSFullscreenChange",d)),Qd=!0};return["interactive","complete"].includes(document.readyState)?v():(t.push(Ic("DOMContentLoaded",()=>{Ud({type:Nu.DomContentLoaded,data:{}}),"DOMContentLoaded"===R&&v()})),t.push(Ic("load",()=>{Ud({type:Nu.Load,data:{}}),"load"===R&&v()},window))),()=>{try{null==e||e.flush()}catch(t){}e=void 0,Pc(t),it.destroy(),et.removeLoadListener(),et.destroy(),G.clear(),st.reset(),Kd.reset(),Qd=!1,ld()}}catch(t){console.warn(t)}}tv.addCustomEvent=(t,e)=>{if(!Qd)throw new Error("please add custom event after start recording");Ud({type:Nu.Custom,data:{tag:t,payload:e}})},tv.freezePage=()=>{ud.forEach(t=>t.freeze())},tv.takeFullSnapshot=t=>{if(!Qd)throw new Error("please take full snapshot after start recording");zd(t)},tv.mirror=Kd,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var ev=Object.create(null);function iv(t){return iv="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},iv(t)}function nv(t,e,i){return(e=function(t){var e=function(t){if("object"!=iv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=iv(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==iv(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}ev.Node=Object.create(null),ev.ShadowRoot=Object.create(null),ev.MutationObserver=Object.create(null),ev.Element=Object.create(null);var sv=class{constructor(t){nv(this,"fileName",void 0),nv(this,"functionName",void 0),nv(this,"lineNumber",void 0),nv(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}`}},rv=/(^|@)\S+:\d+/,ov=/^\s*at .*(\S+:\d+|\(native\))/m,lv=/^(eval@)?(\[native code])?$/,av={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(ov)?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(ov)},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 sv({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(lv)},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 sv({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(e),n=i&&i[1]?i[1]:void 0,s=this.extractLocation(t.replace(e,""));return new sv({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 sv({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 sv({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(rv)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),i=this.extractLocation(e.pop());return new sv({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function uv(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 hv(t){return Array.isArray(t)}function cv(t){return"object"==typeof t&&null!==t&&!hv(t)}function dv(t,e){if(0===e)return!0;const i=Object.keys(t);for(const n of i)if(cv(t[n])&&dv(t[n],e-1))return!0;return!1}function vv(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(cv(r=e)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||cv(r)&&dv(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]=hv(n)?uv(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 fv={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 pv(t,e,i){const n=i?Object.assign({},fv,i):fv,s=n.logger;if(!s)return()=>{};let r;r="string"==typeof s?e[s]:s;let o=0,l=!1,a=!0;const u=[];if(n.level.includes("error")){const i=e=>{const i=e.message;t({level:"error",trace:av.parse(e.error).map(t=>t.toString()),payload:[vv(i,n.stringifyOptions)]})};e.addEventListener("error",i),u.push(()=>{e.removeEventListener("error",i)});const s=e=>{let i,s;e.reason instanceof Error?(i=e.reason,s=[vv(`Uncaught (in promise) ${i.name}: ${i.message}`,n.stringifyOptions)]):(i=new Error,s=[vv("Uncaught (in promise)",n.stringifyOptions),vv(e.reason,n.stringifyOptions)]),t({level:"error",trace:av.parse(i).map(t=>t.toString()),payload:s})};e.addEventListener("unhandledrejection",s),u.push(()=>{e.removeEventListener("unhandledrejection",s)})}for(const t of n.level)u.push(h(r,t));return()=>{a=!1,u.forEach(t=>t())};function h(e,i){return e[i]?function(s,r){try{if(!(r in s))return()=>{};const u=s[r],h={next:u},c=(s=>(...r)=>{if(s.apply(e,r),a&&!("assert"===i&&r[0]||l)){l=!0;try{const e=av.parse(new Error).map(t=>t.toString()).splice(1),s=("assert"===i?r.slice(1):r).map(t=>vv(t,n.stringifyOptions));o++,n.lengthThreshold>o?t({level:i,trace:e,payload:s}):o===n.lengthThreshold&&t({level:"warn",trace:[],payload:[vv("The number of log records reached the threshold.")]})}catch(t){s.apply(e,["rrweb logger error:",t,...r])}finally{l=!1}}})(function(...t){return h.next.apply(this,t)});return"function"==typeof c&&(c.prototype=c.prototype||{},Object.defineProperties(c,{__rrweb_original__:{enumerable:!1,value:u},__rrweb_layer__:{enumerable:!1,value:h}})),s[r]=c,()=>{if(s[r]===c)return void(s[r]=h.next);const t=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let e=s[r],i=t(e);for(;i;){if(i.next===c)return void(i.next=h.next);e=i.next,i=t(e)}}}catch(t){return()=>{}}}(e,i):()=>{}}}var gv=t=>({name:"rrweb/console@1",observer:pv,options:t});const mv=()=>{},yv=t=>{var e;if(ke(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function _v(t,e,i){try{if(!(e in t))return mv;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=yv(i);for(;r;){if(r.next===s)return void(r.next=n.next);i=r.next,r=yv(i)}}}catch(t){return mv}}function bv(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 wv=Ws("[Recorder]"),kv=t=>"navigation"===t.entryType,Sv=t=>"resource"===t.entryType;function xv(t,e){return!!e&&(Pe(e)||e[t])}function Cv(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 $v=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function Tv({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:!!Cv(e)&&t(e.url)}catch(t){return!1}}(n))return!1;if(s($v))return!1;if(Pe(e))return!0;if(we(e))return s(e);const r=e[t];return Pe(r)?r:s(r)}function Ev(t,e,i,n,s){return Iv.apply(this,arguments)}function Iv(){return Iv=ne(function*(t,e,i,n,s,r=0){if(r>10)return wv.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=>Sv(t)&&t.initiatorType===e&&(Ce(n)||t.startTime>=n)&&(Ce(s)||s>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*r)),Ev(t,e,i,n,s,r+1))}),Iv.apply(this,arguments)}function Mv({body:t,options:e,url:i}){if(Ie(t))return null;const{hostname:n,isHostDenied:s}=bv(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(Oe(t))return or(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 Rv=t=>!Ee(t)&&("navigation"===t.entryType||"resource"===t.entryType);function Pv({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(Rv(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 Ov=["video/","audio/"];function Av(t){return Se(t)&&ke(t.getReader)&&ke(t.tee)}const Fv="[SessionReplay] Timeout while trying to read body",Dv="[SessionReplay] Failed to read body";function Lv(t){return`${Dv}: ${t}`}function Nv(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function qv(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const i=setTimeout(()=>e(Fv),500);try{t.clone().text().then(t=>e(t),t=>e(Lv(t))).finally(()=>clearTimeout(i))}catch(t){clearTimeout(i),e(Dv)}})}(t);const i=eo(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(Nv(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(Fv),500);let a;try{a=t.clone()}catch(t){return void o(Dv)}const u=a.body;if(!Av(u)||"undefined"==typeof TextDecoder){try{a.text().then(t=>o(t),t=>o(Lv(t)))}catch(t){o(Dv)}return}try{n=u.getReader()}catch(t){return void o(Dv)}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(Nv(e));c+=n.byteLength,h.push(n)}t()}},t=>o(Lv(t)))}()})}(t,i)}function Bv(){return Bv=ne(function*({r:t,options:e,url:i}){const{hostname:n,isHostDenied:s}=bv(i,e);return s?Promise.resolve(n+" is in deny list"):qv(t,e)}),Bv.apply(this,arguments)}function jv(){return jv=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=Ov.some(t=>null==s?void 0:s.startsWith(t));if(s&&r)return`Content-Type ${s} is not supported`;const{hostname:o,isHostDenied:l}=bv(i,e);return l?o+" is in deny list":null}({r:t,options:e,url:i});return Ee(n)?qv(t,e):Promise.resolve(n)}),jv.apply(this,arguments)}let Hv=null;function Uv(t,e,i){if(!("performance"in e))return()=>{};if(Hv)return wv.warn("Network observer already initialised, doing nothing"),()=>{};const n=i?Object.assign({},io,i):io,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&&ho.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=>kv(t)||Sv(t)&&i.initiatorTypes.includes(t.initiatorType)).flatMap(t=>Pv({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=>kv(t)||Sv(t)&&i.initiatorTypes.includes(t.initiatorType)&&(t=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>Pv({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=xv("request",i.recordHeaders),s=xv("response",i.recordHeaders),r=_v(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=>(Tv({type:"request",headers:d,url:l,recordBody:i.recordBody})&&(a.requestBody=Mv({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),Tv({type:"response",headers:n,url:l,recordBody:i.recordBody})&&(a.responseBody=Mv({body:c.response,options:i,url:l})),Ev(e,"xmlhttprequest",r.url,u,h).then(e=>{t({requests:Pv({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){wv.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=xv("request",i.recordHeaders),s=xv("response",i.recordHeaders),r=_v(e,"fetch",r=>function(){var o=ne(function*(o,l){let a,u;try{a=new Request(o,l)}catch(t){return wv.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),!Av(null==l?void 0:l.body)&&Tv({type:"request",headers:t,url:o,recordBody:i.recordBody})&&(h.requestBody=yield function(t){return Bv.apply(this,arguments)}({r:a,options:i,url:o}))}catch(t){wv.error("Failed to record fetch request for network capture",t)}c=e.performance.now(),u=Cv(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),Tv({type:"response",headers:t,url:o,recordBody:i.recordBody})&&(h.responseBody=yield function(t){return jv.apply(this,arguments)}({r:u,options:i,url:o}))}catch(t){wv.error("Failed to record fetch response for network capture",t)}return u}finally{Ev(e,"fetch",a.url,c,d).then(e=>{t({requests:Pv({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)),Hv=()=>{r(),o(),l(),Hv=null},Hv}const zv=t=>({name:"rrweb/network@1",observer:Uv,options:t});var Wv,Vv,Gv,Zv,Qv,Jv,Kv,Yv,Xv,tf,ef,nf,sf,rf,of;d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:gv,getRecordNetworkPlugin:zv},d.__PosthogExtensions__.rrweb={record:tv,version:"v2",wasMaxDepthReached:()=>Cc,resetMaxDepthState(){Cc=!1,xc=!1},getLastSnapshotCost:()=>vh,getMutationCost:()=>le({},yh),resetSnapshotCostState(){uh=0,hh=0,ch=0,rh=0,dh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},vh=null,fh=null,ph=[],gh=0,mh=0,yh={slowestBatchMs:0},_h={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},d.rrweb={record:tv,version:"v2"},d.rrwebConsoleRecord={getRecordConsolePlugin:gv},d.getRecordNetworkPlugin=zv,d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initSessionRecording=(t,e)=>new Du(t,e);var lf,af,uf,hf,cf={},df=[],vf=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ff=Array.isArray;function pf(t,e){for(var i in e)t[i]=e[i];return t}function gf(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function mf(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?Wv.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 yf(t,o,n,s,null)}function yf(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?++Gv:s,__i:-1,__u:0};return null==s&&null!=Vv.vnode&&Vv.vnode(r),r}function _f(t){return t.children}function bf(t,e){this.props=t,this.context=e}function wf(t,e){if(null==e)return t.__?wf(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?wf(t):null}function kf(t){if(t.__P&&t.__d){var e=t.__v,i=e.__e,n=[],s=[],r=pf({},e);r.__v=e.__v+1,Vv.vnode&&Vv.vnode(r),Pf(t.__P,r,e,t.__n,t.__P.namespaceURI,32&e.__u?[i]:null,n,null==i?wf(e):i,!!(32&e.__u),s),r.__v=e.__v,r.__.__k[r.__i]=r,Af(n,r,s),e.__e=e.__=null,r.__e!=i&&Sf(r)}}function Sf(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}),Sf(t)}function xf(t){(!t.__d&&(t.__d=!0)&&Zv.push(t)&&!Cf.__r++||Qv!=Vv.debounceRendering)&&((Qv=Vv.debounceRendering)||Jv)(Cf)}function Cf(){try{for(var t,e=1;Zv.length;)Zv.length>e&&Zv.sort(Kv),t=Zv.shift(),e=Zv.length,kf(t)}finally{Zv.length=Cf.__r=0}}function $f(t,e,i,n,s,r,o,l,a,u,h){var c,d,v,f,p,g,m,y=n&&n.__k||df,_=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]=yf(null,o,null,null,null):ff(o)?o=t.__k[r]=yf(_f,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=t.__k[r]=yf(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=Ef(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=wf(l)),Lf(l,l));return n}(i,e,y,a,_),c=0;_>c;c++)null!=(v=i.__k[c])&&(d=-1!=v.__i&&y[v.__i]||cf,v.__i=c,g=Pf(t,v,d,s,r,o,l,a,u,h),f=v.__e,v.ref&&d.ref!=v.ref&&(d.ref&&Df(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=Tf(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 Tf(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=Tf(s[r],e,i,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=wf(t)),i.insertBefore(t.__e,e||null)),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function Ef(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 If(t,e,i){"-"==e[0]?t.setProperty(e,null==i?"":i):t[e]=null==i?"":"number"!=typeof i||vf.test(e)?i:i+"px"}function Mf(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||If(t.style,e,"");if(i)for(e in i)n&&i[e]==n[e]||If(t.style,e,i[e])}else if("o"==e[0]&&"n"==e[1])r=e!=(e=e.replace(ef,"$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[tf]=n[tf]:(i[tf]=nf,t.addEventListener(e,r?rf:sf,r)):t.removeEventListener(e,r?rf:sf,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 Rf(t){return function(e){if(this.l){var i=this.l[e.type+t];if(null==e[Xv])e[Xv]=nf++;else if(i[tf]>e[Xv])return;return i(Vv.event?Vv.event(e):e)}}}function Pf(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=Vv.__b)&&h(e);t:if("function"==typeof C){c=o.length;try{if(y=e.props,_=C.prototype&&C.prototype.render,$=(h=C.contextType)&&n[h.__c],b=h?$?$.props.value:h.__:n,i.__c?m=(d=e.__c=i.__c).__=d.__E:(_?e.__c=d=new C(y,b):(e.__c=d=new bf(y,b),d.constructor=C,d.render=Nf),$&&$.sub(d),d.state||(d.state={}),d.__n=n,v=d.__d=!0,d.__h=[],d._sb=[]),_&&null==d.__s&&(d.__s=d.state),_&&null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=pf({},d.__s)),pf(d.__s,C.getDerivedStateFromProps(y,d.__s))),f=d.props,p=d.state,d.__v=e,v)_&&null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),_&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(_&&null==C.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,b),e.__v==i.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,b)){e.__v!=i.__v&&(d.props=y,d.state=d.__s,d.__d=!1),e.__e=i.__e,e.__k=i.__k,e.__k.some(function(t){t&&(t.__=e)}),df.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break t}null!=d.componentWillUpdate&&d.componentWillUpdate(y,d.__s,b),_&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(f,p,g)})}if(d.context=b,d.props=y,d.__P=t,d.__e=!1,w=Vv.__r,k=0,_)d.state=d.__s,d.__d=!1,w&&w(e),h=d.render(d.props,d.state,d.context),df.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=pf(pf({},n),d.getChildContext())),_&&!v&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(f,p)),S=null!=h&&h.type===_f&&null==h.key?Ff(h.props.children):h,l=$f(t,ff(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--;)gf(r[x]);Of(e)}else e.__e=i.__e,!e.__k&&i.__k&&(e.__k=i.__k),t.then||Of(e);Vv.__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||cf,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&&(Vv.__m&&Vv.__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&&Wv.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||Mf(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||Mf(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=""),$f("template"==e.type?t.content:t,ff(d)?d:[d],e,i,n,"foreignObject"==y?"http://www.w3.org/1999/xhtml":s,r,o,r?r[0]:i.__k&&wf(i,0),l,a),null!=r)for(u=r.length;u--;)gf(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])&&Mf(t,u,f,g[u],s),u="checked",null!=p&&p!=t[u]&&Mf(t,u,p,g[u],s))}return t}(i.__e,e,i,n,s,r,o,a,u);return(h=Vv.diffed)&&h(e),128&e.__u?void 0:l}function Of(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(Of))}function Af(t,e,i){for(var n=0;i.length>n;n++)Df(i[n],i[++n],i[++n]);Vv.__c&&Vv.__c(e,t),t.some(function(e){try{t=e.__h,e.__h=[],t.some(function(t){t.call(e)})}catch(t){Vv.__e(t,e.__v)}})}function Ff(t){return"object"!=typeof t||null==t||t.__b>0?t:ff(t)?t.map(Ff):void 0!==t.constructor?null:pf({},t)}function Df(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){Vv.__e(t,i)}}function Lf(t,e,i){var n,s;if(Vv.unmount&&Vv.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Df(n,null,e)),null!=(n=t.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(t){Vv.__e(t,e)}n.base=n.__P=n.__n=null}if(n=t.__k)for(s=0;n.length>s;s++)n[s]&&Lf(n[s],e,i||"function"!=typeof t.type);i||gf(t.__e),t.__c=t.__=t.__e=void 0}function Nf(t,e,i){return this.constructor(t,i)}function qf(t,e,i){var n,s,r,o;e==document&&(e=document.documentElement),Vv.__&&Vv.__(t,e),s=(n="function"==typeof i)?null:i&&i.__k||e.__k,r=[],o=[],Pf(e,t=(!n&&i||e).__k=mf(_f,null,[t]),s||cf,cf,e.namespaceURI,!n&&i?[i]:s?null:e.firstChild?Wv.call(e.childNodes):null,r,!n&&i?i:s?s.__e:e.firstChild,n,o),Af(r,t,o),t.props.children=null}Wv=df.slice,Vv={__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}},Gv=0,bf.prototype.setState=function(t,e){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=pf({},this.state);"function"==typeof t&&(t=t(pf({},i),this.props)),t&&pf(i,t),null!=t&&this.__v&&(e&&this._sb.push(e),xf(this))},bf.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),xf(this))},bf.prototype.render=_f,Zv=[],Jv="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Kv=function(t,e){return t.__v.__b-e.__v.__b},Cf.__r=0,Yv=Math.random().toString(8),Xv="__d"+Yv,tf="__a"+Yv,ef=/(PointerCapture)$|Capture$/i,nf=0,sf=Rf(!1),rf=Rf(!0),of=0;var Bf=0,jf=[],Hf=Vv,Uf=Hf.__b,zf=Hf.__r,Wf=Hf.diffed,Vf=Hf.__c,Gf=Hf.unmount,Zf=Hf.__;function Qf(t,e){Hf.__h&&Hf.__h(af,t,Bf||e),Bf=0;var i=af.__H||(af.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function Jf(t){return Bf=1,function(t,e){var i=Qf(lf++,2);if(i.t=t,!i.__c&&(i.__=[lp(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=af,!af.__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};af.__f=!0;var s=af.shouldComponentUpdate,r=af.componentWillUpdate;af.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)},af.shouldComponentUpdate=n}return i.__N||i.__}(lp,t)}function Kf(t,e){var i=Qf(lf++,3);!Hf.__s&&op(i.__H,e)&&(i.__=t,i.u=e,af.__H.__h.push(i))}function Yf(t){return Bf=5,Xf(function(){return{current:t}},[])}function Xf(t,e){var i=Qf(lf++,7);return op(i.__H,e)&&(i.__=t(),i.__H=e,i.__h=t),i.__}function tp(t){var e=af.context[t.__c],i=Qf(lf++,9);return i.c=t,e?(null==i.__&&(i.__=!0,e.sub(af)),e.props.value):t.__}function ep(){for(var t;t=jf.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(sp),e.__h.some(rp),e.__h=[]}catch(i){e.__h=[],Hf.__e(i,t.__v)}}}Hf.__b=function(t){af=null,Uf&&Uf(t)},Hf.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Zf&&Zf(t,e)},Hf.__r=function(t){zf&&zf(t),lf=0;var e=(af=t.__c).__H;e&&(uf===af?(e.__h=[],af.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.length&&ep(),lf=0)),uf=af},Hf.diffed=function(t){Wf&&Wf(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==jf.push(e)&&hf===Hf.requestAnimationFrame||((hf=Hf.requestAnimationFrame)||np)(ep)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),uf=af=null},Hf.__c=function(t,e){e.some(function(t){try{t.__h.some(sp),t.__h=t.__h.filter(function(t){return!t.__||rp(t)})}catch(i){e.some(function(t){t.__h&&(t.__h=[])}),e=[],Hf.__e(i,t.__v)}}),Vf&&Vf(t,e)},Hf.unmount=function(t){Gf&&Gf(t);var e,i=t.__c;i&&i.__H&&(i.__H.__.some(function(t){try{sp(t)}catch(t){e=t}}),i.__H=void 0,e&&Hf.__e(e,i.__v))};var ip="function"==typeof requestAnimationFrame;function np(t){var e,i=function(){clearTimeout(n),ip&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(i,35);ip&&(e=requestAnimationFrame(i))}function sp(t){var e=af,i=t.__c;"function"==typeof i&&(t.__c=void 0,i()),af=e}function rp(t){var e=af;t.__c=t.__(),af=e}function op(t,e){return!t||t.length!==e.length||e.some(function(e,i){return e!==t[i]})}function lp(t,e){return"function"==typeof e?e(t):e}const ap={GZipJS:"gzip-js",Base64:"base64"},up={Activation:"events",Cancellation:"cancelEvents"},hp={Button:"button",Tab:"tab",Selector:"selector"},cp={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},dp={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},vp={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},fp={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},pp={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},gp={Once:"once",Recurring:"recurring",Always:"always"},mp={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},yp={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},_p={Popover:"popover",Inline:"inline"};function bp(t){let e=!0;return{dispose(){if(e){e=!1;const i=t();i&&ke(i.then)&&i.then(void 0,()=>{})}}}}const wp=Ws("[Surveys]"),kp="PostHog is not capturing, so a survey response cannot be recorded";function Sp(t){return ke(t.is_capturing)?t.is_capturing():!t.has_opted_out_capturing()}function xp(t){return!(!t.start_date||t.end_date)}function Cp(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 $p=(t,e)=>`${t}${function(t){return t.current_iteration&&t.current_iteration>0?`${t.id}_${t.current_iteration}`:t.id}(e)}`,Tp=t=>$p("seenSurvey_",t),Ep=t=>{try{const e=Tp(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){wp.error("Failed to persist survey seen state",t)}},Ip=[vp.Popover,vp.Widget,vp.API],Mp={ignoreConditions:!1,ignoreDelay:!1,displayType:_p.Popover},Rp="logs",Pp=Ws("[Stylesheet Loader]"),Op=t,Ap=n,Fp="#020617",Dp={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:cp.Right,widgetType:hp.Tab,widgetLabel:"Feedback",widgetColor:"black",zIndex:String(2147483645),disabledButtonOpacity:"0.6",maxWidth:"300px",textSubtleColor:"#939393",boxPadding:"20px 24px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"10px",shuffleQuestions:!1,surveyPopupDelaySeconds:void 0,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:Fp,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},Lp=[cp.Center,cp.Left,cp.Right];function Np(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 qp(t=Dp.backgroundColor){let e;"#"===t[0]&&(e=Np(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=Np(i)),!e)return Fp;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?Fp:"white"}return Fp}const Bp=(t,e,i)=>{const n=rg(t),s=Ap.querySelector(`.${n}`);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};const r=Ap.createElement("div");((t,e,i)=>{const n=le(le({},Dp),i),s=t.style,r=!Lp.includes(n.position)||e===vp.Widget&&(null==i?void 0:i.widgetType)===hp.Tab;s.setProperty("--ph-survey-font-family",function(t){if("inherit"===t)return"inherit";const e='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return t?`${t}, ${e}`:`-apple-system, ${e}`}(n.fontFamily)),s.setProperty("--ph-survey-box-padding",n.boxPadding),s.setProperty("--ph-survey-max-width",n.maxWidth),s.setProperty("--ph-survey-z-index",n.zIndex),s.setProperty("--ph-survey-border-color",n.borderColor),r?(s.setProperty("--ph-survey-border-radius",n.borderRadius),s.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(s.setProperty("--ph-survey-border-bottom","none"),s.setProperty("--ph-survey-border-radius",`${n.borderRadius} ${n.borderRadius} 0 0`)),s.setProperty("--ph-survey-background-color",n.backgroundColor),s.setProperty("--ph-survey-box-shadow",n.boxShadow),s.setProperty("--ph-survey-disabled-button-opacity",n.disabledButtonOpacity),s.setProperty("--ph-survey-submit-button-color",n.submitButtonColor),s.setProperty("--ph-survey-submit-button-text-color",(null==i?void 0:i.submitButtonTextColor)||qp(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",qp(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||qp(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",qp(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)||qp(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||(Pp.error("prepare_external_dependency_stylesheet returned null"),null)})(Ap,':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||Ap.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},jp=({responses:t,survey:e,surveySubmissionId:i,posthog:n,isSurveyCompleted:s,properties:r,surveyLanguage:o,questionSnapshots:l})=>{var a;n?Sp(n)&&(Ep(e),n.capture(mp.SENT,le(le(le(le({[yp.SURVEY_NAME]:e.name,[yp.SURVEY_ID]:e.id,[yp.SURVEY_ITERATION]:e.current_iteration,[yp.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,[yp.SURVEY_SUBMISSION_ID]:i,[yp.SURVEY_COMPLETED]:s},o&&{[yp.SURVEY_LANGUAGE]:o}),{},{sessionRecordingUrl:null===(a=n.get_session_replay_url)||void 0===a?void 0:a.call(n)},ea(t,e,l)),r),{},{$set:{[na(e,"responded")]:!0}})),s&&(Op.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:e.id}})),sg(e),n.reloadFeatureFlags())):wp.error("[survey sent] event not captured, PostHog instance not found.")},Hp=(t,e,i)=>{var n;return le(le({[yp.SURVEY_NAME]:t.name,[yp.SURVEY_ID]:t.id,[yp.SURVEY_ITERATION]:t.current_iteration,[yp.SURVEY_ITERATION_START_DATE]:t.current_iteration_start_date,[yp.SURVEY_PARTIALLY_COMPLETED]:ia(null==e?void 0:e.responses)},(null==e?void 0:e.surveyLanguage)&&{[yp.SURVEY_LANGUAGE]:e.surveyLanguage}),{},{sessionRecordingUrl:null===(n=i.get_session_replay_url)||void 0===n?void 0:n.call(i),[yp.SURVEY_SUBMISSION_ID]:null==e?void 0:e.surveySubmissionId},ea(null==e?void 0:e.responses,t,null==e?void 0:e.questionSnapshots))},Up=(t,e,i,n)=>{if(!e)return void wp.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const s=ig(t),r=s?s.surveyLanguage:n;e.capture(mp.DISMISSED,le(le(le({},Hp(t,s,e)),r&&{[yp.SURVEY_LANGUAGE]:r}),{},{$set:{[na(t,"dismissed")]:!0}})),sg(t),Ep(t),Op.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:t.id}}))},zp=(t,e)=>{if(!e)return void wp.error("[survey abandoned] event not captured, PostHog instance not found.");const i=(t=>$p("abandonedSurvey_",t))(t);try{if("true"===localStorage.getItem(i))return}catch(t){return}const n=ig(t);if(n){try{localStorage.setItem(i,"true")}catch(t){}e.capture(mp.ABANDONED,Hp(t,n,e),{transport:"sendBeacon"})}},Wp=t=>t.map(t=>({sort:Math.floor(10*Math.random()),value:t})).sort((t,e)=>t.sort-e.sort).map(t=>t.value),Vp=(t,e)=>t.length===e.length&&t.every((t,i)=>t===e[i])?e.reverse():e,Gp=t=>{const e=t.map(t=>t.id);return e.every(t=>!!t)?e:void 0},Zp=(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?Vp(t.questions,Wp(t.questions)):t.questions;var i},Qp=t=>ha(t)||ng(t),Jp=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,xf(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"+of++,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}),Kp=()=>tp(Jp),Yp=({component:t,children:e,renderAsHtml:i,style:n})=>function(t,e,i){var n,s,r,o,l=pf({},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?Wv.call(arguments,2):i),yf(t.type,l,n||t.key,s||t.ref,null)}(t,i?{dangerouslySetInnerHTML:{__html:e},style:n}:{children:e,style:n});function Xp(t,e){var i,n;if(!(null===(i=t.conditions)||void 0===i?void 0:i.url))return!0;const s=vr(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 va[o](r,[s])}const tg=t=>$p("inProgressSurvey_",t),eg=(t,e)=>{try{localStorage.setItem(tg(t),JSON.stringify(e))}catch(t){wp.error("Error setting in-progress survey state in localStorage",t)}},ig=t=>{try{const e=localStorage.getItem(tg(t));if(e)return JSON.parse(e)}catch(t){wp.error("Error getting in-progress survey state from localStorage",t)}return null},ng=t=>{const e=ig(t);return!Ie(null==e?void 0:e.surveySubmissionId)},sg=t=>{try{localStorage.removeItem(tg(t))}catch(t){wp.error("Error clearing in-progress survey state from localStorage",t)}};function rg(t,e=!1){const i=`PostHogSurvey-${t.id}`;return e?`.${i}`:i}function og(t,e=cp.Right,i){if(t===vp.ExternalSurvey)return{};switch(e){case cp.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case cp.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case cp.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case cp.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case cp.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case cp.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case cp.Left:return{left:"30px"};case cp.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:t===vp.Widget&&i===hp.Tab?"60px":"30px"}}}var lg=0;function ag(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:--lg,__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 Vv.vnode&&Vv.vnode(u),u}const ug=ag("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ag("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"})}),hg=ag("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ag("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"})}),cg=ag("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ag("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"})}),dg=ag("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ag("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"})}),vg=ag("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ag("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"})}),fg=ag("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:ag("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"})}),pg=ag("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:ag("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"})}),gg=({fill:t="currentColor"}={})=>ag("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:[ag("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),ag("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})]}),mg=ag("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ag("g",{"clip-path":"url(#clip0_2415_6911)",children:[ag("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:ag("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),ag("g",{mask:"url(#mask0_2415_6911)",children:[ag("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"}),ag("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"}),ag("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"}),ag("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"}),ag("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"}),ag("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"})]})]}),ag("defs",{children:ag("clipPath",{id:"clip0_2415_6911",children:ag("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function yg({urlParams:t}){const e=t?Object.entries(t).map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"):"";return ag("a",{href:"https://posthog.com/surveys"+(e?`?${e}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",mg]})}function _g({text:e,submitDisabled:i,appearance:n,onSubmit:s,link:r,onPreviewSubmit:o,skipSubmitButton:l,canGoBack:a,onBack:u}){const{isPreviewMode:h}=tp(Jp),c=!!a&&!!u,d=!l&&ag("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 ag("div",{className:"bottom-section",children:[c?ag("div",{className:"form-buttons form-buttons-with-back",children:[ag("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:u,children:n.backButtonText||"Back"}),d]}):d,!n.whiteLabel&&ag(yg,{urlParams:{utm_source:"survey-footer"}})]})}function bg({question:t,forceDisableHtml:e,htmlFor:i}){return ag("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[ag(t.type===fp.Open?"label":"h3",{className:"survey-question",htmlFor:i,children:t.question}),t.description&&Yp({component:mf("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!e&&"text"!==t.descriptionContentType})]})}function wg({onClick:t}){const{isPreviewMode:e}=tp(Jp);return ag("button",{className:"form-cancel",onClick:t,disabled:e,"aria-label":"Close survey",type:"button",children:gg({fill:"black"})})}const kg=t;function Sg({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onClose:r}){const{isPopup:o}=tp(Jp);return Kf(()=>{const t=t=>{"Enter"!==t.key&&"Escape"!==t.key||(t.preventDefault(),r())};return er(kg,"keydown",t),()=>{kg.removeEventListener("keydown",t)}},[r]),ag("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&ag(wg,{onClick:()=>r()}),ag("h3",{className:"thank-you-message-header",children:t}),e&&Yp({component:mf("p",{className:"thank-you-message-body"}),children:e,renderAsHtml:!n&&"text"!==i}),o&&ag(_g,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>r()})]})}function xg({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onStart:r}){const{isPopup:o,onPreviewSubmit:l,onPopupSurveyDismissed:a}=tp(Jp);return ag("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&ag(wg,{onClick:()=>a()}),t&&ag("h3",{className:"intro-screen-header",children:t}),e&&Yp({component:mf("p",{className:"intro-screen-body"}),children:e,renderAsHtml:!n&&"text"!==i}),ag(_g,{text:s.introScreenButtonText||"Get started",submitDisabled:!1,appearance:s,onSubmit:r,onPreviewSubmit:()=>l(null)})]})}const Cg=t=>we(t)&&t.every(t=>$e(t));function $g({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,displayQuestionIndex:r,initialValue:o,canGoBack:l,onBack:a}){const{isPreviewMode:u}=Kp(),h=Yf(null),[c,d]=Jf(()=>$e(o)?o:""),v=null==i?void 0:i.disableAutofocus;Kf(()=>{v||setTimeout(()=>{var t;u||null===(t=h.current)||void 0===t||t.focus()},100)},[u,v]);const f=`surveyQuestion${r}`,p=Xf(()=>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=Bs(t.validation,he),m=Bs(t.validation,ce),y=Xf(()=>function(t,e){const i=1===t?void 0:t;return i&&e?`Enter ${i}-${e} characters`:i?`Enter at least ${i} ${1===i?"character":"characters"}`:e?`Maximum ${e} ${1===e?"character":"characters"}`:void 0}(g,m),[g,m]),_=()=>{p||n(c.trim())},b=()=>{p||s(c.trim())};return ag(_f,{children:[ag("div",{className:"question-container",children:[ag(bg,{question:t,forceDisableHtml:e,htmlFor:f}),ag("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&&ag("div",{className:"validation-hint",children:y})]}),ag(_g,{text:t.buttonText||"Submit",submitDisabled:!!p,appearance:i,onSubmit:_,onPreviewSubmit:b,canGoBack:l,onBack:a})]})}function Tg({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,canGoBack:r,onBack:o}){return ag(_f,{children:[ag("div",{className:"question-container",children:ag(bg,{question:t,forceDisableHtml:e})}),ag(_g,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:()=>n("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:r,onBack:o})]})}function Eg({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]=Jf(()=>Me(o)?o:we(o)&&o.length>0&&Me(parseInt(o[0]))?parseInt(o[0]):$e(o)&&Me(parseInt(o))?parseInt(o):null),f="emoji"===t.display&&2===t.scale,{isPreviewMode:p}=Kp(),g=t=>p?r(t):s(t);return ag(_f,{children:[ag("div",{className:"question-container",children:[ag(bg,{question:t,forceDisableHtml:e}),ag("div",{className:"rating-section",children:[ag("div",{className:"rating-options",children:["emoji"===t.display&&ag("div",{className:"rating-options-emoji"+(f?" rating-options-emoji-2":""),children:null===(u=Ag[t.scale])||void 0===u?void 0:u.map((e,n)=>ag("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&&ag("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${h-c+1}, minmax(0, 1fr))`},children:Fg(t.scale).map((e,s)=>ag(Ig,{displayQuestionIndex:i,active:d===e,appearance:n,num:e,setActiveNumber(e){v(e),t.skipSubmitButton&&g(e)}},s))})]}),!f&&ag("div",{className:"rating-text",children:[ag("div",{children:t.lowerBoundLabel}),ag("div",{children:t.upperBoundLabel})]})]})]}),ag(_g,{text:t.buttonText||(null==n?void 0:n.submitButtonText)||"Submit",submitDisabled:Ee(d)&&!t.optional,appearance:n,onSubmit:()=>s(d),onPreviewSubmit:()=>r(d),skipSubmitButton:t.skipSubmitButton,canGoBack:l,onBack:a})]})}function Ig({num:t,active:e,displayQuestionIndex:i,setActiveNumber:n}){return ag("button",{"aria-label":`Rate ${t}`,className:`ratings-number question-${i}-rating-${t} ${e?"rating-active":""}`,type:"button",onClick(){n(t)},children:t})}function Mg({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:l,onBack:a}){const u=Yf(null),h=Xf(()=>(t=>{if(!t.shuffleOptions)return t.choices;const e=t.choices;let i="";t.hasOpenChoice&&(i=e.pop());const n=Vp(e,Wp(e));return t.hasOpenChoice&&(t.choices.push(i),n.push(i)),n})(t),[t]),[c,d]=Jf(()=>((t,e)=>$e(t)||Cg(t)?t:e===fp.SingleChoice?null:[])(o,t.type)),[v,f]=Jf(()=>((t,e)=>{if($e(t)&&!e.includes(t))return{isSelected:!0,inputValue:t};if(Cg(t)){const i=t.find(t=>!e.includes(t));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,h)),{isPreviewMode:p}=Kp(),g=t.type===fp.SingleChoice,m=t.type===fp.MultipleChoice,y=t.skipSubmitButton&&g&&!t.hasOpenChoice,_=(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]))},b=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||!Ee(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 ag(_f,{children:[ag("div",{className:"question-container",children:[ag(bg,{question:t,forceDisableHtml:e}),ag("fieldset",{className:"multiple-choice-options limit-height",children:[ag("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 ag("label",{className:s?"choice-option-open":"",children:[ag("div",{className:"response-choice",children:[ag("input",{type:g?"radio":"checkbox",name:r,checked:l,onChange:()=>_(e,s),id:r,"aria-controls":o}),ag("span",{children:s?`${e}:`:e})]}),s&&ag("input",{type:"text",ref:u,id:o,name:`question${i}Open`,value:v.inputValue,onKeyDown:w,onInput:b,onClick(t){v.isSelected||_(e,!0),t.stopPropagation()},"aria-label":`${e} - please specify`})]},n)})]})]}),ag(_g,{text:t.buttonText||"Submit",submitDisabled:k(),appearance:n,onSubmit:S,onPreviewSubmit:S,skipSubmitButton:y,canGoBack:l,onBack:a})]})}const Rg=[1,2,3,4,5],Pg=[1,2,3,4,5,6,7],Og=[0,1,2,3,4,5,6,7,8,9,10],Ag={2:[fg,pg],3:[cg,hg,ug],5:[dg,cg,hg,ug,vg]};function Fg(t){switch(t){case 5:default:return Rg;case 7:return Pg;case 10:return Og}}const Dg=Ws("[Surveys]");function Lg(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?pp.End:r;if(s.branching.type===pp.End)return pp.End;if(s.branching.type===pp.SpecificQuestion){if(Number.isInteger(s.branching.index))return s.branching.index}else if(s.branching.type===pp.ResponseBased){if(s.type===fp.SingleChoice){var o;let t=s.choices.indexOf(`${i}`);if(-1===t&&s.hasOpenChoice&&(t=s.choices.length-1),null===(o=s.branching)||void 0===o||null===(o=o.responseValues)||void 0===o?void 0:o.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===pp.End?pp.End:r}}else if(s.type===fp.Rating){var l;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const t=function(t,e){if(2===e){if(1>t||t>2)throw new Error("The response must be in range 1-2");return 1===t?"positive":"negative"}if(3===e){if(1>t||t>3)throw new Error("The response must be in range 1-3");return 1===t?"negative":2===t?"neutral":"positive"}if(5===e){if(1>t||t>5)throw new Error("The response must be in range 1-5");return t>2?3===t?"neutral":"positive":"negative"}if(7===e){if(1>t||t>7)throw new Error("The response must be in range 1-7");return t>3?4===t?"neutral":"positive":"negative"}if(10===e){if(0>t||t>10)throw new Error("The response must be in range 0-10");return t>6?t>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(i,s.scale);if(null===(l=s.branching)||void 0===l||null===(l=l.responseValues)||void 0===l?void 0:l.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===pp.End?pp.End:r}}return r}return Dg.warn("Falling back to next question index due to unexpected branching type"),r}const Ng=Ws("[SurveyTranslations]");function qg(t,e){const i=function(t){return function({overrideLanguage:t,storedPersonProperties:e,locale:i},n){const s=sa(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?sa(t.language):null}(e);if(r)return null==n||n.info(`Using person property language: ${r}`),r;const o=sa(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:Ma()},Ng)}(e);if(!i)return Ng.info("No user language detected"),{survey:t,language:null};const n=aa(t,i,Ng);return{survey:n.survey,language:n.matchedKey}}const Bg=t,jg=n,Hg="ph:show_survey_widget",Ug="PHWidgetSurveyClickListener";function zg(t,e){try{const i=t.getBoundingClientRect(),n=Bg.innerHeight,s=Bg.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:Dp.zIndex}}catch(t){return wp.warn("Failed to calculate trigger position:",t),null}}var Wg=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)ng(e)&&zp(e,this._posthog)},this.handlePopoverSurvey=(t,e,{resumeDelayFromActivation:i=!1}={})=>{var n,s,r,o,l,a;if(!Sp(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)===cp.NextToTrigger&&(null===(r=c.appearance)||void 0===r?void 0:r.widgetSelector)){const t=jg.querySelector(c.appearance.widgetSelector);var g;t&&(p=zg(t,parseInt((null===(g=c.appearance)||void 0===g?void 0:g.maxWidth)||Dp.maxWidth))||{})}const m=(null===(o=c.appearance)||void 0===o?void 0:o.surveyPopupDelaySeconds)||0,{shadow:y}=Bp(c,this._posthog);this.xi.set(y,y.host);const _={posthog:this._posthog,survey:c,removeSurveyFromFocus:this.Ni,properties:d,style:p,isSurveyCompleted:f,skipShownEvent:null==e?void 0:e.skipShownEvent,surveyLanguage:h};if(this.$i=_,0>=m)return this.Ii=!0,qf(ag(Jg,le({},_)),y);const b=()=>{this.Ii=!0;const{survey:i,language:n}=this.Ai(t);this.Mi=n;const s=this.Li(i,e),r=le(le({},_),{},{survey:s,surveyLanguage:n});this.$i=r,qf(ag(Jg,le(le({},r),{},{survey:le(le({},s),{},{appearance:le(le({},s.appearance),{},{surveyPopupDelaySeconds:0})})})),y)},w=()=>{if(!Sp(this._posthog)||!this.qi(c))return wp.info(`Survey ${c.id} no longer eligible when its display delay elapsed; not displaying`),this.Ni(c);b()},k=i?null===(l=this._posthog.surveys)||void 0===l||null===(l=l._surveyEventReceiver)||void 0===l||null===(a=l.getActivationTimestamp)||void 0===a?void 0:a.call(l,c.id):void 0,S=Me(k)?Math.max(0,Date.now()-k):0,x=Math.max(0,1e3*m-S);if(0>=x)return w();const C=Bg.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}=Bp(i,this._posthog);this.xi.set(s,s.host),(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===hp.Tab&&this.Si.set(t.id,t),r&&qf(ag(Yg,{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(Ug),this.ki.delete(t),wp.info(`Removed click listener for survey ${t}`))},this.Hi=t=>{this.zi(t)||(this.Ui(t),this.Bi(t.id))},this.Wi=t=>{this.zi(t)||(this.Ui(t),this.Si.delete(t.id))},this.zi=t=>{try{var e;const i=jg.querySelector(rg(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=jg.querySelector(e),n=this.ki.get(t.id);if(i){if(this.ji(t),n){if(i===n.element)return;wp.info(`Selector element changed for survey ${t.id}. Re-attaching listener.`),this.Bi(t.id)}if(!i.hasAttribute(Ug)){const e=e=>{var i,n;e.stopPropagation();const s=(null===(i=t.appearance)||void 0===i?void 0:i.position)===cp.NextToTrigger?zg(e.currentTarget,parseInt((null===(n=t.appearance)||void 0===n?void 0:n.maxWidth)||Dp.maxWidth)):{};Bg.dispatchEvent(new CustomEvent(Hg,{detail:{surveyId:t.id,position:s}}))};er(i,"click",e),i.setAttribute(Ug,"true"),this.ki.set(t.id,{element:i,listener:e,survey:t}),wp.info(`Attached click listener for feedback button survey ${t.id}`)}}else n&&this.Hi(t)},this.renderPopover=t=>{if(!Sp(this._posthog))return;const{survey:e,language:i}=this.Ai(t),{shadow:n}=Bp(e,this._posthog);this.xi.set(n,n.host),qf(ag(Jg,{posthog:this._posthog,survey:e,removeSurveyFromFocus:this.Ni,surveyLanguage:i}),n)},this.renderSurvey=(t,e,i)=>{var n;if(!Sp(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)),qf(ag(Jg,{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=Sp(this._posthog),i=t.filter(t=>e&&(t.type===vp.Popover||t.type===vp.Widget)),n=new Set(i.map(t=>t.id));for(const t of Array.from(this.wi.keys()))n.has(t)||this.cancelSurvey(t);const s=this.Gi(i),r=new Set,o=new Set;s.forEach(t=>{if(t.type===vp.Widget){var e,i,n,s;if((null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===hp.Tab)return o.add(t.id),void this.ji(t);(null===(i=t.appearance)||void 0===i?void 0:i.widgetType)===hp.Selector&&(null===(n=t.appearance)||void 0===n?void 0:n.widgetSelector)&&(r.add(t.id),this.Vi(t,null===(s=t.appearance)||void 0===s?void 0:s.widgetSelector))}Ee(this.Qi)&&t.type===vp.Popover&&this.handlePopoverSurvey(t,void 0,{resumeDelayFromActivation:!0})}),this.ki.forEach(({survey:t})=>{r.has(t.id)||this.Hi(t)}),this.Si.forEach((t,e)=>{o.has(e)||this.Wi(t)})},t)},this.Fi=t=>{Ee(this.Qi)||wp.error(`Survey ${this.Qi} already in focus. Cannot add survey ${t.id}.`),this.Qi=t.id},this.Ni=t=>{this.Qi!==t.id&&wp.error(`Survey ${t.id} is not in focus. Cannot remove survey ${t.id}.`),this.Pi(t.id),this.Qi=null,this.Mi=null,this.Ii=!1,this.$i=null,this.Oi=void 0,this.Ui(t)},this._posthog=t,this.Qi=null,this.Ti=()=>this.Ji(),er(Bg,"languagechange",this.Ti),this.Ri=t.onFeatureFlags(()=>this.Ji())}Ji(){if(Ee(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}=Bp(s,this._posthog);qf(ag(Jg,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)&&(wp.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&&(Bg.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)=>{qf(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=ng(t),r=ng(e);if(s&&!r)return-1;if(!s&&r)return 1;const o=t.schedule===gp.Always,l=e.schedule===gp.Always;return o&&!l?1:!o&&l?-1:((null===(i=t.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)-((null===(n=e.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)})}Ai(t){return qg(t,this._posthog)}Zi(t,e,i){if(this.Ci.has(t.id))return!1;const{params:n}=function(){const t={};let e=!1;const i=Bg.location.search.replace(/^\?/,"");if(!i)return{params:t,autoSubmit:e};const n=i.split("&");for(const i of n){const[n,s]=i.split("=");if(!n||Ce(s))continue;const r=decodeURIComponent(n),o=decodeURIComponent(s);if("auto_submit"===r&&"true"===o){e=!0;continue}const l=r.match(/^q(\d+)$/);if(l){const e=parseInt(l[1],10);t[e]||(t[e]=[]),t[e].push(o)}}return{params:t,autoSubmit:e}}();if(0===Object.keys(n).length)return!1;wp.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)&&jp({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)];wp.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=Xl(t.id);try{switch(t.type){case fp.SingleChoice:{if(!t.choices||0===t.choices.length)return void zs.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 zs.warn(`[Survey Prefill] Invalid choice index for q${n}: ${s[0]}`);i[r]=t.choices[e];break}case fp.MultipleChoice:{if(!t.choices||0===t.choices.length)return void zs.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 zs.warn(`[Survey Prefill] No valid choices for q${n}`);const o=[...new Set(e.map(e=>t.choices[e]))];e.length>o.length&&zs.warn(`[Survey Prefill] Removed duplicate choices for q${n}`),i[r]=o;break}case fp.Rating:{const e=parseInt(s[0],10),o=t.scale||10;if(isNaN(e)||0>e||e>o)return void zs.warn(`[Survey Prefill] Invalid rating for q${n}: ${s[0]} (scale: 0-${o})`);i[r]=e;break}default:zs.info(`[Survey Prefill] Question type ${t.type} does not support prefill`)}}catch(t){zs.error(`[Survey Prefill] Error converting q${n}:`,t)}}),i}(t,e);if(0===Object.keys(n).length)return wp.warn("[Survey Prefill] No valid responses after conversion"),null;const s=El(),{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=Xl(e.id);Ce(i[t])||(s[t]=i[t])}r.push(n);const o=Lg(t,n,e.id?i[Xl(e.id)]:null);if(o===pp.End)return{startQuestionIndex:t.questions.length,skippedResponses:s,skippedIndices:r};n=o}return{startQuestionIndex:n,skippedResponses:s,skippedIndices:r}}(t,Object.keys(e).map(t=>parseInt(t,10)),n),a=r>=t.questions.length;return eg(t,{surveySubmissionId:s,responses:n,lastQuestionIndex:r,questionOrder:Gp(t.questions),visitedIndices:l,surveyLanguage:i}),wp.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:n,submissionId:s,startQuestionIndex:r,isSurveyCompleted:a,skippedResponses:o}}catch(t){return wp.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,wp.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||Xp(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 va[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==Ap?void 0:Ap.querySelector(t.conditions.selector))}(e)}rr(t){var e;return Qp(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(!xp(t))return n.eligible=!1,n.reason=`Survey is not running. It was completed on ${t.end_date}`,n;if(!Ip.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,Fl.Ot("lastSeenSurveyDate"))?(t=>!!Fl.Ot(Tp(t))&&!Qp(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 Sp(this._posthog)?{eligible:!0}:{eligible:!1,reason:kp}}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(!ua(t)&&!Cp(t))return!0;const i=null===(e=this._posthog.surveys)||void 0===e||null===(e=e._surveyEventReceiver)||void 0===e?void 0:e.getSurveys();return!!(null==i?void 0:i.includes(t.id))}ar(t){var e;return!(null===(e=t.feature_flag_keys)||void 0===e?void 0:e.length)||t.feature_flag_keys.every(({key:t,value:e})=>!t||!e||this.er(e))}qi(t){return this.checkSurveyEligibility(t).eligible&&this.ir(t)&&this.sr(t)&&this.ar(t)}Ui(t){try{const e=jg.querySelector(rg(t,!0));(null==e?void 0:e.shadowRoot)&&(qf(null,e.shadowRoot),this.xi.delete(e.shadowRoot)),null==e||e.remove()}catch(e){wp.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 Vg(t,e){if(!jg||!Bg)return;const i=new Wg(t);if(t.config.disable_surveys_automatic_display)return wp.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===e)return wp.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=()=>{jg.hidden?r():(i.callSurveysAndEvaluateDisplayLogic(!1),s())};return er(jg,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{r(),jg.removeEventListener("visibilitychange",o)}),i}function Gg({survey:t,removeSurveyFromFocus:e=()=>{},setSurveyVisible:i,isPreviewMode:n=!1,posthog:s}){Kf(()=>{var r;if(n||!(null===(r=t.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var n;const r=t.type===vp.Widget,o=Xp(t,s),l=(null===(n=t.appearance)||void 0===n?void 0:n.widgetType)===hp.Tab&&r;if(!o)return wp.info(`Hiding survey ${t.id} because URL does not match`),i(!1),e(t);l&&(wp.info(`Showing survey ${t.id} because it is a feedback button tab and URL matches`),i(!0))};er(Bg,"popstate",o),er(Bg,"hashchange",o);const l=Bg.history.pushState,a=Bg.history.replaceState;return Bg.history.pushState=function(...t){l.apply(this,t),o()},Bg.history.replaceState=function(...t){a.apply(this,t),o()},()=>{Bg.removeEventListener("popstate",o),Bg.removeEventListener("hashchange",o),Bg.history.pushState=l,Bg.history.replaceState=a}},[n,t,e,i,s])}const Zg=200;function Qg(t=dp.Right){switch(t){case dp.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case dp.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case dp.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function Jg({survey:t,forceDisableHtml:e,posthog:i,style:n={},previewPageIndex:s,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:l=()=>{},onPreviewBack:a=()=>{},onPopupSurveyDismissed:u=()=>{},onCloseConfirmationMessage:h=()=>{},properties:c,isSurveyCompleted:d,skipShownEvent:v,surveyLanguage:f}){var p,g,m,y,_,b,w,k,S,x,C,T;const E=Yf(null),I=Number.isInteger(s),{isPopupVisible:M,isSurveySent:R,hidePopupWithAnimation:P}=function(t,e,i,n,s,r,o,l,a){const[u,h]=Jf(n||0===i||t.type===vp.ExternalSurvey),[c,d]=Jf(!1),v=Yf(!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 ${Zg}ms ease-out`,i.style.opacity="0",setTimeout(()=>{v.current=!1,e()},250)):e()},p=e=>{e.detail.surveyId===t.id&&f()};return Kf(()=>{if(!e)return void wp.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(Xp(t,e)){var i;h(!0),Bg.dispatchEvent(new Event("PHSurveyShown")),l||e.capture(mp.SHOWN,le(le({[yp.SURVEY_NAME]:t.name,[yp.SURVEY_ID]:t.id,[yp.SURVEY_ITERATION]:t.current_iteration,[yp.SURVEY_ITERATION_START_DATE]:t.current_iteration_start_date},a&&{[yp.SURVEY_LANGUAGE]:a}),{},{sessionRecordingUrl:null===(i=e.get_session_replay_url)||void 0===i?void 0:i.call(e)}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}};er(Bg,"PHSurveyClosed",p),er(Bg,"PHSurveySent",r);const u=i>0?setTimeout(o,i):void 0;return Ce(u)&&o(),()=>{Ce(u)||clearTimeout(u),Ce(s)||clearTimeout(s),Bg.removeEventListener("PHSurveyClosed",p),Bg.removeEventListener("PHSurveySent",r)}},[]),Gg({survey:t,removeSurveyFromFocus:s,setSurveyVisible:h,isPreviewMode:n,posthog:e}),{isPopupVisible:u,isSurveySent:c,setIsPopupVisible:h,hidePopupWithAnimation:f}}(t,i,(null===(p=t.appearance)||void 0===p?void 0:p.surveyPopupDelaySeconds)?1e3*t.appearance.surveyPopupDelaySeconds:0,I,r,o,E,v,f),O=R||s===t.questions.length||!0===d,[A,F]=Jf(!1),D=Xf(()=>!!ig(t),[t]),L=!(!(null===(g=t.appearance)||void 0===g?void 0:g.introScreenHeader)&&!(null===(m=t.appearance)||void 0===m?void 0:m.introScreenDescription)),N=I?-1===s:!!(null===(y=t.appearance)||void 0===y?void 0:y.displayIntroScreen)&&L&&!A&&!D,q=Xf(()=>{const e=ig(t),n=(null==e?void 0:e.surveySubmissionId)||El();return{isPreviewMode:I,previewPageIndex:s,onPopupSurveyDismissed(){f?Up(t,i,I,f):Up(t,i,I),u()},isPopup:o||!1,surveySubmissionId:n,onPreviewSubmit:l,onPreviewBack:a,posthog:i,properties:c,surveyLanguage:f}},[I,s,o,i,t,u,l,a,c,f]);return M?ag(Jp.Provider,{value:q,children:ag("div",{className:"ph-survey",style:le(le({},og(t.type,null===(_=t.appearance)||void 0===_?void 0:_.position,null===(b=t.appearance)||void 0===b?void 0:b.widgetType)),n),ref:E,children:O?ag(Sg,{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||Dp,onClose(){P(),h()}}):N?ag(xg,{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||Dp,onStart:()=>F(!0)}):ag(Kg,{survey:t,forceDisableHtml:!!e,posthog:i})})}):null}function Kg({survey:t,forceDisableHtml:e,posthog:i}){var n,s;const r=Xf(()=>{const e=ig(t);if(!e)return null;const i=Me(e.lastQuestionIndex);return!i||i&&e.lastQuestionIndex>=0&&t.questions.length>e.lastQuestionIndex?e:(sg(t),null)},[t]),[o,l]=Jf(()=>((null==r?void 0:r.responses)&&wp.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[a,u]=Jf(!1),{previewPageIndex:h,onPopupSurveyDismissed:c,isPopup:d,onPreviewSubmit:v,onPreviewBack:f,surveySubmissionId:p,isPreviewMode:g,properties:m,surveyLanguage:y}=tp(Jp),[_,b]=Jf(()=>{const e=null==r?void 0:r.lastQuestionIndex,i=Me(e)&&e>=0&&t.questions.length>e?e:0;return Me(h)&&h>=0?h:i}),[w,k]=Jf(()=>{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]=Jf(()=>{var e;const i=ig(t);return null!==(e=null==i?void 0:i.questionSnapshots)&&void 0!==e?e:{}}),C=Xf(()=>Gp(Zp(t,r)),[t.id,r]),T=Xf(()=>{if(!C||new Set(C).size!==C.length)return Zp(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]);Kf(()=>{!g||Ce(h)||0>h||b(h)},[h,g]);const E=!!(null===(n=t.appearance)||void 0===n?void 0:n.allowGoBack)&&(g?(null!=h?h:0)>0:w.length>0),I=T.at(_);return I?ag("form",{className:"survey-form",name:"surveyForm",children:[d&&!0!==(null===(s=t.appearance)||void 0===s?void 0:s.hideCancelButton)&&ag(wg,{onClick(){c()}}),ag("div",{className:"survey-box","data-question-index":_,children:[a&&ag("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),Xg({question:I,forceDisableHtml:e,displayQuestionIndex:_,appearance:t.appearance||Dp,onSubmit:e=>(({res:e,displayQuestionIndex:n,questionId:s})=>{if(!i)return void wp.error("onNextButtonClick called without a PostHog instance.");if(!Sp(i))return void u(!0);if(u(!1),!s)return void wp.error("onNextButtonClick called without a questionId.");const r=Xl(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=Lg(t,n,e),v=d===pp.End,f=[...w,n];if(v||(k(f),b(d),eg(t,{surveySubmissionId:p,responses:a,lastQuestionIndex:d,questionOrder:Gp(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=>Xl(t))),n=Object.fromEntries(Object.entries(a).filter(([t])=>e.has(t)));jp({responses:n,survey:t,surveySubmissionId:p,isSurveyCompleted:v,posthog:i,properties:m,surveyLanguage:y,questionSnapshots:c})}})({res:e,displayQuestionIndex:_,questionId:I.id}),onPreviewSubmit:v,initialValue:I.id?o[Xl(I.id)]:void 0,canGoBack:E,onBack(){if(g)return void f();if(0===w.length)return;const e=w[w.length-1],i=w.slice(0,-1);k(i),b(e),eg(t,{surveySubmissionId:p,responses:o,lastQuestionIndex:e,questionOrder:Gp(T),visitedIndices:i,surveyLanguage:y,questionSnapshots:S})}})]})]}):null}function Yg({survey:t,forceDisableHtml:e,posthog:i,readOnly:n,surveyLanguage:s}){var r,o,l,a,u,h,c;const[d,v]=Jf(!0),[f,p]=Jf(!1),[g,m]=Jf({}),y=Yf(void 0),_=()=>{(f||!i||n||Sp(i))&&p(!f)};if(Kf(()=>{var e;if(!i)return void wp.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&&(wp.info(`Received show event for feedback button survey ${t.id}`),m(n.detail.position||{}),_())};return er(Bg,Hg,s),()=>{Ce(y.current)||(clearTimeout(y.current),y.current=void 0),Bg.removeEventListener(Hg,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]),Gg({survey:t,setSurveyVisible:v,posthog:i}),!d)return null;const b=()=>{t.schedule!==gp.Always&&v(!1),Ce(y.current)||clearTimeout(y.current),y.current=setTimeout(()=>{y.current=void 0,p(!1)},200)};return ag(_f,{children:["tab"===(null===(a=t.appearance)||void 0===a?void 0:a.widgetType)&&ag("button",{className:"ph-survey-widget-tab "+((null===(u=t.appearance)||void 0===u?void 0:u.tabPosition)===dp.Top?"widget-tab-top":""),onClick:_,disabled:n,style:Qg(null===(h=t.appearance)||void 0===h?void 0:h.tabPosition),children:(null===(c=t.appearance)||void 0===c?void 0:c.widgetLabel)||""}),f&&ag(Jg,{posthog:i,survey:t,forceDisableHtml:e,style:g,onPopupSurveyDismissed:b,onCloseConfirmationMessage:b,surveyLanguage:s})]})}const Xg=({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 fp.Open:return mf($g,le(le({},u),{},{question:t,key:t.id}));case fp.Link:return mf(Tg,le(le({},u),{},{question:t,key:t.id}));case fp.Rating:return mf(Eg,le(le({},u),{},{question:t,key:t.id}));case fp.SingleChoice:case fp.MultipleChoice:return mf(Mg,le(le({},u),{},{question:t,key:t.id}));default:return wp.error(`Unsupported question type: ${t.type}`),null}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.generateSurveys=Vg,d.extendPostHogWithSurveys=Vg;const tm=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},em=1e4,im=(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),nm=(t,e,i)=>{const n=JSON.stringify(t);if(i.remaining>=n.length)return im(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 im(e,JSON.stringify(t.slice(0,s)),i)},sm=t=>void 0!==t&&"function"!=typeof t&&"symbol"!=typeof t&&"bigint"!=typeof t,rm=(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}},om=(t,e,i)=>{if(!i.truncated)if(Se(t)){if(i.seen.has(t))return void rm(e||"circular","[Circular]",i);i.seen.add(t);try{for(const n in t)try{if(!{}.hasOwnProperty.call(t,n))continue;if(om(t[n],e?`${e}.${n}`:n,i),i.truncated)return}catch(t){continue}}catch(t){}}else rm(e,t,i)},lm=(t,e,i,n,s=!1,r)=>{if(!sm(t))return!s||im(e,"null",i);if(Ee(t)||(t=>{try{return Me(t)||Pe(t)}catch(t){return!1}})(t))return im(e,JSON.stringify(t),i);if("string"==typeof t)return nm(t,e,i);if(!Se(t)&&!we(t))return im(e,JSON.stringify(t),i);if(n.has(t))return nm("[Circular]",e,i);n.add(t);try{const r=t.toJSON;if(ke(r))return lm(r.call(t),e,i,n,s)}catch(t){}try{const n={}.toString.call(t);if("[object String]"===n)return nm(String(t.valueOf()),e,i);if("[object Number]"===n||"[object Boolean]"===n)return im(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 lm(o,e,i,n,s,r)}if(we(t)){if(!im(e,"[",i))return!1;for(let s=0;t.length>s;s++){if(s>0&&!im(e,",",i))return!1;let r;try{r=t[s]}catch(t){r=void 0}if(!lm(r,e,i,n,!0))return!1}return im(e,"]",i)}if(!im(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{om(l,s,r)}catch(t){}if(!sm(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(!im(e,a,i))return!1;const d=e.length,v=lm(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 im(e,"}",i)},am=(t,e)=>{const i=[],n={remaining:e,truncated:!1},s=Se(t[0])?{result:{},keysRemaining:50,sizeRemaining:em,truncated:!1,seen:new WeakSet([t[0]])}:void 0;for(let e=0;t.length>e&&(0>=e||im(i," ",n))&&lm(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)||{}}},um={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},hm=t=>"canCapture"in t,cm=t=>hm(t)?t.canCapture?t.getExtension(Rp):void 0:t.is_capturing()?t.logs:void 0,dm=(t,e,i)=>{if(hm(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(um)){const r=i=>(...r)=>{let o=!1;try{const i=e;if(r.length>0&&!s&&i){const e=cm(i);if(e){s=!0,o=!0;const{body:l,truncated:a,attributes:u}=am(r,em),h=le(le({},n),a?{body_truncated:"true"}:{}),c={level:um[t],body:l,attributes:le(le({"log.source":`console.${t}`},h),u)};dm(i,e,c)}}}catch(t){}finally{o&&(s=!1),i.apply(d.console,r)}},o=d.console[t];i.push(_v(d.console,t,t=>{const e=r(t);return e.__rrweb_original__=tm(o),e}))}return()=>{e=void 0,i.forEach(t=>t())}},replayConsoleBuffer(t,e){const i=cm(t);if(i)for(const t of e)try{var n;const{body:e,truncated:s,attributes:r}=am(t.args,em);null===(n=i.captureBufferedConsoleLog)||void 0===n||n.call(i,{level:um[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 vm=t=>Ne(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),fm=Ws("[Error tracking]"),pm="webkit-masked-url:",gm=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],mm=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",pm],ym=["__firefox__","__gCrWeb"];function _m(){return new fn([new Fn,new Wn,new Ln,new Dn,new Un,new Hn,new qn,new zn],function(t,...e){return(i,n=0)=>{const s=[],r=i.split("\n"),o=Math.min(r.length,n+1e3),l=[];for(let i=n;o>i;i++){const n=r[i];if(n.length>1024)continue;const o=Tn.test(n)?n.replace(Tn,"$1"):n;if(!o.match(/\S*Error: /)){for(const i of e){const e=i(o,t);if(e){s.push(e);const t=In(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(On(s,l)>=50)break}}const a=[...l].sort((t,e)=>e.start-t.start),u=a[a.length-1];if(u){const t=Rn(s,u);s.splice(u.start-t,t);for(const e of a)e.start-=t}for(const t of a)Mn(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++)An(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",Sn,$n))}const bm=Ws("[ExceptionAutocapture]"),wm=_m(),km=(t,e)=>{try{return t()}catch(t){return e}},Sm=(t,e)=>km(()=>t(e()),void 0),xm=t=>km(()=>ke(t)&&ke(t.call),!1),Cm=(t,e)=>km(()=>{t[e].__POSTHOG_INSTRUMENTED__=!0},void 0),$m=(t,e,i)=>{km(()=>{var i;null===(i=t[e])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),km(()=>{t[e]=i},void 0)},Tm=e=>{const i=t;i||bm.info("window not available, cannot wrap onerror");const n=km(()=>i.onerror,void 0);return i.onerror=function(...t){var i;return Sm(e,()=>wm.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}})),!!xm(n)&&null!==(i=n(...t))&&void 0!==i&&i},Cm(i,"onerror"),()=>$m(i,"onerror",n)},Em=(e,i=!1)=>{const n=t;n||bm.info("window not available, cannot wrap onUnhandledRejection");const s=km(()=>n.onunhandledrejection,void 0);return n.onunhandledrejection=function(t){var n;return Sm(e,()=>wm.buildFromUnknown(t,{mechanism:{handled:!1}})),xm(s)?null!==(n=s(t))&&void 0!==n&&n:i},Cm(n,"onunhandledrejection"),()=>$m(n,"onunhandledrejection",s)},Im={wrapOnError:Tm,wrapUnhandledRejection:Em,wrapConsoleError(t){const e=console;e||bm.info("console not available, cannot wrap console.error");const i=km(()=>e.error,void 0);return e.error=function(...e){km(()=>e.length>1&&$e(e[0])&&(/^\[PostHog\.js\](?: |$)/.test(e[0])||"rrweb logger error:"===e[0]),!1)||Sm(t,()=>{let t;t=1==e.length?e[0]:e.join(" ");const i=e.find(t=>t instanceof Error);return wm.buildFromUnknown(i||t,{mechanism:{handled:!0,type:"onconsole"},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),xm(i)&&i(...e)},Cm(e,"error"),()=>$m(e,"error",i)}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.errorWrappingFunctions=Im,d.posthogErrorWrappingFunctions=Im;const Mm=(t,e)=>{if(!ke(null==t?void 0:t.capture))return;const i=null==e?void 0:e.autocaptureExceptions,n=!Ee(i)&&"object"==typeof i&&we(i.errors_to_ignore)?i.errors_to_ignore.reduce((t,e)=>{try{t.push(new RegExp(e))}catch(t){bm.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){bm.error("Failed to capture exception for a legacy client",t)}};Tm(t=>{n.some(e=>t.$exception_list.some(t=>e.test(t.value||"")))||s(t)}),Em(s,!0)};d.extendPostHogWithExceptionAutoCapture=Mm,d.extendPostHogWithExceptionAutocapture=Mm;const Rm="X-POSTHOG-SESSION-ID",Pm="X-POSTHOG-WINDOW-ID",Om="X-POSTHOG-DISTINCT-ID",Am=[Rm,Pm,Om],Fm=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],Dm=(t,e)=>({}.hasOwnProperty.call(t,e)),Lm=t=>"object"==typeof t&&!Ee(t)||ke(t),Nm=t=>"undefined"!=typeof Request&&(t instanceof Request||"[object Request]"==={}.toString.call(t)),qm=e=>{try{var i;return Nm(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}},Bm=(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(Rm,t),s.set(Pm,e),o=!0}const l=(t=>ke(t)?t():t)(e);return l&&"$posthog_cookieless"!==l&&(s.set(Om,l),o=!0),o};d.__PosthogExtensions__=d.__PosthogExtensions__||{};const jm={_patchFetch:(e,i,n)=>_v(t,"fetch",t=>function(s,r){const o=arguments.length>1?[s,r]:[s];let l=o;try{const t=qm(s);if(t)if(Nm(s)){const t=new Request(s,r);Bm(e,i,n,t.url,t.headers),l=[t]}else{const o=new Headers(Lm(r)?r.headers:void 0);if(Bm(e,i,n,t,o)){const t=((t,e)=>{if(Ce(t)||Ee(t))return{headers:e};if(!Lm(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)=>Dm(t,e)?Reflect.get(t,e):Reflect.get(i,e,i),has:(t,e)=>Dm(t,e)||e in i,ownKeys(t){const e=new Set(Reflect.ownKeys(t));return Reflect.ownKeys(i).forEach(t=>e.add(t)),Fm.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&&Fm.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)=>_v(t.XMLHttpRequest.prototype,"open",t=>function(s,r,o=!0,l,a){const u=this,h=new Headers,c=qm(r);c&&Bm(e,i,n,c,h);const d=t.call(u,s,r,o,l,a);return Am.forEach(t=>{const e=h.get(t);if(e)try{u.setRequestHeader(t,e)}catch(t){}}),d})};d.__PosthogExtensions__.tracingHeadersPatchFns=jm,d.postHogTracingHeadersPatchFns=jm,"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 Hm=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 Um=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},zm=t=>{if("loading"===document.readyState)return"loading";const e=Um();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"},Wm=t=>{const e=t.nodeName;return 1===t.nodeType?e.toLowerCase():e.toUpperCase().replace(/^#/,"")},Vm=t=>{let e="";try{for(;9!==(null==t?void 0:t.nodeType);){var i;const n=t,s=n.id?"#"+n.id:[Wm(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},Gm=new WeakMap;function Zm(t,e){let i=Gm.get(e);return i||(i=new WeakMap,Gm.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}let Qm=-1;const Jm=()=>Qm,Km=t=>{addEventListener("pageshow",e=>{e.persisted&&(Qm=e.timeStamp,t(e))},!0)},Ym=(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)))}},Xm=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},ty=()=>{var t,e;return null!==(t=null===(e=Um())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let ey=-1;const iy=new Set,ny=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,sy=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of iy)t();isFinite(ey)||(ey="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",sy,!0))}},ry=(t=!1)=>{if(t&&(ey=1/0),0>ey){var e;const t=ty(),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;ey=null!=i?i:ny(),addEventListener("visibilitychange",sy,!0),addEventListener("prerenderingchange",sy,!0),Km(()=>{setTimeout(()=>{ey=ny()})})}return{get firstHiddenTime(){return ey},onHidden(t){iy.add(t)}}},oy=(t,e=-1,i,n=0,s,r,o)=>{const l=Um(),a=(null==l?void 0:l.navigationId)||0;let u="navigate";return i?u=i:0>Jm()?l&&(document.prerendering||ty()>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}},ly=(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){}},ay=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},uy=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},hy=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var cy=class{constructor(){this.u=void 0}};const dy=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},vy=[1800,3e3],fy=(t,e={})=>{const i=ay(e);dy(()=>{const n=Zm(e,cy),s=ry();let r,o=oy("FCP");const l=ly(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(l.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-ty(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});l&&(r=Ym(t,o,vy,e.reportAllChanges),Km(i=>{o=oy("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Jm()),r=Ym(t,o,vy,e.reportAllChanges),Xm(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&ly(["soft-navigation"],i=>{i.forEach(i=>{n.u&&i.navigationId&&uy(n.u,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=oy("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Ym(t,o,vy,e.reportAllChanges),r(!0)})},e)})},py=[.1,.25],gy=t=>t.find(t=>{var e;return 1===(null===(e=t.node)||void 0===e?void 0:e.nodeType)})||t[0],my=(t,e={})=>{const i=Zm(e=Object.assign({},e),Hm),n=new WeakMap;i.t=t=>{var i;if(null==t||null===(i=t.sources)||void 0===i?void 0:i.length){const i=gy(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:Vm(o);n.set(i,t)}}},((t,e={})=>{const i=ry();fy(hy(()=>{let n,s=oy("CLS",0);const r=Zm(e,Hm),o=(i,o,l,a,u)=>{s=oy("CLS",0,i,o,l,a,u),r.o=0,n=Ym(t,s,py,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"];ay(e)&&h.push("soft-navigation");const c=ly(h,u);c&&(n=Ym(t,s,py,e.reportAllChanges),i.onHidden(()=>{u(c.takeRecords()),n(!0)}),Km(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Jm()),Xm(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=gy(s.sources);t&&(e={largestShiftTarget:n.get(t),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:t,largestShiftEntry:s,loadState:zm(s.startTime)})}}return Object.assign(t,{attribution:e})})(e))},e)},yy=(t,e={})=>{const i=Zm(e=Object.assign({},e),cy);ay(e)&&(i.u=new Map),fy(e=>{t((t=>{let e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:zm(Jm())};if("soft-navigation"!==t.navigationType){if(t.entries.length){const i=Um(),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:zm(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 _y=0,by=1/0,wy=0;const ky=t=>{for(const e of t)e.interactionId&&(by=Math.min(by,e.interactionId),wy=Math.max(wy,e.interactionId),_y=wy?(wy-by)/7+1:0)};let Sy;const xy=()=>{var t;return Sy?_y:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var Cy=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return xy()-this.h}D(){this.h=xy(),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 $y=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=hy(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})}},Ty=[200,500],Ey=(t,e={})=>{const i=Zm(e=Object.assign({},e),Cy);let n=[],s=[],r=0;const o=new WeakMap,l=new WeakMap;let a=!1;const u=()=>{a||($y(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:Vm(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};ly(["long-animation-frame"],t=>{n=n.concat(t),u()},e),((t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=ry();dy(()=>{var n;"interactionCount"in performance||Sy||(Sy=ly(["event"],ky,{durationThreshold:0}));let s,r=oy("INP");const o=Zm(e,Cy),l=(i,n,l,a,u)=>{o.D(),r=oy("INP",-1,i,n,l,a,u),s=Ym(t,r,Ty,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)=>{$y(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.l(e):u(e);a(),e&&s(!0)})},c=["event","first-input"];ay(e)&&c.push("soft-navigation");const d=ly(c,h,le(le({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=Ym(t,r,Ty,e.reportAllChanges),d&&(i.onHidden(()=>{h(d.takeRecords(),!0)}),Km(()=>{l("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Jm())}))})})(e=>{t((t=>{if(0===t.entries.length){const e={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:t.value,loadState:zm(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:zm(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 Iy=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 My=50;const Ry=[];ly(["resource"],t=>{for(const e of t)Ry.push(e),Ry.length>My&&Ry.shift()});const Py=(t,e={})=>{null!=(e=Object.assign({},e)).resourceBufferSize&&(My=e.resourceBufferSize);const i=Zm(e,Iy),n=new WeakMap;ay(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:Vm(i);n.set(t,o)}else t.id&&n.set(t,`#${t.id}`)},((t,e={})=>{let i=!1;const n=ay(e);dy(()=>{let s,r=ry(),o=oy("LCP");const l=Zm(e,Iy),a=(n,l,a,u,h)=>{o=oy("LCP",-1,n,l,a,u,h),s=Ym(t,o,$,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=ry(!0))},u=t=>{var e;l.u&&t.navigationId&&uy(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-ty(),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=ly(c,h);if(d){s=Ym(t,o,$,e.reportAllChanges);const r=["keydown","click","visibilitychange"],l=t=>{if(t.isTrusted&&!i){const t=o.id;$y(()=>{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});Km(n=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Jm()),s=Ym(t,o,$,e.reportAllChanges),Xm(()=>{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&&(Ry.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=Um(),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 Oy=-1;const Ay=()=>Oy,Fy=t=>{addEventListener("pageshow",e=>{e.persisted&&(Oy=e.timeStamp,t(e))},!0)},Dy=(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()))},Ny=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},qy=()=>{var t,e;return null!==(t=null===(e=Ny())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let By=-1;const jy=new Set,Hy=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Uy=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of jy)t();isFinite(By)||(By="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",Uy,!0))}},zy=(t=!1)=>{if(t&&(By=1/0),0>By){var e;const t=qy(),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;By=null!=i?i:Hy(),addEventListener("visibilitychange",Uy,!0),addEventListener("prerenderingchange",Uy,!0),Fy(()=>{setTimeout(()=>{By=Hy()})})}return{get firstHiddenTime(){return By},onHidden(t){jy.add(t)}}},Wy=(t,e=-1,i,n=0,s,r,o)=>{const l=Ny(),a=(null==l?void 0:l.navigationId)||0;let u="navigate";return i?u=i:0>Ay()?l&&(document.prerendering||qy()>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}},Vy=new WeakMap;function Gy(t,e){let i=Vy.get(e);return i||(i=new WeakMap,Vy.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}var Zy=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 Qy=(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){}},Jy=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},Ky=(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 Xy=class{constructor(){this.l=void 0}};const t_=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},e_=[1800,3e3],i_=(t,e={})=>{const i=Jy(e);t_(()=>{const n=Gy(e,Xy),s=zy();let r,o=Wy("FCP");const l=Qy(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(l.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-qy(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});l&&(r=Dy(t,o,e_,e.reportAllChanges),Fy(i=>{o=Wy("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Ay()),r=Dy(t,o,e_,e.reportAllChanges),Ly(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Qy(["soft-navigation"],i=>{i.forEach(i=>{n.l&&i.navigationId&&Ky(n.l,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Wy("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Dy(t,o,e_,e.reportAllChanges),r(!0)})},e)})},n_=[.1,.25],s_=(t,e={})=>{const i=zy();i_(Yy(()=>{let n,s=Wy("CLS",0);const r=Gy(e,Zy),o=(i,o,l,a,u)=>{s=Wy("CLS",0,i,o,l,a,u),r.i=0,n=Dy(t,s,n_,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"];Jy(e)&&h.push("soft-navigation");const c=Qy(h,u);c&&(n=Dy(t,s,n_,e.reportAllChanges),i.onHidden(()=>{u(c.takeRecords()),n(!0)}),Fy(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Ay()),Ly(n)}),setTimeout(n))}))};let r_=0,o_=1/0,l_=0;const a_=t=>{for(const e of t)e.interactionId&&(o_=Math.min(o_,e.interactionId),l_=Math.max(l_,e.interactionId),r_=l_?(l_-o_)/7+1:0)};let u_;const h_=()=>{var t;return u_?r_:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var c_=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return h_()-this.u}M(){this.u=h_(),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 d_=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})}},v_=[200,500],f_=(t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=zy();t_(()=>{var n;"interactionCount"in performance||u_||(u_=Qy(["event"],a_,{durationThreshold:0}));let s,r=Wy("INP");const o=Gy(e,c_),l=(i,n,l,a,u)=>{o.M(),r=Wy("INP",-1,i,n,l,a,u),s=Dy(t,r,v_,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)=>{d_(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.h(e):u(e);a(),e&&s(!0)})},c=["event","first-input"];Jy(e)&&c.push("soft-navigation");const d=Qy(c,h,le(le({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=Dy(t,r,v_,e.reportAllChanges),d&&(i.onHidden(()=>{h(d.takeRecords(),!0)}),Fy(()=>{l("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Ay())}))})};var p_=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 g_=[2500,4e3],m_=(t,e={})=>{let i=!1;const n=Jy(e);t_(()=>{let s,r=zy(),o=Wy("LCP");const l=Gy(e,p_),a=(n,l,a,u,h)=>{o=Wy("LCP",-1,n,l,a,u,h),s=Dy(t,o,g_,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=zy(!0))},u=t=>{var e;l.l&&t.navigationId&&Ky(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-qy(),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=Qy(c,h);if(d){s=Dy(t,o,g_,e.reportAllChanges);const r=["keydown","click","visibilitychange"],l=t=>{if(t.isTrusted&&!i){const t=o.id;d_(()=>{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});Fy(n=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Ay()),s=Dy(t,o,g_,e.reportAllChanges),Ly(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})},y_={onLCP:Py,onCLS:my,onFCP:yy,onINP:Ey,withoutAttribution:{onLCP:m_,onCLS:s_,onFCP:i_,onINP:f_}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=y_,d.__PosthogExtensions__.postHogWebVitalsCallbacks=y_,d.postHogWebVitalsCallbacks=y_;const __={onLCP:m_,onCLS:s_,onFCP:i_,onINP:f_};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=__,d.__PosthogExtensions__.postHogWebVitalsCallbacks=__,d.postHogWebVitalsCallbacks=__,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>__;const b_={onLCP:Py,onCLS:my,onFCP:yy,onINP:Ey,withoutAttribution:{onLCP:m_,onCLS:s_,onFCP:i_,onINP:f_}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=b_,d.__PosthogExtensions__.postHogWebVitalsCallbacks=b_,d.postHogWebVitalsCallbacks=b_;const w_={onLCP:m_,onCLS:s_,onFCP:i_,onINP:f_};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=w_,d.__PosthogExtensions__.postHogWebVitalsCallbacks=w_,d.postHogWebVitalsCallbacks=w_,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>w_;var k_=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 S_="$copy_autocapture",x_=Ws("[AutoCapture]");function C_(t,e){return e.length>t?e.slice(0,t)+"...":e}function $_(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do{e=e.previousSibling}while(e&&!pr(e));return e}function T_(e,{e:i,maskAllElementAttributes:n,maskAllText:s,elementAttributeIgnoreList:r,elementsChainAsString:o,disableCaptureUrlHashes:l}){var a,u;if(!pr(e))return{props:{}};const h=[e],c=new Set([e]);let d=e;for(;d.parentNode&&!gr(d,"body")&&1e3>h.length;){if(yr(d.parentNode)){const t=d.parentNode.host;if(c.has(t))break;c.add(t),h.push(t),d=t;continue}if(!pr(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=>gr(t,"button")||gr(t,"a")):-1;v>0&&(s=s||h.slice(0,v+1).some(t=>!Br(t)||jr(t)));const f=[],p={};let g,m=!1,y=!1;if(Gs(h,t=>{const e=Br(t);if(gr(t,"a")){const i=t.getAttribute("href");m=!!(e&&i&&Qr(i))&&(l?rn(i):i)}fe(wr(t),"ph-no-capture")&&(y=!0),f.push(function(t,e,i,n,s=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};Cr.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?C_(1024,Jr(t)):C_(1024,Sr(t)));const l=wr(t);l.length>0&&(o.classes=l.filter(function(t){return""!==t})),Gs(t.attributes,function(i){var r;if((!jr(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==n?void 0:n.includes(i.name))&&!e&&Qr(i.value)&&(!$e(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=i.value;"class"===i.name&&(t=_r(t).join(" ")),o["attr__"+i.name]=C_(1024,"href"===i.name&&s?rn(t):t)}});let a=1,u=1,h=t;for(;h=$_(h);)a++,h.tagName===t.tagName&&u++;return o.nth_child=a,o.nth_of_type=u,o}(t,n,s,r,l)),Gs(function(t){if(!Br(t))return{};const e={};return Gs(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&&Qr(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=gr(e,"a")||gr(e,"button")?Jr(e):Sr(e)),m){var _,b;f[0].attr__href=m;const e=null===(_=rr(m))||void 0===_?void 0:_.host,i=null==t||null===(b=t.location)||void 0===b?void 0:b.host;e&&i&&e!==i&&(g=m)}return{props:Zs((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 Qs(s).sort(([t],[e])=>function(t,e){return e>t?-1:t>e?1:0}(t,e)).forEach(([t,e])=>r[Yr(t.toString())]=Yr(e.toString())),n+=":",n+=Qs(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:Xr(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Qs(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 E_=class{uo(){this.ho=void 0,clearTimeout(this.co),this.co=void 0}do(t){var e;if(!Br(t))return!0;const i=null!==(e=this.vo().css_selector_ignorelist)&&void 0!==e?e:Ir,n=new Set;let s=t;for(;s;){if(n.size>=1e3||n.has(s))return!0;n.add(s);const t=s,e=wr(t);if(fe(e,"ph-no-capture")||fe(e,"ph-sensitive")||jr(t)||i.some(e=>$r(t,e)))return!0;const r=s.parentNode;s=yr(r)?r.host:r&&pr(r)?r:null}return!1}fo(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.uo();if("pointerdown"===t.type){this.uo();const i=xr(t);var e;return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&i&&pr(i)&&(this.ho={target:i,excluded:this.do(i),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(e=this.po)||void 0===e?void 0:e.distinctId}))}const i=this.ho;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.uo():"pointerup"===t.type&&(i.released=!0,this.co=setTimeout(()=>this.uo(),0)))}mo(t){var e;const i=this.ho;this.uo();const s=xr(t);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(e=this.po)||void 0===e?void 0:e.distinctId)&&t.pointerId===i.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-i.x)&&5>=Math.abs(t.clientY-i.y)&&s&&(gr(s,"html")||gr(s,"body"))){var r;if(i.excluded)return null;const t=null!==(r=this.vo().css_selector_ignorelist)&&void 0!==r?r:Ir;return[s,null==n?void 0:n.documentElement,null==n?void 0:n.body].some(e=>{if(!e)return!1;const i=wr(e);return fe(i,"ph-no-capture")||fe(i,"ph-sensitive")||!Br(e)||jr(e)||t.some(t=>$r(e,t))})?null:i.target}}constructor(t){this.yo=t,this.name="autocapture",this.bo=!1,this._o=null,this.wo=!1,this.ko=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.So=!1,this.yo.refresh(this.Mr),this.rageclicks=new k_(this.Mr.rageclick),this.xo=null}setup(t){this.Co(),this.po=t;const e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.So?e.dispose():(this.$o=e,this.startIfEnabled())}dispose(){var t;this.So||(this.So=!0,this.po=void 0,null===(t=this.$o)||void 0===t||t.dispose(),this.$o=void 0,this.To())}vo(){return this.yo.refresh(this.Mr),this.Mr}Co(){var t,e;return this.vo(),this.Mr.url_allowlist=null===(t=this.Mr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Mr.url_ignorelist=null===(e=this.Mr.url_ignorelist)||void 0===e?void 0:e.map(t=>new RegExp(t)),this.Mr}Io(){if(!this.isBrowserSupported())return void x_.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!n)return;const e=this.Mo=e=>{e=e||(null==t?void 0:t.event);try{if("blur"===e.type)return void this.uo();if(0===e.type.indexOf("pointer"))return void this.fo(e);const t="click"===e.type?this.mo(e):void 0;if(Ee(t))return;this.Eo(e,"$autocapture",t)}catch(t){x_.error("Failed to capture event",t)}};if(er(t,"blur",e),er(n,"submit",e,{capture:!0}),er(n,"change",e,{capture:!0}),er(n,"click",e,{capture:!0}),Gs(["pointerdown","pointermove","pointerup","pointercancel"],t=>{er(n,t,e,{capture:!0})}),this.vo().capture_copied_text){const e=this.Po=e=>{e=e||(null==t?void 0:t.event);try{this.Eo(e,S_)}catch(t){x_.error("Failed to capture clipboard event",t)}};er(n,"copy",e,{capture:!0}),er(n,"cut",e,{capture:!0}),er(n,"paste",e,{capture:!0})}}To(){this.uo(),this.Mo&&(null==t||t.removeEventListener("blur",this.Mo),Gs(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==n||n.removeEventListener(t,this.Mo,!0)}),null==n||n.removeEventListener("submit",this.Mo,!0),null==n||n.removeEventListener("change",this.Mo,!0),null==n||n.removeEventListener("click",this.Mo,!0),this.Mo=void 0),this.Po&&(null==n||n.removeEventListener("copy",this.Po,!0),null==n||n.removeEventListener("cut",this.Po,!0),null==n||n.removeEventListener("paste",this.Po,!0),this.Po=void 0),this.bo=!1}startIfEnabled(){this.isEnabled||this.uo(),!this.So&&this.po&&this.isEnabled&&!this.bo&&(this.Io(),this.bo=!0)}onRemoteConfig(t){if(this.So)return;if(this.wo=!0,!t.ok)return void this.startIfEnabled();const e=t.config;e.elementsChainAsString&&(this.ko=e.elementsChainAsString);const i=e.autocapture_opt_out;var n;Pe(i)&&(null===(n=this.po)||void 0===n||n.kv.set("$autocapture_disabled_server_side",i),this._o=i),this.startIfEnabled()}setElementSelectors(t){this.xo=t}getElementSelectors(t,e){var i;const s=[];return null===(i=this.xo)||void 0===i||i.forEach(i=>{const r=null==n?void 0:n.querySelectorAll(i);null==r||r.forEach(n=>{t!==n&&e!==n||fe(s,i)||s.push(i)})}),s}get isEnabled(){var t,e;if(this.So)return!1;const i=null===(t=this.po)||void 0===t?void 0:t.kv.get(k),n=this._o,s=this.vo();if(!s.remoteRequestsDisabled&&!this.wo)return!1;const r=s.remoteRequestsDisabled&&!this.wo;if(Ee(n)&&!Pe(i)&&!r)return!1;const o=null!==(e=this._o)&&void 0!==e?e:!!i;return!!s.enabled&&!o}Eo(e,i="$autocapture",n){if(!this.isEnabled)return void this.uo();let s=n||xr(e);mr(s)&&(s=s.parentNode||null);const r=this.Co();var o;"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&r.rageclick&&(null===(o=this.rageclicks)||void 0===o?void 0:o.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&Lr(s,r.rageclick)&&this.Eo(e,"$rageclick",n);const l=i===S_,a=l?le(le({},r),{},{dom_event_allowlist:void 0}):r;if(s&&function(e,i,n,s,r,o){var l;if(!t||Nr(e))return!1;if((null==n?void 0:n.url_allowlist)&&!br(n.url_allowlist,o))return!1;if((null==n?void 0:n.url_ignorelist)&&br(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}=qr(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(!Tr(u,null==n?void 0:n.css_selector_allowlist))return!1;if(Tr(u,null!==(l=null==n?void 0:n.css_selector_ignorelist)&&void 0!==l?l:Ir))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&&(Cr.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}=T_(s,{e:e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.ko,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(o)return!1;const a=this.getElementSelectors(s,l);if(a&&a.length>0&&(n.$element_selectors=a),i===S_){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=kr(e);if(!i)return!1;n.$selected_content=i,n.$clipboard_text_length=null!==(c=null==e?void 0:e.length)&&void 0!==c?c:0}n.$copy_type=i}return null===(u=this.po)||void 0===u||u.capture(i,n).catch(t=>x_.error("Failed to capture event",t)),!0}}isBrowserSupported(){return ke(null==n?void 0:n.querySelectorAll)}};const I_={};function M_(t,e){const i=xr(t);return i?le({node:i,originalEvent:t,timestamp:Date.now()},e):null}function R_(t,e){return Math.abs(t)<Math.abs(e)?0>e?"up":"down":0>t?"left":"right"}function P_(t){return"swipe"===t.type?"$dead_swipe":"$dead_click"}const O_="canvas,video,audio,embed,object";function A_(t,e){return Me(t)&&t>=e}function F_(t,e=1e3){return t>=0&&e>t?t:void 0}function D_(t,e,i=1e3){return Me(e)?F_(t-e,i):void 0}var L_=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=>{Ee(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(pr(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=M_(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()),Ee(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&&(pr(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=Dr(xr(t))||Dr(null!=l?l:null)||Dr(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=xr(t);let i;if(Dr(e))i=e;else if("Caret"===(null==s?void 0:s.type)){var f;Dr(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.zr,this.Or].some(t=>Me(t)&&t>=i.timestamp))return;var h,c;if(this.Ur()&&(null!==(h=null==n||null===(c=n.elementsFromPoint)||void 0===c?void 0:c.call(n,i.x,i.y))&&void 0!==h?h:[]).some(t=>{var e;return null===(e=t.matches)||void 0===e?void 0:e.call(t,O_)}))return;const d=M_(s,{type:"swipe",swipeDirection:R_(o,l),swipeDistancePx:Math.round(Math.sqrt(a))});Ee(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=I_[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 I_[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){zs.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)?I_[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.zr=Date.now()}Wr(){er(d,"click",this.Cr),er(d,"mousedown",this.wr,{capture:!0}),er(d,"mouseup",this.Sr,{capture:!0}),er(d,"mouseout",this._r,{capture:!0}),er(d,"dragstart",this.gr,{capture:!0}),er(d,"pointercancel",this.gr,{capture:!0}),er(d,"blur",this.gr)}Tr(t){t.selectionChangedDelayMs=D_(t.timestamp,this.Or,this.Mr.selection_change_threshold_ms),t.visibilityChangedDelayMs=D_(t.timestamp,this.Pr),t.focusChangedDelayMs=D_(t.timestamp,this.Nr),this.pr.push(t)}Rr(){this.pr.length&&Ce(this.eo)&&(this.eo=d.setTimeout(()=>{this.no()},1e3))}Vr(){er(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),er(n,"selectionchange",this.Ar)}Lr(t,e){const i=e.path[0];for(;t;){if(-1!==e.path.indexOf(t)||pr(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&&pr(i)&&n.startContainer.getRootNode()===i.getRootNode()){var s;if(!n.collapsed)return n.intersectsNode(i);const t=pr(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(){er(n,"visibilitychange",this.an)}Qr(){er(d,"blur",this.Fr),er(d,"focus",this.Fr)}Dr(t,e){this.pr.forEach(i=>{const n=F_(e-i.timestamp);Me(n)&&(Ce(i[t])||i[t]>n)&&(i[t]=n)})}Kr(){er(d,"touchstart",this.qr,{capture:!0,passive:!0}),er(d,"touchend",this.Hr,{capture:!0,passive:!0}),er(d,"touchcancel",this.Br,{capture:!0,passive:!0})}Ur(){const t=Ce(this.io)||Me(this.zr)&&this.zr>this.io;return(Ce(this.ro)||t)&&(this.io=Date.now(),this.ro=!!(null==n?void 0:n.querySelector(O_))),!!this.ro}Ir(t){return!t||("swipe"===t.type?this.oo(t):this.so(t))}oo(e){return!(!fr(e.node)&&!this.pr.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!gr(e.node,"html")&&pr(e.node)&&function(e,i){var n;if(!t||Nr(e))return!1;const s=Pe(i)?Or:null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:Or,{targetElementList:r}=qr(e,!1);return!Tr(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||Nr(e))return!1;const{targetElementList:i}=qr(e,!1);return i.some(t=>gr(t,"a"))}(e.node);var i}no(){if(!this.pr.length)return;clearTimeout(this.eo),this.eo=void 0;const t=this.pr;this.pr=[];for(const i of t){var e;i.mutationDelayMs=null!==(e=i.mutationDelayMs)&&void 0!==e?e:this.zr&&this.zr>=i.timestamp?this.zr-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const t=A_(i.scrollDelayMs,this.Mr.scroll_threshold_ms),n=A_(i.selectionChangedDelayMs,this.Mr.selection_change_threshold_ms),s=A_(i.mutationDelayMs,this.Mr.mutation_threshold_ms),r=A_(i.absoluteDelayMs,1.1*this.Mr.mutation_threshold_ms),o=Me(i.scrollDelayMs)&&this.Mr.scroll_threshold_ms>i.scrollDelayMs,l=Me(i.mutationDelayMs)&&this.Mr.mutation_threshold_ms>i.mutationDelayMs,a=i.selectionChangedDuringGesture||Me(i.selectionChangedDelayMs)&&this.Mr.selection_change_threshold_ms>i.selectionChangedDelayMs,u=Me(i.visibilityChangedDelayMs),h=Me(i.focusChangedDelayMs);if(!(o||l||a||u||h))if(t||s||r||n){const e=P_(i);if("$dead_swipe"===e){if(this.mr>=this.Mr.max_dead_swipes_per_page_load)continue;this.mr++}this._onCapture(i,{[`${e}_last_mutation_timestamp`]:this.zr,[`${e}_event_timestamp`]:i.timestamp,[`${e}_scroll_timeout`]:t,[`${e}_mutation_timeout`]:s,[`${e}_absolute_timeout`]:r,[`${e}_selection_changed_timeout`]:n,[`${e}_visibility_changed_timeout`]:!1})}else this.Mr.mutation_threshold_ms>i.absoluteDelayMs&&this.pr.push(i)}this.Rr()}hr(t,e){const i=P_(t);this.instance.capture(i,le(le(le({},e),T_(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 L_(t,e);const N_=Ws("[ExternalScriptsLoader]"),q_=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]},B_=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return N_.warn(`${e} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const s=q_(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(q_(e))return B_(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)},j_={},H_=(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 B_(t,e,i)}const n=t.config.strict_script_versioning;if(n){const s=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=j_[s];if("fallback"===n&&r){if(q_(r))return void B_(t,r,i);delete j_[s]}return void B_(t,s,"fallback"===n?(n,r)=>{if(n)if("string"==typeof n)i(n);else{var o;const n=H_(t,e);j_[s]=n;const r=q_(s);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),B_(t,n,i)}else i(void 0,r)}:i)}B_(t,H_(t,e),i)},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{const n=t.requestRouter.endpointFor("api",e);B_(t,n,i)};var U_=class{constructor(t){this._instance=t}get Mr(){return this._instance.config}get consent(){return this.Ro()?0:this.Ao}isOptedOut(){return"always"===this.Mr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Mr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Mr.opt_out_capturing_by_default}optInOut(t){this.Fo.At(this.Oo,t?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Fo.Lt(this.Oo,this.Mr.cross_subdomain_cookie)}get Oo(){const{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get Ao(){const t=this.Fo.Ot(this.Oo);return He(t)?1:fe(Ue,t)?0:-1}get Fo(){const t=this.Mr.opt_out_capturing_persistence_type,e="localStorage"===t?Fl:Ol,i=e.Et()?e:Gl;if(!this.Do||this.Do!==i){this.Do=i;const e="localStorage"===t?Ol:Fl;e.Ot(this.Oo)&&(this.Do.Ot(this.Oo)||this.optInOut(He(e.Ot(this.Oo))),e.Lt(this.Oo,this.Mr.cross_subdomain_cookie))}return this.Do}Ro(){return!!this.Mr.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(t=>He(t))}};const z_=Ws("[Dead Clicks]"),W_=()=>!0,V_=t=>{var e;const i=!!(null===(e=t.instance.persistence)||void 0===e?void 0:e.get_property(I)),n=t.instance.config.capture_dead_clicks;return Pe(n)?n:!!Se(n)||i};var G_=class{get lazyLoadedDeadClicksAutocapture(){return this.Lo}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[I]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.No(()=>{this.qo()}):this.stop()}No(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this.instance,"dead-clicks-autocapture",e=>{e?z_.error("failed to load script",e):t()})}qo(){var t;if(n){if(!this.Lo&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=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.Lo=d.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Lo.start(n),z_.info("starting...")}}else z_.error("`document` not found. Cannot start.")}stop(){this.Lo&&(this.Lo.stop(),this.Lo=void 0,z_.info("stopping..."))}};const Z_=Ws("[SegmentIntegration]");function Q_(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()||El();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||Z_.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()||(Z_.info("No userId set, resetting PostHog"),t.reset()),r||(e=void 0),n.event.userId&&n.event.userId!==t.get_distinct_id()&&(Z_.info("UserId set, identifying with PostHog"),t.identify(n.event.userId));let o=t.calculateEventProperties(s,n.event.properties);if(!Ie(i)){const t=n.event.properties||{},e={};for(const i of Object.keys(o))_e.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),Ie(n))return null}catch(t){return Z_.error("Error in Segment filterProperties:",t),null}return n})(i,e);if(Ie(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=>{Z_.error("Failed to register the Segment integration",t),e()})},i)}const J_="posthog-js";function K_(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 Y_=class{constructor(t,e,i,n,s,r){this.name=J_,this.setupOnce=function(o){o(K_(t,{organization:e,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:null==r||r}))}}},X_=class{constructor(t){this.jo=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(zs.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Bo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ho()}Ho(){var t;this.zo=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.jo)}destroy(){var t;null===(t=this.zo)||void 0===t||t.call(this),this.zo=void 0}doPageView(e,i){var n;const s=this.Uo(e,i);return this.Bo={pathname:null!==(n=null==t?void 0:t.location.pathname)&&void 0!==n?n:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.Uo(t,null===(e=this.Bo)||void 0===e?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.Bo)||void 0===t?void 0:t.pageViewId}}Uo(t,e){const i=this.Bo;if(!i)return{$pageview_id:e};let n={$pageview_id:e,$prev_pageview_id:i.pageViewId};const s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:t,lastScrollY:e,maxScrollY:i,maxContentHeight:r,lastContentY:o,maxContentY:l}=s;if(!(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,zs):1,a=t>1?Ve(i/t,0,1,zs):1,u=r>1?Ve(o/r,0,1,zs):1,h=r>1?Ve(l/r,0,1,zs):1;n=Zs(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 tb=["flags","surveys"],eb={[v]:{exposure:"hidden"},[m]:{exposure:"hidden"},[y]:{exposure:"hidden"},[w]:{exposure:"hidden"},[b]:{exposure:"hidden"},[k]:{exposure:"event"},[S]:{exposure:"hidden"},[R]:{exposure:"hidden"},[x]:{exposure:"event"},[C]:{exposure:"hidden"},[T]:{exposure:"event"},[E]:{exposure:"event"},[I]:{exposure:"event"},[M]:{exposure:"hidden"},[P]:{exposure:"event"},[O]:{exposure:"hidden"},[A]:{exposure:"hidden"},[B]:{exposure:"hidden"},[j]:{exposure:"event"},[F]:{exposure:"event",shouldSkipFromEventProperties:t=>Ee(t)},[H]:{exposure:"event"},[U]:{exposure:"event"},[z]:{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"},[_t]:{exposure:"event"},[bt]:{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"},[Et]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[D]:{exposure:"event"},[L]:{exposure:"event"},[N]:{exposure:"event"},[q]:{exposure:"event"},[Ot]:{exposure:"event"},[At]:{exposure:"event"},[Ft]:{exposure:"event"},[Dt]:{exposure:"event"},[Lt]:{exposure:"event"},[Nt]:{exposure:"event"},[qt]:{exposure:"event"},[Bt]:{exposure:"event"},[jt]:{exposure:"event"},[Ht]:{exposure:"event"},[Wt]:{exposure:"event"}},ib=[[W,{exposure:"hidden"}],[V,{exposure:"hidden"}],[G,{exposure:"hidden"}]],nb=t=>{const e=eb[t];if(e)return e;for(const[e,i]of ib)if(0===t.indexOf(e))return i},sb={flags:St,surveys:ut},rb=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ob=t=>`${t}_cookie_identity_change_pending`,lb=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},ab="main",ub=[J,K,X,tt,et,St,it,rt],hb=t=>-1!==ub.indexOf(t),cb=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},db=t=>{if(!t)return{};const e=JSON.parse(t);return Se(e)?e:{}},vb=(t,e)=>{Gs(t,(i,n)=>{const s=nb(n);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,n)||delete t[n]})};var fb=class{constructor(e,i,n=!0){if(this.Wo={},this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=new Map,this.Xo=!1,this.Yo=!1,this.tl=!1,this.el=!1,this.il=new Set,this.Mr=e,this.nl=n,this.props={},this.sl=void 0,this.rl=(t=>{let e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(e),this.Fo=this.ol(e),this.Zo=this.ll(e),this.load(),this.al(),e.debug&&zs.info("Persistence loaded",e.persistence,le({},this.props)),this.update_config(e,e,i),this.save(),t){const e=()=>this.flush();er(t,"beforeunload",e,{capture:!1}),er(t,"pagehide",e,{capture:!1}),this.ul=e=>{if(this.Vo&&(!e.storageArea||e.storageArea===(null==t?void 0:t.localStorage))&&e.key)if(e.key!==this.rl){if(this.Zo){const t=tb.find(t=>e.key===this.hl(t));t&&this.cl(e.key,t)}}else this.cl(e.key,ab)},er(t,"storage",this.ul)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,e])=>{const i=this.Ko.get(t);if(!hb(t)||!0===i)return;if(!0===e)return void this.dl(t,!0);const n=new Set(i||[]);e.forEach(t=>n.add(t)),n.size&&this.dl(t,n)})}onCrossTabFeatureFlagChange(t){return this.il.add(t),()=>this.il.delete(t)}destroy(){this.ul&&t&&(t.removeEventListener("storage",this.ul),this.ul=void 0),this.il.clear()}cl(t,e,i=!0){if(this.pi)return!1;let n,s;try{if(s=Fl.Ot(t),Ee(s)){const t=this.vl(e);return t.storageValue=null,e!==ab&&(t.persisted=!1),!1}n=db(s)}catch(t){return!1}const r=e===ab?n:Fl.Dt(this.rl);if(r&&this.fl(r))return!1;const o=this.pl(n,e,i);return e===ab&&this.Zo&&!cb(this.gl().main,n)||this.ml(n,e,!0,s),o}fl(t){const e=this.props[f],i=t[f];return!Ce(e)&&!Ce(i)&&e!==i}ml(t,e,i,n){const s=this.vl(e);s.storageValue=n,e!==ab&&(s.persisted=i);try{s.fingerprint=this.yl(t,e)}catch(t){s.fingerprint=void 0}}pl(t,e,i){let n=!1;return ub.forEach(i=>{var s;const r=null===(s=nb(i))||void 0===s?void 0:s.storageGroup;if(e===ab&&this.Zo&&r||e!==ab&&r!==e)return;const o=i in t,l=this.bl(i,o?t[i]:void 0),a=this.Ko.has(i)?i in this.props:o;a===i in this.props&&cb(l,this.props[i])||(a?this._l(i,l,!1):this.wl(i,!1),n=!0)}),n&&i&&this.il.forEach(t=>t()),n}kl(){if(!this.Vo)return!1;try{this.tl=!1;const t=Fl.Ot(this.rl),e=this.vl(ab);let i,n=!1,s=!1;if(t!==e.storageValue)if(Ee(t))e.storageValue=null;else{if(i=db(t),this.tl=!this.Yo&&this.fl(i),this.tl)return!1;s=this.pl(i,ab,!1),!this.Zo||cb(this.gl().main,i)?this.ml(i,ab,!0,t):e.storageValue=t,n=!0}return this.Zo&&tb.forEach(t=>{const e=Fl.Ot(this.hl(t)),r=this.vl(t),o=i||{},l=n&&ub.some(e=>{var i;return(null===(i=nb(e))||void 0===i?void 0:i.storageGroup)===t&&e in o});if(e===r.storageValue&&!l)return;if(Ee(e))return r.storageValue=null,r.persisted=!1,void(l&&(s=this.pl(o,t,!1)||s));const a=db(e);s=this.pl(a,t,!1)||s,this.ml(a,t,!0,e)}),s}catch(t){return!1}}dl(t,e){this.Ko.set(t,e);const i=nb(t);(null==i?void 0:i.volatile)||(this.vl((this.Zo?null==i?void 0:i.storageGroup:void 0)||ab).fingerprint=void 0,this.Sl(t))}xl(){ub.forEach(t=>this.Ko.set(t,!0))}al(){if(this.Vo)try{const t=Fl.Ot(this.rl),e=db(t);this.vl(ab).storageValue=t,ub.forEach(t=>{var i;const n=this.Zo?null===(i=nb(t))||void 0===i?void 0:i.storageGroup:void 0,s=n?Fl.Ot(this.hl(n)):null;if(n){const t=this.vl(n);t.storageValue=s,t.persisted=!Ee(s)}const r=n&&!Ee(s)?db(s):e;t in this.props?this.Cl(t,r[t],this.props[t]):t in r&&this.dl(t,!0)})}catch(t){}}bl(t,e){const i=this.Ko.get(t);if(!i)return e;if(!0===i)return this.props[t];if("$active_feature_flags"===t){const n=new Set(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}Cl(t,e,i){if(!hb(t))return;const n=this.Ko.get(t);if(!0===n)return;let s=e;if(this.Vo)try{var r;const e=this.Zo?null===(r=nb(t))||void 0===r?void 0:r.storageGroup:void 0,i=e?this.hl(e):this.rl;s=db(Fl.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.dl(t,!0);const n=new Set(e||[]),r=new Set(s||[]),l=new Set(i);new Set([...n,...l]).forEach(t=>{n.has(t)!==l.has(t)&&o.add(t)}),o.forEach(t=>{r.has(t)===l.has(t)&&o.delete(t)})}else{if(!Se(i))return void(cb(s,i)?this.Ko.delete(t):this.dl(t,!0));{if(!Ce(e)&&!Se(e)||Ce(e)&&xe(i)&&Ce(s))return void this.dl(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&&cb(n[t],i[t])||o.add(t)}),o.forEach(t=>{t in r==t in i&&cb(r[t],i[t])&&o.delete(t)})}}o.size?this.dl(t,o):this.Ko.delete(t)}$l(){var t;const e=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Me(e)&&e>0?e:0}Tl(t){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase())if(t)try{const e=jl(t,this.Mr.cookie_persisted_properties||[]),i=Ul(e,this.Mr.cookie_persisted_properties||[]),n=JSON.stringify(e)+"|"+JSON.stringify(i),s=Ol.Ot(this.rl)||void 0;s&&Wl(this.rl,s)===n&&(this.Il=n,this.Ml=s)}catch(t){}else try{const t=Ol.Ot(this.rl)||void 0;this.Il=t?Wl(this.rl,t):void 0,this.Ml=t}catch(t){}}syncCookieProperties(){return this.El(this.Mr)}El(t,e=!1){if(this.pi&&!e||this.Jo||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let i;try{i=Ol.Ot(this.rl)||void 0}catch(t){}if(!i||i===this.Ml)return!1;const n=Wl(this.rl,i);let s;try{s=Bl(JSON.parse(i))}catch(t){return!1}if((Ol.Ot(this.rl)||void 0)!==i)return!1;this.Il=n,this.Ml=i;const r=zl(this.rl,i),o=[...Ll,...r.properties],l={};if(Object.keys(s).forEach(t=>{const e=s[t];(Ce(e)||Ee(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=Zs({},u);[...Ll,...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===Ll.indexOf(t)||!1!==e&&0!==e)&&delete d[t]}}),this.props=Zs(d,s),ub.forEach(t=>{const e=t in this.props;t in u===e&&cb(u[t],this.props[t])||(e?this.Cl(t,u[t],this.props[t]):this.dl(t,!0))}),!a||"$user_state"in s||"$user_state"in this.props||this._l(xt,Gt);const v=this.props[f],p=this.props[xt];return!a||v===h&&p===c||(this.Yo=!0,this.Qo=!0,Ql.At(ob(this.rl),!0),this.wl(rt),this.wl(K),this.wl(J),this.wl(X),this.wl(tt),this.wl(et),this.wl(St),this.wl(kt),this.wl(bt),"anonymous"!==p||"identified"!==c&&"anonymous"!==s.$user_state&&(Ce(h)||v===h)||(vb(this.props,s),this.wl(ot)),"identified"===p?this.props.$user_id=v:delete this.props.$user_id,this.wl(m)),!0}consumeCookieIdentityChange(){const t=ob(this.rl),e=this.Qo||!!Ql.Ot(t);return this.Qo=!1,e&&Ql.Lt(t),e}Pl(t=!1){return!(this.Jo||this.pi&&!t||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.Jo=!0,0))}Rl(){this.Jo&&(Ce(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[ab],this.Fl(!0))}Ol(t=!0){if(this.Jo)try{t?this.Rl():Ce(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}isDisabled(){return!!this.pi}ol(e){-1===rb.indexOf(e.persistence.toLowerCase())&&(zs.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const i=((e=[],i=!1)=>{const n=[...Ll,...e];return le(le({},Fl),{},{Dt(t){try{let s,r={};try{s=Ol.Ot(t)||void 0,r=s?Bl(JSON.parse(s)):{}}catch(t){}const o=JSON.parse(Fl.Ot(t)||"{}");let l;if(i){const i=zl(t,s),a=[...Ll,...i.properties],u={};Object.keys(r).forEach(t=>{const e=r[t];Ee(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===Ll.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||(Dl.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=Zs(o,u)}else l=Zs(r,o);return Fl.At(t,l),l}catch(t){}return null},At(t,n,s,r,o,l){const a=Fl.At(t,n,void 0,void 0,l);try{const u=jl(n,e);if(Object.keys(u).length){if(i){const i=Nl(t),h=Ul(u,e);if(Ol.At(i,h,s,r,o,l),Ol.Ot(i)!==JSON.stringify(h)){Ol.Lt(i,r);const e=jl(n);return Ol.At(t,e,s,r,o,l),a}}Ol.At(t,u,s,r,o,l)}}catch(t){Fl.Pt(t)}return a},Lt(e,i){try{null==t||t.localStorage.removeItem(e),Ol.Lt(e,i),Ol.Lt(Nl(e),i)}catch(t){Fl.Pt(t)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let n,s=!1,r=!1;const o=e.persistence.toLowerCase();return"localstorage"===o&&Fl.Et()?(n=Fl,r=!0):"localstorage+cookie"===o&&i.Et()?(n=i,r=!0,s=!0):"sessionstorage"===o&&Ql.Et()?n=Ql:"memory"===o?n=Gl:"cookie"===o&&Ol.Et()?(n=Ol,s=!0):i.Et()?(n=i,r=!0,s=!0):Ol.Et()?(n=Ol,s=!0):n=Gl,this.Vo=r,this.Go=s,n}hl(t){return`${this.rl}__${t}`}ll(t){return this.Vo&&!!t.split_storage}properties(){const t={};return Gs(this.props,(e,i)=>{const n=nb(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?Fl.Dt(this.rl):null;let n={};if(e)try{n=Bl(Ol.Dt(this.rl)),Gs(n,(t,e)=>{(Ce(t)||Ee(t)||""===t)&&delete n[e]})}catch(t){}const s=this.Fo.Dt(this.rl);if(s&&(this.props=Zs({},s)),this.Zo&&this.Dl(),e&&s){var r,o;const t=null==i?void 0:i[f],e=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Gt,l=s[f],a=null!==(o=s.$user_state)&&void 0!==o?o:Gt;if(l!==t||a!==e){this.Qo=!0,Ql.At(ob(this.rl),!0);const i=Zs({},this.props);Dl.forEach(t=>delete i[t]),"anonymous"!==a||"identified"!==e&&"anonymous"!==n.$user_state&&(Ce(t)||l===t)||(vb(i,n),delete i[ot]),this.props=i;const s=new Set;Dl.forEach(t=>{var e;const i=null===(e=nb(t))||void 0===e?void 0:e.storageGroup;i&&s.add(i)}),s.forEach(t=>{const e={};Gs(this.props,(i,n)=>{var s;(null===(s=nb(n))||void 0===s?void 0:s.storageGroup)===t&&(e[n]=i)}),xe(e)?(Fl.Lt(this.hl(t)),this.Wo[t]={}):Fl.At(this.hl(t),e)&&(this.Wo[t]={persisted:!0,fingerprint:this.yl(e,t)})})}}Ql.Ot(ob(this.rl))&&(this.Qo=!0)}Dl(){for(const t of tb){const e=Fl.Dt(this.hl(t));if(e&&!xe(e)){const i=this.vl(t);i.persisted=!0,this.Ll(t)||(i.fingerprint=this.yl(e,t)),this.Nl(t,e)||Zs(this.props,e)}}}Ll(t){return Object.keys(this.props).some(e=>{var i;return(null===(i=nb(e))||void 0===i?void 0:i.storageGroup)===t})}Nl(t,e){const i=sb[t];if(!i)return!1;const n=e[i],s=this.props[i];return Me(n)&&Me(s)&&s>n}refreshKey(t){var e;if(this.pi)return;if("$fbc_persistence"===t&&this.el)return;const i=this.Zo?null===(e=nb(t))||void 0===e?void 0:e.storageGroup:void 0,n=i?Fl.Dt(this.hl(i)):this.Fo.Dt(this.rl);if(n&&t in n)this._l(t,n[t],!1);else{if(i){const e=this.Fo.Dt(this.rl);if(e&&t in e)return void this._l(t,e[t],!1)}this.wl(t,!1)}}save(){if(this.pi)return;const t=this.$l();t>0?Ce(this.Al)&&(this.Al=setTimeout(()=>{this.Al=void 0,this.Fl()},t)):this.Fl()}flush(){Ce(this.Al)||(clearTimeout(this.Al),this.Al=void 0,this.Fl())}Fl(t=!1){if(this.pi||this.Jo&&!t)return;t||(this.syncCookieProperties(),this.el||this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||this.refreshKey(b));const e=!t&&!this.Xo;e||(this.tl=!1);const i=!!e&&this.kl();if(this.tl)return void(this.Mr.debug&&zs.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Zo)return this.ql(),void(i&&this.il.forEach(t=>t()));const n=this.jl(this.Fo,this.rl,this.props,ab);"written"===n&&this.Tl(this.props),"failed"!==n&&(this.Ko.clear(),this.Yo=!1,this.el=!1),i&&this.il.forEach(t=>t())}ql(){const{main:t,groups:e}=this.gl(),i=this.jl(this.Fo,this.rl,t,ab);"written"===i&&this.Tl(t),"failed"!==i&&(this.Yo=!1,this.el=!1,ub.forEach(t=>{var e;(null===(e=nb(t))||void 0===e?void 0:e.storageGroup)||this.Ko.delete(t)}));for(const t of tb){var n;const i=e[t];if(xe(i)&&!(null===(n=this.Wo[t])||void 0===n?void 0:n.persisted)){ub.forEach(e=>{var i;(null===(i=nb(e))||void 0===i?void 0:i.storageGroup)===t&&this.Ko.delete(e)});continue}const s=this.jl(Fl,this.hl(t),i,t);"failed"!==s&&ub.forEach(e=>{const i=nb(e);(null==i?void 0:i.storageGroup)!==t||"written"!==s&&i.volatile||this.Ko.delete(e)})}}gl(){const t={},e={flags:{},surveys:{}};return Gs(this.props,(i,n)=>{var s;const r=null===(s=nb(n))||void 0===s?void 0:s.storageGroup;r?e[r][n]=i:t[n]=i}),{main:t,groups:e}}yl(t,e){if(e===ab)return JSON.stringify(t)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;const i={};return Gs(t,(t,e)=>{var n;i[e]=(null===(n=nb(e))||void 0===n?void 0:n.volatile)?"__volatile__":t}),JSON.stringify(i)}jl(t,e,i,n){const s=this.vl(n);if(n!==ab&&!s.dirty&&!Ce(s.fingerprint))return"skipped";let r;try{if(r=this.yl(i,n),r===s.fingerprint)return s.dirty=!1,"skipped"}catch(t){r=void 0}return t.At(e,i,this.Bl,this.Hl,this.zl,this.Mr.debug)?(s.dirty=!1,n!==ab&&(s.persisted=!0),Ce(r)||(s.fingerprint=r),this.Vo&&(s.storageValue=Fl.Ot(e)),"written"):(this.Mr.debug&&zs.warn(`failed to persist storage entry "${e}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.xl(),Ce(this.Al)||(clearTimeout(this.Al),this.Al=void 0),this.Fo.Lt(this.rl,!1),this.Fo.Lt(this.rl,!0),!t&&this.nl)for(const t of tb)Fl.Lt(this.hl(t));t?delete this.Wo[ab]:this.Wo={},this.Il=void 0,this.Ml=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(Se(t)){this.syncCookieProperties(),Ce(e)&&(e="None"),this.Bl=Ce(i)?this.Ul:i;let n=!1;if(Gs(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this._l(i,t),n=!0)}),n)return this.save(),!0}return!1}register(t,e){if(Se(t)){this.syncCookieProperties(),this.Bl=Ce(e)?this.Ul:e;let i=!1;if(Gs(t,(e,n)=>{t.hasOwnProperty(n)&&(this.props[n]!==e||Se(e)||we(e))&&(this._l(n,e),i=!0)}),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();const e="string"==typeof t?[t]:t;let i=!1;for(const t of e)t in this.props&&(this.wl(t),i=!0);i&&this.save()}update_campaign_params(){const t=null==n?void 0:n.URL;if(t===this.sl)return;const e=Ta(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),i=!xe(Ks(e));return i&&this.register(e),this.sl=t,i?e:void 0}update_search_keyword(){this.register(function(){const t=null==n?void 0:n.referrer;return t?Ia(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:Oa(),$referring_domain:(null==n?void 0:n.referrer)&&(null===(t=rr(n.referrer))||void 0===t?void 0:t.host)||Pa},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Aa(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[It]:this.Go?{r:lb(t.r),u:t.u?lb(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Gs([Et,Tt],e=>{const i=this.props[e];i&&Gs(i,function(e,i){t["$initial_"+ge(i)]=e})});const e=this.props[It];if(e){const i=function(t,e=!1){const i=Fa(t,e),n={};return Gs(i,function(t,e){n[`$initial_${ge(e)}`]=t}),n}(e,this.Mr.disable_capture_url_hashes);Zs(t,i)}return t}safe_merge(t){return Gs(this.props,function(e,i){i in t||(t[i]=e)}),t}update_config(t,e,i){const n=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;const i=[...t].sort(),n=[...e].sort();return i.every((t,e)=>t===n[e])})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),r=n||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,l=t.disable_persistence||!!i,a=!!this.pi&&!l;l||this.El(e,a),this.Mr=t,!l&&(n||s||o)&&(this.Il=void 0,this.Ml=void 0,this.El(le(le({},t),{},{cookie_persisted_properties:e.cookie_persisted_properties}),a));const u=r||o?this.ol(t):this.Fo;this.Wl();const h=this.ll(t),c=r||h!==this.Zo,d=!l&&(c||t.cross_subdomain_cookie!==this.Hl||t.secure_cookie!==this.zl)&&this.Pl(a);this.Xo=c;try{if(this.Ul=this.Bl=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),c){const t=this.props;this.clear(),this.Fo=u,this.Zo=h,this.props=t,this.save()}else o&&(this.Fo=u,l||(delete this.Wo[ab],this.Fl()))}finally{this.Xo=!1,d&&this.Ol()}}Wl(){const t=this.props[It];if(!this.Go||!Se(t)||"string"!=typeof t.r)return;const e=lb(t.r),i="string"==typeof t.u?lb(t.u):t.u;e===t.r&&i===t.u||this._l(It,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.Hl&&(this.Hl=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.zl&&(this.zl=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){const i=this.props.__timers||{};i[t]=e,this._l(w,i),this.save()}remove_event_timer(t){const e=this.props.__timers||{},i=e[t];return Ce(i)||(delete e[t],this._l(w,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this._l(t,e),this.save()}_l(t,e,i=!0){var n;const s=this.props[t];this.props[t]=e,i&&("distinct_id"!==t&&"$user_state"!==t||s===e||(this.Yo=!0),"$fbc_persistence"!==t||cb(s,e)||(this.el=!0),this.Cl(t,s,e),(null===(n=nb(t))||void 0===n?void 0:n.volatile)||this.Sl(t))}wl(t,e=!0){delete this.props[t],e&&(hb(t)&&this.dl(t,!0),"$fbc_persistence"===t&&(this.el=!0),this.Sl(t))}Sl(t){var e;const i=null===(e=nb(t))||void 0===e?void 0:e.storageGroup;i&&(this.vl(i).dirty=!0)}vl(t){return this.Wo[t]||(this.Wo[t]={})}};const pb={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},gb={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},mb={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},yb=Ws("[RateLimiter]");var _b=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=>{yb.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void yb.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=(Me(l.dropped)?l.dropped:0)+1;l.dropped=t,!this.lastEventRateLimited&&this.Vl(t)&&(l.dropped=0)}return this.lastEventRateLimited=a,null===(n=this.instance.persistence)||void 0===n||n.set_property("$capture_rate_limit",l),{isRateLimited:a,remainingTokens:l.tokens}}Gl(t){const e=this.instance.config.property_denylist;return!we(e)||!e.includes(t)}Zl(){var t;if(this.Gl("$current_url")&&this.Gl("$pathname")&&(null==s?void 0:s.pathname))return`${null!==(t=s.origin)&&void 0!==t?t:""}${s.pathname}`}Vl(t){var e,i;const{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,r=this.Zl(),o=this.Gl("$session_id")?null===(e=(i=this.instance).get_session_id)||void 0===e?void 0:e.call(i):void 0,l=[`${t} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${l}. Config is set to ${s} events per second and ${n} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(t){const e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}};const bb=Ws("[RemoteConfig]");var wb=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=d._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Ql(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.loadExternalDependency)?null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Jl(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:t})}load(){try{if(this.remoteConfig)return bb.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance.Xl())return void bb.warn("Remote config is disabled. Falling back to local config.");this.Ql(t=>{if(!t)return bb.info("No config found after loading remote JS config. Falling back to JSON."),void this.Jl(t=>{this.Kl(t.json,t)});this.Kl(t)})}catch(t){bb.error("Error loading remote config",t),this.Kl()}}Kl(t,e){!t&&e&&(0===e.statusCode?e.error||bb.warn("Failed to fetch remote config from PostHog."):bb.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(t?{ok:!0,config:t}:{ok:!1})}catch(t){bb.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){bb.error("Error loading feature flags",t)}}};const kb=["fatal","error","warning","log","info","debug"],Sb=!!o||!!r,xb=new WeakMap,Cb="text/plain";let $b=!1;const Tb=(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}`:""}`},Eb=(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=or(o);return a&&l.push(a),l.length>0?`${s}?${l.join("&")}`:s},Ib=t=>{if(t.Yl)return t.Yl;const{data:e,compression:i}=t;if(!e)return;if(i===ap.GZipJS){const t=yl(_l(sr(e)),{mtime:0});return{contentType:Cb,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(i===ap.Base64){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(sr(e)),i=(t=>"data="+encodeURIComponent("string"==typeof t?t:sr(t)))(t);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const n=sr(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}},Mb=t=>{const e=()=>"sendBeacon"===t.transport?{url:Eb(t.url,{compression:ap.Base64}),encodedBody:Ib(le(le({},t),{},{compression:ap.Base64,Yl:void 0}))}:{url:Tb(t.url,"compression"),encodedBody:Ib(le(le({},t),{},{compression:void 0,Yl:void 0}))};let i;try{i=Ib(t)}catch(i){if(rs(t.compression,lr(t.url,"compression")))return zs.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return i&&rs(t.compression,lr(t.url,"compression"))&&!((n=i.body)instanceof ArrayBuffer?ss(new Uint8Array(n)):ArrayBuffer.isView(n)&&ss(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?($b=!0,e()):{url:t.url,encodedBody:i};var n},Rb=t=>{try{return Mb(t)}catch(i){var e;return zs.error(i),void(null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))}},Pb=function(){var t=ne(function*(t){const e=yield ds(sr(t.data),Jl.DEBUG,{rethrow:!0});if(!e)return t;const i=yield e.arrayBuffer();return le(le({},t),{},{Yl:{contentType:Cb,body:i,estimatedSize:i.byteLength}})});return function(e){return t.apply(this,arguments)}}(),Ob=/Failed to fetch|NetworkError|Load failed/i,Ab=t=>"TypeError"===(null==t?void 0:t.name)&&Ob.test((null==t?void 0:t.message)||""),Fb=t=>{const e=Rb(t);if(!e)return;const i=new o;xb.set(i,!0);const{url:n,encodedBody:s}=e;i.open(t.method||"GET",n,!0);const{contentType:r,body:l}=null!=s?s:{};Gs(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)},Db=t=>{const e=Rb(t);if(!e)return;const{url:i,encodedBody:n}=e,{contentType:s,body:o,estimatedSize:a}=null!=n?n:{},u=new Headers;Gs(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(sn("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)||Ab(e)?zs.warn(e):zs.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.ta&&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){zs.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)}},Lb=t=>{try{var e;const{url:n,encodedBody:s}=Mb(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 Lb(le(le({},t),{},{data:i(h.slice(0,e))})),void Lb(le(le({},t),{},{data:i(h.slice(e))}))}zs.warn(`Beacon of ~${null!=a?a:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?Db(le(le({},t),{},{ta:!0})):Fb(t)}catch(t){zs.warn("Beacon send failed",t)}},Nb=(t,e,i,n)=>{const s="query"===n?"POST"===e?"sent_at":"_":void 0;return Eb(i===ap.GZipJS?Tb(t,"compression"):t,le(le({},s?{[s]:Date.now().toString()}:{}),i===ap.GZipJS?{}:{compression:i}))},qb=(()=>{const t=[];return r&&t.push({transport:"fetch",method:Db}),o&&t.push({transport:"XHR",method:Fb}),(null==i?void 0:i.sendBeacon)&&t.push({transport:"sendBeacon",method:Lb}),t})();var Bb=class{constructor(t,e){this.ea=!0,this.ia=[],this.na=Ve((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,zs.createLogger("flush interval"),3e3),this.sa=t}enqueue(t){this.ia.push(t),this.ra||this.oa()}unload(){this.la();const t=this.ia.length>0?this.aa():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.ua(le(le({},t),{},{transport:"sendBeacon"}))})}enable(){this.ea=!1,this.oa()}oa(){this.ea||(this.ra=setTimeout(()=>{if(this.la(),this.ia.length>0){const t=this.aa();for(const e in t)this.ua(t[e])}},this.na))}ua(t){try{this.sa(t)}catch(t){zs.error(t)}}la(){clearTimeout(this.ra),this.ra=void 0}aa(){const t={};return Gs(this.ia,e=>{var i;const n=e,s=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");Ce(t[s])&&(t[s]=le(le({},n),{},{data:[]})),null===(i=t[s].data)||void 0===i||i.push(n.data)}),this.ia=[],t}};const jb=["retriesPerformedSoFar"];var Hb=class{constructor(t){this._instance=t,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}resume(){if(!Ce(t)&&"onLine"in t.navigator){if(this.da=t.navigator.onLine,this.va)return;this.va=()=>{this.da=!0,this.fa()},this.pa=()=>{this.da=!1},er(t,"online",this.va),er(t,"offline",this.pa)}}get length(){return this.ia.length}retriableRequest(t){let{retriesPerformedSoFar:e}=t,i=gs(t,jb);Re(e)&&(i.url=Eb(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.Ls(le({retriesPerformedSoFar:e},i));0===t.statusCode&&zs.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)}}))}Ls(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.ia.push({retryAt:n,requestOptions:t});let s=`Enqueued failed request for retry in ${i}`;navigator.onLine||(s+=" (Browser is offline)"),zs.warn(s),this.ha||(this.ha=!0,this.ga())}ga(){if(this.ma&&clearTimeout(this.ma),0===this.ia.length)return this.ha=!1,void(this.ma=void 0);this.ma=setTimeout(()=>{this.da&&this.ia.length>0&&this.fa(),this.ga()},this.ca)}fa(){const t=Date.now(),e=[],i=this.ia.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.ia=e,i.length>0)for(const{requestOptions:t}of i)this.retriableRequest(t)}unload(){this.ma&&(clearTimeout(this.ma),this.ma=void 0),this.ha=!1,Ce(t)||(this.va&&(t.removeEventListener("online",this.va),this.va=void 0),this.pa&&(t.removeEventListener("offline",this.pa),this.pa=void 0));for(const{requestOptions:t}of this.ia)try{this._instance._send_request(le(le({},t),{},{transport:"sendBeacon"}))}catch(t){zs.error(t)}this.ia=[]}},Ub=class{constructor(t){this._instance=t,this.ya=()=>{var t,e,i,n;this.ba||(this.ba={});const s=this.scrollElement(),r=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,l=r+((null==s?void 0:s.clientHeight)||0),a=(null==s?void 0:s.scrollHeight)||0;this.ba.lastScrollY=Math.ceil(r),this.ba.maxScrollY=Math.max(r,null!==(t=this.ba.maxScrollY)&&void 0!==t?t:0),this.ba.maxScrollHeight=Math.max(o,null!==(e=this.ba.maxScrollHeight)&&void 0!==e?e:0),this.ba.lastContentY=l,this.ba.maxContentY=Math.max(l,null!==(i=this.ba.maxContentY)&&void 0!==i?i:0),this.ba.maxContentHeight=Math.max(a,null!==(n=this.ba.maxContentHeight)&&void 0!==n?n:0)}}get _a(){return this._instance.config.scroll_root_selector}getContext(){return this.ba}resetContext(){const t=this.ba;return this.ba=void 0,setTimeout(this.ya,0),t}startMeasuringScrollPosition(){er(t,"scroll",this.ya,{capture:!0}),er(t,"scrollend",this.ya,{capture:!0}),er(t,"resize",this.ya)}scrollElement(){if(this._a){const i=we(this._a)?this._a:[this._a];for(const n of i){var e;const i=null==t||null===(e=t.document)||void 0===e?void 0:e.querySelector(n);if(i)return i}return}var i;return null==t||null===(i=t.document)||void 0===i?void 0:i.documentElement}wa(e){var i,n;const s="y"===e?"scrollTop":"scrollLeft";if(this._a){const t=this.scrollElement();return t&&t[s]||0}return t?"y"===e?t.scrollY||t.pageYOffset||(null===(i=t.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:t.scrollX||t.pageXOffset||(null===(n=t.document)||void 0===n||null===(n=n.documentElement)||void 0===n?void 0:n.scrollLeft)||0:0}scrollY(){return this.wa("y")}scrollX(){return this.wa("x")}};const zb=t=>Aa(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 Wb=class{constructor(t,e,i,n){this.je=t=>{const e=this.ka();if(e&&e.sessionId===t)return;const i={sessionId:t,props:this.Sa(this._instance)};this.xa.register({[Ct]:i})},this._instance=t,this.Ca=e,this.xa=i,this.Sa=n||zb,this.Ca.onSessionId(this.je)}ka(){return this.xa.props[Ct]}getSetOnceProps(){var t;const e=null===(t=this.ka())||void 0===t?void 0:t.props;return e?"r"in e?Fa(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 Gs(Ks(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t[`$session_entry_${ge(i)}`]=e}),t}},Vb=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 Gb=Ws("[SessionId]"),Zb=864e5;var Qb=class{on(t,e){return this.Ta.on(t,e)}constructor(t,e,i){var n;if(this.Ia=null,this.Ma=null,this.Ea=[],this.Pa=void 0,this.Ra=!1,this.Ta=new Vb,this.Aa=(t,e)=>!(!Re(t)||!Re(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=t.config,this.xa=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=e||El,this.Da=i||El;const s=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Ve(this.Mr.session_idle_timeout_seconds||1800,60,36e3,Gb.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.La(),this.Na="ph_"+s+"_window_id",this.qa="ph_"+s+"_primary_window_exists",this.ja()){const t=Ql.Dt(this.Na),e=Ql.Dt(this.qa);t&&!e?this.Be=t:Ql.Lt(this.Na),Ql.At(this.qa,!0)}(null===(n=this.Mr.bootstrap)||void 0===n?void 0:n.sessionID)&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Ba()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Ce(this.Ea)&&(this.Ea=[]),this.Ea.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.Ea=this.Ea.filter(e=>e!==t)}}ja(){return"memory"!==this.Mr.persistence&&!this.xa.pi&&Ql.Et()}Ha(t){t!==this.Be&&(this.Be=t,this.ja()&&Ql.At(this.Na,t))}za(){return this.Be?this.Be:this.ja()?Ql.Dt(this.Na):null}Ua(t){const e=this.Ia;return!Ee(e)&&!Ee(t)&&5e3>Math.abs(t-e)}Wa(t,e,i){const n=e!==this._sessionActivityTimestamp,s=!(t!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Xt=t,s&&!n||s&&this.Ua(e)||(this.Ia=e,this.xa.register({[B]:[e,t,i]}))}Va(){var t;const e=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Re(e)&&e>0}Ga(){this.Va()?this.xa.refreshKey(B):(this.xa.flush(),this.xa.load())}Za(){var t;if(Ee(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ia)return;this.Ga();const[,e,i]=this.Qa();e===this.Xt&&i===this._sessionStartTimestamp&&(this.Ia=this._sessionActivityTimestamp,this.xa.register({[B]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.xa.flush())}Ja(){const[t]=this.Qa(),e=Re(t)?t:0,i=Re(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Ka(t){return this.Ga(),this.Aa(t,this.Ja())}Qa(){const t=this.xa.props[B];return we(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Xa),this.Xa=void 0,this.Wa(null,null,null)}setBootstrapSessionId(t,e=!1){const i=((t,e=(new Date).getTime())=>{try{const i=(t=>{const e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void Gb.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void Gb.error("Invalid sessionID in bootstrap",t)}})(t);return!Ce(i)&&(e?this.Fa={sessionId:t,sessionStartTimestamp:i}:this.Wa(t,(new Date).getTime(),i),!0)}destroy(){this.Ra=!0,this.Za(),clearTimeout(this.Xa),this.Xa=void 0,this.Pa&&t&&(t.removeEventListener(Kt,this.Pa,{capture:!1}),this.Pa=void 0),this.Ea=[]}Ba(){this.Pa=()=>{this.Za(),this.ja()&&Ql.Lt(this.qa)},er(t,Kt,this.Pa,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,e=null,i=!1){if("always"===this.Mr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const n=e||(new Date).getTime(),s=this.Xt;if(i)this.Ma=n;else if(Ee(this.Ma)||this.Ma>n||n-this.Ma>=1e3){var r,o;null===(r=(o=this.xa).syncCookieProperties)||void 0===r||r.call(o),this.Ma=n}let[,l,a]=this.Qa();const u=!Ce(s)&&l!==s,h=this.Ja();let c=this.za();const d=this.Fa,v=!!d&&(d.sessionStartTimestamp>n+6e4||n-d.sessionStartTimestamp>Zb),f=d?v:Re(a)&&Math.abs(n-a)>Zb;let p=!1,g=u;const m=!l||!!d,y=l;let _=!m&&!t&&this.Aa(n,h);if(_&&(_=this.Ka(n),_||Gb.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,a]=this.Qa()),m||_||f){g=!1;const t=d&&!v;l=t?d.sessionId:this.Oa(),c=this.Da(),Gb.info("new session ID assigned",{sessionId:l,windowId:c,bootstrapped:!!t,changeReason:{noSessionId:m,activityTimeout:_,sessionPastMaximumLength:f}}),a=t?d.sessionStartTimestamp:n,this.Fa=void 0,p=!0}else c||(c=this.Da(),p=!0),g=g||l!==y,g&&(Gb.info("adopted cross-tab session id",{sessionId:l,windowId:c}),p=!0);const b=Re(h)&&t&&!f?h:n,w=Re(a)?a:(new Date).getTime();this.Ha(c),this.Wa(l,b,w),t||this.La();const k={noSessionId:m,activityTimeout:_,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.Ea.forEach(t=>t(l,c,k)),{sessionId:l,windowId:c,sessionStartTimestamp:w,changeReason:p?k:void 0,lastActivityTimestamp:h}}La(){this.Ra||(clearTimeout(this.Xa),this.Xa=setTimeout(()=>{if(!this.Ra)if(this.Ka((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.Ta.emit("forcedIdleReset",{idleSessionId:t})}else this.La()},1.1*this.sessionTimeoutMs))}};const Jb=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 Kb(){return Kb=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 zs.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}),Kb.apply(this,arguments)}const Yb="custom",Xb="i.posthog.com",tw=/^\/static\//,ew=["/s/","/e/","/i/"];var iw=class{constructor(t){this.Ya={},this.instance=t}get apiHost(){const t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){const t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t;let e=null===(t=this.instance.config.ui_host)||void 0===t?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace(`.${Xb}`,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Ya[this.apiHost]||(this.Ya[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":Yb),this.Ya[this.apiHost]}tu(t){if(!tw.test(t))return;const e=this.instance.config.asset_host;return"string"==typeof e&&e.trim().replace(/\/$/,"")||void 0}eu(t){const e=rr(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}iu(t,e,i){if("ui"===t)return i;let n=i;const s=this.instance.config.rewriteRequestPath;if(s){var r;const t=(null===(r=rr(i))||void 0===r?void 0:r.href)||i;n=s(new URL(t)).toString()}if(s&&"api"===t&&ew.some(t=>0===e.indexOf(t))){const t=this.eu(n);if(t){const e=this.apiHost;let i=this.nu;(null==i?void 0:i.apiHost)===e&&i.rewriteRequestPath===s||(i={apiHost:e,rewriteRequestPath:s,urls:new Set},this.nu=i),i.urls.add(t)}}return n}isIngestionEndpoint(t){const e=this.nu,i=this.eu(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e=""){if(e&&(e="/"===e[0]?e:`/${e}`),"ui"===t)return this.iu(t,e,this.uiHost+e);if("flags"===t)return this.iu(t,e,this.flagsApiHost+e);if("assets"===t){const i=this.tu(e);if(i)return this.iu(t,e,`${i}${e}`)}if(this.region===Yb)return this.iu(t,e,this.apiHost+e);const i=Xb+e;switch(t){case"assets":return this.iu(t,e,`https://${this.region}-assets.${i}`);case"api":return this.iu(t,e,`https://${this.region}.${i}`)}}};const nw=Ws("[PostHog ExternalIntegrations]"),sw={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var rw=class{constructor(t){this._instance=t}No(t,e){var i,n;null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,t,t=>{if(t)return nw.error("failed to load script",t);e()})}startIfEnabledOrStop(){var t;for(const[s,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var e,i,n;r&&!(null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[s])&&this.No(sw[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())}}},ow=class{constructor(t,e){this.$=t,this.po=e,this.su=new Map,this.So=!1}add(t){var e=this;return ne(function*(){if(e.So)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.su.has(t.name))throw new Error(`Browser extension "${t.name}" is already registered`);e.su.set(t.name,t);try{const i=t.setup(e.po);i&&(yield i)}catch(i){const n=e.su.get(t.name)===t;n&&e.su.delete(t.name),e.$.error(`Failed to set up browser extension "${t.name}"`,i),n&&e.ru(t)}})()}getExtension(t){return this.su.get(t)}dispose(){if(this.So)return;this.So=!0;const t=Array.from(this.su.values()).reverse();this.su.clear();for(const e of t)this.ru(e)}ru(t){try{var e;const i=null===(e=t.dispose)||void 0===e?void 0:e.call(t);i&&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)}}},lw=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 aw="extensionsRemoteConfig";var uw=class{constructor(t){this.instance=t,this.So=!1,this.$=zs,this.ou=t.lu,this.kv=new lw(t),this.onEvent=t=>bp(this.instance.on("eventCaptured",e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.$.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.So)return bp(()=>{});const e=e=>{try{t(e)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},i=this.instance.au.on(aw,e);return this.ou&&e(this.ou),bp(i)},this.uu=new ow(zs.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:Jl.LIB_NAME,version:Jl.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,n;const s=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(n=null==s?void 0:s.sessionStartTimestamp)&&void 0!==n?n:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.uu.add(t)}getExtension(t){return this.uu.getExtension(t)}capture(t,e,i){var n=this;return 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 bp(this.instance.hu(t))}handleRemoteConfig(t){this.So||(this.ou=t,this.instance.au.emit(aw,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?Eb(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.So||(this.So=!0,this.uu.dispose())}};const hw={};let cw=0;const dw=()=>{},vw='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',fw="Surveys module not available",pw="sanitize_properties is deprecated. Use before_send instead",gw="Invalid value for property_denylist config: ",mw=/^[A-Za-z0-9_-]{1,400}$/,yw=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,_w=["token","distinct_id",Pt],bw="posthog";let ww=!Sb&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla"));const kw=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},Sw=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:tr(null==n?void 0:n.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:dw,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){zs.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:dw},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Rr,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:kw(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))},xw=[["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"]],Cw=t=>{const e={};for(const[i,n]of xw)Ce(t[i])||(e[n]=t[i]);const i=Zs({},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]:zs.error(gw+t.property_denylist)),i};var $w=class{constructor(){this.__forceAllowLocalhost=!1}get cu(){return this.__forceAllowLocalhost}set cu(t){zs.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Tw=class e{du(t){if(!t)return;const e=this.su.indexOf(t);-1!==e&&this.su.splice(e,1)}vu(t,e){var i;return this.du(t),this.su.push(e),null===(i=e.initialize)||void 0===i||i.call(e),e}fu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}pu(){if(this.gu)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.fu())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.mu)return;let e,i,n;t?(e=`persistence is set to '${this.config.persistence}'`,i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",n="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(e="persistence is disabled (disable_persistence is true)",i="on every page load",n="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.gu=!0,console.warn("[PostHog.js]",`${e} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${n}`)}yu(){if(this.fu()||"$posthog_cookieless"!==this.get_distinct_id())return;const t=this.persistence;if(!t)return;this.bu()||t.load(!0);const e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){const e=this.config.get_device_id(El());this.register({distinct_id:e,$device_id:e}),t.set_property(xt,Gt)}this._u()}get decideEndpointWasHit(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.wu=!1,this.ku=!1,this.webPerformance=new $w,this.Su=!1,this.version=Jl.LIB_VERSION,this.xu=new Set,this.Cu="",this.au=new Vb,this.su=[],this.$u=[],this.mu=!1,this.gu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Sw(),this.SentryIntegration=Y_,this.sentryIntegration=t=>function(t,e){const i=K_(t,e);return{name:J_,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tu=!1,this.Iu=null,this.Mu=null,this.Eu=null,this.scrollManager=new Ub(this),this.pageViewManager=new X_(this),this.rateLimiter=new _b(this),this.requestRouter=new iw(this),this.consent=new U_(this),this.externalIntegrations=new rw(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=>zs.info(`send "${null==t?void 0:t.event}"`,t))}init(t,i,n){if(n&&n!==bw){var s;const r=null!==(s=hw[n])&&void 0!==s?s:new e;return r._init(t,i,n),hw[n]=r,hw[bw][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 zs.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=Sw(i.defaults),i.debug=this.Pu(i.debug),this.Ru=i,this.Au=[],i.person_profiles?this.Mu=i.person_profiles:i.process_person&&(this.Mu=i.process_person);const u=Sw(i.defaults),h=Cw(i),c=Zs({},u,h,{name:n,token:l});Se(u.rageclick)&&Se(h.rageclick)&&(c.rageclick=Zs({},u.rageclick,h.rageclick)),Se(u.session_recording)&&Se(h.session_recording)&&(c.session_recording=Zs({},u.session_recording,h.session_recording)),this.set_config(c),this.config.on_xhr_error&&zs.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:ap.GZipJS;const d=this.bu();if(this.persistence=new fb(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new fb(le(le({},this.config),{},{persistence:"sessionStorage"}),d,!1),this.Cu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&Ql.Et()){const t=Ql.Dt(this.Cu);we(t)&&t.forEach(t=>{$e(t)&&this.xu.add(t)})}else Ql.Lt(this.Cu);const v=le({},this.persistence.props),f=le({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Fu=new Bb(t=>this.Ou(t),this.config.request_queue_config),this.Du=new Hb(this),this.__request_queue=[];const p=this.fu();p||(this.sessionManager=new Qb(this),this.sessionPropsManager=new Wb(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,e,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this.Lu()})),this.Nu(),this.config.__preview_deferred_init_extensions?(zs.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.qu(p)},0)):(zs.info("Initializing extensions synchronously"),this.qu(p)),Jl.DEBUG=Jl.DEBUG||this.config.debug,Jl.DEBUG&&zs.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.mu=!!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)zs.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(El()),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:Rt,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(El());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(xt,Gt)}return er(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),er(t,"pageshow",()=>{var t;this.wu=!1,this.ku||null===(t=this.Du)||void 0===t||t.resume()}),i.segment?Q_(this,()=>this.ju()):this.ju(),ke(this.config._onCapture)&&this.config._onCapture!==dw&&(zs.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&zs.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 Kb.apply(this,arguments)}().then(t=>{t&&this.register({[g]:t})}).catch(dw),this}Bu(t){const e=t;return $e(e.name)&&ke(e.setup)}Hu(t,e){this.Bu(t)?e.push(()=>{this.zu().add(t).catch(()=>{var e;return null===(e=t.dispose)||void 0===e?void 0:e.call(t)}).catch(e=>{zs.error(`Failed to dispose browser extension "${t.name}"`,e)})}):this.su.push(t)}Nu(){var t,i,n;const s=null!==(t=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:null===(n=e.__defaultExtensionClasses)||void 0===n?void 0:n.featureFlags;var r,o,l;s&&(this.featureFlags&&this.featureFlags instanceof s||(null===(r=this.Uu)||void 0===r||r.call(this),this.Uu=void 0,this.featureFlags=new s(this)),ke(this.featureFlags.onReloading)&&ke(this.featureFlags.setup)?this.Uu||(this.Uu=this.featureFlags.onReloading(()=>{this.au.emit("featureFlagsReloading",!0)}),this.zu().add(this.featureFlags)):null===(o=(l=this.featureFlags).initialize)||void 0===o||o.call(l))}qu(t){const i=performance.now(),n=le(le({},e.__defaultExtensionClasses),this.config.__extensionClasses),s=[];var r,o,l,a,u,h,c;n.exceptions&&this.su.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new n.exceptions(this)),n.historyAutocapture&&this.su.push(this.historyAutocapture=new n.historyAutocapture(this)),n.tracingHeaders&&this.su.push(this.tracingHeaders=new n.tracingHeaders(this)),n.siteApps&&this.su.push(this.siteApps=new n.siteApps(this)),n.sessionRecording&&!t&&this.su.push(this.sessionRecording=new n.sessionRecording(this)),this.config.disable_scroll_properties||s.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),n.autocapture&&this.Hu(this.autocapture=new n.autocapture(this),s),n.surveys&&this.Hu(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new n.surveys(this),s),n.logs&&this.Hu(this.logs=null!==(l=this.logs)&&void 0!==l?l:new n.logs(this),s),n.metrics&&this.su.push(this.metrics=null!==(a=this.metrics)&&void 0!==a?a:new n.metrics(this)),n.conversations&&this.su.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new n.conversations(this)),n.productTours&&this.su.push(this.productTours=new n.productTours(this)),n.heatmaps&&this.su.push(this.heatmaps=new n.heatmaps(this)),n.webVitalsAutocapture&&this.su.push(this.webVitalsAutocapture=new n.webVitalsAutocapture(this)),n.exceptionObserver&&this.su.push(this.exceptionObserver=new n.exceptionObserver(this)),n.deadClicksAutocapture&&this.su.push(this.deadClicksAutocapture=new n.deadClicksAutocapture(this,V_)),n.toolbar&&this.su.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new n.toolbar(this)),n.experiments&&this.su.push(this.experiments=null!==(c=this.experiments)&&void 0!==c?c:new n.experiments(this)),this.su.forEach(t=>{t.initialize&&s.push(()=>{var e;null===(e=t.initialize)||void 0===e||e.call(t)})}),s.push(()=>{if(this.Wu){const t=this.Wu;this.Wu=void 0,this.su.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}}),this.Vu(s,i)}Vu(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout(()=>{this.Vu(t,e)},0);const i=t.shift();if(i)try{i()}catch(t){zs.error("Error initializing extension:",t)}}const i=Math.round(performance.now()-e);this.register_for_session({[Ot]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[At]:i}),this.config.__preview_deferred_init_extensions&&zs.info(`PostHog extensions initialized (${i}ms)`)}Kl(t){var e;if(!n||!n.body)return zs.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Kl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Wu=t),this.lu=t,this.compression=void 0,t.ok){var i;const e=t.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=fe(e.supportedCompression,ap.GZipJS)?ap.GZipJS:fe(e.supportedCompression,ap.Base64)?ap.Base64:void 0),(null===(i=e.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=e.analytics.endpoint)}this.set_config({person_profiles:this.Mu?this.Mu:Qt}),null===(e=this.Gu)||void 0===e||e.handleRemoteConfig(t),this.su.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}ju(){try{this.config.loaded(this)}catch(t){zs.critical("`loaded` function failed",t)}if(this.Zu(),this.config.internal_or_test_user_hostname&&(null==s?void 0:s.hostname)){const t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.fu())&&this.Qu()},1),this.Ju=new wb(this),this.Ju.load()}Zu(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.Fu)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Vs(this.__request_queue,t=>this.Ou(t)),this.__request_queue=[],this.Zu()}_handle_unload(){var t,e,i,n,s,r;this.wu=!0,null===(t=this.surveys)||void 0===t||null===(e=t.handlePageUnload)||void 0===e||e.call(t),null===(i=this.metrics)||void 0===i||i.flush("sendBeacon"),this.config.request_batching?(this.Ku()&&this.capture(Xt),null===(n=this.logs)||void 0===n||n.flushLogs("sendBeacon"),null===(s=this.Fu)||void 0===s||s.unload(),null===(r=this.Du)||void 0===r||r.unload()):this.Ku()&&this.capture(Xt,null,{transport:"sendBeacon"})}_send_request(t){var e,i,n;this.__loaded?ww?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=ap.Base64),"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=Nb(s.url,s.method,s.compression,s.timestampMode);const o=qb.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;Ab(t)?zs.warn(t):zs.error(t),null===(e=s.callback)||void 0===e||e.call(s,{statusCode:0,error:t})}};"sendBeacon"!==r&&s.data&&s.compression===ap.GZipJS&&a&&"undefined"!=typeof Promise&&!$b?Pb(s).then(t=>{u(t)}).catch(e=>{if(os(e))return $b=!0,void u(le(le({},s),{},{compression:void 0,url:Nb(t.url,t.method,void 0,t.timestampMode)}));ls(e)&&($b=!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}))}Ou(t){this.Du?this.Du.retriableRequest(t):this._send_request(t)}_execute_array(t){cw++;try{let e;const i=[],n=[],s=[];Vs(t,t=>{if(t)if(e=t[0],we(e))s.push(t);else if(ke(t))try{t.call(this)}catch(e){zs.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){Vs(t,function(t){try{if(we(t[0])){let i=e;Gs(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){zs.error("Error executing queued PostHog call",t,e)}})};r(i,this),r(n,this),r(s,this)}finally{cw--}}push(t){if(cw>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])}Xu(){var t;const e=null===(t=this.persistence)||void 0===t?void 0:t.get_property(b);return $e(e)&&yw.test(e)?{value:e,delivered:!1}:Se(e)&&$e(e.value)&&yw.test(e.value)?{value:e.value,delivered:!0===e.delivered}:void 0}Yu(t,e,i,n){if(!this.persistence)return;this.persistence.refreshKey(b);const s=this.Xu();if(!n){if(i)return $e(e)&&yw.test(e)?(e!==(null==s?void 0:s.value)&&this.persistence.register({[b]:{value:e,delivered:!1}}),{value:e,pending:e!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(b);if($e(t)&&mw.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({[b]:{value:e,delivered:!1}}),{value:e,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(b)}th(t){if(!this.persistence)return;this.persistence.refreshKey(b);const e=this.Xu();(null==e?void 0:e.value)!==t||e.delivered||this.persistence.register({[b]:{value:t,delivered:!0}})}capture(t,e,i){var n,s,r,o,l,a;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu))return void zs.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Ce(t)||!$e(t))return void zs.error("No event name provided to posthog.capture");this.yu();const u=!this.config.opt_out_useragent_filter&&this._is_bot();if(u&&!this.config.__preview_capture_bot_pageviews)return;const h=(null==i?void 0:i.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==h?void 0:h.isRateLimited)return void zs.critical("This capture call is ignored due to client rate limiting.");let c;(null==e?void 0:e.$current_url)&&!$e(null==e?void 0:e.$current_url)&&(zs.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.eh)||zs.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&&(c=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const d=new Date,v=(null==i?void 0:i.timestamp)||d,f=nn(null==i?void 0:i.uuid,El);let p={uuid:f,event:t,properties:this.calculateEventProperties(t,e||{},v,f)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&u&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),h&&(p.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);const g="$feature_flag_called"===t&&!1===p.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!g&&(p.$set=null==i?void 0:i.$set);const m=Se(null==e?void 0:e.$set)?e.$set:void 0,y=!!(null==i?void 0:i.$set)&&"$fbc"in i.$set,b=y||!!m&&"$fbc"in m,w=y?null==i||null===(n=i.$set)||void 0===n?void 0:n[_]:null==m?void 0:m[_],k=we(null==e?void 0:e.$unset)?e.$unset:[],S=(null==i?void 0:i.$unset)||[],x=-1!==k.indexOf("$fbc")||-1!==S.indexOf("$fbc"),C=this.Yu(null==c?void 0:c.fbclid,w,b,x);C&&!0===p.properties.$process_person_profile&&C.pending&&!b&&!g&&(p.$set=le({[_]:C.value},p.$set));const T=null==i?void 0:i.$unset;T&&(p.$unset=T);const E=g?void 0:this.ih(null==i?void 0:i.$set_once,t!==ee,t===te);if(E&&(p.$set_once=E),(null==i?void 0:i._noTruncate)||(I=this.config.properties_string_max_length,p=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=[],Vs(n,e=>{r.push(t(e))});else{const e={};Gs(Ne(n)?Ys(n):n,(n,s)=>{i.has(n)||(e[s]=t(n,s))}),r=e}return r}(t)}(p,t=>$e(t)?t.slice(0,I):t)),p.timestamp=v,Ce(null==i?void 0:i.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),g&&(p.properties=((t,e=[])=>{const i={},n=e=>{void 0!==t[e]&&(i[e]=t[e])};return is.forEach(n),e.forEach(n),i})(p.properties,_w)),t===mp.DISMISSED||t===mp.SENT){const i=null==e?void 0:e[yp.SURVEY_ID],n=null==e?void 0:e[yp.SURVEY_ITERATION];Ep({id:i,current_iteration:n}),p.$set=le(le({},p.$set),{},{[na({id:i,current_iteration:n},t===mp.SENT?"responded":"dismissed")]:!0})}else t===mp.SHOWN&&(p.$set=le(le({},p.$set),{},{[yp.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var I;if(t===gb.SHOWN){const t=null==e?void 0:e[mb.TOUR_TYPE];t&&(p.$set=le(le({},p.$set),{},{[`${mb.TOUR_LAST_SEEN_DATE}/${t}`]:(new Date).toISOString()}))}const M=le(le({},p.properties.$set),p.$set);if(xe(M)||this.setPersonPropertiesForFlags(M),!Ie(this.config.before_send)){const t=this.Os(p);if(!t)return;p=t,p.uuid=nn(p.uuid,El)}const R=null!==(s=null===(r=p.$set)||void 0===r?void 0:r.$fbc)&&void 0!==s?s:Se(null===(o=p.properties)||void 0===o?void 0:o.$set)?p.properties.$set[_]:void 0,P=(null==C?void 0:C.pending)&&R===C.value?C.value:void 0;this.au.emit("eventCaptured",p);const O=null!==(l=null==i?void 0:i._url)&&void 0!==l?l:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),A="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(O),F=le(le(le({method:"POST",url:O,data:p,compression:"best-available",timestampMode:A?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},A&&(null===(a=p.properties)||void 0===a?void 0:a.$session_id)?{batchGroup:p.properties.$session_id}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),P?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.th(P)}}:{});var D;return!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)||P?(!F.transport&&!F.callback&&xe(null!==(D=this.config.request_headers)&&void 0!==D?D:{})&&this.wu&&(F.transport="sendBeacon"),this.Ou(F)):this.Fu.enqueue(F),p}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null===(e=this.Gu)||void 0===e?void 0:e.getExtension(t)}zu(){var t;return null!==(t=this.Gu)&&void 0!==t?t:this.Gu=new uw(this)}hu(t){this.$u.push(t);let e=!0;return()=>{if(!e)return;e=!1;const i=this.$u.indexOf(t);-1!==i&&this.$u.splice(i,1)}}nh(t=!0){var e,i,n;return!!(null===(e=this.persistence)||void 0===e?void 0:e.consumeCookieIdentityChange())&&(this.Eu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(n=this.sessionPersistence)||void 0===n||n.clear(),this.xu.clear(),this.sh()),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.nh();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.fu()&&(h[Pt]=!0),"$snapshot"===e){const t=le(le({},this.persistence.properties()),this.sessionPersistence.properties());return h.distinct_id=t.distinct_id,(!$e(h.distinct_id)&&!Me(h.distinct_id)||Te(h.distinct_id))&&zs.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?[...Sa,...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={},_=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,b=null===(l=navigator)||void 0===l?void 0:l.maxTouchPoints,w=null==t||null===(a=t.screen)||void 0===a?void 0:a.width,k=null==t||null===(h=t.screen)||void 0===h?void 0:h.height,S=null==t?void 0:t.devicePixelRatio;Ce(_)||(y.userAgentDataPlatform=_),Ce(b)||(y.maxTouchPoints=b),Ce(w)||(y.screenWidth=w),Ce(k)||(y.screenHeight=k),Ce(S)||(y.devicePixelRatio=S);const x=Zs(Ks({$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:Da(),$timezone_offset:La()}),{$current_url:ar(r?rn(null==s?void 0:s.href):null==s?void 0:s.href,c,Ca),$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:zi(u,navigator.vendor,g,m),$browser_language:Ma(),$browser_language_prefix:Ra(),$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:Hs.LIB_NAME,$lib_version:Hs.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Hs.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=Hs.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&&Zs(h,this.sessionPropsManager.getSessionProps());try{var d;this.sessionRecording&&Zs(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null===(d=this.Du)||void 0===d?void 0:d.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}let v;if(this.requestRouter.region===Yb&&(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=Zs(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)),Gs(["$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{Zs(y,t())}catch(t){zs.error("Failed to produce browser extension event properties",t)}h=Zs({},c,f,p,le(le({},y),h)),h.$is_identified=this._isIdentified(),we(this.config.property_denylist)?Gs(this.config.property_denylist,function(t){delete h[t]}):zs.error(gw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const _=this.config.sanitize_properties;_&&(zs.error(pw),h=_(h,e));const b=this.rh();return h.$process_person_profile=b,b&&!l&&this.oh("_calculate_event_properties"),h}ih(t,e=!0,i=!1){var n;if(!this.persistence||!this.rh())return t;if(this.Su&&!i)return t;const s=this.persistence.get_initial_props(),r=null===(n=this.sessionPropsManager)||void 0===n?void 0:n.getSetOnceProps();let o=Zs({},s,r||{},t||{});const l=this.config.sanitize_properties;return l&&(zs.error(pw),o=l(o,"$set_once")),e&&(this.Su=!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.nh(),null===(i=this.sessionPersistence)||void 0===i||i.register(t),Object.keys(t).forEach(t=>this.xu.add(t)),this.sh()}unregister(t){var e;null===(e=this.persistence)||void 0===e||e.unregister(t)}unregister_for_session(t){var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t),this.xu.delete(t),this.sh()}ah(t,e){this.register({[t]:e})}Lu(){this.xu.forEach(t=>{var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t)}),this.xu.clear(),this.sh()}sh(){var t;if(!this.Cu)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.pi)||!Ql.Et())return void Ql.Lt(this.Cu);const e=[];this.xu.forEach(t=>e.push(t)),e.length>0?Ql.At(this.Cu,e):Ql.Lt(this.Cu)}getFeatureFlag(t,e){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,n;return null!==(i=null===(n=this.featureFlags)||void 0===n?void 0:n.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null===(t=this.featureFlags)||void 0===t||t.reloadFeatureFlags()}updateFlags(t,e,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e=!1,i){var n;return null===(n=this.featureFlags)||void 0===n?void 0:n.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.au.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:fw}),()=>{})}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:fw})}getActiveMatchingSurveys(t,e=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:fw})}renderSurvey(t,e){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(t,e)}displaySurvey(t,e=Mp){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:fw}}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:fw})}uh(t){return!t||Te(t)?(zs.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(zs.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())||(zs.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 zs.uninitializedWarning("posthog.identify");if(Me(t)&&(t=t.toString(),zs.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.uh(t))return;if(!this.oh("posthog.identify"))return;this.yu();const n=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,r=this.nh(!1),o=this.persistence.Pl();let l=!1;try{const n=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:n},""),t!==n&&t!==this.get_property("__alias")&&(this.unregister(m),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===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.Rl(),this.capture(te,s,{$set:e||{},$set_once:i||{}}),this.Eu=pa(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.Rl(),this.capture("$set",{$set:n,$set_once:s}),this.Eu=pa(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);u||s||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(bt)):h&&(e||i)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Ol(l)}}setPersonProperties(t,e){if(!t&&!e)return;if(!this.oh("posthog.setPersonProperties"))return;const i=pa(this.get_distinct_id(),t,e);this.Eu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Eu=i):zs.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.oh("posthog.unsetPersonProperties")&&(null===(e=this.featureFlags)||void 0===e||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Eu=null)}group(t,e,i){var n;if(!t||!e)return void zs.error("posthog.group requires a group type and group key");null===(n=this.persistence)||void 0===n||n.syncCookieProperties(),this.nh();const s=this.getGroups(),r=s[t]!==e;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:le(le({},s),{},{[t]:e})}),(r||i)&&this.rh()){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.oh("posthog.setGroupPropertiesForFlags")&&(null===(i=this.featureFlags)||void 0===i||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null===(e=this.featureFlags)||void 0===e||e.resetGroupPropertiesForFlags(t)}reset(t){const e=Pe(t)?t:null==t?void 0:t.resetDeviceID,i=Pe(t)||null==t?void 0:t.bootstrap;this.hh(e,!1,i)}hh(t,e=!1,i){var n,s,r,o,l,a;if(zs.info("reset"),!this.__loaded)return zs.uninitializedWarning("posthog.reset");const u=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(n=this.Ru)||void 0===n?void 0:n.bootstrap)||{},null===(s=this.featureFlags)||void 0===s||null===(r=s.updateConfig)||void 0===r||r.call(s,this.config,this.Xl());const h=this.get_property(p),c=this.get_property(g),d=this.get_property(O);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();this.consent.reset(),e||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const f=null===(l=this.persistence)||void 0===l||null===(a=l.Pl)||void 0===a?void 0:a.call(l);let m=!1;try{var y,_,b,w,k,S,x,C,T,E,I,M,R;if(null===(y=this.persistence)||void 0===y||y.clear(),null===(_=this.sessionPersistence)||void 0===_||_.clear(),this.xu.clear(),this.sh(),Ce(d)||null===(E=this.persistence)||void 0===E||E.register({$session_recording_remote_config:d}),null===(b=this.surveys)||void 0===b||b.reset(),null===(w=this.featureFlags)||void 0===w||w.reset(),null===(k=this.conversations)||void 0===k||k.reset(),null===(S=this.logs)||void 0===S||S.reset(),null===(x=this.metrics)||void 0===x||x.reset(),null===(C=this.persistence)||void 0===C||C.set_property("$user_state","anonymous"),null===(T=this.sessionManager)||void 0===T||T.resetSessionId(),this.Eu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Rt,$device_id:null},"");else{const e=this.config.get_device_id(El());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.fu()&&(null===(R=this.persistence)||void 0===R||R.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(I=this.featureFlags)||void 0===I||I.initialize(),!Ie(u)&&!(null===(M=this.sessionManager)||void 0===M?void 0:M.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 P,A;f&&(null===(P=this.persistence)||void 0===P||null===(A=P.Ol)||void 0===A||A.call(P,m))}this.reloadFeatureFlags()}shutdown(t){var e=this;return ne(function*(){var t,i,n,s,r,o,l,a;if(e.__loaded){e.ku=!0,e.zu().dispose(),null===(t=e.sessionRecording)||void 0===t||t.dispose(),null===(i=e.logs)||void 0===i||i.flushLogs("sendBeacon"),null===(n=e.metrics)||void 0===n||n.flush("sendBeacon"),null===(s=e.metrics)||void 0===s||s.dispose(),null===(r=e.Fu)||void 0===r||r.unload(),null===(o=e.Du)||void 0===o||o.unload();try{var u;null===(u=e.featureFlags)||void 0===u||u.destroy()}catch(t){zs.error("Error while destroying feature flags",t)}null===(l=e.persistence)||void 0===l||l.destroy(),null===(a=e.sessionPersistence)||void 0===a||a.destroy()}else zs.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.dh()}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.fh()}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")?(zs.critical("Attempting to create alias for existing People user - aborting."),-2):this.oh("posthog.alias")?(Ce(e)&&(e=this.get_distinct_id()),t!==e?(this.ah(m,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(zs.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,p;Zs(this.config,Cw(t));const m=this.bu();null===(i=this.persistence)||void 0===i||i.update_config(this.config,e,m),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new fb(le(le({},this.config),{},{persistence:"sessionStorage"}),m,!1);const y=this.Pu(this.config.debug);var g;Pe(y)&&(this.config.debug=y),Pe(this.config.debug)&&(this.config.debug?(Jl.DEBUG=!0,Fl.Et()&&Fl.At("ph_debug",!0),zs.info("set_config",{config:t,oldConfig:e,newConfig:le({},this.config)})):(Jl.DEBUG=!1,Fl.Et()&&Fl.Lt("ph_debug"))),null===(n=this.featureFlags)||void 0===n||null===(s=n.updateConfig)||void 0===s||s.call(n,this.config,this.Xl()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(l=this.metrics)||void 0===l||l.onConfigChange(),null===(a=this.sessionRecording)||void 0===a||a.startIfEnabledOrStop(),null===(u=this.tracingHeaders)||void 0===u||u.startIfEnabledOrStop(),null===(h=this.autocapture)||void 0===h||h.startIfEnabled(),null===(c=this.heatmaps)||void 0===c||c.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(g=this.historyAutocapture)||void 0===g||g.startIfEnabledOrStop()),null===(d=this.exceptionObserver)||void 0===d||d.startIfEnabledOrStop(),null===(v=this.deadClicksAutocapture)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.surveys)||void 0===f||f.loadIfEnabled(),this._u(),null===(p=this.externalIntegrations)||void 0===p||p.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&Q_(this,dw,!1)}}_overrideSDKInfo(t,e){Jl.LIB_NAME=t,Jl.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.ph}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:bw;return e!==bw&&(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"))}rh(){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))}Ku(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.rh()||this.oh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.oh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}oh(t){return"never"===this.config.person_profiles?(zs.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ah(Mt,!0),!0)}bu(){if("always"===this.config.cookieless_mode)return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_u(){var t,e;const i=this.bu();var n,s,r;return this.is_capturing()||null===(n=this.logs)||void 0===n||n.gh(),(null===(t=this.persistence)||void 0===t?void 0:t.pi)!==i&&(null===(s=this.persistence)||void 0===s||s.set_disabled(i)),(null===(e=this.sessionPersistence)||void 0===e?void 0:e.pi)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),i&&(this.xu.clear(),this.sh()),i}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){if(this.fu()){var n,s,r,o,l,a;null===(n=this.sessionRecording)||void 0===n||n.dispose({discardBufferedEvents:!0}),this.hh(!0,!0),null===(s=this.sessionManager)||void 0===s||s.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new Qb(this),this.pageViewManager=new X_(this),this.persistence&&(this.sessionPropsManager=new Wb(this,this.sessionManager,this.persistence));const t=null!==(o=null===(l=this.config.__extensionClasses)||void 0===l?void 0:l.sessionRecording)&&void 0!==o?o:null===(a=e.__defaultExtensionClasses)||void 0===a?void 0:a.sessionRecording;var u,h;t&&(this.sessionRecording=this.vu(this.sessionRecording,new t(this)),this.lu&&(null===(u=this.sessionRecording)||void 0===u||null===(h=u.onRemoteConfig)||void 0===h||h.call(u,this.lu)))}var c,d;this.consent.optInOut(!0),this._u(),this.Zu(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(c=this.surveys)||void 0===c||c.loadIfEnabled()),(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.Qu()}else zs.warn(vw)}opt_out_capturing(){if("always"===this.config.cookieless_mode)return void zs.warn(vw);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.hh(!0,!0),this.consent.optInOut(!1),this._u(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Rt,$device_id:null}),this.du(t),this.sessionRecording=void 0,null===(e=this.sessionManager)||void 0===e||e.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Qu(),this.Zu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._u()}_is_bot(){return i?Jb(i,this.config.custom_blocked_useragents):void 0}Qu(){n&&("visible"===n.visibilityState?this.Tu||(this.Tu=!0,this.capture(Yt,{title:n.title},{send_instantly:!0}),this.Iu&&(n.removeEventListener(Jt,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),er(n,Jt,this.Iu)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Xl(){const t=this.Ru||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(zs.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&&!Ie(t[e]),o=i in t&&!Ie(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,zs)}Os(t){var e;if(Ie(this.config.before_send))return t;const i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(Fe),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),Ie(s)){const e=`Event '${t.event}' was rejected in beforeSend function`;return Ae(t.event)?zs.warn(`${e}. This can cause unexpected behavior.`):zs.info(e),null}s.properties&&!xe(s.properties)||zs.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(e){return zs.error(`Error in beforeSend function for event '${t.event}':`,e),null}for(const e of i)if(s.properties&&Ie(s.properties[e]))return zs.warn(`Event '${t.event}' had its '${e}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return s}getPageViewId(){var t;return null===(t=this.pageViewManager.Bo)||void 0===t?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Pu(t){const e=Pe(t)&&!t,i=Fl.Et()&&"true"===Fl.Ot("ph_debug");return!e&&(!!i||t)}};Tw.__defaultExtensionClasses={},Tw.ph=(()=>{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]]=Js(t.prototype[e[i]])}(Tw,["identify"]);var Ew=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.Xl(),t.url_allowlist=null==i?void 0:i.url_allowlist,t.url_ignorelist=null==i?void 0:i.url_ignorelist,t.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,t.element_allowlist=null==i?void 0:i.element_allowlist,t.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,t.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,t.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,t.capture_copied_text=null==i?void 0:i.capture_copied_text}};const Iw=Ws("[ExceptionAutocapture]"),Mw=Ws("[TracingHeaders]"),Rw=Ws("[Web Vitals]"),Pw=9e5,Ow=["CLS","FCP","INP","LCP"],Aw=["INP","LCP"],Fw=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Dw=Ws("[SessionRecording]"),Lw=Ws("[Heatmaps]");function Nw(t){return Se(t)&&"clientX"in t&&"clientY"in t&&Me(t.clientX)&&Me(t.clientY)}const qw=Ws("[Product Tours]"),Bw=t=>{var e;return!t.config.disable_product_tours&&!!(null===(e=t.persistence)||void 0===e?void 0:e.get_property(M))},jw=["$set_once","$set"],Hw=Ws("[SiteApps]"),Uw="Error while initializing PostHog app with config id ",zw=(t,e)=>(null==t?void 0:t.then)?t.then(e):e(t),Ww="SDK is not enabled or survey functionality is not yet loaded",Vw="Disabled. Not loading surveys.";var Gw=class{constructor(t,e){this.yo=t,this.mh=e,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.yh=!1,this.bh=[],this._h=null,this.wh=null,this.So=!1,this.kh=new Set,this.onRemoteConfig=t=>{if(this.So)return;if(this.Mr.disableSurveys)return;if(!t.ok)return wp.warn("Remote config unavailable. Not loading surveys.");const e=t.config.surveys;if(Ie(e))return wp.warn("Flags not loaded yet. Not loading surveys.");this.Sh=Pe(e)?e:e.length>0,wp.info(`flags response received, isSurveysEnabled: ${this.Sh}`),this.loadIfEnabled()}}setup(t){if(!this.So)return this.xh=t,zw(t.kv.initialize(),()=>{if(this.xh!==t||this.So)return;this.xh=void 0,this.po=t;const e=t.onRemoteConfig(this.onRemoteConfig);this.So?e.dispose():(this.$o=e,this.loadIfEnabled())})}dispose(){var t,e,i,n;this.So||(this.So=!0,this.xh=void 0,this.po=void 0,null===(t=this.$o)||void 0===t||t.dispose(),this.$o=void 0,null===(e=this._surveyEventReceiver)||void 0===e||e.dispose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(n=i.dispose)||void 0===n||n.call(i),this._surveyManager=null,this.bh=[],this._h=null,this.kh.forEach(t=>clearTimeout(t)),this.kh.clear())}get Mr(){return this.yo.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null===(t=this._surveyEventReceiver)||void 0===t||t.reset(),localStorage.removeItem("lastSeenSurveyDate");const e=[];for(let t=0;t<localStorage.length;t++){const i=localStorage.key(t);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&e.push(i)}e.forEach(t=>localStorage.removeItem(t))}catch(t){}}loadIfEnabled(){if(this.So||!this.po)return;const t=this.Mr;if(this._surveyManager)return;if(this.yh)return void wp.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void wp.info(Vw);if(t.cookielessMode&&this.yo.isOptedOut())return void wp.info("Not loading surveys in cookieless mode without consent.");const e=this.yo.getExtensions();if(!e)return void wp.error("PostHog Extensions not found.");if(Ce(this.Sh)&&!t.advancedEnableSurveys)return;const i=this.Sh||t.advancedEnableSurveys;this.yh=!0;try{const t=e.generateSurveys;if(t)return this.Ch(t,i),void(this.yh=!1);const n=e.loadExternalDependency;if(!n)return this.$h(Vt),void(this.yh=!1);n(t=>{try{if(this.So)return;const e=this.yo.getExtensions();t||!(null==e?void 0:e.generateSurveys)?this.$h("Could not load surveys script",t):this.Ch(e.generateSurveys,i)}finally{this.yh=!1}})}catch(t){throw this.yh=!1,this.$h("Error initializing surveys",t),t}}Ch(t,e){this.So||(this._surveyManager=t(e),this._surveyEventReceiver=this.yo.createEventReceiver(),wp.info("Surveys loaded successfully"),this.Th({isLoaded:!0}))}$h(t,e){wp.error(t,e),this.Th({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.bh.push(t),this._surveyManager&&this.Th({isLoaded:!0}),()=>{this.bh=this.bh.filter(e=>e!==t)}}getSurveys(t,e=!1){var i;const n=null!==(i=this.po)&&void 0!==i?i:this.mh;if(!n||this.So)return;if(this.Mr.disableSurveys)return wp.info(Vw),t([]);const s=n.kv.get(at);if(s&&!e)return t(s,{isLoaded:!0}),void(this.Ih()&&this.getSurveys(()=>{},!0));if(this._h)return void this._h.then(({surveys:e,context:i})=>{this.So||t(e,i)}).catch(t=>wp.error("Error in survey callback",t));const r=this.Mh("/api/surveys/",{method:"GET",query:{token:n.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(t=>{try{return this.Eh(n,t)}catch(t){return wp.error("Error processing surveys response",t),this.Eh(n,{statusCode:0,error:t})}},t=>this.Eh(n,{statusCode:0,error:t}));this._h=r;const o=()=>{this._h===r&&(this._h=null)};r.then(e=>{o(),this.So||t(e.surveys,e.context)},o).catch(t=>wp.error("Error in survey callback",t))}Mh(t,e){const i=this.po;return i?i.sendRequest(t,e):new Promise(t=>t({statusCode:0,error:new Error(Ww)}))}Eh(t,e){if(this.So)return{surveys:[],context:{isLoaded:!1,error:Ww}};const i=e.statusCode;if(200!==i||!e.json){const t=`Surveys API could not be loaded, status: ${i}`;return 0!==i?wp.error(t):e.error||wp.warn(t),this.wh=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.wh=null;const n=e.json.surveys||[],s=n.filter(t=>xp(t)&&(ua(t)||Cp(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}}}Ih(){return this.Ph()&&!this._h&&!this.Rh()}Ph(){var t,e;const i=null===(t=null!==(e=this.po)&&void 0!==e?e:this.mh)||void 0===t?void 0:t.kv.get(ut);return Me(i)&&Date.now()-i>3e5}Rh(){return Me(this.wh)&&3e5>Date.now()-this.wh}markSurveyAsSeen(t,e){var i;const n={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};Ep(n);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Th(t){for(const e of this.bh)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){wp.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e=!1){if(!Ie(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);wp.warn("init was not called")}Ah(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}Fh(t){if(Ie(this._surveyManager))return{eligible:!1,reason:Ww};const e="string"==typeof t?this.Ah(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Oh(t){if(!this.yo.isCapturing())return{eligible:!1,reason:kp};if(Ie(this._surveyManager))return{eligible:!1,reason:Ww};const e="string"==typeof t?this.Ah(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Ie(this._surveyManager))return wp.warn("init was not called"),{visible:!1,disabledReason:Ww};const e=this.Oh(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Ie(this._surveyManager)?(wp.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ww})):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.Oh(s);i({visible:t.eligible,disabledReason:t.reason})}else i({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,i){var s;if(!this.yo.isCapturing())return;if(Ie(this._surveyManager))return void wp.warn("init was not called");const r="string"==typeof t?this.Ah(t):t;if(!(null==r?void 0:r.id))return void wp.warn("Survey not found");if(!Ip.includes(r.type))return void wp.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){wp.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var e,n;this.kh.delete(t),!this.So&&this.yo.isCapturing()&&(wp.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),wp.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.kh.add(t)}this._surveyManager.renderSurvey(r,o,i)}else wp.warn("Survey element not found")}displaySurvey(t,e){var i;if(!this.yo.isCapturing())return;if(Ie(this._surveyManager))return void wp.warn("init was not called");const n=this.Ah(t);if(!n)return void wp.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!==_p.Popover&&e.initialResponses&&wp.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){const t=this.Fh(n);if(!t.eligible)return void wp.warn("Survey is not eligible to be displayed: ",t.reason)}e.displayType!==_p.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}cancelPendingSurvey(t){Ie(this._surveyManager)?wp.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 Zw(t,e,i){if(Ie(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 Qw=class{constructor(t){this._instance=t,this.Dh=new Set,this.Lh=new Set,this.Nh=new Vb,this.qh=(t,e)=>this.jh(t,e)&&this.Bh(t,e)&&this.Hh(t,e)&&this.zh(t,e),this.jh=(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.Uh=null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook((t,e)=>{this.on(t,e)}))}dispose(){var t;null===(t=this.Uh)||void 0===t||t.call(this),this.Uh=void 0,this.Nh=new Vb}register(t){var e,i;if(!Ce(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)&&(t.forEach(t=>{var e;this.Dh.add(t),null===(e=t.steps)||void 0===e||e.forEach(t=>{this.Lh.add((null==t?void 0:t.event)||"")})}),null===(i=this._instance)||void 0===i?void 0:i.autocapture)){const t=new Set;this.Dh.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.Dh.clear(),this.Lh.clear(),this.register(t)}on(t,e){null!=e&&0!=t.length&&(this.Lh.has(t)||this.Lh.has(e.event))&&this.Dh.forEach(t=>{this.Wh(e,t)&&this.Nh.emit("actionCaptured",t.name)})}Vh(t){this.onAction("actionCaptured",e=>t(e))}Wh(t,e){if(null==(null==e?void 0:e.steps))return!1;for(const i of e.steps)if(this.qh(t,i))return!0;return!1}onAction(t,e){return this.Nh.on(t,e)}Bh(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(!Zw(n,e.url,e.url_matching||"contains"))return!1}return!0}Hh(t,e){return!!this.Gh(t,e)&&!!this.Zh(t,e)&&!!this.Qh(t,e)}Gh(t,e){var i;if(!(null==e?void 0:e.href))return!0;const n=this.Jh(t);if(n.length>0)return n.some(t=>Zw(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&&Zw(function(t){const e=t.match(/(?::|")href="(.*?)"/);return e?e[1]:""}(s),e.href,e.href_matching||"exact")}Zh(t,e){var i;if(!(null==e?void 0:e.text))return!0;const n=this.Jh(t);if(n.length>0)return n.some(t=>Zw(t.text,e.text,e.text_matching||"exact")||Zw(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(;!Ie(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=>Zw(t,o,l)));var r,o,l}Qh(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}Jh(t){var e;return null==(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}zh(t,e){return!(null==e?void 0:e.properties)||0===e.properties.length||fa(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)}},Jw=class{constructor(t){var e,i;this.Kh=[],this._instance=t,this.Xh=new Map,this.Yh=new Map,this.tc=new Map,this.ec=null===(e=this._instance)||void 0===e||null===(i=e.onSessionId)||void 0===i?void 0:i.call(e,t=>this.nc(t))}sc(t){return!1}rc(){return null}oc(t){}lc(){}ac(t,e){return!!t&&fa(t.propertyFilters,null==e?void 0:e.properties)}uc(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}hc(t,e,i){const n=(i===up.Activation?this.Xh:this.Yh).get(t);let s=[];return this.cc(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.ac(r,e)})}register(t){this.dc(t,!1)}replace(t){this.dc(t,!0)}dc(t,e){var i;Ce(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)||(this.vc(t,e),this.fc(t,e))}fc(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.tc.clear(),0===i.length)return void(e&&(null===(n=this.gc)||void 0===n||n.replace([])));this.gc||(this.gc=new Qw(this._instance),this.gc.init(),this.gc.Vh(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.tc.get(e.name))&&void 0!==i?i:[];n.includes(t.id)||n.push(t.id),this.tc.set(e.name,n)}})}),e?this.gc.replace(s):this.gc.register(s)}mc(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)})}vc(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.uc(t,up.Activation),l=this.uc(t,up.Cancellation);e?(this.Xh=o,this.Yh=l):(this.mc(this.Xh,o),this.mc(this.Yh,l)),(0!==s.length||0!==r.length)&&(null!==(i=this.Uh)&&void 0!==i||(this.Uh=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.yc(),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.bc(t,r);if("consume"===e)return s.info("event consumed activated item, removing it",{event:t,itemId:r}),void this._c([r]);if("persist"===e)return s.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.wc(r),void this.kc([r])}if(this.Yh.has(t)){const i=this.hc(t,e,up.Cancellation);i.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:i.map(t=>t.id)}),this._c(i.map(t=>t.id)),i.forEach(t=>this.Sc(t.id)))}if(!this.Xh.has(t))return;s.info("event name matched",{event:t,eventPayload:e,items:this.Xh.get(t)});const o=this.hc(t,e,up.Activation);this.xc(o.map(t=>t.id))}onAction(t){this.tc.has(t)&&this.xc(this.tc.get(t)||[])}xc(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.sc(e)?this.wc(e)&&this.Cc(e):s.push(e);s.length>0&&(this.Kh=[...new Set([...this.Kh,...s])]),this.yc().info("updating activated items",{activatedItems:this.getActivatedIds()})}wc(t){this.Kh=this.Kh.filter(e=>e!==t);const e=this.$c();return!e.includes(t)&&(this.Tc([...e,t]),this.Ic(),!0)}_c(t){const e=new Set(t);this.Kh=this.Kh.filter(t=>!e.has(t));const i=this.Mc(),n=i.filter(t=>!e.has(t));n.length!==i.length&&(this.Tc(n),0===n.length&&this.Ec()),this.kc(t)}Pc(){var t;const e=this.rc();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:{}}Cc(t){if(!this.rc())return;const e=this.Pc();this.oc(le(le({},e),{},{[t]:Date.now()}))}kc(t){if(!this.rc())return;const e=this.Pc(),i={};let n=!1;for(const[s,r]of Object.entries(e))t.includes(s)?n=!0:i[s]=r;n&&(xe(i)?this.lc():this.oc(i))}Rc(){this.rc()&&this.lc()}getActivationTimestamp(t){if(!this.$c().includes(t))return;const e=this.Pc()[t];return Me(e)?e:void 0}Mc(){var t;const e=this.Ac();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.Mc();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.Fc()],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:[]}Ic(){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.Oc(i)}Ec(){this.Dc()}nc(t){var e;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[this.Fc()];if(i&&i!==t){const t=this.Mc(),e=this.Pc();t.length>0&&(this.Tc([]),t.filter(t=>Me(e[t])).forEach(t=>this.Sc(t))),this.Ec(),this.Rc()}}getActivatedIds(){return[...new Set([...this.$c(),...this.Kh])].filter(t=>!this.Lc(t))}dispose(){var t,e,i;null===(t=this.ec)||void 0===t||t.call(this),this.ec=void 0,null===(e=this.Uh)||void 0===e||e.call(this),this.Uh=void 0,null===(i=this.gc)||void 0===i||i.dispose(),this.gc=void 0}reset(){this.Kh=[],this.Mc().length>0&&this.Tc([]),this.Ec(),this.Rc()}getEventToItemsMap(){return this.Xh}Nc(){return this.gc}},Kw=class extends Jw{constructor(t){super(t)}Ac(){return ht}Fc(){return ct}rc(){return dt}oc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_timestamps:t})}lc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_timestamps")}sc(t){var e;let i;this.cc(e=>{i=e.find(e=>e.id===t)});const n=null==i||null===(e=i.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds;return Me(n)&&n>0}qc(){return mp.SHOWN}cc(t){var e;null===(e=this._instance)||void 0===e||e.getSurveys(t)}Sc(t){var e;null===(e=this._instance)||void 0===e||e.cancelPendingSurvey(t)}yc(){return wp}Tc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated:t})}Oc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_session:t})}Dc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_session")}Lc(){return!1}bc(t,e){let i;return this.cc(t=>{i=t.find(t=>t.id===e)}),!i||ha(i)?t===mp.SHOWN?"consume":"ignore":t===mp.SHOWN?"persist":t===mp.DISMISSED||t===mp.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Yw=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)}},Xw=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 Kw(this._instance)}};const tk=(null==t?void 0:t.location)?ur(t.location.hash,"__posthog")||ur(location.hash,"state"):null,ek="_postHogToolbarParams",ik=Ws("[Toolbar]"),nk=Ws("[FeatureFlags]");var sk=class{constructor(t,e=!1){this.jc=!1,this.update(t,e)}update(t,e){this.Bc=((t,e)=>{var i,n,s,r,o,l,a;return{bootstrap:{featureFlags:null!==(i=null===(n=t.bootstrap)||void 0===n?void 0:n.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(s=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:void 0},remoteRequestsDisabled:e,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=t.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:Ce(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(l=null!==(a=t.evaluation_contexts)&&void 0!==a?a:t.evaluation_environments)&&void 0!==l?l:[],flagKeys:we(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.jc||(nk.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.jc=!0),Ce(t.flag_keys)||we(t.flag_keys)||nk.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Bc}};const rk=Ws("[FeatureFlags]"),ok=Ws("[FeatureFlags]",{debugEnabled:!0}),lk="\" failed. Feature flags didn't load in time.",ak=["click","keydown","wheel","touchstart","pointerdown"],uk="connection_error",hk=t=>{const e={};for(let i=0;t.length>i;i++)e[t[i]]=!0;return e},ck=t=>{const e={};for(const[i,n]of Qs(t||{}))n&&(e[i]=n);return e},dk="Refusing to render web experiment since the viewer is a likely bot",vk={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>ca(e,t),not_regex:(t,e)=>!ca(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},fk=Ws("[Conversations]"),pk="Conversations not available yet.";function gk(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(Cs,t)?Cs[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 mk=["debug","log","warn","error","info"],yk="console",_k="__posthogHandledLogsRequestError",bk=(t,e)=>{const i=t instanceof Error?t:new Error(e);return i[_k]=!0,i},wk=t=>!!t&&"object"==typeof t&&!0===t[_k],kk=Ws("[NetworkMetrics]"),Sk=()=>{var e;return(null==t||null===(e=t.performance)||void 0===e?void 0:e.now)?t.performance.now():Date.now()},xk=t=>t?`${Math.floor(t/100)}xx`:"missing",Ck=(t,e)=>{var i;const n=String(e);return{method:String(t).toUpperCase(),url:(null===(i=rr(n))||void 0===i?void 0:i.href)||n}},$k=(t,e,i,n,s)=>{try{var r,o,l;const u=s();if(!u)return;const h=i||void 0,c=Sk()-n,d=rr(e.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;const v={url:(null==d?void 0:d.href)||e.url,method:e.method},f=ke(u.name)?u.name(v):$e(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=le({method:v.method,host:null!==(r=null==d?void 0:d.hostname)&&void 0!==r?r:"",path:d?(a=d.pathname,a.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/")):"",status_class:xk(h)},null===(o=u.attributes)||void 0===o?void 0:o.call(u,v,{status:h,durationMs:c}));null===(l=t.metrics)||void 0===l||l.histogram(f,c,{unit:"ms",attributes:p})}catch(t){kk.error("Failed to record network metric",t)}var a},Tk=()=>{},Ek=(e,i)=>ke(null==t?void 0:t.fetch)?_v(t,"fetch",t=>function(...n){const s=Sk(),r=t.apply(this,n);if(!i())return r;try{var o,l,a;const[t,u]=n,h=Ck(null!==(o=null!==(l=null==u?void 0:u.method)&&void 0!==l?l:null==t?void 0:t.method)&&void 0!==o?o:"GET",null!==(a=null==t?void 0:t.url)&&void 0!==a?a:t);return r.then(t=>($k(e,h,null==t?void 0:t.status,s,i),t),t=>{throw $k(e,h,void 0,s,i),t})}catch(t){return kk.error("Failed to observe fetch",t),r}}):Tk,Ik=(e,i)=>{var n;const s=null==t||null===(n=t.XMLHttpRequest)||void 0===n?void 0:n.prototype;if(!s)return Tk;const r=new WeakMap,o=_v(s,"open",t=>function(...e){try{(()=>xb.has(this))()||r.set(this,Ck(e[0],e[1]))}catch(t){kk.error("Failed to observe XHR open",t)}return t.apply(this,e)}),l=_v(s,"send",t=>function(...n){let s;try{const t=r.get(this);if(t&&i()){const n=Sk();s=()=>{this.removeEventListener("loadend",s),$k(e,t,this.status,n,i)},er(this,"loadend",s)}}catch(t){kk.error("Failed to observe XHR send",t)}try{return t.apply(this,n)}catch(t){throw s&&this.removeEventListener("loadend",s),t}});return()=>{o(),l()}},Mk={featureFlags:class{constructor(t){this.name="featureFlags",this.Hc=!1,this.featureFlagEventHandlers=[],this.$=rk,this.zc={},this.Uc={},this.Wc=[],this.Vc=!1,this.Gc=!1,this.Zc=0,this.Qc=!1,this.Jc=!1,this.Kc=!1,this.Xc=!1,this.Yc=0,this.td=!1,this.sn=()=>{const t=this.ed();this.Yc=0,t&&this.reloadFeatureFlags()},this.nd=()=>{var t,e;const i=this.sd,s=null!==(t=this.rd)&&void 0!==t?t:i;Ce(i)||Ce(s)||this.Mr.remoteRequestsDisabled||!n||"hidden"===n.visibilityState||Date.now()-(null!==(e=this.od)&&void 0!==e?e:0)<s||(this.rd=this.td||!this.Mr.idleRefreshBackoff?i:Math.min(2*s,36e5),this.td=!1,this.reloadFeatureFlags(),this.ld())},this.ad=()=>{this.td&&this.rd===this.sd||this.ud()},this.an=()=>{"visible"===(null==n?void 0:n.visibilityState)&&this.ud()},"get"in t?this.yo=t:(this._instance=t,this.hd=new sk(t.config,t.Xl()),this.yo=this.hd)}updateConfig(t,e){var i;null===(i=this.hd)||void 0===i||i.update(t,e),this.po&&this.dd()}setup(t){return this.xh=t,this.$=t.logger.createLogger("[FeatureFlags]"),zw(t.kv.initialize(),()=>{this.xh===t&&(this.xh=void 0,this.po=t,this.vd(t))})}vd(e){var i;if(this.po===e)return t&&er(t,"online",this.sn),this.dd(),this.fd=e.registerDynamicEventProperties(()=>this.pd()?this.zc:this.Uc),this.gd=null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.md(),this.yd(),this.bd()}),this.yd(),this.initialize()}ud(){this.td=!0,this.rd=this.sd,this.nd()}dd(){const t=this.Mr.refreshIntervalMs,e=!this.Mr.remoteRequestsDisabled&&n&&!Ce(t)&&t>0?t:void 0;this.Mr.idleRefreshBackoff||(this.rd=e),e!==this.sd&&(this._d(),Ce(e)||(this.sd=e,this.rd=e,this.ld(),(null==n?void 0:n.addEventListener)&&(er(n,Jt,this.an),Vs(ak,t=>{er(n,t,this.ad,{capture:!0})}))))}ld(){Ce(this.sd)||(Ce(this.wd)||clearInterval(this.wd),this.od=Date.now(),this.wd=setInterval(this.nd,this.sd))}_d(){var t;Ce(this.wd)||(clearInterval(this.wd),this.wd=void 0,null==n||null===(t=n.removeEventListener)||void 0===t||t.call(n,"visibilitychange",this.an),Vs(ak,t=>{var e;null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,t,this.ad,{capture:!0})})),this.sd=void 0,this.rd=void 0,this.td=!1,this.od=void 0}destroy(){this.kd()}dispose(){this.kd()}kd(){var e,i;this._d(),this.Zc++,this.Jc=!1,this.xh=void 0,this.po&&(this.Sd(),null===(e=this.fd)||void 0===e||e.dispose(),this.fd=void 0,null===(i=this.gd)||void 0===i||i.call(this),this.gd=void 0,this.Wc=[],null==t||t.removeEventListener("online",this.sn),this.po=void 0)}get Mr(){return this.yo.get()}xd(t){var e;return this.Cd&&t in this.Cd?this.Cd[t]:null===(e=this.po)||void 0===e?void 0:e.kv.get(t)}md(){return!!this.Cd&&(this.Cd=void 0,!0)}$d(){var t;return!Ce(null===(t=this.po)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.md()}At(t){this.Td(()=>{var e;return null===(e=this.po)||void 0===e?void 0:e.kv.set(t)})}Id(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.xd("$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.xd("$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.Td(()=>{var e;return null===(e=this.po)||void 0===e?void 0:e.kv.remove(t)})}Td(t){try{t()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}yd(){const t={};for(const e of[K,tt,et,nt]){const i=this.xd(e);Ce(i)||(t[e]=i)}this.zc=t;const e=le({},t),i=this.xd(J);if(i)for(const[t,n]of Object.entries(i))e[`$feature/${t}`]=n;this.Uc=e}pd(){const t=this.Mr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.xd(St);return"number"!=typeof e||Date.now()-e>t}Md(){return!!this.pd()&&(this.Xc||this.Gc||(this.Xc=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ed(){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}):[]}Pd(){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.Rd({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.xd("$enabled_feature_flags"))&&void 0!==n?n:{},o=(null==i?void 0:i.merge)&&null!==(s=this.xd("$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:ts(e),variant:es(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.Rd({flags:u})}get hasLoadedFlags(){return this.Vc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.xd(X),e=this.xd(nt),i=this.xd(st);if(!i&&!e)return t||{};const n=Zs({},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.Hc||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:n}),this.Hc=!0),n}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(i=>{const n=t[i];return{key:i,enabled:ts(n),variant:es(n),payload:Xn(e[i])}})}getFlagVariants(){const t=this.xd(J),e=this.xd(nt);if(!e)return t||{};const i=Zs({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.Hc||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Hc=!0),i}getFlagPayloads(){const t=this.xd(tt),e=this.xd(st);if(!e)return t||{};const i=Zs({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.Hc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Hc=!0),i}reloadFeatureFlags(){this.Qc||this.Mr.featureFlagsDisabled||this.ed()||(this.Gc&&(this.Jc=!0),this.Ad||(this.Wc.slice().forEach(t=>{try{t()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.Ad=setTimeout(()=>{this.Fd()},5)))}Sd(){clearTimeout(this.Ad),this.Ad=void 0}onReloading(t){return this.Wc.push(t),()=>{this.Wc=this.Wc.filter(e=>e!==t)}}ensureFlagsLoaded(){this.Vc||this.Gc||this.Ad||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Qc=t}resetFlagCallReported(){this.Lt(bt)}Fd(t){this.Sd();const e=this.po;if(!e||this.Mr.remoteRequestsDisabled||this.ed())return;if(this.Gc)return void(this.Jc=!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.xd("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.xd(ot),timezone:Da()};Ce(e.deviceId)||(i.$device_id=e.deviceId),((null==t?void 0:t.disableFlags)||this.Mr.featureFlagsDisabled)&&(i.disable_flags=!0);const n=this.Ed();n.length&&(i.evaluation_contexts=n);const s=this.Pd();Ce(s)||(i.flag_keys=s);const r=this.Mr.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),l=this.Zc;this.Gc=!0;const a=()=>{this.Jc&&(this.Jc=!1,this.Fd())},u=t=>{var e,n;const s=null!==(e=t.json)&&void 0!==e?e:{},o=200!==t.statusCode;if(this.Gc=!1,l!==this.Zc)return void a();if(this.Od(t.statusCode),o||this.Jc||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.Jc)return;this.Kc=!o;const u=[];t.error?u.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?uk:"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.Rd(s,o,{partialResponse:r}),a()},h=t=>{this.Gc=!1,l===this.Zc?(this.At({[kt]:[uk]}),this.$.error("Feature flag request failed",t),this.$d()&&this.bd(!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)}}ed(){return hr(this.Yc,3)}Od(t){this.Yc=cr(t,this.Yc,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.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+t+lk);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.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+t+lk);if(this.Md())return;const i=this.getFlagVariants(),n=t in i,s=i[t],r=this.getFlagPayloads()[t],o=String(s),l=this.xd("$feature_flag_request_id")||void 0,a=this.xd("$feature_flag_evaluated_at")||void 0;let u,h=this.xd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var c;const t=null===(c=this.po)||void 0===c?void 0:c.session.sessionId,e=this.xd(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({[bt]: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({[bt]:h},u?{[wt]:u}:{}));const e=this.getFeatureFlagDetails(t),i=[...null!==(d=this.xd("$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.Kc};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!==(_=null==e||null===(b=e.reason)||void 0===b?void 0:b.description)&&void 0!==_?_:null==e||null===(w=e.reason)||void 0===w?void 0:w.code;var x;c&&(n.$feature_flag_reason=c),(null==e||null===(k=e.metadata)||void 0===k?void 0:k.id)&&(n.$feature_flag_id=e.metadata.id),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.Dd(n)}else u&&this.At({[bt]:h,[wt]:u});return n?{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:Xn(r)}:void 0}Dd(t){try{var e;null===(e=this.po)||void 0===e||e.capture("$feature_flag_called",t).catch(t=>{this.$.error("Failed to capture feature flag call",t)})}catch(t){this.$.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,e){this.Ld(t,e)}Ld(t,e){var i=this;return ne(function*(){const n=i.po;if(!n)return;const s={distinct_id:n.distinctId,token:n.projectToken,person_properties:{$lib:n.library.name,$lib_version:n.library.version}},r=i.Ed();r.length&&(s.evaluation_contexts=r);const o=i.Pd();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.Kc)return e.defaultValue;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+lk),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.Rd(t,e,i)}Rd(t,e,i){if(!this.po)return;this.Vc=!0;const n=((t,e={},i={},n={},s,r=rk)=>{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(ck(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.po.kv.get(J));this.Cd=n,t||this.At(n)}else this.md(),this.Id(n,t,!!(null==i?void 0:i.partialResponse)),this.At(n);else e&&this.$d();e||(this.Xc=!1),this.bd(e)}override(t,e=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.Nd(t)}Nd(t){if(this.po){if(!1===t)return this.Lt([nt,st]),this.bd(),void ok.info("All overrides cleared");if(we(t))return this.At({[nt]:hk(t)}),this.bd(),void ok.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e;const i=t;this.Hc=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);const n={},s=i.flags,r=i.payloads;return s&&(n[nt]=we(s)?hk(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.bd(),!1===s?ok.info("Flag overrides cleared"):s&&ok.info("Flag overrides set",{flags:s}),void(!1===r?ok.info("Payload overrides cleared"):r&&ok.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.At({[nt]:t}),this.bd(),void ok.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.Vc){const{flags:e,flagVariants:i}=this.qd();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.xd("$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(ck(l)),[J]:l,[rt]:le(le({},this.xd("$stored_person_properties")||{}),r)}),this.bd();try{var a;null===(a=this.po)||void 0===a||a.capture("$feature_enrollment_update",o).catch(t=>{this.$.error("Failed to capture early access feature enrollment",t)})}catch(t){this.$.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,e=!1,i){const n=this.xd(Y);!n||e?this.jd(t,i):t(n)}jd(t,e){var i=this;return ne(function*(){const n=i.po;if(!n)return;const s=e?`&${e.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${s}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,i.At({[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)}})()}qd(){const t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(t=>e[t]),flagVariants:Object.keys(e).filter(t=>e[t]).reduce((t,i)=>(t[i]=e[i],t),{})}}bd(t){this.yd();const{flags:e,flagVariants:i}=this.qd();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.Bd(t,e)}Bd(t,e=!0){const i=this.xd("$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.xd("$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.xd("$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.xd("$stored_group_properties")||{};this.At({[ot]:le(le({},e),{},{[t]:{}})})}else this.Lt(ot)}reset(){this.Zc++,this.Jc=!1,this.zc={},this.Uc={},this.Cd=void 0,this.Vc=!1,this.Qc=!1,this.Kc=!1,this.$anon_distinct_id=void 0,this.Sd(),this.Hc=!1,this.Yc=0}}},Rk={sessionRecording:class{get Mr(){return this._instance.config}get xa(){return this._instance.persistence}get started(){var t;return!!(null===(t=this.Hd)||void 0===t?void 0:t.isStarted)}get status(){var t,e;return"awaiting_config"===this.zd||"missing_config"===this.zd?this.zd:null!==(t=null===(e=this.Hd)||void 0===e?void 0:e.status)&&void 0!==t?t:this.zd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.zd=co,this.Ud=void 0,this.Wd=!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.Hd)||void 0===t||null===(e=t.setDocumentWasEverVisible)||void 0===e||e.call(t,!0))},!this._instance.sessionManager)throw Dw.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)&&er(n,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.Wd=!0,null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,"visibilitychange",this.an),t?this.Vd(!0):this.stopRecording()}get Gd(){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.Wd)return;if(this.Gd&&(null===(e=this.Hd)||void 0===e?void 0:e.isStarted))return;const i=!Ce(Object.assign)&&!Ce(Array.from);this.Gd&&i?(this.Zd(t),Dw.info("starting")):(this.zd=co,this.stopRecording())}Zd(t){var e,i;if(this.Gd)if("awaiting_config"!==this.zd&&"missing_config"!==this.zd&&(this.zd=mo),(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.Wd&&this.Gd&&this._instance.sessionManager===e)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Dw.error("could not load recorder",i)):void this.Qd(t);this.zd="disabled"})}}stopRecording(){var t,e;null===(t=this.Ud)||void 0===t||t.call(this),this.Ud=void 0,null===(e=this.Hd)||void 0===e||e.stop()}Vd(t=!1){var e,i;null===(e=this.Ud)||void 0===e||e.call(this),this.Ud=void 0,null===(i=this.Hd)||void 0===i||i.discard({discardProducerEvents:t})}Kd(){var t,e;null===(t=this.xa)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this.xa)||void 0===e||e.unregister("$replay_sample_rate")}Xd(t,e){if(Ie(t))return null;const i=Me(t)?t:parseFloat(t);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(Dw.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):i;var n}Yd(t){if(this.xa){var e,i;const n=this.xa,s=()=>{var e;const i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Xd(null===(e=this.Mr.session_recording)||void 0===e?void 0:e.sampleRate,"session_recording.sampleRate"),r=this.Xd(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:r;Ie(o)&&this.Kd();const l=null==i?void 0:i.minimumDurationMilliseconds;n.register({[O]: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.Ud)||void 0===e||e.call(this),this.Ud=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.Yd(e),void this.Vd()):(this.Yd(e),void this.startIfEnabledOrStop()):("awaiting_config"===this.zd&&(this.zd="missing_config",Dw.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var i;(null===(i=this.Hd)||void 0===i?void 0:i.log)?this.Hd.log(t,e):Dw.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(O);return(null==i||null===(e=i.scriptConfig)||void 0===e?void 0:e.script)||"lazy-recorder"}tv(){const t=this._instance.get_property(O);if(!t)return!1;let e;try{e="object"==typeof t?t:JSON.parse(t)}catch(t){return Dw.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!Ie(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}Qd(t){var e,i,n;if(!this.Wd&&this.Gd&&this._instance.sessionManager){if(!(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))return Dw.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Ft]:!0});var s;if(this.Hd||(this.Hd=null===(s=d.__PosthogExtensions__)||void 0===s?void 0:s.initSessionRecording(this._instance,this.Ke),this.Hd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.tv()){if("missing_config"===this.zd||"awaiting_config"===this.zd)return;return this.zd="awaiting_config",Dw.info("persisted remote config is stale, requesting fresh config before starting"),void new wb(this._instance).load()}this.zd=mo,null===(i=(n=this.Hd).setDocumentWasEverVisible)||void 0===i||i.call(n,this.Ke),this.Hd.start(t)}else this.zd=co}onRRwebEmit(t){var e,i;null===(e=this.Hd)||void 0===e||null===(i=e.onRRwebEmit)||void 0===i||i.call(e,t)}overrideLinkedFlag(){var t,e;this.Hd||null===(e=this.xa)||void 0===e||e.register({$replay_override_linked_flag:!0}),null===(t=this.Hd)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Hd||null===(e=this.xa)||void 0===e||e.register({$replay_override_sampling:!0}),null===(t=this.Hd)||void 0===t||t.overrideSampling()}overrideTrigger(t){var e,i;this.Hd||null===(i=this.xa)||void 0===i||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(e=this.Hd)||void 0===e||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null===(t=this.Hd)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!!(null===(i=this.Hd)||void 0===i?void 0:i.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;null===(t=this.Hd)||void 0===t||null===(e=t.flushBeforeIdentityReset)||void 0===e||e.call(t)}}},Pk={autocapture:class extends E_{constructor(t){super(new Ew(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.ev=this.iv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.nv();return!!(t.path||t.search||this.sv(t))}startIfEnabled(){this.isEnabled&&(zs.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.ev=this.iv(),this.startIfEnabled()}stop(){this.rv&&this.rv(),this.rv=void 0,this.ov&&this.ov(),this.ov=void 0,zs.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.lv("pushState"),this.lv("replaceState"),this.av(),this.sv()&&this.uv())}lv(e){var i;if(!t||(null===(i=t.history[e])||void 0===i?void 0:i.__posthog_wrapped__))return;const n=this;_v(t.history,e,t=>function(i,s,r){t.call(this,i,s,r),n.hv(e)})}iv(){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}}nv(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:Se(t)?t:{}}sv(t=this.nv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}dv(t){const e=this.nv(),i=this.ev;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.sv(e)&&t.hash!==i.hash))}hv(t){try{const e=this.iv();if(!e)return;this.dv(e)&&this._instance.capture(Yt,{navigation_type:t}),this.ev=e}catch(e){zs.error(`Error capturing ${t} pageview`,e)}}av(){if(this.rv)return;const e=()=>{this.hv("popstate")};er(t,"popstate",e),this.rv=()=>{t&&t.removeEventListener("popstate",e)}}uv(){if(this.ov)return;const e=()=>{this.hv("hashchange")};er(t,"hashchange",e),this.ov=()=>{t&&t.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(t){var e;this.vv=!1,this.bo=!1,this.fv=null,this.instance=t,this.vv=!!(null===(e=this.instance.persistence)||void 0===e?void 0:e.props[S]),this.rageclicks=new k_(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 Ie(this.Mr.capture_heatmaps)?Ie(this.Mr.enable_heatmaps)?this.vv:this.Mr.enable_heatmaps:!1!==this.Mr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.bo)return;Lw.info("starting..."),this.pv(),this.an()}else{var t;clearInterval(null!==(t=this.fv)&&void 0!==t?t:void 0),this.gv(),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.vv=i,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}mv(t){Nw(t.originalEvent)&&this.Cr(t.originalEvent,"deadclick")}an(){this.fv&&clearInterval(this.fv),this.fv="visible"===(null==n?void 0:n.visibilityState)?setInterval(this.fa.bind(this),this.flushIntervalMilliseconds):null}pv(){t&&n&&(this.yv=this.fa.bind(this),er(t,Kt,this.yv),this.bv=e=>this.Cr(e||(null==t?void 0:t.event)),er(n,"click",this.bv,{capture:!0}),this._v=e=>this.wv(e||(null==t?void 0:t.event)),er(n,"mousemove",this._v,{capture:!0}),this.Sv=new G_(this.instance,W_,this.mv.bind(this)),this.Sv.startIfEnabledOrStop(),this.xv=this.an.bind(this),er(n,Jt,this.xv),this.bo=!0)}gv(){var e;t&&n&&(this.yv&&t.removeEventListener(Kt,this.yv),this.bv&&n.removeEventListener("click",this.bv,{capture:!0}),this._v&&n.removeEventListener("mousemove",this._v,{capture:!0}),this.xv&&n.removeEventListener(Jt,this.xv),clearTimeout(this.Cv),null===(e=this.Sv)||void 0===e||e.stop(),this.bo=!1)}$v(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&&pr(s)&&!gr(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=Er(s)}return!1}(xr(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(fr(t.target)||!Nw(t))return;const n=this.$v(t,e);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&Lr(xr(t),this.instance.config.rageclick)&&this.Zs(le(le({},n),{},{type:"rageclick"})),this.Zs(n)}wv(t){!fr(t.target)&&Nw(t)&&(clearTimeout(this.Cv),this.Cv=setTimeout(()=>{this.Zs(this.$v(t,"mousemove"))},500))}Zs(e){if(!t)return;const i=this.Mr.disable_capture_url_hashes?rn(t.location.href):t.location.href,n=this.Mr.custom_personal_data_properties,s=this.Mr.mask_personal_data_properties?[...Sa,...n||[]]:[],r=ar(i,s,Ca);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}fa(){this.Rt&&!xe(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:G_,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.vv=!1,this.bo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Tv=()=>{clearTimeout(this.Iv),this.Iv=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.Mv=t=>{var e;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Ie(null==t?void 0:t.name)||Ie(null==t?void 0:t.value))return void Rw.error("Invalid metric received",t);const i="string"==typeof t.navigationURL?t.navigationURL:void 0,n=this.Ev(i);if(Ce(n))return;const s=Me(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${n}`;if(this.Pv&&t.value>=this.Pv)return void Rw.error("Ignoring metric with value >= "+this.Pv,t);this.Rt.navigationKey!==s&&(this.Tv(),this.Iv=setTimeout(this.Tv,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 Fw){const n="url"===i&&"string"==typeof t.attribution[i]?this.Ev(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.Tv()},this.Rv=()=>{if(this.bo)return;let t,e,i,n,s=!1;const r=d.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,l=(null==o?void 0:o[this.Av])||("web-vitals"===this.Av&&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 Rw.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.Mv.bind(this),a),this.allowedMetrics.indexOf("CLS")>-1&&e(this.Mv.bind(this),a),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Mv.bind(this),a),this.allowedMetrics.indexOf("INP")>-1&&n(this.Mv.bind(this),u),this.bo=!0},this.vv=!!(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[E]),this.startIfEnabled()}get Fv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const i=Se(this.Fv)?null===(t=this.Fv)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return Ie(i)?(null===(e=this._instance.persistence)||void 0===e?void 0:e.props.$web_vitals_allowed_metrics)||Ow:i}get flushToCaptureTimeoutMs(){return(Se(this.Fv)?this.Fv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=Se(this.Fv)?this.Fv.web_vitals_attribution:void 0;return Pe(t)?t?Ow:[]:we(t)?t:Aw}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=Se(this.Fv)?this.Fv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Pv(){const t=Se(this.Fv)&&Me(this.Fv.__web_vitals_max_value)?this.Fv.__web_vitals_max_value:Pw;return t>0&&6e4>=t?Pw:t}get isEnabled(){const t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Rw.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=Se(this.Fv)?this.Fv.web_vitals:Pe(this.Fv)?this.Fv:void 0;return Pe(e)?e:this.vv}startIfEnabled(){this.isEnabled&&!this.bo&&(Rw.info("enabled, starting..."),this.No(this.Rv))}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({[E]:i}),this._instance.persistence.register({[P]:n})),this.vv=i,this.startIfEnabled()}get Av(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}No(t){var e;const i=d.__PosthogExtensions__,n=this.Av,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?Rw.error("failed to load script",e):t()})}Ev(e){const i=e||(null==t?void 0:t.location.href);if(!i)return void Rw.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?rn(i):i,s=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Sa,...s||[]]:[];return ar(n,r,Ca)}}},Ok={exceptionObserver:class{constructor(e){var i;this.Rv=()=>{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.Ov&&this.Mr.capture_unhandled_errors&&(this.Ov=i(this.captureException.bind(this))),!this.Dv&&this.Mr.capture_unhandled_rejections&&(this.Dv=n(this.captureException.bind(this))),!this.Lv&&this.Mr.capture_console_errors&&(this.Lv=s(this.captureException.bind(this)))}catch(t){Iw.error("failed to start",t),this.Nv()}},this._instance=e,this.qv=!!(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,$:Iw})),this.Mr=this.jv(),this.startIfEnabledOrStop()}jv(){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.qv: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?(Iw.info("enabled"),this.Nv(),this.No(this.Rv)):this.Nv()}No(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"exception-autocapture",e=>{if(e)return Iw.error("failed to load script",e);t()})}Nv(){var t,e,i;null===(t=this.Ov)||void 0===t||t.call(this),this.Ov=void 0,null===(e=this.Dv)||void 0===e||e.call(this),this.Dv=void 0,null===(i=this.Lv)||void 0===i||i.call(this),this.Lv=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.qv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[x]:this.qv}),this.Mr=this.jv(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.jv()}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 Iw.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.Bv=[],this.Hv=_m(),this._instance=t,this.Bv=null!==(e=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==e?e:[],this.zv=Jn(this.Uv()),this.Wv=new Kn(this.zv)}onConfigChange(){this.zv=Jn(this.Uv()),this.Wv.setConfig(this.zv)}onRemoteConfig(t){var e,i,n;if(!t.ok)return;const s=t.config;if(!("errorTracking"in s))return;const r=null!==(e=null===(i=s.errorTracking)||void 0===i?void 0:i.suppressionRules)&&void 0!==e?e:[],o=null===(n=s.errorTracking)||void 0===n?void 0:n.captureExtensionExceptions;this.Bv=r,this._instance.persistence&&this._instance.persistence.register({[C]:this.Bv,[T]:o})}get Vv(){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.Hv.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.zv.enabled)try{if(!$e(t)||0===t.trim().length)return void fm.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.Gv(e));n.length>0&&fm.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Wv.add(le({[Vn]:t,[Gn]:(new Date).toISOString()},i))}catch(t){fm.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.Zv(e)){if(this.Qv(e))return this.Jv("Exception dropped: matched a suppression rule"),void fm.info("Skipping exception capture because a suppression rule matched");if(!this.Vv&&this.Kv(e))return this.Jv("Exception dropped: thrown by a browser extension"),void fm.info("Skipping exception capture because it was thrown by an extension");if(!this.Vv&&this.Xv(e))return this.Jv("Exception dropped: thrown by an injected browser script"),void fm.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Yv(e))return this.Jv("Exception dropped: thrown by the PostHog SDK"),void fm.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this.zv.enabled&&Ie(t.$exception_steps)?this.tf(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",eh:!0});return t&&this.Wv.clear(),t}catch(t){return vm(t)||fm.error("Failed to capture exception event. Dropping this exception.",t),void this.Wv.clear()}}catch(t){return void(vm(t)||fm.error("Failed to process exception event. Ignoring this exception.",t))}}tf(t){try{const e=this.Wv.getAttachable();return 0===e.length?t:le(le({},t),{},{$exception_steps:e})}catch(e){return fm.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Jv(t){this.zv.enabled&&this.Wv.add({[Vn]:t,[Gn]:(new Date).toISOString()})}Gv(t){return Se(t)?le({},t):{}}Uv(){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.Bv.some(t=>{const i=t.values.map(t=>{const i=va[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 fm.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Kv(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&&mm.some(e=>t.startsWith(e)));return 0!==i.length&&(!i.every(({filename:t})=>!!t&&t.startsWith(pm))||t.some(({type:t,value:e})=>"NoResponse"===t||$e(e)&&gm.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(pm))))}Xv(t){return t.some(({value:t})=>$e(t)&&ym.some(e=>t.includes(e)))}Yv(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}Zv(t){return!Ie(t)&&we(t)}}},Ak=le({productTours:class{get xa(){return this._instance.persistence}constructor(t){this.ef=null,this.if=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if("productTours"in e){var i,n;if(this.xa&&this.xa.register({[M]:!!e.productTours}),!Bw(this._instance))return!this.ef&&Ie(null===(i=this.xa)||void 0===i?void 0:i.props.ph_product_tours)||qw.info("product tours disabled; stopping and clearing cached tours"),null===(n=this.ef)||void 0===n||n.stop(),this.ef=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.ef&&Bw(this._instance)&&this.No(()=>this.nf())}No(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"product-tours",e=>{e?qw.error("Could not load product tours script",e):t()})}nf(){var t;!this.ef&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.ef=d.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(we(this.if)&&!e)return void t(this.if,{isLoaded:!0});const i=this.xa;if(i){const n=i.props[vt];if(we(n)&&!e)return this.if=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(!Bw(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||qw.warn(i):qw.error(i),void t([],{isLoaded:!1,error:i})}const s=we(e.json.product_tours)?e.json.product_tours:[];this.if=s,i&&i.register({[vt]:s}),t(s,{isLoaded:!0})}})}getActiveProductTours(t){Ie(this.ef)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.ef.getActiveProductTours(t)}showProductTour(t){var e;null===(e=this.ef)||void 0===e||e.showTourById(t)}previewTour(t){this.ef?this.ef.previewTour(t):this.No(()=>{var e;this.nf(),null===(e=this.ef)||void 0===e||e.previewTour(t)})}dismissProductTour(){var t;null===(t=this.ef)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.ef)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.ef)||void 0===t||t.previousStep()}clearCache(){var t;this.if=null,null===(t=this.xa)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var e;null===(e=this.ef)||void 0===e||e.resetTour(t)}resetAllTours(){var t;null===(t=this.ef)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var e;null===(e=this.ef)||void 0===e||e.cancelPendingTour(t)}}},Mk),Fk={siteApps:class{constructor(t){this._instance=t,this.sf=0,this.rf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}lf(t,e){if(!e)return;const i=this.globalsForEvent(e);this.rf.push(i),this.rf.length>1e3&&(this.rf=this.rf.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.lf.bind(this));this.af=()=>{t(),this.rf=[],this.af=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({},gs(t,jw)),{},{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}}uf(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)||(Hw.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)||(Hw.error("prepare_external_dependency_script returned null"),null)}return t}hf(){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.sf++,this.cf)return this.df();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.uf(t);return e&&v.add(e),e},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!Ee(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.cf=()=>{c.forEach(t=>t()),this.cf=void 0},this.df()}df(){let t=!1;return()=>{var e;t||(t=!0,this.sf--,0===this.sf&&(null===(e=this.cf)||void 0===e||e.call(this)))}}vf(t,e=!0){const i=this.hf();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.rf.length&&(Hw.info(`Processing ${this.rf.length} events for site app with id ${t.id}`),this.rf.forEach(t=>this.vf(()=>{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.af)||void 0===i||i.call(this))};let n=!1;const s=s=>{e.errored=!s,e.loaded=!0,Hw.info(`Site app with id ${t.id} ${s?"loaded":"errored"}`),n&&i()};try{const{processEvent:i}=this.vf(e=>t.init({posthog:this._instance,callback(t){e(),s(t)}}),!1);i&&(e.processEvent=i),n=!0}catch(e){Hw.error(Uw+t.id,e),s(!1)}if(n&&e.loaded)try{i()}catch(i){Hw.error(`Error while processing buffered events PostHog app with config id ${t.id}`,i),e.errored=!0}}ff(){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)}pf(t){if(0===Object.keys(this.apps).length)return;const e=this.globalsForEvent(t);for(const i of Object.values(this.apps))try{this.vf(()=>{var t;return null===(t=i.processEvent)||void 0===t?void 0:t.call(i,e)})}catch(e){Hw.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.ff(),void this._instance.on("eventCaptured",t=>this.pf(t))):void Hw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this.af)||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 Hw.error(Uw+t,e)})}else Hw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Dk={tracingHeaders:class{constructor(t){this._instance=t,this.gf=void 0,this.mf=void 0,this.yf=void 0,this.Rv=()=>{const t=this.bf();var e,i;t?(Ce(this.gf)&&(this.gf=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.mf)&&(this.mf=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.Nv()}}initialize(){this.startIfEnabledOrStop()}No(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.tracingHeadersPatchFns)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"tracing-headers",e=>{if(e)return Mw.error("failed to load script",e);t()})}_f(){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}bf(){const t=this._f();return we(t)?(we(this.yf)?this.yf.splice(0,this.yf.length,...t):this.yf=[...t],t.length>0?this.yf:void 0):(we(this.yf)&&this.yf.splice(0),this.yf=t||void 0,this.yf)}Nv(){var t,e;null===(t=this.gf)||void 0===t||t.call(this),null===(e=this.mf)||void 0===e||e.call(this),this.gf=void 0,this.mf=void 0}startIfEnabledOrStop(){this.bf()?this.No(this.Rv):this.Nv()}}},Lk=le({surveys:class extends Gw{constructor(t){var e;super(new Xw(t),(e=t,{get projectToken(){return e.config.token},kv:new Yw(e)})),this._instance=t}Mh(t,e){const i=e.query?Eb(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})})}}},Mk),Nk={toolbar:class{constructor(t){this.instance=t}wf(t){d.ph_toolbar_state=t}kf(){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(ir(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=tk||ur(e.hash,"__posthog")||ur(e.hash,"state");let r;const o=n?on(()=>JSON.parse(atob(decodeURIComponent(n))))||on(()=>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(ek)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Sf(t){const e=d.ph_load_toolbar||d.ph_load_editor;!Ie(e)&&ke(e)?e(t,this.instance):ik.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(ek,JSON.stringify(le(le({},r),{},{source:void 0}))),2===this.kf())this.Sf(r);else if(0===this.kf()){var o,l;this.wf(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 ik.error("[Toolbar] Failed to load",t),void this.wf(0);this.wf(2),this.Sf(r)}),er(t,"turbolinks:load",()=>{this.wf(0),this.loadToolbar(r)})}return!0}xf(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,i=void 0){return this.maybeLoadToolbar(t,e,i)}}},qk=le({experiments:class e{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.Cf("retrieved web experiments from the server"),this.$f=new Map,t.forEach(t=>{if(t.feature_flag_key){var i;this.$f&&(e.Cf("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=this.$f)||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.Tf(t.name,n,t.variants[n].transforms)}else if(t.variants)for(const i in t.variants){const n=t.variants[i];e.If(n,this._instance)&&this.Tf(t.name,i,n.transforms)}})},t)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.Cf(dk);else if(!this.Mr.disable_web_experiments){if(Ie(this.$f))return this.$f=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Cf("applying feature flags",t),t.forEach(t=>{var e;if(this.$f&&(null===(e=this.$f)||void 0===e?void 0:e.has(t))){var i;const e=this._instance.getFeatureFlag(t),n=null===(i=this.$f)||void 0===i?void 0:i.get(t);e&&(null==n?void 0:n.variants[e])&&this.Tf(n.name,e,n.variants[e].transforms)}})}}previewWebExperiment(){const t=e.getWindowLocation();if(null==t?void 0:t.search){const i=lr(null==t?void 0:t.search,"__experiment_id"),n=lr(null==t?void 0:t.search,"__experiment_variant");i&&n&&(e.Cf(`previewing web experiments ${i} && ${n}`),this.getWebExperiments(t=>{this.Mf(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||[])})}Mf(t,i,n){const s=n.filter(e=>e.id===t);s&&s.length>0&&(e.Cf(`Previewing web experiment [${s[0].name}] with variant [${i}]`),this.Tf(s[0].name,i,s[0].variants[i].transforms))}static If(t,i){return!Ie(t.conditions)&&e.Ef(t,i)&&e.Pf(t)}static Ef(t,i){var n;if(Ie(t.conditions)||Ie(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=dr(i,s.href);return!(null===(r=t.conditions)||void 0===r?void 0:r.url)||vk[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 Pf(t){var e;if(Ie(t.conditions)||Ie(null===(e=t.conditions)||void 0===e?void 0:e.utm))return!0;const i=Ta();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 Cf(t,...e){zs.info(`[WebExperiments] ${t}`,e)}Tf(t,i,n){this._is_bot()?e.Cf(dk):"control"!==i?n.forEach(n=>{if(n.selector){var s;e.Cf(`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.Cf("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?Jb(i,this.Mr.custom_blocked_useragents):void 0}}},Mk),Bk={conversations:class{constructor(t){this._instance=t,this.Rf=void 0,this._conversationsManager=null,this.Af=!1,this.ne=null,this.Ff=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return;if(this.Of=t.ok,!t.ok)return;const e=t.config.conversations;Ie(e)||(Pe(e)?this.Rf=e:(this.Rf=e.enabled,this.ne=e),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.Rf=void 0,this.ne=null,this.Of=void 0,this.Ff=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this.Af)return;if(this._instance.config.disable_conversations)return;if(ir(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.Rf)&&this.Rf)if(this.ne&&this.ne.token){this.Af=!0;try{const e=t.initConversations;if(e)return this.Df(e),void(this.Af=!1);const i=t.loadExternalDependency;if(!i)return void this.Lf(Vt);i(this._instance,"conversations",e=>{e||!t.initConversations?this.Lf("Could not load conversations script",e):this.Df(t.initConversations),this.Af=!1})}catch(t){this.Lf("Error initializing conversations",t),this.Af=!1}}else fk.error("Conversations enabled but missing token in remote config.")}Df(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.Ff=!1,fk.info("Conversations loaded successfully")}catch(t){this.Lf("Error completing conversations initialization",t)}else fk.error("Cannot complete initialization: remote config is null")}Lf(t,e){fk.error(t,e),this._conversationsManager=null,this.Af=!1,this.Ff=!0}show(){this._conversationsManager?this._conversationsManager.show():fk.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Rf&&!Ee(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":ir(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Of?"remote_config_failed":Ce(this.Rf)?this.Of?"disabled_in_project":"remote_config_pending":this.Rf?Ie(this.ne)||!this.ne.token?"missing_token":(null==d?void 0:d.__PosthogExtensions__)?this.Af?"initializing":this.Ff?"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):(fk.warn(pk),null)})()}getMessages(t,e){var i=this;return ne(function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(fk.warn(pk),null)})()}markAsRead(t){var e=this;return ne(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(fk.warn(pk),null)})()}getTickets(t){var e=this;return ne(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(fk.warn(pk),null)})()}requestRestoreLink(t){var e=this;return ne(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(fk.warn(pk),null)})()}restoreFromToken(t){var e=this;return ne(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(fk.warn(pk),null)})()}restoreFromUrlToken(){var t=this;return ne(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(fk.warn(pk),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}dh(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}fh(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}}},jk={logs:class{constructor(e){var i;this._instance=e,this.name=Rp,this.Nf=!1,this.qf=!1,this.jf=!1,this.$=Ws("[logs]"),this.Bf=le(le({},this.$),{},{error:(...t)=>{t.some(wk)||this.$.error(...t)}}),this.ia=[],this.Hf=[],this.Yc=0,this.So=!1,this.zf=[],this.Uf=[],this.Wf=!1,this.Vf=!1,this.Gf=()=>{var t,e;this.So||(this.Yc=0,null===(t=this.Zf)||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.Nf=!0),t&&er(t,"online",this.Gf)}Jf(t,e,i,n){var s;const r=gk(null===(s=this._instance)||void 0===s||null===(s=s.config)||void 0===s?void 0:s.logs,i);return[new Fs(this.Kf(t,e),r,this.Bf,()=>this.Xf(),t=>t(),void 0,n),r]}Yf(){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.Zf&&this.tp===e||(null===(i=this.Zf)||void 0===i||i.reset(),this.tp=e,[this.Zf,this.ep]=this.Jf(()=>this.ia,t=>{this.ia=t})),this.Zf}np(){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.sp===e||(null===(i=this.Qf)||void 0===i||i.reset(),this.sp=e,[this.Qf,this.rp]=this.Jf(()=>this.Hf,t=>{this.Hf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},yk)),this.Qf}setup(t){var e;if(this.So)return;this.po=t,(null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.logs)||void 0===e?void 0:e.captureConsoleLogs)&&(this.Nf=!0),(this.Nf||this.op()&&this.lp())&&this.ap();let i=!1;const n=t.onRemoteConfig(t=>{var e;i=t.ok&&!0===(null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs),this.onRemoteConfig(t)});this.So?n.dispose():(this.$o=n,i||this.loadIfEnabled())}dispose(){var e,i,n,s;this.So||(this.So=!0,this.up(),null===(e=this.$o)||void 0===e||e.dispose(),this.$o=void 0,this.po=void 0,this.jf=!1,null==t||t.removeEventListener("online",this.Gf),null===(i=this.hp)||void 0===i||i.call(this),this.hp=void 0,null===(n=this.Zf)||void 0===n||n.reset(),null===(s=this.Qf)||void 0===s||s.reset())}onRemoteConfig(t){var e,i;if(this.So)return;const n=t.ok?null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs:void 0;Ie(n)?this.cp():(null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$logs_capture_enabled_server_side:!!n}),n?(this.Nf=!0,this.qf||this.ap(),this.loadIfEnabled()):this.cp())}reset(){var t,e,i,n;this.up(),null===(t=this.Zf)||void 0===t||t.clearQueue(),this.ia=[],null===(e=this.Zf)||void 0===e||e.reset(),null===(i=this.Qf)||void 0===i||i.clearQueue(),this.Hf=[],null===(n=this.Qf)||void 0===n||n.reset(),this.Yc=0}captureLog(t){this.So||this.Yf().captureLog(t)}captureConsoleLog(t){this.So||this.np().captureLog(t)}captureBufferedConsoleLog(t,e,i){this.So||this.np().captureLog(t,{context:e,occurredAtMs:i})}lp(){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[R])}op(){var t,e,i;return!(null===(t=this._instance)||void 0===t||null===(e=t.Xl)||void 0===e?void 0:e.call(t))||!!(null===(i=d._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[this._instance.config.token])||void 0===i?void 0:i.config)}gh(){var t;this.up(),null===(t=this.Qf)||void 0===t||t.clearQueue(),this.Hf=[]}cp(){this.Nf||this.up()}ap(){var t;if(this.Wf||!(null==d?void 0:d.console))return;const e=gk(null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs).maxBufferSize;let i=!0;this.Uf.push(()=>{i=!1});for(const t of mk){let n;try{n=tm(d.console[t])}catch(t){continue}n&&this.Uf.push(_v(d.console,t,s=>{const r=(...n)=>{try{i&&this.dp(t,n,e)}catch(t){}return s.apply(d.console,n)};return r.__rrweb_original__=n,r}))}this.Wf=!0,this.vp=setTimeout(()=>{this.up()},3e4)}dp(t,e,i){var n;if(this.Wf&&!this.Vf&&0!==e.length)if(null===(n=this._instance)||void 0===n?void 0:n.is_capturing()){if(i>this.zf.length){this.Vf=!0;try{this.zf.push({level:t,args:e,occurredAtMs:Date.now(),context:this.Xf()})}finally{this.Vf=!1}}}else this.up()}up(){if(this.zf=[],this.Wf){this.Wf=!1,this.vp&&(clearTimeout(this.vp),this.vp=void 0);for(const t of this.Uf)t();this.Uf=[]}}fp(){const t=this.zf;return this.up(),t}get logger(){return this.pp||(this.pp={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.pp}flushLogs(t){t?this.gp(t):(this.Zf&&this.Zf.flush().catch(t=>this.mp(t)),this.Qf&&this.Qf.flush().catch(t=>this.mp(t)))}mp(t){wk(t)||this.$.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.So||!this.Nf||this.qf||this.jf)return;const t=null==d?void 0:d.__PosthogExtensions__;if(!t)return this.$.error("PostHog Extensions not found."),void this.up();const e=t.loadExternalDependency;if(!e)return this.$.error(Vt),void this.up();this.jf=!0;try{e(this._instance,"logs",e=>{if(this.jf=!1,this.So||!this.Nf)return;const i=t.logs;if(e||!(null==i?void 0:i.initializeLogs))this.$.error("Could not load logs script",e),this.up();else{var n;const t=this.fp();var s,r;this.hp=i.initializeLogs(null!==(n=this.po)&&void 0!==n?n:this._instance),this.qf=!0,t.length>0&&(null===(s=i.replayConsoleBuffer)||void 0===s||s.call(i,null!==(r=this.po)&&void 0!==r?r:this._instance,t))}})}catch(t){throw this.jf=!1,t}}Kf(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:[])},js:t=>this.js(t),getLibraryId:()=>Jl.LIB_NAME,getLibraryVersion:()=>Jl.LIB_VERSION}}js(t){return new Promise(e=>{if(hr(this.Yc,3))return void e({kind:"fatal",error:bk(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:bk(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.yp(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{const e=t.statusCode;if(this.bp(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:bk(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}`)})}}})})}bp(t){(0!==t||this._instance.__loaded)&&(this.Yc=cr(t,this.Yc,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.")))}gp(t){this.ia.length>0&&this._p(t,this.ia,this.ep,Jl.LIB_NAME,t=>{this.ia=t}),this.Hf.length>0&&this._p(t,this.Hf,this.rp,yk,t=>{this.Hf=t})}_p(t,e,i,n,s){if(0===e.length)return;const r=e.map(t=>t.record);s([]);const o=Rs(r,Ms(i,Jl.LIB_NAME,Jl.LIB_VERSION),n,Jl.LIB_VERSION);this._instance._send_request({method:"POST",url:this.yp(),data:o,compression:"best-available",batchKey:"logs",transport:t})}yp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Xf(){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,Ie(n)||(e.sessionStartTimestamp=n),Ie(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?rn(d.location.href):d.location.href),this._instance.featureFlags){const t=this._instance.featureFlags.getFlags();t&&t.length>0&&(e.activeFeatureFlags=t)}return e}}},Hk={metrics:class{constructor(t){this._instance=t,this.$=Ws("[metrics]"),this.So=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.So)return;const e=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);e&&!this.wp?this.wp=(t=>{let e=!0;const i=()=>e?(t=>{var e;const i=null===(e=t.config.metrics)||void 0===e?void 0:e.network;return!0===i?{}:i||void 0})(t):void 0,n=Ek(t,i),s=Ik(t,i);return()=>{e=!1,n(),s()}})(this._instance):!e&&this.wp&&(this.wp(),this.wp=void 0)}Yf(){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.Zf&&this.tp===e||(null===(i=this.Zf)||void 0===i||i.reset(),this.tp=e,this.Zf=new qs(this.Kf(),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.Zf}count(t,e=1,i){this.Yf().count(t,e,i)}gauge(t,e,i){this.Yf().gauge(t,e,i)}histogram(t,e,i){this.Yf().histogram(t,e,i)}flush(t){if(!this.Zf)return Promise.resolve();if(t){const e=this.Zf.drainWindow();return e&&this.Ys(e,t),Promise.resolve()}return this.Zf.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.Zf)||void 0===t||t.reset()}dispose(){var t,e;this.So=!0,null===(t=this.wp)||void 0===t||t.call(this),this.wp=void 0,null===(e=this.Zf)||void 0===e||e.reset()}Kf(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ys:t=>e.Ys(t),getLibraryId:()=>Jl.LIB_NAME,getLibraryVersion:()=>Jl.LIB_VERSION}}Ys(t,e){return new Promise(i=>{let n=!1;const s=t=>{n||(n=!0,clearTimeout(r),i(t))},r=setTimeout(()=>s({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(le(le({method:"POST",url:this.kp(),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}`)})}}}))})}kp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};Tw.__defaultExtensionClasses=le({},le(le(le(le(le(le(le(le(le(le(le(le(le({},Mk),Rk),Pk),Ok),Ak),Fk),Lk),Dk),Nk),qk),Bk),jk),Hk));const Uk=function(){Jl.SDK_DIST_CHANNEL="npm";const e=hw[bw]=new Tw;return function(){function e(){e.done||(e.done=!0,ww=!1,Gs(hw,function(t){t._dom_loaded()}))}(null==n?void 0:n.addEventListener)?"complete"===n.readyState?e():er(n,"DOMContentLoaded",e,{capture:!1}):t&&zs.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();var zk=Uk;export{ap as Compression,pb as DEFAULT_PRODUCT_TOUR_APPEARANCE,_p as DisplaySurveyType,Tw as PostHog,gb as ProductTourEventName,mb as ProductTourEventProperties,mp as SurveyEventName,yp as SurveyEventProperties,up as SurveyEventType,cp as SurveyPosition,pp as SurveyQuestionBranchingType,fp as SurveyQuestionType,gp as SurveySchedule,dp as SurveyTabPosition,vp as SurveyType,hp as SurveyWidgetType,zk as default,Uk as posthog,kb as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.full.js.map
|